twenty-sdk 2.56.0 → 2.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,75 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("@sniptt/guards"),n=require("uuid"),r=require("twenty-client-sdk/metadata"),i=require("twenty-client-sdk/rest");var a=`__twentySdkExecutionContext__`,o=`__twentySdkContextListeners__`,s=()=>(globalThis.__twentySdkContextListeners__||(globalThis[o]=new Set),globalThis[o]),c=()=>globalThis[a],l=e=>{s().add(e)},u=e=>{s().delete(e)},d=t=>{let[n,r]=(0,e.useState)(()=>t(c())),i=(0,e.useRef)(n);return(0,e.useEffect)(()=>{let e=()=>{let e=t(c());e!==i.current&&(i.current=e,r(e))};return l(e),e(),()=>u(e)},[t]),n},f=e=>e.locale??`en`,p=()=>d(f),m=e=>typeof e==`string`?{message:e}:e,h=e=>e.replace(/\s+/g,` `).trim(),g=e=>!(0,t.isUndefined)(e)&&!(0,t.isNull)(e);function _(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function v(e,...t){if(!_(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function y(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function b(e,t){v(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function x(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function S(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function ee(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function te(e){return typeof e==`string`&&(e=ee(e)),v(e),e}var ne=class{};function re(e){let t=t=>e().update(te(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ie(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function ae(e,t,n){return e&t^~e&n}function oe(e,t,n){return e&t^e&n^t&n}var se=class extends ne{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=S(this.buffer)}update(e){y(this),e=te(e),v(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=S(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){y(this),b(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,x(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ie(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=S(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},w=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ce=BigInt(2**32-1),le=BigInt(32);function ue(e,t=!1){return t?{h:Number(e&ce),l:Number(e>>le&ce)}:{h:Number(e>>le&ce)|0,l:Number(e&ce)|0}}function de(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=ue(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var fe=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),T=new Uint32Array(64),pe=class extends se{constructor(e=32){super(64,e,8,!1),this.A=w[0]|0,this.B=w[1]|0,this.C=w[2]|0,this.D=w[3]|0,this.E=w[4]|0,this.F=w[5]|0,this.G=w[6]|0,this.H=w[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)T[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=T[e-15],n=T[e-2],r=C(t,7)^C(t,18)^t>>>3;T[e]=(C(n,17)^C(n,19)^n>>>10)+T[e-7]+r+T[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=C(o,6)^C(o,11)^C(o,25),u=l+t+ae(o,s,c)+fe[e]+T[e]|0,d=(C(n,2)^C(n,13)^C(n,22))+oe(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){x(T)}destroy(){this.set(0,0,0,0,0,0,0,0),x(this.buffer)}},me=de(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));me[0],me[1];var he=re(()=>new pe),ge=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),_e=ge(((e,t)=>{(function(e,n){typeof define==`function`&&define.amd?define([],n):typeof t==`object`&&t.exports?t.exports=n():e.moo=n()})(e,function(){var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=typeof RegExp().sticky==`boolean`;function r(e){return e&&t.call(e)===`[object RegExp]`}function i(e){return e&&typeof e==`object`&&!r(e)&&!Array.isArray(e)}function a(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,`\\$&`)}function o(e){return RegExp(`|`+e).exec(``).length-1}function s(e){return`(`+e+`)`}function c(e){return e.length?`(?:`+e.map(function(e){return`(?:`+e+`)`}).join(`|`)+`)`:`(?!)`}function l(e){if(typeof e==`string`)return`(?:`+a(e)+`)`;if(r(e)){if(e.ignoreCase)throw Error(`RegExp /i flag not allowed`);if(e.global)throw Error(`RegExp /g flag is implied`);if(e.sticky)throw Error(`RegExp /y flag is implied`);if(e.multiline)throw Error(`RegExp /m flag is implied`);return e.source}else throw Error(`Not a pattern: `+e)}function u(e,t){return e.length>t?e:Array(t-e.length+1).join(` `)+e}function d(e,t){for(var n=e.length,r=0;;){var i=e.lastIndexOf(`
2
- `,n-1);if(i===-1||(r++,n=i,r===t)||n===0)break}var a=r<t?0:n+1;return e.substring(a).split(`
3
- `)}function f(e){for(var t=Object.getOwnPropertyNames(e),n=[],r=0;r<t.length;r++){var a=t[r],o=e[a],s=[].concat(o);if(a===`include`){for(var c=0;c<s.length;c++)n.push({include:s[c]});continue}var l=[];s.forEach(function(e){i(e)?(l.length&&n.push(m(a,l)),n.push(m(a,e)),l=[]):l.push(e)}),l.length&&n.push(m(a,l))}return n}function p(e){for(var t=[],n=0;n<e.length;n++){var r=e[n];if(r.include){for(var i=[].concat(r.include),a=0;a<i.length;a++)t.push({include:i[a]});continue}if(!r.type)throw Error(`Rule has no type: `+JSON.stringify(r));t.push(m(r.type,r))}return t}function m(t,n){if(i(n)||(n={match:n}),n.include)throw Error(`Matching rules cannot also include states`);var a={defaultType:t,lineBreaks:!!n.error||!!n.fallback,pop:!1,next:null,push:null,error:!1,fallback:!1,value:null,type:null,shouldThrow:!1};for(var o in n)e.call(n,o)&&(a[o]=n[o]);if(typeof a.type==`string`&&t!==a.type)throw Error(`Type transform cannot be a string (type '`+a.type+`' for token '`+t+`')`);var s=a.match;return a.match=Array.isArray(s)?s:s?[s]:[],a.match.sort(function(e,t){return r(e)&&r(t)?0:r(t)?-1:r(e)?1:t.length-e.length}),a}function h(e){return Array.isArray(e)?p(e):f(e)}var g=m(`error`,{lineBreaks:!0,shouldThrow:!0});function _(e,t){for(var i=null,a=Object.create(null),u=!0,d=null,f=[],p=[],m=0;m<e.length;m++)e[m].fallback&&(u=!1);for(var m=0;m<e.length;m++){var h=e[m];if(h.include)throw Error(`Inheritance is not allowed in stateless lexers`);if(h.error||h.fallback){if(i)throw!h.fallback==!i.fallback?Error(`Multiple `+(h.fallback?`fallback`:`error`)+` rules not allowed (for token '`+h.defaultType+`')`):Error(`fallback and error are mutually exclusive (for token '`+h.defaultType+`')`);i=h}var _=h.match.slice();if(u)for(;_.length&&typeof _[0]==`string`&&_[0].length===1;){var v=_.shift();a[v.charCodeAt(0)]=h}if(h.pop||h.push||h.next){if(!t)throw Error(`State-switching options are not allowed in stateless lexers (for token '`+h.defaultType+`')`);if(h.fallback)throw Error(`State-switching options are not allowed on fallback tokens (for token '`+h.defaultType+`')`)}if(_.length!==0){u=!1,f.push(h);for(var y=0;y<_.length;y++){var b=_[y];if(r(b)){if(d===null)d=b.unicode;else if(d!==b.unicode&&h.fallback===!1)throw Error(`If one rule is /u then all must be`)}}var x=c(_.map(l)),S=new RegExp(x);if(S.test(``))throw Error(`RegExp matches empty string: `+S);if(o(x)>0)throw Error(`RegExp has capture groups: `+S+`
4
- Use (?: … ) instead`);if(!h.lineBreaks&&S.test(`
5
- `))throw Error(`Rule should declare lineBreaks: `+S);p.push(s(x))}}var C=i&&i.fallback,ee=n&&!C?`ym`:`gm`,te=n||C?``:`|`;return d===!0&&(ee+=`u`),{regexp:new RegExp(c(p)+te,ee),groups:f,fast:a,error:i||g}}function v(e){return new S({start:_(h(e))},`start`)}function y(e,t,n){var r=e&&(e.push||e.next);if(r&&!n[r])throw Error(`Missing state '`+r+`' (in token '`+e.defaultType+`' of state '`+t+`')`);if(e&&e.pop&&+e.pop!=1)throw Error(`pop must be 1 (in token '`+e.defaultType+`' of state '`+t+`')`)}function b(e,t){var n=e.$all?h(e.$all):[];delete e.$all;var r=Object.getOwnPropertyNames(e);t||=r[0];for(var i=Object.create(null),a=0;a<r.length;a++){var o=r[a];i[o]=h(e[o]).concat(n)}for(var a=0;a<r.length;a++)for(var o=r[a],s=i[o],c=Object.create(null),l=0;l<s.length;l++){var u=s[l];if(u.include){var d=[l,1];if(u.include!==o&&!c[u.include]){c[u.include]=!0;var f=i[u.include];if(!f)throw Error(`Cannot include nonexistent state '`+u.include+`' (in state '`+o+`')`);for(var p=0;p<f.length;p++){var m=f[p];s.indexOf(m)===-1&&d.push(m)}}s.splice.apply(s,d),l--}}for(var g=Object.create(null),a=0;a<r.length;a++){var o=r[a];g[o]=_(i[o],!0)}for(var a=0;a<r.length;a++){for(var v=r[a],b=g[v],x=b.groups,l=0;l<x.length;l++)y(x[l],v,g);for(var C=Object.getOwnPropertyNames(b.fast),l=0;l<C.length;l++)y(b.fast[C[l]],v,g)}return new S(g,t)}function x(e){for(var t=typeof Map<`u`,n=t?new Map:Object.create(null),r=Object.getOwnPropertyNames(e),i=0;i<r.length;i++){var a=r[i],o=e[a];(Array.isArray(o)?o:[o]).forEach(function(e){if(typeof e!=`string`)throw Error(`keyword must be string (in keyword '`+a+`')`);t?n.set(e,a):n[e]=a})}return function(e){return t?n.get(e):n[e]}}var S=function(e,t){this.startState=t,this.states=e,this.buffer=``,this.stack=[],this.reset()};S.prototype.reset=function(e,t){return this.buffer=e||``,this.index=0,this.line=t?t.line:1,this.col=t?t.col:1,this.queuedToken=t?t.queuedToken:null,this.queuedText=t?t.queuedText:``,this.queuedThrow=t?t.queuedThrow:null,this.setState(t?t.state:this.startState),this.stack=t&&t.stack?t.stack.slice():[],this},S.prototype.save=function(){return{line:this.line,col:this.col,state:this.state,stack:this.stack.slice(),queuedToken:this.queuedToken,queuedText:this.queuedText,queuedThrow:this.queuedThrow}},S.prototype.setState=function(e){if(!(!e||this.state===e)){this.state=e;var t=this.states[e];this.groups=t.groups,this.error=t.error,this.re=t.regexp,this.fast=t.fast}},S.prototype.popState=function(){this.setState(this.stack.pop())},S.prototype.pushState=function(e){this.stack.push(this.state),this.setState(e)};var C=n?function(e,t){return e.exec(t)}:function(e,t){var n=e.exec(t);return n[0].length===0?null:n};S.prototype._getGroup=function(e){for(var t=this.groups.length,n=0;n<t;n++)if(e[n+1]!==void 0)return this.groups[n];throw Error(`Cannot find token type for matched text`)};function ee(){return this.value}if(S.prototype.next=function(){var e=this.index;if(this.queuedGroup){var t=this._token(this.queuedGroup,this.queuedText,e);return this.queuedGroup=null,this.queuedText=``,t}var n=this.buffer;if(e!==n.length){var r=this.fast[n.charCodeAt(e)];if(r)return this._token(r,n.charAt(e),e);var i=this.re;i.lastIndex=e;var a=C(i,n),o=this.error;if(a==null)return this._token(o,n.slice(e,n.length),e);var r=this._getGroup(a),s=a[0];return o.fallback&&a.index!==e?(this.queuedGroup=r,this.queuedText=s,this._token(o,n.slice(e,a.index),e)):this._token(r,s,e)}},S.prototype._token=function(e,t,n){var r=0;if(e.lineBreaks){var i=/\n/g,a=1;if(t===`
6
- `)r=1;else for(;i.exec(t);)r++,a=i.lastIndex}var o={type:typeof e.type==`function`&&e.type(t)||e.defaultType,value:typeof e.value==`function`?e.value(t):t,text:t,toString:ee,offset:n,lineBreaks:r,line:this.line,col:this.col},s=t.length;if(this.index+=s,this.line+=r,r===0?this.col+=s:this.col=s-a+1,e.shouldThrow)throw Error(this.formatError(o,`invalid syntax`));return e.pop?this.popState():e.push?this.pushState(e.push):e.next&&this.setState(e.next),o},typeof Symbol<`u`&&Symbol.iterator){var te=function(e){this.lexer=e};te.prototype.next=function(){var e=this.lexer.next();return{value:e,done:!e}},te.prototype[Symbol.iterator]=function(){return this},S.prototype[Symbol.iterator]=function(){return new te(this)}}return S.prototype.formatError=function(e,t){if(e==null)var n=this.buffer.slice(this.index),e={text:n,offset:this.index,lineBreaks:n.indexOf(`
7
- `)===-1?0:1,line:this.line,col:this.col};var r=2,i=Math.max(e.line-r,1),a=e.line+r,o=String(a).length,s=d(this.buffer,this.line-e.line+r+1).slice(0,5),c=[];c.push(t+` at line `+e.line+` col `+e.col+`:`),c.push(``);for(var l=0;l<s.length;l++){var f=s[l],p=i+l;c.push(u(String(p),o)+` `+f),p===e.line&&c.push(u(``,o+e.col+1)+`^`)}return c.join(`
8
- `)},S.prototype.clone=function(){return new S(this.states,this.state)},S.prototype.has=function(e){return!0},{compile:v,states:b,error:Object.freeze({error:!0}),fallback:Object.freeze({fallback:!0}),keywords:x}})})),ve=ge((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.lexer=e.states=void 0;var n=t(_e());e.states={body:{doubleapos:{match:`''`,value:()=>`'`},quoted:{lineBreaks:!0,match:/'[{}#](?:[^']|'')*'(?!')/u,value:e=>e.slice(1,-1).replace(/''/g,`'`)},argument:{lineBreaks:!0,match:/\{\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,push:`arg`,value:e=>e.substring(1).trim()},octothorpe:`#`,end:{match:`}`,pop:1},content:{lineBreaks:!0,match:/[^][^{}#']*/u}},arg:{select:{lineBreaks:!0,match:/,\s*(?:plural|select|selectordinal)\s*,\s*/u,next:`select`,value:e=>e.split(`,`)[1].trim()},"func-args":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*,/u,next:`body`,value:e=>e.split(`,`)[1].trim()},"func-simple":{lineBreaks:!0,match:/,\s*[^\p{Pat_Syn}\p{Pat_WS}]+\s*/u,value:e=>e.substring(1).trim()},end:{match:`}`,pop:1}},select:{offset:{lineBreaks:!0,match:/\s*offset\s*:\s*\d+\s*/u,value:e=>e.split(`:`)[1].trim()},case:{lineBreaks:!0,match:/\s*(?:=\d+|[^\p{Pat_Syn}\p{Pat_WS}]+)\s*\{/u,push:`body`,value:e=>e.substring(0,e.indexOf(`{`)).trim()},end:{match:/\s*\}/u,pop:1}}},e.lexer=n.default.states(e.states)})),ye=ge((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ParseError=void 0,e.parse=l;var t=ve(),n=e=>({offset:e.offset,line:e.line,col:e.col,text:e.text,lineBreaks:e.lineBreaks}),r=e=>e===`plural`||e===`select`||e===`selectordinal`;function i(e,t){let n=``,r=``;for(let i of t){let t=i.ctx.text;switch(r+=t,i.type){case`content`:n+=i.value;break;case`argument`:case`function`:case`octothorpe`:n+=t;break;default:throw new s(e,`Unsupported part in strict mode function arg style: ${t}`)}}return[{type:`content`,value:n.trim(),ctx:Object.assign({},t[0].ctx,{text:r})}]}var a=[`number`,`date`,`time`,`spellout`,`ordinal`,`duration`],o=[`zero`,`one`,`two`,`few`,`many`,`other`],s=class extends Error{constructor(e,n){super(t.lexer.formatError(e,n))}};e.ParseError=s;var c=class{constructor(e,n){this.lexer=t.lexer.reset(e),this.cardinalKeys=n?.cardinal??o,this.ordinalKeys=n?.ordinal??o,this.strict=n?.strict??!1,this.strictPluralKeys=n?.strictPluralKeys??!0}parse(){return this.parseBody(!1,!0)}checkSelectKey(e,t,n){if(n[0]===`=`){if(t===`select`)throw new s(e,`The case ${n} is not valid with select`)}else if(t!==`select`){let r=t===`plural`?this.cardinalKeys:this.ordinalKeys;if(this.strictPluralKeys&&r.length>0&&!r.includes(n))throw new s(e,`The ${t} case ${n} is not valid in this locale`)}}parseSelect({value:e},t,r,i){let a={type:i,arg:e,cases:[],ctx:r};i===`plural`||i===`selectordinal`?t=!0:this.strict&&(t=!1);for(let e of this.lexer)switch(e.type){case`offset`:if(i===`select`)throw new s(e,`Unexpected plural offset for select`);if(a.cases.length>0)throw new s(e,`Plural offset must be set before cases`);a.pluralOffset=Number(e.value),r.text+=e.text,r.lineBreaks+=e.lineBreaks;break;case`case`:this.checkSelectKey(e,i,e.value),a.cases.push({key:e.value,tokens:this.parseBody(t),ctx:n(e)});break;case`end`:return a;default:throw new s(e,`Unexpected lexer token: ${e.type}`)}throw new s(null,`Unexpected message end`)}parseArgToken(e,t){let o=n(e),c=this.lexer.next();if(!c)throw new s(null,`Unexpected message end`);if(o.text+=c.text,o.lineBreaks+=c.lineBreaks,this.strict&&(c.type===`func-simple`||c.type===`func-args`)&&!a.includes(c.value))throw new s(e,`Invalid strict mode function arg type: ${c.value}`);switch(c.type){case`end`:return{type:`argument`,arg:e.value,ctx:o};case`func-simple`:{let t=this.lexer.next();if(!t)throw new s(null,`Unexpected message end`);if(t.type!==`end`)throw new s(t,`Unexpected lexer token: ${t.type}`);if(o.text+=t.text,r(c.value.toLowerCase()))throw new s(c,`Invalid type identifier: ${c.value}`);return{type:`function`,arg:e.value,key:c.value,ctx:o}}case`func-args`:{if(r(c.value.toLowerCase()))throw new s(c,`Invalid type identifier: ${c.value}`);let n=this.parseBody(!this.strict&&t);return this.strict&&n.length>0&&(n=i(e,n)),{type:`function`,arg:e.value,key:c.value,param:n,ctx:o}}case`select`:if(r(c.value))return this.parseSelect(e,t,o,c.value);throw new s(c,`Unexpected select type ${c.value}`);default:throw new s(c,`Unexpected lexer token: ${c.type}`)}}parseBody(e,t){let r=[],i=null;for(let a of this.lexer)if(a.type===`argument`)i&&=null,r.push(this.parseArgToken(a,e));else if(a.type===`octothorpe`&&e)i&&=null,r.push({type:`octothorpe`,ctx:n(a)});else if(a.type===`end`&&!t)return r;else{let t=a.value;if(!e&&a.type===`quoted`&&t[0]===`#`){if(t.includes(`{`))throw new s(a,`Unsupported escape pattern: ${t}`);t=a.text}i?(i.value+=t,i.ctx.text+=a.text,i.ctx.lineBreaks+=a.lineBreaks):(i={type:`content`,value:t,ctx:n(a)},r.push(i))}if(t)return r;throw new s(null,`Unexpected message end`)}};function l(e,t={}){return new c(e,t).parse()}}))(),E=class extends Error{constructor(e,t,n){super(e),this.token=t,this.type=n||`error`}},be=e=>e<4?`short`:e===4?`long`:`narrow`,xe=e=>e%2==0?`2-digit`:`numeric`;function Se(e,t){switch(e.char){case`y`:return{year:xe(e.width)};case`r`:return{calendar:`gregory`,year:`numeric`};default:return t(`${e.desc} is not supported; falling back to year:numeric`,E.WARNING),{year:`numeric`}}}function Ce(e,t){switch(e.width){case 1:return`numeric`;case 2:return`2-digit`;case 3:return`short`;case 4:return`long`;case 5:return`narrow`;default:t(`${e.desc} is not supported with width ${e.width}`);return}}function we(e,t){let{char:n,desc:r,width:i}=e;if(n===`d`)return xe(i);t(`${r} is not supported`)}function Te(e,t){let{char:n,desc:r,width:i}=e;return(n===`c`||n===`e`)&&i<3&&t(`Numeric value is not supported for ${r}; falling back to weekday:short`,E.WARNING),be(i)}function Ee(e){let t=xe(e.width),n;switch(e.char){case`h`:n=`h12`;break;case`H`:n=`h23`;break;case`k`:n=`h24`;break;case`K`:n=`h11`;break}return n?{hour:t,hourCycle:n}:{hour:t}}function De(e,t){let{char:n,desc:r,width:i}=e;switch(n){case`v`:case`z`:return i===4?`long`:`short`;case`V`:if(i===4)return`long`;t(`${r} is not supported with width ${i}`);return;case`X`:t(`${r} is not supported`);return}return`short`}function Oe(e,t){switch(e.field){case`era`:return{era:be(e.width)};case`year`:return Se(e,t);case`month`:return{month:Ce(e,t)};case`day`:return{day:we(e,t)};case`weekday`:return{weekday:Te(e,t)};case`period`:return;case`hour`:return Ee(e);case`min`:return{minute:xe(e.width)};case`sec`:return{second:xe(e.width)};case`tz`:return{timeZoneName:De(e,t)};case`quarter`:case`week`:case`sec-frac`:case`ms`:t(`${e.desc} is not supported`)}}function ke(e,t,n=e=>{throw e}){let r={timeZone:t},i=[];for(let t of e){let{error:e,field:a,str:o}=t;if(e){let r=new E(e.message,t);r.stack=e.stack,n(r)}o&&n(new E(`Ignoring string part: ${o}`,t,E.WARNING)),a&&(i.indexOf(a)===-1?i.push(a):n(new E(`Duplicate ${a} token`,t)));let s=Oe(t,(e,r)=>n(new E(e,t,r)));s&&Object.assign(r,s)}return r}var Ae={G:{field:`era`,desc:`Era`},y:{field:`year`,desc:`Year`},Y:{field:`year`,desc:`Year of "Week of Year"`},u:{field:`year`,desc:`Extended year`},U:{field:`year`,desc:`Cyclic year name`},r:{field:`year`,desc:`Related Gregorian year`},Q:{field:`quarter`,desc:`Quarter`},q:{field:`quarter`,desc:`Stand-alone quarter`},M:{field:`month`,desc:`Month in year`},L:{field:`month`,desc:`Stand-alone month in year`},w:{field:`week`,desc:`Week of year`},W:{field:`week`,desc:`Week of month`},d:{field:`day`,desc:`Day in month`},D:{field:`day`,desc:`Day of year`},F:{field:`day`,desc:`Day of week in month`},g:{field:`day`,desc:`Modified julian day`},E:{field:`weekday`,desc:`Day of week`},e:{field:`weekday`,desc:`Local day of week`},c:{field:`weekday`,desc:`Stand-alone local day of week`},a:{field:`period`,desc:`AM/PM marker`},b:{field:`period`,desc:`AM/PM/noon/midnight marker`},B:{field:`period`,desc:`Flexible day period`},h:{field:`hour`,desc:`Hour in AM/PM (1~12)`},H:{field:`hour`,desc:`Hour in day (0~23)`},k:{field:`hour`,desc:`Hour in day (1~24)`},K:{field:`hour`,desc:`Hour in AM/PM (0~11)`},j:{field:`hour`,desc:`Hour in preferred cycle`},J:{field:`hour`,desc:`Hour in preferred cycle without marker`},C:{field:`hour`,desc:`Hour in preferred cycle with flexible marker`},m:{field:`min`,desc:`Minute in hour`},s:{field:`sec`,desc:`Second in minute`},S:{field:`sec-frac`,desc:`Fractional second`},A:{field:`ms`,desc:`Milliseconds in day`},z:{field:`tz`,desc:`Time Zone: specific non-location`},Z:{field:`tz`,desc:`Time Zone`},O:{field:`tz`,desc:`Time Zone: localized`},v:{field:`tz`,desc:`Time Zone: generic non-location`},V:{field:`tz`,desc:`Time Zone: ID`},X:{field:`tz`,desc:`Time Zone: ISO8601 with Z`},x:{field:`tz`,desc:`Time Zone: ISO8601`}},je=e=>e>=`A`&&e<=`Z`||e>=`a`&&e<=`z`;function Me(e,t){let n=e[t],r=1;for(;e[++t]===n;)++r;let i=Ae[n];if(!i){let e=`The letter ${n} is not a valid field identifier`;return{char:n,error:Error(e),width:r}}return{char:n,field:i.field,desc:i.desc,width:r}}function Ne(e,t){let n=e[++t],r=2;if(n===`'`)return{char:`'`,str:n,width:r};for(;;){let i=e[++t];if(++r,i===void 0){let t=`Unterminated quoted literal in pattern: ${n||e}`;return{char:`'`,error:Error(t),str:n,width:r}}else if(i===`'`){if(e[++t]!==`'`)return{char:`'`,str:n,width:r};++r}n+=i}}function Pe(e,t){let n=e[t];if(!n)return null;if(je(n))return Me(e,t);if(n===`'`)return Ne(e,t);let r=n,i=1;for(;;){let a=e[++t];if(!a||je(a)||a===`'`)return{char:n,str:r,width:i};r+=a,i+=1}}function Fe(e){let t=[],n=0;for(;;){let r=Pe(e,n);if(!r)return t;t.push(r),n+=r.width}}function Ie(e,t){return e.filter(e=>e.type!==`content`).length?e.map(e=>{if(e.type===`content`)return t(e.value);if(e.type===`octothorpe`)return`#`;if(e.type===`argument`)return[e.arg];if(e.type===`function`){let t=e?.param?.[0];if(e.key===`date`&&t){let n=Le(t.value.trim(),e=>{throw Error(`Unable to compile date expression: ${e.message}`)});return[e.arg,e.key,n]}return t?[e.arg,e.key,t.value.trim()]:[e.arg,e.key]}let n=e.pluralOffset,r={};return e.cases.forEach(({key:e,tokens:n})=>{let i=e[0]===`=`?e.slice(1):e;r[i]=Ie(n,t)}),[e.arg,e.type,{offset:n,...r}]}):e.map(e=>t(e.value))}function Le(e,t){return/^::/.test(e)?ke(Fe(e.substring(2)),void 0,t):e}function Re(e,t=e=>e){return Ie((0,ye.parse)(e),t)}function ze(e,t=e=>e){try{return Re(e,t)}catch(t){return console.error(`${t.message}
9
-
10
- Message: ${e}`),[e]}}var D=e=>typeof e==`string`,Be=e=>typeof e==`function`,Ve=new Map,He=`en`;function Ue(e){return[...Array.isArray(e)?e:[e],He]}function We(e,t,n){let r=Ue(e);n||=`default`;let i;if(typeof n==`string`)switch(i={day:`numeric`,month:`short`,year:`numeric`},n){case`full`:i.weekday=`long`;case`long`:i.month=`long`;break;case`short`:i.month=`numeric`;break}else i=n;return Je(()=>Ye(`date`,r,n),()=>new Intl.DateTimeFormat(r,i)).format(D(t)?new Date(t):t)}function Ge(e,t,n){let r;if(n||=`default`,typeof n==`string`)switch(r={second:`numeric`,minute:`numeric`,hour:`numeric`},n){case`full`:case`long`:r.timeZoneName=`short`;break;case`short`:delete r.second}else r=n;return We(e,t,r)}function Ke(e,t,n){let r=Ue(e);return Je(()=>Ye(`number`,r,n),()=>new Intl.NumberFormat(r,n)).format(t)}function qe(e,t,n,{offset:r=0,...i}){let a=Ue(e),o=t?Je(()=>Ye(`plural-ordinal`,a),()=>new Intl.PluralRules(a,{type:`ordinal`})):Je(()=>Ye(`plural-cardinal`,a),()=>new Intl.PluralRules(a,{type:`cardinal`}));return i[n]??i[o.select(n-r)]??i.other}function Je(e,t){let n=e(),r=Ve.get(n);return r||(r=t(),Ve.set(n,r)),r}function Ye(e,t,n){return`${e}-${t.join(`-`)}-${JSON.stringify(n)}`}var Xe=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Ze=e=>e.replace(/\\u([a-fA-F0-9]{4})|\\x([a-fA-F0-9]{2})/g,(e,t,n)=>{if(t){let e=parseInt(t,16);return String.fromCharCode(e)}else{let e=parseInt(n,16);return String.fromCharCode(e)}}),Qe=`%__lingui_octothorpe__%`,$e=(e,t,n={})=>{let r=t||e,i=e=>typeof e==`object`?e:n[e],a=(e,t)=>{let a=Object.keys(n).length?i(`number`):void 0,o=Ke(r,e,a);return t.replace(new RegExp(Qe,`g`),o)};return{plural:(e,t)=>{let{offset:n=0}=t,i=qe(r,!1,e,t);return a(e-n,i)},selectordinal:(e,t)=>{let{offset:n=0}=t,i=qe(r,!0,e,t);return a(e-n,i)},select:et,number:(e,t)=>Ke(r,e,i(t)||{style:t}),date:(e,t)=>We(r,e,i(t)||t),time:(e,t)=>Ge(r,e,i(t)||t)}},et=(e,t)=>t[e]??t.other;function tt(e,t,n){return(r={},i)=>{let a=$e(t,n,i),o=(e,t=!1)=>Array.isArray(e)?e.reduce((e,n)=>{if(n===`#`&&t)return e+Qe;if(D(n))return e+n;let[i,s,c]=n,l={};s===`plural`||s===`selectordinal`||s===`select`?Object.entries(c).forEach(([e,t])=>{l[e]=o(t,s===`plural`||s===`selectordinal`)}):l=c;let u;if(s){let e=a[s];u=e(r[i],l)}else u=r[i];return u==null?e:e+u},``):e,s=o(e);return D(s)&&Xe.test(s)?Ze(s):D(s)?s:s?String(s):``}}var nt=Object.defineProperty,rt=(e,t,n)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,it=(e,t,n)=>(rt(e,typeof t==`symbol`?t:t+``,n),n),at=class{constructor(){it(this,`_events`,{})}on(e,t){var n;return(n=this._events)[e]??(n[e]=[]),this._events[e].push(t),()=>this.removeListener(e,t)}removeListener(e,t){let n=this._getListeners(e);if(!n)return;let r=n.indexOf(t);~r&&n.splice(r,1)}emit(e,...t){let n=this._getListeners(e);n&&n.map(e=>e.apply(this,t))}_getListeners(e){let t=this._events[e];return Array.isArray(t)?t:!1}},ot=Object.defineProperty,st=(e,t,n)=>t in e?ot(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t,n)=>(st(e,typeof t==`symbol`?t:t+``,n),n),ct=class extends at{constructor(e){super(),O(this,`_locale`,``),O(this,`_locales`),O(this,`_localeData`,{}),O(this,`_messages`,{}),O(this,`_missing`),O(this,`_messageCompiler`),O(this,`t`,this._.bind(this)),process.env.NODE_ENV!==`production`&&this.setMessagesCompiler(ze),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale==`string`||e.locales)&&this.activate(e.locale??He,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){return this._messages[this._locale]??{}}get localeData(){return this._localeData[this._locale]??{}}_loadLocaleData(e,t){let n=this._localeData[e];n?Object.assign(n,t):this._localeData[e]=t}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,t){typeof e==`string`?this._loadLocaleData(e,t):Object.keys(e).forEach(t=>this._loadLocaleData(t,e[t])),this.emit(`change`)}_load(e,t){let n=this._messages[e];n?Object.assign(n,t):this._messages[e]=t}load(e,t){typeof e==`string`&&typeof t==`object`?this._load(e,t):Object.entries(e).forEach(([e,t])=>this._load(e,t)),this.emit(`change`)}loadAndActivate({locale:e,locales:t,messages:n}){this._locale=e,this._locales=t||void 0,this._messages[this._locale]=n,this.emit(`change`)}activate(e,t){process.env.NODE_ENV!==`production`&&(this._messages[e]||console.warn(`Messages for locale "${e}" not loaded.`)),this._locale=e,this._locales=t,this.emit(`change`)}_(e,t,n){if(!this.locale)throw Error(`Lingui: Attempted to call a translation function without setting a locale.
11
- Make sure to call \`i18n.activate(locale)\` before using Lingui functions.
12
- This issue may also occur due to a race condition in your initialization logic.`);let r=n?.message;e||=``,D(e)||(t=e.values||t,r=e.message,e=e.id);let i=this.messages[e],a=i===void 0,o=this._missing;if(o&&a)return Be(o)?o(this._locale,e):o;a&&this.emit(`missing`,{id:e,locale:this._locale});let s=i||r||e;return D(s)&&(this._messageCompiler?s=this._messageCompiler(s):console.warn(`Uncompiled message detected! Message:
13
-
14
- > ${s}
15
-
16
- That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
17
- ICU features such as interpolation and plurals will not work properly for that message.
18
-
19
- Please compile your catalog first.
20
- `)),D(s)&&Xe.test(s)?Ze(s):D(s)?s:tt(s,this._locale,this._locales)(t,n?.formats)}date(e,t){return We(this._locales||this._locale,e,t)}number(e,t){return Ke(this._locales||this._locale,e,t)}};function lt(e={}){return new ct(e)}lt();var ut=``,dt=5e4,ft=new Map,pt=e=>typeof Buffer<`u`?Buffer.from(e).toString(`base64`):btoa(String.fromCharCode(...e)),mt=(e,t=``)=>{let n=e+ut+(t||``),r=ft.get(n);if(g(r))return r;let i=pt(he(ee(n))).slice(0,6);return ft.size>=dt&&ft.clear(),ft.set(n,i),i},ht=/\{(\w+)\}/g,gt=(e,t)=>g(t)?e.replace(ht,(e,n)=>{let r=t[n];return g(r)?String(r):e}):e,_t=[`objectLabel`,`objectLabelSingular`,`objectLabelPlural`,`objectIcon`],vt=e=>`{${e}}`;Object.fromEntries(_t.map(e=>[e,vt(e)]));var yt=()=>globalThis.__twentySdkFrontComponentTranslations__??{},bt=(e,t,n)=>{let{message:r,context:i}=m(e),a=yt()[n]?.[mt(r,i)];return gt(a??r,t)},xt=(e,t)=>{if(e!==void 0)return e;if(typeof t==`string`)return h(t)},St=({children:e,message:t,context:n,values:r})=>{let i=p(),a=xt(t,e);return a===void 0?e:bt({message:a,context:n},r,i)},Ct=`agentChatAssistant`,wt=({objectNameSingular:e,recordId:t,displayName:n})=>e===`agentChatAssistant`?`@${n}`:`[[record:${e}:${t}:${n}]]`;function Tt(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Et(e,t=`|`){return e.map(e=>Gt(e)).join(t)}function Dt(e,t){return typeof t==`bigint`?t.toString():t}var Ot=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function kt(e){return new Ot(e)}function At(e){return e==null}function jt(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function k(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Mt(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function A(e){return Mt(e._zod.def)??e._zod.def.shape}function Nt(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return k(this,t,e),e},enumerable:!0,configurable:!0})}function Pt(e,t,n){t in e?k(e,t,n):e[t]=n}function j(e,t,n,r){let i=A(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Nt(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Pt(e,a,r?r(n.value,a):n.value))}}function Ft(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Nt(e,n,()=>t[n]):Pt(e,n,r.value))}}function M(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function It(e){return JSON.stringify(e)}function Lt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Rt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function zt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Bt=kt(()=>{if(H.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Vt(e){if(zt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(zt(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ht(e){return Vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Ut=new Set([`string`,`number`,`symbol`]);function Wt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function N(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function P(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Gt(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Kt(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var qt={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Jt={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Yt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return j(i,e,Xt(e,t)),N(e,M(n,{shape:i,checks:[]}))}function Xt(e,t){let n=A(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Zt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Xt(e,t)),a={};return j(a,e,Reflect.ownKeys(A(e)).filter(e=>!i.has(e))),N(e,M(n,{shape:a,checks:[]}))}function Qt(e,t){if(!Vt(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=A(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return N(e,M(e._zod.def,{shape:$t(e,t)}))}function $t(e,t){let n={};return j(n,e,Reflect.ownKeys(A(e))),Ft(n,t),n}function en(e,t){if(!Vt(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return N(e,M(e._zod.def,{shape:$t(e,t)}))}function tn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return j(n,e,Reflect.ownKeys(A(e))),j(n,t,Reflect.ownKeys(A(t))),N(e,M(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function nn(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Xt(t,n)):void 0,o={};return j(o,t,Reflect.ownKeys(A(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),N(t,M(t._zod.def,{shape:o,checks:[]}))}function rn(e,t,n){let r=n?new Set(Xt(t,n)):void 0,i={};return j(i,t,Reflect.ownKeys(A(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),N(t,M(t._zod.def,{shape:i}))}function F(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function an(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function on(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function sn(e){return typeof e==`string`?e:e?.message}function cn(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function ln(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function I(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:sn(e.inst?._zod.def?.error?.(e))??sn(a?.(e))??sn(t?.error?.(e))??sn(n.customError?.(e))??sn(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t===`inst`||t===`schema`||t===`continue`||t===`input`||t===`__proto__`||(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var un=/[\uD800-\uDBFF]/;function dn(e){let t=e.length;if(!un.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function fn(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function pn(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function mn(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function hn(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):vn(e,n,r.value)}}function L(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function gn(e,t,n){return L(e,t,n,!1)}function _n(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return L(this,n,r(this))},set(e){L(this,n,e)}})}return t}function vn(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:L(this,t,n.bind(this))},set(e){L(this,t,e)}})}function yn(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var bn,R=!1,xn={configurable:!0,get(){R=!0}};function z(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&bn!==e._zod){bn=void 0;return}bn=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,xn);let e=R;R=!1;try{let r=n(this);return R?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),R||=e,r}catch(n){throw delete this[t],R||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Sn(e,t,n,r){let i=yn(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Cn=`~constantCatch`;function wn(e){let t=()=>e;return t[Cn]=!0,t}var Tn,En={value:void 0,enumerable:!1},Dn=`captureStackTrace`in Error?Error:null;function On(e){let t=Dn;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Dn=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function B(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){En.value=new a(r);try{Object.defineProperty(n,"_zod",En)}finally{En.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),hn(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?On(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var V=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},kn=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Tn=globalThis).__zod_globalConfig??(Tn.__zod_globalConfig={});var H=globalThis.__zod_globalConfig;function U(e){return e&&Object.assign(H,e),H}function An(){let e=this._zod;return e.message??=JSON.stringify(e.def,Dt,2),e.message}function jn(e){this._zod.message=e}var Mn={get:An,set:jn,enumerable:!0,configurable:!0},Nn={value:void 0,enumerable:!1},Pn=new WeakSet([Object.prototype,Error.prototype]),Fn=(e,t)=>{e.name=`$ZodError`,Nn.value=t,Object.defineProperty(e,"issues",Nn),Nn.value=void 0,Object.defineProperty(e,"message",Mn);let n=Object.getPrototypeOf(e);Pn.has(n)||(Pn.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},In=B(`$ZodError`,Fn);B(`$ZodError`,Fn,void 0,{Parent:Error});function Ln(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Rn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Ln(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function zn(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Bn(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Vn=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new V;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>I(e,o,U())));throw Rt(n,a?.callee??t),n}return s.value};return t},Hn=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>I(e,o,U())));throw Rt(n,a?.callee??t),n}return s.value};return t},Un=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new V;return a.issues.length?Wn(e,a.issues,i):{success:!0,data:a.value}};function Wn(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>I(e,n,U()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Gn=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Wn(e,a.issues,i):{success:!0,data:a.value}},Kn=Symbol.for(`zod.compile.invalid`),qn=Symbol.for(`zod.compile.fallback`),Jn=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Kn)return!0;if(r.definite===!0&&n===void 0)return!1}return Yn(e,t,n)});function Yn(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[qn]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new V;return a.issues.length===0}var Xn=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Zn=e=>{let t=Vn(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Bn(n,a))};return n},Qn=e=>{let t=Vn(e),n=(e,r,i,a)=>t(e,r,i,Bn(n,a));return n},$n=e=>{let t=Hn(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Bn(n,a))};return n},er=e=>{let t=Hn(e),n=async(e,r,i,a)=>await t(e,r,i,Bn(n,a));return n},tr=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Un(e)(t,n,i)},nr=e=>(t,n,r)=>Un(e)(t,n,r),rr=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Gn(e)(t,n,i)},ir=e=>async(t,n,r)=>Gn(e)(t,n,r),ar=/^[cC][0-9a-z]{6,}$/,or=/^[0-9a-z]+$/,sr=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,cr=/^[0-9a-vA-V]{20}$/,lr=/^[A-Za-z0-9]{27}$/,ur=/^[a-zA-Z0-9_-]{21}$/;function dr(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var fr=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,pr=/^([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})$/,mr=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,hr=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,gr=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function _r(){return new RegExp(gr,`u`)}var vr=/^(?:(?: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])$/,yr=/^(([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}|:))$/,br=/^((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])$/,xr=/^(([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])$/,Sr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Cr=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,wr=/^https?$/,Tr=/^\+[1-9]\d{6,14}$/,Er=`(?:(?:\\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 Dr(e){return RegExp(`^${e}$`)}var Or=Dr(Er);function kr(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Ar(e){return RegExp(`^${kr(e)}$`)}function jr(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${kr({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${kr({precision:e.precision})}`:n;return RegExp(`^${Er}T(?:${r})$`)}var Mr=/^[\s\S]{0,}$/,Nr=/^[^A-Z]*$/,Pr=/^[^a-z]*$/,W=B(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Fr=e=>{let t=e.value;return!At(t)&&t.length!==void 0},Ir=B(`$ZodCheckMaxLength`,(e,t)=>{var n;W.init(e,t),(n=e._zod.def).when??(n.when=Fr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?dn(r):i)<=t.maximum)return;let a=fn(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Lr=B(`$ZodCheckMinLength`,(e,t)=>{var n;W.init(e,t),(n=e._zod.def).when??(n.when=Fr),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?dn(r):i)>=t.minimum)return;let a=fn(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Rr=B(`$ZodCheckLengthEquals`,(e,t)=>{var n;W.init(e,t),(n=e._zod.def).when??(n.when=Fr),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?dn(r):i;if(a===t.length)return;let o=fn(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),zr=B(`$ZodCheckStringFormat`,(e,t)=>{var n,r;W.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Br=B(`$ZodCheckRegex`,(e,t)=>{zr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Vr=B(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Nr,zr.init(e,t)}),Hr=B(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Pr,zr.init(e,t)}),Ur=B(`$ZodCheckIncludes`,(e,t)=>{W.init(e,t);let n=Wt(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Wr=B(`$ZodCheckStartsWith`,(e,t)=>{W.init(e,t);let n=RegExp(`^${Wt(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Gr=B(`$ZodCheckEndsWith`,(e,t)=>{W.init(e,t);let n=RegExp(`.*${Wt(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Kr=B(`$ZodCheckOverwrite`,(e,t)=>{W.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),qr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
21
- `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
22
- `)}\n};`)(...Object.values(this.closed))}},Jr={major:4,minor:6,patch:7},G=B(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Jr;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=F(t),a;for(let o of n){if(o._zod.def.when){if(an(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new V;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(ln(t.issues,n,e),i||=F(t,n))});else{if(t.issues.length===n)continue;ln(t.issues,n,e),i||=F(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(F(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new V;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new V;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return gn(this,`~standard`,Zr(this))},set"~standard"(e){L(this,`~standard`,e)}}),Yr=(e,t)=>e.issues.length?{issues:e.issues.map(e=>I(e,t,U()))}:{value:e.value};async function Xr(e,t){let n={async:!0};return Yr(await e._zod.run({value:t,issues:[]},n),n)}function Zr(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Yr(r,n)}catch{}return Xr(e,t)},vendor:`zod`,version:1}}var Qr=B(`$ZodString`,(e,t)=>{G.init(e,t),e._zod.pattern=t.pattern??Mr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),K=B(`$ZodStringFormat`,(e,t)=>{zr.init(e,t),Qr.init(e,t)}),$r=B(`$ZodGUID`,(e,t)=>{t.pattern??=pr,K.init(e,t)}),ei=B(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=mr(e)}else t.pattern??=mr();K.init(e,t)}),ti=B(`$ZodEmail`,(e,t)=>{t.pattern??=hr,K.init(e,t)});function ni(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function ri(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?ni(e)||2:ii(e,t)}function ii(e,t){if(!t.normalize&&t.protocol?.source===wr.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var ai=/[\t\n\r]/g;function oi(e){return e.replace(ai,``)}function si(e,t){return t.lastIndex=0,t.test(e.hostname)}function ci(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var li=B(`$ZodURL`,(e,t)=>{K.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=ri(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=oi(r);return}t.hostname&&!si(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!ci(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:oi(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ui=B(`$ZodEmoji`,(e,t)=>{t.pattern??=_r(),K.init(e,t)}),di=B(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?ur:dr(t.length),K.init(e,t)}),fi=B(`$ZodCUID`,(e,t)=>{t.pattern??=ar,K.init(e,t)}),pi=B(`$ZodCUID2`,(e,t)=>{t.pattern??=or,K.init(e,t)}),mi=B(`$ZodULID`,(e,t)=>{t.pattern??=sr,K.init(e,t)}),hi=B(`$ZodXID`,(e,t)=>{t.pattern??=cr,K.init(e,t)}),gi=B(`$ZodKSUID`,(e,t)=>{t.pattern??=lr,K.init(e,t)}),_i=B(`$ZodISODateTime`,(e,t)=>{t.pattern??=jr(t),K.init(e,t)}),vi=B(`$ZodISODate`,(e,t)=>{t.pattern??=Or,K.init(e,t)}),yi=B(`$ZodISOTime`,(e,t)=>{t.pattern??=Ar(t),K.init(e,t)}),bi=B(`$ZodISODuration`,(e,t)=>{t.pattern??=fr,K.init(e,t)}),xi=B(`$ZodIPv4`,(e,t)=>{t.pattern??=vr,K.init(e,t)}),Si=/^[0-9a-fA-F:.]+$/;function Ci(e){return Si.test(e)?ni(`http://[${e}]`):!1}var wi=B(`$ZodIPv6`,(e,t)=>{t.pattern??=yr,K.init(e,t),e._zod.check=n=>{Ci(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ti=B(`$ZodCIDRv4`,(e,t)=>{t.pattern??=br,K.init(e,t)});function Ei(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ci(n)}var Di=B(`$ZodCIDRv6`,(e,t)=>{t.pattern??=xr,K.init(e,t),e._zod.check=n=>{Ei(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Oi(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ki=/^[0-9a-zA-Z+/]*={0,2}$/,Ai=B(`$ZodBase64`,(e,t)=>{t.pattern??=ki,K.init(e,t),e._zod.check=n=>{Oi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),ji=/^[A-Za-z0-9_-]*$/;function Mi(e){if(!ji.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Oi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ni=B(`$ZodBase64URL`,(e,t)=>{t.pattern??=ji,K.init(e,t),e._zod.check=n=>{Mi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Pi=B(`$ZodE164`,(e,t)=>{t.pattern??=Tr,K.init(e,t)});function Fi(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ii=B(`$ZodJWT`,(e,t)=>{K.init(e,t),e._zod.check=n=>{Fi(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Li=B(`$ZodUnknown`,(e,t)=>{G.init(e,t),e._zod.parse=e=>e}),Ri=B(`$ZodNever`,(e,t)=>{G.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function zi(e,t){let n=cn(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of cn(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,ln(n.issues,t,e),n}}return i(n,a)}}var Bi=e=>Array.isArray(e)?e.length:-1;function Vi(e,t,n){e.issues.length&&t.issues.push(...on(n,e.issues)),t.value[n]=e.value}var Hi=B(`$ZodArray`,(e,t)=>{G.init(e,t);let n=H.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Vi(t,r,e)));else if(Vi(c,r,e),s&&c.issues.length!==0&&F(c))break}return o.length?Promise.all(o).then(()=>r):r},zi(e,Bi)});function Ui(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...on(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Wi=[];function Gi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Wi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Kt(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ki(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(F(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ui(e,n,i,t,d,f))):Ui(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var qi=B(`$ZodObject`,(e,t)=>{G.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=kt(()=>Gi(t));z(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||k(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=zt,o=t.catchall,s,c=H.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(F(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Ui(n,t,e,r,a,o))):Ui(s,t,e,r,a,o)}return o?Ki(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Ji=B(`$ZodObjectJIT`,(e,t)=>{qi.init(e,t);let n=e._zod.parse,r=kt(()=>Gi(t)),i=H.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new qr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
23
- let ${e}_ab = false;
24
- for (let i = 0; i < ${e}.issues.length; i++) {
25
- const iss = ${e}.issues[i];
26
- iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
27
- payload.issues.push(iss);
28
- if (iss.continue !== true) ${e}_ab = true;
29
- }
30
- if (${e}_ab && ctx && ctx.abortEarly) {
31
- payload.value = newResult;
32
- return payload;
33
- }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:It(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
34
- const ${n}_present = ${i};
35
- if (!${n}.issues.length || ${n}_present) {
36
- if (${n}.issues.length) {${c(n,r)}
37
- }
38
-
39
- if (${e}) {
40
- newResult[${r}] = ${n}.value;
41
- }
42
- }
43
-
44
- `)}else f?(o.write(`
45
- if (${n}.issues.length) {${c(n,r)}
46
- }
47
- `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
48
- if (${n}.value !== undefined || ${i}) {
49
- newResult[${r}] = ${n}.value;
50
- }
51
- `)):o.write(`
52
- const ${n}_present = ${i};
53
- if (${n}.issues.length) {${c(n,r)}
54
- }
55
- if (!${n}_present && !${n}.issues.length) {
56
- payload.issues.push({
57
- code: "invalid_type",
58
- expected: "nonoptional",
59
- input: undefined,
60
- path: [${r}]
61
- });
62
- if (ctx && ctx.abortEarly) {
63
- payload.value = newResult;
64
- return payload;
65
- }
66
- }
67
-
68
- if (${n}_present) {
69
- newResult[${r}] = ${n}.value;
70
- }
71
-
72
- `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=zt,c=!H.jitless,l=c&&Bt.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Ki([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Yi(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!F(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>I(e,r,U())))}),t)}var Xi=B(`$ZodUnion`,(e,t)=>{G.init(e,t),z(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),z(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),z(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),z(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>jt(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Yi(t,r,e,i)):Yi(o,r,e,i)}}),Zi=B(`$ZodIntersection`,(e,t)=>{G.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>$i(e,t,n)):$i(e,i,a)}});function Qi(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Vt(e)&&Vt(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=Qi(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Qi(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function $i(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=Qi(t.value,n.value);if(!c.valid){if(F(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ea=B(`$ZodEnum`,(e,t)=>{G.init(e,t);let n=Tt(t.entries),r=new Set(n);e._zod.values=r,z(e,`pattern`,e=>{let t=Tt(e.def.entries).filter(e=>Ut.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Wt(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),ta=B(`$ZodTransform`,(e,t)=>{G.init(e,t),e._zod.optin=`optional`,H.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kn(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new V;return n.value=i,n}});function na(e,t){return e.value=t.issues.length?void 0:t.value,e}var ra=B(`$ZodOptional`,(e,t)=>{G.init(e,t),z(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,z(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),z(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${jt(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>na(e,t)):na(e,r)}return t.innerType._zod.run(e,n)}}),ia=B(`$ZodExactOptional`,(e,t)=>{ra.init(e,t),z(e,`values`,e=>e.def.innerType._zod.values),z(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),aa=B(`$ZodNullable`,(e,t)=>{G.init(e,t),z(e,`optin`,e=>e.def.innerType._zod.optin),z(e,`optout`,e=>e.def.innerType._zod.optout),z(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${jt(t.source)}|null)$`):void 0}),z(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),oa=B(`$ZodDefault`,(e,t)=>{G.init(e,t),e._zod.optin=`defaulted`,z(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>sa(e,t)):sa(r,t)}});function sa(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ca=B(`$ZodPrefault`,(e,t)=>{G.init(e,t),e._zod.optin=`defaulted`,z(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),la=B(`$ZodNonOptional`,(e,t)=>{G.init(e,t),z(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>ua(t,e)):ua(i,e)}});function ua(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function da(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>I(e,r,U()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var fa=B(`$ZodCatch`,(e,t)=>{G.init(e,t),z(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),z(e,`optout`,e=>e.def.innerType._zod.optout),z(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>da(e,r,t,n)):da(e,r,t,n)}}),pa=B(`$ZodPipe`,(e,t)=>{G.init(e,t),z(e,`values`,e=>e.def.in._zod.values),z(e,`optin`,e=>e.def.in._zod.optin),z(e,`optout`,e=>e.def.out._zod.optout),z(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>ma(e,t.in,n)):ma(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ma(e,t.out,n)):ma(r,t.out,n)}});function ma(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var ha=B(`$ZodReadonly`,(e,t)=>{G.init(e,t),z(e,`propValues`,e=>e.def.innerType._zod.propValues),z(e,`values`,e=>e.def.innerType._zod.values),z(e,`optin`,e=>e.def.innerType?._zod?.optin),z(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ga):ga(r)}});function ga(e){return e.memo||(e.value=Object.freeze(e.value)),e}var _a=B(`$ZodCustom`,(e,t)=>{W.init(e,t),G.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>va(t,n,r,e));va(i,n,r,e)}});function va(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(mn(e))}}var ya=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ba=`~memo`,xa=[];function Sa(e){return typeof e==`object`&&!!e}function Ca(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var wa=new WeakMap,Ta=0,Ea=1,Da=2;function Oa(e,t,n){let r=wa.get(e);if(r!==void 0)return r?Da:Ta;if(t.has(e))return Da;t.add(e);let i=Ta,a=e=>{if(i!==Da&&e?._zod){let r=Oa(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ta;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ea:o.value?._zod?Oa(o.value,t,n):Ta;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Mt(c);s(e?o(e,!0):Ea),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Oa(r,t,!1):Ea);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 e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),ka(e,i)}function ka(e,t){return t!==Ea&&wa.set(e,t===Da),t}function Aa(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var ja,Ma=[],Na={alloc(e,t,n){let r=ja;if(!r)return n;ja=void 0;let i={value:n,issues:null};return r.set(t.value,i),Ma.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Fa(n,e.value))throw new ya;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Oa(e,new Set,!1);if(i===Ta)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Da||r?n=!0:r=!0}let l=s.value;if(!Sa(l))return t(s,c);let u=c[ba];u||(u={buckets:new WeakMap,backEdges:void 0},c[ba]=u);let d;i===c?d=a:(d=Aa(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Ca(f.issues)):(s.memo=!0,u.backEdges??=new WeakSet,u.backEdges.add(f.value)),s;ja=d;let p=Ma.length,m=t(s,c);ja=void 0;let h=Ma.length>p?Ma.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Ca(e.issues):xa),e)):(h&&(h.issues=m.issues.length?Ca(m.issues):xa),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Pa(){return Na}function Fa(e,t){let n=e[ba]?.backEdges;return n!==void 0&&Sa(t)&&n.has(t)}var Ia=()=>{let e={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 t(t){return e[t]??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`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(pn(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Gt(e.values[0])}`:`Invalid option: expected one of ${Et(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${Et(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function La(){return{localeError:Ia()}}var Ra,za=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ba(){return new za}(Ra=globalThis).__zod_globalRegistry??(Ra.__zod_globalRegistry=Ba());var Va=globalThis.__zod_globalRegistry;function Ha(e){return e.checks&&=[...e.checks],e}function Ua(e,t){return new e(Ha({type:`string`,...P(t)}))}function Wa(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...P(t)})}function Ga(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...P(t)})}function Ka(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...P(t)})}function qa(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...P(t)})}function Ja(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...P(t)})}function Ya(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...P(t)})}function Xa(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...P(t)})}function Za(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...P(t)})}function Qa(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...P(t)})}function $a(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...P(t)})}function eo(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...P(t)})}function to(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...P(t)})}function no(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...P(t)})}function ro(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...P(t)})}function io(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...P(t)})}function ao(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...P(t)})}function oo(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...P(t)})}function so(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...P(t)})}function co(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...P(t)})}function lo(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...P(t)})}function uo(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...P(t)})}function fo(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...P(t)})}function po(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...P(t)})}function mo(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...P(t)})}function ho(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...P(t)})}function go(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...P(t)})}function _o(e){return new e({type:`unknown`})}function vo(e,t){return new e({type:`never`,...P(t)})}function yo(e,t){return new Ir({check:`max_length`,...P(t),maximum:e})}function bo(e,t){return new Lr({check:`min_length`,...P(t),minimum:e})}function xo(e,t){return new Rr({check:`length_equals`,...P(t),length:e})}function So(e,t){return new Br({check:`string_format`,format:`regex`,...P(t),pattern:e})}function Co(e){return new Vr({check:`string_format`,format:`lowercase`,...P(e)})}function wo(e){return new Hr({check:`string_format`,format:`uppercase`,...P(e)})}function To(e,t){return new Ur({check:`string_format`,format:`includes`,...P(t),includes:e})}function Eo(e,t){return new Wr({check:`string_format`,format:`starts_with`,...P(t),prefix:e})}function Do(e,t){return new Gr({check:`string_format`,format:`ends_with`,...P(t),suffix:e})}function Oo(e){return new Kr({check:`overwrite`,tx:e})}function ko(e){return Oo(t=>t.normalize(e))}function Ao(){return Oo(e=>e.trim())}function jo(){return Oo(e=>e.toLowerCase())}function Mo(){return Oo(e=>e.toUpperCase())}function No(){return Oo(e=>Lt(e))}function Po(e,t,n){return new e({type:`array`,element:t,...P(n)})}function Fo(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...P(n)})}function Io(e,t){let n=Lo(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(mn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(mn(r))}},e(t.value,t)),t);return n}function Lo(e,t){let n=new W({check:`custom`,...P(t)});return n._zod.check=e,n}function Ro(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&k(e,t,n[t]);return e}function zo(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Va,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function Bo(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function q(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,q(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Ro(o.schema,c),t.io===`input`&&J(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Vo(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Ho(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${Vo(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+Vo(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
73
-
74
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function Uo(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;Uo(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var Wo=new Set([`type`,`properties`,`required`,`additionalProperties`]),Go=[`oneOf`,`anyOf`];function Ko(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function qo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Wo.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??Ko(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}k(n,r,e.length===1?e[0]:qo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=Ko(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function Jo(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Wo)if(t in e)return;let n=t.filter(e=>Go.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=qo(t);else{let e=n[0],i=Go.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>qo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Ro(e,r))}function Yo(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Ro(i,s),Ro(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())Uo(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])Jo(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Ro(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,k(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Zo(t,`input`,e.processors),output:Zo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function J(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return J(r.element,n);if(r.type===`set`)return J(r.valueType,n);if(r.type===`lazy`)return J(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return J(r.innerType,n);if(r.type===`intersection`)return J(r.left,n)||J(r.right,n);if(r.type===`record`||r.type===`map`)return J(r.keyType,n)||J(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:J(r.in,n)||J(r.out,n);if(r.type===`object`){for(let e in r.shape)if(J(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(J(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(J(e,n))return!0;return!!(r.rest&&J(r.rest,n))}return!1}var Xo=(e,t={})=>n=>{let r=zo({...n,processors:t});return q(e,r),Ho(r,e),Yo(r,e)},Zo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=zo({...i??{},target:a,io:t,processors:n});return q(e,o),Ho(o,e),Yo(o,e)},Qo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},$o=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},es=(e,t)=>{Qo(e,`minimum`,t),$o(e,`maximum`,t)},ts=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},ns=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},rs=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},is=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},as=(e,t)=>Qo(e,`minimum`,t.minimum),os=(e,t)=>$o(e,`maximum`,t.maximum),ss=e=>(t,n)=>{is(t,n.format);let[r,i]=e[n.format];Qo(t,`minimum`,r),$o(t,`maximum`,i)},cs={greater_than:(e,t)=>Qo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>$o(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>ts(e,t.value),number_format:ss(qt),bigint_format:ss(Jt),min_length:as,max_length:os,length_equals:(e,t)=>es(e,t.length),min_size:as,max_size:os,size_equals:(e,t)=>es(e,t.size),string_format:(e,t)=>{is(e,t.format),t.pattern&&ns(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>rs(e,t.mime)};function ls(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)cs[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Qo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Qo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&$o(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&$o(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&ts(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&rs(t,i.mime);for(let e of i.patterns??[])ns(t,e);return t}var us={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ds=new Map([[ki,Sr],[ji,Cr]]),fs=e=>ds.get(e)??e,ps=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=ls(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=us[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(fs);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ms=(e,t,n,r)=>{n.not={}},hs=(e,t,n,r)=>{let i=e._zod.def,a=Tt(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},gs=(e,t,n,r)=>{Bo(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},_s=(e,t,n,r)=>{Bo(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},vs=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=ls(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=q(a.element,t,{...r,path:[...r.path,`items`]})};function ys(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?ys(t.out):t.type===`catch`?ys(t.innerType):e._zod.optin}var bs=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Bo(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)k(i.properties,e,q(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?ys(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=q(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},xs=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>q(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ss=(e,t,n,r)=>{let i=e._zod.def,a=q(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=q(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Cs=(e,t,n,r)=>{let i=e._zod.def,a=q(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ws=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ts=Symbol();function Es(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Bo(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ts):JSON.parse(o)}var Ds=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=Es(i.defaultValue,e,t,n,r);o!==Ts&&(n.default=o)},Os=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=Es(i.defaultValue,e,t,n,r);o!==Ts&&(n._prefault=o)},ks=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Bo(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},As=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;q(o,t,r);let s=t.seen.get(e);s.ref=o},js=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ms=(e,t,n,r)=>{let i=e._zod.def;q(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ns=new WeakSet([Object.prototype,Error.prototype]);function Ps(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var Y=B(`ZodError`,(e,t)=>{In.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Ns.has(n)||(Ns.add(n),Ps(n,`format`,e=>t=>zn(e,t)),Ps(n,`flatten`,e=>t=>Rn(e,t)),Ps(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Dt,2)}),Ps(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Dt,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Fs=Vn(Y),Is=Hn(Y),Ls=Un(Y),Rs=Gn(Y),zs=Zn(Y),Bs=Qn(Y),Vs=$n(Y),Hs=er(Y),Us=tr(Y),Ws=nr(Y),Gs=rr(Y),Ks=ir(Y);function qs(){H.localeError||U(La())}function Js(){H.memoizer||U({memoizer:Pa()})}var X=B(`ZodType`,(e,t)=>(qs(),G.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(M(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return N(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(nl(e,t))},superRefine(e,t){return this.check(rl(e,t))},overwrite(e){return this.check(Oo(e))},optional(){return Rc(this)},exactOptional(){return Bc(this)},nullable(){return Hc(this)},nullish(){return Rc(Hc(this))},nonoptional(e){return Jc(this,e)},array(){return Ec(this)},or(e){return Ac([this,e])},and(e){return Mc(this,e)},transform(e){return Qc(this,Ic(e))},default(e){return Wc(this,e)},prefault(e){return Kc(this,e)},catch(e){return Xc(this,e)},pipe(e){return Qc(this,e)},readonly(){return el(this)},describe(e){let t=this.clone();return Va.add(t,{description:e}),t},meta(...e){if(e.length===0)return Va.get(this);let t=this.clone();return Va.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return gn(this,`~standard`,{...Zr(this),jsonSchema:{input:Zo(this,`input`),output:Zo(this,`output`)}})},set"~standard"(e){L(this,`~standard`,e)},parse:function e(t,n){return Fs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Is(this,t,n,{callee:e})},safeParse(e,t){return Ls(this,e,t)},async safeParseAsync(e,t){return Rs(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){L(this,`spa`,e)},validate(e,t){return Jn(this,e,t)},validateAsync(e,t){return Xn(this,e,t)},encode:function e(t,n){return zs(this,t,n,{callee:e})},decode:function e(t,n){return Bs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Vs(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Hs(this,t,n,{callee:e})},safeEncode(e,t){return Us(this,e,t)},safeDecode(e,t){return Ws(this,e,t)},async safeEncodeAsync(e,t){return Gs(this,e,t)},async safeDecodeAsync(e,t){return Ks(this,e,t)},toJSONSchema(e){return Xo(this,{})(e)},get description(){return Va.get(this)?.description},get _def(){return this._zod.def}}),Ys=B(`_ZodString`,(e,t)=>{Qr.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ps(e,t,n,r)},_n({format:e=>ls(e).format??null,minLength:e=>ls(e).minimum??null,maxLength:e=>ls(e).maximum??null},{regex(...e){return this.check(So(...e))},includes(...e){return this.check(To(...e))},startsWith(...e){return this.check(Eo(...e))},endsWith(...e){return this.check(Do(...e))},min(...e){return this.check(bo(...e))},max(...e){return this.check(yo(...e))},length(...e){return this.check(xo(...e))},nonempty(...e){return this.check(bo(1,...e))},lowercase(e){return this.check(Co(e))},uppercase(e){return this.check(wo(e))},trim(){return this.check(Ao())},normalize(...e){return this.check(ko(...e))},toLowerCase(){return this.check(jo())},toUpperCase(){return this.check(Mo())},slugify(){return this.check(No())}})),Xs=B(`ZodString`,(e,t)=>{Qr.init(e,t),Ys.init(e,t)},{email(e){return this.check(Wa(nc,e))},url(e){return this.check(Xa(ac,e))},jwt(e){return this.check(fo(bc,e))},emoji(e){return this.check(Za(oc,e))},guid(e){return this.check(Ga(rc,e))},uuid(e){return this.check(Ka(ic,e))},uuidv4(e){return this.check(qa(ic,e))},uuidv6(e){return this.check(Ja(ic,e))},uuidv7(e){return this.check(Ya(ic,e))},nanoid(e){return this.check(Qa(sc,e))},cuid(e){return this.check($a(cc,e))},cuid2(e){return this.check(eo(lc,e))},ulid(e){return this.check(to(uc,e))},base64(e){return this.check(co(_c,e))},base64url(e){return this.check(lo(vc,e))},xid(e){return this.check(no(dc,e))},ksuid(e){return this.check(ro(fc,e))},ipv4(e){return this.check(io(pc,e))},ipv6(e){return this.check(ao(mc,e))},cidrv4(e){return this.check(oo(hc,e))},cidrv6(e){return this.check(so(gc,e))},e164(e){return this.check(uo(yc,e))},datetime(e){return this.check(po(Qs,e))},date(e){return this.check(mo($s,e))},time(e){return this.check(ho(ec,e))},duration(e){return this.check(go(tc,e))}});function Zs(e){return Ua(Xs,e)}var Z=B(`ZodStringFormat`,(e,t)=>{K.init(e,t),Ys.init(e,t)}),Qs=B(`ZodISODateTime`,(e,t)=>{_i.init(e,t),Z.init(e,t)}),$s=B(`ZodISODate`,(e,t)=>{vi.init(e,t),Z.init(e,t)}),ec=B(`ZodISOTime`,(e,t)=>{yi.init(e,t),Z.init(e,t)}),tc=B(`ZodISODuration`,(e,t)=>{bi.init(e,t),Z.init(e,t)}),nc=B(`ZodEmail`,(e,t)=>{ti.init(e,t),Z.init(e,t)}),rc=B(`ZodGUID`,(e,t)=>{$r.init(e,t),Z.init(e,t)}),ic=B(`ZodUUID`,(e,t)=>{ei.init(e,t),Z.init(e,t)}),ac=B(`ZodURL`,(e,t)=>{li.init(e,t),Z.init(e,t)}),oc=B(`ZodEmoji`,(e,t)=>{ui.init(e,t),Z.init(e,t)}),sc=B(`ZodNanoID`,(e,t)=>{di.init(e,t),Z.init(e,t)}),cc=B(`ZodCUID`,(e,t)=>{fi.init(e,t),Z.init(e,t)}),lc=B(`ZodCUID2`,(e,t)=>{pi.init(e,t),Z.init(e,t)}),uc=B(`ZodULID`,(e,t)=>{mi.init(e,t),Z.init(e,t)}),dc=B(`ZodXID`,(e,t)=>{hi.init(e,t),Z.init(e,t)}),fc=B(`ZodKSUID`,(e,t)=>{gi.init(e,t),Z.init(e,t)}),pc=B(`ZodIPv4`,(e,t)=>{xi.init(e,t),Z.init(e,t)}),mc=B(`ZodIPv6`,(e,t)=>{wi.init(e,t),Z.init(e,t)}),hc=B(`ZodCIDRv4`,(e,t)=>{Ti.init(e,t),Z.init(e,t)}),gc=B(`ZodCIDRv6`,(e,t)=>{Di.init(e,t),Z.init(e,t)}),_c=B(`ZodBase64`,(e,t)=>{Ai.init(e,t),Z.init(e,t)}),vc=B(`ZodBase64URL`,(e,t)=>{Ni.init(e,t),Z.init(e,t)}),yc=B(`ZodE164`,(e,t)=>{Pi.init(e,t),Z.init(e,t)}),bc=B(`ZodJWT`,(e,t)=>{Ii.init(e,t),Z.init(e,t)}),xc=B(`ZodUnknown`,(e,t)=>{Li.init(e,t),X.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Sc(){return _o(xc)}var Cc=B(`ZodNever`,(e,t)=>{Ri.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ms(e,t,n,r)});function wc(e){return vo(Cc,e)}var Tc=B(`ZodArray`,(e,t)=>{Js(),Hi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vs(e,t,n,r),e.element=t.element},{min(e,t){return this.check(bo(e,t))},nonempty(e){return this.check(bo(1,e))},max(e,t){return this.check(yo(e,t))},length(e,t){return this.check(xo(e,t))},unwrap(){return this.element}});function Ec(e,t){return Po(Tc,e,t)}var Dc=B(`ZodObject`,(e,t)=>{Js(),Ji.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bs(e,t,n,r),Sn(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Pc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(M(this._zod.def,{catchall:e}))},passthrough(){return this.clone(M(this._zod.def,{catchall:Sc()}))},loose(){return this.clone(M(this._zod.def,{catchall:Sc()}))},strict(){return this.clone(M(this._zod.def,{catchall:wc()}))},strip(){return this.clone(M(this._zod.def,{catchall:void 0}))},extend(e){return Qt(this,e)},safeExtend(e){return en(this,e)},merge(e){return tn(this,e)},pick(e){return Yt(this,e)},omit(e){return Zt(this,e)},partial(...e){return nn(Lc,this,e[0])},exactPartial(...e){return nn(zc,this,e[0],`exactPartial`)},required(...e){return rn(qc,this,e[0])}});function Oc(e,t){return new Dc({type:`object`,shape:e??{},...P(t)})}var kc=B(`ZodUnion`,(e,t)=>{Xi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xs(e,t,n,r),e.options=t.options});function Ac(e,t){return new kc({type:`union`,options:e,...P(t)})}var jc=B(`ZodIntersection`,(e,t)=>{Zi.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ss(e,t,n,r)});function Mc(e,t){return new jc({type:`intersection`,left:e,right:t})}var Nc=B(`ZodEnum`,(e,t)=>{ea.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hs(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Nc({...t,checks:[],...P(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Nc({...t,checks:[],...P(r),entries:i})}});function Pc(e,t){return new Nc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...P(t)})}var Fc=B(`ZodTransform`,(e,t)=>{Js(),ta.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_s(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kn(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(mn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(mn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ic(e){return new Fc({type:`transform`,transform:e})}var Lc=B(`ZodOptional`,(e,t)=>{ra.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rc(e){return new Lc({type:`optional`,innerType:e})}var zc=B(`ZodExactOptional`,(e,t)=>{ia.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ms(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bc(e){return new zc({type:`optional`,innerType:e})}var Vc=B(`ZodNullable`,(e,t)=>{aa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Cs(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hc(e){return new Vc({type:`nullable`,innerType:e})}var Uc=B(`ZodDefault`,(e,t)=>{oa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ds(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Wc(e,t){return new Uc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ht(t)}})}var Gc=B(`ZodPrefault`,(e,t)=>{ca.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Os(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kc(e,t){return new Gc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ht(t)}})}var qc=B(`ZodNonOptional`,(e,t)=>{la.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ws(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jc(e,t){return new qc({type:`nonoptional`,innerType:e,...P(t)})}var Yc=B(`ZodCatch`,(e,t)=>{fa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ks(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xc(e,t){return new Yc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:wn(t)})}var Zc=B(`ZodPipe`,(e,t)=>{pa.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>As(e,t,n,r),e.in=t.in,e.out=t.out});function Qc(e,t){return new Zc({type:`pipe`,in:e,out:t})}var $c=B(`ZodReadonly`,(e,t)=>{ha.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>js(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function el(e){return new $c({type:`readonly`,innerType:e})}var tl=B(`ZodCustom`,(e,t)=>{_a.init(e,t),X.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gs(e,t,n,r)});function nl(e,t={}){return Fo(tl,e,t)}function rl(e,t){return Io(e,t)}var Q=function(e){return e.ACTOR=`ACTOR`,e.ADDRESS=`ADDRESS`,e.ARRAY=`ARRAY`,e.BOOLEAN=`BOOLEAN`,e.CURRENCY=`CURRENCY`,e.DATE=`DATE`,e.DATE_TIME=`DATE_TIME`,e.EMAILS=`EMAILS`,e.FILES=`FILES`,e.FULL_NAME=`FULL_NAME`,e.LINKS=`LINKS`,e.MORPH_RELATION=`MORPH_RELATION`,e.MULTI_SELECT=`MULTI_SELECT`,e.NUMBER=`NUMBER`,e.NUMERIC=`NUMERIC`,e.PHONES=`PHONES`,e.POSITION=`POSITION`,e.RATING=`RATING`,e.RAW_JSON=`RAW_JSON`,e.RELATION=`RELATION`,e.RICH_TEXT=`RICH_TEXT`,e.SELECT=`SELECT`,e.TEXT=`TEXT`,e.TS_VECTOR=`TS_VECTOR`,e.UUID=`UUID`,e}({}),il=function(e){return e.Verify=`/verify`,e.VerifyEmail=`/verify-email`,e.SignInUp=`/welcome`,e.Invite=`/invite/:workspaceInviteHash`,e.ResetPassword=`/reset-password/:passwordResetToken`,e.WorkspaceActivation=`/workspace-activation`,e.CreateProfile=`/create/profile`,e.SyncEmails=`/sync/emails`,e.InviteTeam=`/invite-team`,e.PlanRequired=`/plan-required`,e.PlanRequiredSuccess=`/plan-required/payment-success`,e.BookCall=`/book-call`,e.AiChat=`/chat/:threadId?`,e.AiChatInbox=`/inbox/:threadId?`,e.GettingStarted=`/getting-started`,e.Index=`/`,e.Home=`/home`,e.TasksPage=`/objects/tasks`,e.OpportunitiesPage=`/objects/opportunities`,e.RecordIndexPage=`/objects/:objectNamePlural`,e.RecordShowPage=`/object/:objectNameSingular/:objectRecordId`,e.PageLayoutPage=`/page/:pageLayoutId`,e.WorkflowIndexPage=`/workflows`,e.WorkflowCoreShowPage=`/workflow/:coreWorkflowId`,e.AgentIndexPage=`/agents`,e.AgentShowPage=`/agent/:agentId`,e.Settings=`settings`,e.SettingsCatchAll=`/settings/*`,e.Developers=`developers`,e.DevelopersCatchAll=`/developers/*`,e.Authorize=`/authorize`,e.Dpa=`/dpa`,e.NotFoundWildcard=`*`,e.NotFound=`/not-found`,e}({}),al=function(e){return e.EMAIL=`EMAIL`,e.CALENDAR=`CALENDAR`,e.WORKFLOW=`WORKFLOW`,e.AGENT=`AGENT`,e.API=`API`,e.IMPORT=`IMPORT`,e.MANUAL=`MANUAL`,e.SYSTEM=`SYSTEM`,e.WEBHOOK=`WEBHOOK`,e.APPLICATION=`APPLICATION`,e}({});Q.ACTOR,Q.SELECT,Object.keys(al).map((e,t)=>({id:(0,n.v4)(),label:`${al[e].toLowerCase()}`,value:e,position:t})),Q.UUID,Q.TEXT,Q.RAW_JSON,Q.ADDRESS,Q.TEXT,Q.TEXT,Q.TEXT,Q.TEXT,Q.TEXT,Q.TEXT,Q.NUMERIC,Q.NUMERIC,Q.CURRENCY,Q.NUMERIC,Q.TEXT,Q.EMAILS,Q.TEXT,Q.RAW_JSON,Q.FULL_NAME,Q.TEXT,Q.TEXT,Q.LINKS,Q.TEXT,Q.TEXT,Q.RAW_JSON,Q.PHONES,Q.TEXT,Q.TEXT,Q.TEXT,Q.RAW_JSON,Q.RICH_TEXT,Q.TEXT,Q.TEXT,Q.TEXT,Oc({tiptap:Zs().nullable().optional(),markdown:Zs().nullable().optional(),blocknote:Zs().nullable().optional()}),Q.LINKS,Q.CURRENCY,Q.FULL_NAME,Q.ADDRESS,Q.ACTOR,Q.EMAILS,Q.PHONES,Q.RICH_TEXT,Q.RELATION,Q.MORPH_RELATION,Q.FILES,Q.TS_VECTOR;var ol=function(e){return e.CommandMenuDisplay=`command-menu-display`,e.ViewRecord=`view-record`,e.ViewRecords=`view-records`,e.MergeRecords=`merge-records`,e.MergeWithRecord=`merge-with-record`,e.UpdateRecords=`update-records`,e.EditRichText=`edit-rich-text`,e.Copilot=`copilot`,e.WorkflowTriggerSelectType=`workflow-trigger-select-type`,e.WorkflowStepCreate=`workflow-step-create`,e.WorkflowStepEditType=`workflow-step-edit-type`,e.WorkflowStepView=`workflow-step-view`,e.WorkflowStepEdit=`workflow-step-edit`,e.WorkflowRunStepView=`workflow-run-step-view`,e.WorkflowStepSettings=`workflow-step-settings`,e.SearchRecords=`search-records`,e.SearchAiChats=`search-ai-chats`,e.AskAI=`ask-ai`,e.PageLayoutDashboardWidgetTypeSelect=`page-layout-dashboard-widget-type-select`,e.PageLayoutTabSettings=`page-layout-tab-settings`,e.PageLayoutWidgetSettings=`page-layout-widget-settings`,e.DashboardChartSettings=`dashboard-chart-settings`,e.DashboardIframeSettings=`dashboard-iframe-settings`,e.DashboardRecordTableSettings=`dashboard-record-table-settings`,e.RecordPageFieldsSettings=`record-page-fields-settings`,e.RecordPageFieldSettings=`record-page-field-settings`,e.ViewFrontComponent=`view-front-component`,e.CommandMenuEdit=`command-menu-edit`,e.PageLayoutRecordPageWidgetTypeSelect=`page-layout-record-page-widget-type-select`,e.ComposeEmail=`compose-email`,e.ComposeCalendarEvent=`compose-calendar-event`,e.CreateRelatedRecord=`create-related-record`,e.RecordCreationForm=`record-creation-form`,e.RecordCreationFormSettings=`record-creation-form-settings`,e.RecordUpdateForm=`record-update-form`,e.SendCampaign=`send-campaign`,e.SendCampaignTest=`send-campaign-test`,e.AddToMessageList=`add-to-message-list`,e.WorkflowVersions=`workflow-versions`,e.WorkflowVersion=`workflow-version`,e.EmailBlockSettings=`email-block-settings`,e.EmailPageStyle=`email-page-style`,e.EmailBlockStyle=`email-block-style`,e.SettingsMetadataTranslations=`settings-metadata-translations`,e.RoutedPage=`routed-page`,e.WorkflowCoreFilters=`workflow-core-filters`,e.AgentCoreFilters=`agent-core-filters`,e.ShareRecord=`share-record`,e.SnoozeAiChat=`snooze-ai-chat`,e.AssignAiChat=`assign-ai-chat`,e}({}),sl=`frontComponentHostCommunicationApi`;globalThis[sl]??={};var $=globalThis.frontComponentHostCommunicationApi,cl=()=>{let e=$.closeSidePanel;if(!g(e))throw Error(`closeSidePanelFunction is not set`);return e()},ll=e=>{let t=$.copyToClipboard;if(!g(t))throw Error(`copyToClipboardFunction is not set`);return t(e)},ul=e=>{let t=process.env.applicationVariables;if(t)return JSON.parse(t)[e]},dl=e=>{let t=$.enqueueSnackbar;if(!g(t))throw Error(`enqueueSnackbarFunction is not set`);return t(e)},fl=(e,t,n,r)=>{let i=$.navigate;if(!g(i))throw Error(`navigateFunction is not set`);return i(e,t,n,r)},pl=e=>{let t=$.openCommandConfirmationModal;if(!g(t))throw Error(`openCommandConfirmationModalFunction is not set`);return t(e)},ml=e=>{let t=$.openSidePanelPage;if(!g(t))throw Error(`openSidePanelPageFunction is not set`);return t(e)},hl=()=>{let e=$.unmountFrontComponent;if(!g(e))throw Error(`unmountFrontComponentFunction is not set`);return e()},gl=e=>{let t=$.updateProgress;if(!g(t))throw Error(`updateProgressFunction is not set`);return t(e)},_l=(e,t)=>{let n=$.uploadFile;if(!g(n))throw Error(`uploadFileFunction is not set`);return n(e,t)},vl=e=>e.colorScheme,yl=()=>d(vl),bl=e=>e.frontComponentId,xl=()=>d(bl),Sl=()=>{let t=p();return{locale:t,t:(0,e.useCallback)((e,n)=>bt(e,n,t),[t])}},Cl=e=>e.location??null,wl=()=>d(Cl),Tl=e=>e.selectedRecordIds.length===1?e.selectedRecordIds[0]:null,El=()=>d(Tl),Dl=e=>e.toolCall??null,Ol=()=>d(Dl),kl=e=>e.selectedRecordIds,Al=()=>d(kl),jl=e=>e.selectedRecordsFilter??null,Ml=()=>d(jl),Nl=e=>e.selectedObjectMetadata??null,Pl=()=>d(Nl),Fl=()=>d(e=>e.timelineActivityId),Il=e=>e.userId,Ll=()=>d(Il),Rl=e=>m(e),zl=()=>c()?.locale??`en`,Bl=(e,t)=>bt(e,t,zl()),Vl=e=>`${e}-command-error`,Hl=({execute:t})=>{let[n,r]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{n||(r(!0),(async()=>{await t(),await hl()})())},[t,n,xl()]),null},Ul=({to:t,params:n,queryParams:r,options:i})=>{let[a,o]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{a||(o(!0),(async()=>{await fl(t,n,r,i),await hl()})())},[t,n,r,i,a,xl()]),null},Wl=t=>{let[n,r]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{n||(r(!0),(async()=>{await ml(t),await hl()})())},[t,n,xl()]),null},Gl=({title:t,subtitle:n,execute:r,confirmButtonText:i,confirmButtonAccent:a})=>{let[o,s]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{o||(s(!0),(async()=>{await pl({title:t,subtitle:n,confirmButtonText:i,confirmButtonAccent:a})===`confirm`&&await r(),await hl()})())},[t,n,r,i,a,o,xl()]),null},Kl=async e=>{let{sendInboxMessage:t}=await new r.MetadataApiClient().mutation({sendInboxMessage:{__args:{input:e},threadId:!0}});return t},ql=/\[/g,Jl=/\]/g,Yl=/\r?\n/g,Xl=e=>e.replace(ql,`(`).replace(Jl,`)`).replace(Yl,` `).trim(),Zl=async({workspaceMemberId:e})=>{let{data:{workspaceMember:n}}=await new i.RestApiClient().get(`/rest/workspaceMembers/${e}`),r=`${n.name.firstName??``} ${n.name.lastName??``}`.trim();return wt({objectNameSingular:`workspaceMember`,recordId:e,displayName:Xl((0,t.isNonEmptyString)(r)?r:n.userEmail)})},Ql=({fullName:e,partName:n})=>{let r=(0,t.isObject)(e)?Reflect.get(e,n):void 0;return(0,t.isString)(r)?r:``},$l=({record:e,recordId:t,labelIdentifierField:n})=>{if(!g(n))return t;let r=e[n.name];return n.type===`FULL_NAME`?`${Ql({fullName:r,partName:`firstName`})} ${Ql({fullName:r,partName:`lastName`})}`.trim():g(r)?String(r):``},eu=async({metadataClient:e,objectMetadata:t})=>{if(!g(t.labelIdentifierFieldMetadataId))return;let{object:n}=await e.query({object:{__args:{id:t.id},fields:{__args:{filter:{id:{eq:t.labelIdentifierFieldMetadataId}},paging:{first:1}},edges:{node:{name:!0,type:!0}}}}});return n.fields.edges[0]?.node},tu=1e3,nu=async({metadataClient:e,objectNameSingular:t})=>{let{objects:n}=await e.query({objects:{__args:{filter:{},paging:{first:tu}},edges:{node:{id:!0,nameSingular:!0,namePlural:!0,labelIdentifierFieldMetadataId:!0}}}}),r=n.edges.find(({node:e})=>e.nameSingular===t)?.node;if(!g(r))throw Error(`This workspace has no ${t} object.`);return r},ru=async({objectNameSingular:e,recordId:t})=>{let n=new r.MetadataApiClient,a=await nu({metadataClient:n,objectNameSingular:e}),[o,s]=await Promise.all([eu({metadataClient:n,objectMetadata:a}),new i.RestApiClient().get(`/rest/${a.namePlural}/${t}`)]);return wt({objectNameSingular:e,recordId:t,displayName:Xl($l({record:s.data[e],recordId:t,labelIdentifierField:o}))})},iu=wt({objectNameSingular:Ct,recordId:Ct,displayName:`Ada`}),au=async e=>{await new r.MetadataApiClient().mutation({attachRecordToInboxThread:{__args:{input:e}}})},ou=async e=>{await new r.MetadataApiClient().mutation({detachRecordFromInboxThread:{__args:{input:e}}})};exports.AppPath=il,exports.Command=Hl,exports.CommandLink=Ul,exports.CommandModal=Gl,exports.CommandOpenSidePanelPage=Wl,exports.INBOX_ASSISTANT_MENTION=iu,exports.SidePanelPages=ol,exports.Trans=St,exports.attachRecordToInboxThread=au,exports.closeSidePanel=cl,exports.copyToClipboard=ll,exports.detachRecordFromInboxThread=ou,exports.enqueueSnackbar=dl,exports.getApplicationVariable=ul,exports.getFrontComponentCommandErrorDedupeKey=Vl,exports.inboxMention=Zl,exports.inboxReferenceRecord=ru,exports.msg=Rl,exports.navigate=fl,exports.openCommandConfirmationModal=pl,exports.openSidePanelPage=ml,exports.sendInboxMessage=Kl,exports.t=Bl,exports.unmountFrontComponent=hl,exports.updateProgress=gl,exports.uploadFile=_l,exports.useColorScheme=yl,exports.useFrontComponentExecutionContext=d,exports.useFrontComponentId=xl,exports.useLocale=p,exports.useLocation=wl,exports.useRecordId=El,exports.useSelectedObjectMetadata=Pl,exports.useSelectedRecordIds=Al,exports.useSelectedRecordsFilter=Ml,exports.useTimelineActivityId=Fl,exports.useToolCall=Ol,exports.useTranslate=Sl,exports.useUserId=Ll;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("@sniptt/guards"),n=require("twenty-client-sdk/metadata"),r=require("twenty-client-sdk/rest");var i=e=>!(0,t.isUndefined)(e)&&!(0,t.isNull)(e),a=(e,t)=>typeof e[t]==`function`&&e[t]!==Object.prototype[t],o=(e,t)=>{if(e===t)return!0;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(e.constructor!==t.constructor)return!1;if(Array.isArray(e)){let n=e,r=t;if(n.length!==r.length)return!1;for(let e=n.length;e--!==0;)if(!o(n[e],r[e]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n]of e.entries())if(!t.has(n))return!1;for(let[n,r]of e.entries())if(!o(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){let n=e,r=t;if(n.length!==r.length)return!1;for(let e=n.length;e--!==0;)if(n[e]!==r[e])return!1;return!0}if(e.constructor===RegExp){let n=e,r=t;return n.source===r.source&&n.flags===r.flags}if(a(e,`valueOf`)&&a(t,`valueOf`))return e.valueOf()===t.valueOf();if(a(e,`toString`)&&a(t,`toString`))return e.toString()===t.toString();let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e=n.length;e--!==0;)if(!(n[e]in t))return!1;for(let r=n.length;r--!==0;){let i=n[r];if(!o(e[i],t[i]))return!1}return!0}return e!==e&&t!==t},s=function(e){return e.Verify=`/verify`,e.VerifyEmail=`/verify-email`,e.SignInUp=`/welcome`,e.Invite=`/invite/:workspaceInviteHash`,e.ResetPassword=`/reset-password/:passwordResetToken`,e.WorkspaceActivation=`/workspace-activation`,e.CreateProfile=`/create/profile`,e.SyncEmails=`/sync/emails`,e.InviteTeam=`/invite-team`,e.PlanRequired=`/plan-required`,e.PlanRequiredSuccess=`/plan-required/payment-success`,e.BookCall=`/book-call`,e.AiChat=`/chat/:threadId?`,e.AiChatInbox=`/inbox/:threadId?`,e.GettingStarted=`/getting-started`,e.Index=`/`,e.Home=`/home`,e.TasksPage=`/objects/tasks`,e.OpportunitiesPage=`/objects/opportunities`,e.RecordIndexPage=`/objects/:objectNamePlural`,e.RecordShowPage=`/object/:objectNameSingular/:objectRecordId`,e.PageLayoutPage=`/page/:pageLayoutId`,e.WorkflowIndexPage=`/workflows`,e.WorkflowCoreShowPage=`/workflow/:coreWorkflowId`,e.AgentIndexPage=`/agents`,e.AgentShowPage=`/agent/:agentId`,e.Settings=`settings`,e.SettingsCatchAll=`/settings/*`,e.Developers=`developers`,e.DevelopersCatchAll=`/developers/*`,e.Authorize=`/authorize`,e.Dpa=`/dpa`,e.NotFoundWildcard=`*`,e.NotFound=`/not-found`,e}({}),c=({objectNameSingular:e,recordId:t,displayName:n})=>`[[record:${e}:${t}:${n}]]`,l=`__twentySdkExecutionContext__`,u=`__twentySdkContextListeners__`,d=()=>(globalThis.__twentySdkContextListeners__||(globalThis[u]=new Set),globalThis[u]),f=()=>globalThis[l],ee=e=>{d().add(e)},p=e=>{d().delete(e)},m=t=>{let[n,r]=(0,e.useState)(()=>t(f())),i=(0,e.useRef)(n);return(0,e.useEffect)(()=>{let e=()=>{let e=t(f());o(e,i.current)||(i.current=e,r(e))};return ee(e),e(),()=>p(e)},[t]),n},h=e=>e.locale??`en`,g=()=>m(h),_=e=>typeof e==`string`?{message:e}:e,te=e=>e.replace(/\s+/g,` `).trim();function v(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function y(e,...t){if(!v(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function b(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function ne(e,t){y(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function x(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function S(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}typeof Uint8Array.from([]).toHex==`function`&&Uint8Array.fromHex;function w(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function T(e){return typeof e==`string`&&(e=w(e)),y(e),e}var E=class{};function re(e){let t=t=>e().update(T(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ie(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function ae(e,t,n){return e&t^~e&n}function oe(e,t,n){return e&t^e&n^t&n}var se=class extends E{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=S(this.buffer)}update(e){b(this),e=T(e),y(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=S(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){b(this),ne(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,x(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ie(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=S(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}},D=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),O=BigInt(2**32-1),k=BigInt(32);function ce(e,t=!1){return t?{h:Number(e&O),l:Number(e>>k&O)}:{h:Number(e>>k&O)|0,l:Number(e&O)|0}}function le(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=ce(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var ue=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),A=new Uint32Array(64),j=class extends se{constructor(e=32){super(64,e,8,!1),this.A=D[0]|0,this.B=D[1]|0,this.C=D[2]|0,this.D=D[3]|0,this.E=D[4]|0,this.F=D[5]|0,this.G=D[6]|0,this.H=D[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)A[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=A[e-15],n=A[e-2],r=C(t,7)^C(t,18)^t>>>3;A[e]=(C(n,17)^C(n,19)^n>>>10)+A[e-7]+r+A[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=C(o,6)^C(o,11)^C(o,25),u=l+t+ae(o,s,c)+ue[e]+A[e]|0,d=(C(n,2)^C(n,13)^C(n,22))+oe(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){x(A)}destroy(){this.set(0,0,0,0,0,0,0,0),x(this.buffer)}},M=le(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e)));M[0],M[1];var N=re(()=>new j),P=``,F=5e4,I=new Map,L=e=>typeof Buffer<`u`?Buffer.from(e).toString(`base64`):btoa(String.fromCharCode(...e)),R=(e,t=``)=>{let n=e+P+(t||``),r=I.get(n);if(i(r))return r;let a=L(N(w(n))).slice(0,6);return I.size>=F&&I.clear(),I.set(n,a),a},z=/\{(\w+)\}/g,B=(e,t)=>i(t)?e.replace(z,(e,n)=>{let r=t[n];return i(r)?String(r):e}):e,V=()=>globalThis.__twentySdkFrontComponentTranslations__??{},H=(e,t,n)=>{let{message:r,context:i}=_(e),a=V()[n]?.[R(r,i)];return B(a??r,t)},U=(e,t)=>{if(e!==void 0)return e;if(typeof t==`string`)return te(t)},de=({children:e,message:t,context:n,values:r})=>{let i=g(),a=U(t,e);return a===void 0?e:H({message:a,context:n},r,i)},fe=`frontComponentHostCommunicationApi`;globalThis[fe]??={};var W=globalThis.frontComponentHostCommunicationApi,pe=()=>{let e=W.closeSidePanel;if(!i(e))throw Error(`closeSidePanelFunction is not set`);return e()},me=e=>{let t=W.copyToClipboard;if(!i(t))throw Error(`copyToClipboardFunction is not set`);return t(e)},he=e=>{let t=process.env.applicationVariables;if(t)return JSON.parse(t)[e]},ge=e=>{let t=W.enqueueSnackbar;if(!i(t))throw Error(`enqueueSnackbarFunction is not set`);return t(e)},G=(e,t,n,r)=>{let a=W.navigate;if(!i(a))throw Error(`navigateFunction is not set`);return a(e,t,n,r)},K=e=>{let t=W.openCommandConfirmationModal;if(!i(t))throw Error(`openCommandConfirmationModalFunction is not set`);return t(e)},q=e=>{let t=W.openSidePanelPage;if(!i(t))throw Error(`openSidePanelPageFunction is not set`);return t(e)},J=()=>{let e=W.unmountFrontComponent;if(!i(e))throw Error(`unmountFrontComponentFunction is not set`);return e()},_e=e=>{let t=W.updateProgress;if(!i(t))throw Error(`updateProgressFunction is not set`);return t(e)},ve=(e,t)=>{let n=W.uploadFile;if(!i(n))throw Error(`uploadFileFunction is not set`);return n(e,t)},ye=e=>e.colorScheme,be=()=>m(ye),xe=e=>e.frontComponentId,Y=()=>m(xe),Se=()=>{let t=g();return{locale:t,t:(0,e.useCallback)((e,n)=>H(e,n,t),[t])}},Ce=e=>e.location??null,we=()=>m(Ce),Te=e=>e.selectedRecordIds.length===1?e.selectedRecordIds[0]:null,Ee=()=>m(Te),De=e=>e.toolCall??null,Oe=()=>m(De),ke=e=>e.selectedRecordIds,Ae=()=>m(ke),je=e=>e.selectedRecordsFilter??null,Me=()=>m(je),Ne=e=>e.selectedObjectMetadata??null,Pe=()=>m(Ne),Fe=()=>m(e=>e.timelineActivityId),Ie=e=>e.userId,Le=()=>m(Ie),Re=e=>_(e),ze=()=>f()?.locale??`en`,Be=(e,t)=>H(e,t,ze()),Ve=e=>`${e}-command-error`,He=({execute:t})=>{let[n,r]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{n||(r(!0),(async()=>{await t(),await J()})())},[t,n,Y()]),null},Ue=({to:t,params:n,queryParams:r,options:i})=>{let[a,o]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{a||(o(!0),(async()=>{await G(t,n,r,i),await J()})())},[t,n,r,i,a,Y()]),null},We=t=>{let[n,r]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{n||(r(!0),(async()=>{await q(t),await J()})())},[t,n,Y()]),null},Ge=({title:t,subtitle:n,execute:r,confirmButtonText:i,confirmButtonAccent:a})=>{let[o,s]=(0,e.useState)(!1);return(0,e.useEffect)(()=>{o||(s(!0),(async()=>{await K({title:t,subtitle:n,confirmButtonText:i,confirmButtonAccent:a})===`confirm`&&await r(),await J()})())},[t,n,r,i,a,o,Y()]),null},Ke=async e=>{let{sendInboxMessage:t}=await new n.MetadataApiClient().mutation({sendInboxMessage:{__args:{input:e},threadId:!0}});return t},X=`agentChatAssistant`,qe=/\[/g,Je=/\]/g,Ye=/\r?\n/g,Z=e=>e.replace(qe,`(`).replace(Je,`)`).replace(Ye,` `).trim(),Q=async({workspaceMemberId:e})=>{let{data:{workspaceMember:n}}=await new r.RestApiClient().get(`/rest/workspaceMembers/${e}`),i=`${n.name.firstName??``} ${n.name.lastName??``}`.trim();return c({objectNameSingular:`workspaceMember`,recordId:e,displayName:Z((0,t.isNonEmptyString)(i)?i:n.userEmail)})},$=({fullName:e,partName:n})=>{let r=(0,t.isObject)(e)?Reflect.get(e,n):void 0;return(0,t.isString)(r)?r:``},Xe=({record:e,recordId:t,labelIdentifierField:n})=>{if(!i(n))return t;let r=e[n.name];return n.type===`FULL_NAME`?`${$({fullName:r,partName:`firstName`})} ${$({fullName:r,partName:`lastName`})}`.trim():i(r)?String(r):``},Ze=async({metadataClient:e,objectMetadata:t})=>{if(!i(t.labelIdentifierFieldMetadataId))return;let{object:n}=await e.query({object:{__args:{id:t.id},fields:{__args:{filter:{id:{eq:t.labelIdentifierFieldMetadataId}},paging:{first:1}},edges:{node:{name:!0,type:!0}}}}});return n.fields.edges[0]?.node},Qe=1e3,$e=async({metadataClient:e,objectNameSingular:t})=>{let{objects:n}=await e.query({objects:{__args:{filter:{},paging:{first:Qe}},edges:{node:{id:!0,nameSingular:!0,namePlural:!0,labelIdentifierFieldMetadataId:!0}}}}),r=n.edges.find(({node:e})=>e.nameSingular===t)?.node;if(!i(r))throw Error(`This workspace has no ${t} object.`);return r},et=async({objectNameSingular:e,recordId:t})=>{let i=new n.MetadataApiClient,a=await $e({metadataClient:i,objectNameSingular:e}),[o,s]=await Promise.all([Ze({metadataClient:i,objectMetadata:a}),new r.RestApiClient().get(`/rest/${a.namePlural}/${t}`)]);return c({objectNameSingular:e,recordId:t,displayName:Z(Xe({record:s.data[e],recordId:t,labelIdentifierField:o}))})},tt=c({objectNameSingular:X,recordId:X,displayName:`Ada`}),nt=async e=>{await new n.MetadataApiClient().mutation({attachRecordToInboxThread:{__args:{input:e}}})},rt=async e=>{await new n.MetadataApiClient().mutation({detachRecordFromInboxThread:{__args:{input:e}}})},it=async e=>{await new n.MetadataApiClient().mutation({archiveInboxThread:{__args:{input:e}}})},at=function(e){return e.CommandMenuDisplay=`command-menu-display`,e.ViewRecord=`view-record`,e.ViewRecords=`view-records`,e.MergeRecords=`merge-records`,e.MergeWithRecord=`merge-with-record`,e.UpdateRecords=`update-records`,e.EditRichText=`edit-rich-text`,e.Copilot=`copilot`,e.WorkflowTriggerSelectType=`workflow-trigger-select-type`,e.WorkflowStepCreate=`workflow-step-create`,e.WorkflowStepEditType=`workflow-step-edit-type`,e.WorkflowStepView=`workflow-step-view`,e.WorkflowStepEdit=`workflow-step-edit`,e.WorkflowRunStepView=`workflow-run-step-view`,e.WorkflowStepSettings=`workflow-step-settings`,e.SearchRecords=`search-records`,e.SearchAiChats=`search-ai-chats`,e.AskAI=`ask-ai`,e.PageLayoutDashboardWidgetTypeSelect=`page-layout-dashboard-widget-type-select`,e.PageLayoutTabSettings=`page-layout-tab-settings`,e.PageLayoutWidgetSettings=`page-layout-widget-settings`,e.DashboardChartSettings=`dashboard-chart-settings`,e.DashboardIframeSettings=`dashboard-iframe-settings`,e.DashboardRecordTableSettings=`dashboard-record-table-settings`,e.RecordPageFieldsSettings=`record-page-fields-settings`,e.RecordPageFieldSettings=`record-page-field-settings`,e.ViewFrontComponent=`view-front-component`,e.CommandMenuEdit=`command-menu-edit`,e.PageLayoutRecordPageWidgetTypeSelect=`page-layout-record-page-widget-type-select`,e.ComposeEmail=`compose-email`,e.ComposeCalendarEvent=`compose-calendar-event`,e.CreateRelatedRecord=`create-related-record`,e.RecordCreationForm=`record-creation-form`,e.RecordCreationFormSettings=`record-creation-form-settings`,e.RecordUpdateForm=`record-update-form`,e.SendCampaign=`send-campaign`,e.SendCampaignTest=`send-campaign-test`,e.AddToMessageList=`add-to-message-list`,e.WorkflowVersions=`workflow-versions`,e.WorkflowVersion=`workflow-version`,e.EmailBlockSettings=`email-block-settings`,e.EmailPageStyle=`email-page-style`,e.EmailBlockStyle=`email-block-style`,e.SettingsMetadataTranslations=`settings-metadata-translations`,e.RoutedPage=`routed-page`,e.WorkflowCoreFilters=`workflow-core-filters`,e.AgentCoreFilters=`agent-core-filters`,e.AgentCoreTriggerType=`agent-core-trigger-type`,e.AgentCoreTrigger=`agent-core-trigger`,e.AgentCoreDataAccess=`agent-core-data-access`,e.AgentCoreTools=`agent-core-tools`,e.ShareRecord=`share-record`,e.SnoozeAiChat=`snooze-ai-chat`,e.AssignAiChat=`assign-ai-chat`,e}({});exports.AppPath=s,exports.Command=He,exports.CommandLink=Ue,exports.CommandModal=Ge,exports.CommandOpenSidePanelPage=We,exports.INBOX_ASSISTANT_MENTION=tt,exports.SidePanelPages=at,exports.Trans=de,exports.archiveInboxThread=it,exports.attachRecordToInboxThread=nt,exports.closeSidePanel=pe,exports.copyToClipboard=me,exports.detachRecordFromInboxThread=rt,exports.enqueueSnackbar=ge,exports.getApplicationVariable=he,exports.getFrontComponentCommandErrorDedupeKey=Ve,exports.inboxMention=Q,exports.inboxReferenceRecord=et,exports.msg=Re,exports.navigate=G,exports.openCommandConfirmationModal=K,exports.openSidePanelPage=q,exports.sendInboxMessage=Ke,exports.t=Be,exports.unmountFrontComponent=J,exports.updateProgress=_e,exports.uploadFile=ve,exports.useColorScheme=be,exports.useFrontComponentExecutionContext=m,exports.useFrontComponentId=Y,exports.useLocale=g,exports.useLocation=we,exports.useRecordId=Ee,exports.useSelectedObjectMetadata=Pe,exports.useSelectedRecordIds=Ae,exports.useSelectedRecordsFilter=Me,exports.useTimelineActivityId=Fe,exports.useToolCall=Oe,exports.useTranslate=Se,exports.useUserId=Le;
75
2
  //# sourceMappingURL=index.cjs.map