@oomol-lab/open-flow 0.1.0-beta.85 → 0.1.0-beta.86

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.
Files changed (97) hide show
  1. package/dist/browser/{FlowCanvas-CZoHhB1y.js → FlowCanvas-CHIaMaBv.js} +3 -3
  2. package/dist/browser/{createResourceDialog-Bi4fUnbD.js → createResourceDialog-C0E5yPe6.js} +3 -3
  3. package/dist/browser/{dialog-BzoSxhXQ.js → dialog-b3hsdu8i.js} +291 -143
  4. package/dist/browser/{exportPng-CXVWVlLc.js → exportPng-DGHcejgy.js} +2 -2
  5. package/dist/browser/{flowChanges-C567g-Pc.js → flowChanges-BvSWezEb.js} +375 -83
  6. package/dist/browser/{flowWorkspace-BNdBKtla.js → flowWorkspace-BKnMRClO.js} +1619 -475
  7. package/dist/browser/fr-CNTSedYU.js +593 -0
  8. package/dist/browser/ja-CxQBHr2J.js +593 -0
  9. package/dist/browser/ko-D1Exiv1h.js +593 -0
  10. package/dist/browser/licenses.md +1 -1
  11. package/dist/browser/{markdownContent-DF39sd9T.js → markdownContent-BR9-1ikU.js} +1 -1
  12. package/dist/browser/preview.css +181 -181
  13. package/dist/browser/preview.js +1994 -623
  14. package/dist/browser/ru-BzLZv0B7.js +593 -0
  15. package/dist/browser/{tooltip-DGj5pudg.js → tooltip-DSBF3bRw.js} +55 -23
  16. package/dist/browser/workbench.css +181 -181
  17. package/dist/browser/workbench.js +86 -17
  18. package/dist/browser/{workbenchSelect-BIaEVTx6.js → workbenchSelect-Di1Bm_-d.js} +2 -2
  19. package/dist/browser/{wrapLayout-C4moMKgb.js → wrapLayout-B0AT8_-i.js} +1 -1
  20. package/dist/browser/zh-CN-Dg_xSGde.js +593 -0
  21. package/dist/browser/zh-TW-oxuLwsV0.js +593 -0
  22. package/dist/command/index.js +61 -57
  23. package/dist/command/licenses.md +28 -4
  24. package/dist/common/authoring.d.ts +5 -5
  25. package/dist/common/authoringExamples.d.ts +3 -2
  26. package/dist/common/authoringSchema.d.ts +41 -4
  27. package/dist/common/catalogCache.d.ts +46 -0
  28. package/dist/common/connector-action.js +13 -10
  29. package/dist/common/connector-proxy.d.ts +96 -0
  30. package/dist/common/connector-proxy.js +5209 -0
  31. package/dist/common/control-api-conformance.js +312 -46
  32. package/dist/common/control-api.d.ts +12 -1
  33. package/dist/common/control-api.js +303 -41
  34. package/dist/common/control-requests.d.ts +4 -3
  35. package/dist/common/control-requests.js +14111 -171
  36. package/dist/common/engine-contract.d.ts +3 -2
  37. package/dist/common/event-source.js +55 -23
  38. package/dist/common/flow-authoring-node.d.ts +2 -0
  39. package/dist/common/flow-authoring.js +6936 -6781
  40. package/dist/common/flow-change-schema.d.ts +1 -1
  41. package/dist/common/flow-change.d.ts +2 -2
  42. package/dist/common/flow-change.js +91 -36
  43. package/dist/common/flow-connectionUsage.d.ts +1 -1
  44. package/dist/common/flow-encoding.js +93 -38
  45. package/dist/common/flow-requestParameters.d.ts +34 -0
  46. package/dist/common/flow-semantics.js +9429 -9236
  47. package/dist/common/flow-state.js +55 -23
  48. package/dist/common/flow-workflowFile.d.ts +3 -1
  49. package/dist/common/http-request.d.ts +6 -11
  50. package/dist/common/http-request.js +192 -141
  51. package/dist/common/licenses.md +1 -1
  52. package/dist/common/mcp.d.ts +3 -3
  53. package/dist/common/mcp.js +303 -41
  54. package/dist/common/run-events.js +1 -0
  55. package/dist/common/runtime-contract.js +10 -4
  56. package/dist/common/runtime-nodejs-compat.js +55 -23
  57. package/dist/common/scheduler-checkpoint.d.ts +3 -3
  58. package/dist/common/scheduler-dependencies.d.ts +22 -28
  59. package/dist/common/scheduler-node-execution.d.ts +1 -0
  60. package/dist/common/scheduler.d.ts +8 -2
  61. package/dist/common/scheduler.js +274 -95
  62. package/dist/common/workflow.js +51 -19
  63. package/dist/common/workflowAuthoring.d.ts +411 -0
  64. package/dist/render/browser/licenses.md +1 -1
  65. package/dist/render/browser/runtime.js +180 -48
  66. package/dist/render/node/index.js +85 -30
  67. package/dist/render/node/licenses.md +1 -1
  68. package/package.json +1 -1
  69. package/skills/open-flow/references/flow-authoring.md +14 -13
  70. package/src/base/common/jsonSchema.ts +11 -0
  71. package/src/connector/common/actionSchema.ts +4 -11
  72. package/src/connector/common/proxy.ts +152 -0
  73. package/src/control/common/api.ts +99 -3
  74. package/src/control/common/authoring.ts +23 -9
  75. package/src/control/common/authoringExamples.ts +9 -0
  76. package/src/control/common/authoringSchema.ts +21 -12
  77. package/src/control/common/catalogCache.ts +145 -0
  78. package/src/control/common/conformance.ts +9 -3
  79. package/src/control/common/connectorQueries.ts +17 -2
  80. package/src/control/common/requests.ts +1 -0
  81. package/src/control/common/workflowAuthoring.ts +120 -0
  82. package/src/execution/common/checkpoint.ts +18 -12
  83. package/src/execution/common/dependencies.ts +132 -15
  84. package/src/execution/common/events.ts +3 -0
  85. package/src/execution/common/node-execution.ts +22 -15
  86. package/src/execution/common/scheduler.ts +20 -31
  87. package/src/flow/common/change.ts +2 -1
  88. package/src/flow/common/changeSchema.ts +11 -1
  89. package/src/flow/common/connectionUsage.ts +4 -2
  90. package/src/flow/common/errorHandling.ts +3 -1
  91. package/src/flow/common/nodeChanges.ts +35 -18
  92. package/src/flow/common/requestParameters.ts +120 -0
  93. package/src/flow/common/semantics.ts +51 -1
  94. package/src/flow/common/sourceField.ts +3 -2
  95. package/src/flow/common/workflowFile.ts +2 -2
  96. package/src/http/common/httpRequest.ts +28 -78
  97. package/src/runtime/common/engineContract.ts +6 -3
@@ -1,42 +1,46 @@
1
1
  // @bun
2
- var Fw=Object.defineProperty;var Mw=(e)=>e;function Zw(e,t){this[e]=Mw.bind(null,t)}var co=(e,t)=>{for(var n in t)Fw(e,n,{get:t[n],enumerable:!0,configurable:!0,set:Zw.bind(t,n)})};var Ot={};co(Ot,{anyString:()=>ra,base64:()=>Ws,base64url:()=>Gs,bigint:()=>ia,boolean:()=>sa,browserEmail:()=>Sv,cidrv4:()=>Us,cidrv6:()=>Ks,creditCard:()=>Io,cuid:()=>Ps,cuid2:()=>Ts,currencyCode:()=>Xs,date:()=>ea,datetime:()=>na,domain:()=>Qs,duration:()=>Vs,e164:()=>Ys,email:()=>Fs,emoji:()=>Ms,extendedDuration:()=>hv,guid:()=>Ls,hex:()=>da,hostname:()=>Hs,html5Email:()=>vv,httpProtocol:()=>er,iban:()=>Co,idnEmail:()=>xv,integer:()=>tr,ipv4:()=>Zs,ipv6:()=>Js,ksuid:()=>zs,lowercase:()=>la,mac:()=>Bs,md5_base64:()=>Ov,md5_base64url:()=>jv,md5_hex:()=>Ev,nanoid:()=>Ds,nanoidOfLength:()=>qs,null:()=>aa,number:()=>Bt,rfc5322Email:()=>kv,sha1_base64:()=>Rv,sha1_base64url:()=>Av,sha1_hex:()=>_v,sha256_base64:()=>Tv,sha256_base64url:()=>$v,sha256_hex:()=>Pv,sha384_base64:()=>zv,sha384_base64url:()=>Dv,sha384_hex:()=>Nv,sha512_base64:()=>Vv,sha512_base64url:()=>Lv,sha512_hex:()=>qv,string:()=>oa,time:()=>ta,ulid:()=>$s,undefined:()=>ca,unicodeEmail:()=>Pd,uppercase:()=>ua,uuid:()=>Jt,uuid4:()=>yv,uuid6:()=>bv,uuid7:()=>wv,xid:()=>Ns});var ul={};co(ul,{ZodAny:()=>lg,ZodArray:()=>mg,ZodBase64:()=>Xc,ZodBase64URL:()=>el,ZodBigInt:()=>il,ZodBigIntFormat:()=>sl,ZodBoolean:()=>ol,ZodCIDRv4:()=>Qc,ZodCIDRv6:()=>Yc,ZodCUID:()=>Jc,ZodCUID2:()=>Bc,ZodCatch:()=>$g,ZodCodec:()=>hi,ZodCreditCard:()=>rg,ZodCustom:()=>yi,ZodCustomStringFormat:()=>vn,ZodDate:()=>fg,ZodDefault:()=>jg,ZodDiscriminatedUnion:()=>hg,ZodE164:()=>tl,ZodEmail:()=>Lc,ZodEmoji:()=>Mc,ZodEnum:()=>br,ZodExactOptional:()=>cl,ZodFile:()=>Ig,ZodFunction:()=>Jg,ZodGUID:()=>Fc,ZodIBAN:()=>og,ZodIPv4:()=>Gc,ZodIPv6:()=>Hc,ZodISODate:()=>yn,ZodISODateTime:()=>hn,ZodISODuration:()=>wn,ZodISOTime:()=>bn,ZodInstanceOf:()=>Kg,ZodIntersection:()=>yg,ZodJWT:()=>nl,ZodKSUID:()=>Wc,ZodLazy:()=>Fg,ZodLiteral:()=>Sg,ZodMAC:()=>ng,ZodMap:()=>kg,ZodNaN:()=>zg,ZodNanoID:()=>Zc,ZodNever:()=>dg,ZodNonOptional:()=>ll,ZodNull:()=>ag,ZodNullable:()=>Og,ZodNumber:()=>rl,ZodNumberFormat:()=>kn,ZodObject:()=>pi,ZodOptional:()=>mi,ZodPipe:()=>gi,ZodPrefault:()=>Rg,ZodPreprocess:()=>Dg,ZodPromise:()=>Zg,ZodReadonly:()=>qg,ZodRecord:()=>yr,ZodSet:()=>xg,ZodString:()=>Vc,ZodStringFormat:()=>ce,ZodSuccess:()=>Tg,ZodSymbol:()=>ig,ZodTemplateLiteral:()=>Lg,ZodTransform:()=>Cg,ZodTuple:()=>wg,ZodType:()=>K,ZodULID:()=>Uc,ZodURL:()=>di,ZodUUID:()=>vt,ZodUndefined:()=>sg,ZodUnion:()=>fi,ZodUnknown:()=>ug,ZodVoid:()=>pg,ZodXID:()=>Kc,ZodXor:()=>gg,_ZodString:()=>qc,_default:()=>_g,_function:()=>Rx,any:()=>dx,array:()=>R,base64:()=>Bk,base64url:()=>Uk,bigint:()=>sx,boolean:()=>he,catch:()=>Ng,check:()=>Ax,cidrv4:()=>Zk,cidrv6:()=>Jk,codec:()=>Ex,creditCard:()=>Wk,cuid:()=>Nk,cuid2:()=>zk,currencyCode:()=>ex,custom:()=>Px,date:()=>fx,describe:()=>Tx,discriminatedUnion:()=>it,e164:()=>Kk,email:()=>Ck,emoji:()=>Tk,enum:()=>Z,exactOptional:()=>Eg,file:()=>xx,float32:()=>nx,float64:()=>rx,function:()=>Rx,guid:()=>Ek,hash:()=>tx,hex:()=>Xk,hostname:()=>Yk,httpUrl:()=>Pk,iban:()=>Gk,instanceof:()=>Nx,int:()=>xe,int32:()=>ox,int64:()=>ax,intersection:()=>bg,invertCodec:()=>Ox,ipv4:()=>Lk,ipv6:()=>Mk,json:()=>Pe,jwt:()=>Hk,keyof:()=>mx,ksuid:()=>Vk,lazy:()=>Mg,literal:()=>b,looseObject:()=>gx,looseRecord:()=>bx,mac:()=>Fk,map:()=>wx,meta:()=>$x,nan:()=>Cx,nanoid:()=>$k,nativeEnum:()=>kx,never:()=>ot,nonoptional:()=>Pg,null:()=>cg,nullable:()=>ui,nullish:()=>Sx,number:()=>B,object:()=>O,optional:()=>li,partialRecord:()=>yx,pipe:()=>Dc,prefault:()=>Ag,preprocess:()=>Wg,promise:()=>_x,readonly:()=>Vg,record:()=>oe,refine:()=>Bg,set:()=>vx,strictObject:()=>v,string:()=>C,stringFormat:()=>Qk,stringbool:()=>zx,success:()=>Ix,superRefine:()=>Ug,symbol:()=>lx,templateLiteral:()=>jx,transform:()=>al,tuple:()=>vg,uint32:()=>ix,uint64:()=>cx,ulid:()=>Dk,undefined:()=>ux,union:()=>Y,unknown:()=>rt,url:()=>Ak,uuid:()=>Ok,uuidv4:()=>jk,uuidv6:()=>_k,uuidv7:()=>Rk,void:()=>px,xid:()=>qk,xor:()=>hx});var ai={};co(ai,{endsWith:()=>Qo,gt:()=>_t,gte:()=>nt,includes:()=>Go,length:()=>lr,lowercase:()=>Ko,lt:()=>jt,lte:()=>tt,maxLength:()=>cr,maxSize:()=>dn,mime:()=>Xo,minLength:()=>Ut,minSize:()=>Rt,multipleOf:()=>un,negative:()=>fm,nonnegative:()=>gm,nonpositive:()=>mm,normalize:()=>ei,overwrite:()=>wt,positive:()=>pm,properties:()=>Yo,property:()=>hm,regex:()=>Uo,size:()=>ar,slugify:()=>oi,startsWith:()=>Ho,toLowerCase:()=>ni,toUpperCase:()=>ri,trim:()=>ti,uppercase:()=>Wo});var wr={};co(wr,{ZodISODate:()=>yn,ZodISODateTime:()=>hn,ZodISODuration:()=>wn,ZodISOTime:()=>bn,date:()=>qx,datetime:()=>Dx,duration:()=>Lx,time:()=>Vx});var Ku="0.1.0-beta.85";var gs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Wu="en";var ms=new Map(gs.map((e)=>[e.toLowerCase(),e])),Bw=new Set(["hk","mo","tw"]);function Gu(e){return typeof e=="string"&&ms.get(e.toLowerCase())==e}function lo(e,t="en"){for(let n of e){let r=n==null?void 0:Uw(n);if(r!=null)return r}return t}function Uw(e){let t=e.trim().toLowerCase();if(t.length==0)return;let n=ms.get(t);if(n!=null)return n;let r=t.split("-");if(r[0]=="zh"){if(r.includes("hant"))return"zh-TW";if(r.includes("hans"))return"zh-CN";return r.some((o)=>Bw.has(o))?"zh-TW":"zh-CN"}return ms.get(r[0])}function Hu(e){return{en:"Imported workflow","zh-CN":"\u5BFC\u5165\u7684\u5DE5\u4F5C\u6D41","zh-TW":"\u532F\u5165\u7684\u5DE5\u4F5C\u6D41",ja:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u305F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",ko:"\uAC00\uC838\uC628 \uC6CC\uD06C\uD50C\uB85C",fr:"Workflow import\xE9",ru:"\u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0446\u0435\u0441\u0441"}[e]}import{spawn as PE}from"child_process";import{readFile as TE}from"fs/promises";import{setTimeout as $E}from"timers/promises";var sn="open-flow-engine/v10";var on=(e)=>`export const engineContract = ${JSON.stringify(e)}
2
+ var gv=Object.defineProperty;var bv=(e)=>e;function xv(e,n){this[e]=bv.bind(null,n)}var Lo=(e,n)=>{for(var t in n)gv(e,t,{get:n[t],enumerable:!0,configurable:!0,set:xv.bind(n,t)})};var wv=(e,n,t)=>()=>{if(e)try{n=e(e=0)}catch(r){t=[r]}if(t)throw t[0];return n};class ur{constructor(e,n,t){if(this.line=void 0,this.column=void 0,t!==void 0)this.index=void 0;if(this.line=e,this.column=n,t!==void 0)this.index=t}}class gw{start;end;filename;identifierName;constructor(e,n){this.start=e,this.end=n}}function cA(e,n){let{line:t,column:r,index:o}=e;return new ur(t,r+n,o+n)}function cw(e,n,t){Object.defineProperty(e,n,{enumerable:!1,configurable:!0,value:t})}function mA({toMessage:e,code:n,reasonCode:t,syntaxPlugin:r}){let o=t==="MissingPlugin"||t==="MissingOneOfPlugins";return function i(s,a,c){let l=SyntaxError();if(l.code=n,l.reasonCode=t,l.loc=s,l.pos=a,l.syntaxPlugin=r,o)l.missingPlugin=c.missingPlugin;return cw(l,"clone",function(d={}){let{line:p,column:m,index:y=a}=d.loc??s;return i(new ur(p,m),y,{...c,...d.details})}),cw(l,"details",c),Object.defineProperty(l,"message",{configurable:!0,get(){let u=`${e(c)} (${s.line}:${s.column})`;return this.message=u,u},set(u){Object.defineProperty(this,"message",{value:u,writable:!0})}}),l}}function kt(e,n){if(Array.isArray(e))return(r)=>kt(r,e[0]);let t={};for(let r of Object.keys(e)){let o=e[r],{message:i,...s}=typeof o==="string"?{message:()=>o}:typeof o==="function"?{message:o}:o,a=typeof i==="string"?()=>i:i;t[r]=mA({code:"BABEL_PARSER_SYNTAX_ERROR",reasonCode:r,toMessage:a,...n?{syntaxPlugin:n}:{},...s})}return t}function cr(e){let{start:n,end:t}=e.loc;return e.loc.start=new ur(n.line,n.column),e.loc.end=new ur(t.line,t.column),e}class xd{label;keyword;beforeExpr;startsExpr;rightAssociative;isLoop;isAssign;prefix;postfix;binop;constructor(e,n={}){this.label=e,this.keyword=n.keyword,this.beforeExpr=!!n.beforeExpr,this.startsExpr=!!n.startsExpr,this.rightAssociative=!!n.rightAssociative,this.isLoop=!!n.isLoop,this.isAssign=!!n.isAssign,this.prefix=!!n.prefix,this.postfix=!!n.postfix,this.binop=n.binop!=null?n.binop:null}}function se(e,n={}){n.keyword=e;let t=B(e,n);return bw.set(e,t),t}function We(e,n){return B(e,{beforeExpr:ie,binop:n})}function B(e,n={}){return++Ro,vd.push(e),kd.push(n.binop??-1),Sd.push(n.beforeExpr??!1),Id.push(n.startsExpr??!1),xw.push(n.prefix??!1),wd.push(new xd(e,n)),Ro}function ne(e,n={}){return++Ro,bw.set(e,Ro),vd.push(e),kd.push(n.binop??-1),Sd.push(n.beforeExpr??!1),Id.push(n.startsExpr??!1),xw.push(n.prefix??!1),wd.push(new xd("name",n)),Ro}function _e(e){return e>=89&&e<=129}function Sn(e){return e>=54&&e<=129}function xA(e){return e>=54&&e<=132}function wA(e){return Sd[e]}function vA(e){return Id[e]}function lw(e){return e>=125&&e<=127}function ww(e){return e>=54&&e<=88}function kA(e){return e>=117&&e<=119}function SA(e){return e>=120&&e<=126}function Cd(e){return vd[e]}function IA(e){return kd[e]}function CA(e){return e>=20&&e<=21}function PA(e){return wd[e]}class jo{constructor(e,n){this.token=e,this.preserveSpace=!!n}token;preserveSpace}function gd(e,n){let t=65536;for(let r=0,o=n.length;r<o;r+=2){if(t+=n[r],t>e)return!1;if(t+=n[r+1],t>=e)return!0}return!1}function Pd(e){if(e<65)return e===36;if(e<=90)return!0;if(e<97)return e===95;if(e<=122)return!0;if(e<=65535)return e>=170&&uw.test(String.fromCharCode(e));return!isNaN(e)&&e<=1114111&&(uw.test(String.fromCodePoint(e))||gd(e,vw))}function kw(e){if(e<48)return e===36;if(e<58)return!0;if(e<65)return!1;if(e<=90)return!0;if(e<97)return e===95;if(e<=122)return!0;if(e<=65535)return e>=170&&dw.test(String.fromCharCode(e));return!isNaN(e)&&e<=1114111&&(dw.test(String.fromCodePoint(e))||gd(e,vw)||gd(e,EA))}function AA(e,n,t){return e===64&&n===64&&Pd(t)}class Ds{flags=0;names=new Map;firstLexicalName="";constructor(e){this.flags=e}}class Ad{parser;scopeStack=[];inModule;undefinedExports=new Map;constructor(e,n){this.parser=e,this.inModule=n}get inTopLevel(){return(this.currentScope().flags&1)>0}get inFunction(){return(this.currentVarScopeFlags()&2)>0}get allowSuper(){return(this.currentThisScopeFlags()&16)>0}get allowDirectSuper(){return(this.currentThisScopeFlags()&32)>0}get allowNewTarget(){return(this.currentThisScopeFlags()&512)>0}get inClass(){return(this.currentThisScopeFlags()&64)>0}get inClassAndNotInNonArrowFunction(){let e=this.currentThisScopeFlags();return(e&64)>0&&(e&2)===0}get inStaticBlock(){for(let e=this.scopeStack.length-1;;e--){let{flags:n}=this.scopeStack[e];if(n&128)return!0;if(n&3779)return!1}}get inNonArrowFunction(){return(this.currentThisScopeFlags()&2)>0}get inBareCaseStatement(){return(this.currentScope().flags&256)>0}get treatFunctionsAsVar(){return this.treatFunctionsAsVarInScope(this.currentScope())}createScope(e){return new Ds(e)}enter(e){this.scopeStack.push(this.createScope(e))}exit(){return this.scopeStack.pop().flags}treatFunctionsAsVarInScope(e){return!!(e.flags&130||!this.parser.inModule&&e.flags&1)}declareName(e,n,t){let r=this.currentScope();if(n&8||n&16){this.checkRedeclarationInScope(r,e,n,t);let o=r.names.get(e)||0;if(n&16)o=o|4;else{if(!r.firstLexicalName)r.firstLexicalName=e;o=o|2}if(r.names.set(e,o),n&8)this.maybeExportDefined(r,e)}else if(n&4){for(let o=this.scopeStack.length-1;o>=0;--o)if(r=this.scopeStack[o],this.checkRedeclarationInScope(r,e,n,t),r.names.set(e,(r.names.get(e)||0)|1),this.maybeExportDefined(r,e),r.flags&3715)break}if(this.parser.inModule&&r.flags&1)this.undefinedExports.delete(e)}maybeExportDefined(e,n){if(this.parser.inModule&&e.flags&1)this.undefinedExports.delete(n)}checkRedeclarationInScope(e,n,t,r){if(this.isRedeclaredInScope(e,n,t))this.parser.raise(He.VarRedeclaration,r,{identifierName:n})}isRedeclaredInScope(e,n,t){if(!(t&1))return!1;if(t&8)return e.names.has(n);let r=e.names.get(n)||0;if(t&16)return(r&2)>0||!this.treatFunctionsAsVarInScope(e)&&(r&1)>0;return(r&2)>0&&!(e.flags&8&&e.firstLexicalName===n)||!this.treatFunctionsAsVarInScope(e)&&(r&4)>0}checkLocalExport(e){let{name:n}=e;if(!this.scopeStack[0].names.has(n))this.undefinedExports.set(n,e.start)}currentScope(){return this.scopeStack[this.scopeStack.length-1]}currentVarScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:n}=this.scopeStack[e];if(n&3715)return n}}currentThisScopeFlags(){for(let e=this.scopeStack.length-1;;e--){let{flags:n}=this.scopeStack[e];if(n&3779&&!(n&4))return n}}}function NA(e){return e.type==="DeclareExportAllDeclaration"||e.type==="DeclareExportDeclaration"&&(!e.declaration||e.declaration.type!=="TypeAlias"&&e.declaration.type!=="InterfaceDeclaration")}function pw(e){return e.importKind==="type"||e.importKind==="typeof"}function RA(e,n){let t=[],r=[];for(let o=0;o<e.length;o++)(n(e[o],o,e)?t:r).push(e[o]);return[t,r]}function fw(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}}function on(e){return e?e.type==="JSXOpeningFragment"||e.type==="JSXClosingFragment":!1}function lr(e){if(e.type==="JSXIdentifier")return e.name;if(e.type==="JSXNamespacedName")return e.namespace.name+":"+e.name.name;if(e.type==="JSXMemberExpression")return lr(e.object)+"."+lr(e.property);throw Error("Node had unexpected type: "+e.type)}class Ew{constructor(e,n,t,r){if(this.start=t,this.end=0,r!==void 0)this.loc=new gw(r);if(e&128)this.range=[t,0];if(r!==void 0&&n)this.loc.filename=n}type=""}function FA(e){if(e==null)throw Error(`Unexpected ${e} value.`);return e}function hw(e){if(!e)throw Error("Assert fail")}function VA(e){switch(e){case"any":return"TSAnyKeyword";case"boolean":return"TSBooleanKeyword";case"bigint":return"TSBigIntKeyword";case"never":return"TSNeverKeyword";case"number":return"TSNumberKeyword";case"object":return"TSObjectKeyword";case"string":return"TSStringKeyword";case"symbol":return"TSSymbolKeyword";case"undefined":return"TSUndefinedKeyword";case"unknown":return"TSUnknownKeyword";default:return}}function mw(e){return e==="private"||e==="public"||e==="protected"}function BA(e){return e==="in"||e==="out"}function bd(e){if(e.extra?.parenthesized)return!1;switch(e.type){case"Identifier":return!0;case"MemberExpression":return!e.computed&&bd(e.object);case"TSInstantiationExpression":return bd(e.expression);default:return!1}}function JA(e){if(e.type!=="MemberExpression")return!1;let{computed:n,property:t}=e;if(n&&t.type!=="StringLiteral"&&(t.type!=="TemplateLiteral"||t.expressions.length>0))return!1;return Tw(e.object)}function ZA(e,n){let{type:t}=e;if(e.extra?.parenthesized)return!1;if(n){if(t==="Literal"){let{value:r}=e;if(typeof r==="string"||typeof r==="boolean")return!0}}else if(t==="StringLiteral"||t==="BooleanLiteral")return!0;if(Aw(e,n)||KA(e,n))return!0;if(t==="TemplateLiteral"&&e.expressions.length===0)return!0;if(JA(e))return!0;return!1}function Aw(e,n){if(n)return e.type==="Literal"&&(typeof e.value==="number"||("bigint"in e));return e.type==="NumericLiteral"||e.type==="BigIntLiteral"}function KA(e,n){if(e.type==="UnaryExpression"){let{operator:t,argument:r}=e;if(t==="-"&&Aw(r,n))return!0}return!1}function Tw(e){if(e.type==="Identifier")return!0;if(e.type!=="MemberExpression"||e.computed)return!1;return Tw(e.object)}function XA(e){let n={};for(let t of Object.keys(e))n[t]=PA(e[t]);return n}var sw="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",lA,aw,$s=(e)=>e.type==="UpdateExpression"?aw.UpdateExpression[`${e.prefix}`]:aw[e.type],uA,dA,pA,fA,hA,He,yA=(e)=>class extends e{createPosition(t){return new ur(t.line,t.column)}parse(){let t=super.parse();if(this.optionFlags&512)t.tokens=t.tokens.map(cr);return cr(t)}parseRegExpLiteral({pattern:t,flags:r}){let o=null;try{o=new RegExp(t,r)}catch(s){}let i=this.estreeParseLiteral(o);return i.regex={pattern:t,flags:r},i}parseBigIntLiteral(t){let r;try{r=BigInt(t)}catch{r=null}let o=this.estreeParseLiteral(r);return o.bigint=String(o.value||t),o}estreeParseLiteral(t){return this.parseLiteral(t,"Literal")}parseStringLiteral(t){return this.estreeParseLiteral(t)}parseNumericLiteral(t){return this.estreeParseLiteral(t)}parseNullLiteral(){return this.estreeParseLiteral(null)}parseBooleanLiteral(t){return this.estreeParseLiteral(t)}estreeParseChainExpression(t,r){let o=this.startNodeAtNode(t);return o.expression=t,this.finishNodeAtNode(o,"ChainExpression",r)}directiveToStmt(t){let r=t.value;delete t.value,this.castNodeTo(r,"Literal"),r.raw=r.extra.raw,r.value=r.extra.expressionValue;let o=this.castNodeTo(t,"ExpressionStatement");return o.expression=r,o.directive=r.extra.rawValue,delete r.extra,o}fillOptionalPropertiesForTSESLint(t){}cloneEstreeStringLiteral(t){let{start:r,end:o,loc:i,range:s,raw:a,value:c}=t,l=Object.create(t.constructor.prototype);return l.type="Literal",l.start=r,l.end=o,l.loc=i,l.range=s,l.raw=a,l.value=c,l}initFunction(t,r){super.initFunction(t,r),t.expression=!1}checkDeclaration(t){if(t!=null&&this.isObjectProperty(t))this.checkDeclaration(t.value);else super.checkDeclaration(t)}getObjectOrClassMethodParams(t){return t.value.params}isValidDirective(t){return t.type==="ExpressionStatement"&&t.expression.type==="Literal"&&typeof t.expression.value==="string"&&!t.expression.extra?.parenthesized}parseBlockBody(t,r,o,i,s){super.parseBlockBody(t,r,o,i,s);let a=t.directives.map((c)=>this.directiveToStmt(c));t.body=a.concat(t.body),delete t.directives}parsePrivateName(){let t=super.parsePrivateName();return this.convertPrivateNameToPrivateIdentifier(t)}convertPrivateNameToPrivateIdentifier(t){let r=super.getPrivateNameSV(t);return delete t.id,t.name=r,this.castNodeTo(t,"PrivateIdentifier")}isPrivateName(t){return t.type==="PrivateIdentifier"}getPrivateNameSV(t){return t.name}parseLiteral(t,r){let o=super.parseLiteral(t,r);return o.raw=o.extra.raw,delete o.extra,o}parseFunctionBody(t,r,o=!1){super.parseFunctionBody(t,r,o),t.expression=t.body.type!=="BlockStatement"}parseMethod(t,r,o,i,s,a,c=!1){let l=this.startNode();l.kind=t.kind,l=super.parseMethod(l,r,o,i,s,a,c),delete l.kind;let{typeParameters:u}=t;if(u)delete t.typeParameters,l.typeParameters=u,this.resetStartLocationFromNode(l,u);let d=this.castNodeTo(l,this.hasPlugin("typescript")&&!l.body?"TSEmptyBodyFunctionExpression":"FunctionExpression");if(t.value=d,a==="ClassPrivateMethod")t.computed=!1;if(this.hasPlugin("typescript")){if(t.abstract)return delete t.abstract,this.finishNode(t,"TSAbstractMethodDefinition")}if(a==="ObjectMethod"){if(t.kind==="method")t.kind="init";return t.shorthand=!1,this.finishNode(t,"Property")}else return this.finishNode(t,"MethodDefinition")}nameIsConstructor(t){if(t.type==="Literal")return t.value==="constructor";return super.nameIsConstructor(t)}parseClassProperty(...t){let r=super.parseClassProperty(...t);if(r.abstract&&this.hasPlugin("typescript"))delete r.abstract,this.castNodeTo(r,"TSAbstractPropertyDefinition");else this.castNodeTo(r,"PropertyDefinition");return r}parseClassPrivateProperty(...t){let r=super.parseClassPrivateProperty(...t);if(r.abstract&&this.hasPlugin("typescript"))this.castNodeTo(r,"TSAbstractPropertyDefinition");else this.castNodeTo(r,"PropertyDefinition");return r.computed=!1,r}parseClassAccessorProperty(t){let r=super.parseClassAccessorProperty(t);if(r.abstract&&this.hasPlugin("typescript"))delete r.abstract,this.castNodeTo(r,"TSAbstractAccessorProperty");else this.castNodeTo(r,"AccessorProperty");return r}parseObjectProperty(t,r,o,i){let s=super.parseObjectProperty(t,r,o,i);if(s)s.kind="init",this.castNodeTo(s,"Property");return s}finishObjectProperty(t){return t.kind="init",this.finishNode(t,"Property")}isValidLVal(t,r,o,i){return t==="Property"?"value":super.isValidLVal(t,r,o,i)}isAssignable(t,r){if(t!=null&&this.isObjectProperty(t))return this.isAssignable(t.value,r);return super.isAssignable(t,r)}toAssignable(t,r=!1){if(t!=null&&this.isObjectProperty(t)){let{key:o,value:i}=t;if(this.isPrivateName(o))this.classScope.usePrivateName(this.getPrivateNameSV(o),o.start);this.toAssignable(i,r)}else super.toAssignable(t,r)}toAssignableObjectExpressionProp(t,r,o){if(t.type==="Property"&&(t.kind==="get"||t.kind==="set"))this.raise(He.PatternHasAccessor,t.key);else if(t.type==="Property"&&t.method)this.raise(He.PatternHasMethod,t.key);else super.toAssignableObjectExpressionProp(t,r,o)}finishCallExpression(t,r){let o=super.finishCallExpression(t,r);if(o.callee.type==="Import")this.castNodeTo(o,"ImportExpression"),o.source=o.arguments[0],o.options=o.arguments[1]??null,delete o.arguments,delete o.callee;else if(o.type==="OptionalCallExpression")this.castNodeTo(o,"CallExpression");else o.optional=!1;return o}parseExport(t,r){let o=this.state.lastTokStartLoc,i=super.parseExport(t,r);switch(i.type){case"ExportAllDeclaration":i.exported=null;break;case"ExportNamedDeclaration":if(i.specifiers.length===1&&i.specifiers[0].type==="ExportNamespaceSpecifier")this.castNodeTo(i,"ExportAllDeclaration"),i.exported=i.specifiers[0].exported,delete i.specifiers;case"ExportDefaultDeclaration":{let{declaration:s}=i;if(s?.type==="ClassDeclaration"&&s.decorators?.length>0&&s.start===i.start)this.resetStartLocation(i,o)}break}return i}stopParseSubscript(t,r){let o=super.stopParseSubscript(t,r);if(r.optionalChainMember)return this.estreeParseChainExpression(o,t);return o}parseMember(t,r,o,i,s){let a=super.parseMember(t,r,o,i,s);if(a.type==="OptionalMemberExpression")this.castNodeTo(a,"MemberExpression");else a.optional=!1;return a}isOptionalMemberExpression(t){if(t.type==="ChainExpression")return t.expression.type==="MemberExpression";return super.isOptionalMemberExpression(t)}hasPropertyAsPrivateName(t){if(t.type==="ChainExpression")t=t.expression;return super.hasPropertyAsPrivateName(t)}isObjectProperty(t){return t.type==="Property"&&t.kind==="init"&&!t.method}isObjectMethod(t){return t.type==="Property"&&(t.method||t.kind==="get"||t.kind==="set")}castNodeTo(t,r){let o=super.castNodeTo(t,r);return this.fillOptionalPropertiesForTSESLint(o),o}cloneIdentifier(t){let r=super.cloneIdentifier(t);return this.fillOptionalPropertiesForTSESLint(r),r}cloneStringLiteral(t){if(t.type==="Literal")return this.cloneEstreeStringLiteral(t);return super.cloneStringLiteral(t)}finishNodeAt(t,r,o){return cr(super.finishNodeAt(t,r,o))}finishNodeAtNode(t,r,o){return cr(super.finishNodeAtNode(t,r,o))}finishNode(t,r){let o=super.finishNode(t,r);return this.fillOptionalPropertiesForTSESLint(o),o}resetStartLocation(t,r){super.resetStartLocation(t,r),cr(t)}resetEndLocation(t,r=this.state.lastTokEndLoc){super.resetEndLocation(t,r),cr(t)}},ie=!0,_=!0,md=!0,No=!0,rn=!0,gA=!0,bw,Ro=-1,wd,vd,kd,Sd,Id,xw,bA,Ce,uw,dw,vw,EA,Ed,sM,aM,cM,Sw,Iw,TA,OA,V,jA,_A,$A=(e)=>class extends e{flowPragma=void 0;getScopeHandler(){return Iw}shouldParseTypes(){return this.getPluginOption("flow","all")||this.flowPragma==="flow"}finishToken(t,r){if(t!==130&&t!==9&&t!==24){if(this.flowPragma===void 0)this.flowPragma=null}super.finishToken(t,r)}addComment(t){if(this.flowPragma===void 0){let r=_A.exec(t.value);if(!r);else if(r[1]==="flow")this.flowPragma="flow";else if(r[1]==="noflow")this.flowPragma="noflow";else throw Error("Unexpected flow pragma")}super.addComment(t)}flowParseTypeInitialiser(t){let r=this.state.inType;this.state.inType=!0,this.expect(t||10);let o=this.flowParseType();return this.state.inType=r,o}flowParsePredicate(){let t=this.startNode(),r=this.state.startLoc;if(this.next(),this.expectContextual(106),this.state.lastTokStartLoc.index>r.index+1)this.raise(V.UnexpectedSpaceBetweenModuloChecks,r);if(this.eat(6))return t.value=super.parseExpression(),this.expect(7),this.finishNode(t,"DeclaredPredicate");else return this.finishNode(t,"InferredPredicate")}flowParseTypeAndPredicateInitialiser(t){let r=this.state.inType;this.state.inType=!0,this.expect(10);let o=null,i=null;if(t&&this.match(50))this.state.inType=r,i=this.flowParsePredicate();else if(o=this.flowParseType(),this.state.inType=r,this.match(50))i=this.flowParsePredicate();return[o,i]}flowParseDeclareClass(t){return this.next(),this.flowParseInterfaceish(t,!0),this.finishNode(t,"DeclareClass")}flowParseDeclareFunction(t){this.next();let r=t.id=this.parseIdentifier(),o=this.startNode(),i=this.startNode();if(this.match(43))o.typeParameters=this.flowParseTypeParameterDeclaration();else o.typeParameters=null;this.expect(6);let s=this.flowParseFunctionTypeParams();return o.params=s.params,o.rest=s.rest,o.this=s._this,this.expect(7),[o.returnType,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!1),i.typeAnnotation=this.finishNode(o,"FunctionTypeAnnotation"),r.typeAnnotation=this.finishNode(i,"TypeAnnotation"),this.resetEndLocation(r),this.semicolon(),this.scope.declareName(t.id.name,2048,t.id.start),this.finishNode(t,"DeclareFunction")}flowParseDeclare(t,r){if(this.match(76))return this.flowParseDeclareClass(t);else if(this.match(64))return this.flowParseDeclareFunction(t);else if(this.match(70))return this.flowParseDeclareVariable(t);else if(this.eatContextual(123))if(this.match(12))return this.flowParseDeclareModuleExports(t);else{if(r)this.raise(V.NestedDeclareModule,this.state.lastTokStartLoc);return this.flowParseDeclareModule(t)}else if(this.isContextual(126))return this.flowParseDeclareTypeAlias(t);else if(this.isContextual(127))return this.flowParseDeclareOpaqueType(t);else if(this.isContextual(125))return this.flowParseDeclareInterface(t);else if(this.match(78))return this.flowParseDeclareExportDeclaration(t,r);throw this.unexpected()}flowParseDeclareVariable(t){return this.next(),t.id=this.flowParseTypeAnnotatableIdentifier(),this.scope.declareName(t.id.name,5,t.id.start),this.semicolon(),this.finishNode(t,"DeclareVariable")}flowParseDeclareModule(t){if(this.scope.enter(0),this.match(130))t.id=super.parseExprAtom();else t.id=this.parseIdentifier();let r=this.startNode(),o=r.body=[];this.expect(2);while(!this.match(4)){let a=this.startNode();if(this.match(79)){if(this.next(),!this.isContextual(126)&&!this.match(83))this.raise(V.InvalidNonTypeImportInDeclareModule,this.state.lastTokStartLoc);o.push(super.parseImport(a))}else this.expectContextual(121,V.UnsupportedStatementInDeclareModule),o.push(this.flowParseDeclare(a,!0))}this.scope.exit(),this.expect(4),t.body=this.finishNode(r,"BlockStatement");let i=null,s=!1;return o.forEach((a)=>{if(NA(a)){if(i==="CommonJS")this.raise(V.AmbiguousDeclareModuleKind,a);i="ES"}else if(a.type==="DeclareModuleExports"){if(s)this.raise(V.DuplicateDeclareModuleExports,a);if(i==="ES")this.raise(V.AmbiguousDeclareModuleKind,a);i="CommonJS",s=!0}}),t.kind=i||"CommonJS",this.finishNode(t,"DeclareModule")}flowParseDeclareExportDeclaration(t,r){if(this.expect(78),this.eat(61)){if(this.match(64)||this.match(76))t.declaration=this.flowParseDeclare(this.startNode());else t.declaration=this.flowParseType(),this.semicolon();return t.default=!0,this.finishNode(t,"DeclareExportDeclaration")}else{if(this.match(71)||this.isLet()||(this.isContextual(126)||this.isContextual(125))&&!r){let o=this.state.value;throw this.raise(V.UnsupportedDeclareExportKind,this.state.startLoc,{unsupportedExportKind:o,suggestion:jA[o]})}if(this.match(70)||this.match(64)||this.match(76)||this.isContextual(127))return t.declaration=this.flowParseDeclare(this.startNode()),t.default=!1,this.finishNode(t,"DeclareExportDeclaration");else if(this.match(51)||this.match(2)||this.isContextual(125)||this.isContextual(126)||this.isContextual(127)){let o=this.parseExport(t,null);if(o.type==="ExportNamedDeclaration")return o.default=!1,delete o.exportKind,this.castNodeTo(o,"DeclareExportDeclaration");else return this.castNodeTo(o,"DeclareExportAllDeclaration")}}throw this.unexpected()}flowParseDeclareModuleExports(t){return this.next(),this.expectContextual(107),t.typeAnnotation=this.flowParseTypeAnnotation(),this.semicolon(),this.finishNode(t,"DeclareModuleExports")}flowParseDeclareTypeAlias(t){this.next();let r=this.flowParseTypeAlias(t);return this.castNodeTo(r,"DeclareTypeAlias"),r}flowParseDeclareOpaqueType(t){return this.next(),this.flowParseOpaqueType(t,!0)}flowParseDeclareInterface(t){return this.next(),this.flowParseInterfaceish(t,!1),this.finishNode(t,"DeclareInterface")}flowParseInterfaceish(t,r){if(t.id=this.flowParseRestrictedIdentifier(!r,!0),this.scope.declareName(t.id.name,r?17:8201,t.id.start),this.match(43))t.typeParameters=this.flowParseTypeParameterDeclaration();else t.typeParameters=null;if(t.extends=[],this.eat(77))do t.extends.push(this.flowParseInterfaceExtends());while(!r&&this.eat(8));if(r){let o=[],i=[];if(this.eatContextual(113))do i.push(this.flowParseInterfaceExtends());while(this.eat(8));if(this.eatContextual(109))do o.push(this.flowParseClassImplements());while(this.eat(8));t.implements=o,t.mixins=i}t.body=this.flowParseObjectType({allowStatic:r,allowExact:!1,allowSpread:!1,allowProto:r,allowInexact:!1})}flowParseInterfaceExtends(){let t=this.startNode();if(t.id=this.flowParseQualifiedTypeIdentifier(),this.match(43))t.typeParameters=this.flowParseTypeParameterInstantiation();else t.typeParameters=null;return this.finishNode(t,"InterfaceExtends")}flowParseInterface(t){return this.flowParseInterfaceish(t,!1),this.finishNode(t,"InterfaceDeclaration")}checkNotUnderscore(t){if(t==="_")this.raise(V.UnexpectedReservedUnderscore,this.state.startLoc)}checkReservedType(t,r,o){if(!TA.has(t))return;this.raise(o?V.AssignReservedType:V.UnexpectedReservedType,r,{reservedType:t})}flowParseRestrictedIdentifierName(t,r){return this.checkReservedType(this.state.value,this.state.startLoc,r),this.parseIdentifierName(t)}flowParseRestrictedIdentifier(t,r){let o=this.startNode(),i=this.flowParseRestrictedIdentifierName(t,r);return this.createIdentifier(o,i)}flowParseTypeAlias(t){if(t.id=this.flowParseRestrictedIdentifier(!1,!0),this.scope.declareName(t.id.name,8201,t.id.start),this.match(43))t.typeParameters=this.flowParseTypeParameterDeclaration();else t.typeParameters=null;return t.right=this.flowParseTypeInitialiser(25),this.semicolon(),this.finishNode(t,"TypeAlias")}flowParseOpaqueType(t,r){if(this.expectContextual(126),t.id=this.flowParseRestrictedIdentifier(!0,!0),this.scope.declareName(t.id.name,8201,t.id.start),this.match(43))t.typeParameters=this.flowParseTypeParameterDeclaration();else t.typeParameters=null;if(t.supertype=null,this.match(10))t.supertype=this.flowParseTypeInitialiser(10);if(t.impltype=null,!r)t.impltype=this.flowParseTypeInitialiser(25);return this.semicolon(),this.finishNode(t,r?"DeclareOpaqueType":"OpaqueType")}flowParseTypeParameterBound(){if(this.match(10)||this.isContextual(77)){let t=this.startNode();return this.next(),t.typeAnnotation=this.flowParseType(),this.finishNode(t,"TypeAnnotation")}}flowParseTypeParameter(t=!1){let r=this.state.startLoc,o=this.startNode(),i=this.flowParseVariance();if(o.name=this.flowParseRestrictedIdentifierName(),o.variance=i,o.bound=this.flowParseTypeParameterBound(),this.match(25))this.eat(25),o.default=this.flowParseType();else if(t)this.raise(V.MissingTypeParamDefault,r);return this.finishNode(o,"TypeParameter")}flowParseTypeParameterDeclaration(){let t=this.state.inType,r=this.startNode();if(r.params=[],this.state.inType=!0,this.match(43)||this.match(138))this.next();else this.unexpected();let o=!1;do{let i=this.flowParseTypeParameter(o);if(r.params.push(i),i.default)o=!0;if(!this.match(44))this.expect(8)}while(!this.match(44));return this.expect(44),this.state.inType=t,this.finishNode(r,"TypeParameterDeclaration")}flowInTopLevelContext(t){if(this.curContext()!==Ce.brace){let r=this.state.context;this.state.context=[r[0]];try{return t()}finally{this.state.context=r}}else return t()}flowParseTypeParameterInstantiationInExpression(){if(this.reScan_lt()!==43)return;return this.flowParseTypeParameterInstantiation()}flowParseTypeParameterInstantiation(){let t=this.startNode(),r=this.state.inType;if(this.state.inType=!0,t.params=[],this.flowInTopLevelContext(()=>{this.expect(43);let o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!1;while(!this.match(44))if(t.params.push(this.flowParseType()),!this.match(44))this.expect(8);this.state.noAnonFunctionType=o}),this.state.inType=r,!this.state.inType&&this.curContext()===Ce.brace)this.reScan_lt_gt();return this.expect(44),this.finishNode(t,"TypeParameterInstantiation")}flowParseTypeParameterInstantiationCallOrNew(){if(this.reScan_lt()!==43)return null;let t=this.startNode(),r=this.state.inType;t.params=[],this.state.inType=!0,this.expect(43);while(!this.match(44))if(t.params.push(this.flowParseTypeOrImplicitInstantiation()),!this.match(44))this.expect(8);return this.expect(44),this.state.inType=r,this.finishNode(t,"TypeParameterInstantiation")}flowParseInterfaceType(){let t=this.startNode();if(this.expectContextual(125),t.extends=[],this.eat(77))do t.extends.push(this.flowParseInterfaceExtends());while(this.eat(8));return t.body=this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!1,allowProto:!1,allowInexact:!1}),this.finishNode(t,"InterfaceTypeAnnotation")}flowParseObjectPropertyKey(){return this.match(131)||this.match(130)?super.parseExprAtom():this.parseIdentifier(!0)}flowParseObjectTypeIndexer(t,r,o){if(t.static=r,this.lookahead().type===10)t.id=this.parseIdentifier(!0),t.key=this.flowParseTypeInitialiser();else t.id=null,t.key=this.flowParseType();return this.expect(1),t.value=this.flowParseTypeInitialiser(),t.variance=o,this.finishNode(t,"ObjectTypeIndexer")}flowParseObjectTypeInternalSlot(t,r){if(t.static=r,t.id=this.parseIdentifier(!0),this.expect(1),this.expect(1),this.match(43)||this.match(6))t.method=!0,t.optional=!1,t.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(t));else{if(t.method=!1,this.eat(13))t.optional=!0;t.value=this.flowParseTypeInitialiser()}return this.finishNode(t,"ObjectTypeInternalSlot")}flowParseObjectTypeMethodish(t){if(t.params=[],t.rest=null,t.typeParameters=null,t.this=null,this.match(43))t.typeParameters=this.flowParseTypeParameterDeclaration();if(this.expect(6),this.match(74)){if(t.this=this.flowParseFunctionTypeParam(!0),t.this.name=null,!this.match(7))this.expect(8)}while(!this.match(7)&&!this.match(17))if(t.params.push(this.flowParseFunctionTypeParam(!1)),!this.match(7))this.expect(8);if(this.eat(17))t.rest=this.flowParseFunctionTypeParam(!1);return this.expect(7),t.returnType=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeAnnotation")}flowParseObjectTypeCallProperty(t,r){let o=this.startNode();return t.static=r,t.value=this.flowParseObjectTypeMethodish(o),this.finishNode(t,"ObjectTypeCallProperty")}flowParseObjectType({allowStatic:t,allowExact:r,allowSpread:o,allowProto:i,allowInexact:s}){let a=this.state.inType;this.state.inType=!0;let c=this.startNode();c.callProperties=[],c.properties=[],c.indexers=[],c.internalSlots=[];let l,u,d=!1;if(r&&this.match(3))this.expect(3),l=5,u=!0;else this.expect(2),l=4,u=!1;c.exact=u;while(!this.match(l)){let m=!1,y=null,I=null,j=this.startNode();if(i&&this.isContextual(114)){let F=this.lookahead();if(F.type!==10&&F.type!==13)this.next(),y=this.state.startLoc,t=!1}if(t&&this.isContextual(102)){let F=this.lookahead();if(F.type!==10&&F.type!==13)this.next(),m=!0}let L=this.flowParseVariance();if(this.eat(0)){if(y!=null)this.unexpected(y);if(this.eat(0)){if(L)this.unexpected(L.start);c.internalSlots.push(this.flowParseObjectTypeInternalSlot(j,m))}else c.indexers.push(this.flowParseObjectTypeIndexer(j,m,L))}else if(this.match(6)||this.match(43)){if(y!=null)this.unexpected(y);if(L)this.unexpected(L.start);c.callProperties.push(this.flowParseObjectTypeCallProperty(j,m))}else{let F="init";if(this.isContextual(95)||this.isContextual(100)){let ge=this.lookahead();if(xA(ge.type))F=this.state.value,this.next()}let z=this.flowParseObjectTypeProperty(j,m,y,L,F,o,s??!u);if(z===null)d=!0,I=this.state.lastTokStartLoc;else c.properties.push(z)}if(this.flowObjectTypeSemicolon(),I&&!this.match(4)&&!this.match(5))this.raise(V.UnexpectedExplicitInexactInObject,I)}if(this.expect(l),o)c.inexact=d;let p=this.finishNode(c,"ObjectTypeAnnotation");return this.state.inType=a,p}flowParseObjectTypeProperty(t,r,o,i,s,a,c){if(this.eat(17)){if(this.match(8)||this.match(9)||this.match(4)||this.match(5)){if(!a)this.raise(V.InexactInsideNonObject,this.state.lastTokStartLoc);else if(!c)this.raise(V.InexactInsideExact,this.state.lastTokStartLoc);if(i)this.raise(V.InexactVariance,i);return null}if(!a)this.raise(V.UnexpectedSpreadType,this.state.lastTokStartLoc);if(o!=null)this.unexpected(o);if(i)this.raise(V.SpreadVariance,i);return t.argument=this.flowParseType(),this.finishNode(t,"ObjectTypeSpreadProperty")}else{t.key=this.flowParseObjectPropertyKey(),t.static=r,t.proto=o!=null,t.kind=s;let l=!1;if(this.match(43)||this.match(6)){if(t.method=!0,o!=null)this.unexpected(o);if(i)this.unexpected(i.start);if(t.value=this.flowParseObjectTypeMethodish(this.startNodeAtNode(t)),s==="get"||s==="set")this.flowCheckGetterSetterParams(t);else if(!r&&!a&&t.key.name==="constructor"&&t.value.this)this.raise(V.ThisParamBannedInConstructor,t.value.this)}else{if(s!=="init")this.unexpected();if(t.method=!1,this.eat(13))l=!0;t.value=this.flowParseTypeInitialiser(),t.variance=i}return t.optional=l,this.finishNode(t,"ObjectTypeProperty")}}flowCheckGetterSetterParams(t){let r=t.kind==="get"?0:1,o=t.value,i=o.params.length+(o.rest?1:0);if(o.this)this.raise(t.kind==="get"?V.GetterMayNotHaveThisParam:V.SetterMayNotHaveThisParam,o.this);if(i!==r)this.raise(t.kind==="get"?He.BadGetterArity:He.BadSetterArity,t);if(t.kind==="set"&&o.rest)this.raise(He.BadSetterRestParameter,t)}flowObjectTypeSemicolon(){if(!this.eat(9)&&!this.eat(8)&&!this.match(4)&&!this.match(5))this.unexpected()}flowParseQualifiedTypeIdentifier(t,r){t??=this.state.startLoc;let o=r||this.flowParseRestrictedIdentifier(!0);while(this.eat(12)){let i=this.startNodeAt(t);i.qualification=o,i.id=this.flowParseRestrictedIdentifier(!0),o=this.finishNode(i,"QualifiedTypeIdentifier")}return o}flowParseGenericType(t,r){let o=this.startNodeAt(t);if(o.typeParameters=null,o.id=this.flowParseQualifiedTypeIdentifier(t,r),this.match(43))o.typeParameters=this.flowParseTypeParameterInstantiation();return this.finishNode(o,"GenericTypeAnnotation")}flowParseTypeofType(){let t=this.startNode();return this.expect(83),t.argument=this.flowParsePrimaryType(),this.finishNode(t,"TypeofTypeAnnotation")}flowParseTupleType(){let t=this.startNode();t.types=[],this.expect(0);while(this.state.pos<this.length&&!this.match(1)){if(t.types.push(this.flowParseType()),this.match(1))break;this.expect(8)}return this.expect(1),this.finishNode(t,"TupleTypeAnnotation")}flowParseFunctionTypeParam(t){let r=null,o=!1,i,s=this.startNode(),a=this.lookahead(),c=this.state.type===74;if(a.type===10||a.type===13){if(c&&!t)this.raise(V.ThisParamMustBeFirst,s);if(r=this.parseIdentifier(c),this.eat(13)){if(o=!0,c)this.raise(V.ThisParamMayNotBeOptional,s)}i=this.flowParseTypeInitialiser()}else i=this.flowParseType();return s.name=r,s.optional=o,s.typeAnnotation=i,this.finishNode(s,"FunctionTypeParam")}reinterpretTypeAsFunctionTypeParam(t){let r=this.startNodeAtNode(t);return r.name=null,r.optional=!1,r.typeAnnotation=t,this.finishNode(r,"FunctionTypeParam")}flowParseFunctionTypeParams(t=[]){let r=null,o=null;if(this.match(74)){if(o=this.flowParseFunctionTypeParam(!0),o.name=null,!this.match(7))this.expect(8)}while(!this.match(7)&&!this.match(17))if(t.push(this.flowParseFunctionTypeParam(!1)),!this.match(7))this.expect(8);if(this.eat(17))r=this.flowParseFunctionTypeParam(!1);return{params:t,rest:r,_this:o}}flowIdentToTypeAnnotation(t,r,o){switch(o.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"empty":return this.finishNode(r,"EmptyTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");case"symbol":return this.finishNode(r,"SymbolTypeAnnotation");default:return this.checkNotUnderscore(o.name),this.flowParseGenericType(t,o)}}flowParsePrimaryType(){let t=this.state.startLoc,r=this.startNode(),o,i,s=!1,a=this.state.noAnonFunctionType;switch(this.state.type){case 2:return this.flowParseObjectType({allowStatic:!1,allowExact:!1,allowSpread:!0,allowProto:!1,allowInexact:!0});case 3:return this.flowParseObjectType({allowStatic:!1,allowExact:!0,allowSpread:!0,allowProto:!1,allowInexact:!1});case 0:return this.state.noAnonFunctionType=!1,i=this.flowParseTupleType(),this.state.noAnonFunctionType=a,i;case 43:{let c=this.startNode();return c.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(6),o=this.flowParseFunctionTypeParams(),c.params=o.params,c.rest=o.rest,c.this=o._this,this.expect(7),this.expect(15),c.returnType=this.flowParseType(),this.finishNode(c,"FunctionTypeAnnotation")}case 6:{let c=this.startNode();if(this.next(),!this.match(7)&&!this.match(17))if(_e(this.state.type)||this.match(74)){let l=this.lookahead().type;s=l!==13&&l!==10}else s=!0;if(s)if(this.state.noAnonFunctionType=!1,i=this.flowParseType(),this.state.noAnonFunctionType=a,this.state.noAnonFunctionType||!(this.match(8)||this.match(7)&&this.lookahead().type===15))return this.expect(7),i;else this.eat(8);if(i)o=this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(i)]);else o=this.flowParseFunctionTypeParams();return c.params=o.params,c.rest=o.rest,c.this=o._this,this.expect(7),this.expect(15),c.returnType=this.flowParseType(),c.typeParameters=null,this.finishNode(c,"FunctionTypeAnnotation")}case 130:return this.parseLiteral(this.state.value,"StringLiteralTypeAnnotation");case 81:case 82:return r.value=this.match(81),this.next(),this.finishNode(r,"BooleanLiteralTypeAnnotation");case 49:if(this.state.value==="-"){if(this.next(),this.match(131))return this.parseLiteralAtNode(-this.state.value,"NumberLiteralTypeAnnotation",r);if(this.match(132))return this.parseLiteralAtNode(-this.state.value,"BigIntLiteralTypeAnnotation",r);throw this.raise(V.UnexpectedSubtractionOperand,this.state.startLoc)}throw this.unexpected();case 131:return this.parseLiteral(this.state.value,"NumberLiteralTypeAnnotation");case 132:return this.parseLiteral(this.state.value,"BigIntLiteralTypeAnnotation");case 84:return this.next(),this.finishNode(r,"VoidTypeAnnotation");case 80:return this.next(),this.finishNode(r,"NullLiteralTypeAnnotation");case 74:return this.next(),this.finishNode(r,"ThisTypeAnnotation");case 51:return this.next(),this.finishNode(r,"ExistsTypeAnnotation");case 83:return this.flowParseTypeofType();default:if(ww(this.state.type)){let c=Cd(this.state.type);return this.next(),super.createIdentifier(r,c)}else if(_e(this.state.type)){if(this.isContextual(125))return this.flowParseInterfaceType();return this.flowIdentToTypeAnnotation(t,r,this.parseIdentifier())}}throw this.unexpected()}flowParsePostfixType(){let t=this.state.startLoc,r=this.flowParsePrimaryType(),o=!1;while((this.match(0)||this.match(14))&&!this.canInsertSemicolon()){let i=this.startNodeAt(t),s=this.eat(14);if(o=o||s,this.expect(0),!s&&this.match(1))i.elementType=r,this.next(),r=this.finishNode(i,"ArrayTypeAnnotation");else if(i.objectType=r,i.indexType=this.flowParseType(),this.expect(1),o)i.optional=s,r=this.finishNode(i,"OptionalIndexedAccessType");else r=this.finishNode(i,"IndexedAccessType")}return r}flowParsePrefixType(){let t=this.startNode();if(this.eat(13))return t.typeAnnotation=this.flowParsePrefixType(),this.finishNode(t,"NullableTypeAnnotation");else return this.flowParsePostfixType()}flowParseAnonFunctionWithoutParens(){let t=this.flowParsePrefixType();if(!this.state.noAnonFunctionType&&this.eat(15)){let r=this.startNodeAtNode(t);return r.params=[this.reinterpretTypeAsFunctionTypeParam(t)],r.rest=null,r.this=null,r.returnType=this.flowParseType(),r.typeParameters=null,this.finishNode(r,"FunctionTypeAnnotation")}return t}flowParseIntersectionType(){let t=this.startNode();this.eat(41);let r=this.flowParseAnonFunctionWithoutParens();t.types=[r];while(this.eat(41))t.types.push(this.flowParseAnonFunctionWithoutParens());return t.types.length===1?r:this.finishNode(t,"IntersectionTypeAnnotation")}flowParseUnionType(){let t=this.startNode();this.eat(39);let r=this.flowParseIntersectionType();t.types=[r];while(this.eat(39))t.types.push(this.flowParseIntersectionType());return t.types.length===1?r:this.finishNode(t,"UnionTypeAnnotation")}flowParseType(){let t=this.state.inType;this.state.inType=!0;let r=this.flowParseUnionType();return this.state.inType=t,r}flowParseTypeOrImplicitInstantiation(){if(this.state.type===128&&this.state.value==="_"){let t=this.state.startLoc,r=this.parseIdentifier();return this.flowParseGenericType(t,r)}else return this.flowParseType()}flowParseTypeAnnotation(){let t=this.startNode();return t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"TypeAnnotation")}flowParseTypeAnnotatableIdentifier(){let t=this.startNode(),r=this.parseIdentifierName();if(this.match(10))t.typeAnnotation=this.flowParseTypeAnnotation();return this.createIdentifier(t,r)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocationFromNode(t.expression,t.typeAnnotation),t.expression}flowParseVariance(){let t=null;if(this.match(49)){if(t=this.startNode(),this.state.value==="+")t.kind="plus";else t.kind="minus";return this.next(),this.finishNode(t,"Variance")}return t}parseFunctionBody(t,r,o=!1){if(r){this.forwardNoArrowParamsConversionAt(t,()=>super.parseFunctionBody(t,!0,o));return}super.parseFunctionBody(t,!1,o)}parseFunctionBodyAndFinish(t,r,o=!1){if(this.match(10)){let i=this.startNode();if(r==="FunctionDeclaration"||r==="FunctionExpression"||r==="ArrowFunctionExpression")[i.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!0);else i.typeAnnotation=this.flowParseTypeInitialiser();t.returnType=i.typeAnnotation?this.finishNode(i,"TypeAnnotation"):null}return super.parseFunctionBodyAndFinish(t,r,o)}parseStatementLike(t){if(this.state.strict&&this.isContextual(125)){let o=this.lookahead();if(Sn(o.type)){let i=this.startNode();return this.next(),this.flowParseInterface(i)}}else if(this.isContextual(122)){let o=this.startNode();return this.next(),this.flowParseEnumDeclaration(o)}let r=super.parseStatementLike(t);if(this.flowPragma===void 0&&!this.isValidDirective(r))this.flowPragma=null;return r}parseExpressionStatement(t,r,o){if(r.type==="Identifier"){if(r.name==="declare"){if(this.match(76)||_e(this.state.type)||this.match(64)||this.match(70)||this.match(78))return this.flowParseDeclare(t)}else if(_e(this.state.type)){if(r.name==="interface")return this.flowParseInterface(t);else if(r.name==="type")return this.flowParseTypeAlias(t);else if(r.name==="opaque")return this.flowParseOpaqueType(t,!1)}}return super.parseExpressionStatement(t,r,o)}shouldParseExportDeclaration(){let{type:t}=this.state;if(t===122||lw(t))return!this.state.containsEsc;return super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:t}=this.state;if(t===122||lw(t))return this.state.containsEsc;return super.isExportDefaultSpecifier()}parseExportDefaultExpression(){if(this.isContextual(122)){let t=this.startNode();return this.next(),this.flowParseEnumDeclaration(t)}return super.parseExportDefaultExpression()}parseConditional(t,r,o){if(!this.match(13))return t;if(o!=null){let m=this.lookaheadCharCode();if(m===44||m===61||m===58||m===41)return this.setOptionalParametersError(o),t}this.expect(13);let i=this.state.clone(),s=this.state.noArrowAt,a=this.startNodeAt(r),{consequent:c,failed:l}=this.tryParseConditionalConsequent(),u=this.getArrowLikeExpressions(c),d=u[0],p=u[1];if(l||p.length>0){let m=[...s];if(p.length>0){this.state=i,this.state.noArrowAt=m;for(let y=0;y<p.length;y++)m.push(p[y].start);({consequent:c,failed:l}=this.tryParseConditionalConsequent()),[d]=this.getArrowLikeExpressions(c)}if(l&&d.length>1)this.raise(V.AmbiguousConditionalArrow,i.startLoc);if(l&&d.length===1)this.state=i,m.push(d[0].start),this.state.noArrowAt=m,{consequent:c}=this.tryParseConditionalConsequent()}return this.getArrowLikeExpressions(c,!0),this.state.noArrowAt=s,this.expect(10),a.test=t,a.consequent=c,a.alternate=this.forwardNoArrowParamsConversionAt(a,()=>this.parseMaybeAssign(void 0,void 0)),this.finishNode(a,"ConditionalExpression")}tryParseConditionalConsequent(){this.state.noArrowParamsConversionAt.push(this.state.start);let t=this.parseMaybeAssignAllowIn(),r=!this.match(10);return this.state.noArrowParamsConversionAt.pop(),{consequent:t,failed:r}}getArrowLikeExpressions(t,r){let o=[t],i=[];while(o.length!==0){let s=o.pop();if(s.type==="ArrowFunctionExpression"&&s.body.type!=="BlockStatement"){if(s.typeParameters||!s.returnType)this.finishArrowValidation(s);else i.push(s);o.push(s.body)}else if(s.type==="ConditionalExpression")o.push(s.consequent),o.push(s.alternate)}if(r)return i.forEach((s)=>this.finishArrowValidation(s)),[i,[]];return RA(i,(s)=>s.params.every((a)=>this.isAssignable(a,!0)))}finishArrowValidation(t){this.toAssignableList(t.params,t.extra?.trailingCommaLoc,!1),this.scope.enter(518),super.checkParams(t,!1,!0),this.scope.exit()}forwardNoArrowParamsConversionAt(t,r){let o;if(this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))this.state.noArrowParamsConversionAt.push(this.state.start),o=r(),this.state.noArrowParamsConversionAt.pop();else o=r();return o}parseParenItem(t,r){let o=super.parseParenItem(t,r);if(this.eat(13))o.optional=!0,this.resetEndLocation(t);if(this.match(10)){let i=this.startNodeAt(r);return i.expression=o,i.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(i,"TypeCastExpression")}return o}assertModuleNodeAllowed(t){if(t.type==="ImportDeclaration"&&(t.importKind==="type"||t.importKind==="typeof")||t.type==="ExportNamedDeclaration"&&t.exportKind==="type"||t.type==="ExportAllDeclaration"&&t.exportKind==="type")return;super.assertModuleNodeAllowed(t)}parseExportDeclaration(t){if(this.isContextual(126)){t.exportKind="type";let r=this.startNode();if(this.next(),this.match(2))return t.specifiers=this.parseExportSpecifiers(!0),super.parseExportFrom(t),null;else return this.flowParseTypeAlias(r)}else if(this.isContextual(127)){t.exportKind="type";let r=this.startNode();return this.next(),this.flowParseOpaqueType(r,!1)}else if(this.isContextual(125)){t.exportKind="type";let r=this.startNode();return this.next(),this.flowParseInterface(r)}else if(this.isContextual(122)){t.exportKind="value";let r=this.startNode();return this.next(),this.flowParseEnumDeclaration(r)}else return super.parseExportDeclaration(t)}eatExportStar(t){if(super.eatExportStar(t))return!0;if(this.isContextual(126)&&this.lookahead().type===51)return t.exportKind="type",this.next(),this.next(),!0;return!1}maybeParseExportNamespaceSpecifier(t){let{startLoc:r}=this.state,o=super.maybeParseExportNamespaceSpecifier(t);if(o&&t.exportKind==="type")this.unexpected(r);return o}parseClassId(t,r,o){if((!r||o)&&this.isContextual(109)){t.id=null;return}if(super.parseClassId(t,r,o),this.match(43))t.typeParameters=this.flowParseTypeParameterDeclaration()}parseClassMember(t,r,o){let{startLoc:i}=this.state;if(this.isContextual(121)){if(super.parseClassMemberFromModifier(t,r))return;r.declare=!0}if(super.parseClassMember(t,r,o),r.declare){if(r.type!=="ClassProperty"&&r.type!=="ClassPrivateProperty"&&r.type!=="PropertyDefinition")this.raise(V.DeclareClassElement,i);else if(r.value)this.raise(V.DeclareClassFieldInitializer,r.value)}}isIterator(t){return t==="iterator"||t==="asyncIterator"}readIterator(){let t=super.readWord1(),r="@@"+t;if(!this.isIterator(t)||!this.state.inType)this.raise(He.InvalidIdentifier,this.state.curPosition(),{identifierName:r});this.finishToken(128,r)}getTokenFromCode(t){let r=this.input.charCodeAt(this.state.pos+1);if(t===123&&r===124)this.finishOp(3,2);else if(this.state.inType&&(t===62||t===60))this.finishOp(t===62?44:43,1);else if(this.state.inType&&t===63)if(r===46)this.finishOp(14,2);else this.finishOp(13,1);else if(AA(t,r,this.input.charCodeAt(this.state.pos+2)))this.state.pos+=2,this.readIterator();else super.getTokenFromCode(t)}isAssignable(t,r){if(t.type==="TypeCastExpression")return this.isAssignable(t.expression,r);else return super.isAssignable(t,r)}toAssignable(t,r=!1){if(!r&&t.type==="AssignmentExpression"&&t.left.type==="TypeCastExpression")t.left=this.typeCastToParameter(t.left);super.toAssignable(t,r)}toAssignableListItem(t,r,o){let i=t[r];if(i.type==="TypeCastExpression")t[r]=this.typeCastToParameter(i);super.toAssignableListItem(t,r,o)}toReferencedList(t,r){for(let o=0;o<t.length;o++){let i=t[o];if(i?.type==="TypeCastExpression"&&!i.extra?.parenthesized&&(t.length>1||!r))this.raise(V.TypeCastInPattern,i.typeAnnotation)}return t}parseArrayLike(t,r){let o=super.parseArrayLike(t,r);if(o.type==="ArrayExpression")this.toReferencedList(o.elements);return o}isValidLVal(t,r,o,i){return t==="TypeCastExpression"||super.isValidLVal(t,r,o,i)}parseClassProperty(t){if(this.match(10))t.typeAnnotation=this.flowParseTypeAnnotation();return super.parseClassProperty(t)}parseClassPrivateProperty(t){if(this.match(10))t.typeAnnotation=this.flowParseTypeAnnotation();return super.parseClassPrivateProperty(t)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(10)||super.isClassProperty()}isNonstaticConstructor(t){return!this.match(10)&&super.isNonstaticConstructor(t)}pushClassMethod(t,r,o,i,s,a){if(r.variance)this.unexpected(r.variance.start);if(delete r.variance,this.match(43))r.typeParameters=this.flowParseTypeParameterDeclaration();if(super.pushClassMethod(t,r,o,i,s,a),r.params&&s){let c=r.params;if(c.length>0&&this.isThisParam(c[0]))this.raise(V.ThisParamBannedInConstructor,r)}else if(r.type==="MethodDefinition"&&s&&r.value.params){let c=r.value.params;if(c.length>0&&this.isThisParam(c[0]))this.raise(V.ThisParamBannedInConstructor,r)}}pushClassPrivateMethod(t,r,o,i){if(r.variance)this.unexpected(r.variance.start);if(delete r.variance,this.match(43))r.typeParameters=this.flowParseTypeParameterDeclaration();super.pushClassPrivateMethod(t,r,o,i)}flowParseClassImplements(){let t=this.startNode();if(t.id=this.flowParseRestrictedIdentifier(!0),this.match(43))t.typeParameters=this.flowParseTypeParameterInstantiation();else t.typeParameters=null;return this.finishNode(t,"ClassImplements")}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass&&(this.match(43)||this.match(47)))t.superTypeArguments=this.flowParseTypeParameterInstantiationInExpression();if(this.eatContextual(109)){let r=t.implements=[];do r.push(this.flowParseClassImplements());while(this.eat(8))}}checkGetterSetterParams(t){super.checkGetterSetterParams(t);let r=this.getObjectOrClassMethodParams(t);if(r.length>0){let o=r[0];if(this.isThisParam(o)&&t.kind==="get")this.raise(V.GetterMayNotHaveThisParam,o);else if(this.isThisParam(o))this.raise(V.SetterMayNotHaveThisParam,o)}}parsePropertyNamePrefixOperator(t){t.variance=this.flowParseVariance()}parseObjPropValue(t,r,o,i,s,a,c){if(t.variance)this.unexpected(t.variance.start);delete t.variance;let l;if(this.match(43)&&!a){if(l=this.flowParseTypeParameterDeclaration(),!this.match(6))this.unexpected()}let u=super.parseObjPropValue(t,r,o,i,s,a,c);if(l)(u.value||u).typeParameters=l;return u}parseFunctionParamType(t){if(this.eat(13)){if(t.type!=="Identifier")this.raise(V.PatternIsOptional,t);if(this.isThisParam(t))this.raise(V.ThisParamMayNotBeOptional,t);t.optional=!0}if(this.match(10))t.typeAnnotation=this.flowParseTypeAnnotation();else if(this.isThisParam(t))this.raise(V.ThisParamAnnotationRequired,t);if(this.match(25)&&this.isThisParam(t))this.raise(V.ThisParamNoDefault,t);return this.resetEndLocation(t),t}parseMaybeDefault(t,r){let o=super.parseMaybeDefault(t,r);if(o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start)this.raise(V.TypeBeforeInitializer,o.typeAnnotation);return o}parseImportSpecifierLocal(t,r,o){r.local=pw(t)?this.flowParseRestrictedIdentifier(!0,!0):this.parseIdentifier(),t.specifiers.push(this.finishImportSpecifier(r,o))}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(126)){if(!t)return!0;let r=this.lookaheadCharCode();return r===123||r===42}return!t&&this.isContextual(83)}applyImportPhase(t,r,o,i){if(super.applyImportPhase(t,r,o,i),r){if(!o&&this.match(61))return;t.exportKind=o==="type"?o:"value"}else{if(o==="type"&&this.match(51))this.unexpected();t.importKind=o==="type"||o==="typeof"?o:"value"}}parseImportSpecifier(t,r,o,i,s){let a=t.imported,c=null;if(a.type==="Identifier"){if(a.name==="type")c="type";else if(a.name==="typeof")c="typeof"}let l=!1;if(this.isContextual(89)&&!this.isLookaheadContextual("as")){let d=this.parseIdentifier(!0);if(c!==null&&!Sn(this.state.type))t.imported=d,t.importKind=c,t.local=this.cloneIdentifier(d);else t.imported=a,t.importKind=null,t.local=this.parseIdentifier()}else{if(c!==null&&Sn(this.state.type))t.imported=this.parseIdentifier(!0),t.importKind=c;else{if(r)throw this.raise(He.ImportBindingIsString,t,{importName:a.value});t.imported=a,t.importKind=null}if(this.eatContextual(89))t.local=this.parseIdentifier();else l=!0,t.local=this.cloneIdentifier(t.imported)}let u=pw(t);if(o&&u)this.raise(V.ImportTypeShorthandOnlyInPureImport,t);if(o||u)this.checkReservedType(t.local.name,t.local.start,!0);if(l&&!o&&!u)this.checkReservedWord(t.local.name,t.start,!0,!0);return this.finishImportSpecifier(t,"ImportSpecifier")}parseBindingAtom(){switch(this.state.type){case 74:return this.parseIdentifier(!0);default:return super.parseBindingAtom()}}parseFunctionParams(t,r){let o=t.kind;if(o!=="get"&&o!=="set"&&this.match(43))t.typeParameters=this.flowParseTypeParameterDeclaration();super.parseFunctionParams(t,r)}parseVarId(t,r){if(super.parseVarId(t,r),this.match(10))t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.resetEndLocation(t.id)}parseAsyncArrowFromCallExpression(t,r){if(this.match(10)){let o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0,t.returnType=this.flowParseTypeAnnotation(),this.state.noAnonFunctionType=o}return super.parseAsyncArrowFromCallExpression(t,r)}shouldParseAsyncArrow(){return this.match(10)||super.shouldParseAsyncArrow()}parseMaybeAssign(t,r){let o=null,i;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(o=this.state.clone(),i=this.tryParse(()=>super.parseMaybeAssign(t,r),o),!i.error)return i.node;let{context:s}=this.state,a=s[s.length-1];if(a===Ce.j_oTag||a===Ce.j_expr)s.pop()}if(i?.error||this.match(43)){o=o||this.state.clone();let s,a=this.tryParse((l)=>{s=this.flowParseTypeParameterDeclaration();let u=this.forwardNoArrowParamsConversionAt(s,()=>{let p=super.parseMaybeAssign(t,r);return this.resetStartLocationFromNode(p,s),p});if(u.extra?.parenthesized)l();let d=this.maybeUnwrapTypeCastExpression(u);if(d.type!=="ArrowFunctionExpression")l();return d.typeParameters=s,this.resetStartLocationFromNode(d,s),u},o),c=null;if(a.node&&this.maybeUnwrapTypeCastExpression(a.node).type==="ArrowFunctionExpression"){if(!a.error&&!a.aborted){if(a.node.async)this.raise(V.UnexpectedTypeParameterBeforeAsyncArrowFunction,s);return a.node}c=a.node}if(i?.node)return this.state=i.failState,i.node;if(c)return this.state=a.failState,c;if(i?.thrown)throw i.error;if(a.thrown)throw a.error;throw this.raise(V.UnexpectedTokenAfterTypeParameter,s)}return super.parseMaybeAssign(t,r)}parseArrow(t){if(this.match(10)){let r=this.tryParse(()=>{let o=this.state.noAnonFunctionType;this.state.noAnonFunctionType=!0;let i=this.startNode();if([i.typeAnnotation,t.predicate]=this.flowParseTypeAndPredicateInitialiser(!0),this.state.noAnonFunctionType=o,this.canInsertSemicolon())this.unexpected();if(!this.match(15))this.unexpected();return i});if(r.thrown)return null;if(r.error)this.state=r.failState;t.returnType=r.node.typeAnnotation?this.finishNode(r.node,"TypeAnnotation"):null}return super.parseArrow(t)}shouldParseArrow(t){return this.match(10)||super.shouldParseArrow(t)}setArrowFunctionParameters(t,r){if(this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))t.params=r;else super.setArrowFunctionParameters(t,r)}checkParams(t,r,o,i=!0){if(o&&this.state.noArrowParamsConversionAt.includes(this.offsetToSourcePos(t.start)))return;for(let s=0;s<t.params.length;s++)if(this.isThisParam(t.params[s])&&s>0)this.raise(V.ThisParamMustBeFirst,t.params[s]);super.checkParams(t,r,o,i)}parseParenAndDistinguishExpression(t){return super.parseParenAndDistinguishExpression(t&&!this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)))}parseSubscripts(t,r,o){if(t.type==="Identifier"&&t.name==="async"&&this.state.noArrowAt.includes(r.index)){this.next();let i=this.startNodeAt(r);i.callee=t,i.arguments=super.parseCallExpressionArguments(),t=this.finishNode(i,"CallExpression")}else if(t.type==="Identifier"&&t.name==="async"&&this.match(43)){let i=this.state.clone(),s=this.tryParse((c)=>this.parseAsyncArrowWithTypeParameters(r)||c(),i);if(!s.error&&!s.aborted)return s.node;let a=this.tryParse(()=>super.parseSubscripts(t,r,o),i);if(a.node&&!a.error)return a.node;if(s.node)return this.state=s.failState,s.node;if(a.node)return this.state=a.failState,a.node;throw s.error||a.error}return super.parseSubscripts(t,r,o)}parseSubscript(t,r,o,i){if(this.match(14)&&this.isLookaheadToken_lt()){if(i.optionalChainMember=!0,o)return i.stop=!0,t;this.next();let s=this.startNodeAt(r);return s.callee=t,s.typeArguments=this.flowParseTypeParameterInstantiationInExpression(),this.expect(6),s.arguments=this.parseCallExpressionArguments(),s.optional=!0,this.finishCallExpression(s,!0)}else if(!o&&this.shouldParseTypes()&&(this.match(43)||this.match(47))){let s=this.startNodeAt(r);s.callee=t;let a=this.tryParse(()=>{if(s.typeArguments=this.flowParseTypeParameterInstantiationCallOrNew(),this.expect(6),s.arguments=super.parseCallExpressionArguments(),i.optionalChainMember)s.optional=!1;return this.finishCallExpression(s,i.optionalChainMember)});if(a.node){if(a.error)this.state=a.failState;return a.node}}return super.parseSubscript(t,r,o,i)}parseNewCallee(t){super.parseNewCallee(t);let r=null;if(this.shouldParseTypes()&&this.match(43))r=this.tryParse(()=>this.flowParseTypeParameterInstantiationCallOrNew()).node;t.typeArguments=r}parseAsyncArrowWithTypeParameters(t){let r=this.startNodeAt(t);if(this.parseFunctionParams(r,!1),!this.parseArrow(r))return;return super.parseArrowExpression(r,void 0,!0)}readToken_mult_modulo(t){let r=this.input.charCodeAt(this.state.pos+1);if(t===42&&r===47&&this.state.hasFlowComment){this.state.hasFlowComment=!1,this.state.pos+=2,this.nextToken();return}super.readToken_mult_modulo(t)}readToken_pipe_amp(t){let r=this.input.charCodeAt(this.state.pos+1);if(t===124&&r===125){this.finishOp(5,2);return}super.readToken_pipe_amp(t)}parseTopLevel(t,r){let o=super.parseTopLevel(t,r);if(this.state.hasFlowComment)this.raise(V.UnterminatedFlowComment,this.state.curPosition());return o}skipBlockComment(){if(this.hasPlugin("flowComments")&&this.skipFlowComment()){if(this.state.hasFlowComment)throw this.raise(V.NestedFlowComment,this.state.startLoc);this.hasFlowCommentCompletion();let t=this.skipFlowComment();if(t)this.state.pos+=t,this.state.hasFlowComment=!0;return}return super.skipBlockComment(this.state.hasFlowComment?"*-/":"*/")}skipFlowComment(){let{pos:t}=this.state,r=2;while([32,9].includes(this.input.charCodeAt(t+r)))r++;let o=this.input.charCodeAt(r+t),i=this.input.charCodeAt(r+t+1);if(o===58&&i===58)return r+2;if(this.input.slice(r+t,r+t+12)==="flow-include")return r+12;if(o===58&&i!==58)return r;return!1}hasFlowCommentCompletion(){if(this.input.indexOf("*/",this.state.pos)===-1)throw this.raise(He.UnterminatedComment,this.state.curPosition())}flowEnumErrorBooleanMemberNotInitialized(t,r){this.raise(V.EnumBooleanMemberNotInitialized,t,r)}flowEnumErrorInvalidMemberInitializer(t,r){return this.raise(!r.explicitType?V.EnumInvalidMemberInitializerUnknownType:r.explicitType==="symbol"?V.EnumInvalidMemberInitializerSymbolType:V.EnumInvalidMemberInitializerPrimaryType,t,r)}flowEnumErrorNumberMemberNotInitialized(t,r){this.raise(V.EnumNumberMemberNotInitialized,t,r)}flowEnumErrorStringMemberInconsistentlyInitialized(t,r){this.raise(V.EnumStringMemberInconsistentlyInitialized,t,r)}flowEnumMemberInit(){let t=this.state.startLoc,r=()=>this.match(8)||this.match(4);switch(this.state.type){case 131:{let o=this.parseNumericLiteral(this.state.value);if(r())return{type:"number",loc:o.start,value:o};break}case 130:{let o=this.parseStringLiteral(this.state.value);if(r())return{type:"string",loc:o.start,value:o};break}case 81:case 82:{let o=this.parseBooleanLiteral(this.match(81));if(r())return{type:"boolean",loc:o.start,value:o}}}return{type:"invalid",loc:t}}flowEnumMemberRaw(){let t=this.state.startLoc,r=this.parseIdentifier(!0),o=this.eat(25)?this.flowEnumMemberInit():{type:"none",loc:t};return{id:r,init:o}}flowEnumCheckExplicitTypeMismatch(t,r,o){let{explicitType:i}=r;if(i===null)return;if(i!==o)this.flowEnumErrorInvalidMemberInitializer(t,r)}flowEnumMembers({enumName:t,explicitType:r}){let o=new Set,i={booleanMembers:[],numberMembers:[],stringMembers:[],defaultedMembers:[]},s=!1;while(!this.match(4)){if(this.eat(17)){s=!0;break}let a=this.startNode(),{id:c,init:l}=this.flowEnumMemberRaw(),u=c.name;if(u==="")continue;if(/^[a-z]/.test(u))this.raise(V.EnumInvalidMemberName,c,{memberName:u,suggestion:u[0].toUpperCase()+u.slice(1),enumName:t});if(o.has(u))this.raise(V.EnumDuplicateMemberName,c,{memberName:u,enumName:t});o.add(u);let d={enumName:t,explicitType:r,memberName:u};switch(a.id=c,l.type){case"boolean":{this.flowEnumCheckExplicitTypeMismatch(l.loc,d,"boolean"),a.init=l.value,i.booleanMembers.push(this.finishNode(a,"EnumBooleanMember"));break}case"number":{this.flowEnumCheckExplicitTypeMismatch(l.loc,d,"number"),a.init=l.value,i.numberMembers.push(this.finishNode(a,"EnumNumberMember"));break}case"string":{this.flowEnumCheckExplicitTypeMismatch(l.loc,d,"string"),a.init=l.value,i.stringMembers.push(this.finishNode(a,"EnumStringMember"));break}case"invalid":throw this.flowEnumErrorInvalidMemberInitializer(l.loc,d);case"none":switch(r){case"boolean":this.flowEnumErrorBooleanMemberNotInitialized(l.loc,d);break;case"number":this.flowEnumErrorNumberMemberNotInitialized(l.loc,d);break;default:i.defaultedMembers.push(this.finishNode(a,"EnumDefaultedMember"))}}if(!this.match(4))this.expect(8)}return{members:i,hasUnknownMembers:s}}flowEnumStringMembers(t,r,{enumName:o}){if(t.length===0)return r;else if(r.length===0)return t;else if(r.length>t.length){for(let i of t)this.flowEnumErrorStringMemberInconsistentlyInitialized(i,{enumName:o});return r}else{for(let i of r)this.flowEnumErrorStringMemberInconsistentlyInitialized(i,{enumName:o});return t}}flowEnumParseExplicitType({enumName:t}){if(!this.eatContextual(98))return null;if(!_e(this.state.type))throw this.raise(V.EnumInvalidExplicitTypeUnknownSupplied,this.state.startLoc,{enumName:t});let{value:r}=this.state;if(this.next(),r!=="boolean"&&r!=="number"&&r!=="string"&&r!=="symbol")this.raise(V.EnumInvalidExplicitType,this.state.startLoc,{enumName:t,invalidEnumType:r});return r}flowEnumBody(t,r){let{name:o,start:i}=r,s=this.flowEnumParseExplicitType({enumName:o});this.expect(2);let{members:a,hasUnknownMembers:c}=this.flowEnumMembers({enumName:o,explicitType:s});switch(t.hasUnknownMembers=c,s){case"boolean":return t.explicitType=!0,t.members=a.booleanMembers,this.expect(4),this.finishNode(t,"EnumBooleanBody");case"number":return t.explicitType=!0,t.members=a.numberMembers,this.expect(4),this.finishNode(t,"EnumNumberBody");case"string":return t.explicitType=!0,t.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:o}),this.expect(4),this.finishNode(t,"EnumStringBody");case"symbol":return t.members=a.defaultedMembers,this.expect(4),this.finishNode(t,"EnumSymbolBody");default:{let l=()=>(t.members=[],this.expect(4),this.finishNode(t,"EnumStringBody"));t.explicitType=!1;let u=a.booleanMembers.length,d=a.numberMembers.length,p=a.stringMembers.length,m=a.defaultedMembers.length;if(!u&&!d&&!p&&!m)return l();else if(!u&&!d)return t.members=this.flowEnumStringMembers(a.stringMembers,a.defaultedMembers,{enumName:o}),this.expect(4),this.finishNode(t,"EnumStringBody");else if(!d&&!p&&u>=m){for(let y of a.defaultedMembers)this.flowEnumErrorBooleanMemberNotInitialized(y.start,{enumName:o,memberName:y.id.name});return t.members=a.booleanMembers,this.expect(4),this.finishNode(t,"EnumBooleanBody")}else if(!u&&!p&&d>=m){for(let y of a.defaultedMembers)this.flowEnumErrorNumberMemberNotInitialized(y.start,{enumName:o,memberName:y.id.name});return t.members=a.numberMembers,this.expect(4),this.finishNode(t,"EnumNumberBody")}else return this.raise(V.EnumInconsistentMemberValues,i,{enumName:o}),l()}}}flowParseEnumDeclaration(t){let r=this.parseIdentifier();return t.id=r,t.body=this.flowEnumBody(this.startNode(),r),this.finishNode(t,"EnumDeclaration")}jsxParseOpeningElementAfterName(t){if(this.shouldParseTypes()){if(this.match(43)||this.match(47))t.typeArguments=this.flowParseTypeParameterInstantiationInExpression()}return super.jsxParseOpeningElementAfterName(t)}isLookaheadToken_lt(){let t=this.nextTokenStart();if(this.input.charCodeAt(t)===60){let r=this.input.charCodeAt(t+1);return r!==60&&r!==61}return!1}reScan_lt_gt(){let{type:t}=this.state;if(t===43)this.state.pos-=1,this.readToken_lt();else if(t===44)this.state.pos-=1,this.readToken_gt()}reScan_lt(){let{type:t}=this.state;if(t===47)return this.state.pos-=2,this.finishOp(43,1),43;return t}maybeUnwrapTypeCastExpression(t){return t.type==="TypeCastExpression"?t.expression:t}},DA,LA,lM,MA,Mt,zA=(e)=>class extends e{jsxReadToken(){let t="",r=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Mt.UnterminatedJsxContent,this.state.startLoc);let o=this.input.charCodeAt(this.state.pos);switch(o){case 60:case 123:if(this.state.pos===this.state.start){if(o===60&&this.state.canStartJSXElement)++this.state.pos,this.finishToken(138);else super.getTokenFromCode(o);return}t+=this.input.slice(r,this.state.pos),this.finishToken(137,t);return;case 38:t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos;break;case 62:case 125:this.raise(Mt.UnexpectedToken,this.state.curPosition(),{unexpected:this.input[this.state.pos],HTMLEntity:o===125?"&rbrace;":"&gt;"});default:if(fw(o))t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!0),r=this.state.pos;else++this.state.pos}}}jsxReadNewLine(t){let r=this.input.charCodeAt(this.state.pos),o;if(++this.state.pos,r===13&&this.input.charCodeAt(this.state.pos)===10)++this.state.pos,o=t?`
3
+ `:`\r
4
+ `;else o=String.fromCharCode(r);return++this.state.curLine,this.state.lineStart=this.state.pos,o}jsxReadString(t){let r="",o=++this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(He.UnterminatedString,this.state.startLoc);let i=this.input.charCodeAt(this.state.pos);if(i===t)break;if(i===38)r+=this.input.slice(o,this.state.pos),r+=this.jsxReadEntity(),o=this.state.pos;else if(fw(i))r+=this.input.slice(o,this.state.pos),r+=this.jsxReadNewLine(!1),o=this.state.pos;else++this.state.pos}r+=this.input.slice(o,this.state.pos++),this.finishToken(130,r)}jsxReadEntity(){let t=++this.state.pos;if(this.codePointAtPos(this.state.pos)===35){++this.state.pos;let r=10;if(this.codePointAtPos(this.state.pos)===120)r=16,++this.state.pos;let o=this.readInt(r,void 0,!1,"bail");if(o!==null&&this.codePointAtPos(this.state.pos)===59)return++this.state.pos,String.fromCodePoint(o)}else{let r=0,o=!1;while(r++<10&&this.state.pos<this.length&&!(o=this.codePointAtPos(this.state.pos)===59))++this.state.pos;if(o){let i=this.input.slice(t,this.state.pos),s=DA[i];if(++this.state.pos,s)return s}}return this.state.pos=t,"&"}jsxReadWord(){let t,r=this.state.pos;do t=this.input.charCodeAt(++this.state.pos);while(kw(t)||t===45);this.finishToken(136,this.input.slice(r,this.state.pos))}jsxParseIdentifier(){let t=this.startNode();if(this.match(136))t.name=this.state.value;else if(ww(this.state.type))t.name=Cd(this.state.type);else this.unexpected();return this.next(),this.finishNode(t,"JSXIdentifier")}jsxParseNamespacedName(){let t=this.state.startLoc,r=this.jsxParseIdentifier();if(!this.eat(10))return r;let o=this.startNodeAt(t);return o.namespace=r,o.name=this.jsxParseIdentifier(),this.finishNode(o,"JSXNamespacedName")}jsxParseElementName(){let t=this.state.startLoc,r=this.jsxParseNamespacedName();if(r.type==="JSXNamespacedName")return r;while(this.eat(12)){let o=this.startNodeAt(t);o.object=r,o.property=this.jsxParseIdentifier(),r=this.finishNode(o,"JSXMemberExpression")}return r}jsxParseAttributeValue(){let t;switch(this.state.type){case 2:if(t=this.startNode(),this.setContext(Ce.brace),this.next(),t=this.jsxParseExpressionContainer(t,Ce.j_oTag),t.expression.type==="JSXEmptyExpression")this.raise(Mt.AttributeIsEmpty,t);return t;case 138:case 130:return this.parseExprAtom();default:throw this.raise(Mt.UnsupportedJsxValue,this.state.startLoc)}}jsxParseEmptyExpression(){let t=this.startNodeAt(this.state.lastTokEndLoc);return this.finishNodeAt(t,"JSXEmptyExpression",this.state.startLoc)}jsxParseSpreadChild(t){return this.next(),t.expression=this.parseExpression(),this.setContext(Ce.j_expr),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(t,"JSXSpreadChild")}jsxParseExpressionContainer(t,r){if(this.match(4))t.expression=this.jsxParseEmptyExpression();else{let o=this.parseExpression();if(o.type==="SequenceExpression"&&!o.extra?.parenthesized)this.raise(Mt.UnexpectedSequenceExpression,o.expressions[1]);t.expression=o}return this.setContext(r),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(t,"JSXExpressionContainer")}jsxParseAttribute(){if(this.match(2)){let r=this.startNode();return this.setContext(Ce.brace),this.next(),this.expect(17),r.argument=this.parseMaybeAssignAllowIn(),this.setContext(Ce.j_oTag),this.state.canStartJSXElement=!0,this.expect(4),this.finishNode(r,"JSXSpreadAttribute")}let t=this.startNode();return t.name=this.jsxParseNamespacedName(),t.value=this.eat(25)?this.jsxParseAttributeValue():null,this.finishNode(t,"JSXAttribute")}jsxParseOpeningElementAt(t){if(this.eat(139)){let o=this.startNodeAt(t);return this.finishNode(o,"JSXOpeningFragment")}let r=this.startNodeAt(t);return r.name=this.jsxParseElementName(),this.jsxParseOpeningElementAfterName(r)}jsxParseOpeningElementAfterName(t){let r=[];while(!this.match(52)&&!this.match(139))r.push(this.jsxParseAttribute());return t.attributes=r,t.selfClosing=this.eat(52),this.expect(139),this.finishNode(t,"JSXOpeningElement")}jsxParseClosingElementAt(t){if(this.eat(139)){let o=this.startNodeAt(t);return this.finishNode(o,"JSXClosingFragment")}let r=this.startNodeAt(t);return r.name=this.jsxParseElementName(),this.expect(139),this.finishNode(r,"JSXClosingElement")}jsxParseElementAt(t){let r=this.startNodeAt(t),o=[],i=this.jsxParseOpeningElementAt(t),s=null;if(!i.selfClosing){e:for(;;)switch(this.state.type){case 138:if(t=this.state.startLoc,this.next(),this.eat(52)){this.setLoc(t),s=this.jsxParseClosingElementAt(t);break e}o.push(this.jsxParseElementAt(t));break;case 137:o.push(this.parseLiteral(this.state.value,"JSXText"));break;case 2:{let a=this.startNode();if(this.setContext(Ce.brace),this.next(),this.match(17))o.push(this.jsxParseSpreadChild(a));else o.push(this.jsxParseExpressionContainer(a,Ce.j_expr));break}default:this.unexpected()}if(on(i)&&!on(s)&&s!==null)this.raise(Mt.MissingClosingTagFragment,s);else if(!on(i)&&on(s))this.raise(Mt.MissingClosingTagElement,s,{openingTagName:lr(i.name)});else if(!on(i)&&!on(s)){if(lr(s.name)!==lr(i.name))this.raise(Mt.MissingClosingTagElement,s,{openingTagName:lr(i.name)})}}if(on(i))r.openingFragment=i,r.closingFragment=s;else r.openingElement=i,r.closingElement=s;if(r.children=o,this.match(43))throw this.raise(Mt.UnwrappedAdjacentJSXElements,this.state.startLoc);return on(i)?this.finishNode(r,"JSXFragment"):this.finishNode(r,"JSXElement")}jsxParseElement(){let t=this.state.startLoc;return this.next(),this.jsxParseElementAt(t)}setContext(t){let{context:r}=this.state;r[r.length-1]=t}parseExprAtom(t){if(this.match(138))return this.jsxParseElement();else if(this.match(43)&&this.input.charCodeAt(this.state.pos)!==33)return this.replaceToken(138),this.jsxParseElement();else return super.parseExprAtom(t)}skipSpace(){if(!this.curContext().preserveSpace)super.skipSpace()}getTokenFromCode(t){let r=this.curContext();if(r===Ce.j_expr){this.jsxReadToken();return}if(r===Ce.j_oTag||r===Ce.j_cTag){if(Pd(t)){this.jsxReadWord();return}if(t===62){++this.state.pos,this.finishToken(139);return}if((t===34||t===39)&&r===Ce.j_oTag){this.jsxReadString(t);return}}if(t===60&&this.state.canStartJSXElement&&this.input.charCodeAt(this.state.pos+1)!==33){++this.state.pos,this.finishToken(138);return}super.getTokenFromCode(t)}updateContext(t){let{context:r,type:o}=this.state;if(o===52&&t===138)r.splice(-2,2,Ce.j_cTag),this.state.canStartJSXElement=!1;else if(o===138)r.push(Ce.j_oTag);else if(o===139){let i=r[r.length-1];if(i===Ce.j_oTag&&t===52||i===Ce.j_cTag)r.pop(),this.state.canStartJSXElement=r[r.length-1]===Ce.j_expr;else this.setContext(Ce.j_expr),this.state.canStartJSXElement=!0}else this.state.canStartJSXElement=wA(o)}},Cw,Pw,uM,yd,qA,N,UA=(e)=>class extends e{getScopeHandler(){return Pw}tsIsIdentifier(){return _e(this.state.type)}tsTokenCanFollowModifier(){return this.match(0)||this.match(2)||this.match(51)||this.match(17)||this.match(134)||this.isLiteralPropertyName()}tsNextTokenOnSameLineAndCanFollowModifier(){if(this.next(),this.hasPrecedingLineBreak())return!1;return this.tsTokenCanFollowModifier()}tsNextTokenCanFollowModifier(){if(this.match(102))return this.next(),this.tsTokenCanFollowModifier();return this.tsNextTokenOnSameLineAndCanFollowModifier()}tsParseModifier(t,r,o){if(!_e(this.state.type)&&this.state.type!==54&&this.state.type!==71)return;let i=this.state.value;if(t.includes(i)){if(o&&this.match(102))return;if(r&&this.tsIsStartOfStaticBlocks())return;if(this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))return i}return}tsParseModifiers({allowedModifiers:t,disallowedModifiers:r,stopOnStartOfClassStaticBlock:o,errorTemplate:i=N.InvalidModifierOnTypeMember},s){let a=(l,u,d,p)=>{if(u===d&&s[p])this.raise(N.InvalidModifiersOrder,l,{orderedModifiers:[d,p]})},c=(l,u,d,p)=>{if(s[d]&&u===p||s[p]&&u===d)this.raise(N.IncompatibleModifiers,l,{modifiers:[d,p]})};for(;;){let{startLoc:l}=this.state,u=this.tsParseModifier(t.concat(r??[]),o,s.static);if(!u)break;if(mw(u))if(s.accessibility)this.raise(N.DuplicateAccessibilityModifier,l,{modifier:u});else a(l,u,u,"override"),a(l,u,u,"static"),a(l,u,u,"readonly"),s.accessibility=u;else if(BA(u)){if(s[u])this.raise(N.DuplicateModifier,l,{modifier:u});s[u]=!0,a(l,u,"in","out")}else{if(Object.hasOwn(s,u))this.raise(N.DuplicateModifier,l,{modifier:u});else a(l,u,"static","readonly"),a(l,u,"static","override"),a(l,u,"override","readonly"),a(l,u,"abstract","override"),c(l,u,"declare","override"),c(l,u,"static","abstract");s[u]=!0}if(r?.includes(u))this.raise(i,l,{modifier:u})}}tsIsListTerminator(t){switch(t){case"EnumMembers":case"TypeMembers":return this.match(4);case"HeritageClauseElement":return this.match(2);case"TupleElementTypes":return this.match(1);case"TypeParametersOrArguments":return this.match(44)}}tsParseList(t,r){let o=[];while(!this.tsIsListTerminator(t))o.push(r());return o}tsParseDelimitedList(t,r,o){return FA(this.tsParseDelimitedListWorker(t,r,!0,o))}tsParseDelimitedListWorker(t,r,o,i){let s=[],a=-1;for(;;){if(this.tsIsListTerminator(t))break;a=-1;let c=r();if(c==null)return;if(s.push(c),this.eat(8)){a=this.state.lastTokStartLoc.index;continue}if(this.tsIsListTerminator(t))break;if(o)this.expect(8);return}if(i)i.value=a;return s}tsParseBracketedList(t,r,o,i,s){if(!i)if(o)this.expect(0);else this.expect(43);let a=this.tsParseDelimitedList(t,r,s);if(o)this.expect(1);else this.expect(44);return a}tsParseImportType(){let t=this.startNode();if(this.expect(79),this.expect(6),!this.match(130))this.raise(N.UnsupportedImportTypeArgument,this.state.startLoc),t.source=this.tsParseNonConditionalType();else t.source=this.parseStringLiteral(this.state.value);if(this.eat(8))t.options=this.tsParseImportTypeOptions();else t.options=null;if(this.expect(7),this.eat(12))t.qualifier=this.tsParseEntityName(3);if(this.match(43))t.typeArguments=this.tsParseTypeArguments();return this.finishNode(t,"TSImportType")}tsParseImportTypeOptions(){let t=this.startNode();this.expect(2);let r=this.startNode();if(this.isContextual(72))r.method=!1,r.key=this.parseIdentifier(!0),r.computed=!1,r.shorthand=!1;else this.unexpected(null,72);return this.expect(10),r.value=this.tsParseImportTypeWithPropertyValue(),t.properties=[this.finishObjectProperty(r)],this.eat(8),this.expect(4),this.finishNode(t,"ObjectExpression")}tsParseImportTypeWithPropertyValue(){let t=this.startNode(),r=[];this.expect(2);while(!this.match(4)){let o=this.state.type;if(_e(o)||o===130)r.push(super.parsePropertyDefinition(null));else this.unexpected();this.eat(8)}return t.properties=r,this.next(),this.finishNode(t,"ObjectExpression")}tsParseEntityName(t){let r;if(t&1&&this.match(74))if(t&2)r=this.parseIdentifier(!0);else{let o=this.startNode();this.next(),r=this.finishNode(o,"ThisExpression")}else r=this.parseIdentifier(!!(t&1));while(this.eat(12)){let o=this.startNodeAtNode(r);o.left=r,o.right=this.parseIdentifier(!!(t&1)),r=this.finishNode(o,"TSQualifiedName")}return r}tsParseTypeReference(){let t=this.startNode();if(t.typeName=this.tsParseEntityName(1),!this.hasPrecedingLineBreak()&&this.match(43))t.typeArguments=this.tsParseTypeArguments();return this.finishNode(t,"TSTypeReference")}tsParseThisTypePredicate(t){this.next();let r=this.startNodeAtNode(t);return r.parameterName=t,r.typeAnnotation=this.tsParseTypeAnnotation(!1),r.asserts=!1,this.finishNode(r,"TSTypePredicate")}tsParseThisTypeNode(){let t=this.startNode();return this.next(),this.finishNode(t,"TSThisType")}tsParseTypeQuery(){let t=this.startNode();if(this.expect(83),this.match(79))t.exprName=this.tsParseImportType();else t.exprName=this.tsParseEntityName(1);if(!this.hasPrecedingLineBreak()&&this.match(43))t.typeArguments=this.tsParseTypeArguments();return this.finishNode(t,"TSTypeQuery")}tsParseInOutModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out"],disallowedModifiers:["const","public","private","protected","readonly","declare","abstract","override"],errorTemplate:N.InvalidModifierOnTypeParameter});tsParseConstModifier=this.tsParseModifiers.bind(this,{allowedModifiers:["const"],disallowedModifiers:["in","out"],errorTemplate:N.InvalidModifierOnTypeParameterPositions});tsParseInOutConstModifiers=this.tsParseModifiers.bind(this,{allowedModifiers:["in","out","const"],disallowedModifiers:["public","private","protected","readonly","declare","abstract","override"],errorTemplate:N.InvalidModifierOnTypeParameter});tsParseTypeParameter(t){let r=this.startNode();return t(r),r.name=this.tsParseTypeParameterName(),r.constraint=this.tsEatThenParseType(77),r.default=this.tsEatThenParseType(25),this.finishNode(r,"TSTypeParameter")}tsTryParseTypeParameters(t){if(this.match(43))return this.tsParseTypeParameters(t)}tsParseTypeParameters(t){let r=this.startNode();if(this.match(43)||this.match(138))this.next();else this.unexpected();let o={value:-1};if(r.params=this.tsParseBracketedList("TypeParametersOrArguments",this.tsParseTypeParameter.bind(this,t),!1,!0,o),r.params.length===0)this.raise(N.EmptyTypeParameters,r);if(o.value!==-1)this.addExtra(r,"trailingComma",o.value);return this.finishNode(r,"TSTypeParameterDeclaration")}tsFillSignature(t,r){let o=t===15,i="params",s="returnType";if(r.typeParameters=this.tsTryParseTypeParameters(this.tsParseConstModifier),this.expect(6),r.params=this.tsParseBindingListForSignature(),o)r.returnType=this.tsParseTypeOrTypePredicateAnnotation(t);else if(this.match(t))r.returnType=this.tsParseTypeOrTypePredicateAnnotation(t)}tsParseBindingListForSignature(){let t=super.parseBindingList(7,41,2);for(let r of t){let{type:o}=r;if(o==="AssignmentPattern"||o==="TSParameterProperty")this.raise(N.UnsupportedSignatureParameterKind,r,{type:o})}return t}tsParseTypeMemberSemicolon(){if(!this.eat(8)&&!this.isLineTerminator())this.expect(9)}tsParseSignatureMember(t,r){return this.tsFillSignature(10,r),this.tsParseTypeMemberSemicolon(),this.finishNode(r,t)}tsIsUnambiguouslyIndexSignature(){if(this.next(),_e(this.state.type))return this.next(),this.match(10);return!1}tsTryParseIndexSignature(t){if(!(this.match(0)&&this.tsLookAhead(this.tsIsUnambiguouslyIndexSignature.bind(this))))return;this.expect(0);let r=this.parseIdentifier();r.typeAnnotation=this.tsParseTypeAnnotation(),this.resetEndLocation(r),this.expect(1),t.parameters=[r];let o=this.tsTryParseTypeAnnotation();if(o)t.typeAnnotation=o;return this.tsParseTypeMemberSemicolon(),this.finishNode(t,"TSIndexSignature")}tsParsePropertyOrMethodSignature(t,r){if(this.eat(13))t.optional=!0;if(this.match(6)||this.match(43)){if(r)this.raise(N.ReadonlyForMethodSignature,t);let o=t;if(o.kind&&this.match(43))this.raise(N.AccessorCannotHaveTypeParameters,this.state.curPosition());if(this.tsFillSignature(10,o),this.tsParseTypeMemberSemicolon(),o.kind==="get"){if(o.params.length>0){if(this.raise(He.BadGetterArity,this.state.curPosition()),this.isThisParam(o.params[0]))this.raise(N.AccessorCannotDeclareThisParameter,this.state.curPosition())}}else if(o.kind==="set"){if(o.params.length!==1)this.raise(He.BadSetterArity,this.state.curPosition());else{let i=o.params[0];if(this.isThisParam(i))this.raise(N.AccessorCannotDeclareThisParameter,this.state.curPosition());if(i.type==="Identifier"&&i.optional)this.raise(N.SetAccessorCannotHaveOptionalParameter,this.state.curPosition());if(i.type==="RestElement")this.raise(N.SetAccessorCannotHaveRestParameter,this.state.curPosition())}if(o.returnType)this.raise(N.SetAccessorCannotHaveReturnType,o.returnType)}else o.kind="method";return this.finishNode(o,"TSMethodSignature")}else{let o=t;if(r)o.readonly=!0;let i=this.tsTryParseTypeAnnotation();if(i)o.typeAnnotation=i;return this.tsParseTypeMemberSemicolon(),this.finishNode(o,"TSPropertySignature")}}tsParseTypeMember(){let t=this.startNode();if(this.match(6)||this.match(43))return this.tsParseSignatureMember("TSCallSignatureDeclaration",t);if(this.match(73)){let o=this.startNode();if(this.next(),this.match(6)||this.match(43))return this.tsParseSignatureMember("TSConstructSignatureDeclaration",t);else return t.key=this.createIdentifier(o,"new"),this.tsParsePropertyOrMethodSignature(t,!1)}this.tsParseModifiers({allowedModifiers:["readonly"],disallowedModifiers:["declare","abstract","private","protected","public","static","override"]},t);let r=this.tsTryParseIndexSignature(t);if(r)return r;if(super.parsePropertyName(t),!t.computed&&t.key.type==="Identifier"&&(t.key.name==="get"||t.key.name==="set")&&this.tsTokenCanFollowModifier()){if(t.kind=t.key.name,super.parsePropertyName(t),!this.match(6)&&!this.match(43))this.unexpected(null,6)}return this.tsParsePropertyOrMethodSignature(t,!!t.readonly)}tsParseTypeLiteral(){let t=this.startNode();return t.members=this.tsParseObjectTypeMembers(),this.finishNode(t,"TSTypeLiteral")}tsParseObjectTypeMembers(){this.expect(2);let t=this.tsParseList("TypeMembers",this.tsParseTypeMember.bind(this));return this.expect(4),t}tsIsStartOfMappedType(){if(this.next(),this.eat(49))return this.isContextual(118);if(this.isContextual(118))this.next();if(!this.match(0))return!1;if(this.next(),!this.tsIsIdentifier())return!1;return this.next(),this.match(54)}tsParseMappedType(){let t=this.startNode();if(this.expect(2),this.match(49))t.readonly=this.state.value,this.next(),this.expectContextual(118);else if(this.eatContextual(118))t.readonly=!0;if(this.expect(0),t.key=this.tsParseTypeParameterName(),t.constraint=this.tsExpectThenParseType(54),t.nameType=this.eatContextual(89)?this.tsParseType():null,this.expect(1),this.match(49))t.optional=this.state.value,this.next(),this.expect(13);else if(this.eat(13))t.optional=!0;return t.typeAnnotation=this.tsTryParseType(),this.semicolon(),this.expect(4),this.finishNode(t,"TSMappedType")}tsParseTupleType(){let t=this.startNode();t.elementTypes=this.tsParseBracketedList("TupleElementTypes",this.tsParseTupleElementType.bind(this),!0,!1);let r=!1;return t.elementTypes.forEach((o)=>{let{type:i}=o;if(r&&i!=="TSRestType"&&i!=="TSOptionalType"&&!(i==="TSNamedTupleMember"&&o.optional))this.raise(N.OptionalTypeBeforeRequired,o);r||=i==="TSNamedTupleMember"&&o.optional||i==="TSOptionalType"}),this.finishNode(t,"TSTupleType")}tsParseTupleElementType(){let t=this.state.startLoc,r=this.eat(17),{startLoc:o}=this.state,i,s,a,c,u=Sn(this.state.type)?this.lookaheadCharCode():null;if(u===58)i=!0,a=!1,s=this.parseIdentifier(!0),this.expect(10),c=this.tsParseType();else if(u===63){a=!0;let d=this.state.value,p=this.tsParseNonArrayType();if(this.lookaheadCharCode()===58)i=!0,s=this.createIdentifier(this.startNodeAt(o),d),this.expect(13),this.expect(10),c=this.tsParseType();else i=!1,c=p,this.expect(13)}else c=this.tsParseType(),a=this.eat(13),i=this.eat(10);if(i){let d;if(s){if(d=this.startNodeAt(o),d.optional=a,d.label=s,d.elementType=c,this.eat(13))d.optional=!0,this.raise(N.TupleOptionalAfterType,this.state.lastTokStartLoc)}else d=this.startNodeAt(o),d.optional=a,this.raise(N.InvalidTupleMemberLabel,c),d.label=c,d.elementType=this.tsParseType();c=this.finishNode(d,"TSNamedTupleMember")}else if(a){let d=this.startNodeAt(o);d.typeAnnotation=c,c=this.finishNode(d,"TSOptionalType")}if(r){let d=this.startNodeAt(t);d.typeAnnotation=c,c=this.finishNode(d,"TSRestType")}return c}tsParseParenthesizedType(){let t=this.startNode();return this.expect(6),t.typeAnnotation=this.tsParseType(),this.expect(7),this.finishNode(t,"TSParenthesizedType")}tsParseFunctionOrConstructorType(t,r){let o=this.startNode();if(t==="TSConstructorType"){if(o.abstract=!!r,r)this.next();this.next()}return this.tsInAllowConditionalTypesContext(()=>this.tsFillSignature(15,o)),this.finishNode(o,t)}tsParseLiteralTypeNode(){let t=this.startNode();switch(this.state.type){case 131:case 132:case 130:case 81:case 82:t.literal=super.parseExprAtom();break;default:this.unexpected()}return this.finishNode(t,"TSLiteralType")}tsParseTemplateLiteralType(){let t=this.state.startLoc,r=this.parseTemplateElement(!1),o=[r];if(r.tail){let i=this.startNodeAt(t),s=this.startNodeAt(t);return s.expressions=[],s.quasis=o,i.literal=this.finishNode(s,"TemplateLiteral"),this.finishNode(i,"TSLiteralType")}else{let i=[];while(!r.tail)i.push(this.tsParseType()),this.readTemplateContinuation(),o.push(r=this.parseTemplateElement(!1));let s=this.startNodeAt(t);return s.types=i,s.quasis=o,this.finishNode(s,"TSTemplateLiteralType")}}parseTemplateSubstitution(){if(this.state.inType)return this.tsParseType();return super.parseTemplateSubstitution()}tsParseThisTypeOrThisTypePredicate(){let t=this.tsParseThisTypeNode();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.tsParseThisTypePredicate(t);else return t}tsParseNonArrayType(){switch(this.state.type){case 130:case 131:case 132:case 81:case 82:return this.tsParseLiteralTypeNode();case 49:if(this.state.value==="-"){let t=this.startNode(),r=this.lookahead();if(r.type!==131&&r.type!==132)this.unexpected();return t.literal=this.parseMaybeUnary(),this.finishNode(t,"TSLiteralType")}break;case 74:return this.tsParseThisTypeOrThisTypePredicate();case 83:return this.tsParseTypeQuery();case 79:return this.tsParseImportType();case 2:return this.tsLookAhead(this.tsIsStartOfMappedType.bind(this))?this.tsParseMappedType():this.tsParseTypeLiteral();case 0:return this.tsParseTupleType();case 6:if(!(this.optionFlags&2048)){let t=this.state.startLoc;this.next();let r=this.tsParseType();return this.expect(7),this.addExtra(r,"parenthesized",!0),this.addExtra(r,"parenStart",t.index),r}return this.tsParseParenthesizedType();case 21:case 20:return this.tsParseTemplateLiteralType();default:{let{type:t}=this.state;if(_e(t)||t===84||t===80){let r=t===84?"TSVoidKeyword":t===80?"TSNullKeyword":VA(this.state.value);if(r!==void 0&&this.lookaheadCharCode()!==46){let o=this.startNode();return this.next(),this.finishNode(o,r)}return this.tsParseTypeReference()}}}throw this.unexpected()}tsParseArrayTypeOrHigher(){let{startLoc:t}=this.state,r=this.tsParseNonArrayType();while(!this.hasPrecedingLineBreak()&&this.eat(0))if(this.match(1)){let o=this.startNodeAt(t);o.elementType=r,this.expect(1),r=this.finishNode(o,"TSArrayType")}else{let o=this.startNodeAt(t);o.objectType=r,o.indexType=this.tsParseType(),this.expect(1),r=this.finishNode(o,"TSIndexedAccessType")}return r}tsParseTypeOperator(){let t=this.startNode(),r=this.state.value;if(this.next(),t.operator=r,t.typeAnnotation=this.tsParseTypeOperatorOrHigher(),r==="readonly")this.tsCheckTypeAnnotationForReadOnly(t);return this.finishNode(t,"TSTypeOperator")}tsCheckTypeAnnotationForReadOnly(t){switch(t.typeAnnotation.type){case"TSTupleType":case"TSArrayType":return;default:this.raise(N.UnexpectedReadonly,t)}}tsParseInferType(){let t=this.startNode();this.expectContextual(111);let r=this.startNode();return r.name=this.tsParseTypeParameterName(),r.constraint=this.tsTryParse(()=>this.tsParseConstraintForInferType()),t.typeParameter=this.finishNode(r,"TSTypeParameter"),this.finishNode(t,"TSInferType")}tsParseConstraintForInferType(){if(this.eat(77)){let t=this.tsInDisallowConditionalTypesContext(()=>this.tsParseType());if(this.state.inDisallowConditionalTypesContext||!this.match(13))return t}}tsParseTypeOperatorOrHigher(){return kA(this.state.type)&&!this.state.containsEsc?this.tsParseTypeOperator():this.isContextual(111)?this.tsParseInferType():this.tsInAllowConditionalTypesContext(()=>this.tsParseArrayTypeOrHigher())}tsParseUnionOrIntersectionType(t,r,o){let i=this.startNode(),s=this.eat(o),a=[];do a.push(r());while(this.eat(o));if(a.length===1&&!s)return a[0];return i.types=a,this.finishNode(i,t)}tsParseIntersectionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSIntersectionType",this.tsParseTypeOperatorOrHigher.bind(this),41)}tsParseUnionTypeOrHigher(){return this.tsParseUnionOrIntersectionType("TSUnionType",this.tsParseIntersectionTypeOrHigher.bind(this),39)}tsIsStartOfFunctionType(){if(this.match(43))return!0;return this.match(6)&&this.tsLookAhead(this.tsIsUnambiguouslyStartOfFunctionType.bind(this))}tsSkipParameterStart(){if(_e(this.state.type)||this.match(74))return this.next(),!0;if(this.match(2)){let{errors:t}=this.state,r=t.length;try{return this.parseObjectLike(4,!0),t.length===r}catch{return!1}}if(this.match(0)){this.next();let{errors:t}=this.state,r=t.length;try{return super.parseBindingList(1,93,1),t.length===r}catch{return!1}}return!1}tsIsUnambiguouslyStartOfFunctionType(){if(this.next(),this.match(7)||this.match(17))return!0;if(this.tsSkipParameterStart()){if(this.match(10)||this.match(8)||this.match(13)||this.match(25))return!0;if(this.match(7)){if(this.next(),this.match(15))return!0}}return!1}tsParseTypeOrTypePredicateAnnotation(t){return this.tsInType(()=>{let r=this.startNode();this.expect(t);let o=this.startNode(),i=!!this.tsTryParse(this.tsParseTypePredicateAsserts.bind(this));if(i&&this.match(74)){let c=this.tsParseThisTypeOrThisTypePredicate();if(c.type==="TSThisType")o.parameterName=c,o.asserts=!0,o.typeAnnotation=null,c=this.finishNode(o,"TSTypePredicate");else this.resetStartLocationFromNode(c,o),c.asserts=!0;return r.typeAnnotation=c,this.finishNode(r,"TSTypeAnnotation")}let s=this.tsIsIdentifier()&&this.tsTryParse(this.tsParseTypePredicatePrefix.bind(this));if(!s){if(!i)return this.tsParseTypeAnnotation(!1,r);return o.parameterName=this.parseIdentifier(),o.asserts=i,o.typeAnnotation=null,r.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(r,"TSTypeAnnotation")}let a=this.tsParseTypeAnnotation(!1);return o.parameterName=s,o.typeAnnotation=a,o.asserts=i,r.typeAnnotation=this.finishNode(o,"TSTypePredicate"),this.finishNode(r,"TSTypeAnnotation")})}tsTryParseTypeOrTypePredicateAnnotation(){if(this.match(10))return this.tsParseTypeOrTypePredicateAnnotation(10)}tsTryParseTypeAnnotation(){if(this.match(10))return this.tsParseTypeAnnotation()}tsTryParseType(){return this.tsEatThenParseType(10)}tsParseTypePredicatePrefix(){let t=this.parseIdentifier();if(this.isContextual(112)&&!this.hasPrecedingLineBreak())return this.next(),t}tsParseTypePredicateAsserts(){if(this.state.type!==105)return!1;let t=this.state.containsEsc;if(this.next(),!_e(this.state.type)&&!this.match(74))return!1;if(t)this.raise(He.InvalidEscapedReservedWord,this.state.lastTokStartLoc,{reservedWord:"asserts"});return!0}tsParseTypeAnnotation(t=!0,r=this.startNode()){return this.tsInType(()=>{if(t)this.expect(10);r.typeAnnotation=this.tsParseType()}),this.finishNode(r,"TSTypeAnnotation")}tsParseType(){hw(this.state.inType);let t=this.tsParseNonConditionalType();if(this.state.inDisallowConditionalTypesContext||this.hasPrecedingLineBreak()||!this.eat(77))return t;let r=this.startNodeAtNode(t);return r.checkType=t,r.extendsType=this.tsInDisallowConditionalTypesContext(()=>this.tsParseNonConditionalType()),this.expect(13),r.trueType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.expect(10),r.falseType=this.tsInAllowConditionalTypesContext(()=>this.tsParseType()),this.finishNode(r,"TSConditionalType")}isAbstractConstructorSignature(){return this.isContextual(120)&&this.isLookaheadContextual("new")}tsParseNonConditionalType(){if(this.tsIsStartOfFunctionType())return this.tsParseFunctionOrConstructorType("TSFunctionType");if(this.match(73))return this.tsParseFunctionOrConstructorType("TSConstructorType");else if(this.isAbstractConstructorSignature())return this.tsParseFunctionOrConstructorType("TSConstructorType",!0);return this.tsParseUnionTypeOrHigher()}tsParseTypeAssertion(){if(this.getPluginOption("typescript","disallowAmbiguousJSXLike"))this.raise(N.ReservedTypeAssertion,this.state.startLoc);let t=this.startNode();return t.typeAnnotation=this.tsInType(()=>(this.next(),this.match(71)?this.tsParseTypeReference():this.tsParseType())),this.expect(44),t.expression=this.parseMaybeUnary(),this.finishNode(t,"TSTypeAssertion")}tsParseHeritageClause(t){let r=this.state.startLoc,o=this.tsParseDelimitedList("HeritageClauseElement",()=>{let i=(this.state.canStartArrow=!1,super.parseExprSubscripts());if(!bd(i))this.raise(N.InvalidHeritageClauseType,i.start,{token:t});let s=t==="extends"?"TSInterfaceHeritage":"TSClassImplements";if(i.type==="TSInstantiationExpression")return i.type=s,i;let a=this.startNodeAtNode(i);if(a.expression=i,this.match(43)||this.match(47))a.typeArguments=this.tsParseTypeArgumentsInExpression();return this.finishNode(a,s)});if(!o.length)this.raise(N.EmptyHeritageClauseType,r,{token:t});return o}tsParseInterfaceDeclaration(t,r={}){if(this.hasFollowingLineBreak())return null;if(this.expectContextual(125),r.declare)t.declare=!0;if(_e(this.state.type))t.id=this.parseIdentifier(),this.checkIdentifier(t.id,130);else t.id=null,this.raise(N.MissingInterfaceName,this.state.startLoc);if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers),this.eat(77))t.extends=this.tsParseHeritageClause("extends");let o=this.startNode();return o.body=this.tsInType(this.tsParseObjectTypeMembers.bind(this)),t.body=this.finishNode(o,"TSInterfaceBody"),this.finishNode(t,"TSInterfaceDeclaration")}tsParseTypeAliasDeclaration(t){return t.id=this.parseIdentifier(),this.checkIdentifier(t.id,2),t.typeAnnotation=this.tsInType(()=>{if(t.typeParameters=this.tsTryParseTypeParameters(this.tsParseInOutModifiers),this.expect(25),this.isContextual(110)&&this.lookaheadCharCode()!==46){let r=this.startNode();return this.next(),this.finishNode(r,"TSIntrinsicKeyword")}return this.tsParseType()}),this.semicolon(),this.finishNode(t,"TSTypeAliasDeclaration")}tsInTopLevelContext(t){if(this.curContext()!==Ce.brace){let r=this.state.context;this.state.context=[r[0]];try{return t()}finally{this.state.context=r}}else return t()}tsInType(t){let r=this.state.inType;this.state.inType=!0;try{return t()}finally{this.state.inType=r}}tsInDisallowConditionalTypesContext(t){let r=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!0;try{return t()}finally{this.state.inDisallowConditionalTypesContext=r}}tsInAllowConditionalTypesContext(t){let r=this.state.inDisallowConditionalTypesContext;this.state.inDisallowConditionalTypesContext=!1;try{return t()}finally{this.state.inDisallowConditionalTypesContext=r}}tsEatThenParseType(t){if(this.match(t))return this.tsNextThenParseType()}tsExpectThenParseType(t){return this.tsInType(()=>(this.expect(t),this.tsParseType()))}tsNextThenParseType(){return this.tsInType(()=>(this.next(),this.tsParseType()))}tsParseEnumMember(){let t=this.startNode();if(t.id=this.match(130)?super.parseStringLiteral(this.state.value):this.parseIdentifier(!0),this.eat(25))t.initializer=super.parseMaybeAssignAllowIn();return this.finishNode(t,"TSEnumMember")}tsParseEnumDeclaration(t,r={}){if(r.const)t.const=!0;if(r.declare)t.declare=!0;return this.expectContextual(122),t.id=this.parseIdentifier(),this.checkIdentifier(t.id,t.const?8971:8459),t.body=this.tsParseEnumBody(),this.finishNode(t,"TSEnumDeclaration")}tsParseEnumBody(){let t=this.startNode();return this.expect(2),t.members=this.tsParseDelimitedList("EnumMembers",this.tsParseEnumMember.bind(this)),this.expect(4),this.finishNode(t,"TSEnumBody")}tsParseModuleBlock(t){let r=this.startNode();if(!t)this.scope.enter(0);if(this.expect(2),super.parseBlockOrModuleBlockBody(r.body=[],void 0,!0,4),!t)this.scope.exit();return this.finishNode(r,"TSModuleBlock")}tsParseNamespaceDeclaration(t){if(t.id=this.tsParseEntityName(0),t.id.type==="Identifier")this.checkIdentifier(t.id,1024);return this.scope.enter(2048),this.prodParam.enter(0),t.body=this.tsParseModuleBlock(!1),this.prodParam.exit(),this.scope.exit(),this.finishNode(t,"TSModuleDeclaration")}tsParseAmbientExternalModuleDeclaration(t){let r=this.isContextual(108);if(r)t.kind="global",t.id=this.parseIdentifier();else{t.kind="module";let{type:o,value:i}=this.state;if(o===130)t.id=super.parseStringLiteral(i);else if(_e(o))this.raise(N.InlineModuleDeclarationMustUseString,this.state.startLoc),t.id=this.tsParseEntityName(0);else if(o===2)this.raise(N.EmptyNamespaceName,this.state.startLoc);else this.raise(N.InvalidNamespaceName,this.state.startLoc,i),t.id=super.parseExprAtom()}if(this.match(2)){if(!r)this.scope.enter(1024);if(this.prodParam.enter(0),t.body=this.tsParseModuleBlock(r),this.prodParam.exit(),!r)this.scope.exit()}else this.semicolon();return this.finishNode(t,"TSModuleDeclaration")}tsParseImportEqualsDeclaration(t,r){t.id=r||this.parseIdentifier(),this.checkIdentifier(t.id,4096),this.expect(25);let o=this.tsParseModuleReference();if(t.importKind==="type"&&o.type!=="TSExternalModuleReference")this.raise(N.ImportAliasHasImportType,o);return t.moduleReference=o,this.semicolon(),this.finishNode(t,"TSImportEqualsDeclaration")}tsIsExternalModuleReference(){return this.isContextual(115)&&this.lookaheadCharCode()===40}tsParseModuleReference(){return this.tsIsExternalModuleReference()?this.tsParseExternalModuleReference():this.tsParseEntityName(0)}tsParseExternalModuleReference(){let t=this.startNode();if(this.expectContextual(115),this.expect(6),!this.match(130))this.unexpected();return t.expression=super.parseExprAtom(),this.expect(7),this.sawUnambiguousESM=!0,this.finishNode(t,"TSExternalModuleReference")}tsLookAhead(t){let r=this.state.clone(),o=t();return this.state=r,o}tsTryParseAndCatch(t){let r=this.tryParse((o)=>t()||o());if(r.aborted||!r.node)return;if(r.error)this.state=r.failState;return r.node}tsTryParse(t){let r=this.state.clone(),o=t();if(o!==void 0&&o!==!1)return o;this.state=r}tsTryParseDeclare(t){if(this.isLineTerminator())return;let r=this.state.type;return this.tsInAmbientContext(()=>{switch(r){case 64:return t.declare=!0,super.parseFunctionStatement(t,!1,!1);case 76:return t.declare=!0,this.parseClass(t,!0,!1);case 122:return this.tsParseEnumDeclaration(t,{declare:!0});case 108:return this.tsParseAmbientExternalModuleDeclaration(t);case 96:if(this.state.containsEsc)return;case 71:case 70:if(!this.match(71)||!this.isLookaheadContextual("enum"))return t.declare=!0,this.parseVarStatement(t,this.state.value,!0);return this.expect(71),this.tsParseEnumDeclaration(t,{const:!0,declare:!0});case 103:if(this.isUsing())return this.raise(N.InvalidModifierOnUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.parseVarStatement(t,"using",!0);break;case 92:if(this.isAwaitUsing())return this.raise(N.InvalidModifierOnAwaitUsingDeclaration,this.state.startLoc,"declare"),t.declare=!0,this.next(),this.parseVarStatement(t,"await using",!0);break;case 125:{let o=this.tsParseInterfaceDeclaration(t,{declare:!0});if(o)return o}default:if(_e(r))return this.tsParseDeclaration(t,this.state.type,!0,null)}})}tsTryParseExportDeclaration(){return this.tsParseDeclaration(this.startNode(),this.state.type,!0,null)}tsParseDeclaration(t,r,o,i){switch(r){case 120:if(this.tsCheckLineTerminator(o)&&(this.match(76)||_e(this.state.type)))return this.tsParseAbstractDeclaration(t,i);break;case 123:if(this.tsCheckLineTerminator(o))return this.tsParseAmbientExternalModuleDeclaration(t);break;case 124:if(this.tsCheckLineTerminator(o)&&_e(this.state.type))return t.kind="namespace",this.tsParseNamespaceDeclaration(t);break;case 126:if(this.tsCheckLineTerminator(o)&&_e(this.state.type))return this.tsParseTypeAliasDeclaration(t);break}}tsCheckLineTerminator(t){if(t){if(this.hasFollowingLineBreak())return!1;return this.next(),!0}return!this.isLineTerminator()}tsTryParseGenericAsyncArrowFunction(t){if(!this.match(43))return;let r=this.tsTryParseAndCatch(()=>{let o=this.startNodeAt(t);return o.typeParameters=this.tsParseTypeParameters(this.tsParseConstModifier),super.parseFunctionParams(o),o.returnType=this.tsTryParseTypeOrTypePredicateAnnotation(),this.expect(15),o});if(!r)return;return super.parseArrowExpression(r,null,!0)}tsParseTypeArgumentsInExpression(){if(this.reScan_lt()!==43)return;return this.tsParseTypeArguments()}tsParseTypeArguments(){let t=this.startNode();if(t.params=this.tsInType(()=>this.tsInTopLevelContext(()=>(this.expect(43),this.tsParseDelimitedList("TypeParametersOrArguments",this.tsParseType.bind(this))))),t.params.length===0)this.raise(N.EmptyTypeArguments,t);else if(!this.state.inType&&this.curContext()===Ce.brace)this.reScan_lt_gt();return this.expect(44),this.finishNode(t,"TSTypeParameterInstantiation")}tsIsDeclarationStart(){return SA(this.state.type)}isExportDefaultSpecifier(){if(this.tsIsDeclarationStart())return!1;return super.isExportDefaultSpecifier()}parseBindingElement(t,r){let o=r.length?null:this.state.startLoc,i={};this.tsParseModifiers({allowedModifiers:["public","private","protected","override","readonly"]},i);let{accessibility:s,override:a,readonly:c}=i;if(!(t&4)&&(s||c||a))this.raise(N.UnexpectedParameterModifier,o||r[0]);let l=this.state.startLoc,u=this.parseMaybeDefault(l);if(t&2)this.parseFunctionParamType(u);let d=this.parseMaybeDefault(l,u);if(s||c||a){let p=o?this.startNodeAt(o):this.startNodeAtNode(r[0]);if(r.length)p.decorators=r;else this.setLoc(o);if(s)p.accessibility=s;if(c)p.readonly=c;if(a)p.override=a;if(d.type!=="Identifier"&&d.type!=="AssignmentPattern")this.raise(N.UnsupportedParameterPropertyKind,o||r[0]);return p.parameter=d,this.finishNode(p,"TSParameterProperty")}if(r.length)u.decorators=r;return d}isSimpleParameter(t){return t.type==="TSParameterProperty"&&super.isSimpleParameter(t.parameter)||super.isSimpleParameter(t)}tsDisallowOptionalPattern(t){for(let r of t.params)if(r.type!=="Identifier"&&r.optional&&!this.state.isAmbientContext)this.raise(N.PatternIsOptional,r)}setArrowFunctionParameters(t,r,o){super.setArrowFunctionParameters(t,r,o),this.tsDisallowOptionalPattern(t)}parseFunctionBodyAndFinish(t,r,o=!1){if(this.match(10))t.returnType=this.tsParseTypeOrTypePredicateAnnotation(10);let i=r==="FunctionDeclaration"?"TSDeclareFunction":r==="ClassMethod"||r==="ClassPrivateMethod"?"TSDeclareMethod":void 0;if(i&&!this.match(2)&&this.isLineTerminator()){if(i==="TSDeclareMethod"&&t.kind==="constructor"){for(let s of t.params)if(s.type==="TSParameterProperty")this.raise(N.UnexpectedParameterModifier,s);else if(s.type==="AssignmentPattern")this.raise(N.UnexpectedParameterInitializer,s)}else for(let s of t.params)if(s.type==="AssignmentPattern")this.raise(N.UnexpectedParameterInitializer,s);return this.finishNode(t,i)}if(i&&this.state.isAmbientContext){if(this.raise(N.DeclareFunctionHasImplementation,this.state.startLoc),i==="TSDeclareFunction"&&t.declare)return super.parseFunctionBodyAndFinish(t,i,o)}return this.tsDisallowOptionalPattern(t),super.parseFunctionBodyAndFinish(t,r,o)}registerFunctionStatementId(t){if(!t.body&&t.id)this.checkIdentifier(t.id,1024);else super.registerFunctionStatementId(t)}tsCheckForInvalidTypeCasts(t){t.forEach((r)=>{if(r?.type==="TSTypeCastExpression")this.raise(N.UnexpectedTypeAnnotation,r.typeAnnotation)})}toReferencedList(t,r){return this.tsCheckForInvalidTypeCasts(t),t}parseArrayLike(t,r){let o=super.parseArrayLike(t,r);if(o.type==="ArrayExpression")this.tsCheckForInvalidTypeCasts(o.elements);return o}parseSubscript(t,r,o,i){if(!this.hasPrecedingLineBreak()&&this.match(31)){this.state.canStartJSXElement=!1,this.next();let a=this.startNodeAt(r);return a.expression=t,this.finishNode(a,"TSNonNullExpression")}let s=!1;if(this.match(14)&&this.lookaheadCharCode()===60){if(o)return i.stop=!0,t;i.optionalChainMember=s=!0,this.next()}if(this.match(43)||this.match(47)){let a,c=this.tsTryParseAndCatch(()=>{if(!o&&this.atPossibleAsyncArrow(t)){let p=this.tsTryParseGenericAsyncArrowFunction(r);if(p)return i.stop=!0,p}let l=this.tsParseTypeArgumentsInExpression();if(!l)return;if(s&&!this.match(6)){a=this.state.curPosition();return}if(CA(this.state.type)){let p=super.parseTaggedTemplateExpression(t,r,i);return p.typeArguments=l,p}if(!o&&this.eat(6)){let p=this.startNodeAt(r);if(p.callee=t,p.arguments=this.parseCallExpressionArguments(),this.tsCheckForInvalidTypeCasts(p.arguments),p.typeArguments=l,i.optionalChainMember)p.optional=s;return this.finishCallExpression(p,i.optionalChainMember)}let u=this.state.type;if(u===44||u===48||u!==6&&u!==89&&u!==116&&vA(u)&&!this.hasPrecedingLineBreak())return;let d=this.startNodeAt(r);return d.expression=t,d.typeArguments=l,this.finishNode(d,"TSInstantiationExpression")});if(a)this.unexpected(a,6);if(c){if(c.type==="TSInstantiationExpression"){if(this.match(12)||this.match(14)&&this.lookaheadCharCode()!==40)this.raise(N.InvalidPropertyAccessAfterInstantiationExpression,this.state.startLoc);if(!this.match(12)&&!this.match(14))c.expression=super.stopParseSubscript(t,i)}return c}}return super.parseSubscript(t,r,o,i)}parseNewCallee(t){super.parseNewCallee(t);let{callee:r}=t;if(r.type==="TSInstantiationExpression"&&!r.extra?.parenthesized)t.typeArguments=r.typeArguments,t.callee=r.expression}parseExprOp(t,r,o){let i;if(IA(54)>o&&!this.hasPrecedingLineBreak()&&(this.isContextual(89)||(i=this.isContextual(116)))){let s=this.startNodeAt(r);s.expression=t,s.typeAnnotation=this.tsInType(()=>{if(this.next(),this.match(71)){if(i)this.raise(He.UnexpectedKeyword,this.state.startLoc,{keyword:"const"});return this.tsParseTypeReference()}return this.tsParseType()});let a=this.finishNode(s,i?"TSSatisfiesExpression":"TSAsExpression");return this.reScan_lt_gt(),this.parseExprOp(a,r,o)}return super.parseExprOp(t,r,o)}checkReservedWord(t,r,o,i){if(!this.state.isAmbientContext)super.checkReservedWord(t,r,o,i)}checkDuplicateExports(){}isPotentialImportPhase(t){if(super.isPotentialImportPhase(t))return!0;if(this.isContextual(126)){let r=this.lookaheadCharCode();return t?r===123||r===42:r!==61}return!t&&this.isContextual(83)}applyImportPhase(t,r,o,i){if(super.applyImportPhase(t,r,o,i),r)t.exportKind=o==="type"?"type":"value";else t.importKind=o==="type"||o==="typeof"?o:"value"}parseImport(t){if(this.match(130)){if(t.importKind="value",this.scope.inTSNamespace)this.raise(N.ImportInTSNamespace,t);return super.parseImport(t)}let r;if(_e(this.state.type)&&this.lookaheadCharCode()===61){t.importKind="value";let o=this.tsParseImportEqualsDeclaration(t);if(this.scope.inTSNamespace&&o.moduleReference.type==="TSExternalModuleReference")this.raise(N.ImportInTSNamespace,t);return o}else if(this.isContextual(126)){let o=this.parseMaybeImportPhase(t,!1);if(this.lookaheadCharCode()===61){if(this.scope.inTSNamespace)this.raise(N.ImportInTSNamespace,t);return this.tsParseImportEqualsDeclaration(t,o)}else r=super.parseImportSpecifiersAndAfter(t,o)}else r=super.parseImport(t);if(r.importKind==="type"&&r.specifiers.length>1&&r.specifiers[0].type==="ImportDefaultSpecifier")this.raise(N.TypeImportCannotSpecifyDefaultAndNamed,r);else if(this.scope.inTSNamespace)this.raise(N.ImportInTSNamespace,r);return r}parseExport(t,r){if(this.match(79)){let o=this.startNode();this.next();let i=null;if(this.isContextual(126)&&this.isPotentialImportPhase(!1))i=this.parseMaybeImportPhase(o,!1);else o.importKind="value";let s=this.tsParseImportEqualsDeclaration(o,i);return t.attributes=[],t.declaration=s,t.exportKind="value",t.source=null,t.specifiers=[],this.finishNode(t,"ExportNamedDeclaration")}else if(this.eat(25)){let o=t;if(o.expression=super.parseExpression(),this.semicolon(),this.sawUnambiguousESM=!0,this.scope.inTSNamespace)this.raise(N.ExportAssignmentInTSNamespace,o);return this.finishNode(o,"TSExportAssignment")}else if(this.eatContextual(89)){let o=t;if(this.expectContextual(124),o.id=this.parseIdentifier(),this.checkIdentifier(o.id,8201),this.semicolon(),this.scope.inTSNamespace)this.raise(N.NamespaceExportInTSNamespace,o);return this.finishNode(o,"TSNamespaceExportDeclaration")}else{let o=super.parseExport(t,r);if(this.scope.inTSNamespace&&(o.type!=="ExportNamedDeclaration"||o.source||!o.declaration&&!this.state.isAmbientContext))this.raise(N.ExportInTSNamespace,o);return o}}isAbstractClass(){return this.isContextual(120)&&this.isLookaheadContextual("class")}parseExportDefaultExpression(){if(this.isAbstractClass()){let t=this.startNode();return this.next(),t.abstract=!0,this.parseClass(t,!0,!0)}if(this.match(125)){let t=this.tsParseInterfaceDeclaration(this.startNode());if(t)return t}return super.parseExportDefaultExpression()}parseVarStatement(t,r,o=!1){let{isAmbientContext:i}=this.state,s=super.parseVarStatement(t,r,o||i);if(i&&!t.declare&&(r==="using"||r==="await using"))return this.raiseOverwrite(N.UsingDeclarationInAmbientContext,t,r),s;for(let a of s.declarations){let{id:c,init:l,definite:u}=a;if(u){if(l)this.raise(N.DeclaratorDefiniteAssertionWithInitializer,c);else if(!c.typeAnnotation)this.raise(N.DeclaratorDefiniteAssertionRequiresTypeAnnotation,c)}if(i&&l){if(r==="var"||r==="let"||!!c.typeAnnotation)this.raise(N.InitializerNotAllowedInAmbientContext,l);else if(!ZA(l,this.hasPlugin("estree")))this.raise(N.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference,l)}}return s}parseStatementContent(t,r){let o=!!(t&2);if(!this.state.containsEsc)switch(this.state.type){case 71:{if(this.isLookaheadContextual("enum")){let i=this.startNode();return this.next(),this.tsParseEnumDeclaration(i,{const:!0})}break}case 120:case 121:{if(this.nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine()){let i=this.state.type,s=this.startNode();this.next();let a=i===121?this.tsTryParseDeclare(s):this.tsParseAbstractDeclaration(s,r);if(a){if(i===121)a.declare=!0;return a}else return s.expression=this.createIdentifier(this.startNodeAtNode(s),i===121?"declare":"abstract"),this.semicolon(!1),this.finishNode(s,"ExpressionStatement")}break}case 122:return this.tsParseEnumDeclaration(this.startNode());case 108:{if(this.lookaheadCharCode()===123){let s=this.startNode();return this.tsParseAmbientExternalModuleDeclaration(s)}break}case 125:{let i=this.tsParseInterfaceDeclaration(this.startNode());if(i){if(!o)this.raise(N.UnexpectedTypeDeclaration,i,"interface");return i}break}case 123:{if(this.nextTokenIsStringLiteralOnSameLine()){let i=this.startNode();return this.next(),this.tsParseDeclaration(i,123,!1,r)}else if(this.nextTokenIsIdentifierOnSameLine()){this.raise(N.InlineModuleDeclarationMustUseString,this.state.startLoc);let i=this.startNode();return this.next(),this.tsParseDeclaration(i,124,!1,r)}break}case 124:{if(this.nextTokenIsIdentifierOnSameLine()){let i=this.startNode();return this.next(),this.tsParseDeclaration(i,124,!1,r)}break}case 126:{if(this.nextTokenIsIdentifierOnSameLine()){let i=this.startNode();if(!o)this.raise(N.UnexpectedTypeDeclaration,i,"type");return this.next(),this.tsParseTypeAliasDeclaration(i)}break}}return super.parseStatementContent(t,r)}parseAccessModifier(){return this.tsParseModifier(["public","protected","private"])}tsHasSomeModifiers(t,r){return r.some((o)=>{if(mw(o))return t.accessibility===o;return!!t[o]})}tsIsStartOfStaticBlocks(){return this.isContextual(102)&&this.lookaheadCharCode()===123}parseClassMember(t,r,o){let i=["declare","private","public","protected","override","abstract","readonly","static"];this.tsParseModifiers({allowedModifiers:i,disallowedModifiers:["in","out"],stopOnStartOfClassStaticBlock:!0,errorTemplate:N.InvalidModifierOnTypeParameterPositions},r);let s=()=>{if(this.tsIsStartOfStaticBlocks()){if(this.next(),this.next(),this.tsHasSomeModifiers(r,i))this.raise(N.StaticBlockCannotHaveModifier,this.state.curPosition());super.parseClassStaticBlock(t,r)}else this.parseClassMemberWithIsStatic(t,r,o,!!r.static)};if(r.declare)this.tsInAmbientContext(s);else s();if(r.decorators&&r.decorators.length>0&&!this.hasPlugin("decorators-legacy")){if(r.type==="TSAbstractMethodDefinition"||r.type==="TSDeclareMethod")this.raise(N.DecoratorAbstractMethod,r,{kind:"abstract method"});else if(r.type==="ClassProperty"&&r.abstract||r.type==="ClassProperty"&&r.declare||r.type==="TSAbstractPropertyDefinition"||r.type==="PropertyDefinition"&&r.declare)this.raise(N.DecoratorAbstractMethod,r,{kind:r.declare?"declare field":"abstract field"})}}parseClassMemberWithIsStatic(t,r,o,i){let s=this.tsTryParseIndexSignature(r);if(s){if(t.body.push(s),r.abstract)this.raise(N.IndexSignatureHasAbstract,r);if(r.accessibility)this.raise(N.IndexSignatureHasAccessibility,r,{modifier:r.accessibility});if(r.declare)this.raise(N.IndexSignatureHasDeclare,r);if(r.override)this.raise(N.IndexSignatureHasOverride,r);return}if(!this.state.inAbstractClass&&r.abstract)this.raise(N.NonAbstractClassHasAbstractMethod,r);if(r.override){if(!o.hadSuperClass)this.raise(N.OverrideNotInSubClass,r)}super.parseClassMemberWithIsStatic(t,r,o,i)}parsePostMemberNameModifiers(t){if(this.eat(13))t.optional=!0;if(t.readonly&&this.match(6))this.raise(N.ClassMethodHasReadonly,t);if(t.declare&&this.match(6))this.raise(N.ClassMethodHasDeclare,t)}shouldParseExportDeclaration(){if(this.tsIsDeclarationStart())return!0;return super.shouldParseExportDeclaration()}parseConditional(t,r,o){if(!this.match(13))return t;if(o!=null){let a=this.lookaheadCharCode();if(a===44||a===61||a===58||a===41)return this.setOptionalParametersError(o),t}this.next();let i=this.startNodeAt(r);i.test=t;let s=this.state.inConditionalConsequent;return this.state.inConditionalConsequent=!0,i.consequent=this.parseMaybeAssignAllowIn(),this.state.inConditionalConsequent=s,this.expect(10),i.alternate=this.parseMaybeAssign(),this.finishNode(i,"ConditionalExpression")}parseParenItem(t,r){let o=super.parseParenItem(t,r);if(this.eat(13))o.optional=!0,this.resetEndLocation(t);if(this.match(10)){let i=this.startNodeAt(r);return i.expression=t,i.typeAnnotation=this.tsParseTypeAnnotation(),this.finishNode(i,"TSTypeCastExpression")}return t}parseExportDeclaration(t){if(!this.state.isAmbientContext&&this.isContextual(121))return this.tsInAmbientContext(()=>this.parseExportDeclaration(t));let r=this.state.startLoc,o=this.eatContextual(121);if(o&&(this.isContextual(121)||!this.shouldParseExportDeclaration()))throw this.raise(N.ExpectedAmbientAfterExportDeclare,this.state.startLoc);let s=_e(this.state.type)&&this.tsTryParseExportDeclaration()||super.parseExportDeclaration(t);if(!s)return null;if(s.type==="TSInterfaceDeclaration"||s.type==="TSTypeAliasDeclaration"||o)t.exportKind="type";if(o&&s.type!=="TSImportEqualsDeclaration")this.resetStartLocation(s,r),s.declare=!0;return s}parseClassId(t,r,o,i){if((!r||o)&&this.isContextual(109)){t.id=null;return}super.parseClassId(t,r,o,t.declare?1024:8331);let s=this.tsTryParseTypeParameters(this.tsParseInOutConstModifiers);if(s)t.typeParameters=s}parseClassPropertyAnnotation(t){if(!t.optional){if(this.eat(31))t.definite=!0;else if(this.eat(13))t.optional=!0}let r=this.tsTryParseTypeAnnotation();if(r)t.typeAnnotation=r;if(t.definite){if(this.match(25))this.raise(N.DeclaratorDefiniteAssertionWithInitializer,t);else if(!r)this.raise(N.DeclaratorDefiniteAssertionRequiresTypeAnnotation,t)}}parseClassProperty(t){if(this.parseClassPropertyAnnotation(t),this.state.isAmbientContext&&!(t.readonly&&!t.typeAnnotation)&&this.match(25))this.raise(N.DeclareClassFieldHasInitializer,this.state.startLoc);if(t.abstract&&this.match(25)){let{key:r}=t;this.raise(N.AbstractPropertyHasInitializer,this.state.startLoc,{propertyName:r.type==="Identifier"&&!t.computed?r.name:`[${this.input.slice(this.offsetToSourcePos(r.start),this.offsetToSourcePos(r.end))}]`})}return super.parseClassProperty(t)}parseClassPrivateProperty(t){if(t.abstract)this.raise(N.PrivateElementHasAbstract,t);if(t.accessibility)this.raise(N.PrivateElementHasAccessibility,t,{modifier:t.accessibility});return this.parseClassPropertyAnnotation(t),super.parseClassPrivateProperty(t)}parseClassAccessorProperty(t){if(this.parseClassPropertyAnnotation(t),t.optional)this.raise(N.AccessorCannotBeOptional,t);return super.parseClassAccessorProperty(t)}pushClassMethod(t,r,o,i,s,a){let c=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(c&&s)this.raise(N.ConstructorHasTypeParameters,c);let{declare:l=!1,kind:u}=r;if(l&&(u==="get"||u==="set"))this.raise(N.DeclareAccessor,r,{kind:u});if(c)r.typeParameters=c;super.pushClassMethod(t,r,o,i,s,a)}pushClassPrivateMethod(t,r,o,i){let s=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(s)r.typeParameters=s;super.pushClassPrivateMethod(t,r,o,i)}declareClassPrivateMethodInScope(t,r){if(t.type==="TSDeclareMethod")return;if(t.type==="MethodDefinition"&&t.value.body==null)return;super.declareClassPrivateMethodInScope(t,r)}parseClassSuper(t){if(super.parseClassSuper(t),t.superClass){if(t.superClass.type==="TSInstantiationExpression"){let r=t.superClass,o=r.expression;this.takeSurroundingComments(o,o.start,o.end);let i=r.typeArguments;this.takeSurroundingComments(i,i.start,i.end),t.superClass=o,t.superTypeArguments=i}else if(this.match(43)||this.match(47))t.superTypeArguments=this.tsParseTypeArgumentsInExpression()}if(this.eatContextual(109))t.implements=this.tsParseHeritageClause("implements")}parseObjPropValue(t,r,o,i,s,a,c){let l=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(l)t.typeParameters=l;return super.parseObjPropValue(t,r,o,i,s,a,c)}parseFunctionParams(t,r){let o=this.tsTryParseTypeParameters(this.tsParseConstModifier);if(o)t.typeParameters=o;super.parseFunctionParams(t,r)}parseVarId(t,r){if(super.parseVarId(t,r),t.id.type==="Identifier"&&!this.hasPrecedingLineBreak()&&this.eat(31))t.definite=!0;let o=this.tsTryParseTypeAnnotation();if(o)t.id.typeAnnotation=o,this.resetEndLocation(t.id)}parseAsyncArrowFromCallExpression(t,r){if(this.match(10))t.returnType=this.tsParseTypeAnnotation();return super.parseAsyncArrowFromCallExpression(t,r)}parseMaybeAssign(t,r){let o,i,s;if(this.hasPlugin("jsx")&&(this.match(138)||this.match(43))){if(o=this.state.clone(),i=this.tryParse(()=>super.parseMaybeAssign(t,r),o),!i.error)return i.node;let{context:l}=this.state,u=l[l.length-1];if(u===Ce.j_oTag||u===Ce.j_expr)l.pop()}if(!i?.error&&!this.match(43))return super.parseMaybeAssign(t,r);if(!o||o===this.state)o=this.state.clone();let a,c=this.tryParse((l)=>{a=this.tsParseTypeParameters(this.tsParseConstModifier);let u=super.parseMaybeAssign(t,r);if(u.type!=="ArrowFunctionExpression"||u.extra?.parenthesized)l();if(a?.params.length!==0)this.resetStartLocationFromNode(u,a);if(u.typeParameters=a,this.hasPlugin("jsx")&&u.typeParameters.params.length===1&&!u.typeParameters.extra?.trailingComma){let d=u.typeParameters.params[0];if(!d.constraint)this.raise(N.SingleTypeParameterWithoutTrailingComma,this.optionFlags&256?cA(d.loc.end,1):d,{typeParameterName:d.name.name})}return u},o);if(!c.error&&!c.aborted){if(a)this.reportReservedArrowTypeParam(a);return c.node}if(!i){if(hw(!this.hasPlugin("jsx")),s=this.tryParse(()=>super.parseMaybeAssign(t,r),o),!s.error)return s.node}if(i?.node)return this.state=i.failState,i.node;if(c.node){if(this.state=c.failState,a)this.reportReservedArrowTypeParam(a);return c.node}if(s?.node)return this.state=s.failState,s.node;throw i?.error||c.error||s?.error}reportReservedArrowTypeParam(t){if(t.params.length===1&&!t.params[0].constraint&&!t.extra?.trailingComma&&this.getPluginOption("typescript","disallowAmbiguousJSXLike"))this.raise(N.ReservedArrowTypeParam,t)}parseMaybeUnary(t,r){if(!this.hasPlugin("jsx")&&this.match(43))return this.tsParseTypeAssertion();return super.parseMaybeUnary(t,r)}parseArrow(t){if(this.match(10)){let r=this.tryParse((o)=>{let i=this.tsParseTypeOrTypePredicateAnnotation(10);if(this.canInsertSemicolon()||!this.match(15))o();return i});if(r.aborted)return;if(!r.thrown){if(r.error)this.state=r.failState;t.returnType=r.node}}return super.parseArrow(t)}parseFunctionParamType(t){if(this.eat(13))t.optional=!0;let r=this.tsTryParseTypeAnnotation();if(r)t.typeAnnotation=r;return this.resetEndLocation(t),t}isAssignable(t,r){switch(t.type){case"TSTypeCastExpression":return this.isAssignable(t.expression,r);case"TSParameterProperty":return!0;default:return super.isAssignable(t,r)}}toAssignable(t,r=!1){switch(t.type){case"ParenthesizedExpression":this.toAssignableParenthesizedExpression(t,r);break;case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":if(r)this.expressionScope.recordArrowParameterBindingError(N.UnexpectedTypeCastInParameter,t);else this.raise(N.UnexpectedTypeCastInParameter,t);this.toAssignable(t.expression,r);break;case"AssignmentExpression":if(!r&&t.left.type==="TSTypeCastExpression")t.left=this.typeCastToParameter(t.left);default:super.toAssignable(t,r)}}toAssignableParenthesizedExpression(t,r){switch(t.expression.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSNonNullExpression":case"TSTypeAssertion":case"ParenthesizedExpression":this.toAssignable(t.expression,r);break;default:super.toAssignable(t,r)}}checkToRestConversion(t,r){switch(t.type){case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":case"TSNonNullExpression":this.checkToRestConversion(t.expression,!1);break;default:super.checkToRestConversion(t,r)}}isValidLVal(t,r,o,i){switch(t){case"TSTypeCastExpression":return!0;case"TSParameterProperty":return"parameter";case"TSNonNullExpression":return"expression";case"TSAsExpression":case"TSSatisfiesExpression":case"TSTypeAssertion":return(i!==64||!o)&&["expression",!0];default:return super.isValidLVal(t,r,o,i)}}parseBindingAtom(){if(this.state.type===74)return this.parseIdentifier(!0);return super.parseBindingAtom()}parseMaybeDecoratorArguments(t,r){if(this.match(43)||this.match(47)){let o=this.tsParseTypeArgumentsInExpression();if(this.match(6)){let i=super.parseMaybeDecoratorArguments(t,r);return i.typeArguments=o,i}this.unexpected(null,6)}return super.parseMaybeDecoratorArguments(t,r)}checkCommaAfterRest(t){if(this.state.isAmbientContext&&this.match(8)&&this.lookaheadCharCode()===t)return this.next(),!1;return super.checkCommaAfterRest(t)}isClassMethod(){return this.match(43)||super.isClassMethod()}isClassProperty(){return this.match(31)||this.match(10)||super.isClassProperty()}parseMaybeDefault(t,r){let o=super.parseMaybeDefault(t,r);if(o.type==="AssignmentPattern"&&o.typeAnnotation&&o.right.start<o.typeAnnotation.start)this.raise(N.TypeAnnotationAfterAssign,o.typeAnnotation);return o}getTokenFromCode(t){if(this.state.inType){if(t===62){this.finishOp(44,1);return}if(t===60){this.finishOp(43,1);return}}super.getTokenFromCode(t)}reScan_lt_gt(){let{type:t}=this.state;if(t===43)this.state.pos-=1,this.readToken_lt();else if(t===44)this.state.pos-=1,this.readToken_gt()}reScan_lt(){let{type:t}=this.state;if(t===47)return this.state.pos-=2,this.finishOp(43,1),43;return t}toAssignableListItem(t,r,o){let i=t[r];if(i.type==="TSTypeCastExpression")t[r]=this.typeCastToParameter(i);super.toAssignableListItem(t,r,o)}typeCastToParameter(t){return t.expression.typeAnnotation=t.typeAnnotation,this.resetEndLocationFromNode(t.expression,t.typeAnnotation),t.expression}shouldParseArrow(t){if(this.match(10))return t.every((r)=>this.isAssignable(r,!0));return super.shouldParseArrow(t)}shouldParseAsyncArrow(){if(this.match(10)){if(this.state.inConditionalConsequent)return!1;return!0}return super.shouldParseAsyncArrow()}parseParenAndDistinguishExpression(t){let r=this.state.inConditionalConsequent;this.state.inConditionalConsequent=!1;let o=super.parseParenAndDistinguishExpression(t);return this.state.inConditionalConsequent=r,o}canHaveLeadingDecorator(){return super.canHaveLeadingDecorator()||this.isAbstractClass()}jsxParseOpeningElementAfterName(t){if(this.match(43)||this.match(47)){let r=this.tsTryParseAndCatch(()=>this.tsParseTypeArgumentsInExpression());if(r)t.typeArguments=r}return super.jsxParseOpeningElementAfterName(t)}getGetterSetterExpectedParamCount(t){let r=super.getGetterSetterExpectedParamCount(t),i=this.getObjectOrClassMethodParams(t)[0];return i&&this.isThisParam(i)?r+1:r}parseCatchClauseParam(){let t=super.parseCatchClauseParam(),r=this.tsTryParseTypeAnnotation();if(r)t.typeAnnotation=r,this.resetEndLocation(t);return t}tsInAmbientContext(t){let{isAmbientContext:r,strict:o}=this.state;this.state.isAmbientContext=!0,this.state.strict=!1;try{return t()}finally{this.state.isAmbientContext=r,this.state.strict=o}}parseClass(t,r,o){let i=this.state.inAbstractClass;this.state.inAbstractClass=!!t.abstract;try{return super.parseClass(t,r,o)}finally{this.state.inAbstractClass=i}}tsParseAbstractDeclaration(t,r){if(this.match(76))return t.abstract=!0,this.maybeTakeDecorators(r,this.parseClass(t,!0,!1));else if(this.isContextual(125))if(!this.hasFollowingLineBreak())return t.abstract=!0,this.raise(N.NonClassMethodPropertyHasAbstractModifier,t),this.tsParseInterfaceDeclaration(t);else return null;throw this.unexpected(null,76)}parseMethod(t,r,o,i,s,a,c){let l=super.parseMethod(t,r,o,i,s,a,c);if(l.abstract||l.type==="TSAbstractMethodDefinition"){if((this.hasPlugin("estree")?l.value:l).body){let{key:p}=l;this.raise(N.AbstractMethodHasImplementation,l,{methodName:p.type==="Identifier"&&!l.computed?p.name:`[${this.input.slice(this.offsetToSourcePos(p.start),this.offsetToSourcePos(p.end))}]`})}}return l}tsParseTypeParameterName(){return this.parseIdentifier()}shouldParseAsAmbientContext(){return!!this.getPluginOption("typescript","dts")}parse(){if(this.shouldParseAsAmbientContext())this.state.isAmbientContext=!0;return super.parse()}getExpression(){if(this.shouldParseAsAmbientContext())this.state.isAmbientContext=!0;return super.getExpression()}parseExportSpecifier(t,r,o,i){if(!r&&i)return this.parseTypeOnlyImportExportSpecifier(t,!1,o),this.finishNode(t,"ExportSpecifier");return t.exportKind="value",super.parseExportSpecifier(t,r,o,i)}parseImportSpecifier(t,r,o,i,s){if(!r&&i)return this.parseTypeOnlyImportExportSpecifier(t,!0,o),this.finishNode(t,"ImportSpecifier");return t.importKind="value",super.parseImportSpecifier(t,r,o,i,o?4098:4096)}parseTypeOnlyImportExportSpecifier(t,r,o){let i=r?"imported":"local",s=r?"local":"exported",a=t[i],c,l=!1,u=!0,d=a.start;if(this.isContextual(89)){let m=this.parseIdentifier();if(this.isContextual(89)){let y=this.parseIdentifier();if(Sn(this.state.type))l=!0,a=m,c=r?this.parseIdentifier():this.parseModuleExportName(),u=!1;else c=y,u=!1}else if(Sn(this.state.type))u=!1,c=r?this.parseIdentifier():this.parseModuleExportName();else l=!0,a=m}else if(Sn(this.state.type))if(l=!0,r){if(a=this.parseIdentifier(!0),!this.isContextual(89))this.checkReservedWord(a.name,a.start,!0,!0)}else a=this.parseModuleExportName();if(l&&o)this.raise(r?N.TypeModifierIsUsedInTypeImports:N.TypeModifierIsUsedInTypeExports,d);t[i]=a,t[s]=c;let p=r?"importKind":"exportKind";if(t[p]=l?"type":"value",u&&this.eatContextual(89))t[s]=r?this.parseIdentifier():this.parseModuleExportName();if(!t[s])t[s]=this.cloneIdentifier(t[i]);if(r)this.checkIdentifier(t[s],l?4098:4096)}fillOptionalPropertiesForTSESLint(t){switch(t.type){case"ExpressionStatement":t.directive??=void 0;return;case"RestElement":t.value=void 0;case"Identifier":case"ArrayPattern":case"AssignmentPattern":case"ObjectPattern":t.decorators??=[],t.optional??=!1,t.typeAnnotation??=void 0;return;case"TSParameterProperty":t.accessibility??=void 0,t.decorators??=[],t.override??=!1,t.readonly??=!1,t.static??=!1;return;case"TSEmptyBodyFunctionExpression":t.body=null;case"TSDeclareFunction":case"FunctionDeclaration":case"FunctionExpression":case"ClassMethod":case"ClassPrivateMethod":t.declare??=!1,t.returnType??=void 0,t.typeParameters??=void 0;return;case"Property":t.optional??=!1;return;case"TSMethodSignature":case"TSPropertySignature":t.optional??=!1;case"TSIndexSignature":t.accessibility??=void 0,t.readonly??=!1,t.static??=!1;return;case"TSAbstractPropertyDefinition":case"PropertyDefinition":case"TSAbstractAccessorProperty":case"AccessorProperty":t.declare??=!1,t.definite??=!1,t.readonly??=!1,t.typeAnnotation??=void 0;case"TSAbstractMethodDefinition":case"MethodDefinition":t.accessibility??=void 0,t.decorators??=[],t.override??=!1,t.optional??=!1;return;case"ClassExpression":t.id??=null;case"ClassDeclaration":t.abstract??=!1,t.declare??=!1,t.decorators??=[],t.implements??=[],t.superTypeArguments??=void 0,t.typeParameters??=void 0;return;case"TSTypeAliasDeclaration":case"VariableDeclaration":t.declare??=!1;return;case"VariableDeclarator":t.definite??=!1;return;case"TSEnumDeclaration":t.const??=!1,t.declare??=!1;return;case"TSEnumMember":t.computed??=!1;return;case"TSImportType":t.qualifier??=null,t.options??=null,t.typeArguments??=null;return;case"TSInterfaceDeclaration":t.declare??=!1,t.extends??=[];return;case"TSMappedType":t.optional??=!1,t.readonly??=void 0;return;case"TSModuleDeclaration":t.declare??=!1,t.global??=t.kind==="global";return;case"TSTypeParameter":t.const??=!1,t.in??=!1,t.out??=!1;return}}chStartsBindingIdentifierAndNotRelationalOperator(t,r){if(Pd(t)){if(yd.lastIndex=r,yd.test(this.input)){let o=this.codePointAtPos(yd.lastIndex);if(!kw(o)&&o!==92)return!1}return!0}else if(t===92)return!0;else return!1}nextTokenIsIdentifierAndNotTSRelationalOperatorOnSameLine(){let t=this.nextTokenInLineStart(),r=this.codePointAtPos(t);return this.chStartsBindingIdentifierAndNotRelationalOperator(r,t)}nextTokenIsStringLiteralOnSameLine(){let t=this.nextTokenInLineStart(),r=this.codePointAtPos(t);return r===34||r===39}},WA,yw,HA=(e)=>class extends e{parsePlaceholder(t){if(this.match(129)){let r=this.startNode();return this.next(),this.assertNoSpace(),r.name=super.parseIdentifier(!0),this.assertNoSpace(),this.expect(129),this.finishPlaceholder(r,t)}}finishPlaceholder(t,r){let o=t;if(!o.expectedNode||!o.type)o=this.finishNode(o,"Placeholder");return o.expectedNode=r,o}getTokenFromCode(t){if(t===37&&this.input.charCodeAt(this.state.pos+1)===37)this.finishOp(129,2);else super.getTokenFromCode(t)}parseExprAtom(t){return this.parsePlaceholder("Expression")||super.parseExprAtom(t)}parseIdentifier(t){return this.parsePlaceholder("Identifier")||super.parseIdentifier(t)}checkReservedWord(t,r,o,i){if(t!==void 0)super.checkReservedWord(t,r,o,i)}cloneIdentifier(t){let r=super.cloneIdentifier(t);if(r.type==="Placeholder")r.expectedNode=t.expectedNode;return r}cloneStringLiteral(t){if(t.type==="Placeholder")return this.cloneIdentifier(t);return super.cloneStringLiteral(t)}parseBindingAtom(){return this.parsePlaceholder("Pattern")||super.parseBindingAtom()}isValidLVal(t,r,o,i){return t==="Placeholder"||super.isValidLVal(t,r,o,i)}toAssignable(t,r){if(t&&t.type==="Placeholder"&&t.expectedNode==="Expression")t.expectedNode="Pattern";else super.toAssignable(t,r)}chStartsBindingIdentifier(t,r){if(super.chStartsBindingIdentifier(t,r))return!0;let o=this.nextTokenStart();if(this.input.charCodeAt(o)===37&&this.input.charCodeAt(o+1)===37)return!0;return!1}verifyBreakContinue(t,r){if(t.label?.type==="Placeholder")return;super.verifyBreakContinue(t,r)}parseExpressionStatement(t,r){if(r.type!=="Placeholder"||r.extra?.parenthesized)return super.parseExpressionStatement(t,r);if(this.match(10)){let i=t;return i.label=this.finishPlaceholder(r,"Identifier"),this.next(),i.body=super.parseStatementOrSloppyAnnexBFunctionDeclaration(),this.finishNode(i,"LabeledStatement")}this.semicolon();let o=t;return o.name=r.name,this.finishPlaceholder(o,"Statement")}parseBlock(t,r,o){return this.parsePlaceholder("BlockStatement")||super.parseBlock(t,r,o)}parseFunctionId(t){return this.parsePlaceholder("Identifier")||super.parseFunctionId(t)}parseClass(t,r,o){let i=r?"ClassDeclaration":"ClassExpression";this.next();let s=this.state.strict,a=this.parsePlaceholder("Identifier");if(a)if(this.match(77)||this.match(129)||this.match(2))t.id=a;else if(o||!r)return t.id=null,t.body=this.finishPlaceholder(a,"ClassBody"),this.finishNode(t,i);else throw this.raise(yw.ClassNameIsRequired,this.state.startLoc);else this.parseClassId(t,r,o);return super.parseClassSuper(t),t.body=this.parsePlaceholder("ClassBody")||super.parseClassBody(!!t.superClass,s),this.finishNode(t,i)}parseExport(t,r){let o=this.parsePlaceholder("Identifier");if(!o)return super.parseExport(t,r);let i=t;if(!this.isContextual(94)&&!this.match(8))return i.specifiers=[],i.source=null,i.declaration=this.finishPlaceholder(o,"Declaration"),this.finishNode(i,"ExportNamedDeclaration");this.expectPlugin("exportDefaultFrom");let s=this.startNode();return s.exported=o,i.specifiers=[this.finishNode(s,"ExportDefaultSpecifier")],super.parseExport(i,r)}isExportDefaultSpecifier(){if(this.match(61)){let t=this.nextTokenStart();if(this.isUnparsedContextual(t,"from")){if(this.input.startsWith(Cd(129),this.nextTokenStartSince(t+4)))return!0}}return super.isExportDefaultSpecifier()}maybeParseExportDefaultSpecifier(t,r){if(t.specifiers?.length)return!0;return super.maybeParseExportDefaultSpecifier(t,r)}checkExport(t){let{specifiers:r}=t;if(r?.length)t.specifiers=r.filter((o)=>o.exported.type==="Placeholder");super.checkExport(t),t.specifiers=r}parseImport(t){let r=this.parsePlaceholder("Identifier");if(!r)return super.parseImport(t);if(t.specifiers=[],!this.isContextual(94)&&!this.match(8))return t.source=this.finishPlaceholder(r,"StringLiteral"),this.semicolon(),this.finishNode(t,"ImportDeclaration");let o=this.startNodeAtNode(r);if(o.local=r,t.specifiers.push(this.finishNode(o,"ImportDefaultSpecifier")),this.eat(8)){if(!this.maybeParseStarImportSpecifier(t))this.parseNamedImportSpecifiers(t)}return this.expectContextual(94),t.source=this.parseImportSource(),this.semicolon(),this.finishNode(t,"ImportDeclaration")}parseImportSource(){return this.parsePlaceholder("StringLiteral")||super.parseImportSource()}assertNoSpace(){if(this.state.start>this.offsetToSourcePos(this.state.lastTokEndLoc.index))this.raise(yw.UnexpectedSpace,this.state.lastTokEndLoc)}},GA=(e)=>class extends e{parseV8Intrinsic(){if(this.match(50)){let t=this.state.startLoc,r=this.startNode();if(this.next(),_e(this.state.type)){let o=this.parseIdentifierName(),i=this.createIdentifier(r,o);if(this.castNodeTo(i,"V8IntrinsicIdentifier"),this.match(6))return i}this.unexpected(t)}}parseExprAtom(t){return this.parseV8Intrinsic()||super.parseExprAtom(t)}},QA,dM,pM;var Ow=wv(()=>{lA={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:sw},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:sw}},aw={ArrayPattern:"array destructuring pattern",AssignmentExpression:"assignment expression",AssignmentPattern:"assignment expression",ArrowFunctionExpression:"arrow function expression",ConditionalExpression:"conditional expression",CatchClause:"catch clause",ForOfStatement:"for-of statement",ForInStatement:"for-in statement",ForStatement:"for-loop",FormalParameters:"function parameter list",Identifier:"identifier",ImportSpecifier:"import specifier",ImportDefaultSpecifier:"import default specifier",ImportNamespaceSpecifier:"import namespace specifier",ObjectPattern:"object destructuring pattern",ParenthesizedExpression:"parenthesized expression",RestElement:"rest element",UpdateExpression:{true:"prefix operation",false:"postfix operation"},VariableDeclarator:"variable declaration",YieldExpression:"yield expression"},uA={AccessorIsGenerator:({kind:e})=>`A ${e}ter cannot be a generator.`,ArgumentsInClass:"'arguments' is only allowed in functions and class methods.",AsyncFunctionInSingleStatementContext:"Async functions can only be declared at the top level or inside a block.",AwaitBindingIdentifier:"Can not use 'await' as identifier inside an async function.",AwaitBindingIdentifierInStaticBlock:"Can not use 'await' as identifier inside a static block.",AwaitExpressionFormalParameter:"'await' is not allowed in async function parameters.",AwaitUsingNotInAsyncContext:"'await using' is only allowed within async functions and at the top levels of modules.",AwaitNotInAsyncContext:"'await' is only allowed within async functions and at the top levels of modules.",BadGetterArity:"A 'get' accessor must not have any formal parameters.",BadSetterArity:"A 'set' accessor must have exactly one formal parameter.",BadSetterRestParameter:"A 'set' accessor function argument must not be a rest parameter.",ConstructorClassField:"Classes may not have a field named 'constructor'.",ConstructorClassPrivateField:"Classes may not have a private field named '#constructor'.",ConstructorIsAccessor:"Class constructor may not be an accessor.",ConstructorIsAsync:"Constructor can't be an async function.",ConstructorIsGenerator:"Constructor can't be a generator.",DeclarationMissingInitializer:({kind:e})=>`Missing initializer in ${e} declaration.`,DecoratorArgumentsOutsideParentheses:"Decorator arguments must be moved inside parentheses: use '@(decorator(args))' instead of '@(decorator)(args)'.",DecoratorsBeforeAfterExport:"Decorators can be placed *either* before or after the 'export' keyword, but not in both locations at the same time.",DecoratorConstructor:"Decorators can't be used with a constructor. Did you mean '@dec class { ... }'?",DecoratorSemicolon:"Decorators must not be followed by a semicolon.",DecoratorStaticBlock:"Decorators can't be used with a static block.",DeferImportRequiresNamespace:'Only `import defer * as x from "./module"` is valid.',DeletePrivateField:"Deleting a private field is not allowed.",DestructureNamedImport:"ES2015 named imports do not destructure. Use another statement for destructuring after the import.",DuplicateConstructor:"Duplicate constructor in the same class.",DuplicateDefaultExport:"Only one default export allowed per module.",DuplicateExport:({exportName:e})=>`\`${e}\` has already been exported. Exported identifiers must be unique.`,DuplicateProto:"Redefinition of __proto__ property.",DuplicateRegExpFlags:"Duplicate regular expression flag.",ElementAfterRest:"Rest element must be last element.",EscapedCharNotAnIdentifier:"Invalid Unicode escape.",ExportBindingIsString:({localName:e,exportName:n})=>`A string literal cannot be used as an exported binding without \`from\`.
5
+ - Did you mean \`export { '${e}' as '${n}' } from 'some-module'\`?`,ExportDefaultFromAsIdentifier:"'from' is not allowed as an identifier after 'export default'.",ForInOfLoopInitializer:({type:e})=>`'${e==="ForInStatement"?"for-in":"for-of"}' loop variable declaration may not have an initializer.`,ForInUsing:"For-in loop may not start with 'using' declaration.",ForOfAsync:"The left-hand side of a for-of loop may not be 'async'.",ForOfLet:"The left-hand side of a for-of loop may not start with 'let'.",GeneratorInSingleStatementContext:"Generators can only be declared at the top level or inside a block.",IllegalBreakContinue:({type:e})=>`Unsyntactic ${e==="BreakStatement"?"break":"continue"}.`,IllegalLanguageModeDirective:"Illegal 'use strict' directive in function with non-simple parameter list.",IllegalReturn:"'return' outside of function.",ImportBindingIsString:({importName:e})=>`A string literal cannot be used as an imported binding.
6
+ - Did you mean \`import { "${e}" as foo }\`?`,ImportCallArity:({phase:e})=>`\`import${e?`.${e}`:""}()\` requires exactly one or two arguments.`,ImportCallNotNewExpression:({phase:e})=>`Cannot use new with import${e?`.${e}`:""}().`,ImportCallSpreadArgument:({phase:e})=>`\`...\` is not allowed in \`import${e?`.${e}`:""}()\`.`,IncompatibleRegExpUVFlags:"The 'u' and 'v' regular expression flags cannot be enabled at the same time.",InvalidBigIntLiteral:"Invalid BigIntLiteral.",InvalidCodePoint:"Code point out of bounds.",InvalidCoverDiscardElement:"'void' must be followed by an expression when not used in a binding position.",InvalidCoverInitializedName:"Invalid shorthand property initializer.",InvalidDigit:({radix:e})=>`Expected number in radix ${e}.`,InvalidEscapeSequence:"Bad character escape sequence.",InvalidEscapeSequenceTemplate:"Invalid escape sequence in template.",InvalidEscapedReservedWord:({reservedWord:e})=>`Escape sequence in keyword ${e}.`,InvalidIdentifier:({identifierName:e})=>`Invalid identifier ${e}.`,InvalidLhs:({ancestor:e})=>`Invalid left-hand side in ${$s(e)}.`,InvalidLhsBinding:({ancestor:e})=>`Binding invalid left-hand side in ${$s(e)}.`,InvalidLhsOptionalChaining:({ancestor:e})=>`Invalid optional chaining in the left-hand side of ${$s(e)}.`,InvalidNumber:"Invalid number.",InvalidOrMissingExponent:"Floating-point numbers require a valid exponent after the 'e'.",InvalidOrUnexpectedToken:({unexpected:e})=>`Unexpected character '${e}'.`,InvalidParenthesizedAssignment:"Invalid parenthesized assignment pattern.",InvalidPrivateFieldResolution:({identifierName:e})=>`Private name #${e} is not defined.`,InvalidPropertyBindingPattern:"Binding member expression.",InvalidRestAssignmentPattern:"Invalid rest operator's argument.",LabelRedeclaration:({labelName:e})=>`Label '${e}' is already declared.`,LetInLexicalBinding:"'let' is disallowed as a lexically bound name.",LineTerminatorBeforeArrow:"No line break is allowed before '=>'.",MalformedRegExpFlags:"Invalid regular expression flag.",MissingClassName:"A class name is required.",MissingEqInAssignment:"Only '=' operator can be used for specifying default value.",MissingSemicolon:"Missing semicolon.",MissingPlugin:({missingPlugin:e})=>`This experimental syntax requires enabling the parser plugin: ${e.map((n)=>JSON.stringify(n)).join(", ")}.`,MissingOneOfPlugins:({missingPlugin:e})=>`This experimental syntax requires enabling one of the following parser plugin(s): ${e.map((n)=>JSON.stringify(n)).join(", ")}.`,MissingUnicodeEscape:"Expecting Unicode escape sequence \\uXXXX.",MixingCoalesceWithLogical:"Nullish coalescing operator(??) requires parens when mixing with logical operators.",ModuleAttributeInvalidValue:"Only string literals are allowed as module attribute values.",ModuleAttributesWithDuplicateKeys:({key:e})=>`Duplicate key "${e}" is not allowed in module attributes.`,ModuleExportNameHasLoneSurrogate:({surrogateCharCode:e})=>`An export name cannot include a lone surrogate, found '\\u${e.toString(16)}'.`,ModuleExportUndefined:({localName:e})=>`Export '${e}' is not defined.`,MultipleDefaultsInSwitch:"Multiple default clauses.",NewlineAfterThrow:"Illegal newline after throw.",NoCatchOrFinally:"Missing catch or finally clause.",NumberIdentifier:"Identifier directly after number.",NumericSeparatorInEscapeSequence:"Numeric separators are not allowed inside unicode escape sequences or hex escape sequences.",ObsoleteAwaitStar:"'await*' has been removed from the async functions proposal. Use Promise.all() instead.",OptionalChainingNoNew:"Constructors in/after an Optional Chain are not allowed.",OptionalChainingNoTemplate:"Tagged Template Literals are not allowed in optionalChain.",OverrideOnConstructor:"'override' modifier cannot appear on a constructor declaration.",ParamDupe:"Argument name clash.",PatternHasAccessor:"Object pattern can't contain getter or setter.",PatternHasMethod:"Object pattern can't contain methods.",PrivateInExpectedIn:({identifierName:e})=>`Private names are only allowed in property accesses (\`obj.#${e}\`) or in \`in\` expressions (\`#${e} in obj\`).`,PrivateNameRedeclaration:({identifierName:e})=>`Duplicate private name #${e}.`,RestTrailingComma:"Unexpected trailing comma after rest element.",SloppyFunction:"In non-strict mode code, functions can only be declared at top level or inside a block.",SloppyFunctionAnnexB:"In non-strict mode code, functions can only be declared at top level, inside a block, or as the body of an if statement.",SourcePhaseImportRequiresDefault:'Only `import source x from "./module"` is valid.',StaticPrototype:"Classes may not have static property named prototype.",SuperCallNotNewExpression:"Cannot use new with super(...).",SuperNotAllowed:"`super()` is only valid inside a class constructor of a subclass. Maybe a typo in the method name ('constructor') or not extending another class?",SuperPrivateField:"Private fields can't be accessed on super.",TrailingDecorator:"Decorators must be attached to a class element.",UnexpectedArgumentPlaceholder:"Unexpected argument placeholder.",UnexpectedDigitAfterHash:"Unexpected digit after hash token.",UnexpectedImportExport:"'import' and 'export' may only appear at the top level.",UnexpectedKeyword:({keyword:e})=>`Unexpected keyword '${e}'.`,UnexpectedLeadingDecorator:"Leading decorators must be attached to a class declaration.",UnexpectedLexicalDeclaration:"Lexical declaration cannot appear in a single-statement context.",UnexpectedNewTarget:"`new.target` can only be used in functions or class properties.",UnexpectedNumericSeparator:"A numeric separator is only allowed between two digits.",UnexpectedPrivateField:"Unexpected private name.",UnexpectedReservedWord:({reservedWord:e})=>`Unexpected reserved word '${e}'.`,UnexpectedSuper:"'super' is only allowed in object methods and classes.",UnexpectedToken:({expected:e,unexpected:n})=>`Unexpected token${n?` '${n}'.`:""}${e?`, expected "${e}"`:""}`,UnexpectedTokenUnaryExponentiation:"Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",UnexpectedUsingDeclaration:"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",UnexpectedVoidPattern:"Unexpected void binding.",UnsupportedDecoratorExport:"A decorated export must export a class declaration.",UnsupportedDefaultExport:"Only expressions, functions or classes are allowed as the `default` export.",UnsupportedImport:"`import` can only be used in `import()` or `import.meta`.",UnsupportedMetaProperty:({target:e,onlyValidPropertyName:n})=>`The only valid meta property for ${e} is ${e}.${n}.`,UnsupportedParameterDecorator:"Decorators cannot be used to decorate parameters.",UnsupportedPropertyDecorator:"Decorators cannot be used to decorate object literal properties.",UnsupportedSuper:"'super' can only be used with function calls (i.e. super()) or in property accesses (i.e. super.prop or super[prop]).",UnterminatedComment:"Unterminated comment.",UnterminatedRegExp:"Unterminated regular expression.",UnterminatedString:"Unterminated string constant.",UnterminatedTemplate:"Unterminated template.",UsingDeclarationExport:"Using declaration cannot be exported.",UsingDeclarationHasBindingPattern:"Using declaration cannot have destructuring patterns.",VarRedeclaration:({identifierName:e})=>`Identifier '${e}' has already been declared.`,VoidPatternCatchClauseParam:"A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",VoidPatternInitializer:"A void binding may not have an initializer.",YieldBindingIdentifier:"Can not use 'yield' as identifier inside a generator.",YieldInParameter:"Yield expression is not allowed in formal parameters.",YieldNotInGeneratorFunction:"'yield' is only allowed within generator functions.",ZeroDigitNumericSeparator:"Numeric separator can not be used after leading 0."},dA={StrictDelete:"Deleting local variable in strict mode.",StrictEvalArguments:({referenceName:e})=>`Assigning to '${e}' in strict mode.`,StrictEvalArgumentsBinding:({bindingName:e})=>`Binding '${e}' in strict mode.`,StrictFunction:"In strict mode code, functions can only be declared at top level or inside a block.",StrictNumericEscape:"The only valid numeric escape in strict mode is '\\0'.",StrictOctalLiteral:"Legacy octal literals are not allowed in strict mode.",StrictWith:"'with' in strict mode."},pA={ParseExpressionEmptyInput:"Unexpected parseExpression() input: The input is empty or contains only comments.",ParseExpressionExpectsEOF:({unexpected:e})=>`Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(e)}\`.`},fA={PipeTopicRequiresHackPipes:'Topic references are only supported when using the `"proposal": "hack"` version of the pipeline proposal.',PipeTopicUnbound:"Topic reference is unbound; it must be inside a pipe body.",PipeTopicUnconfiguredToken:({token:e})=>`Invalid topic token ${e}. In order to use ${e} as a topic reference, the pipelineOperator plugin must be configured with { "proposal": "hack", "topicToken": "${e}" }.`,PipeTopicUnused:"Hack-style pipe body does not contain a topic reference; Hack-style pipes must use topic at least once.",PipeUnparenthesizedBody:({type:e})=>`Hack-style pipe body cannot be an unparenthesized ${$s({type:e})}; please wrap it in parentheses.`,PipelineUnparenthesized:"Cannot mix binary operator with solo-await F#-style pipeline. Please wrap the pipeline in parentheses."},hA={UnsupportedBind:"Binding should be performed on object property.",UnsupportedBindRHS:"The right-hand side of binding can not be super or import."};He={...kt(lA),...kt(uA),...kt(dA),...kt(pA),...kt`pipelineOperator`(fA),...kt`functionBind`(hA)};bw=new Map;wd=[],vd=[],kd=[],Sd=[],Id=[],xw=[];bA={bracketL:B("[",{beforeExpr:ie,startsExpr:_}),bracketR:B("]"),braceL:B("{",{beforeExpr:ie,startsExpr:_}),braceBarL:B("{|",{beforeExpr:ie,startsExpr:_}),braceR:B("}"),braceBarR:B("|}"),parenL:B("(",{beforeExpr:ie,startsExpr:_}),parenR:B(")"),comma:B(",",{beforeExpr:ie}),semi:B(";",{beforeExpr:ie}),colon:B(":",{beforeExpr:ie}),doubleColon:B("::",{beforeExpr:ie}),dot:B("."),question:B("?",{beforeExpr:ie}),questionDot:B("?."),arrow:B("=>",{beforeExpr:ie}),template:B("template"),ellipsis:B("...",{beforeExpr:ie}),backQuote:B("`",{startsExpr:_}),dollarBraceL:B("${",{beforeExpr:ie,startsExpr:_}),templateTail:B("...`",{startsExpr:_}),templateNonTail:B("...${",{beforeExpr:ie,startsExpr:_}),at:B("@"),hash:B("#",{startsExpr:_}),interpreterDirective:B("#!..."),eq:B("=",{beforeExpr:ie,isAssign:No}),assign:B("_=",{beforeExpr:ie,isAssign:No}),slashAssign:B("_=",{beforeExpr:ie,isAssign:No}),xorAssign:B("_=",{beforeExpr:ie,isAssign:No}),moduloAssign:B("_=",{beforeExpr:ie,isAssign:No}),incDec:B("++/--",{prefix:rn,postfix:gA,startsExpr:_}),bang:B("!",{beforeExpr:ie,prefix:rn,startsExpr:_}),tilde:B("~",{beforeExpr:ie,prefix:rn,startsExpr:_}),doubleCaret:B("^^",{startsExpr:_}),doubleAt:B("@@",{startsExpr:_}),pipeline:We("|>",0),nullishCoalescing:We("??",1),logicalOR:We("||",1),logicalAND:We("&&",2),bitwiseOR:We("|",3),bitwiseXOR:We("^",4),bitwiseAND:We("&",5),equality:We("==/!=/===/!==",6),lt:We("</>/<=/>=",7),gt:We("</>/<=/>=",7),relational:We("</>/<=/>=",7),bitShift:We("<</>>/>>>",8),bitShiftL:We("<</>>/>>>",8),bitShiftR:We("<</>>/>>>",8),plusMin:B("+/-",{beforeExpr:ie,binop:9,prefix:rn,startsExpr:_}),modulo:B("%",{binop:10,startsExpr:_}),star:B("*",{binop:10}),slash:We("/",10),exponent:B("**",{beforeExpr:ie,binop:11,rightAssociative:!0}),_in:se("in",{beforeExpr:ie,binop:7}),_instanceof:se("instanceof",{beforeExpr:ie,binop:7}),_break:se("break"),_case:se("case",{beforeExpr:ie}),_catch:se("catch"),_continue:se("continue"),_debugger:se("debugger"),_default:se("default",{beforeExpr:ie}),_else:se("else",{beforeExpr:ie}),_finally:se("finally"),_function:se("function",{startsExpr:_}),_if:se("if"),_return:se("return",{beforeExpr:ie}),_switch:se("switch"),_throw:se("throw",{beforeExpr:ie,prefix:rn,startsExpr:_}),_try:se("try"),_var:se("var"),_const:se("const"),_with:se("with"),_new:se("new",{beforeExpr:ie,startsExpr:_}),_this:se("this",{startsExpr:_}),_super:se("super",{startsExpr:_}),_class:se("class",{startsExpr:_}),_extends:se("extends",{beforeExpr:ie}),_export:se("export"),_import:se("import",{startsExpr:_}),_null:se("null",{startsExpr:_}),_true:se("true",{startsExpr:_}),_false:se("false",{startsExpr:_}),_typeof:se("typeof",{beforeExpr:ie,prefix:rn,startsExpr:_}),_void:se("void",{beforeExpr:ie,prefix:rn,startsExpr:_}),_delete:se("delete",{beforeExpr:ie,prefix:rn,startsExpr:_}),_do:se("do",{isLoop:md,beforeExpr:ie}),_for:se("for",{isLoop:md}),_while:se("while",{isLoop:md}),_as:ne("as",{startsExpr:_}),_assert:ne("assert",{startsExpr:_}),_async:ne("async",{startsExpr:_}),_await:ne("await",{startsExpr:_}),_defer:ne("defer",{startsExpr:_}),_from:ne("from",{startsExpr:_}),_get:ne("get",{startsExpr:_}),_let:ne("let",{startsExpr:_}),_meta:ne("meta",{startsExpr:_}),_of:ne("of",{startsExpr:_}),_sent:ne("sent",{startsExpr:_}),_set:ne("set",{startsExpr:_}),_source:ne("source",{startsExpr:_}),_static:ne("static",{startsExpr:_}),_using:ne("using",{startsExpr:_}),_yield:ne("yield",{startsExpr:_}),_asserts:ne("asserts",{startsExpr:_}),_checks:ne("checks",{startsExpr:_}),_exports:ne("exports",{startsExpr:_}),_global:ne("global",{startsExpr:_}),_implements:ne("implements",{startsExpr:_}),_intrinsic:ne("intrinsic",{startsExpr:_}),_infer:ne("infer",{startsExpr:_}),_is:ne("is",{startsExpr:_}),_mixins:ne("mixins",{startsExpr:_}),_proto:ne("proto",{startsExpr:_}),_require:ne("require",{startsExpr:_}),_satisfies:ne("satisfies",{startsExpr:_}),_keyof:ne("keyof",{startsExpr:_}),_readonly:ne("readonly",{startsExpr:_}),_unique:ne("unique",{startsExpr:_}),_abstract:ne("abstract",{startsExpr:_}),_declare:ne("declare",{startsExpr:_}),_enum:ne("enum",{startsExpr:_}),_module:ne("module",{startsExpr:_}),_namespace:ne("namespace",{startsExpr:_}),_interface:ne("interface",{startsExpr:_}),_type:ne("type",{startsExpr:_}),_opaque:ne("opaque",{startsExpr:_}),name:B("name",{startsExpr:_}),placeholder:B("%%",{startsExpr:_}),string:B("string",{startsExpr:_}),num:B("num",{startsExpr:_}),bigint:B("bigint",{startsExpr:_}),regexp:B("regexp",{startsExpr:_}),privateName:B("#name",{startsExpr:_}),eof:B("eof"),jsxName:B("jsxName"),jsxText:B("jsxText",{beforeExpr:ie}),jsxTagStart:B("jsxTagStart",{startsExpr:_}),jsxTagEnd:B("jsxTagEnd")};Ce={brace:new jo("{"),j_oTag:new jo("<tag"),j_cTag:new jo("</tag"),j_expr:new jo("<tag>...</tag>",!0)},uw=/[\p{ID_Start}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1]/u,dw=/[\p{ID_Continue}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1\u1acf-\u1add\u1ae0-\u1aeb]/u,vw=[2368,25,1388,2,3817,43,20677,24,3,24,287,4,6146,7,1290,21,98,114,22734,30,2,2,2,1,2,6,3,4,10,1,53307,5,5987,11,21763,4297],EA=[3834,1,3173,7,633,9,51450,0,3,0,8,1,6,0];Ed={keyword:["break","case","catch","continue","debugger","default","do","else","finally","for","function","if","return","switch","throw","try","var","const","while","with","new","this","super","class","extends","export","import","null","true","false","in","instanceof","typeof","void","delete"],strict:["implements","interface","let","package","private","protected","public","static","yield"],strictBind:["eval","arguments"]},sM=new Set(Ed.keyword),aM=new Set(Ed.strict),cM=new Set(Ed.strictBind);Sw=class Sw extends Ds{declareFunctions=new Set};Iw=class Iw extends Ad{createScope(e){return new Sw(e)}declareName(e,n,t){let r=this.currentScope();if(n&2048){this.checkRedeclarationInScope(r,e,n,t),this.maybeExportDefined(r,e),r.declareFunctions.add(e);return}super.declareName(e,n,t)}isRedeclaredInScope(e,n,t){if(super.isRedeclaredInScope(e,n,t))return!0;if(t&2048&&!e.declareFunctions.has(n)){let r=e.names.get(n);return(r&4)>0||(r&2)>0}return!1}checkLocalExport(e){if(!this.scopeStack[0].declareFunctions.has(e.name))super.checkLocalExport(e)}};TA=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),OA={AmbiguousConditionalArrow:"Ambiguous expression: wrap the arrow functions in parentheses to disambiguate.",AmbiguousDeclareModuleKind:"Found both `declare module.exports` and `declare export` in the same module. Modules can only have 1 since they are either an ES module or they are a CommonJS module.",AssignReservedType:({reservedType:e})=>`Cannot overwrite reserved type ${e}.`,DeclareClassElement:"The `declare` modifier can only appear on class fields.",DeclareClassFieldInitializer:"Initializers are not allowed in fields with the `declare` modifier.",DuplicateDeclareModuleExports:"Duplicate `declare module.exports` statement.",EnumBooleanMemberNotInitialized:({memberName:e,enumName:n})=>`Boolean enum members need to be initialized. Use either \`${e} = true,\` or \`${e} = false,\` in enum \`${n}\`.`,EnumDuplicateMemberName:({memberName:e,enumName:n})=>`Enum member names need to be unique, but the name \`${e}\` has already been used before in enum \`${n}\`.`,EnumInconsistentMemberValues:({enumName:e})=>`Enum \`${e}\` has inconsistent member initializers. Either use no initializers, or consistently use literals (either booleans, numbers, or strings) for all member initializers.`,EnumInvalidExplicitType:({invalidEnumType:e,enumName:n})=>`Enum type \`${e}\` is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${n}\`.`,EnumInvalidExplicitTypeUnknownSupplied:({enumName:e})=>`Supplied enum type is not valid. Use one of \`boolean\`, \`number\`, \`string\`, or \`symbol\` in enum \`${e}\`.`,EnumInvalidMemberInitializerPrimaryType:({enumName:e,memberName:n,explicitType:t})=>`Enum \`${e}\` has type \`${t}\`, so the initializer of \`${n}\` needs to be a ${t} literal.`,EnumInvalidMemberInitializerSymbolType:({enumName:e,memberName:n})=>`Symbol enum members cannot be initialized. Use \`${n},\` in enum \`${e}\`.`,EnumInvalidMemberInitializerUnknownType:({enumName:e,memberName:n})=>`The enum member initializer for \`${n}\` needs to be a literal (either a boolean, number, or string) in enum \`${e}\`.`,EnumInvalidMemberName:({enumName:e,memberName:n,suggestion:t})=>`Enum member names cannot start with lowercase 'a' through 'z'. Instead of using \`${n}\`, consider using \`${t}\`, in enum \`${e}\`.`,EnumNumberMemberNotInitialized:({enumName:e,memberName:n})=>`Number enum members need to be initialized, e.g. \`${n} = 1\` in enum \`${e}\`.`,EnumStringMemberInconsistentlyInitialized:({enumName:e})=>`String enum members need to consistently either all use initializers, or use no initializers, in enum \`${e}\`.`,GetterMayNotHaveThisParam:"A getter cannot have a `this` parameter.",ImportTypeShorthandOnlyInPureImport:"The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements.",InexactInsideExact:"Explicit inexact syntax cannot appear inside an explicit exact object type.",InexactInsideNonObject:"Explicit inexact syntax cannot appear in class or interface definitions.",InexactVariance:"Explicit inexact syntax cannot have variance.",InvalidNonTypeImportInDeclareModule:"Imports within a `declare module` body must always be `import type` or `import typeof`.",MissingTypeParamDefault:"Type parameter declaration needs a default, since a preceding type parameter declaration has a default.",NestedDeclareModule:"`declare module` cannot be used inside another `declare module`.",NestedFlowComment:"Cannot have a flow comment inside another flow comment.",PatternIsOptional:{message:"A binding pattern parameter cannot be optional in an implementation signature."},SetterMayNotHaveThisParam:"A setter cannot have a `this` parameter.",SpreadVariance:"Spread properties cannot have variance.",ThisParamAnnotationRequired:"A type annotation is required for the `this` parameter.",ThisParamBannedInConstructor:"Constructors cannot have a `this` parameter; constructors don't bind `this` like other functions.",ThisParamMayNotBeOptional:"The `this` parameter cannot be optional.",ThisParamMustBeFirst:"The `this` parameter must be the first function parameter.",ThisParamNoDefault:"The `this` parameter may not have a default value.",TypeBeforeInitializer:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeCastInPattern:"The type cast expression is expected to be wrapped with parenthesis.",UnexpectedExplicitInexactInObject:"Explicit inexact syntax must appear at the end of an inexact object.",UnexpectedReservedType:({reservedType:e})=>`Unexpected reserved type ${e}.`,UnexpectedReservedUnderscore:"`_` is only allowed as a type argument to call or new.",UnexpectedSpaceBetweenModuloChecks:"Spaces between `%` and `checks` are not allowed here.",UnexpectedSpreadType:"Spread operator cannot appear in class or interface definitions.",UnexpectedSubtractionOperand:'Unexpected token, expected "number" or "bigint".',UnexpectedTokenAfterTypeParameter:"Expected an arrow function after this type parameter declaration.",UnexpectedTypeParameterBeforeAsyncArrowFunction:"Type parameters must come after the async keyword, e.g. instead of `<T> async () => {}`, use `async <T>() => {}`.",UnsupportedDeclareExportKind:({unsupportedExportKind:e,suggestion:n})=>`\`declare export ${e}\` is not supported. Use \`${n}\` instead.`,UnsupportedStatementInDeclareModule:"Only declares and type imports are allowed inside declare module.",UnterminatedFlowComment:"Unterminated flow-comment."},V=kt`flow`(OA);jA={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};_A=/\*?\s*@((?:no)?flow)\b/,DA={__proto__:null,quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",fnof:"\u0192",circ:"\u02C6",tilde:"\u02DC",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",bull:"\u2022",hellip:"\u2026",permil:"\u2030",prime:"\u2032",Prime:"\u2033",lsaquo:"\u2039",rsaquo:"\u203A",oline:"\u203E",frasl:"\u2044",euro:"\u20AC",image:"\u2111",weierp:"\u2118",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666"},LA=/\r\n|[\r\n\u2028\u2029]/,lM=new RegExp(LA.source,"g");MA={AttributeIsEmpty:"JSX attributes must only be assigned a non-empty expression.",MissingClosingTagElement:({openingTagName:e})=>`Expected corresponding JSX closing tag for <${e}>.`,MissingClosingTagFragment:"Expected corresponding JSX closing tag for <>.",UnexpectedSequenceExpression:"Sequence expressions cannot be directly nested inside JSX. Did you mean to wrap it in parentheses (...)?",UnexpectedToken:({unexpected:e,HTMLEntity:n})=>`Unexpected token \`${e}\`. Did you mean \`${n}\` or \`{'${e}'}\`?`,UnsupportedJsxValue:"JSX value should be either an expression or a quoted JSX text.",UnterminatedJsxContent:"Unterminated JSX contents.",UnwrappedAdjacentJSXElements:"Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?"},Mt=kt`jsx`(MA);Cw=class Cw extends Ds{tsNames=new Map};Pw=class Pw extends Ad{get inTSNamespace(){let e=this.scopeStack;return e.length>=2&&e[e.length-1].flags===0&&(e[e.length-2].flags&2048)>0}importsStack=[];createScope(e){return this.importsStack.push(new Set),new Cw(e)}enter(e){if(e&3072)this.importsStack.push(new Set);super.enter(e)}exit(){let e=super.exit();if(e&3072)this.importsStack.pop();return e}hasImport(e,n){let t=this.importsStack.length;if(this.importsStack[t-1].has(e))return!0;if(!n&&t>1){for(let r=0;r<t-1;r++)if(this.importsStack[r].has(e))return!0}return!1}declareName(e,n,t){if(n&4096){if(this.hasImport(e,!0))this.parser.raise(He.VarRedeclaration,t,{identifierName:e});this.importsStack[this.importsStack.length-1].add(e);return}let r=this.currentScope(),o=r.tsNames.get(e)||0;if(n&1024){this.maybeExportDefined(r,e),r.tsNames.set(e,o|16);return}if(super.declareName(e,n,t),n&2){if(!(n&1))this.checkRedeclarationInScope(r,e,n,t),this.maybeExportDefined(r,e);o=o|1}if(n&256)o=o|2;if(n&512)o=o|4;if(n&128)o=o|8;if(o)r.tsNames.set(e,o)}isRedeclaredInScope(e,n,t){let r=e.tsNames.get(n);if((r&2)>0){if(t&256){let o=(t&512)>0,i=(r&4)>0;return o!==i}return!0}if(t&128&&(r&8)>0)if(e.names.get(n)&2)return!!(t&1);else return!1;if(t&2&&(r&1)>0)return!0;return super.isRedeclaredInScope(e,n,t)}checkLocalExport(e){let{name:n}=e;if(this.hasImport(n))return;let t=this.scopeStack.length;for(let r=t-1;r>=0;r--){let i=this.scopeStack[r].tsNames.get(n);if((i&1)>0||(i&16)>0)return}super.checkLocalExport(e)}};uM=Ew.prototype,yd=/in(?:stanceof)?|as|satisfies/y;qA={AbstractMethodHasImplementation:({methodName:e})=>`Method '${e}' cannot have an implementation because it is marked abstract.`,AbstractPropertyHasInitializer:({propertyName:e})=>`Property '${e}' cannot have an initializer because it is marked abstract.`,AccessorCannotBeOptional:"An 'accessor' property cannot be declared optional.",AccessorCannotDeclareThisParameter:"'get' and 'set' accessors cannot declare 'this' parameters.",AccessorCannotHaveTypeParameters:"An accessor cannot have type parameters.",ClassMethodHasDeclare:"Class methods cannot have the 'declare' modifier.",ClassMethodHasReadonly:"Class methods cannot have the 'readonly' modifier.",ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference:"A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",ConstructorHasTypeParameters:"Type parameters cannot appear on a constructor declaration.",DeclaratorDefiniteAssertionRequiresTypeAnnotation:"Declarations with definite assignment assertions must also have type annotations.",DeclaratorDefiniteAssertionWithInitializer:"Declarations with initializers cannot also have definite assignment assertions.",DeclareAccessor:({kind:e})=>`'declare' is not allowed in ${e}ters.`,DeclareClassFieldHasInitializer:"Initializers are not allowed in ambient contexts.",DeclareFunctionHasImplementation:"An implementation cannot be declared in ambient contexts.",DecoratorAbstractMethod:({kind:e})=>`Decorators can't be used with ${e.startsWith("a")?"an":"a"} ${e}.`,DuplicateAccessibilityModifier:({modifier:e})=>`Accessibility modifier already seen: '${e}'.`,DuplicateModifier:({modifier:e})=>`Duplicate modifier: '${e}'.`,EmptyHeritageClauseType:({token:e})=>`'${e}' list cannot be empty.`,EmptyNamespaceName:"Namespace must be given a name.",EmptyTypeArguments:"Type argument list cannot be empty.",EmptyTypeParameters:"Type parameter list cannot be empty.",ExpectedAmbientAfterExportDeclare:"'export declare' must be followed by an ambient declaration.",ExportAssignmentInTSNamespace:"An export assignment cannot be used in a namespace.",ExportInTSNamespace:"Export declarations are not permitted in a namespace.",ImportAliasHasImportType:"An import alias can not use 'import type'.",ImportInTSNamespace:"Import declarations in a namespace cannot reference a module.",IncompatibleModifiers:({modifiers:e})=>`'${e[0]}' modifier cannot be used with '${e[1]}' modifier.`,IndexSignatureHasAbstract:"Index signatures cannot have the 'abstract' modifier.",IndexSignatureHasAccessibility:({modifier:e})=>`Index signatures cannot have an accessibility modifier ('${e}').`,IndexSignatureHasDeclare:"Index signatures cannot have the 'declare' modifier.",IndexSignatureHasOverride:"'override' modifier cannot appear on an index signature.",IndexSignatureHasStatic:"Index signatures cannot have the 'static' modifier.",InitializerNotAllowedInAmbientContext:"Initializers are not allowed in ambient contexts.",InlineModuleDeclarationMustUseString:"`module ... {}` declarations must have a string name. Use `namespace ... {}` instead.",InvalidHeritageClauseType:({token:e})=>`'${e}' list can only include identifiers or qualified-names with optional type arguments.`,InvalidModifierOnAwaitUsingDeclaration:(e)=>`'${e}' modifier cannot appear on an await using declaration.`,InvalidModifierOnTypeMember:({modifier:e})=>`'${e}' modifier cannot appear on a type member.`,InvalidModifierOnTypeParameter:({modifier:e})=>`'${e}' modifier cannot appear on a type parameter.`,InvalidModifierOnTypeParameterPositions:({modifier:e})=>`'${e}' modifier can only appear on a type parameter of a class, interface or type alias.`,InvalidModifierOnUsingDeclaration:(e)=>`'${e}' modifier cannot appear on a using declaration.`,InvalidModifiersOrder:({orderedModifiers:e})=>`'${e[0]}' modifier must precede '${e[1]}' modifier.`,InvalidNamespaceName:(e)=>`Namespace name cannot be '${e}'.`,InvalidPropertyAccessAfterInstantiationExpression:"Invalid property access after an instantiation expression. You can either wrap the instantiation expression in parentheses, or delete the type arguments.",InvalidTupleMemberLabel:"Tuple members must be labeled with a simple identifier.",MissingInterfaceName:"'interface' declarations must be followed by an identifier.",NamespaceExportInTSNamespace:"Global module exports may only appear at top level.",NonAbstractClassHasAbstractMethod:"Abstract methods can only appear within an abstract class.",NonClassMethodPropertyHasAbstractModifier:"'abstract' modifier can only appear on a class, method, or property declaration.",OptionalTypeBeforeRequired:"A required element cannot follow an optional element.",OverrideNotInSubClass:"This member cannot have an 'override' modifier because its containing class does not extend another class.",PatternIsOptional:"A binding pattern parameter cannot be optional in an implementation signature.",PrivateElementHasAbstract:"Private elements cannot have the 'abstract' modifier.",PrivateElementHasAccessibility:({modifier:e})=>`Private elements cannot have an accessibility modifier ('${e}').`,ReadonlyForMethodSignature:"'readonly' modifier can only appear on a property declaration or index signature.",ReservedArrowTypeParam:"This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",ReservedTypeAssertion:"This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",SetAccessorCannotHaveOptionalParameter:"A 'set' accessor cannot have an optional parameter.",SetAccessorCannotHaveRestParameter:"A 'set' accessor cannot have rest parameter.",SetAccessorCannotHaveReturnType:"A 'set' accessor cannot have a return type annotation.",SingleTypeParameterWithoutTrailingComma:({typeParameterName:e})=>`Single type parameter ${e} should have a trailing comma. Example usage: <${e},>.`,StaticBlockCannotHaveModifier:"Static class blocks cannot have any modifier.",TupleOptionalAfterType:"A labeled tuple optional element must be declared using a question mark after the name and before the colon (`name?: type`), rather than after the type (`name: type?`).",TypeAnnotationAfterAssign:"Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`.",TypeImportCannotSpecifyDefaultAndNamed:"A type-only import can specify a default import or named bindings, but not both.",TypeModifierIsUsedInTypeExports:"The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement.",TypeModifierIsUsedInTypeImports:"The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement.",UnexpectedParameterInitializer:"A parameter initializer is only allowed in a function or constructor implementation.",UnexpectedParameterModifier:"A parameter property is only allowed in a constructor implementation.",UnexpectedReadonly:"'readonly' type modifier is only permitted on array and tuple literal types.",UnexpectedTypeAnnotation:"Did not expect a type annotation here.",UnexpectedTypeCastInParameter:"Unexpected type cast in parameter position.",UnexpectedTypeDeclaration:(e)=>`'${e}' declarations can only be declared inside a block.`,UnsupportedImportTypeArgument:"Argument in a type import must be a string literal.",UnsupportedParameterPropertyKind:"A parameter property may not be declared using a binding pattern.",UnsupportedSignatureParameterKind:({type:e})=>`Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${e}.`,UsingDeclarationInAmbientContext:(e)=>`'${e}' declarations are not allowed in ambient contexts.`},N=kt`typescript`(qA);WA={ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."},yw=kt`placeholders`(WA),QA={estree:yA,jsx:zA,flow:$A,typescript:UA,v8intrinsic:GA,placeholders:HA},dM=Object.keys(QA);pM=XA(bA)});var Vt={};Lo(Vt,{anyString:()=>za,base64:()=>Oa,base64url:()=>Na,bigint:()=>qa,boolean:()=>Va,browserEmail:()=>ek,cidrv4:()=>Aa,cidrv6:()=>Ta,creditCard:()=>ei,cuid:()=>ha,cuid2:()=>ma,currencyCode:()=>$a,date:()=>Da,datetime:()=>Ma,domain:()=>Ra,duration:()=>va,e164:()=>_a,email:()=>Sa,emoji:()=>Ia,extendedDuration:()=>Kv,guid:()=>ka,hex:()=>Ka,hostname:()=>ja,html5Email:()=>Qv,httpProtocol:()=>Cr,iban:()=>ti,idnEmail:()=>Yv,integer:()=>Pr,ipv4:()=>Ca,ipv6:()=>Pa,ksuid:()=>ba,lowercase:()=>Ja,mac:()=>Ea,md5_base64:()=>ok,md5_base64url:()=>ik,md5_hex:()=>rk,nanoid:()=>xa,nanoidOfLength:()=>wa,null:()=>Ba,number:()=>fn,rfc5322Email:()=>Xv,sha1_base64:()=>ak,sha1_base64url:()=>ck,sha1_hex:()=>sk,sha256_base64:()=>uk,sha256_base64url:()=>dk,sha256_hex:()=>lk,sha384_base64:()=>fk,sha384_base64url:()=>hk,sha384_hex:()=>pk,sha512_base64:()=>yk,sha512_base64url:()=>gk,sha512_hex:()=>mk,string:()=>Fa,time:()=>La,ulid:()=>ya,undefined:()=>Ua,unicodeEmail:()=>Np,uppercase:()=>Za,uuid:()=>pn,uuid4:()=>Wv,uuid6:()=>Hv,uuid7:()=>Gv,xid:()=>ga});var Wl={};Lo(Wl,{ZodAny:()=>cy,ZodArray:()=>fy,ZodBase64:()=>Dl,ZodBase64URL:()=>Ll,ZodBigInt:()=>Vl,ZodBigIntFormat:()=>Bl,ZodBoolean:()=>ql,ZodCIDRv4:()=>_l,ZodCIDRv6:()=>$l,ZodCUID:()=>El,ZodCUID2:()=>Al,ZodCatch:()=>Ry,ZodCodec:()=>Zi,ZodCreditCard:()=>ny,ZodCustom:()=>Ki,ZodCustomStringFormat:()=>Fn,ZodDate:()=>py,ZodDefault:()=>Ey,ZodDiscriminatedUnion:()=>my,ZodE164:()=>Ml,ZodEmail:()=>Sl,ZodEmoji:()=>Cl,ZodEnum:()=>Br,ZodExactOptional:()=>Jl,ZodFile:()=>Sy,ZodFunction:()=>Vy,ZodGUID:()=>Il,ZodIBAN:()=>ry,ZodIPv4:()=>jl,ZodIPv6:()=>Rl,ZodISODate:()=>Ln,ZodISODateTime:()=>Dn,ZodISODuration:()=>zn,ZodISOTime:()=>Mn,ZodInstanceOf:()=>Jy,ZodIntersection:()=>yy,ZodJWT:()=>zl,ZodKSUID:()=>Nl,ZodLazy:()=>Fy,ZodLiteral:()=>ky,ZodMAC:()=>ty,ZodMap:()=>wy,ZodNaN:()=>$y,ZodNanoID:()=>Pl,ZodNever:()=>uy,ZodNonOptional:()=>Zl,ZodNull:()=>sy,ZodNullable:()=>Py,ZodNumber:()=>Fl,ZodNumberFormat:()=>qn,ZodObject:()=>Vi,ZodOptional:()=>Ui,ZodPipe:()=>Ji,ZodPrefault:()=>Ty,ZodPreprocess:()=>Dy,ZodPromise:()=>qy,ZodReadonly:()=>Ly,ZodRecord:()=>Vr,ZodSet:()=>vy,ZodString:()=>kl,ZodStringFormat:()=>be,ZodSuccess:()=>jy,ZodSymbol:()=>oy,ZodTemplateLiteral:()=>zy,ZodTransform:()=>Iy,ZodTuple:()=>by,ZodType:()=>Q,ZodULID:()=>Tl,ZodURL:()=>qi,ZodUUID:()=>_t,ZodUndefined:()=>iy,ZodUnion:()=>Bi,ZodUnknown:()=>ly,ZodVoid:()=>dy,ZodXID:()=>Ol,ZodXor:()=>hy,_ZodString:()=>vl,_default:()=>Ay,_function:()=>uI,any:()=>JS,array:()=>A,base64:()=>CS,base64url:()=>PS,bigint:()=>FS,boolean:()=>me,catch:()=>_y,check:()=>dI,cidrv4:()=>SS,cidrv6:()=>IS,codec:()=>sI,creditCard:()=>AS,cuid:()=>mS,cuid2:()=>yS,currencyCode:()=>_S,custom:()=>pI,date:()=>KS,describe:()=>fI,discriminatedUnion:()=>gt,e164:()=>ES,email:()=>iS,emoji:()=>fS,enum:()=>U,exactOptional:()=>Cy,file:()=>nI,float32:()=>DS,float64:()=>LS,function:()=>uI,guid:()=>sS,hash:()=>$S,hex:()=>RS,hostname:()=>jS,httpUrl:()=>pS,iban:()=>TS,instanceof:()=>mI,int:()=>Ne,int32:()=>MS,int64:()=>qS,intersection:()=>gy,invertCodec:()=>aI,ipv4:()=>wS,ipv6:()=>kS,json:()=>De,jwt:()=>OS,keyof:()=>WS,ksuid:()=>xS,lazy:()=>Kl,literal:()=>b,looseObject:()=>HS,looseRecord:()=>XS,mac:()=>vS,map:()=>YS,meta:()=>hI,nan:()=>iI,nanoid:()=>hS,nativeEnum:()=>tI,never:()=>yt,nonoptional:()=>Ny,null:()=>ay,nullable:()=>Fi,nullish:()=>rI,number:()=>M,object:()=>E,optional:()=>zi,partialRecord:()=>QS,pipe:()=>wl,prefault:()=>Oy,preprocess:()=>Zy,promise:()=>lI,readonly:()=>My,record:()=>re,refine:()=>By,set:()=>eI,strictObject:()=>w,string:()=>k,stringFormat:()=>NS,stringbool:()=>yI,success:()=>oI,superRefine:()=>Uy,symbol:()=>BS,templateLiteral:()=>cI,transform:()=>Ul,tuple:()=>xy,uint32:()=>zS,uint64:()=>VS,ulid:()=>gS,undefined:()=>US,union:()=>te,unknown:()=>mt,url:()=>dS,uuid:()=>aS,uuidv4:()=>cS,uuidv6:()=>lS,uuidv7:()=>uS,void:()=>ZS,xid:()=>bS,xor:()=>GS});var Li={};Lo(Li,{endsWith:()=>Ei,gt:()=>Ut,gte:()=>ht,includes:()=>Ci,length:()=>_r,lowercase:()=>Si,lt:()=>Bt,lte:()=>ft,maxLength:()=>Rr,maxSize:()=>Nn,mime:()=>Ti,minLength:()=>hn,minSize:()=>Jt,multipleOf:()=>On,negative:()=>pm,nonnegative:()=>hm,nonpositive:()=>fm,normalize:()=>Oi,overwrite:()=>Rt,positive:()=>dm,properties:()=>Ai,property:()=>mm,regex:()=>ki,size:()=>jr,slugify:()=>_i,startsWith:()=>Pi,toLowerCase:()=>ji,toUpperCase:()=>Ri,trim:()=>Ni,uppercase:()=>Ii});var Ur={};Lo(Ur,{ZodISODate:()=>Ln,ZodISODateTime:()=>Dn,ZodISODuration:()=>zn,ZodISOTime:()=>Mn,date:()=>bI,datetime:()=>gI,duration:()=>wI,time:()=>xI});var Zd="0.1.0-beta.86";var Qs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Kd="en";var Gs=new Map(Qs.map((e)=>[e.toLowerCase(),e])),kv=new Set(["hk","mo","tw"]);function Wd(e){return typeof e=="string"&&Gs.get(e.toLowerCase())==e}function Mo(e,n="en"){for(let t of e){let r=t==null?void 0:Sv(t);if(r!=null)return r}return n}function Sv(e){let n=e.trim().toLowerCase();if(n.length==0)return;let t=Gs.get(n);if(t!=null)return t;let r=n.split("-");if(r[0]=="zh"){if(r.includes("hant"))return"zh-TW";if(r.includes("hans"))return"zh-CN";return r.some((o)=>kv.has(o))?"zh-TW":"zh-CN"}return Gs.get(r[0])}function Hd(e){return{en:"Imported workflow","zh-CN":"\u5BFC\u5165\u7684\u5DE5\u4F5C\u6D41","zh-TW":"\u532F\u5165\u7684\u5DE5\u4F5C\u6D41",ja:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u305F\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC",ko:"\uAC00\uC838\uC628 \uC6CC\uD06C\uD50C\uB85C",fr:"Workflow import\xE9",ru:"\u0418\u043C\u043F\u043E\u0440\u0442\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0439 \u043F\u0440\u043E\u0446\u0435\u0441\u0441"}[e]}import{spawn as MT}from"child_process";import{readFile as zT}from"fs/promises";import{setTimeout as FT}from"timers/promises";var ln="open-flow-engine/v11";var cn=(e)=>`export const engineContract = ${JSON.stringify(e)}
3
7
  export function identity(value) { return value }
4
- `,uo={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:on("open-flow-engine/v8")},po={...uo,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:on("open-flow-engine/v8/nodejs-compat-v1")},Qu={...po,codeFetch:!0,platformSource:on("open-flow-engine/v9")},Kw={...Qu,flowState:!0,platformSource:on("open-flow-engine/v10")};function Yu(e){if(e=="open-flow-engine/v10")return Kw;if(e=="open-flow-engine/v9")return Qu;if(e=="open-flow-engine/v8")return uo;if(e=="open-flow-engine/v8/nodejs-compat-v1")return po;if(e=="open-flow-engine/v7"||e=="open-flow-engine/v7/nodejs-compat-v1")return{...e.endsWith("/nodejs-compat-v1")?po:uo,workflowTools:!1,httpRequests:!1,platformSource:on(e)};if(e=="open-flow-engine/v6"||e=="open-flow-engine/v6/nodejs-compat-v1")return{...e=="open-flow-engine/v6"?uo:po,workflowTools:!1,httpRequests:!1,waitAutoContinue:!1,webhookResponses:!1,platformSource:on(e)};return}function Kn(e){let t=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function ys(e,t="|"){return e.map((n)=>ks(n)).join(t)}function Wn(e,t){if(typeof t==="bigint")return t.toString();return t}class ed{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function Gn(e){return new ed(e)}function bs(e){return e===null||e===void 0}function Et(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function td(e,t){let n=e/t,r=Math.round(n),o=4*Number.EPSILON*Math.max(Math.abs(n),1);if(Math.abs(n-r)<o)return 0;return n-r}var Xu=Symbol("evaluating");function nd(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Xu)return;if(r===void 0)r=Xu,r=n();return r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Re(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Hn(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function ht(e){return Hn(e._zod.def)??e._zod.def.shape}function rd(e,t,n){Object.defineProperty(e,t,{get(){let r=n();return Re(this,t,r),r},enumerable:!0,configurable:!0})}function od(e,t,n){if(t in e)Re(e,t,n);else e[t]=n}function Mt(e,t,n,r){let o=ht(t);for(let i of n){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)rd(e,i,()=>{let a=t._zod.def.shape[i];return r?r(a,i):a});else od(e,i,r?r(s.value,i):s.value)}}function Ww(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);if(!r.enumerable)continue;if(r.get)rd(e,n,()=>t[n]);else od(e,n,r.value)}}function Je(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function id(e){return JSON.stringify(e)}function sd(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ws="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function an(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var ad=Gn(()=>{if(je.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function bt(e){if(an(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let n=t.prototype;if(an(n)===!1)return!1;if(Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)return!1;return!0}function vs(e){if(bt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var fo=new Set(["string","number","symbol"]),cd=new Set(["string","number","bigint","boolean","symbol","undefined"]);function et(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lt(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function j(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}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function ks(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function ld(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var mo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),go={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Gw(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 Mt(i,e,ho(e,t)),lt(e,Je(n,{shape:i,checks:[]}))}function ho(e,t){let n=ht(e),r=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])r.push(o)}return r}function Hw(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(ho(e,t)),s={};return Mt(s,e,Reflect.ownKeys(ht(e)).filter((a)=>!i.has(a))),lt(e,Je(n,{shape:s,checks:[]}))}function Qw(e,t){if(!bt(t))throw Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let o=ht(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return lt(e,Je(e._zod.def,{shape:ud(e,t)}))}function ud(e,t){let n={};return Mt(n,e,Reflect.ownKeys(ht(e))),Ww(n,t),n}function Yw(e,t){if(!bt(t))throw Error("Invalid input to safeExtend: expected a plain object");return lt(e,Je(e._zod.def,{shape:ud(e,t)}))}function Xw(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={};Mt(n,e,Reflect.ownKeys(ht(e))),Mt(n,t,Reflect.ownKeys(ht(t)));let r=Je(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return lt(e,r)}function dd(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(ho(t,n)):void 0,c={};return Mt(c,t,Reflect.ownKeys(ht(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),lt(t,Je(t._zod.def,{shape:c,checks:[]}))}function ev(e,t,n){let r=n?new Set(ho(t,n)):void 0,o={};return Mt(o,t,Reflect.ownKeys(ht(t)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),lt(t,Je(t._zod.def,{shape:o}))}function Ve(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 pd(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 Be(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Un(e){return typeof e==="string"?e:e?.message}function xs(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function Ue(e,t,n){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Un(e.inst?._zod.def?.error?.(e))??Un(i?.(e))??Un(t?.error?.(e))??Un(n.customError?.(e))??Un(n.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}function yo(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var tv=/[\uD800-\uDBFF]/;function bo(e){let t=e.length;if(!tv.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function wo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function fd(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 n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function Zt(...e){let[t,n,r]=e;if(typeof t==="string")return{message:t,code:"custom",input:n,inst:r};return{...t}}function md(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else nv(e,n,r.value)}}function yt(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Qn(e,t,n){return yt(e,t,n,!1)}function vo(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return yt(this,n,r(this))},set(o){yt(this,n,o)}})}return t}function nv(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:yt(this,t,n.bind(this))},set(r){yt(this,t,r)}})}function rv(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var hs,Ct=!1,ov={configurable:!0,get(){Ct=!0;return}};function G(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&hs!==e._zod){hs=void 0;return}hs=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ov);let o=Ct;Ct=!1;try{let i=n(this);if(Ct)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return Ct=Ct||o,i}catch(i){throw delete this[t],Ct=Ct||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function iv(e,t,n,r){let o=rv(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,i),i.value=n(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var sv="~constantCatch";function gd(e){let t=()=>e;return t[sv]=!0,t}var hd;var Ss={value:void 0,enumerable:!1},yd="captureStackTrace"in Error?Error:null;function av(e){let t=yd;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return yd=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function m(e,t,n,r){let o={};function i(h){this.def=h,this.constr=d,this.traits=new Set}i.prototype=o;let s=n,a=s&&new WeakSet;function c(h,g){if(!h._zod){Ss.value=new i(g);try{Object.defineProperty(h,"_zod",Ss)}finally{Ss.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,g),a){let S=Object.getPrototypeOf(h),A=h._zod.constr.prototype,N=S;while(N&&N!==A)N=Object.getPrototypeOf(N);let L=N??S;if(!a.has(L))a.add(L),md(L,s)}let y=d.prototype;for(let S in y){if(!Object.prototype.hasOwnProperty.call(y,S))continue;if(!(S in h))h[S]=y[S].bind(h)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(h){let g=r?.Parent?av(u):this;c(g,h);let y=g._zod.deferred;if(y){for(let A of y)A();g._zod.deferred=void 0}let S=globalThis.__zod_globalConfig?.postProcessor;if(S)S(g);return g}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(h)=>{if(r?.Parent&&h instanceof r.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class ut extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class cn extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(hd=globalThis).__zod_globalConfig??(hd.__zod_globalConfig={});var je=globalThis.__zod_globalConfig;function Ae(e){if(e)Object.assign(je,e);return je}function cv(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Wn,2)),e.message}function lv(e){this._zod.message=e}var uv={get:cv,set:lv,enumerable:!0,configurable:!0},Cs={value:void 0,enumerable:!1},bd=new WeakSet([Object.prototype,Error.prototype]),wd=(e,t)=>{e.name="$ZodError",Cs.value=t,Object.defineProperty(e,"issues",Cs),Cs.value=void 0,Object.defineProperty(e,"message",uv);let n=Object.getPrototypeOf(e);if(!bd.has(n))bd.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},vd=m("$ZodError",wd),Es=m("$ZodError",wd,void 0,{Parent:Error});function dv(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0});else e[t]=n();return e[t]}function kd(e,t=(n)=>n.message){let n={},r=[];for(let o of e.issues)if(o.path.length>0)dv(n,o.path[0],()=>[]).push(t(o));else r.push(t(o));return{formErrors:r,fieldErrors:n}}function xd(e,t=(n)=>n.message){let n={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)n._errors.push(t(s));else{let c=n,l=0;while(l<a.length){let u=a[l],d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=c[u];if(d)h._errors.push(t(s));c=h,l++}}}};return r(e),n}function ko(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Yn=(e)=>{let t=(n,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new ut;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Ue(l,s,Ae())));throw ws(c,i?.callee??t),c}return a.value};return t},Os=Yn(Es),Xn=(e)=>{let t=async(n,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=n._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>Ue(l,s,Ae())));throw ws(c,i?.callee??t),c}return a.value};return t},js=Xn(Es),xo=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new ut;return i.issues.length?Sd(e,i.issues,o):{success:!0,data:i.value}};function Sd(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>Ue(o,n,Ae()))),t=void 0,n=void 0;return r},set error(o){r=o,t=void 0,n=void 0}}}var So=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?Sd(e,i.issues,o):{success:!0,data:i.value}};var fv=Symbol.for("zod.compile.invalid"),mv=Symbol.for("zod.compile.fallback"),_s=(e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==fv)return!0;if(r.definite===!0&&n===void 0)return!1}return gv(e,t,n)};function gv(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[mv]=!0,i=o({value:t,issues:[]},r);else i=e._zod.run({value:t,issues:[]},r);if(i instanceof Promise)throw new ut;return i.issues.length===0}var Rs=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},Id=(e)=>{let t=Yn(e),n=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(r,o,a,ko(n,s))};return n};var Cd=(e)=>{let t=Yn(e),n=(r,o,i,s)=>t(r,o,i,ko(n,s));return n};var Ed=(e)=>{let t=Xn(e),n=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(r,o,a,ko(n,s))};return n};var Od=(e)=>{let t=Xn(e),n=async(r,o,i,s)=>await t(r,o,i,ko(n,s));return n};var jd=(e)=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return xo(e)(t,n,o)};var _d=(e)=>(t,n,r)=>xo(e)(t,n,r);var Rd=(e)=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return So(e)(t,n,o)};var Ad=(e)=>async(t,n,r)=>So(e)(t,n,r);var Ps=/^[cC][0-9a-z]{6,}$/,Ts=/^[0-9a-z]+$/,$s=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Ns=/^[0-9a-vA-V]{20}$/,zs=/^[A-Za-z0-9]{27}$/,Ds=/^[a-zA-Z0-9_-]{21}$/;function qs(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Vs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,hv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Ls=/^([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})$/,Jt=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},yv=Jt(4),bv=Jt(6),wv=Jt(7),Fs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,vv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,kv=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Pd=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,xv=Pd,Sv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Iv="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ms(){return new RegExp(Iv,"u")}var Zs=/^(?:(?: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])$/,Js=/^(([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}|:))$/,Bs=(e)=>{let t=et(e??":");return new RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Us=/^((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])$/,Ks=/^(([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])$/,Ws=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Gs=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Hs=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Qs=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,er=/^https?$/,Ys=/^\+[1-9]\d{6,14}$/,Io=/^\d(?:[ -]?\d){11,18}$/,Xs=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,Co=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Td="(?:(?:\\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 Cv(e){return new RegExp(`^${e}$`)}var ea=Cv(Td);function As(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function ta(e){return new RegExp(`^${As(e)}$`)}function na(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let n=`${As({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,r=e.local?`${n}|${As({precision:e.precision})}`:n;return new RegExp(`^${Td}T(?:${r})$`)}var ra=/^[\s\S]{0,}$/,oa=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},ia=/^-?\d+n?$/,tr=/^-?\d+$/,Bt=/^-?\d+(?:\.\d+)?$/,sa=/^(?:true|false)$/i,aa=/^null$/i;var ca=/^undefined$/i;var la=/^[^A-Z]*$/,ua=/^[^a-z]*$/,da=/^[0-9a-fA-F]*$/;function nr(e,t){return new RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function rr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var Ev=/^[0-9a-fA-F]{32}$/,Ov=nr(22,"=="),jv=rr(22),_v=/^[0-9a-fA-F]{40}$/,Rv=nr(27,"="),Av=rr(27),Pv=/^[0-9a-fA-F]{64}$/,Tv=nr(43,"="),$v=rr(43),Nv=/^[0-9a-fA-F]{96}$/,zv=nr(64,""),Dv=rr(64),qv=/^[0-9a-fA-F]{128}$/,Vv=nr(86,"=="),Lv=rr(86);var ue=m("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),pa=(e)=>{let t=e.value;return!bs(t)&&t.size!==void 0},fa=(e)=>{let t=e.value;return!bs(t)&&t.length!==void 0},Eo={number:"number",bigint:"bigint",object:"date"},ma=m("$ZodCheckLessThan",(e,t)=>{ue.init(e,t);let n=Eo[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value<=t.value:r.value<t.value)return;r.issues.push({origin:Eo[typeof r.value]??n,code:"too_big",maximum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ga=m("$ZodCheckGreaterThan",(e,t)=>{ue.init(e,t);let n=Eo[typeof t.value];e._zod.check=(r)=>{if(t.inclusive?r.value>=t.value:r.value>t.value)return;r.issues.push({origin:Eo[typeof r.value]??n,code:"too_small",minimum:typeof t.value==="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$d=m("$ZodCheckMultipleOf",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{if(typeof n.value!==typeof t.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof n.value==="bigint"?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):td(n.value,t.value)===0)return;n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Nd=m("$ZodCheckNumberFormat",(e,t)=>{ue.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,i]=mo[t.format];e._zod.check=(s)=>{let a=s.value;if(n){if(!Number.isInteger(a)){s.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),zd=m("$ZodCheckBigIntFormat",(e,t)=>{ue.init(e,t);let[n,r]=go[t.format];e._zod.check=(o)=>{let i=o.value;if(i<n)o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:n,inclusive:!0,inst:e,continue:!t.abort});if(i>r)o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),Dd=m("$ZodCheckMaxSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=pa),e._zod.check=(r)=>{let o=r.value;if(o.size<=t.maximum)return;r.issues.push({origin:yo(o),code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),qd=m("$ZodCheckMinSize",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=pa),e._zod.check=(r)=>{let o=r.value;if(o.size>=t.minimum)return;r.issues.push({origin:yo(o),code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vd=m("$ZodCheckSizeEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=pa),e._zod.check=(r)=>{let o=r.value,i=o.size;if(i===t.size)return;let s=i>t.size;r.issues.push({origin:yo(o),...s?{code:"too_big",maximum:t.size}:{code:"too_small",minimum:t.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Ld=m("$ZodCheckMaxLength",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=fa),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>t.maximum?bo(o):i)<=t.maximum)return;let a=wo(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Fd=m("$ZodCheckMinLength",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=fa),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?bo(o):i)>=t.minimum)return;let a=wo(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Md=m("$ZodCheckLengthEquals",(e,t)=>{var n;ue.init(e,t),(n=e._zod.def).when??(n.when=fa),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?bo(o):i;if(s===t.length)return;let a=wo(o),c=s>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),or=m("$ZodCheckStringFormat",(e,t)=>{var n,r;if(ue.init(e,t),t.pattern)(n=e._zod).check??(n.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(r=e._zod).check??(r.check=()=>{})}),Zd=m("$ZodCheckRegex",(e,t)=>{or.init(e,t),e._zod.check=(n)=>{if(t.pattern.lastIndex=0,t.pattern.test(n.value))return;n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Jd=m("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=la),or.init(e,t)}),Bd=m("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=ua),or.init(e,t)}),Ud=m("$ZodCheckIncludes",(e,t)=>{ue.init(e,t);let n=et(t.includes),r=new RegExp(typeof t.position==="number"?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Kd=m("$ZodCheckStartsWith",(e,t)=>{ue.init(e,t);let n=new RegExp(`^${et(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.startsWith(t.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Wd=m("$ZodCheckEndsWith",(e,t)=>{ue.init(e,t);let n=new RegExp(`.*${et(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.check=(r)=>{if(r.value.endsWith(t.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});function Oo(e,t,n){if(e.issues.length)t.issues.push(...Be(n,e.issues))}var Gd=m("$ZodCheckProperty",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{let r=t.schema._zod.run({value:n.value[t.property],issues:[]},{});if(r instanceof Promise)return r.then((o)=>Oo(o,n,t.property));Oo(r,n,t.property);return}}),Hd=m("$ZodCheckProperties",(e,t)=>{ue.init(e,t),Qn(e,Symbol.iterator,function*(){yield e});let n;e._zod.check=(r)=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}n??(n=Reflect.ownKeys(t.shape).map((s)=>[s,t.shape[s]]));let o=r.value,i;for(let[s,a]of n){let c=a._zod.run({value:o[s],issues:[]},{});if(c instanceof Promise)i??(i=[]),i.push(c.then((l)=>Oo(l,r,s)));else Oo(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),Qd=m("$ZodCheckMimeType",(e,t)=>{ue.init(e,t);let n=new Set(t.mime);e._zod.check=(r)=>{if(n.has(r.value.type))return;r.issues.push({code:"invalid_value",values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Yd=m("$ZodCheckOverwrite",(e,t)=>{ue.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});class ha{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-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let n=e.split(`
5
- `).filter((i)=>i),r=Math.min(...n.map((i)=>i.length-i.trimStart().length)),o=n.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
6
- ${t.join(`
8
+ `,zo={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:cn("open-flow-engine/v8")},Fo={...zo,builtinModules:new Set(["assert","assert/strict","buffer","console","constants","crypto","events","fs","fs/promises","os","path","path/posix","process","punycode","querystring","stream","stream/promises","stream/web","string_decoder","timers","timers/promises","url","util","zlib"].flatMap((e)=>[e,`node:${e}`])),platformSource:cn("open-flow-engine/v8/nodejs-compat-v1")},Gd={...Fo,codeFetch:!0,platformSource:cn("open-flow-engine/v9")},Qd={...Gd,flowState:!0,platformSource:cn("open-flow-engine/v10")},Iv={...Qd,connectorProxy:!0,platformSource:cn("open-flow-engine/v11")};function qo(e){if(e=="open-flow-engine/v11")return Iv;if(e=="open-flow-engine/v10")return Qd;if(e=="open-flow-engine/v9")return Gd;if(e=="open-flow-engine/v8")return zo;if(e=="open-flow-engine/v8/nodejs-compat-v1")return Fo;if(e=="open-flow-engine/v7"||e=="open-flow-engine/v7/nodejs-compat-v1")return{...e.endsWith("/nodejs-compat-v1")?Fo:zo,workflowTools:!1,httpRequests:!1,platformSource:cn(e)};if(e=="open-flow-engine/v6"||e=="open-flow-engine/v6/nodejs-compat-v1")return{...e=="open-flow-engine/v6"?zo:Fo,workflowTools:!1,httpRequests:!1,waitAutoContinue:!1,webhookResponses:!1,platformSource:cn(e)};return}function br(e){let n=Object.values(e).filter((r)=>typeof r==="number");return Object.entries(e).filter(([r,o])=>n.indexOf(+r)===-1).map(([r,o])=>o)}function Ys(e,n="|"){return e.map((t)=>ra(t)).join(n)}function xr(e,n){if(typeof n==="bigint")return n.toString();return n}class Yd{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function wr(e){return new Yd(e)}function ea(e){return e===null||e===void 0}function qt(e){let n=e.startsWith("^")?1:0,t=e.endsWith("$")?e.length-1:e.length;return e.slice(n,t)}function ep(e,n){let t=e/n,r=Math.round(t),o=4*Number.EPSILON*Math.max(Math.abs(t),1);if(Math.abs(t-r)<o)return 0;return t-r}var Xd=Symbol("evaluating");function tp(e,n,t){let r=void 0;Object.defineProperty(e,n,{get(){if(r===Xd)return;if(r===void 0)r=Xd,r=t();return r},set(o){Object.defineProperty(e,n,{value:o})},configurable:!0})}function qe(e,n,t){Object.defineProperty(e,n,{value:t,writable:!0,enumerable:!0,configurable:!0})}function vr(e){let n=Object.getOwnPropertyDescriptor(e,"shape");return n?.get?n.get.raw:n?.value}function Ot(e){return vr(e._zod.def)??e._zod.def.shape}function np(e,n,t){Object.defineProperty(e,n,{get(){let r=t();return qe(this,n,r),r},enumerable:!0,configurable:!0})}function rp(e,n,t){if(n in e)qe(e,n,t);else e[n]=t}function un(e,n,t,r){let o=Ot(n);for(let i of t){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)np(e,i,()=>{let a=n._zod.def.shape[i];return r?r(a,i):a});else rp(e,i,r?r(s.value,i):s.value)}}function Cv(e,n){for(let t of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,t);if(!r.enumerable)continue;if(r.get)np(e,t,()=>n[t]);else rp(e,t,r.value)}}function nt(...e){let n={};for(let t of e){let r=Object.getOwnPropertyDescriptors(t);Object.assign(n,r)}return Object.defineProperties({},n)}function op(e){return JSON.stringify(e)}function ip(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var ta="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function En(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}var sp=wr(()=>{if(Fe.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function jt(e){if(En(e)===!1)return!1;let n=e.constructor;if(n===void 0)return!0;if(typeof n!=="function")return!0;let t=n.prototype;if(En(t)===!1)return!1;if(Object.prototype.hasOwnProperty.call(t,"isPrototypeOf")===!1)return!1;return!0}function na(e){if(jt(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}var Vo=new Set(["string","number","symbol"]),ap=new Set(["string","number","bigint","boolean","symbol","undefined"]);function pt(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function St(e,n,t){let r=new e._zod.constr(n??e._zod.def);if(!n||t?.parent)r._zod.parent=e;return r}function T(e){let n=e;if(!n)return{};if(typeof n==="string")return{error:()=>n};if(n?.message!==void 0){if(n?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");n.error=n.message}if(delete n.message,typeof n.error==="string")return{...n,error:()=>n.error};return n}function ra(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function cp(e){return Object.keys(e).filter((n)=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var Bo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Uo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Pv(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return un(i,e,Jo(e,n)),St(e,nt(t,{shape:i,checks:[]}))}function Jo(e,n){let t=Ot(e),r=[];for(let o of Reflect.ownKeys(n)){if(!Object.getOwnPropertyDescriptor(t,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(n[o])r.push(o)}return r}function Ev(e,n){let t=e._zod.def,r=t.checks;if(r&&r.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(Jo(e,n)),s={};return un(s,e,Reflect.ownKeys(Ot(e)).filter((a)=>!i.has(a))),St(e,nt(t,{shape:s,checks:[]}))}function Av(e,n){if(!jt(n))throw Error("Invalid input to extend: expected a plain object");let t=e._zod.def.checks;if(t&&t.length>0){let o=Ot(e);for(let i of Reflect.ownKeys(n))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return St(e,nt(e._zod.def,{shape:lp(e,n)}))}function lp(e,n){let t={};return un(t,e,Reflect.ownKeys(Ot(e))),Cv(t,n),t}function Tv(e,n){if(!jt(n))throw Error("Invalid input to safeExtend: expected a plain object");return St(e,nt(e._zod.def,{shape:lp(e,n)}))}function Ov(e,n){if(!n?._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 t={};un(t,e,Reflect.ownKeys(Ot(e))),un(t,n,Reflect.ownKeys(Ot(n)));let r=nt(e._zod.def,{shape:t,get catchall(){return n._zod.def.catchall},checks:n._zod.def.checks??[]});return St(e,r)}function up(e,n,t,r="partial"){let i=n._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=t?new Set(Jo(n,t)):void 0,c={};return un(c,n,Reflect.ownKeys(Ot(n)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),St(n,nt(n._zod.def,{shape:c,checks:[]}))}function Nv(e,n,t){let r=t?new Set(Jo(n,t)):void 0,o={};return un(o,n,Reflect.ownKeys(Ot(n)),(i,s)=>r&&!r.has(s)?i:new e({type:"nonoptional",innerType:i})),St(n,nt(n._zod.def,{shape:o}))}function Qe(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue!==!0)return!0;return!1}function dp(e,n=0){if(e.aborted===!0)return!0;for(let t=n;t<e.issues.length;t++)if(e.issues[t]?.continue===!1)return!0;return!1}function rt(e,n){return n.map((t)=>{var r;return(r=t).path??(r.path=[]),t.path.unshift(e),t})}function gr(e){return typeof e==="string"?e:e?.message}function oa(e){let n=[];for(let t of e??[]){let r=t._zod.def;if(!/_(length|size)$|_equals$/.test(r.check))break;let o=r.maximum??r.length??r.size;if(o>=0)n.push([o,t])}return n}function Zo(e,n,t){var r;for(let o=n;o<e.length;o++)(r=e[o]).schema??(r.schema=t)}function ot(e,n,t){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:gr(e.inst?._zod.def?.error?.(e))??gr(i?.(e))??gr(n?.error?.(e))??gr(t.customError?.(e))??gr(t.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,n?.reportInput)a.input=e.input;return a}function Ko(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var jv=/[\uD800-\uDBFF]/;function Wo(e){let n=e.length;if(!jv.test(e))return n;let t=n;for(let r=0;r<n-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)t--,r++;return t}function Ho(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function pp(e){let n=typeof e;switch(n){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 n}function dn(...e){let[n,t,r]=e;if(typeof n==="string")return{message:n,code:"custom",input:t,inst:r};return{...n}}function fp(e,n){for(let t in n){let r=Object.getOwnPropertyDescriptor(n,t);if(r.get)Object.defineProperty(e,t,{...r,enumerable:!1});else Rv(e,t,r.value)}}function Nt(e,n,t,r=!0){return Object.defineProperty(e,n,{configurable:!0,writable:!0,enumerable:r,value:t}),t}function kr(e,n,t){return Nt(e,n,t,!1)}function Go(e,n){for(let t in e){let r=e[t];Object.defineProperty(n,t,{configurable:!0,enumerable:!0,get(){return Nt(this,t,r(this))},set(o){Nt(this,t,o)}})}return n}function Rv(e,n,t){Object.defineProperty(e,n,{configurable:!0,get(){return this==null?t:Nt(this,n,t.bind(this))},set(r){Nt(this,n,r)}})}function _v(e,n){let t=Object.getPrototypeOf(e);return n in t?void 0:t}var Xs,Ft=!1,$v={configurable:!0,get(){Ft=!0;return}};function Y(e,n,t){let r=Object.getPrototypeOf(e._zod);if(n in r&&Xs!==e._zod){Xs=void 0;return}Xs=e._zod,Object.defineProperty(r,n,{configurable:!0,get(){Object.defineProperty(this,n,$v);let o=Ft;Ft=!1;try{let i=t(this);if(Ft)delete this[n];else Object.defineProperty(this,n,{configurable:!0,writable:!0,value:i});return Ft=Ft||o,i}catch(i){throw delete this[n],Ft=Ft||o,i}},set(o){Object.defineProperty(this,n,{configurable:!0,writable:!0,value:o})}})}function Dv(e,n,t,r){let o=_v(e,n);if(!o)return;Object.defineProperty(o,n,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,n,i),i.value=t(this),Object.defineProperty(this,n,i),i.value},set(i){Object.defineProperty(this,n,{configurable:!0,writable:!0,enumerable:r,value:i})}})}var Lv="~constantCatch";function hp(e){let n=()=>e;return n[Lv]=!0,n}var mp;var ia={value:void 0,enumerable:!1},yp="captureStackTrace"in Error?Error:null;function Mv(e){let n=yp;if(n){let t=n.stackTraceLimit;if(typeof t==="number"){try{n.stackTraceLimit=0}catch{return yp=null,new e}try{return new e}finally{n.stackTraceLimit=t}}}return new e}function g(e,n,t,r){let o={};function i(p){this.def=p,this.constr=d,this.traits=new Set}i.prototype=o;let s=t,a=s&&new WeakSet;function c(p,m){if(!p._zod){ia.value=new i(m);try{Object.defineProperty(p,"_zod",ia)}finally{ia.value=void 0}}else if(p._zod.traits.has(e))return;if(p._zod.traits.add(e),n(p,m),a){let I=Object.getPrototypeOf(p),j=p._zod.constr.prototype,L=I;while(L&&L!==j)L=Object.getPrototypeOf(L);let F=L??I;if(!a.has(F))a.add(F),fp(F,s)}let y=d.prototype;for(let I in y){if(!Object.prototype.hasOwnProperty.call(y,I))continue;if(!(I in p))p[I]=y[I].bind(p)}}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(p){let m=r?.Parent?Mv(u):this;c(m,p);let y=m._zod.deferred;if(y){for(let j of y)j();m._zod.deferred=void 0}let I=globalThis.__zod_globalConfig?.postProcessor;if(I)I(m);return m}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:(p)=>{if(r?.Parent&&p instanceof r.Parent)return!0;return p?._zod?.traits?.has(e)}}),Object.defineProperty(d,"name",{value:e}),d}class It extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class An extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}}(mp=globalThis).__zod_globalConfig??(mp.__zod_globalConfig={});var Fe=globalThis.__zod_globalConfig;function Ve(e){if(e)Object.assign(Fe,e);return Fe}function zv(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,xr,2)),e.message}function Fv(e){this._zod.message=e}var qv={get:zv,set:Fv,enumerable:!0,configurable:!0},aa={value:void 0,enumerable:!1},gp=new WeakSet([Object.prototype,Error.prototype]),bp=(e,n)=>{e.name="$ZodError",aa.value=n,Object.defineProperty(e,"issues",aa),aa.value=void 0,Object.defineProperty(e,"message",qv);let t=Object.getPrototypeOf(e);if(!gp.has(t))gp.add(t),Object.defineProperty(t,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},xp=g("$ZodError",bp),ca=g("$ZodError",bp,void 0,{Parent:Error});function Vv(e,n,t){if(!Object.prototype.hasOwnProperty.call(e,n))if(n==="__proto__")Object.defineProperty(e,n,{value:t(),writable:!0,enumerable:!0,configurable:!0});else e[n]=t();return e[n]}function wp(e,n=(t)=>t.message){let t={},r=[];for(let o of e.issues)if(o.path.length>0)Vv(t,o.path[0],()=>[]).push(n(o));else r.push(n(o));return{formErrors:r,fieldErrors:t}}function vp(e,n=(t)=>t.message){let t={_errors:[]},r=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>r({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")r({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")r({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)t._errors.push(n(s));else{let c=t,l=0;while(l<a.length){let u=a[l],d=l===a.length-1;if(u==="_errors"){if(d)c._errors.push(n(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let p=c[u];if(d)p._errors.push(n(s));c=p,l++}}}};return r(e),t}function Qo(e,n){return{callee:n?.callee??e,Err:n?.Err}}var Sr=(e)=>{let n=(t,r,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)throw new It;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>ot(l,s,Ve())));throw ta(c,i?.callee??n),c}return a.value};return n},la=Sr(ca),Ir=(e)=>{let n=async(t,r,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=t._zod.run({value:r,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>ot(l,s,Ve())));throw ta(c,i?.callee??n),c}return a.value};return n},ua=Ir(ca),Xo=(e)=>(n,t,r)=>{let o=r?{...r,async:!1}:{async:!1},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)throw new It;return i.issues.length?kp(e,i.issues,o):{success:!0,data:i.value}};function kp(e,n,t){let r;return{success:!1,get error(){if(!r)r=new e(n.map((o)=>ot(o,t,Ve()))),n=void 0,t=void 0;return r},set error(o){r=o,n=void 0,t=void 0}}}var Yo=(e)=>async(n,t,r)=>{let o=r?{...r,async:!0}:{async:!0},i=n._zod.run({value:t,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?kp(e,i.issues,o):{success:!0,data:i.value}};var Uv=Symbol.for("zod.compile.invalid"),Jv=Symbol.for("zod.compile.fallback"),da=(e,n,t)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(n)!==Uv)return!0;if(r.definite===!0&&t===void 0)return!1}return Zv(e,n,t)};function Zv(e,n,t){let r=t?{...t,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Jv]=!0,i=o({value:n,issues:[]},r);else i=e._zod.run({value:n,issues:[]},r);if(i instanceof Promise)throw new It;return i.issues.length===0}var pa=async(e,n,t)=>{let r=t?{...t,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:n,issues:[]},r);if(o instanceof Promise)o=await o;return o.issues.length===0},Sp=(e)=>{let n=Sr(e),t=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return n(r,o,a,Qo(t,s))};return t};var Ip=(e)=>{let n=Sr(e),t=(r,o,i,s)=>n(r,o,i,Qo(t,s));return t};var Cp=(e)=>{let n=Ir(e),t=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await n(r,o,a,Qo(t,s))};return t};var Pp=(e)=>{let n=Ir(e),t=async(r,o,i,s)=>await n(r,o,i,Qo(t,s));return t};var Ep=(e)=>(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Xo(e)(n,t,o)};var Ap=(e)=>(n,t,r)=>Xo(e)(n,t,r);var Tp=(e)=>async(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Yo(e)(n,t,o)};var Op=(e)=>async(n,t,r)=>Yo(e)(n,t,r);var ha=/^[cC][0-9a-z]{6,}$/,ma=/^[0-9a-z]+$/,ya=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ga=/^[0-9a-vA-V]{20}$/,ba=/^[A-Za-z0-9]{27}$/,xa=/^[a-zA-Z0-9_-]{21}$/;function wa(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var va=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Kv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ka=/^([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})$/,pn=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Wv=pn(4),Hv=pn(6),Gv=pn(7),Sa=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Qv=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Xv=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Np=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,Yv=Np,ek=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,tk="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ia(){return new RegExp(tk,"u")}var Ca=/^(?:(?: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])$/,Pa=/^(([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}|:))$/,Ea=(e)=>{let n=pt(e??":");return new RegExp(`^(?:[0-9A-F]{2}${n}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${n}){5}[0-9a-f]{2}$`)},Aa=/^((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])$/,Ta=/^(([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])$/,Oa=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Na=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ja=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Ra=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,Cr=/^https?$/,_a=/^\+[1-9]\d{6,14}$/,ei=/^\d(?:[ -]?\d){11,18}$/,$a=/^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/,ti=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,jp="(?:(?:\\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 nk(e){return new RegExp(`^${e}$`)}var Da=nk(jp);function fa(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function La(e){return new RegExp(`^${fa(e)}$`)}function Ma(e){let n=["Z"];if(e.offset)n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let t=`${fa({precision:e.precision,seconds:!0})}(?:${n.join("|")})`,r=e.local?`${t}|${fa({precision:e.precision})}`:t;return new RegExp(`^${jp}T(?:${r})$`)}var za=/^[\s\S]{0,}$/,Fa=(e)=>{let n=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${n}$`)},qa=/^-?\d+n?$/,Pr=/^-?\d+$/,fn=/^-?\d+(?:\.\d+)?$/,Va=/^(?:true|false)$/i,Ba=/^null$/i;var Ua=/^undefined$/i;var Ja=/^[^A-Z]*$/,Za=/^[^a-z]*$/,Ka=/^[0-9a-fA-F]*$/;function Er(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function Ar(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var rk=/^[0-9a-fA-F]{32}$/,ok=Er(22,"=="),ik=Ar(22),sk=/^[0-9a-fA-F]{40}$/,ak=Er(27,"="),ck=Ar(27),lk=/^[0-9a-fA-F]{64}$/,uk=Er(43,"="),dk=Ar(43),pk=/^[0-9a-fA-F]{96}$/,fk=Er(64,""),hk=Ar(64),mk=/^[0-9a-fA-F]{128}$/,yk=Er(86,"=="),gk=Ar(86);var we=g("$ZodCheck",(e,n)=>{var t;e._zod??(e._zod={}),e._zod.def=n,(t=e._zod).onattach??(t.onattach=[])}),Wa=(e)=>{let n=e.value;return!ea(n)&&n.size!==void 0},Ha=(e)=>{let n=e.value;return!ea(n)&&n.length!==void 0},ni={number:"number",bigint:"bigint",object:"date"},Ga=g("$ZodCheckLessThan",(e,n)=>{we.init(e,n);let t=ni[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value<=n.value:r.value<n.value)return;r.issues.push({origin:ni[typeof r.value]??t,code:"too_big",maximum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Qa=g("$ZodCheckGreaterThan",(e,n)=>{we.init(e,n);let t=ni[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value>=n.value:r.value>n.value)return;r.issues.push({origin:ni[typeof r.value]??t,code:"too_small",minimum:typeof n.value==="object"?n.value.getTime():n.value,input:r.value,inclusive:n.inclusive,inst:e,continue:!n.abort})}}),Rp=g("$ZodCheckMultipleOf",(e,n)=>{we.init(e,n),e._zod.check=(t)=>{if(typeof t.value!==typeof n.value)throw Error("Cannot mix number and bigint in multiple_of check.");if(typeof t.value==="bigint"?n.value!==BigInt(0)&&t.value%n.value===BigInt(0):ep(t.value,n.value)===0)return;t.issues.push({origin:typeof t.value,code:"not_multiple_of",divisor:n.value,input:t.value,inst:e,continue:!n.abort})}}),_p=g("$ZodCheckNumberFormat",(e,n)=>{we.init(e,n),n.format=n.format||"float64";let t=n.format?.includes("int"),r=t?"int":"number",[o,i]=Bo[n.format];e._zod.check=(s)=>{let a=s.value;if(t){if(!Number.isInteger(a)){s.issues.push({expected:r,format:n.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){if(a>0)s.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});else s.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!n.abort});return}}if(a<o)s.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!n.abort});if(a>i)s.issues.push({origin:"number",input:a,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!n.abort})}}),$p=g("$ZodCheckBigIntFormat",(e,n)=>{we.init(e,n);let[t,r]=Uo[n.format];e._zod.check=(o)=>{let i=o.value;if(i<t)o.issues.push({origin:"bigint",input:i,code:"too_small",minimum:t,inclusive:!0,inst:e,continue:!n.abort});if(i>r)o.issues.push({origin:"bigint",input:i,code:"too_big",maximum:r,inclusive:!0,inst:e,continue:!n.abort})}}),Dp=g("$ZodCheckMaxSize",(e,n)=>{var t;we.init(e,n),(t=e._zod.def).when??(t.when=Wa),e._zod.check=(r)=>{let o=r.value;if(o.size<=n.maximum)return;r.issues.push({origin:Ko(o),code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Lp=g("$ZodCheckMinSize",(e,n)=>{var t;we.init(e,n),(t=e._zod.def).when??(t.when=Wa),e._zod.check=(r)=>{let o=r.value;if(o.size>=n.minimum)return;r.issues.push({origin:Ko(o),code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Mp=g("$ZodCheckSizeEquals",(e,n)=>{var t;we.init(e,n),(t=e._zod.def).when??(t.when=Wa),e._zod.check=(r)=>{let o=r.value,i=o.size;if(i===n.size)return;let s=i>n.size;r.issues.push({origin:Ko(o),...s?{code:"too_big",maximum:n.size}:{code:"too_small",minimum:n.size},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),zp=g("$ZodCheckMaxLength",(e,n)=>{var t;we.init(e,n),(t=e._zod.def).when??(t.when=Ha),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>n.maximum?Wo(o):i)<=n.maximum)return;let a=Ho(o);r.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Fp=g("$ZodCheckMinLength",(e,n)=>{var t;we.init(e,n),(t=e._zod.def).when??(t.when=Ha),e._zod.check=(r)=>{let o=r.value,i=o.length;if((typeof o==="string"&&i>=n.minimum&&i<n.minimum*2?Wo(o):i)>=n.minimum)return;let a=Ho(o);r.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),qp=g("$ZodCheckLengthEquals",(e,n)=>{var t;we.init(e,n),(t=e._zod.def).when??(t.when=Ha),e._zod.check=(r)=>{let o=r.value,i=o.length,s=typeof o==="string"&&i>=n.length&&i<=n.length*2?Wo(o):i;if(s===n.length)return;let a=Ho(o),c=s>n.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:n.length}:{code:"too_small",minimum:n.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!n.abort})}}),Tr=g("$ZodCheckStringFormat",(e,n)=>{var t,r;if(we.init(e,n),n.pattern)(t=e._zod).check??(t.check=(o)=>{if(n.pattern.lastIndex=0,n.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:n.format,input:o.value,...n.pattern?{pattern:n.pattern.toString()}:{},inst:e,continue:!n.abort})});else(r=e._zod).check??(r.check=()=>{})}),Vp=g("$ZodCheckRegex",(e,n)=>{Tr.init(e,n),e._zod.check=(t)=>{if(n.pattern.lastIndex=0,n.pattern.test(t.value))return;t.issues.push({origin:"string",code:"invalid_format",format:"regex",input:t.value,pattern:n.pattern.toString(),inst:e,continue:!n.abort})}}),Bp=g("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Ja),Tr.init(e,n)}),Up=g("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Za),Tr.init(e,n)}),Jp=g("$ZodCheckIncludes",(e,n)=>{we.init(e,n);let t=pt(n.includes),r=new RegExp(typeof n.position==="number"?`^.{${n.position},}${t}`:t);n.pattern=r,e._zod.check=(o)=>{if(o.value.includes(n.includes,n.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:n.includes,input:o.value,inst:e,continue:!n.abort})}}),Zp=g("$ZodCheckStartsWith",(e,n)=>{we.init(e,n);let t=new RegExp(`^${pt(n.prefix)}.*`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.startsWith(n.prefix))return;r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:n.prefix,input:r.value,inst:e,continue:!n.abort})}}),Kp=g("$ZodCheckEndsWith",(e,n)=>{we.init(e,n);let t=new RegExp(`.*${pt(n.suffix)}$`);n.pattern??(n.pattern=t),e._zod.check=(r)=>{if(r.value.endsWith(n.suffix))return;r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:n.suffix,input:r.value,inst:e,continue:!n.abort})}});function ri(e,n,t){if(e.issues.length)n.issues.push(...rt(t,e.issues))}var Wp=g("$ZodCheckProperty",(e,n)=>{we.init(e,n),e._zod.check=(t)=>{let r=n.schema._zod.run({value:t.value[n.property],issues:[]},{});if(r instanceof Promise)return r.then((o)=>ri(o,t,n.property));ri(r,t,n.property);return}}),Hp=g("$ZodCheckProperties",(e,n)=>{we.init(e,n),kr(e,Symbol.iterator,function*(){yield e});let t;e._zod.check=(r)=>{if(r.value==null){r.issues.push({expected:"object",code:"invalid_type",input:r.value,inst:e});return}t??(t=Reflect.ownKeys(n.shape).map((s)=>[s,n.shape[s]]));let o=r.value,i;for(let[s,a]of t){let c=a._zod.run({value:o[s],issues:[]},{});if(c instanceof Promise)i??(i=[]),i.push(c.then((l)=>ri(l,r,s)));else ri(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),Gp=g("$ZodCheckMimeType",(e,n)=>{we.init(e,n);let t=new Set(n.mime);e._zod.check=(r)=>{if(t.has(r.value.type))return;r.issues.push({code:"invalid_value",values:n.mime,input:r.value.type,inst:e,continue:!n.abort})}}),Qp=g("$ZodCheckOverwrite",(e,n)=>{we.init(e,n),e._zod.check=(t)=>{t.value=n.tx(t.value)}});class Xa{constructor(e=[],n={}){this.content=[],this.indent=0,this.args=e,this.closed=n}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let t=e.split(`
9
+ `).filter((i)=>i),r=Math.min(...t.map((i)=>i.length-i.trimStart().length)),o=t.map((i)=>i.slice(r)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,n=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
10
+ ${n.join(`
7
11
  `)}
8
- };`)(...Object.values(this.closed))}}var ep={major:4,minor:6,patch:5};var J=m("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ep;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Ve(a),d;for(let h of c){if(h._zod.def.when){if(pd(a))continue;if(!h._zod.def.when(a))continue}else if(u)continue;let g=a.issues.length,y=h._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new ut;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===g)return;if(xs(a.issues,g,e),!u)u=Ve(a,g)});else{if(a.issues.length===g)continue;if(xs(a.issues,g,e),!u)u=Ve(a,g)}}if(d)return d.then(()=>a);return a},s=(a,c,l)=>{if(Ve(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new ut;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new ut;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return Qn(this,"~standard",wa(this))},set "~standard"(e){yt(this,"~standard",e)}}),yp=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>Ue(n,t,Ae()))}:{value:e.value};async function Fv(e,t){let n={async:!0};return yp(await e._zod.run({value:t,issues:[]},n),n)}function wa(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return yp(r,n)}catch(r){}return Fv(e,t)},vendor:"zod",version:1}}var ln=m("$ZodString",(e,t)=>{J.init(e,t),e._zod.pattern=t.pattern??ra,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ae=m("$ZodStringFormat",(e,t)=>{or.init(e,t),ln.init(e,t)}),bp=m("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ls),ae.init(e,t)}),wp=m("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Jt(r))}else t.pattern??(t.pattern=Jt());ae.init(e,t)}),vp=m("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Fs),ae.init(e,t)}),kp=1,Ao=2;function xp(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Mv(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return xp(e)||Ao;return Zv(e,t)}function Zv(e,t){if(!t.normalize&&t.protocol?.source===er.source&&!/^https?:\/\//i.test(e))return kp;try{if(typeof URL<"u"){let n=URL;if(typeof n.parse==="function")return n.parse(e)??Ao}return new URL(e)}catch{return Ao}}var Jv=/[\t\n\r]/g;function tp(e){return e.replace(Jv,"")}function Bv(e,t){return t.lastIndex=0,t.test(e.hostname)}function Uv(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Sp=m("$ZodURL",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{try{let r=n.value.trim(),o=Mv(r,t);if(o===kp){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}if(o===Ao){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort});return}if(o===!0){n.value=tp(r);return}if(t.hostname&&!Bv(o,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});if(t.protocol&&!Uv(o,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?o.href:tp(r);return}catch(r){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Ip=m("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ms()),ae.init(e,t)}),Cp=m("$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.pattern=t.length===void 0?Ds:qs(t.length)),ae.init(e,t)}),Ep=m("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ps),ae.init(e,t)}),Op=m("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ts),ae.init(e,t)}),jp=m("$ZodULID",(e,t)=>{t.pattern??(t.pattern=$s),ae.init(e,t)}),_p=m("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ns),ae.init(e,t)}),Rp=m("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=zs),ae.init(e,t)}),Ap=m("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=na(t)),ae.init(e,t)}),Pp=m("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ea),ae.init(e,t)}),Tp=m("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=ta(t)),ae.init(e,t)}),$p=m("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Vs),ae.init(e,t)}),Np=m("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Zs),ae.init(e,t)}),Kv=/^[0-9a-fA-F:.]+$/;function zp(e){if(!Kv.test(e))return!1;return xp(`http://[${e}]`)}var Dp=m("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Js),ae.init(e,t),e._zod.check=(n)=>{if(!zp(n.value))n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}),qp=m("$ZodMAC",(e,t)=>{t.pattern??(t.pattern=Bs(t.delimiter)),ae.init(e,t)}),Vp=m("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Us),ae.init(e,t)});function Wv(e){let t=e.split("/");if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return zp(n)}var Lp=m("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Ks),ae.init(e,t),e._zod.check=(n)=>{if(!Wv(n.value))n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}});function Fp(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var va=/^[0-9a-zA-Z+/]*={0,2}$/,Mp=m("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=va),ae.init(e,t),e._zod.check=(n)=>{if(Fp(n.value))return;n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}}),To=/^[A-Za-z0-9_-]*$/;function Gv(e){if(!To.test(e))return!1;let t=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return Fp(n)}var Zp=m("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=To),ae.init(e,t),e._zod.check=(n)=>{if(Gv(n.value))return;n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Jp=m("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Ys),ae.init(e,t)}),Hv=/[- ]/g;function Qv(e){let t=e.length,n=1,r=0;while(t){let o=e.charCodeAt(--t)-48;n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function Yv(e){if(!Io.test(e))return!1;return Qv(e.replace(Hv,""))}var Bp=m("$ZodCreditCard",(e,t)=>{t.pattern??(t.pattern=Io),ae.init(e,t),e._zod.check=(n)=>{if(Yv(n.value))return;n.issues.push({code:"invalid_format",format:"credit_card",input:n.value,inst:e,continue:!t.abort})}});function Xv(e){let t=0,n=e.length;for(let r=4;r<n;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);t=(o>=65?t*100+(o-55):t*10+(o-48))%97}return t===1}function ek(e){if(!Co.test(e))return!1;return Xv(e)}var Up=m("$ZodIBAN",(e,t)=>{t.pattern??(t.pattern=Co),ae.init(e,t),e._zod.check=(n)=>{if(ek(n.value))return;n.issues.push({code:"invalid_format",format:"iban",input:n.value,inst:e,continue:!t.abort})}});function tk(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}var Kp=m("$ZodJWT",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{if(tk(n.value,t.alg))return;n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Wp=m("$ZodCustomStringFormat",(e,t)=>{ae.init(e,t),e._zod.check=(n)=>{if(t.fn(n.value))return;n.issues.push({code:"invalid_format",format:t.format,input:n.value,inst:e,continue:!t.abort})}}),ka=m("$ZodNumber",(e,t)=>{J.init(e,t),e._zod.pattern=Bt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch(s){}let o=n.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),n}}),Gp=m("$ZodNumberFormat",(e,t)=>{Nd.init(e,t),ka.init(e,t)}),$o=m("$ZodBoolean",(e,t)=>{J.init(e,t),e._zod.pattern=sa,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Boolean(n.value)}catch(i){}let o=n.value;if(typeof o==="boolean")return n;return n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),xa=m("$ZodBigInt",(e,t)=>{J.init(e,t),e._zod.pattern=ia,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch(o){}if(typeof n.value==="bigint")return n;return n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Hp=m("$ZodBigIntFormat",(e,t)=>{zd.init(e,t),xa.init(e,t)}),Qp=m("$ZodSymbol",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o==="symbol")return n;return n.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),n}}),Yp=m("$ZodUndefined",(e,t)=>{J.init(e,t),e._zod.pattern=ca,e._zod.values=new Set([void 0]),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),n}}),Xp=m("$ZodNull",(e,t)=>{J.init(e,t),e._zod.pattern=aa,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;if(o===null)return n;return n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),ef=m("$ZodAny",(e,t)=>{J.init(e,t),e._zod.parse=(n)=>n}),tf=m("$ZodUnknown",(e,t)=>{J.init(e,t),e._zod.parse=(n)=>n}),nf=m("$ZodNever",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)}),rf=m("$ZodVoid",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(typeof o>"u")return n;return n.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),n}}),of=m("$ZodDate",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch(a){}let o=n.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return n;return n.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),n}});function np(e,t,n){if(e.issues.length)t.issues.push(...Be(n,e.issues));t.value[n]=e.value}var sf=m("$ZodArray",(e,t)=>{J.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=n?n.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>np(d,r,c)));else if(np(u,r,c),a&&u.issues.length!==0&&Ve(u))break}if(s.length)return Promise.all(s).then(()=>r);return r}});function Po(e,t,n,r,o,i){let s=n in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...Be(n,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)t.value[n]=void 0}else t.value[n]=e.value}var nk=[];function af(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:nk,o=r.length?[...t,...r]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=ld(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function cf(e,t,n,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:h}=l,g=0;for(let y in t){if(s&&n.issues.length!==g){if(Ve(n,g))break;g=n.issues.length}if(c.has(y))continue;if(y==="__proto__"){if(u==="never")a.push(y);continue}if(u==="never"){a.push(y);continue}let S=l.run({value:t[y],issues:[]},r);if(S instanceof Promise)e.push(S.then((A)=>Po(A,n,y,t,d,h)));else Po(S,n,y,t,d,h)}if(a.length)n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var rk=m("$ZodObject",(e,t)=>{J.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(t,"shape",{get:l})}let o=Gn(()=>af(t));G(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let h in u){let g=u[h]._zod;if(g.values){if(!Object.prototype.hasOwnProperty.call(d,h))Re(d,h,new Set);for(let y of g.values)d[h].add(y);if(g.optin!==void 0)d[h].add(void 0)}}return d});let i=an,s=t.catchall,a,c=je.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let h=[],g=a.shape,y=u?.abortEarly,S=l.issues.length;for(let A of a.allKeys){if(y&&l.issues.length!==S){if(Ve(l,S))break;S=l.issues.length}if(A==="__proto__")continue;let N=g[A],L=N._zod.optin,D=N._zod.optout,fe=N._zod.run({value:d[A],issues:[]},u);if(fe instanceof Promise)h.push(fe.then((ge)=>Po(ge,l,A,d,L,D)));else Po(fe,l,A,d,L,D)}if(!s)return h.length?Promise.all(h).then(()=>l):l;return cf(h,d,l,u,o.value,e,y===!0)}}),lf=m("$ZodObjectJIT",(e,t)=>{rk.init(e,t);let n=e._zod.parse,r=Gn(()=>af(t)),o=je.memoizer,i=(g)=>{let y=r.value,S=y.symbolKeys,A=new ha(["payload","ctx"],{shape:g,inst:e,memo:o,syms:S}),N=(ge)=>`shape[${ge}]._zod.run({ value: input[${ge}], issues: [] }, ctx)`,L=(ge,se)=>`
9
- let ${ge}_ab = false;
10
- for (let i = 0; i < ${ge}.issues.length; i++) {
11
- const iss = ${ge}.issues[i];
12
- iss.path = iss.path ? [${se}, ...iss.path] : [${se}];
12
+ };`)(...Object.values(this.closed))}}var Yp={major:4,minor:6,patch:7};var H=g("$ZodType",(e,n)=>{var t;e??(e={}),e._zod.def=n,e._zod.bag=e._zod.bag||{},e._zod.version=Yp;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Qe(a),d;for(let p of c){if(p._zod.def.when){if(dp(a))continue;if(!p._zod.def.when(a))continue}else if(u)continue;let m=a.issues.length,y=p._zod.check(a);if(y instanceof Promise&&l?.async===!1)throw new It;if(d||y instanceof Promise)d=(d??Promise.resolve()).then(async()=>{if(await y,a.issues.length===m)return;if(Zo(a.issues,m,e),!u)u=Qe(a,m)});else{if(a.issues.length===m)continue;if(Zo(a.issues,m,e),!u)u=Qe(a,m)}}if(d)return d.then(()=>a);return a},s=(a,c,l)=>{if(Qe(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new It;return u.then((d)=>e._zod.parse(d,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((d)=>s(d,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new It;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return kr(this,"~standard",tc(this))},set "~standard"(e){Nt(this,"~standard",e)}}),gf=(e,n)=>e.issues.length?{issues:e.issues.map((t)=>ot(t,n,Ve()))}:{value:e.value};async function bk(e,n){let t={async:!0};return gf(await e._zod.run({value:n,issues:[]},t),t)}function tc(e){return{validate:(n)=>{let t={async:!1};try{let r=e._zod.run({value:n,issues:[]},t);if(!(r instanceof Promise))return gf(r,t)}catch(r){}return bk(e,n)},vendor:"zod",version:1}}var Tn=g("$ZodString",(e,n)=>{H.init(e,n),e._zod.pattern=n.pattern??za,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=String(t.value)}catch(o){}if(typeof t.value==="string")return t;return t.issues.push({expected:"string",code:"invalid_type",input:t.value,inst:e}),t}}),he=g("$ZodStringFormat",(e,n)=>{Tr.init(e,n),Tn.init(e,n)}),bf=g("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=ka),he.init(e,n)}),xf=g("$ZodUUID",(e,n)=>{if(n.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[n.version];if(r===void 0)throw Error(`Invalid UUID version: "${n.version}"`);n.pattern??(n.pattern=pn(r))}else n.pattern??(n.pattern=pn());he.init(e,n)}),wf=g("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=Sa),he.init(e,n)}),vf=1,ai=2;function kf(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function xk(e,n){if(!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n))return kf(e)||ai;return wk(e,n)}function wk(e,n){if(!n.normalize&&n.protocol?.source===Cr.source&&!/^https?:\/\//i.test(e))return vf;try{if(typeof URL<"u"){let t=URL;if(typeof t.parse==="function")return t.parse(e)??ai}return new URL(e)}catch{return ai}}var vk=/[\t\n\r]/g;function ef(e){return e.replace(vk,"")}function kk(e,n){return n.lastIndex=0,n.test(e.hostname)}function Sk(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var Sf=g("$ZodURL",(e,n)=>{he.init(e,n),e._zod.check=(t)=>{try{let r=t.value.trim(),o=xk(r,n);if(o===vf){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:e,continue:!n.abort});return}if(o===ai){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort});return}if(o===!0){t.value=ef(r);return}if(n.hostname&&!kk(o,n.hostname))t.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:n.hostname.source,input:t.value,inst:e,continue:!n.abort});if(n.protocol&&!Sk(o,n.protocol))t.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:n.protocol.source,input:t.value,inst:e,continue:!n.abort});t.value=n.normalize?o.href:ef(r);return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}}),If=g("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=Ia()),he.init(e,n)}),Cf=g("$ZodNanoID",(e,n)=>{if(n.length!==void 0&&(!Number.isInteger(n.length)||n.length<1))throw Error(`Invalid nanoid length: ${n.length}`);n.pattern??(n.pattern=n.length===void 0?xa:wa(n.length)),he.init(e,n)}),Pf=g("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=ha),he.init(e,n)}),Ef=g("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=ma),he.init(e,n)}),Af=g("$ZodULID",(e,n)=>{n.pattern??(n.pattern=ya),he.init(e,n)}),Tf=g("$ZodXID",(e,n)=>{n.pattern??(n.pattern=ga),he.init(e,n)}),Of=g("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=ba),he.init(e,n)}),Nf=g("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Ma(n)),he.init(e,n)}),jf=g("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=Da),he.init(e,n)}),Rf=g("$ZodISOTime",(e,n)=>{n.pattern??(n.pattern=La(n)),he.init(e,n)}),_f=g("$ZodISODuration",(e,n)=>{n.pattern??(n.pattern=va),he.init(e,n)}),$f=g("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=Ca),he.init(e,n)}),Ik=/^[0-9a-fA-F:.]+$/;function Df(e){if(!Ik.test(e))return!1;return kf(`http://[${e}]`)}var Lf=g("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=Pa),he.init(e,n),e._zod.check=(t)=>{if(!Df(t.value))t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}),Mf=g("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=Ea(n.delimiter)),he.init(e,n)}),zf=g("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=Aa),he.init(e,n)});function Ck(e){let n=e.split("/");if(n.length!==2)return!1;let[t,r]=n;if(!r)return!1;let o=Number(r);if(`${o}`!==r)return!1;if(o<0||o>128)return!1;return Df(t)}var Ff=g("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=Ta),he.init(e,n),e._zod.check=(t)=>{if(!Ck(t.value))t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}});function qf(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var nc=/^[0-9a-zA-Z+/]*={0,2}$/,Vf=g("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=nc),he.init(e,n),e._zod.check=(t)=>{if(qf(t.value))return;t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}),li=/^[A-Za-z0-9_-]*$/;function Pk(e){if(!li.test(e))return!1;let n=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"=");return qf(t)}var Bf=g("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=li),he.init(e,n),e._zod.check=(t)=>{if(Pk(t.value))return;t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}}),Uf=g("$ZodE164",(e,n)=>{n.pattern??(n.pattern=_a),he.init(e,n)}),Ek=/[- ]/g;function Ak(e){let n=e.length,t=1,r=0;while(n){let o=e.charCodeAt(--n)-48;t^=1,r+=t?[0,2,4,6,8,1,3,5,7,9][o]:o}return r%10===0}function Tk(e){if(!ei.test(e))return!1;return Ak(e.replace(Ek,""))}var Jf=g("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=ei),he.init(e,n),e._zod.check=(t)=>{if(Tk(t.value))return;t.issues.push({code:"invalid_format",format:"credit_card",input:t.value,inst:e,continue:!n.abort})}});function Ok(e){let n=0,t=e.length;for(let r=4;r<t;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}for(let r=0;r<4;r++){let o=e.charCodeAt(r);n=(o>=65?n*100+(o-55):n*10+(o-48))%97}return n===1}function Nk(e){if(!ti.test(e))return!1;return Ok(e)}var Zf=g("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=ti),he.init(e,n),e._zod.check=(t)=>{if(Nk(t.value))return;t.issues.push({code:"invalid_format",format:"iban",input:t.value,inst:e,continue:!n.abort})}});function jk(e,n=null){try{let t=e.split(".");if(t.length!==3)return!1;let[r]=t;if(!r)return!1;let o=JSON.parse(atob(r));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(n&&(!("alg"in o)||o.alg!==n))return!1;return!0}catch{return!1}}var Kf=g("$ZodJWT",(e,n)=>{he.init(e,n),e._zod.check=(t)=>{if(jk(t.value,n.alg))return;t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}}),Wf=g("$ZodCustomStringFormat",(e,n)=>{he.init(e,n),e._zod.check=(t)=>{if(n.fn(t.value))return;t.issues.push({code:"invalid_format",format:n.format,input:t.value,inst:e,continue:!n.abort})}}),rc=g("$ZodNumber",(e,n)=>{H.init(e,n),e._zod.pattern=fn,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Number(t.value)}catch(s){}let o=t.value;if(typeof o==="number"&&!Number.isNaN(o)&&Number.isFinite(o))return t;let i=typeof o==="number"?Number.isNaN(o)?"NaN":!Number.isFinite(o)?String(o):void 0:void 0;return t.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),t}}),Hf=g("$ZodNumberFormat",(e,n)=>{_p.init(e,n),rc.init(e,n)}),ui=g("$ZodBoolean",(e,n)=>{H.init(e,n),e._zod.pattern=Va,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=Boolean(t.value)}catch(i){}let o=t.value;if(typeof o==="boolean")return t;return t.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),t}}),oc=g("$ZodBigInt",(e,n)=>{H.init(e,n),e._zod.pattern=qa,e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=BigInt(t.value)}catch(o){}if(typeof t.value==="bigint")return t;return t.issues.push({expected:"bigint",code:"invalid_type",input:t.value,inst:e}),t}}),Gf=g("$ZodBigIntFormat",(e,n)=>{$p.init(e,n),oc.init(e,n)}),Qf=g("$ZodSymbol",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o==="symbol")return t;return t.issues.push({expected:"symbol",code:"invalid_type",input:o,inst:e}),t}}),Xf=g("$ZodUndefined",(e,n)=>{H.init(e,n),e._zod.pattern=Ua,e._zod.values=new Set([void 0]),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"undefined",code:"invalid_type",input:o,inst:e}),t}}),Yf=g("$ZodNull",(e,n)=>{H.init(e,n),e._zod.pattern=Ba,e._zod.values=new Set([null]),e._zod.parse=(t,r)=>{let o=t.value;if(o===null)return t;return t.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),t}}),eh=g("$ZodAny",(e,n)=>{H.init(e,n),e._zod.parse=(t)=>t}),th=g("$ZodUnknown",(e,n)=>{H.init(e,n),e._zod.parse=(t)=>t}),nh=g("$ZodNever",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)}),rh=g("$ZodVoid",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(typeof o>"u")return t;return t.issues.push({expected:"void",code:"invalid_type",input:o,inst:e}),t}}),oh=g("$ZodDate",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{if(n.coerce)try{t.value=new Date(t.value)}catch(a){}let o=t.value,i=o instanceof Date;if(i&&!Number.isNaN(o.getTime()))return t;return t.issues.push({expected:"date",code:"invalid_type",input:o,...i?{received:"Invalid Date"}:{},inst:e}),t}});function ic(e,n){let t=oa(e._zod.def.checks);if(!t.length)return;let r=Math.min(...t.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=n(i.value);if(a>r&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,l]of oa(e._zod.def.checks))if(a>c&&l._zod.def.when(i)){let u=i.issues.length;return l._zod.check(i),i.issues[u].continue=!1,Zo(i.issues,u,e),i}}return o(i,s)}}var Rk=(e)=>Array.isArray(e)?e.length:-1,_k=(e)=>e instanceof Map?e.size:-1,$k=(e)=>e instanceof Set?e.size:-1;function tf(e,n,t){if(e.issues.length)n.issues.push(...rt(t,e.issues));n.value[t]=e.value}var ih=g("$ZodArray",(e,n)=>{H.init(e,n);let t=Fe.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=t?t.alloc(e,r,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=n.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>tf(d,r,c)));else if(tf(u,r,c),a&&u.issues.length!==0&&Qe(u))break}if(s.length)return Promise.all(s).then(()=>r);return r},ic(e,Rk)});function ci(e,n,t,r,o,i){let s=t in r,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;n.issues.push(...rt(t,e.issues))}if(!s&&o===void 0){if(!e.issues.length)n.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[t]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)n.value[t]=void 0}else n.value[t]=e.value}var Dk=[];function sh(e){let n=Object.keys(e.shape),t=Object.getOwnPropertySymbols(e.shape),r=t.length?t:Dk,o=r.length?[...n,...r]:n;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=cp(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(i)}}function ah(e,n,t,r,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:d,optout:p}=l,m=0;for(let y in n){if(s&&t.issues.length!==m){if(Qe(t,m))break;m=t.issues.length}if(c.has(y))continue;if(y==="__proto__"){if(u==="never")a.push(y);continue}if(u==="never"){a.push(y);continue}let I=l.run({value:n[y],issues:[]},r);if(I instanceof Promise)e.push(I.then((j)=>ci(j,t,y,n,d,p)));else ci(I,t,y,n,d,p)}if(a.length)t.issues.push({code:"unrecognized_keys",keys:a,input:n,inst:i,continue:!0});if(!e.length)return t;return Promise.all(e).then(()=>t)}var Lk=g("$ZodObject",(e,n)=>{H.init(e,n);let t=Object.getOwnPropertyDescriptor(n,"shape"),r=t?.get?t.get.raw:n.shape??{};if(r){let l=()=>{let u={...r};return Object.defineProperty(n,"shape",{value:u}),l.raw=u,u};l.raw=r,Object.defineProperty(n,"shape",{get:l})}let o=wr(()=>sh(n));Y(e,"propValues",(l)=>{let u=l.def.shape,d={};for(let p in u){let m=u[p]._zod;if(m.values){if(!Object.prototype.hasOwnProperty.call(d,p))qe(d,p,new Set);for(let y of m.values)d[p].add(y);if(m.optin!==void 0)d[p].add(void 0)}}return d});let i=En,s=n.catchall,a,c=Fe.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let d=l.value;if(!i(d))return l.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let p=[],m=a.shape,y=u?.abortEarly,I=l.issues.length;for(let j of a.allKeys){if(y&&l.issues.length!==I){if(Qe(l,I))break;I=l.issues.length}if(j==="__proto__")continue;let L=m[j],F=L._zod.optin,z=L._zod.optout,ge=L._zod.run({value:d[j],issues:[]},u);if(ge instanceof Promise)p.push(ge.then((Se)=>ci(Se,l,j,d,F,z)));else ci(ge,l,j,d,F,z)}if(!s)return p.length?Promise.all(p).then(()=>l):l;return ah(p,d,l,u,o.value,e,y===!0)}}),ch=g("$ZodObjectJIT",(e,n)=>{Lk.init(e,n);let t=e._zod.parse,r=wr(()=>sh(n)),o=Fe.memoizer,i=(m)=>{let y=r.value,I=y.symbolKeys,j=new Xa(["payload","ctx"],{shape:m,inst:e,memo:o,syms:I}),L=(Se)=>`shape[${Se}]._zod.run({ value: input[${Se}], issues: [] }, ctx)`,F=(Se,fe)=>`
13
+ let ${Se}_ab = false;
14
+ for (let i = 0; i < ${Se}.issues.length; i++) {
15
+ const iss = ${Se}.issues[i];
16
+ iss.path = iss.path ? [${fe}, ...iss.path] : [${fe}];
13
17
  payload.issues.push(iss);
14
- if (iss.continue !== true) ${ge}_ab = true;
18
+ if (iss.continue !== true) ${Se}_ab = true;
15
19
  }
16
- if (${ge}_ab && ctx && ctx.abortEarly) {
20
+ if (${Se}_ab && ctx && ctx.abortEarly) {
17
21
  payload.value = newResult;
18
22
  return payload;
19
- }`;A.write("const input = payload.value;");let D=Object.create(null),fe=0;for(let ge of y.allKeys)D[ge]=`key_${fe++}`;A.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let ge of y.allKeys){if(ge==="__proto__")continue;let se=D[ge],qe=typeof ge==="symbol"?`syms[${S.indexOf(ge)}]`:id(ge),Lt=`${qe} in input`,tn=g[ge],Ft=tn?._zod?.optin,nn=Ft!==void 0,Zn=tn?._zod?.optout==="optional";if(A.write(`const ${se} = ${N(qe)};`),nn&&Zn){let so=Ft==="optional"?`${se}_present`:`${se}.value !== undefined || ${se}_present`;A.write(`
20
- const ${se}_present = ${Lt};
21
- if (!${se}.issues.length || ${se}_present) {
22
- if (${se}.issues.length) {${L(se,qe)}
23
+ }`;j.write("const input = payload.value;");let z=Object.create(null),ge=0;for(let Se of y.allKeys)z[Se]=`key_${ge++}`;j.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let Se of y.allKeys){if(Se==="__proto__")continue;let fe=z[Se],Ge=typeof Se==="symbol"?`syms[${I.indexOf(Se)}]`:op(Se),sn=`${Ge} in input`,In=m[Se],an=In?._zod?.optin,Cn=an!==void 0,hr=In?._zod?.optout==="optional";if(j.write(`const ${fe} = ${L(Ge)};`),Cn&&hr){let $o=an==="optional"?`${fe}_present`:`${fe}.value !== undefined || ${fe}_present`;j.write(`
24
+ const ${fe}_present = ${sn};
25
+ if (!${fe}.issues.length || ${fe}_present) {
26
+ if (${fe}.issues.length) {${F(fe,Ge)}
23
27
  }
24
28
 
25
- if (${so}) {
26
- newResult[${qe}] = ${se}.value;
29
+ if (${$o}) {
30
+ newResult[${Ge}] = ${fe}.value;
27
31
  }
28
32
  }
29
33
 
30
- `)}else if(!nn)A.write(`
31
- const ${se}_present = ${Lt};
32
- if (${se}.issues.length) {${L(se,qe)}
34
+ `)}else if(!Cn)j.write(`
35
+ const ${fe}_present = ${sn};
36
+ if (${fe}.issues.length) {${F(fe,Ge)}
33
37
  }
34
- if (!${se}_present && !${se}.issues.length) {
38
+ if (!${fe}_present && !${fe}.issues.length) {
35
39
  payload.issues.push({
36
40
  code: "invalid_type",
37
41
  expected: "nonoptional",
38
42
  input: undefined,
39
- path: [${qe}]
43
+ path: [${Ge}]
40
44
  });
41
45
  if (ctx && ctx.abortEarly) {
42
46
  payload.value = newResult;
@@ -44,46 +48,46 @@ ${t.join(`
44
48
  }
45
49
  }
46
50
 
47
- if (${se}_present) {
48
- newResult[${qe}] = ${se}.value;
51
+ if (${fe}_present) {
52
+ newResult[${Ge}] = ${fe}.value;
49
53
  }
50
54
 
51
- `);else if(A.write(`
52
- if (${se}.issues.length) {${L(se,qe)}
55
+ `);else if(j.write(`
56
+ if (${fe}.issues.length) {${F(fe,Ge)}
53
57
  }
54
- `),Ft==="defaulted")A.write(`newResult[${qe}] = ${se}.value;`);else A.write(`
55
- if (${se}.value !== undefined || ${Lt}) {
56
- newResult[${qe}] = ${se}.value;
58
+ `),an==="defaulted")j.write(`newResult[${Ge}] = ${fe}.value;`);else j.write(`
59
+ if (${fe}.value !== undefined || ${sn}) {
60
+ newResult[${Ge}] = ${fe}.value;
57
61
  }
58
- `)}return A.write("payload.value = newResult;"),A.write("return payload;"),A.compile()},s,a=an,c=!je.jitless,u=c&&ad.value,d=t.catchall,h;e._zod.parse=(g,y)=>{h??(h=r.value);let S=g.value;if(!a(S))return g.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),g;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(t.shape);if(g=s(g,y),!d)return g;return cf([],S,g,y,h,e,y?.abortEarly===!0)}return n(g,y)}});function rp(e,t,n,r){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!Ve(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Ue(s,r,Ae())))}),t}var No=m("$ZodUnion",(e,t)=>{J.init(e,t),G(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),G(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),G(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),G(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>Et(i.source)).join("|")})$`)}return});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return rp(s,r,e,o);return Promise.all(s).then((a)=>rp(a,r,e,o))}});function op(e,t,n,r){let o=[];for(let i=0;i<e.length;i++)if(e[i].issues.length===0)o.push(i);if(o.length===1)return t.value=e[o[0]].value,t;if(o.length===0)t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map((i)=>i.issues.map((s)=>Ue(s,r,Ae())))});else t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:[],inclusive:!1,matches:o});return t}var uf=m("$ZodXor",(e,t)=>{No.init(e,t),t.inclusive=!1;let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return op(s,r,e,o);return Promise.all(s).then((a)=>op(a,r,e,o))}});function ok(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let o of r)if(t.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);t.set(o,null)}else t.set(o,n)}return t}var df=m("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,No.init(e,t);let n=e._zod.parse;G(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))Re(i,l,new Set);for(let d of u)i[l].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),t.options.forEach((o,i)=>{let s=Hn(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,t.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=Gn(()=>ok(t));e._zod.parse=(o,i)=>{let s=o.value;if(!an(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[t.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(t.unionFallback||i.direction==="backward")return n(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[t.discriminator],inst:e}),o}}),pf=m("$ZodIntersection",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,i=t.left._zod.run({value:o,issues:[]},r),s=t.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>ip(n,c,l));return ip(n,i,s)}});function ya(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(bt(e)&&bt(t)){let n=Object.keys(t),r=Object.keys(e).filter((i)=>n.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=ya(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}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 o=e[r],i=t[r],s=ya(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ip(e,t,n){let r=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let h=String(l.path[0]);if(!i.has(h))i.set(h,l);d=[h]}else return!1;for(let h of d){if(!r.has(h))r.set(h,{});r.get(h)[u]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of n.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=ya(t.value,n.value);if(!c.valid){if(Ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Sa=m("$ZodTuple",(e,t)=>{J.init(e,t);let n=t.items,r=je.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=sp(n,"optin"),l=sp(n,"optout");if(!t.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>n.length)o.issues.push({code:"too_big",maximum:n.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(n.length),d=t.rest?i?.abortEarly:void 0,h=!1;for(let g=0;g<n.length;g++){let y=n[g]._zod.run({value:s[g],issues:[]},i);if(y instanceof Promise)a.push(y.then((S)=>{u[g]=S}));else if(u[g]=y,d&&!h&&y.issues.length)h=Ve(y)}if(t.rest&&!h){let g=n.length-1,y=s.slice(n.length),S=o.issues.length;for(let A of y){if(d&&o.issues.length!==S){if(Ve(o,S))break;S=o.issues.length}g++;let N=t.rest._zod.run({value:A,issues:[]},i);if(N instanceof Promise)a.push(N.then((L)=>ap(L,o,g)));else ap(N,o,g)}}if(a.length)return Promise.all(a).then(()=>cp(u,o,n,s,l));return cp(u,o,n,s,l)}});function sp(e,t){for(let n=e.length-1;n>=0;n--)if(!(t==="optin"?e[n]._zod.optin!==void 0:e[n]._zod.optout==="optional"))return n+1;return 0}function ap(e,t,n){if(e.issues.length)t.issues.push(...Be(n,e.issues));t.value[n]=e.value}function cp(e,t,n,r,o){for(let i=0;i<n.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&n[i]._zod.optin==="optional"){t.value.length=i;break}if(s.issues.length){if(!a&&i>=o){t.value.length=i;break}t.issues.push(...Be(i,s.issues))}t.value[i]=s.value}for(let i=t.value.length-1;i>=r.length;i--)if(n[i]._zod.optout==="optional"&&t.value[i]===void 0)t.value.length=i;else break;return t}var ff=m("$ZodRecord",(e,t)=>{J.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!bt(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=t.keyType._zod.values;if(a&&!t.partial){r.value=n?n.alloc(e,r,{},o):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let d=t.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((y)=>Ue(y,o,Ae())),input:u,path:[u],inst:e});continue}let h=d.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[u],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{if(y.issues.length)r.issues.push(...Be(u,y.issues));r.value[h]=y.value}));else{if(g.issues.length)r.issues.push(...Be(u,g.issues));r.value[h]=g.value}}let l;for(let u in i)if(!c.has(u))if(t.mode==="loose"){if(u==="__proto__")continue;r.value[u]=i[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=t.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&Bt.test(l)&&u.issues.length){let y=t.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)u=y}if(u.issues.length){if(t.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((y)=>Ue(y,o,Ae())),input:l,path:[l],inst:e});continue}let h=u.value;if(h==="__proto__")continue;let g=t.valueType._zod.run({value:i[l],issues:[]},o);if(g instanceof Promise)s.push(g.then((y)=>{if(y.issues.length)r.issues.push(...Be(l,y.issues));r.value[h]=y.value}));else{if(g.issues.length)r.issues.push(...Be(l,g.issues));r.value[h]=g.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}}),mf=m("$ZodMap",(e,t)=>{J.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=n?n.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[l,u]of i){if(a&&r.issues.length!==c){if(Ve(r,c))break;c=r.issues.length}let d=t.keyType._zod.run({value:l,issues:[]},o),h=t.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||h instanceof Promise)s.push(Promise.all([d,h]).then(([g,y])=>{lp(g,y,r,l,i,e,o)}));else lp(d,h,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r}});function lp(e,t,n,r,o,i,s){if(e.issues.length)if(fo.has(typeof r))n.issues.push(...Be(r,e.issues));else n.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>Ue(a,s,Ae()))});if(t.issues.length)if(fo.has(typeof r))n.issues.push(...Be(r,t.issues));else n.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:t.issues.map((a)=>Ue(a,s,Ae()))});n.value.set(e.value,t.value)}var gf=m("$ZodSet",(e,t)=>{J.init(e,t);let n=je.memoizer;n?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=n?n.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let l of i){if(a&&r.issues.length!==c){if(Ve(r,c))break;c=r.issues.length}let u=t.valueType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>up(d,r)));else up(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r}});function up(e,t){if(e.issues.length)t.issues.push(...e.issues);t.value.add(e.value)}var hf=m("$ZodEnum",(e,t)=>{J.init(e,t);let n=Kn(t.entries),r=new Set(n);e._zod.values=r,G(e,"pattern",(o)=>{let i=Kn(o.def.entries).filter((s)=>fo.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>et(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:n,input:s,inst:e}),o}}),yf=m("$ZodLiteral",(e,t)=>{J.init(e,t);let n=new Set(t.values);e._zod.values=n,G(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?et(i):i?et(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(n.has(i))return r;return r.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),r}}),bf=m("$ZodFile",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(o instanceof File)return n;return n.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),n}}),wf=m("$ZodTransform",(e,t)=>{J.init(e,t),e._zod.optin="optional",je.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cn(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(n.value=s,n));if(o instanceof Promise)throw new ut;return n.value=o,n}});function dp(e,t){return e.value=t.issues.length?void 0:t.value,e}var Ia=m("$ZodOptional",(e,t)=>{J.init(e,t),G(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",G(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),G(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>dp(n,i));return dp(n,o)}return t.innerType._zod.run(n,r)}}),vf=m("$ZodExactOptional",(e,t)=>{Ia.init(e,t),G(e,"values",(n)=>n.def.innerType._zod.values),G(e,"pattern",(n)=>n.def.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),kf=m("$ZodNullable",(e,t)=>{J.init(e,t),G(e,"optin",(n)=>n.def.innerType._zod.optin),G(e,"optout",(n)=>n.def.innerType._zod.optout),G(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${Et(r.source)}|null)$`):void 0}),G(e,"values",(n)=>n.def.innerType._zod.values?new Set([...n.def.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>{if(n.value===null)return n;return t.innerType._zod.run(n,r)}}),xf=m("$ZodDefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",G(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>pp(i,t));return pp(o,t)}});function pp(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}var Sf=m("$ZodPrefault",(e,t)=>{J.init(e,t),e._zod.optin="defaulted",G(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)n.value=t.defaultValue;return t.innerType._zod.run(n,r)}}),If=m("$ZodNonOptional",(e,t)=>{J.init(e,t),G(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>fp(i,e));return fp(o,e)}});function fp(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}var Cf=m("$ZodSuccess",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cn("ZodSuccess");let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>(n.value=i.issues.length===0,n));return n.value=o.issues.length===0,n}});function mp(e,t,n,r){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>Ue(o,r,Ae()))},input:e.value}),e}var Ef=m("$ZodCatch",(e,t)=>{J.init(e,t),G(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),G(e,"optout",(n)=>n.def.innerType._zod.optout),G(e,"values",(n)=>n.def.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>mp(n,i,t,r));return mp(n,o,t,r)}}),Of=m("$ZodNaN",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>{if(typeof n.value!=="number"||!Number.isNaN(n.value))return n.issues.push({input:n.value,inst:e,expected:"nan",code:"invalid_type"}),n;return n}}),Ca=m("$ZodPipe",(e,t)=>{J.init(e,t),G(e,"values",(n)=>n.def.in._zod.values),G(e,"optin",(n)=>n.def.in._zod.optin),G(e,"optout",(n)=>n.def.out._zod.optout),G(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let i=t.out._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>jo(s,t.in,r));return jo(i,t.in,r)}let o=t.in._zod.run(n,r);if(o instanceof Promise)return o.then((i)=>jo(i,t.out,r));return jo(o,t.out,r)}});function jo(e,t,n){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},n)}var zo=m("$ZodCodec",(e,t)=>{J.init(e,t),G(e,"values",(n)=>n.def.in._zod.values),G(e,"optin",(n)=>n.def.in._zod.optin),G(e,"optout",(n)=>n.def.out._zod.optout),G(e,"propValues",(n)=>n.def.in._zod.propValues),e._zod.parse=(n,r)=>{if((r.direction||"forward")==="forward"){let i=t.in._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>_o(s,t,r));return _o(i,t,r)}else{let i=t.out._zod.run(n,r);if(i instanceof Promise)return i.then((s)=>_o(s,t,r));return _o(i,t,r)}}});function _o(e,t,n){if(e.issues.length)return e.aborted=!0,e;if((n.direction||"forward")==="forward"){let o=t.transform(e.value,e);if(o instanceof Promise)return o.then((i)=>Ro(e,i,t.out,n));return Ro(e,o,t.out,n)}else{let o=t.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>Ro(e,i,t.in,n));return Ro(e,o,t.in,n)}}function Ro(e,t,n,r){if(e.issues.length)return e.aborted=!0,e;return n._zod.run({value:t,issues:e.issues},r)}var jf=m("$ZodPreprocess",(e,t)=>{Ca.init(e,t)}),_f=m("$ZodReadonly",(e,t)=>{J.init(e,t),G(e,"propValues",(n)=>n.def.innerType._zod.propValues),G(e,"values",(n)=>n.def.innerType._zod.values),G(e,"optin",(n)=>n.def.innerType?._zod?.optin),G(e,"optout",(n)=>n.def.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);if(o instanceof Promise)return o.then(gp);return gp(o)}});function gp(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function ik(e){let t=e._zod.def,n=t.pattern,r=!!t.format?.includes("int"),o,i;for(let a of t.checks??[]){let c=a._zod.def;if(c.pattern)n=c.pattern;r||(r=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;if(l!==void 0&&(o===void 0||l>o))o=l;if(u!==void 0&&(i===void 0||u<i))i=u}if(n)return n.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return oa({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===Bt?tr:s)?.source}function ba(e){let t=e._zod.def,n=e._zod.pattern?.source,r=t.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ba(r);if(n&&o&&i&&i!==o)return n.replace(Et(o),()=>Et(i));return n}if(t.options){let o=t.options.map(ba);if(o.every(Boolean))return`^(${o.map((i)=>Et(i)).join("|")})$`}return ik(e)}var Rf=m("$ZodTemplateLiteral",(e,t)=>{J.init(e,t);let n=[];for(let r of t.parts)if(typeof r==="object"&&r!==null){let o=ba(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);n.push(Et(o))}else if(r===null||cd.has(typeof r))n.push(et(`${r}`));else throw Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${n.join("")}$`),e._zod.parse=(r,o)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:e,code:"invalid_format",format:t.format??"template_literal",pattern:e._zod.pattern.source}),r;return r}}),Af=m("$ZodFunction",(e,t)=>(J.init(e,t),Object.defineProperty(e,"_def",{value:t}),e._zod.def=t,e.implement=(n)=>{if(typeof n!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?Os(e._def.input,r):r,i=Reflect.apply(n,this,o);if(e._def.output)return Os(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(n)=>{if(typeof n!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await js(e._def.input,r):r,i=await Reflect.apply(n,this,o);if(e._def.output)return await js(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(n,r)=>{if(typeof n.value!=="function")return n.issues.push({code:"invalid_type",expected:"function",input:n.value,inst:e}),n;if(e._def.output&&e._def.output._zod.def.type==="promise")n.value=e.implementAsync(n.value);else n.value=e.implement(n.value);return n},e.input=(...n)=>{let r=e.constructor;if(Array.isArray(n[0]))return new r({type:"function",input:new Sa({type:"tuple",items:n[0],rest:n[1]}),output:e._def.output});return new r({type:"function",input:n[0],output:e._def.output})},e.output=(n)=>new e.constructor({type:"function",input:e._def.input,output:n}),e)),Pf=m("$ZodPromise",(e,t)=>{J.init(e,t),e._zod.parse=(n,r)=>Promise.resolve(n.value).then((o)=>t.innerType._zod.run({value:o,issues:[]},r))}),Tf=m("$ZodLazy",(e,t)=>{J.init(e,t),nd(e._zod,"innerType",()=>{let n=t;if(!n._cachedInner)n._cachedInner=t.getter();return n._cachedInner}),G(e,"pattern",(n)=>n.innerType?._zod?.pattern),G(e,"propValues",(n)=>n.innerType?._zod?.propValues),G(e,"optin",(n)=>n.innerType?._zod?.optin??void 0),G(e,"optout",(n)=>n.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),$f=m("$ZodCustom",(e,t)=>{ue.init(e,t),J.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=(n)=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then((i)=>hp(i,n,r,e));hp(o,n,r,e);return}});function hp(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;t.issues.push(Zt(o))}}class zf extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var Oa="~memo",Nf=[];function Df(e){return e!==null&&typeof e==="object"}function Ea(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}var qf=new WeakMap,ir=0,Vo=1,sr=2;function Lo(e,t,n){let r=qf.get(e);if(r!==void 0)return r?sr:ir;if(t.has(e))return sr;t.add(e);let o=ir,i=(u)=>{if(o!==sr&&u?._zod){let d=Lo(u,t,n);if(d>o)o=d}},s=(u,d)=>{let h=ir;for(let g of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,g);if(d&&!y.enumerable)continue;let S=y.get?Vo:y.value?._zod?Lo(y.value,t,n):ir;if(S>h)h=S}return h},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=Hn(c);a(u?s(u,!0):Vo),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(n?e._zod.innerType:void 0);a(u?Lo(u,t,!1):Vo);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 u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let h=d.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let g of h)i(g)}}return t.delete(e),ak(e,o)}function ak(e,t){if(t!==Vo)qf.set(e,t===sr);return t}function ck(e,t){let n=e.buckets.get(t);if(!n)n=new WeakMap,e.buckets.set(t,n);return n}var Do,qo=[],lk={alloc(e,t,n){let r=Do;if(!r)return n;Do=void 0;let o={value:n,issues:null};return r.set(t.value,o),qo.push(o),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let n=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&uk(i,o.value))throw new zf;return n(o,i)};if(e._zod.parse=r,e._zod.run===n)e._zod.run=r})},attach(e){var t;let n,r=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(n===void 0){let N=Lo(e,new Set,!1);if(N===ir){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(N===sr||r)n=!0;else r=!0}let u=c.value;if(!Df(u))return s(c,l);let d=l[Oa];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[Oa]=d;let h;if(o===l)h=i;else h=ck(d,e),o=l,i=h;let g=h.get(u);if(g){if(c.value=g.value,g.issues){if(g.issues.length)c.issues.push(...Ea(g.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(g.value);return c}Do=h;let y=qo.length,S=s(c,l);Do=void 0;let A=qo.length>y?qo.pop():void 0;if(S instanceof Promise)return S.then((N)=>{if(A)A.issues=N.issues.length?Ea(N.issues):Nf;return N});if(A)A.issues=S.issues.length?Ea(S.issues):Nf;return S};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function Vf(){return lk}function uk(e,t){let n=e[Oa]?.backEdges;return n!==void 0&&Df(t)&&n.has(t)}var dk=()=>{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(i){return e[i]??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 o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=fd(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ks(i.values[0])}`;return`Invalid option: expected one of ${ys(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${n[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${ys(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function ja(){return{localeError:dk()}}var Lf;class Ff{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==="object"&&"id"in n)this._idmap.set(n.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return 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 pk(){return new Ff}(Lf=globalThis).__zod_globalRegistry??(Lf.__zod_globalRegistry=pk());var Le=globalThis.__zod_globalRegistry;function Mf(e){if(e.checks)e.checks=[...e.checks];return e}function Zf(e,t){return new e(Mf({type:"string",...j(t)}))}function _a(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...j(t)})}function Ra(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...j(t)})}function Aa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...j(t)})}function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...j(t)})}function Ta(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...j(t)})}function $a(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...j(t)})}function Fo(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...j(t)})}function Na(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...j(t)})}function za(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...j(t)})}function Da(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...j(t)})}function qa(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...j(t)})}function Va(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...j(t)})}function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...j(t)})}function Fa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...j(t)})}function Ma(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...j(t)})}function Za(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...j(t)})}function Jf(e,t){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...j(t)})}function Ja(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...j(t)})}function Ba(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...j(t)})}function Ua(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...j(t)})}function Ka(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...j(t)})}function Wa(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...j(t)})}function Bf(e,t){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...j(t)})}function Uf(e,t){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...j(t)})}function Ga(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...j(t)})}function Mo(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...j(t)})}function Zo(e,t){return new e({type:"string",format:"date",check:"string_format",...j(t)})}function Jo(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...j(t)})}function Bo(e,t){return new e({type:"string",format:"duration",check:"string_format",...j(t)})}function Kf(e,t){return new e(Mf({type:"number",checks:[],...j(t)}))}function Wf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...j(t)})}function Gf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...j(t)})}function Hf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...j(t)})}function Qf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...j(t)})}function Yf(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...j(t)})}function Xf(e,t){return new e({type:"boolean",...j(t)})}function em(e,t){return new e({type:"bigint",...j(t)})}function tm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...j(t)})}function nm(e,t){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...j(t)})}function rm(e,t){return new e({type:"symbol",...j(t)})}function om(e,t){return new e({type:"undefined",...j(t)})}function im(e,t){return new e({type:"null",...j(t)})}function sm(e){return new e({type:"any"})}function am(e){return new e({type:"unknown"})}function cm(e,t){return new e({type:"never",...j(t)})}function lm(e,t){return new e({type:"void",...j(t)})}function um(e,t){return new e({type:"date",...j(t)})}function dm(e,t){return new e({type:"nan",...j(t)})}function jt(e,t){return new ma({check:"less_than",...j(t),value:e,inclusive:!1})}function tt(e,t){return new ma({check:"less_than",...j(t),value:e,inclusive:!0})}function _t(e,t){return new ga({check:"greater_than",...j(t),value:e,inclusive:!1})}function nt(e,t){return new ga({check:"greater_than",...j(t),value:e,inclusive:!0})}function pm(e){return _t(0,e)}function fm(e){return jt(0,e)}function mm(e){return tt(0,e)}function gm(e){return nt(0,e)}function un(e,t){return new $d({check:"multiple_of",...j(t),value:e})}function dn(e,t){return new Dd({check:"max_size",...j(t),maximum:e})}function Rt(e,t){return new qd({check:"min_size",...j(t),minimum:e})}function ar(e,t){return new Vd({check:"size_equals",...j(t),size:e})}function cr(e,t){return new Ld({check:"max_length",...j(t),maximum:e})}function Ut(e,t){return new Fd({check:"min_length",...j(t),minimum:e})}function lr(e,t){return new Md({check:"length_equals",...j(t),length:e})}function Uo(e,t){return new Zd({check:"string_format",format:"regex",...j(t),pattern:e})}function Ko(e){return new Jd({check:"string_format",format:"lowercase",...j(e)})}function Wo(e){return new Bd({check:"string_format",format:"uppercase",...j(e)})}function Go(e,t){return new Ud({check:"string_format",format:"includes",...j(t),includes:e})}function Ho(e,t){return new Kd({check:"string_format",format:"starts_with",...j(t),prefix:e})}function Qo(e,t){return new Wd({check:"string_format",format:"ends_with",...j(t),suffix:e})}function hm(e,t,n){return new Gd({check:"property",property:e,schema:t,...j(n)})}function Yo(e,t){return new Hd({check:"properties",shape:e,...j(t)})}function Xo(e,t){return new Qd({check:"mime_type",mime:e,...j(t)})}function wt(e){return new Yd({check:"overwrite",tx:e})}function ei(e){return wt((t)=>t.normalize(e))}function ti(){return wt((e)=>e.trim())}function ni(){return wt((e)=>e.toLowerCase())}function ri(){return wt((e)=>e.toUpperCase())}function oi(){return wt((e)=>sd(e))}function ym(e,t,n){return new e({type:"array",element:t,...j(n)})}function bm(e,t){return new e({type:"file",...j(t)})}function wm(e,t,n){let r=j(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function vm(e,t,n){return new e({type:"custom",check:"custom",fn:t,...j(n)})}function km(e,t){let n=mk((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(Zt(o,r.value,n._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(Zt(i))}},e(r.value,r)),t);return n}function mk(e,t){let n=new ue({check:"custom",...j(t)});return n._zod.check=e,n}function xm(e){let t=new ue({check:"describe"});return t._zod.onattach=[(n)=>{let r=Le.get(n)??{};Le.add(n,{...r,description:e})}],t._zod.check=()=>{},t}function Sm(e){let t=new ue({check:"meta"});return t._zod.onattach=[(n)=>{let r=Le.get(n)??{};Le.add(n,{...r,...e})}],t._zod.check=()=>{},t}function Im(e,t){let n=j(t),r=n.truthy??["true","1","yes","on","y","enabled"],o=n.falsy??["false","0","no","off","n","disabled"];if(n.case!=="sensitive")r=r.map((g)=>typeof g==="string"?g.toLowerCase():g),o=o.map((g)=>typeof g==="string"?g.toLowerCase():g);let i=new Set(r),s=new Set(o),a=e.Codec??zo,c=e.Boolean??$o,u=new(e.String??ln)({type:"string",error:n.error}),d=new c({type:"boolean",error:n.error}),h=new a({type:"pipe",in:u,out:d,transform:(g,y)=>{let S=g;if(n.case!=="sensitive")S=S.toLowerCase();if(i.has(S))return!0;else if(s.has(S))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:h,continue:!1}),{}},reverseTransform:(g,y)=>{if(g===!0)return r[0]||"true";else return o[0]||"false"},error:n.error});return h._zod.bag.truthy=r,h._zod.bag.falsy=o,h._zod.bag.case=n.case??"insensitive",h}function pn(e,t,n,r={}){let o=j(r),i={check:"string_format",type:"string",format:t,fn:typeof n==="function"?n:(a)=>n.test(a),...o};if(n instanceof RegExp)i.pattern=n;return new e(i)}function ur(e,...t){for(let n of t)for(let r of Reflect.ownKeys(n))if(Object.prototype.propertyIsEnumerable.call(n,r))Re(e,r,n[r]);return e}function pr(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Le,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 Ee(e,t,n,r,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:r.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(n,i),!0}function de(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,n.schemaPath.includes(e))i.cycle=n.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let h=s.schema,g=t.processors[o.type];if(!g)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);g(e,t,h,u)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;de(d,t,u),t.seen.get(d).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)ur(s.schema,c);if(t.io==="input"&&$e(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function Cm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function fr(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 s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,h=e.external.uri??((y)=>y);if(d)return{ref:h(d)};let g=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=g,{defId:g,ref:`${h("__shared")}#/${a}/${Cm(g)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===n&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Cm(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
62
+ `)}return j.write("payload.value = newResult;"),j.write("return payload;"),j.compile()},s,a=En,c=!Fe.jitless,u=c&&sp.value,d=n.catchall,p;e._zod.parse=(m,y)=>{p??(p=r.value);let I=m.value;if(!a(I))return m.issues.push({expected:"object",code:"invalid_type",input:I,inst:e}),m;if(c&&u&&y?.async===!1&&y.jitless!==!0){if(!s)s=i(n.shape);if(m=s(m,y),!d)return m;return ah([],I,m,y,p,e,y?.abortEarly===!0)}return t(m,y)}});function nf(e,n,t,r){for(let i of e)if(i.issues.length===0)return n.value=i.value,n;let o=e.filter((i)=>!Qe(i));if(o.length===1)return n.value=o[0].value,o[0];return n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>ot(s,r,Ve())))}),n}var di=g("$ZodUnion",(e,n)=>{H.init(e,n),Y(e,"optin",(r)=>r.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":r.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),Y(e,"optout",(r)=>r.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),Y(e,"values",(r)=>{if(r.def.options.every((o)=>o._zod.values))return new Set(r.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),Y(e,"pattern",(r)=>{if(r.def.options.every((o)=>o._zod.pattern)){let o=r.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>qt(i.source)).join("|")})$`)}return});let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return nf(s,r,e,o);return Promise.all(s).then((a)=>nf(a,r,e,o))}});function rf(e,n,t,r){let o=[];for(let i=0;i<e.length;i++)if(e[i].issues.length===0)o.push(i);if(o.length===1)return n.value=e[o[0]].value,n;if(o.length===0)n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:e.map((i)=>i.issues.map((s)=>ot(s,r,Ve())))});else n.issues.push({code:"invalid_union",input:n.value,inst:t,errors:[],inclusive:!1,matches:o});return n}var lh=g("$ZodXor",(e,n)=>{di.init(e,n),n.inclusive=!1;let t=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(t)return t(r,o);let i=!1,s=[];for(let a of n.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else s.push(c)}if(!i)return rf(s,r,e,o);return Promise.all(s).then((a)=>rf(a,r,e,o))}});function Mk(e){let n=new Map;for(let t of e.options){let r=t._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(t)}"`);for(let o of r)if(n.has(o)){if(o!==void 0)throw Error(`Duplicate discriminator value "${String(o)}"`);n.set(o,null)}else n.set(o,t)}return n}var uh=g("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,di.init(e,n);let t=e._zod.parse;Y(e,"propValues",(o)=>{let i={},s=0;for(let a of o.def.options){let c=a._zod.propValues;if(!c||Object.keys(c).length===0)throw Error(`Invalid discriminated union option at index "${o.def.options.indexOf(a)}"`);if(c[o.def.discriminator]?.has(void 0))s++;for(let[l,u]of Object.entries(c)){if(!Object.prototype.hasOwnProperty.call(i,l))qe(i,l,new Set);for(let d of u)i[l].add(d)}}if(!o.def.unionFallback&&s>1)i[o.def.discriminator]?.delete(void 0);return i}),n.options.forEach((o,i)=>{let s=vr(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,n.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=wr(()=>Mk(n));e._zod.parse=(o,i)=>{let s=o.value;if(!En(s))return o.issues.push({code:"invalid_type",expected:"object",input:s,inst:e}),o;let a=s?.[n.discriminator],c=r.value.get(a);if(c&&(a!==void 0||i.direction!=="backward"))return c._zod.run(o,i);if(n.unionFallback||i.direction==="backward")return t(o,i);return o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:n.discriminator,options:Array.from(r.value.keys()).filter((l)=>r.value.get(l)!==null),input:s,path:[n.discriminator],inst:e}),o}}),dh=g("$ZodIntersection",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{let o=t.value,i=n.left._zod.run({value:o,issues:[]},r),s=n.right._zod.run({value:o,issues:[]},r);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>of(t,c,l));return of(t,i,s)}});function Ya(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e===+n)return{valid:!0,data:e};if(jt(e)&&jt(n)){let t=Object.keys(n),r=Object.keys(e).filter((i)=>t.indexOf(i)!==-1),o={...e,...n};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of r){if(i==="__proto__")continue;let s=Ya(e[i],n[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};let t=[];for(let r=0;r<e.length;r++){let o=e[r],i=n[r],s=Ya(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[r,...s.mergeErrorPath]};t.push(s.data)}return{valid:!0,data:t}}return{valid:!1,mergeErrorPath:[]}}function of(e,n,t){let r=new Map,o,i=new Map,s=(l,u)=>{let d;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),d=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let p=String(l.path[0]);if(!i.has(p))i.set(p,l);d=[p]}else return!1;for(let p of d){if(!r.has(p))r.set(p,{});r.get(p)[u]=!0}return!0};for(let l of n.issues)if(!s(l,"l"))e.issues.push(l);for(let l of t.issues)if(!s(l,"r"))e.issues.push(l);let a=[...r].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=Ya(n.value,t.value);if(!c.valid){if(Qe(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var sc=g("$ZodTuple",(e,n)=>{H.init(e,n);let t=n.items,r=Fe.memoizer;r?.attach(e),e._zod.parse=(o,i)=>{let s=o.value;if(!Array.isArray(s))return o.issues.push({input:s,inst:e,expected:"tuple",code:"invalid_type"}),o;o.value=r?r.alloc(e,o,[],i):[];let a=[],c=sf(t,"optin"),l=sf(t,"optout");if(!n.rest){if(s.length<c)return o.issues.push({code:"too_small",minimum:c,inclusive:!0,input:s,inst:e,origin:"array"}),o;if(s.length>t.length)o.issues.push({code:"too_big",maximum:t.length,inclusive:!0,input:s,inst:e,origin:"array"})}let u=Array(t.length),d=n.rest?i?.abortEarly:void 0,p=!1;for(let m=0;m<t.length;m++){let y=t[m]._zod.run({value:s[m],issues:[]},i);if(y instanceof Promise)a.push(y.then((I)=>{u[m]=I}));else if(u[m]=y,d&&!p&&y.issues.length)p=Qe(y)}if(n.rest&&!p){let m=t.length-1,y=s.slice(t.length),I=o.issues.length;for(let j of y){if(d&&o.issues.length!==I){if(Qe(o,I))break;I=o.issues.length}m++;let L=n.rest._zod.run({value:j,issues:[]},i);if(L instanceof Promise)a.push(L.then((F)=>af(F,o,m)));else af(L,o,m)}}if(a.length)return Promise.all(a).then(()=>cf(u,o,t,s,l));return cf(u,o,t,s,l)}});function sf(e,n){for(let t=e.length-1;t>=0;t--)if(!(n==="optin"?e[t]._zod.optin!==void 0:e[t]._zod.optout==="optional"))return t+1;return 0}function af(e,n,t){if(e.issues.length)n.issues.push(...rt(t,e.issues));n.value[t]=e.value}function cf(e,n,t,r,o){for(let i=0;i<t.length;i++){let s=e[i],a=i<r.length;if(!a&&i>=o&&t[i]._zod.optin==="optional"){n.value.length=i;break}if(s.issues.length){if(!a&&i>=o){n.value.length=i;break}n.issues.push(...rt(i,s.issues))}n.value[i]=s.value}for(let i=n.value.length-1;i>=r.length;i--)if(t[i]._zod.optout==="optional"&&n.value[i]===void 0)n.value.length=i;else break;return n}var ph=g("$ZodRecord",(e,n)=>{H.init(e,n);let t=Fe.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!jt(i))return r.issues.push({expected:"record",code:"invalid_type",input:i,inst:e}),r;let s=[],a=n.keyType._zod.values;if(a&&!n.partial){r.value=t?t.alloc(e,r,{},o):{};let c=new Set;for(let u of a)if(typeof u==="string"||typeof u==="number"||typeof u==="symbol"){if(c.add(typeof u==="number"?u.toString():u),u==="__proto__")continue;let d=n.keyType._zod.run({value:u,issues:[]},o);if(d instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(d.issues.length){r.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map((y)=>ot(y,o,Ve())),input:u,path:[u],inst:e});continue}let p=d.value;if(p==="__proto__")continue;let m=n.valueType._zod.run({value:i[u],issues:[]},o);if(m instanceof Promise)s.push(m.then((y)=>{if(y.issues.length)r.issues.push(...rt(u,y.issues));r.value[p]=y.value}));else{if(m.issues.length)r.issues.push(...rt(u,m.issues));r.value[p]=m.value}}let l;for(let u in i)if(!c.has(u))if(n.mode==="loose"){if(u==="__proto__")continue;r.value[u]=i[u]}else l=l??[],l.push(u);if(l&&l.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:l,continue:!0})}else{r.value=t?t.alloc(e,r,{},o):{};let c;for(let l of Reflect.ownKeys(i)){if(l==="__proto__")continue;if(!Object.prototype.propertyIsEnumerable.call(i,l))continue;let u=n.keyType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(typeof l==="string"&&fn.test(l)&&u.issues.length){let y=n.keyType._zod.run({value:Number(l),issues:[]},o);if(y instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(y.issues.length===0)u=y}if(u.issues.length){if(n.mode==="loose")r.value[l]=i[l];else if(a)c=c??[],c.push(l);else r.issues.push({code:"invalid_key",origin:"record",issues:u.issues.map((y)=>ot(y,o,Ve())),input:l,path:[l],inst:e});continue}let p=u.value;if(p==="__proto__")continue;let m=n.valueType._zod.run({value:i[l],issues:[]},o);if(m instanceof Promise)s.push(m.then((y)=>{if(y.issues.length)r.issues.push(...rt(l,y.issues));r.value[p]=y.value}));else{if(m.issues.length)r.issues.push(...rt(l,m.issues));r.value[p]=m.value}}if(c&&c.length>0)r.issues.push({code:"unrecognized_keys",input:i,inst:e,keys:c,continue:!0})}if(s.length)return Promise.all(s).then(()=>r);return r}}),fh=g("$ZodMap",(e,n)=>{H.init(e,n);let t=Fe.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Map))return r.issues.push({expected:"map",code:"invalid_type",input:i,inst:e}),r;let s=[];r.value=t?t.alloc(e,r,new Map,o):new Map;let a=o?.abortEarly,c=r.issues.length;for(let[l,u]of i){if(a&&r.issues.length!==c){if(Qe(r,c))break;c=r.issues.length}let d=n.keyType._zod.run({value:l,issues:[]},o),p=n.valueType._zod.run({value:u,issues:[]},o);if(d instanceof Promise||p instanceof Promise)s.push(Promise.all([d,p]).then(([m,y])=>{lf(m,y,r,l,i,e,o)}));else lf(d,p,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r},ic(e,_k)});function lf(e,n,t,r,o,i,s){if(e.issues.length)if(Vo.has(typeof r))t.issues.push(...rt(r,e.issues));else t.issues.push({code:"invalid_key",origin:"map",input:o,inst:i,issues:e.issues.map((a)=>ot(a,s,Ve()))});if(n.issues.length)if(Vo.has(typeof r))t.issues.push(...rt(r,n.issues));else t.issues.push({origin:"map",code:"invalid_element",input:o,inst:i,key:r,issues:n.issues.map((a)=>ot(a,s,Ve()))});t.value.set(e.value,n.value)}var hh=g("$ZodSet",(e,n)=>{H.init(e,n);let t=Fe.memoizer;t?.attach(e),e._zod.parse=(r,o)=>{let i=r.value;if(!(i instanceof Set))return r.issues.push({input:i,inst:e,expected:"set",code:"invalid_type"}),r;let s=[];r.value=t?t.alloc(e,r,new Set,o):new Set;let a=o?.abortEarly,c=r.issues.length;for(let l of i){if(a&&r.issues.length!==c){if(Qe(r,c))break;c=r.issues.length}let u=n.valueType._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((d)=>uf(d,r)));else uf(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r},ic(e,$k)});function uf(e,n){if(e.issues.length)n.issues.push(...e.issues);n.value.add(e.value)}var mh=g("$ZodEnum",(e,n)=>{H.init(e,n);let t=br(n.entries),r=new Set(t);e._zod.values=r,Y(e,"pattern",(o)=>{let i=br(o.def.entries).filter((s)=>Vo.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>pt(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(r.has(s))return o;return o.issues.push({code:"invalid_value",values:t,input:s,inst:e}),o}}),yh=g("$ZodLiteral",(e,n)=>{H.init(e,n);let t=new Set(n.values);e._zod.values=t,Y(e,"pattern",(r)=>{let o=r.def.values;return new RegExp(o.length?`^(${o.map((i)=>typeof i==="string"?pt(i):i?pt(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(r,o)=>{let i=r.value;if(t.has(i))return r;return r.issues.push({code:"invalid_value",values:n.values,input:i,inst:e}),r}}),gh=g("$ZodFile",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{let o=t.value;if(o instanceof File)return t;return t.issues.push({expected:"file",code:"invalid_type",input:o,inst:e}),t}}),bh=g("$ZodTransform",(e,n)=>{H.init(e,n),e._zod.optin="optional",Fe.memoizer?.guard(e),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new An(e.constructor.name);let o=n.transform(t.value,t);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(t.value=s,t));if(o instanceof Promise)throw new It;return t.value=o,t}});function df(e,n){return e.value=n.issues.length?void 0:n.value,e}var ac=g("$ZodOptional",(e,n)=>{H.init(e,n),Y(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Y(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Y(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${qt(r.source)})?$`):void 0}),e._zod.parse=(t,r)=>{if(t.value===void 0){if(n.innerType._zod.optin!=="defaulted")return t;let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>df(t,i));return df(t,o)}return n.innerType._zod.run(t,r)}}),xh=g("$ZodExactOptional",(e,n)=>{ac.init(e,n),Y(e,"values",(t)=>t.def.innerType._zod.values),Y(e,"pattern",(t)=>t.def.innerType._zod.pattern),e._zod.parse=(t,r)=>n.innerType._zod.run(t,r)}),wh=g("$ZodNullable",(e,n)=>{H.init(e,n),Y(e,"optin",(t)=>t.def.innerType._zod.optin),Y(e,"optout",(t)=>t.def.innerType._zod.optout),Y(e,"pattern",(t)=>{let r=t.def.innerType._zod.pattern;return r?new RegExp(`^(${qt(r.source)}|null)$`):void 0}),Y(e,"values",(t)=>t.def.innerType._zod.values?new Set([...t.def.innerType._zod.values,null]):void 0),e._zod.parse=(t,r)=>{if(t.value===null)return t;return n.innerType._zod.run(t,r)}}),vh=g("$ZodDefault",(e,n)=>{H.init(e,n),e._zod.optin="defaulted",Y(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)return t.value=n.defaultValue,t;let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>pf(i,n));return pf(o,n)}});function pf(e,n){if(e.value===void 0)e.value=n.defaultValue;return e}var kh=g("$ZodPrefault",(e,n)=>{H.init(e,n),e._zod.optin="defaulted",Y(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);if(t.value===void 0)t.value=n.defaultValue;return n.innerType._zod.run(t,r)}}),Sh=g("$ZodNonOptional",(e,n)=>{H.init(e,n),Y(e,"values",(t)=>{let r=t.def.innerType._zod.values;return r?new Set([...r].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(t,r)=>{let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>ff(i,e));return ff(o,e)}});function ff(e,n){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n});return e}var Ih=g("$ZodSuccess",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new An("ZodSuccess");let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>(t.value=i.issues.length===0,t));return t.value=o.issues.length===0,t}});function hf(e,n,t,r){if(!n.issues.length){if(e.value=n.value,n.memo)e.memo=!0;return e}return e.value=t.catchValue({...n,value:e.value,error:{issues:n.issues.map((o)=>ot(o,r,Ve()))},input:e.value}),e}var Ch=g("$ZodCatch",(e,n)=>{H.init(e,n),Y(e,"optin",(t)=>t.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),Y(e,"optout",(t)=>t.def.innerType._zod.optout),Y(e,"values",(t)=>t.def.innerType._zod.values),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run({value:t.value,issues:[]},r);if(o instanceof Promise)return o.then((i)=>hf(t,i,n,r));return hf(t,o,n,r)}}),Ph=g("$ZodNaN",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>{if(typeof t.value!=="number"||!Number.isNaN(t.value))return t.issues.push({input:t.value,inst:e,expected:"nan",code:"invalid_type"}),t;return t}}),cc=g("$ZodPipe",(e,n)=>{H.init(e,n),Y(e,"values",(t)=>t.def.in._zod.values),Y(e,"optin",(t)=>t.def.in._zod.optin),Y(e,"optout",(t)=>t.def.out._zod.optout),Y(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if(r.direction==="backward"){let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>oi(s,n.in,r));return oi(i,n.in,r)}let o=n.in._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>oi(i,n.out,r));return oi(o,n.out,r)}});function oi(e,n,t){if(e.issues.some((r)=>r.code!=="unrecognized_keys"))return e.aborted=!0,e;return n._zod.run({value:e.value,issues:e.issues},t)}var pi=g("$ZodCodec",(e,n)=>{H.init(e,n),Y(e,"values",(t)=>t.def.in._zod.values),Y(e,"optin",(t)=>t.def.in._zod.optin),Y(e,"optout",(t)=>t.def.out._zod.optout),Y(e,"propValues",(t)=>t.def.in._zod.propValues),e._zod.parse=(t,r)=>{if((r.direction||"forward")==="forward"){let i=n.in._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>ii(s,n,r));return ii(i,n,r)}else{let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>ii(s,n,r));return ii(i,n,r)}}});function ii(e,n,t){if(e.issues.length)return e.aborted=!0,e;if((t.direction||"forward")==="forward"){let o=n.transform(e.value,e);if(o instanceof Promise)return o.then((i)=>si(e,i,n.out,t));return si(e,o,n.out,t)}else{let o=n.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>si(e,i,n.in,t));return si(e,o,n.in,t)}}function si(e,n,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:n,issues:e.issues},r)}var Eh=g("$ZodPreprocess",(e,n)=>{cc.init(e,n)}),Ah=g("$ZodReadonly",(e,n)=>{H.init(e,n),Y(e,"propValues",(t)=>t.def.innerType._zod.propValues),Y(e,"values",(t)=>t.def.innerType._zod.values),Y(e,"optin",(t)=>t.def.innerType?._zod?.optin),Y(e,"optout",(t)=>t.def.innerType?._zod?.optout),e._zod.parse=(t,r)=>{if(r.direction==="backward")return n.innerType._zod.run(t,r);let o=n.innerType._zod.run(t,r);if(o instanceof Promise)return o.then(mf);return mf(o)}});function mf(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function zk(e){let n=e._zod.def,t=n.pattern,r=!!n.format?.includes("int"),o,i;for(let a of n.checks??[]){let c=a._zod.def;if(c.pattern)t=c.pattern;r||(r=!!c.format?.includes("int"));let l=c.minimum??c.length,u=c.maximum??c.length;if(l!==void 0&&(o===void 0||l>o))o=l;if(u!==void 0&&(i===void 0||u<i))i=u}if(t)return t.source;if(o!==void 0&&i!==void 0&&o>i)return"(?!)";if(o!==void 0||i!==void 0)return Fa({minimum:o,maximum:i}).source;let s=e._zod.pattern;return(r&&s===fn?Pr:s)?.source}function ec(e){let n=e._zod.def,t=e._zod.pattern?.source,r=n.innerType??e._zod.innerType;if(r){let o=r._zod.pattern?.source,i=ec(r);if(t&&o&&i&&i!==o)return t.replace(qt(o),()=>qt(i));return t}if(n.options){let o=n.options.map(ec);if(o.every(Boolean))return`^(${o.map((i)=>qt(i)).join("|")})$`}return zk(e)}var Th=g("$ZodTemplateLiteral",(e,n)=>{H.init(e,n);let t=[];for(let r of n.parts)if(typeof r==="object"&&r!==null){let o=ec(r);if(!o)throw Error(`Invalid template literal part, no pattern found: ${[...r._zod.traits].shift()}`);t.push(qt(o))}else if(r===null||ap.has(typeof r))t.push(pt(`${r}`));else throw Error(`Invalid template literal part: ${r}`);e._zod.pattern=new RegExp(`^${t.join("")}$`),e._zod.parse=(r,o)=>{if(typeof r.value!=="string")return r.issues.push({input:r.value,inst:e,expected:"string",code:"invalid_type"}),r;if(e._zod.pattern.lastIndex=0,!e._zod.pattern.test(r.value))return r.issues.push({input:r.value,inst:e,code:"invalid_format",format:n.format??"template_literal",pattern:e._zod.pattern.source}),r;return r}}),Oh=g("$ZodFunction",(e,n)=>(H.init(e,n),Object.defineProperty(e,"_def",{value:n}),e._zod.def=n,e.implement=(t)=>{if(typeof t!=="function")throw Error("implement() must be called with a function");return Object.defineProperty(function(...r){let o=e._def.input?la(e._def.input,r):r,i=Reflect.apply(t,this,o);if(e._def.output)return la(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e.implementAsync=(t)=>{if(typeof t!=="function")throw Error("implementAsync() must be called with a function");return Object.defineProperty(async function(...r){let o=e._def.input?await ua(e._def.input,r):r,i=await Reflect.apply(t,this,o);if(e._def.output)return await ua(e._def.output,i);return i},"_zod",{value:e._zod,enumerable:!1})},e._zod.parse=(t,r)=>{if(typeof t.value!=="function")return t.issues.push({code:"invalid_type",expected:"function",input:t.value,inst:e}),t;if(e._def.output&&e._def.output._zod.def.type==="promise")t.value=e.implementAsync(t.value);else t.value=e.implement(t.value);return t},e.input=(...t)=>{let r=e.constructor;if(Array.isArray(t[0]))return new r({type:"function",input:new sc({type:"tuple",items:t[0],rest:t[1]}),output:e._def.output});return new r({type:"function",input:t[0],output:e._def.output})},e.output=(t)=>new e.constructor({type:"function",input:e._def.input,output:t}),e)),Nh=g("$ZodPromise",(e,n)=>{H.init(e,n),e._zod.parse=(t,r)=>Promise.resolve(t.value).then((o)=>n.innerType._zod.run({value:o,issues:[]},r))}),jh=g("$ZodLazy",(e,n)=>{H.init(e,n),tp(e._zod,"innerType",()=>{let t=n;if(!t._cachedInner)t._cachedInner=n.getter();return t._cachedInner}),Y(e,"pattern",(t)=>t.innerType?._zod?.pattern),Y(e,"propValues",(t)=>t.innerType?._zod?.propValues),Y(e,"optin",(t)=>t.innerType?._zod?.optin??void 0),Y(e,"optout",(t)=>t.innerType?._zod?.optout??void 0),e._zod.parse=(t,r)=>e._zod.innerType._zod.run(t,r)}),Rh=g("$ZodCustom",(e,n)=>{we.init(e,n),H.init(e,n),e._zod.parse=(t,r)=>t,e._zod.check=(t)=>{let r=t.value,o=n.fn(r);if(o instanceof Promise)return o.then((i)=>yf(i,t,r,e));yf(o,t,r,e);return}});function yf(e,n,t,r){if(!e){let o={code:"custom",input:t,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};if(r._zod.def.params)o.params=r._zod.def.params;n.issues.push(dn(o))}}class $h extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var uc="~memo",_h=[];function Dh(e){return e!==null&&typeof e==="object"}function lc(e){return e.map((n)=>n.path?{...n,path:n.path.slice()}:{...n})}var Lh=new WeakMap,Or=0,mi=1,Nr=2;function yi(e,n,t){let r=Lh.get(e);if(r!==void 0)return r?Nr:Or;if(n.has(e))return Nr;n.add(e);let o=Or,i=(u)=>{if(o!==Nr&&u?._zod){let d=yi(u,n,t);if(d>o)o=d}},s=(u,d)=>{let p=Or;for(let m of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,m);if(d&&!y.enumerable)continue;let I=y.get?mi:y.value?._zod?yi(y.value,n,t):Or;if(I>p)p=I}return p},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=vr(c);a(u?s(u,!0):mi),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(t?e._zod.innerType:void 0);a(u?yi(u,n,!1):mi);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 u in c){let d=Object.getOwnPropertyDescriptor(c,u);if(!d||d.get)continue;let p=d.value;if(!p||typeof p!=="object")continue;if(p._zod)i(p);else if(Array.isArray(p))for(let m of p)i(m)}}return n.delete(e),qk(e,o)}function qk(e,n){if(n!==mi)Lh.set(e,n===Nr);return n}function Vk(e,n){let t=e.buckets.get(n);if(!t)t=new WeakMap,e.buckets.set(n,t);return t}var fi,hi=[],Bk={alloc(e,n,t){let r=fi;if(!r)return t;fi=void 0;let o={value:t,issues:null};return r.set(n.value,o),hi.push(o),t},guard(e){var n;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,r=(o,i)=>{if(i.direction!=="backward"&&Uk(i,o.value))throw new $h;return t(o,i)};if(e._zod.parse=r,e._zod.run===t)e._zod.run=r})},attach(e){var n;let t,r=!1,o,i;(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(t===void 0){let L=yi(e,new Set,!1);if(L===Or){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(L===Nr||r)t=!0;else r=!0}let u=c.value;if(!Dh(u))return s(c,l);let d=l[uc];if(!d)d={buckets:new WeakMap,backEdges:void 0},l[uc]=d;let p;if(o===l)p=i;else p=Vk(d,e),o=l,i=p;let m=p.get(u);if(m){if(c.value=m.value,m.issues){if(m.issues.length)c.issues.push(...lc(m.issues))}else c.memo=!0,d.backEdges??(d.backEdges=new WeakSet),d.backEdges.add(m.value);return c}fi=p;let y=hi.length,I=s(c,l);fi=void 0;let j=hi.length>y?hi.pop():void 0;if(I instanceof Promise)return I.then((L)=>{if(j)j.issues=L.issues.length?lc(L.issues):_h;return L});if(j)j.issues=I.issues.length?lc(I.issues):_h;return I};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}};function Mh(){return Bk}function Uk(e,n){let t=e[uc]?.backEdges;return t!==void 0&&Dh(n)&&t.has(n)}var Jk=()=>{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 n(i){return e[i]??null}let t={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 o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return r[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=pp(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${ra(i.values[0])}`;return`Invalid option: expected one of ${Ys(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=n(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=n(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${t[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${Ys(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};function dc(){return{localeError:Jk()}}var zh;class Fh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){let t=n[0];if(this._map.set(e,t),t&&typeof t==="object"&&"id"in t)this._idmap.set(t.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let n=this._map.get(e);if(n&&typeof n==="object"&&"id"in n)this._idmap.delete(n.id);return this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let t={...this.get(n)??{}};delete t.id;let r={...t,...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 Zk(){return new Fh}(zh=globalThis).__zod_globalRegistry??(zh.__zod_globalRegistry=Zk());var Xe=globalThis.__zod_globalRegistry;function qh(e){if(e.checks)e.checks=[...e.checks];return e}function Vh(e,n){return new e(qh({type:"string",...T(n)}))}function pc(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...T(n)})}function fc(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...T(n)})}function hc(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...T(n)})}function mc(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...T(n)})}function yc(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...T(n)})}function gc(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...T(n)})}function gi(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...T(n)})}function bc(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...T(n)})}function xc(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...T(n)})}function wc(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...T(n)})}function vc(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...T(n)})}function kc(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...T(n)})}function Sc(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...T(n)})}function Ic(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...T(n)})}function Cc(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...T(n)})}function Pc(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...T(n)})}function Bh(e,n){return new e({type:"string",format:"mac",check:"string_format",abort:!1,...T(n)})}function Ec(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...T(n)})}function Ac(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...T(n)})}function Tc(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...T(n)})}function Oc(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...T(n)})}function Nc(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...T(n)})}function Uh(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...T(n)})}function Jh(e,n){return new e({type:"string",format:"iban",check:"string_format",abort:!1,...T(n)})}function jc(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...T(n)})}function bi(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(n)})}function xi(e,n){return new e({type:"string",format:"date",check:"string_format",...T(n)})}function wi(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(n)})}function vi(e,n){return new e({type:"string",format:"duration",check:"string_format",...T(n)})}function Zh(e,n){return new e(qh({type:"number",checks:[],...T(n)}))}function Kh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(n)})}function Wh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...T(n)})}function Hh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...T(n)})}function Gh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...T(n)})}function Qh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...T(n)})}function Xh(e,n){return new e({type:"boolean",...T(n)})}function Yh(e,n){return new e({type:"bigint",...T(n)})}function em(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(n)})}function tm(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(n)})}function nm(e,n){return new e({type:"symbol",...T(n)})}function rm(e,n){return new e({type:"undefined",...T(n)})}function om(e,n){return new e({type:"null",...T(n)})}function im(e){return new e({type:"any"})}function sm(e){return new e({type:"unknown"})}function am(e,n){return new e({type:"never",...T(n)})}function cm(e,n){return new e({type:"void",...T(n)})}function lm(e,n){return new e({type:"date",...T(n)})}function um(e,n){return new e({type:"nan",...T(n)})}function Bt(e,n){return new Ga({check:"less_than",...T(n),value:e,inclusive:!1})}function ft(e,n){return new Ga({check:"less_than",...T(n),value:e,inclusive:!0})}function Ut(e,n){return new Qa({check:"greater_than",...T(n),value:e,inclusive:!1})}function ht(e,n){return new Qa({check:"greater_than",...T(n),value:e,inclusive:!0})}function dm(e){return Ut(0,e)}function pm(e){return Bt(0,e)}function fm(e){return ft(0,e)}function hm(e){return ht(0,e)}function On(e,n){return new Rp({check:"multiple_of",...T(n),value:e})}function Nn(e,n){return new Dp({check:"max_size",...T(n),maximum:e})}function Jt(e,n){return new Lp({check:"min_size",...T(n),minimum:e})}function jr(e,n){return new Mp({check:"size_equals",...T(n),size:e})}function Rr(e,n){return new zp({check:"max_length",...T(n),maximum:e})}function hn(e,n){return new Fp({check:"min_length",...T(n),minimum:e})}function _r(e,n){return new qp({check:"length_equals",...T(n),length:e})}function ki(e,n){return new Vp({check:"string_format",format:"regex",...T(n),pattern:e})}function Si(e){return new Bp({check:"string_format",format:"lowercase",...T(e)})}function Ii(e){return new Up({check:"string_format",format:"uppercase",...T(e)})}function Ci(e,n){return new Jp({check:"string_format",format:"includes",...T(n),includes:e})}function Pi(e,n){return new Zp({check:"string_format",format:"starts_with",...T(n),prefix:e})}function Ei(e,n){return new Kp({check:"string_format",format:"ends_with",...T(n),suffix:e})}function mm(e,n,t){return new Wp({check:"property",property:e,schema:n,...T(t)})}function Ai(e,n){return new Hp({check:"properties",shape:e,...T(n)})}function Ti(e,n){return new Gp({check:"mime_type",mime:e,...T(n)})}function Rt(e){return new Qp({check:"overwrite",tx:e})}function Oi(e){return Rt((n)=>n.normalize(e))}function Ni(){return Rt((e)=>e.trim())}function ji(){return Rt((e)=>e.toLowerCase())}function Ri(){return Rt((e)=>e.toUpperCase())}function _i(){return Rt((e)=>ip(e))}function ym(e,n,t){return new e({type:"array",element:n,...T(t)})}function gm(e,n){return new e({type:"file",...T(n)})}function bm(e,n,t){let r=T(t);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:n,...r})}function xm(e,n,t){return new e({type:"custom",check:"custom",fn:n,...T(t)})}function wm(e,n){let t=Wk((r)=>(r.addIssue=(o)=>{if(typeof o==="string")r.issues.push(dn(o,r.value,t._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=r.value;i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),r.issues.push(dn(i))}},e(r.value,r)),n);return t}function Wk(e,n){let t=new we({check:"custom",...T(n)});return t._zod.check=e,t}function vm(e){let n=new we({check:"describe"});return n._zod.onattach=[(t)=>{let r=Xe.get(t)??{};Xe.add(t,{...r,description:e})}],n._zod.check=()=>{},n}function km(e){let n=new we({check:"meta"});return n._zod.onattach=[(t)=>{let r=Xe.get(t)??{};Xe.add(t,{...r,...e})}],n._zod.check=()=>{},n}function Sm(e,n){let t=T(n),r=t.truthy??["true","1","yes","on","y","enabled"],o=t.falsy??["false","0","no","off","n","disabled"];if(t.case!=="sensitive")r=r.map((m)=>typeof m==="string"?m.toLowerCase():m),o=o.map((m)=>typeof m==="string"?m.toLowerCase():m);let i=new Set(r),s=new Set(o),a=e.Codec??pi,c=e.Boolean??ui,u=new(e.String??Tn)({type:"string",error:t.error}),d=new c({type:"boolean",error:t.error}),p=new a({type:"pipe",in:u,out:d,transform:(m,y)=>{let I=m;if(t.case!=="sensitive")I=I.toLowerCase();if(i.has(I))return!0;else if(s.has(I))return!1;else return y.issues.push({code:"invalid_value",expected:"stringbool",values:[...i,...s],input:y.value,inst:p,continue:!1}),{}},reverseTransform:(m,y)=>{if(m===!0)return r[0]||"true";else return o[0]||"false"},error:t.error});return p._zod.bag.truthy=r,p._zod.bag.falsy=o,p._zod.bag.case=t.case??"insensitive",p}function jn(e,n,t,r={}){let o=T(r),i={check:"string_format",type:"string",format:n,fn:typeof t==="function"?t:(a)=>t.test(a),...o};if(t instanceof RegExp)i.pattern=t;return new e(i)}function $r(e,...n){for(let t of n)for(let r of Reflect.ownKeys(t))if(Object.prototype.propertyIsEnumerable.call(t,r))qe(e,r,t[r]);return e}function Lr(e){let n=e?.target??"draft-2020-12";if(n==="draft-4")n="draft-04";if(n==="draft-7")n="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??Xe,target:n,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 Me(e,n,t,r,o){let i=typeof n.unrepresentable==="function"?n.unrepresentable({zodSchema:e,path:r.path,message:o}):n.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(t,i),!0}function ve(e,n,t={path:[],schemaPath:[]}){var r;let o=e._zod.def,i=n.seen.get(e);if(i){if(i.count++,t.schemaPath.includes(e))i.cycle=t.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:t.path};n.seen.set(e,s),n.sharedDefsExtractedFor=void 0,n.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...t,schemaPath:[...t.schemaPath,e],path:t.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,s.schema,u);else{let p=s.schema,m=n.processors[o.type];if(!m)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);m(e,n,p,u)}let d=e._zod.parent;if(d){if(!s.ref)s.ref=d;ve(d,n,u),n.seen.get(d).isParent=!0}}let c=n.metadataRegistry.get(e);if(c)$r(s.schema,c);if(n.io==="input"&&Ue(e))delete s.schema.examples,delete s.schema.default;if(n.io==="input"&&"_prefault"in s.schema)(r=s.schema).default??(r.default=s.schema._prefault);return delete s.schema._prefault,n.seen.get(e).schema}function Im(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function Mr(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=r.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let d=e.external.registry.get(s[0])?.id,p=e.external.uri??((y)=>y);if(d)return{ref:p(d)};let m=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=m,{defId:m,ref:`${p("__shared")}#/${a}/${Im(m)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===t&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+Im(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let d in u)delete u[d];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
59
63
 
60
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function jm(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let r of t){if(!r||typeof r!=="object")return;jm(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!n.includes(s))n.push(s)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var _m=new Set(["type","properties","required","additionalProperties"]),Em=["oneOf","anyOf"];function Om(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function Ha(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!_m.has(s))return null;t.push(i)}let n={},r=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(n,s))continue;let a=[];for(let l of t){let u=l.properties?.[s]??Om(l);if(u===null||u===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:Ha(a)??{allOf:a};Re(n,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:n};if(r.size)o.required=[...r];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Om(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function gk(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of _m)if(o in e)return;let n=t.filter((o)=>Em.some((i)=>Array.isArray(o[i]))),r=null;if(!n.length)r=Ha(t);else{let o=n[0],i=Em.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter((c)=>c!==o),a=o[i].map((c)=>Ha([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,ur(e,r)}function mr(e,t){let n=e.seen.get(t);if(!n)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){r(d);let g=e.seen.get(d),y=g.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(y);else ur(l,y);if(ur(l,u),a._zod.parent===d)for(let A in l){if(A==="$ref"||A==="allOf")continue;if(!(A in u))delete l[A]}if(y.$ref&&g.def)for(let A in l){if(A==="$ref"||A==="allOf")continue;if(A in g.def&&JSON.stringify(l[A])===JSON.stringify(g.def[A]))delete l[A]}}let h=a._zod.parent;if(h&&h!==d){r(h);let g=e.seen.get(h);if(g?.schema.$ref){if(l.$ref=g.schema.$ref,g.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in g.def&&JSON.stringify(l[y])===JSON.stringify(g.def[y]))delete l[y]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())jm(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);if(d)d.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])gk(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}ur(o,n.defId?n.schema:n.def??n.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Re(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:dr(t,"input",e.processors),output:dr(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function $e(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 $e(r.element,n);if(r.type==="set")return $e(r.valueType,n);if(r.type==="lazy")return $e(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 $e(r.innerType,n);if(r.type==="intersection")return $e(r.left,n)||$e(r.right,n);if(r.type==="record"||r.type==="map")return $e(r.keyType,n)||$e(r.valueType,n);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return $e(r.in,n)||$e(r.out,n)}if(r.type==="object"){for(let o in r.shape)if($e(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if($e(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if($e(o,n))return!0;if(r.rest&&$e(r.rest,n))return!0;return!1}return!1}var Rm=(e,t={})=>(n)=>{let r=pr({...n,processors:t});return de(e,r),fr(r,e),mr(r,e)},dr=(e,t,n={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=pr({...o??{},target:i,io:t,processors:n});return de(e,s),fr(s,e),mr(s,e)};var fn=(e,t,n)=>{if(e[t]===void 0||n>e[t])e[t]=n},mn=(e,t,n)=>{if(e[t]===void 0||n<e[t])e[t]=n},Am=(e,t)=>{fn(e,"minimum",t),mn(e,"maximum",t)},zm=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},Dm=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},qm=(e,t)=>{e.mime=e.mime?e.mime.filter((n)=>t.includes(n)):[...t]},Vm=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},Pm=(e,t)=>fn(e,"minimum",t.minimum),Tm=(e,t)=>mn(e,"maximum",t.maximum),$m=(e)=>(t,n)=>{Vm(t,n.format);let[r,o]=e[n.format];fn(t,"minimum",r),mn(t,"maximum",o)},hk={greater_than:(e,t)=>fn(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>mn(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>zm(e,t.value),number_format:$m(mo),bigint_format:$m(go),min_length:Pm,max_length:Tm,length_equals:(e,t)=>Am(e,t.length),min_size:Pm,max_size:Tm,size_equals:(e,t)=>Am(e,t.size),string_format:(e,t)=>{if(Vm(e,t.format),t.pattern)Dm(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>qm(e,t.mime)};function Ce(e){let t={},n=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...n.checks??[]]:n.checks??[];for(let i of r)hk[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)fn(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)fn(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)mn(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)mn(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)zm(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)qm(t,o.mime);for(let i of o.patterns??[])Dm(t,i);return t}var yk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},bk=new Map([[va,Ws],[To,Gs]]),Lm=(e)=>bk.get(e)??e,Xa=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Ce(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=yk[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let d=[...c].map(Lm);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},ec=(e,t,n,r)=>{let o=n,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Ce(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),h=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),g=t.target==="draft-04"||t.target==="openapi-3.0";if(d)if(g)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(h)if(g)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let y=new Set;for(let N of a)if(Number.isFinite(N)&&N!==0)y.add(Math.abs(N));else Ee(e,t,o,r,`A multipleOf divisor of ${N} cannot be represented in JSON Schema`);let[S,...A]=y;if(S!==void 0)o.multipleOf=S;if(A.length)o.allOf=[...o.allOf??[],...A.map((N)=>({multipleOf:N}))]}},tc=(e,t,n,r)=>{n.type="boolean"},nc=(e,t,n,r)=>{Ee(e,t,n,r,"BigInt cannot be represented in JSON Schema")},rc=(e,t,n,r)=>{Ee(e,t,n,r,"Symbols cannot be represented in JSON Schema")},oc=(e,t,n,r)=>{if(t.target==="openapi-3.0")n.type="string",n.nullable=!0,n.enum=[null];else n.type="null"},ic=(e,t,n,r)=>{Ee(e,t,n,r,"Undefined cannot be represented in JSON Schema")},sc=(e,t,n,r)=>{Ee(e,t,n,r,"Void cannot be represented in JSON Schema")},ac=(e,t,n,r)=>{n.not={}},cc=(e,t,n,r)=>{},lc=(e,t,n,r)=>{},uc=(e,t,n,r)=>{Ee(e,t,n,r,"Date cannot be represented in JSON Schema")},dc=(e,t,n,r)=>{let o=e._zod.def,i=Kn(o.entries);if(i.length===0){n.not={};return}if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";n.enum=i},pc=(e,t,n,r)=>{let o=e._zod.def;if(o.values.length===0){n.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(Ee(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Ee(e,t,n,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(n.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0")n.enum=[s];else n.const=s}else{if(i.every((s)=>typeof s==="number"))n.type="number";if(i.every((s)=>typeof s==="string"))n.type="string";if(i.every((s)=>typeof s==="boolean"))n.type="boolean";if(i.every((s)=>s===null))n.type="null";n.enum=i}},fc=(e,t,n,r)=>{Ee(e,t,n,r,"NaN cannot be represented in JSON Schema")},mc=(e,t,n,r)=>{let o=n,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},gc=(e,t,n,r)=>{let o=n;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Ce(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},hc=(e,t,n,r)=>{n.type="boolean"},yc=(e,t,n,r)=>{Ee(e,t,n,r,"Custom types cannot be represented in JSON Schema")},bc=(e,t,n,r)=>{Ee(e,t,n,r,"Function types cannot be represented in JSON Schema")},wc=(e,t,n,r)=>{Ee(e,t,n,r,"Transforms cannot be represented in JSON Schema")},vc=(e,t,n,r)=>{Ee(e,t,n,r,"Map cannot be represented in JSON Schema")},kc=(e,t,n,r)=>{Ee(e,t,n,r,"Set cannot be represented in JSON Schema")},xc=(e,t,n,r)=>{let o=n,i=e._zod.def,{minimum:s,maximum:a}=Ce(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=de(i.element,t,{...r,path:[...r.path,"items"]})};function gr(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return gr(t.out);if(t.type==="catch")return gr(t.innerType);return e._zod.optin}var Sc=(e,t,n,r)=>{let o=n,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Ee(e,t,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)Re(o.properties,l,de(s[l],t,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(t.io==="input"?gr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=de(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})},ii=(e,t,n,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>de(a,t,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)n.oneOf=s;else n.anyOf=s},Ic=(e,t,n,r)=>{let o=e._zod.def,i=de(o.left,t,{...r,path:[...r.path,"allOf",0]}),s=de(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];n.allOf=c,t.intersections.push(c)},Cc=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"?"items":t.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((S,A)=>de(S,t,{...r,path:[...r.path,s,A]})),l=i.rest?de(i.rest,t,{...r,path:[...r.path,a,...t.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let S=i.items[u-1];if(!(t.io==="input"?gr(S)!==void 0:S._zod.optout==="optional"))break;u--}let d=i.items.length,h=!i.rest;if(t.target==="draft-2020-12"){if(o.prefixItems=c,h)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(h)o.maxItems=d}else if(t.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(u>0)o.minItems=u;if(h)o.maxItems=d}else{if(o.items=c,h)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(h)o.maxItems=d}let{minimum:g,maximum:y}=Ce(e);if(typeof g==="number")o.minItems=g;if(typeof y==="number")o.maxItems=y};function Qa(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let y=e.get(t)?.def;if(!y)return t;let S=Qa(e,y,n);return S===y?t:S}for(let y of["anyOf","oneOf"]){let S=t[y];if(!Array.isArray(S))continue;let A=S.map((N)=>Qa(e,N,n));if(A.some((N,L)=>N!==S[L]))t={...t,[y]:A}}let r=Array.isArray(t.type)?t.type:[t.type],o=!r.includes("string")&&r.some((y)=>y==="number"||y==="integer"),i=t.enum??(t.const!==void 0?[t.const]:void 0);if(!o&&!i?.some((y)=>typeof y==="number"))return t;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:h,...g}=t;if(g.enum)g.enum=g.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof g.const==="number")g.const=String(g.const);if(!o)return g;if(g.type="string",!i)g.pattern=(r.includes("number")?Bt:tr).source;return g}var Ya=new WeakMap;function wk(e){let t=new Map;for(let r of e.seen.values())if(r.def&&!t.has(r.schema))t.set(r.schema,r);let n=new Map;for(let r of Ya.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||n.has(i))continue;let s=Qa(t,i,new Set);if(s!==i)n.set(i,s)}if(!n.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&n.get(o.propertyNames);if(i)o.propertyNames=i}}var Ec=(e,t,n,r)=>{let o=n,i=e._zod.def;o.type="object";let s=i.keyType,a=Ce(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=de(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)Re(o.patternProperties,Lm(d).source,u)}else{if(t.target==="draft-07"||t.target==="draft-2020-12"){o.propertyNames=de(i.keyType,t,{...r,path:[...r.path,"propertyNames"]});let u=Ya.get(t);if(!u)u=[],Ya.set(t,u),t.deferred.push(()=>wk(t));u.push(e)}o.additionalProperties=de(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=t.io==="input"&&gr(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(u.length>0)o.required=u.map(String)}},Oc=(e,t,n,r)=>{let o=e._zod.def,i=de(o.innerType,t,r),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,n.nullable=!0;else n.anyOf=[i,{type:"null"}]},jc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},_c=Symbol();function Fm(e,t,n,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return Ee(t,n,r,o,"BigInt defaults cannot be represented in JSON Schema"),_c}var Rc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s=Fm(o.defaultValue,e,t,n,r);if(s!==_c)n.default=s},Ac=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=Fm(o.defaultValue,e,t,n,r);if(s!==_c)n._prefault=s},Pc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Ee(e,t,n,r,"Dynamic catch values are not supported in JSON Schema");return}n.default=s},Tc=(e,t,n,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;de(s,t,r);let a=t.seen.get(e);a.ref=s},$c=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},Nc=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},si=(e,t,n,r)=>{let o=e._zod.def;de(o.innerType,t,r);let i=t.seen.get(e);i.ref=o.innerType},zc=(e,t,n,r)=>{let o=e._zod.innerType;de(o,t,r);let i=t.seen.get(e);i.ref=o},Nm={string:Xa,number:ec,boolean:tc,bigint:nc,symbol:rc,null:oc,undefined:ic,void:sc,never:ac,any:cc,unknown:lc,date:uc,enum:dc,literal:pc,nan:fc,template_literal:mc,file:gc,success:hc,custom:yc,function:bc,transform:wc,map:vc,set:kc,array:xc,object:Sc,union:ii,intersection:Ic,tuple:Cc,record:Ec,nullable:Oc,nonoptional:jc,default:Rc,prefault:Ac,catch:Pc,pipe:Tc,readonly:$c,promise:Nc,optional:si,lazy:zc};function gn(e,t){if("_idmap"in e){let r=e,o=pr({...t,processors:Nm}),i={};for(let c of r._idmap.entries()){let[l,u]=c;de(u,o)}let s={},a={registry:r,uri:t?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;fr(o,u),Re(s,l,mr(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let n=pr({...t,processors:Nm});return de(e,n),fr(n,e),mr(n,e)}var Mm=new WeakSet([Object.prototype,Error.prototype]);function ci(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let r=n(this);return Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,t,{value:r,configurable:!0,writable:!0})}})}var Zm=(e,t)=>{vd.init(e,t),e.name="ZodError";let n=Object.getPrototypeOf(e);if(Mm.has(n))return;Mm.add(n),ci(n,"format",(r)=>(o)=>xd(r,o)),ci(n,"flatten",(r)=>(o)=>kd(r,o)),ci(n,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,Wn,2)}),ci(n,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,Wn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},xk=m("ZodError",Zm),Ke=m("ZodError",Zm,void 0,{Parent:Error});var Jm=Yn(Ke),Bm=Xn(Ke),Um=xo(Ke),Km=So(Ke),Wm=Id(Ke),Gm=Cd(Ke),Hm=Ed(Ke),Qm=Od(Ke),Ym=jd(Ke),Xm=_d(Ke),eg=Rd(Ke),tg=Ad(Ke);function Ik(){if(!je.localeError)Ae(ja())}function Kt(){if(!je.memoizer)Ae({memoizer:Vf()})}var K=m("ZodType",(e,t)=>(Ik(),J.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Je(t,{checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return lt(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bg(e,t))},superRefine(e,t){return this.check(Ug(e,t))},overwrite(e){return this.check(wt(e))},optional(){return li(this)},exactOptional(){return Eg(this)},nullable(){return ui(this)},nullish(){return li(ui(this))},nonoptional(e){return Pg(this,e)},array(){return R(this)},or(e){return Y([this,e])},and(e){return bg(this,e)},transform(e){return Dc(this,al(e))},default(e){return _g(this,e)},prefault(e){return Ag(this,e)},catch(e){return Ng(this,e)},pipe(e){return Dc(this,e)},readonly(){return Vg(this)},describe(e){let t=this.clone();return Le.add(t,{description:e}),t},meta(...e){if(e.length===0)return Le.get(this);let t=this.clone();return Le.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 Qn(this,"~standard",{...wa(this),jsonSchema:{input:dr(this,"input"),output:dr(this,"output")}})},set "~standard"(e){yt(this,"~standard",e)},parse:function e(t,n){return Jm(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Bm(this,t,n,{callee:e})},safeParse(e,t){return Um(this,e,t)},async safeParseAsync(e,t){return Km(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){yt(this,"spa",e)},validate(e,t){return _s(this,e,t)},validateAsync(e,t){return Rs(this,e,t)},encode:function e(t,n){return Wm(this,t,n,{callee:e})},decode:function e(t,n){return Gm(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Hm(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Qm(this,t,n,{callee:e})},safeEncode(e,t){return Ym(this,e,t)},safeDecode(e,t){return Xm(this,e,t)},async safeEncodeAsync(e,t){return eg(this,e,t)},async safeDecodeAsync(e,t){return tg(this,e,t)},toJSONSchema(e){return Rm(this,{})(e)},get description(){return Le.get(this)?.description},get _def(){return this._zod.def}}),qc=m("_ZodString",(e,t)=>{ln.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xa(e,n,r,o)},vo({format:(e)=>Ce(e).format??null,minLength:(e)=>Ce(e).minimum??null,maxLength:(e)=>Ce(e).maximum??null},{regex(...e){return this.check(Uo(...e))},includes(...e){return this.check(Go(...e))},startsWith(...e){return this.check(Ho(...e))},endsWith(...e){return this.check(Qo(...e))},min(...e){return this.check(Ut(...e))},max(...e){return this.check(cr(...e))},length(...e){return this.check(lr(...e))},nonempty(...e){return this.check(Ut(1,...e))},lowercase(e){return this.check(Ko(e))},uppercase(e){return this.check(Wo(e))},trim(){return this.check(ti())},normalize(...e){return this.check(ei(...e))},toLowerCase(){return this.check(ni())},toUpperCase(){return this.check(ri())},slugify(){return this.check(oi())}})),Vc=m("ZodString",(e,t)=>{ln.init(e,t),qc.init(e,t)},{email(e){return this.check(_a(Lc,e))},url(e){return this.check(Fo(di,e))},jwt(e){return this.check(Ga(nl,e))},emoji(e){return this.check(Na(Mc,e))},guid(e){return this.check(Ra(Fc,e))},uuid(e){return this.check(Aa(vt,e))},uuidv4(e){return this.check(Pa(vt,e))},uuidv6(e){return this.check(Ta(vt,e))},uuidv7(e){return this.check($a(vt,e))},nanoid(e){return this.check(za(Zc,e))},cuid(e){return this.check(Da(Jc,e))},cuid2(e){return this.check(qa(Bc,e))},ulid(e){return this.check(Va(Uc,e))},base64(e){return this.check(Ua(Xc,e))},base64url(e){return this.check(Ka(el,e))},xid(e){return this.check(La(Kc,e))},ksuid(e){return this.check(Fa(Wc,e))},ipv4(e){return this.check(Ma(Gc,e))},ipv6(e){return this.check(Za(Hc,e))},cidrv4(e){return this.check(Ja(Qc,e))},cidrv6(e){return this.check(Ba(Yc,e))},e164(e){return this.check(Wa(tl,e))},datetime(e){return this.check(Mo(hn,e))},date(e){return this.check(Zo(yn,e))},time(e){return this.check(Jo(bn,e))},duration(e){return this.check(Bo(wn,e))}});function C(e){return Zf(Vc,e)}var ce=m("ZodStringFormat",(e,t)=>{ae.init(e,t),qc.init(e,t)}),hn=m("ZodISODateTime",(e,t)=>{Ap.init(e,t),ce.init(e,t)}),yn=m("ZodISODate",(e,t)=>{Pp.init(e,t),ce.init(e,t)}),bn=m("ZodISOTime",(e,t)=>{Tp.init(e,t),ce.init(e,t)}),wn=m("ZodISODuration",(e,t)=>{$p.init(e,t),ce.init(e,t)}),Lc=m("ZodEmail",(e,t)=>{vp.init(e,t),ce.init(e,t)});function Ck(e){return _a(Lc,e)}var Fc=m("ZodGUID",(e,t)=>{bp.init(e,t),ce.init(e,t)});function Ek(e){return Ra(Fc,e)}var vt=m("ZodUUID",(e,t)=>{wp.init(e,t),ce.init(e,t)});function Ok(e){return Aa(vt,e)}function jk(e){return Pa(vt,e)}function _k(e){return Ta(vt,e)}function Rk(e){return $a(vt,e)}var di=m("ZodURL",(e,t)=>{Sp.init(e,t),ce.init(e,t)});function Ak(e){return Fo(di,e)}function Pk(e){return Fo(di,{protocol:er,hostname:Qs,...j(e)})}var Mc=m("ZodEmoji",(e,t)=>{Ip.init(e,t),ce.init(e,t)});function Tk(e){return Na(Mc,e)}var Zc=m("ZodNanoID",(e,t)=>{Cp.init(e,t),ce.init(e,t)});function $k(e){return za(Zc,e)}var Jc=m("ZodCUID",(e,t)=>{Ep.init(e,t),ce.init(e,t)});function Nk(e){return Da(Jc,e)}var Bc=m("ZodCUID2",(e,t)=>{Op.init(e,t),ce.init(e,t)});function zk(e){return qa(Bc,e)}var Uc=m("ZodULID",(e,t)=>{jp.init(e,t),ce.init(e,t)});function Dk(e){return Va(Uc,e)}var Kc=m("ZodXID",(e,t)=>{_p.init(e,t),ce.init(e,t)});function qk(e){return La(Kc,e)}var Wc=m("ZodKSUID",(e,t)=>{Rp.init(e,t),ce.init(e,t)});function Vk(e){return Fa(Wc,e)}var Gc=m("ZodIPv4",(e,t)=>{Np.init(e,t),ce.init(e,t)});function Lk(e){return Ma(Gc,e)}var ng=m("ZodMAC",(e,t)=>{qp.init(e,t),ce.init(e,t)});function Fk(e){return Jf(ng,e)}var Hc=m("ZodIPv6",(e,t)=>{Dp.init(e,t),ce.init(e,t)});function Mk(e){return Za(Hc,e)}var Qc=m("ZodCIDRv4",(e,t)=>{Vp.init(e,t),ce.init(e,t)});function Zk(e){return Ja(Qc,e)}var Yc=m("ZodCIDRv6",(e,t)=>{Lp.init(e,t),ce.init(e,t)});function Jk(e){return Ba(Yc,e)}var Xc=m("ZodBase64",(e,t)=>{Mp.init(e,t),ce.init(e,t)});function Bk(e){return Ua(Xc,e)}var el=m("ZodBase64URL",(e,t)=>{Zp.init(e,t),ce.init(e,t)});function Uk(e){return Ka(el,e)}var tl=m("ZodE164",(e,t)=>{Jp.init(e,t),ce.init(e,t)});function Kk(e){return Wa(tl,e)}var rg=m("ZodCreditCard",(e,t)=>{Bp.init(e,t),ce.init(e,t)});function Wk(e){return Bf(rg,e)}var og=m("ZodIBAN",(e,t)=>{Up.init(e,t),ce.init(e,t)});function Gk(e){return Uf(og,e)}var nl=m("ZodJWT",(e,t)=>{Kp.init(e,t),ce.init(e,t)});function Hk(e){return Ga(nl,e)}var vn=m("ZodCustomStringFormat",(e,t)=>{Wp.init(e,t),ce.init(e,t)});function Qk(e,t,n={}){return pn(vn,e,t,n)}function Yk(e){return pn(vn,"hostname",Hs,e)}function Xk(e){return pn(vn,"hex",da,e)}function ex(e){return pn(vn,"currency_code",Xs,e)}function tx(e,t){let n=t?.enc??"hex",r=`${e}_${n}`,o=Ot[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return pn(vn,r,o,t)}var rl=m("ZodNumber",(e,t)=>{ka.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ec(e,n,r,o),e.isFinite=!0},vo({minValue:(e)=>{let{minimum:t,exclusiveMinimum:n}=Ce(e);return Math.max(t??Number.NEGATIVE_INFINITY,n??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:t,exclusiveMaximum:n}=Ce(e);return Math.min(t??Number.POSITIVE_INFINITY,n??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:t,multipleOf:n}=Ce(e);return!!t||!!n?.some(Number.isSafeInteger)},format:(e)=>Ce(e).format??null},{gt(e,t){return this.check(_t(e,t))},gte(e,t){return this.check(nt(e,t))},min(e,t){return this.check(nt(e,t))},lt(e,t){return this.check(jt(e,t))},lte(e,t){return this.check(tt(e,t))},max(e,t){return this.check(tt(e,t))},int(e){return this.check(xe(e))},safe(e){return this.check(xe(e))},positive(e){return this.check(_t(0,e))},nonnegative(e){return this.check(nt(0,e))},negative(e){return this.check(jt(0,e))},nonpositive(e){return this.check(tt(0,e))},multipleOf(e,t){return this.check(un(e,t))},step(e,t){return this.check(un(e,t))},finite(){return this}}));function B(e){return Kf(rl,e)}var kn=m("ZodNumberFormat",(e,t)=>{Gp.init(e,t),rl.init(e,t)});function xe(e){return Wf(kn,e)}function nx(e){return Gf(kn,e)}function rx(e){return Hf(kn,e)}function ox(e){return Qf(kn,e)}function ix(e){return Yf(kn,e)}var ol=m("ZodBoolean",(e,t)=>{$o.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tc(e,n,r,o)});function he(e){return Xf(ol,e)}var il=m("ZodBigInt",(e,t)=>{xa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>nc(e,n,r,o)},vo({minValue:(e)=>Ce(e).minimum??null,maxValue:(e)=>Ce(e).maximum??null,format:(e)=>Ce(e).format??null},{gte(e,t){return this.check(nt(e,t))},min(e,t){return this.check(nt(e,t))},gt(e,t){return this.check(_t(e,t))},lt(e,t){return this.check(jt(e,t))},lte(e,t){return this.check(tt(e,t))},max(e,t){return this.check(tt(e,t))},positive(e){return this.check(_t(BigInt(0),e))},negative(e){return this.check(jt(BigInt(0),e))},nonpositive(e){return this.check(tt(BigInt(0),e))},nonnegative(e){return this.check(nt(BigInt(0),e))},multipleOf(e,t){return this.check(un(e,t))}}));function sx(e){return em(il,e)}var sl=m("ZodBigIntFormat",(e,t)=>{Hp.init(e,t),il.init(e,t)});function ax(e){return tm(sl,e)}function cx(e){return nm(sl,e)}var ig=m("ZodSymbol",(e,t)=>{Qp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>rc(e,n,r,o)});function lx(e){return rm(ig,e)}var sg=m("ZodUndefined",(e,t)=>{Yp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ic(e,n,r,o)});function ux(e){return om(sg,e)}var ag=m("ZodNull",(e,t)=>{Xp.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>oc(e,n,r,o)});function cg(e){return im(ag,e)}var lg=m("ZodAny",(e,t)=>{ef.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>cc(e,n,r,o)});function dx(){return sm(lg)}var ug=m("ZodUnknown",(e,t)=>{tf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>lc(e,n,r,o)});function rt(){return am(ug)}var dg=m("ZodNever",(e,t)=>{nf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ac(e,n,r,o)});function ot(e){return cm(dg,e)}var pg=m("ZodVoid",(e,t)=>{rf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>sc(e,n,r,o)});function px(e){return lm(pg,e)}var fg=m("ZodDate",(e,t)=>{of.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>uc(e,n,r,o),e.min=(n,r)=>e.check(nt(n,r)),e.max=(n,r)=>e.check(tt(n,r))},vo({minDate:(e)=>{let{minimum:t}=Ce(e);return t?new Date(t):null},maxDate:(e)=>{let{maximum:t}=Ce(e);return t?new Date(t):null}},{}));function fx(e){return um(fg,e)}var mg=m("ZodArray",(e,t)=>{Kt(),sf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xc(e,n,r,o),e.element=t.element},{min(e,t){return this.check(Ut(e,t))},nonempty(e){return this.check(Ut(1,e))},max(e,t){return this.check(cr(e,t))},length(e,t){return this.check(lr(e,t))},unwrap(){return this.element}});function R(e,t){return ym(mg,e,t)}function mx(e){let t=e._zod.def.shape;return Z(Object.keys(t))}var pi=m("ZodObject",(e,t)=>{Kt(),lf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sc(e,n,r,o),iv(e,"shape",(n)=>n._zod.def.shape,!1)},{keyof(){return Z(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Je(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Je(this._zod.def,{catchall:rt()}))},loose(){return this.clone(Je(this._zod.def,{catchall:rt()}))},strict(){return this.clone(Je(this._zod.def,{catchall:ot()}))},strip(){return this.clone(Je(this._zod.def,{catchall:void 0}))},extend(e){return Qw(this,e)},safeExtend(e){return Yw(this,e)},merge(e){return Xw(this,e)},pick(e){return Gw(this,e)},omit(e){return Hw(this,e)},partial(...e){return dd(mi,this,e[0])},exactPartial(...e){return dd(cl,this,e[0],"exactPartial")},required(...e){return ev(ll,this,e[0])}});function O(e,t){let n={type:"object",shape:e??{},...j(t)};return new pi(n)}function v(e,t){return new pi({type:"object",shape:e,catchall:ot(),...j(t)})}function gx(e,t){return new pi({type:"object",shape:e,catchall:rt(),...j(t)})}var fi=m("ZodUnion",(e,t)=>{No.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ii(e,n,r,o),e.options=t.options});function Y(e,t){return new fi({type:"union",options:e,...j(t)})}var gg=m("ZodXor",(e,t)=>{fi.init(e,t),uf.init(e,t),e._zod.processJSONSchema=(n,r,o)=>ii(e,n,r,o),e.options=t.options});function hx(e,t){return new gg({type:"union",options:e,inclusive:!1,...j(t)})}var hg=m("ZodDiscriminatedUnion",(e,t)=>{fi.init(e,t),df.init(e,t)});function it(e,t,n){return new hg({type:"union",options:t,discriminator:e,...j(n)})}var yg=m("ZodIntersection",(e,t)=>{pf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ic(e,n,r,o)});function bg(e,t){return new yg({type:"intersection",left:e,right:t})}var wg=m("ZodTuple",(e,t)=>{Kt(),Sa.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cc(e,n,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((t)=>new mi({type:"optional",innerType:t}))})}});function vg(e,t,n){let r=t instanceof J,o=r?n:t;return new wg({type:"tuple",items:e,rest:r?t:null,...j(o)})}var yr=m("ZodRecord",(e,t)=>{Kt(),ff.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ec(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function oe(e,t,n){if(!t||!t._zod)return new yr({type:"record",keyType:C(),valueType:e,...j(t)});return new yr({type:"record",keyType:e,valueType:t,...j(n)})}function yx(e,t,n){return new yr({type:"record",keyType:e,valueType:t,...j(n),partial:!0})}function bx(e,t,n){return new yr({type:"record",keyType:e,valueType:t,mode:"loose",...j(n)})}var kg=m("ZodMap",(e,t)=>{Kt(),mf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vc(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...n)=>e.check(Rt(...n)),e.nonempty=(n)=>e.check(Rt(1,n)),e.max=(...n)=>e.check(dn(...n)),e.size=(...n)=>e.check(ar(...n))});function wx(e,t,n){return new kg({type:"map",keyType:e,valueType:t,...j(n)})}var xg=m("ZodSet",(e,t)=>{Kt(),gf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kc(e,n,r,o),e.min=(...n)=>e.check(Rt(...n)),e.nonempty=(n)=>e.check(Rt(1,n)),e.max=(...n)=>e.check(dn(...n)),e.size=(...n)=>e.check(ar(...n))});function vx(e,t){return new xg({type:"set",valueType:e,...j(t)})}var br=m("ZodEnum",(e,t)=>{hf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(r,o,i)=>dc(e,r,o,i),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(n.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new br({...t,checks:[],...j(o),entries:i})},e.exclude=(r,o)=>{let i={...t.entries};for(let s of r)if(n.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new br({...t,checks:[],...j(o),entries:i})}});function Z(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new br({type:"enum",entries:n,...j(t)})}function kx(e,t){return new br({type:"enum",entries:e,...j(t)})}var Sg=m("ZodLiteral",(e,t)=>{yf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>pc(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function b(e,t){return new Sg({type:"literal",values:Array.isArray(e)?e:[e],...j(t)})}var Ig=m("ZodFile",(e,t)=>{bf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>gc(e,n,r,o),e.min=(n,r)=>e.check(Rt(n,r)),e.max=(n,r)=>e.check(dn(n,r)),e.mime=(n,r)=>e.check(Xo(Array.isArray(n)?n:[n],r))});function xx(e){return bm(Ig,e)}var Cg=m("ZodTransform",(e,t)=>{Kt(),wf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wc(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cn(e.constructor.name);n.addIssue=(i)=>{if(typeof i==="string")n.issues.push(Zt(i,n.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=n.value;s.inst??(s.inst=e),n.issues.push(Zt(s))}};let o=t.transform(n.value,n);if(o instanceof Promise)return o.then((i)=>(n.value=i,n));return n.value=o,n}});function al(e){return new Cg({type:"transform",transform:e})}var mi=m("ZodOptional",(e,t)=>{Ia.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>si(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function li(e){return new mi({type:"optional",innerType:e})}var cl=m("ZodExactOptional",(e,t)=>{vf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>si(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Eg(e){return new cl({type:"optional",innerType:e})}var Og=m("ZodNullable",(e,t)=>{kf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Oc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ui(e){return new Og({type:"nullable",innerType:e})}function Sx(e){return li(ui(e))}var jg=m("ZodDefault",(e,t)=>{xf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function _g(e,t){return new jg({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():vs(t)}})}var Rg=m("ZodPrefault",(e,t)=>{Sf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ac(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ag(e,t){return new Rg({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():vs(t)}})}var ll=m("ZodNonOptional",(e,t)=>{If.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Pg(e,t){return new ll({type:"nonoptional",innerType:e,...j(t)})}var Tg=m("ZodSuccess",(e,t)=>{Cf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>hc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Ix(e){return new Tg({type:"success",innerType:e})}var $g=m("ZodCatch",(e,t)=>{Ef.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ng(e,t){return new $g({type:"catch",innerType:e,catchValue:typeof t==="function"?t:gd(t)})}var zg=m("ZodNaN",(e,t)=>{Of.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>fc(e,n,r,o)});function Cx(e){return dm(zg,e)}var gi=m("ZodPipe",(e,t)=>{Ca.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tc(e,n,r,o),e.in=t.in,e.out=t.out});function Dc(e,t){return new gi({type:"pipe",in:e,out:t})}var hi=m("ZodCodec",(e,t)=>{gi.init(e,t),zo.init(e,t)});function Ex(e,t,n){return new hi({type:"pipe",in:e,out:t,transform:n.decode,reverseTransform:n.encode})}function Ox(e){let t=e._zod.def;return new hi({type:"pipe",in:t.out,out:t.in,transform:t.reverseTransform,reverseTransform:t.transform})}var Dg=m("ZodPreprocess",(e,t)=>{gi.init(e,t),jf.init(e,t)}),qg=m("ZodReadonly",(e,t)=>{_f.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$c(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Vg(e){return new qg({type:"readonly",innerType:e})}var Lg=m("ZodTemplateLiteral",(e,t)=>{Rf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>mc(e,n,r,o)});function jx(e,t){return new Lg({type:"template_literal",parts:e,...j(t)})}var Fg=m("ZodLazy",(e,t)=>{Tf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zc(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Mg(e){return new Fg({type:"lazy",getter:e})}var Zg=m("ZodPromise",(e,t)=>{Pf.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nc(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function _x(e){return new Zg({type:"promise",innerType:e})}var Jg=m("ZodFunction",(e,t)=>{Af.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>bc(e,n,r,o)});function Rx(e){return new Jg({type:"function",input:Array.isArray(e?.input)?vg(e?.input):e?.input??R(rt()),output:e?.output??rt()})}var yi=m("ZodCustom",(e,t)=>{$f.init(e,t),K.init(e,t),e._zod.processJSONSchema=(n,r,o)=>yc(e,n,r,o)});function Ax(e){let t=new ue({check:"custom"});return t._zod.check=e,t}function Px(e,t){return wm(yi,e??(()=>!0),t)}function Bg(e,t={}){return vm(yi,e,t)}function Ug(e,t){return km(e,t)}var Tx=xm,$x=Sm,Kg=m("ZodInstanceOf",(e,t)=>{yi.init(e,t)},{properties(e,t){return this.check(Yo(e,t))}});function Nx(e,t={}){let n=new Kg({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...j(t)});return n._zod.bag.Class=e,n._zod.check=(r)=>{if(!(r.value instanceof e))r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:n,path:[...n._zod.def.path??[]]})},n}var zx=(...e)=>Im({Codec:hi,Boolean:ol,String:Vc},...e);function Pe(e){let t=Mg(()=>Y([C(e),B(),he(),cg(),R(t),oe(C(),t)]));return t}function Wg(e,t){return new Dg({type:"pipe",in:al(e),out:t})}function Dx(e){return Mo(hn,e)}function qx(e){return Zo(yn,e)}function Vx(e){return Jo(bn,e)}function Lx(e){return Bo(wn,e)}var T={...ul,...ai,iso:wr},Fx=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function Mx(e,t){let n=e.$schema;if(n==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(n==="http://json-schema.org/draft-07/schema#")return"draft-7";if(n==="http://json-schema.org/draft-04/schema#")return"draft-4";return t??"draft-2020-12"}function Gg(e,t){return e.map((n,r)=>r<t?n:n.optional())}function Zx(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function Jx(e,t){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let n=e.slice(1).split("/").filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version==="draft-2020-12"?"$defs":"definitions";if(n[0]===r){let o=n[1]===void 0?void 0:Zx(n[1]);if(!o||!t.defs[o])throw Error(`Reference not found: ${e}`);return t.defs[o]}throw Error(`Reference not found: ${e}`)}function Bx(e,t){return T.transform((r)=>r).check((r)=>{let o=r.value;if(typeof o!=="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(t.minProperties!==void 0&&i.length<t.minProperties)r.issues.push({origin:"object",code:"too_small",minimum:t.minProperties,inclusive:!0,message:`Too small: expected object to have >=${t.minProperties} properties`,input:o,inst:e,continue:!0});if(t.maxProperties!==void 0&&i.length>t.maxProperties)r.issues.push({origin:"object",code:"too_big",maximum:t.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${t.maxProperties} properties`,input:o,inst:e,continue:!0});if(t.keySchema)for(let s of i){let a=t.keySchema.safeParse(s);if(a.success)continue;r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function dl(e,t){if(e===null)return"z";let n=typeof e;if(n!=="object"){if(n==="number"&&Number.isNaN(e))return null;let r=String(e);return`${n[0]}${r.length}:${r}`}if(t.has(e))return null;t.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=dl(s,t);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=dl(e[i],t);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{t.delete(e)}}var Ux=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),Kx=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function vr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(vr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([t,n])=>{if(Ux.has(t))return vr(n);if(!Kx.has(t)||typeof n!=="object"||n===null)return!1;return Object.values(n).some(vr)})}function Hg(e){return e===1?"element":"elements"}function Wx(e,t){return T.transform((r)=>r).check((r)=>{let o=r.value;if(!Array.isArray(o))return;if(t.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=dl(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(t.containsSchema){let i=t.minContains??1,s=t.maxContains!==void 0?t.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(t.containsSchema.safeParse(c).success&&++a>=s)break;if(a<i)r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Hg(i)}; found ${a}`,input:o,continue:!0});if(t.maxContains!==void 0&&a>t.maxContains)r.issues.push({code:"custom",message:`Array must contain at most ${t.maxContains} matching ${Hg(t.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Qg(e,t){if(e===!1)return;if(e===void 0||e===!0)return T.any();return Ne(e,t)}var Gx=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Yg(e,t){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return T.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(t.refs.has(o))return t.refs.get(o);if(t.processing.has(o))return T.lazy(()=>{if(!t.refs.has(o))throw Error(`Circular reference not resolved: ${o}`);return t.refs.get(o)});t.processing.add(o);let i=Jx(o,t),s=Ne(i,t);return t.refs.set(o,s),t.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return T.null();if(o.length===0)return T.never();if(o.length===1)return T.literal(o[0]);if(o.every((s)=>typeof s==="string"))return T.enum(o);let i=o.map((s)=>T.literal(s));if(i.length<2)return i[0];return T.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return T.literal(e.const);let n=e.type;if(Array.isArray(n)){let o=n.map((i)=>{let s={...e,type:i};return Yg(s,t)});if(o.length===0)return T.never();if(o.length===1)return o[0];return T.union(o)}if(!n)return T.any();let r;switch(n){case"string":{let o=T.string();if(e.format){let i=e.format;if(i==="email")o=o.check(T.email());else if(i==="uri"||i==="uri-reference")o=o.check(T.url());else if(i==="uuid"||i==="guid")o=o.check(T.uuid());else if(i==="date-time")o=o.check(T.iso.datetime({offset:!0}));else if(i==="date")o=o.check(T.iso.date());else if(i==="time")o=o.check(T.regex(Gx));else if(i==="duration")o=o.check(T.iso.duration());else if(i==="hostname")o=o.check(T.hostname());else if(i==="ipv4")o=o.check(T.ipv4());else if(i==="ipv6")o=o.check(T.ipv6());else if(i==="mac")o=o.check(T.mac());else if(i==="cidr")o=o.check(T.cidrv4());else if(i==="cidr-v6")o=o.check(T.cidrv6());else if(i==="base64")o=o.check(T.base64());else if(i==="base64url")o=o.check(T.base64url());else if(i==="e164")o=o.check(T.e164());else if(i==="credit_card")o=o.check(T.creditCard());else if(i==="iban")o=o.check(T.iban());else if(i==="jwt")o=o.check(T.jwt());else if(i==="emoji")o=o.check(T.emoji());else if(i==="nanoid")o=o.check(T.nanoid());else if(i==="cuid")o=o.check(T.cuid());else if(i==="cuid2")o=o.check(T.cuid2());else if(i==="ulid")o=o.check(T.ulid());else if(i==="xid")o=o.check(T.xid());else if(i==="ksuid")o=o.check(T.ksuid())}if(typeof e.minLength==="number")o=o.min(e.minLength);if(typeof e.maxLength==="number")o=o.max(e.maxLength);if(e.pattern)o=o.regex(new RegExp(e.pattern));r=o;break}case"number":case"integer":{let o=n==="integer"?T.number().int():T.number();if(typeof e.minimum==="number"&&e.exclusiveMinimum!==!0)o=o.min(e.minimum);if(typeof e.maximum==="number"&&e.exclusiveMaximum!==!0)o=o.max(e.maximum);if(typeof e.exclusiveMinimum==="number")o=o.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")o=o.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")o=o.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")o=o.lt(e.maximum);if(typeof e.multipleOf==="number")o=o.multipleOf(e.multipleOf);r=o;break}case"boolean":{r=T.boolean();break}case"null":{r=T.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties==="object"?Ne(e.additionalProperties,t):void 0;for(let[d,h]of Object.entries(i)){let g=Ne(h,t);Re(o,d,s.has(d)?g:g.optional())}if(e.patternProperties){let d=e.patternProperties,h=Object.keys(d),g=[];for(let S of h){let A=Ne(d[S],t),N=T.string().regex(new RegExp(S));g.push(T.looseRecord(N,A))}let y=[];if(Object.keys(o).length>0)y.push(T.object(o).passthrough());if(y.push(...g),y.length===0)r=T.object({}).passthrough();else if(y.length===1)r=y[0];else{let S=T.intersection(y[0],y[1]);for(let A=2;A<y.length;A++)S=T.intersection(S,y[A]);r=S}if(e.additionalProperties===!1){let S=Object.keys(o),A=h.map((L)=>new RegExp(L)),N=r;r=r.check((L)=>{if(!bt(L.value))return;let D=[];for(let fe of Object.keys(L.value)){if(S.includes(fe))continue;if(A.some((ge)=>ge.test(fe)))continue;D.push(fe)}if(D.length)L.issues.push({code:"unrecognized_keys",keys:D,input:L.value,inst:N})})}}else{let d=T.object(o);if(e.additionalProperties===!1)r=d.strict();else if(a)r=d.catchall(a);else r=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties==="number"?e.minProperties:void 0,u=typeof e.maxProperties==="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let h=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Ne(h,t)}r=Bx(r,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let{prefixItems:o,items:i}=e;if(o&&Array.isArray(o)){let s=typeof e.minItems==="number"?e.minItems:0,a=o.map((d)=>Ne(d,t)),c=Gg(a,s),l=!Array.isArray(i)?Qg(i,t):void 0,u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=typeof e.minItems==="number"?e.minItems:0,a=i.map((d)=>Ne(d,t)),c=Gg(a,s),l=Qg(e.additionalItems,t),u=T.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(T.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(T.maxLength(e.maxItems))}else if(i!==void 0){let s=Ne(i,t),a=T.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);r=a}else r=T.array(T.any());if(e.uniqueItems===!0||e.contains!==void 0)r=Wx(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Ne(e.contains,t):void 0,minContains:typeof e.minContains==="number"?e.minContains:void 0,maxContains:typeof e.maxContains==="number"?e.maxContains:void 0});break}default:throw Error(`Unsupported type: ${n}`)}return r}function Ne(e,t){if(typeof e==="boolean")return e?T.any():T.never();let n=Yg(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((l)=>Ne(l,t)),c=T.union(a);n=r?T.intersection(n,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((l)=>Ne(l,t)),c=T.xor(a);n=r?T.intersection(n,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:T.any();else{let a=r?n:Ne(e.allOf[0],t),c=r?0:1;for(let l=c;l<e.allOf.length;l++)a=T.intersection(a,Ne(e.allOf[l],t));n=a}if(e.nullable===!0&&t.version==="openapi-3.0")n=T.nullable(n);if(e.readOnly===!0)n=T.readonly(n);if(e.default!==void 0)n=n.default(e.default);let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)o[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)o[a]=e[a];if(e.type==="object"&&e.$ref===void 0){if(e.propertyNames!==void 0&&!vr(e.propertyNames))o.propertyNames=e.propertyNames;for(let a of["minProperties","maxProperties"])if(e[a]!==void 0)o[a]=e[a]}if(e.type==="array"&&e.$ref===void 0){if(e.contains!==void 0&&!vr(e.contains))o.contains=e.contains;for(let a of["uniqueItems","minContains","maxContains"])if(e[a]!==void 0)o[a]=e[a]}for(let a of Object.keys(e))if(!Fx.has(a))Re(o,a,e[a]);if(Object.keys(o).length>0)t.registry.add(n,o);if(e.description)n=n.describe(e.description);return n}function Xg(e,t){if(typeof e==="boolean")return e?T.any():T.never();let n;try{n=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=Mx(n,t?.defaultTarget),o=n.$defs||n.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:n,registry:t?.registry??Le};return Ne(n,i)}var eh=Object.prototype.hasOwnProperty;function Ie(e,t){var n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Date)return e.getTime()===t.getTime();if(n===RegExp)return e.toString()===t.toString();if(n===Array){if((r=e.length)===t.length)while(r--&&Ie(e[r],t[r]));return r===-1}if(!n||typeof e==="object"){r=0;for(n in e){if(eh.call(e,n)&&++r&&!eh.call(t,n))return!1;if(!(n in t)||!Ie(e[n],t[n]))return!1}return Object.keys(t).length===r}}return e!==e&&t!==t}var pl={maxKeys:16,maxBytes:1048576},fl=C().min(1).refine((e)=>new TextEncoder().encode(e).length<=256),Hx=v({scope:Z(["draft","live"]),values:b(!1).optional()}),UO=Hx.omit({values:!0}),th=v({scope:Z(["draft","live"]),keys:R(fl).min(1).max(pl.maxKeys).refine((e)=>new Set(e).size===e.length,"State keys must be distinct.")}),KO=v({scope:Z(["draft","live"]),key:fl.optional()}),WO=v({scope:Z(["draft","live"]),space:C().regex(/^(flow|node:.+)$/)}),GO=v({scope:Z(["draft","live"])}),bi=v({fields:R(C().refine((e)=>e.length>0&&e.split(".").every((t)=>t.length>0),"Use a nonempty dot-separated field path.")).refine((e)=>new Set(e).size===e.length,"Identity fields must be distinct.").default([])}),nh=bi.extend({kind:b("skip-duplicates")});var ml=O({version:b(1),scope:Z(["draft","live"]),limits:O({maxValueBytes:B().positive(),maxValues:B().int().positive(),maxSpaces:B().int().positive(),maxIdentities:B().positive(),maxRunWrites:B().positive()}),values:R(v({key:C(),size:B().nonnegative(),updatedAt:B()})),spaces:R(O({space:C(),count:B().nonnegative(),pendingCount:B().nonnegative(),reservedCount:B().nonnegative(),updatedAt:B()}))}),rh=ml.extend({values:v({count:B().int().nonnegative(),updatedAt:B().nullable()})}),oh=O({version:b(1),scope:Z(["draft","live"]),values:R(v({key:fl,value:Pe()})).min(1).max(pl.maxKeys)}).refine((e)=>{let t=new TextEncoder;return e.values.reduce((n,r)=>n+(r.value===null?0:t.encode(JSON.stringify(r.value)).byteLength),0)<=pl.maxBytes},"State values exceed the 1 MiB read limit.");var ih=0;function At(){let e=ih;return ih+=1,e}function Sn(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let t of Object.getOwnPropertyNames(e)){let n=Reflect.get(e,t);Sn(n)}Object.freeze(e)}return e}function gl(e,t){let n={};for(let r of t)if(r in e)n[r]=e[r];return n}function wi(e){if(typeof e!=="object"||e===null)return e;else if(Array.isArray(e)){let t=[];for(let[n,r]of e.entries())t[n]=wi(r);return t}else{let t={};for(let n in e)t[n]=wi(e[n]);return t}}function xn(e,t){if(e===t)return!0;if(e===null)return!1;if(typeof e!=="object")return!1;if(typeof e!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let[n,r]of e.entries())if(!xn(r,t[n]))return!1}else{if(Array.isArray(t))return!1;for(let n in e){if(!(n in t))return!1;if(!xn(e[n],t[n]))return!1}for(let n in t)if(!(n in e))return!1}return!0}var w=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),H=Pt(w.Equals),U=Pt(w.Containing),W=Pt(w.ContainedBy),Q=Pt(w.Rejection),ne=Pt(w.Intersection),kt=Sn([[w.Equals,H],[w.Containing,U],[w.ContainedBy,W],[w.Rejection,Q],[w.Intersection,ne]]),pe=0,We=(()=>{let e=pe;for(let[t,n]of kt)e|=n;return e})();function kr(e){return!!(e&H)}function xr(e){return!!(e&U)}function Sr(e){return!!(e&W)}function Ir(e){return!!(e&Q)}function Cr(e){return!!(e&ne)}function Pt(e){return 1<<e}function hl(e){let t=pe,n=0,r={push:(o)=>{if(n===0)t=o;else t=Qx(t,o,e);return n+=1,t}};return Object.defineProperties(r,{result:{get:()=>t},count:{get:()=>n}}),r}function Qx(e,t,n){let r=pe;for(let[o,i]of kt)if(i&e){for(let[s,a]of kt)if(a&t){if(r|=n(o,s),r===We)return r}}return r}var ye=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function sh(e,t){switch(e){case ye.Save:return t[0];case ye.OneOf:return Yx(t);case ye.AllOf:case ye.AnyOf:return Er(e,t);case ye.Not:case ye.Swap:return yl(e,t[0])}}function Tt(e){return yl(ye.Swap,e)}function Yx(e){if(e.length===1)return e[0];let t=Er(ye.AnyOf,e),n=[];for(let i=0;i<e.length;++i)for(let s=i+1;s<e.length;++s){let a=e[i],c=e[s],l=Er(ye.AllOf,[a,c]);n.push(l)}let r=Er(ye.AnyOf,n),o=yl(ye.Not,r);return Er(ye.AllOf,[t,o])}function Er(e,t){if(t.length<0)throw Error("invalid expressions: empty array");let n;switch(e){case ye.AllOf:{n=hl(Xx);break}case ye.AnyOf:{n=hl(eS);break}default:throw Error(`invalid operator ${e}`)}for(let r of t)n.push(r);return n.result}function yl(e,t){let n,r=pe;switch(e){case ye.Not:{n=tS;break}case ye.Swap:{n=nS;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of kt)if(i&t)r|=n(o);return r}function Xx(e,t){let n=pe;switch(e){case w.Equals:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=H;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=pe;break}case w.Intersection:{n=W;break}}break}case w.Containing:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=H|U;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=ne|W;break}}break}case w.ContainedBy:{switch(t){case w.Equals:{n=W;break}case w.Containing:{n=W;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=pe;break}case w.Intersection:{n=W;break}}break}case w.Rejection:{switch(t){case w.Equals:{n=pe;break}case w.Containing:{n=Q;break}case w.ContainedBy:{n=pe;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=Q;break}}break}case w.Intersection:{switch(t){case w.Equals:{n=W;break}case w.Containing:{n=ne|W;break}case w.ContainedBy:{n=W;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=W|Q|ne;break}}break}}return n}function eS(e,t){let n=pe;switch(e){case w.Equals:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=H;break}case w.Rejection:{n=U;break}case w.Intersection:{n=U;break}}break}case w.Containing:{switch(t){case w.Equals:{n=U;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=U;break}case w.Rejection:{n=U;break}case w.Intersection:{n=U;break}}break}case w.ContainedBy:{switch(t){case w.Equals:{n=H;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=H|W;break}case w.Rejection:{n=ne;break}case w.Intersection:{n=U|ne;break}}break}case w.Rejection:{switch(t){case w.Equals:{n=U;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=ne;break}case w.Rejection:{n=Q;break}case w.Intersection:{n=ne;break}}break}case w.Intersection:{switch(t){case w.Equals:{n=U;break}case w.Containing:{n=U;break}case w.ContainedBy:{n=U|ne;break}case w.Rejection:{n=ne;break}case w.Intersection:{n=U|ne;break}}break}}return n}function tS(e){let t=pe;switch(e){case w.Equals:{t=Q;break}case w.Containing:{t=Q;break}case w.ContainedBy:{t=ne;break}case w.Rejection:{t=H|U;break}case w.Intersection:{t=W|ne;break}}return t}function nS(e){let t=pe;switch(e){case w.Equals:{t=H;break}case w.Containing:{t=W;break}case w.ContainedBy:{t=U;break}case w.Rejection:{t=Q;break}case w.Intersection:{t=ne;break}}return t}var Fe=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var bl=(e)=>(t,n)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:ye.Save,results:[pe],willSwap:!1,count:0}},o=[{parent:{node:r,index:0},swapped:!1,expressions:[t,n],calculation:null}],i=[];while(o.length>0||i.length>0){while(o.length>0){let u=o.pop();s(u)}while(i.length>0){let u=i.pop();c(u)}}function s(u){let d=H,[h,g]=u.expressions;if(!e.equals(h,g)){let y=e.describe(h);if(y.kind!==Fe.Leaf){let[N,L]=a(y,!1);u.expressions=null,u.calculation=N;for(let[D,fe]of L.entries())o.push({parent:{node:u,index:D},swapped:u.swapped,expressions:[fe,g],calculation:null});return}let S=e.describe(g);if(S.kind!==Fe.Leaf){let[N,L]=a(S,!0);u.expressions=null,u.calculation=N;for(let[D,fe]of L.entries())o.push({parent:{node:u,index:D},swapped:!u.swapped,expressions:[fe,h],calculation:null});return}if(d=e.calculate(h,g),e.observeCalculation?.(h,g,d,u.swapped),d===pe)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:ye.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let h=ye.Save,g;switch(u.kind){case Fe.Not:{h=ye.Not,g=[u.expression];break}case Fe.AllOf:{h=ye.AllOf,g=[...u.expressions];break}case Fe.AnyOf:{h=ye.AnyOf,g=[...u.expressions];break}case Fe.OneOf:{h=ye.OneOf,g=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:h,willSwap:d,count:0,results:Array(g.length).fill(-1)},g]}function c(u){let{calculation:d,parent:h}=u,g=sh(d.operator,d.results);if(g===pe)g=W;if(d.willSwap)g=Tt(g);if(h){let y=h.node.calculation,S=y.results;if(S[h.index]=g,y.count+=1,y.count>=S.length)i.push(h.node)}}let l=r.calculation.results[0];if(l===0)throw Error("cannot find result of root");return l};class vi extends Error{constructor(e=[]){super(rS(e));this.name="SchemaError",this.items=e}}var In=Object.freeze({Compiled:0,External:1});function Cn(e){switch(e.kind){case In.Compiled:{let{message:t,path:n}=e;return`${t} (at ${n.length>0?n.join("."):"$root"})`}case In.External:return String(e.error)}}function rS(e){switch(e.length){case 0:return"without any items";case 1:return Cn(e[0]);default:return`${Cn(e[0])} ... omit the rest ${e.length-1} items`}}var oS=new Set(["type","enum","const","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","items","additionalItems","maxItems","minItems","uniqueItems","contains","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames","if","then","else","allOf","anyOf","oneOf","not","format","contentMediaType","contentEncoding","definitions"]);function dt(e){return oS.has(e)}function ah(e){for(let t in e)if(dt(t))return!1;return!0}function ze(e,...t){return{...e,path:[...e.path,...t]}}function Me(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function $t({path:e,errors:t},n,...r){t.push(ch(e,r,n))}function re({path:e,warns:t},n,...r){t.push(ch(e,r,n))}function ch(e,t,n){return{kind:In.Compiled,message:n,path:[...e,...t]}}function ki(e){for(let t in e){let n=e[t];if(n===void 0)delete e[t];else if(n&&typeof n==="object"){if(Array.isArray(n)){if(n.length===0)delete e[t]}else if(iS(n))delete e[t]}}return e}function iS(e){for(let t in e)return!1;return!0}var Or=Symbol("compiledId"),wl=Symbol("compiledKind"),vl=Symbol("compiledPath"),lh=Symbol("validatorLoader"),I=Object.freeze({Extends:0,Never:1,Any:2,Null:3,String:4,Numeric:5,Boolean:6,Object:7,Array:8,Not:9,Combination:10,EnumOrConst:11}),Nt=Sn(xi(I.Any,At(),{},()=>()=>!0)),jr=Sn(xi(I.Never,At(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function _r(e){if(e===null||typeof e!=="object")return!1;return Or in e}function Ze(e){if(e===null||typeof e!=="object")return!1;return Or in e&&wl in e}function ee(e){if(Ze(e))return e[wl];else return I.Extends}function Wt(e){if(Ze(e)||_r(e))return e[Or];else return e.id}function kl(e){return Ze(e)?e[vl]:void 0}function xl(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Or,{value:At(),configurable:!1,writable:!1,enumerable:!1}),e}function we(e,t,n,r=[]){return xi(e,At(),t,n&&(()=>n.compile(t)),r)}function Rr(e){return xi(I.Never,At(),{...e},e[lh],e[vl])}function xi(e,t,n,r,o=[]){let i=null;return Object.defineProperties(n,{[wl]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Or]:{value:t,configurable:!1,writable:!1,enumerable:!1},[vl]:{value:o,configurable:!1,writable:!1,enumerable:!1},[lh]:{value:r,configurable:!1,writable:!1,enumerable:!1},isValid:{configurable:!1,enumerable:!1,get:()=>{if(r){if(!i)i=r();return i}else return}}}),n}function ph(e,t){let n=sS(e,t),r=uh(e,"maxItems",t),o=uh(e,"minItems",t),i=aS(e,t),s=t.uniqueItems,a;if(Array.isArray(n))a=cS(e,t);else if(t.additionalItems)re(e,"it is needless when items is not array","additionalItems");if(!n||!i||a===null)return null;let c=!1,l=!1;if(Array.isArray(n)){if(r!==void 0&&r<=n.length)n=n.splice(r),a=dh(a,e.delegate);let h=n.findIndex((g)=>ee(g)===I.Never);if(h!==-1){if(n=n.splice(h),a=dh(a,e.delegate),r===void 0)r=n.length,l=!0}if(o!==void 0&&n.length<o)re(e,`length(${n.length}) of items if less than minItems(${o})`),c=!0;if(n.length===0&&a&&ee(a)===I.Never)c=!0}else if(ee(n)===I.Never)c=!0;if(r!==void 0&&o!==void 0&&r<o){if(!l)re(e,`maxItems(${r}) is less than minItems(${o})`);c=!0}let u=c?I.Never:I.Array,d=ki({type:"array",items:n,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return we(u,d,e.delegate,e.path)}function sS(e,{items:t}){if(!t)return we(I.Any,{},e.delegate,e.path);if(Array.isArray(t)){let n=[],r=!1;for(let[o,i]of t.entries()){let s=ze(e,"items",o),a=De(s,Me(i));if(!a){r=!0;continue}n.push(a)}if(r)return null;return n}else{let n=ze(e,"items"),r=Me(t);return De(n,r)}}function uh(e,t,n){let r=n[t];if(r===void 0)return;if(Number.isNaN(r)){re(e,"find NaN",t);return}if(r<0){re(e,`find invalid number ${r}`,t);return}return r}function aS(e,{contains:t}){if(!t)return we(I.Any,{},e.delegate,e.path);let n=ze(e,"contains"),r=Me(t);return De(n,r)}function cS(e,{additionalItems:t}){switch(typeof t){case"boolean":if(t)return we(I.Any,{},e.delegate,e.path);else return!1;case"object":{let n=ze(e,"additionalItems");return De(n,t)}default:return we(I.Any,{},e.delegate,e.path)}}function dh(e,t){if(e===void 0)return we(I.Never,{type:"string",maxLength:0,minLength:1},t);else if(Ze(e))return ee(e)===I.Never?e:Rr(e);else return e}var fh=Object.freeze(["allOf","anyOf","oneOf"]);function Sl(e,t,n,r){if(n.length===0)return $t(e,"disable empty list",t),null;let o=[];for(let[c,l]of n.entries()){let u=ze(e,t,c),d=Me(l),h=De(u,d);if(h)o.push(h)}if(o.length<n.length)return null;let i=0,s=0;for(let c of o)switch(ee(c)){case I.Any:{i+=1;break}case I.Never:{s+=1;break}}let a=I.Combination;switch(t){case"allOf":{if(s>0)a=I.Never;else if(i===o.length)a=I.Any;else if(!lS(o))a=I.Never;break}case"anyOf":{if(i>0)a=I.Any;else if(s===o.length)a=I.Never;break}case"oneOf":{if(i>1)a=I.Never;else if(s===o.length)a=I.Never;else if(i===1&&s===o.length-1)a=I.Any;break}}return we(a,{[t]:o},r,e.path)}function lS(e){let t=null;for(let n of e){let r=ee(n);switch(r){case I.Any:case I.Never:break;default:{if(t===null)t=r;else if(t!==r)return!1;break}}}return!0}var Te=Object.freeze({Valid:0,Invalid:1,Unknown:2});function pt(e,t){let n=e.isValid;if(n)if(n(t)===!0)return Te.Valid;else return Te.Invalid;else return Te.Unknown}function mh(e,t,n,r){let o,i=!1;if(t){if(t.length===0)return $t(e,"disable empty list","enum"),null;o=[];for(let[c,l]of t.entries())switch(pt(r,l)){case Te.Valid:{o.push(xl(l));break}case Te.Invalid:{re(e,"cannot pass JSON schema of currently schema object","enum",c);break}}if(o.length===0)re(e,"all of elements from list is rejected by currently schema object","enum")}if(n!==void 0&&pt(r,n)===Te.Invalid)i=!0;if(o){if(o.length===0)i=!0;else if(n!==void 0){let c=!1;for(let l of o)if(xn(l,n)){c=!0;break}if(!c)i=!0}}let s=i?I.Never:I.EnumOrConst,a={};if(r.type)a.type=r.type;if(o)a.enum=o;if(n!==void 0)a.const=xl(wi(n));return we(s,a,e.delegate,e.path)}var uS=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function hh(e,t){let n=Object.keys(t).filter((y)=>!uS.has(y)&&dt(y));if(n.length>0)re(e,`type="object" will exclude other keys: ${n.toSorted().join(", ")}`);let r=gh(e,"maxProperties",t),o=gh(e,"minProperties",t),i=dS(e,t),s=pS(e,t),a=fS(e,t),c=gS(e,t);if(!i||!s||!a||!c)return null;let l=mS(e,s,a,t);if(!l)return null;let u=hS(i,s,a,l),d=yS(e,u,c,t),h=bS(e,i,l,d,r,o)?I.Never:I.Object,g=ki({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:kS(s),dependencies:xS(c,t),propertyNames:a});return we(h,g,e.delegate,e.path)}function gh(e,t,n){let r=n[t];if(r===void 0)return;if(Number.isNaN(r)){re(e,"find NaN",t);return}if(r<0){re(e,`find invalid number ${r}`,t);return}return r}function dS(e,{additionalProperties:t}){if(t===!1)return we(I.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof t!=="object")return we(I.Any,{},e.delegate,e.path);let n=ze(e,"additionalProperties"),r=Me(t);return De(n,r)}function pS(e,{patternProperties:t}){let n=!1,r={};for(let o in t){let i=vS(o);if(i instanceof Error){re(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=Me(t[o]),a=ze(e,"patternProperties",o),c=De(a,s);if(!c){n=!0;continue}r[o]=[c,i]}if(n)return null;return r}function fS(e,{propertyNames:t}){if(!t)return we(I.Any,{},e.delegate,e.path);t=Me(t);let n=ze(e,"propertyNames"),r=De(n,t);if(!r)return null;let o=ee(r);if(o!==I.String&&o!==I.Any)return Rr(r);return r}function mS(e,t,n,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(pt(n,s)===Te.Invalid){re(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=bh(t,s);if(a&&ee(a)===I.Never){re(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=Me(r[s]),l=ze(e,"properties",s),u=De(l,c);if(!u){o=!0;continue}i[s]=u}if(o)return null;return i}function gS(e,{dependencies:t}){if(!t)return[{},{}];let n={},r={};for(let o in t){let i=Me(t[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=yh(i);if(a)re(e,`found duplicated property names: ${a.join(", ")}`,"dependencies",o);n[o]=s}else{let s=ze(e,"dependencies",o),a=De(s,i);if(a){let c=ee(a);if(c===I.Object||c===I.Any)r[o]=a;else if(c===I.Extends)r[o]=jr;else r[o]=Rr(a)}}}return[n,r]}function hS(e,t,n,r){return(o)=>{if(pt(n,o)===Te.Invalid)return!0;let i=bh(t,o);if(i&&ee(i)===I.Never)return!0;let s=r[o]??e;if(ee(s)===I.Never)return!0;return!1}}function yS(e,t,n,{required:r}){if(!r)return[];let o=yh(r);if(o.duplicated)re(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(wS(n,a).some((l)=>t(l)))s.push(a);else i.push(a);if(s.length>0)re(e,`key ${s.map((a)=>JSON.stringify(a)).join(", ")} will ban by another condition`,"required");return i}function bS(e,t,n,r,o,i){if(o!==void 0&&i!==void 0&&o<i)return re(e,`maxProperties(${o}) is less than minProperties(${i})`),!0;if(o!==void 0&&r.length>o)return re(e,`length(${r.length}) of required is greater than maxProperties(${o})`),!0;if(i!==void 0&&r.length<i)return re(e,`length(${r.length}) of required is less than minProperties(${i})`),!0;if(ee(t)!==I.Never)return!1;for(let s in n){let a=n[s];if(ee(a)!==I.Never)return!1}return!0}function wS([e,t],n){let r=[n],o=new Set(r);while(r.length>0){let s=r.pop(),a=t[s],c=e[s];if(a){if(ee(a)===I.Object)i(a.required)}if(c)i(c)}function i(s){if(s){for(let a of s)if(!o.has(a))o.add(a),r.push(a)}}return[...o]}function yh(e){let t=new Set,n=new Set;for(let r of e)if(t.has(r))n.add(r);else t.add(r);if(n.size===0)return{keys:[...e],duplicated:null};else return{keys:[...t],duplicated:[...n]}}function bh(e,t){for(let n in e){let[r,o]=e[n];if(o.test(t))return r}return null}function vS(e){try{return new RegExp(e,"i")}catch(t){if(t instanceof SyntaxError)return t;else throw t}}function kS(e){let t={};for(let n in e)t[n]=e[n][0];return t}function xS([e,t],{dependencies:n}){let r={};for(let o in n){let i=e[o],s=t[o];r[o]=i||s}return r}var Il=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),wh=new Set(["type","format","maxLength","minLength","pattern"]);function kh(e,t){let{type:n}=t;switch(n){case"number":case"integer":return SS(e,t);case"string":return CS(e,t);case"boolean":case"null":{let r=Object.keys(t).filter((s)=>dt(s)&&s!=="type");if(r.length>0)re(e,`key "type" will exclude other keys: ${r.toSorted().join(", ")}`);let o=n==="null"?I.Null:I.Boolean;return we(o,{type:n},e.delegate,e.path)}default:return $t(e,`invalid type ${JSON.stringify(n)}`),null}}function SS(e,t){let n=Object.keys(t).filter((u)=>!Il.has(u)&&dt(u));if(n.length>0)re(e,`type=${JSON.stringify(t.type)} will exclude other keys: ${n.toSorted().join(", ")}`);let r=gl(t,Il);for(let u of Il){let d=r[u];if(u!=="type"&&d!==void 0&&Number.isNaN(d))re(e,"found NaN",u),delete r[u]}let{maximum:o,exclusiveMaximum:i,minimum:s,exclusiveMinimum:a}=r;if(o!==void 0&&i!==void 0){if(o===i)delete r.maximum;else if(o<i)delete r.exclusiveMaximum;else if(o>i)delete r.maximum}if(s!==void 0&&a!==void 0){if(s===a)delete r.minimum;else if(s<a)delete r.exclusiveMinimum;else if(s>a)delete r.minimum}let{multipleOf:c}=r;if(c===0)delete r.multipleOf,r.type="number",re(e,"cannot be 0","multipleOf");let l=I.Numeric;if(!IS(r))l=I.Never;return we(l,r,e.delegate,e.path)}function IS(e){let{maximum:t,exclusiveMaximum:n,minimum:r,exclusiveMinimum:o}=e;if(t!==void 0&&r!==void 0)return t>=r;else if(n!==void 0&&r!==void 0)return n>r;else if(t!==void 0&&o!==void 0)return t>o;else if(n!==void 0&&o!==void 0)return n>o;else return!0}function CS(e,t){let n=Object.keys(t).filter((a)=>!wh.has(a)&&dt(a));if(n.length>0)re(e,`type="string" will exclude other keys: ${n.toSorted().join(", ")}`);let r=gl(t,wh);vh(e,r,"maxLength"),vh(e,r,"minLength");let{maxLength:o,minLength:i}=r,s=I.String;if(o!==void 0){if(o<0)s=I.Never;else if(o!==void 0&&i!==void 0&&o<i)s=I.Never}return we(s,r,e.delegate,e.path)}function vh(e,t,n){let r=t[n];if(r!==void 0){if(Number.isNaN(r))re(e,"found NaN",n),delete t[n]}}var xh=Object.freeze([]);function Si(e,t,n,r){if(Ze(e))return{schema:e,warns:xh};if(t.isExtendsSchema(e))return{schema:e,warns:xh};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:In.External,error:c});if(a.length>0)return a}else if(s===!1)throw Error("it is not a JSON Schema 7")}let o={delegate:r,payload:n,extends:t,path:[],errors:[],warns:[]},i=De(o,e);if(i)Sh(o.errors.length===0,"found errors (it should be empty)");else return Sh(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function Sh(e,t){if(!e)throw Error(t)}function De(e,t){if(e.extends.isExtendsSchema(t))return t;if(Ze(t))return t;let n=e.extends.tryCompiledExtendsSchema(t,e.payload);if(n)return n;let r=t,o=!1,{enum:i,const:s}=t;if(i||s!==void 0){let{enum:c,const:l,...u}=t;r=u,o=!0}let a=ES(e,r);if(a&&o)a=mh(e,i,s,a);if(!a)return null;return a}function ES(e,t){for(let n of fh){let r=t[n];if(r){let o=Object.keys(t).filter((s)=>dt(s)&&s!==n);if(o.length>0)re(e,`composition key ${JSON.stringify(n)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=Sl(e,n,r);if(!i)return null;return i}}{let n=Me(t.not);if(n){let r=Object.keys(t).filter((a)=>dt(a)&&a!=="not");if(r.length>0)re(e,`key "not" will exclude other keys: ${r.toSorted().join(", ")}`);let o=ze(e,"not"),i=De(o,n);if(!i)return null;let s=I.Not;switch(ee(i)){case I.Never:{s=I.Any;break}case I.Any:{s=I.Never;break}}return we(s,{not:i},e.delegate,e.path)}}if(t.type){let{type:n}=t;if(Array.isArray(n)){let{type:r,...o}=t;return Sl(e,"anyOf",n.map((i)=>({...o,type:i})))}switch(n){case"object":return hh(e,t);case"array":return ph(e,t);default:return kh(e,t)}}if(ah(t))return we(I.Any,{},e.delegate,e.path);return $t(e,"unrecognized"),null}class Cl{constructor(e){let t=Object.freeze(e.toSorted());if(t.length>32)throw Error(`cannot define ${t.length} keys which is greater than 32`);this.keys=t,this.clazz=class extends Ih{constructor(n){super(t,n)}};for(let[n,r]of this.keys.entries()){let o=1<<n;Object.defineProperty(this.clazz.prototype,r,{enumerable:!0,get:function(){return!!(this.int32&o)},set:function(s){if(s)this.int32|=o;else this.int32&=~o}})}}toBundle(e){let t=0;if(typeof e==="number")t=e;else if(e){for(let[n,r]of this.keys.entries())if(e[r])t|=1<<n}return new this.clazz(t)}}class Ih{constructor(e,t){this.keys=e,this.int32=t}toInt32(){return this.int32}toString(){let e={};for(let t of this.keys)e[t]=this[t];return JSON.stringify(e)}}function Ii(e){return new Ch(e)}class Ch{constructor(e){this.description=new Cl(e)}get keys(){return this.description.keys}variable(e){let t;if(e)t=this.description.toBundle(e).toInt32();return new Eh(this.description,t)}}class Eh{constructor(e,t){this.values=new Set;if(this.description=e,t!==void 0)this.values.add(t)}[Symbol.iterator](){let e=this.values[Symbol.iterator]();return{next:()=>{let t=e.next();if(t.done)return t;else return{done:!1,value:this.description.toBundle(t.value)}}}}assign(e){let{values:t}=e;for(let n of t)this.values.add(n);return this}push(e,t){let n=new Set;for(let r of this.values)for(let[o,i]of kt)if(e&i){let s=this.description.toBundle(r);t(o,s),n.add(s.toInt32())}this.values=n}update(e){let t=new Set;for(let n of this.values){let r=this.description.toBundle(n);e(r),t.add(r.toInt32())}this.values=t}}function zt(e,t){let[n]=e,[r]=t;if(n.num<r.num)return OS(e,t);else if(n.num>r.num)return jS(e,t);else return _S(e,t)}function OS(e,t){let[n,r]=e,[o,i]=t;if(r.num<=o.num){let s=r.exclusive,a=o.exclusive;if(r.num<o.num||s||a)return{left:{fromLeft:!0,range:e},right:{fromLeft:!1,range:t}}}if(r.num<=i.num){let s=!0,a=!1;if(r.num===i.num){let c=r.exclusive,l=i.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!1,range:[He(r),i]};return{left:{fromLeft:!0,range:[n,He(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[n,He(o)]},center:[o,i],right:{fromLeft:!0,range:[He(i),r]}}}function jS(e,t){let[n,r]=e,[o,i]=t;if(n.num>=i.num){let s=i.exclusive,a=n.exclusive;if(n.num>i.num||s||a)return{left:{fromLeft:!1,range:t},right:{fromLeft:!0,range:e}}}if(i.num<=r.num){let s=!0,a=!1;if(r.num===i.num){let c=i.exclusive,l=r.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!0,range:[He(i),r]};return{left:{fromLeft:!1,range:[o,He(n)]},center:[n,i],right:c}}}return{left:{fromLeft:!1,range:[o,He(n)]},center:[n,r],right:{fromLeft:!1,range:[He(r),i]}}}function _S(e,t){let[n,r]=e,[o,i]=t,s=n.exclusive,a=o.exclusive,c,l=n;if(!s&&a)l=o,c={fromLeft:!0,range:[n,He(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,He(n)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let h=r.exclusive,g=i.exclusive;u=h!==g,d=!h&&g}if(!d){let h;if(u)h={fromLeft:!1,range:[He(r),i]};return{left:c,center:[l,r],right:h}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[He(i),r]}}}function He(e){return{num:e.num,exclusive:!e.exclusive}}var En=(e)=>(t=e,n=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=zt([{num:t,exclusive:!1},{num:n,exclusive:!1}],[{num:r,exclusive:!1},{num:o,exclusive:!1}]),c,l,u;if(i)c={min:i.range[0].num,max:i.range[1].num,isFrom1:i.fromLeft};if(a)l={min:a.range[0].num,max:a.range[1].num,isFrom1:a.fromLeft};if(s)u={min:s[0].num,max:s[1].num};return{left:c,right:l,intersection:u}};function On({left:e,right:t,intersection:n}){if(!n)return w.Rejection;let r=!1,o=!1;if(e)if(e.isFrom1)r=!0;else o=!0;if(t)if(t.isFrom1)r=!0;else o=!0;if(r&&o)return w.Intersection;if(r)return w.Containing;if(o)return w.ContainedBy;return w.Equals}var RS=En(0),AS=Ii(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function jh({calculate:e},t,n){let r=RS(t.minItems,t.maxItems,n.minItems,n.maxItems),o=On(r);if(o===w.Rejection)return Q;let[i,s]=Oh(t),[a,c]=Oh(n),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=AS.variable({}),h=Math.min(t.minItems??0,n.minItems??0);for(let y=0;y<u;y++){let S=i[y]??s,A=a[y]??c,N=e(S,A);d.push(N,(L,D)=>{switch(L){case w.Equals:{if(!D.hasRejection)D.hasCommon=!0;break}case w.Containing:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra1=!0;break}case w.ContainedBy:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra2=!0;break}case w.Intersection:{if(!D.hasRejection)D.hasCommon=!0;D.hasExtra1=!0,D.hasExtra2=!0;break}case w.Rejection:{if(y<h)D.hasCommonBroken=!0;D.hasRejection=!0,D.hasExtra1=!0,D.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case w.Containing:{y.hasExtra1=!0;break}case w.ContainedBy:{y.hasExtra2=!0;break}case w.Intersection:{y.hasExtra1=!0,y.hasExtra2=!0;break}}if(t.uniqueItems&&!n.uniqueItems&&(n.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra2=!0;else if(!t.uniqueItems&&n.uniqueItems&&(t.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra1=!0;if(t.maxItems===0||n.maxItems===0){if(y.hasCommon=!0,t.maxItems!==0)y.hasExtra1=!0;if(n.maxItems!==0)y.hasExtra2=!0}});let g=pe;for(let{hasExtra1:y,hasExtra2:S,hasCommon:A,hasCommonBroken:N}of d){let L=A;if(N)L=!1;if(!L)g|=Q;else if(y&&S)g|=ne;else if(y)g|=U;else if(S)g|=W;else g|=H}return g}function Oh({items:e,additionalItems:t}){if(Array.isArray(e))return[e,t??Nt];else return[[],e??Nt]}function _h(e){let t=new Map;return(n,r)=>{let o=_r(n),i=_r(r);if(o!==i)return!1;if(!o)return n===r;return Ah(t,n,r,e)}}function Rh(e){let t=new Map;return(n,r)=>Ah(t,n,r,e)}function Ah(e,t,n,r){let o=Wt(t),i=Wt(n),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(t,n));return a}function Th(e,t,n){let r=El(t),o=El(n),i=!1,s=!1,a=!1;for(let c of r){if(Ph(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(Ph(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return Q;if(i&&s)return ne;if(i)return U;if(s)return W;return H}function Ol(e,t){let n=!1,r=!1;for(let o of El(e)){switch(pt(t,o)){case Te.Valid:{n=!0;break}case Te.Invalid:{r=!0;break}case Te.Unknown:return We}if(n&&r)break}if(n&&r)return ne;if(n)return H|W;if(r)return Q;if(ee(t)===I.Never)return H;return W}function El({const:e,enum:t}){if(e!==void 0)return[e];if(t)return t;throw Error("invalid branch")}function Ph({isEquals:e},t,n){for(let r of t)if(e(r,n))return!0;return!1}function $h(e){function t(s,a){let c=e.isExtendsSchema(s),l=e.isExtendsSchema(a);if(c||l)return e.equals(s,a);else return r(s,a)}let n=new Map;function r(s,a){let c=Wt(s),l=Wt(a);if(c===l)return!0;let u=`${c}/${l}`,d=n.get(u);if(d===void 0)d=o(s,a),n.set(u,d);return d}function o(s,a){if(Array.isArray(s)){if(!Array.isArray(a))return!1;if(s.length!==a.length)return!1;for(let[c,l]of s.entries())if(!i(l,a[c]))return!1}else{if(Array.isArray(a))return!1;for(let c in s){if(!(c in a))return!1;let l=Reflect.get(s,c),u=Reflect.get(a,c);if(!i(l,u))return!1}for(let c in a)if(!(c in s))return!1}return!0}function i(s,a){if(s===a)return!0;if(s===null||a===null)return!1;if(typeof s!=="object")return!1;if(typeof s!==typeof a)return!1;if(Ze(s)&&Ze(a))return r(s,a);return o(s,a)}return t}function Ar(e){let t=Pr(e),n=e.multipleOf??1,r=st(t,n);if(!r)return null;return{multipleOf:n,range:r}}function Nh([e,t]){if(e.num!==t.num)return!1;if(e.exclusive)return!1;if(t.exclusive)return!1;return!0}function st(e,t){if(!e)return;let[n,r]=e,o=PS(n.num,t),i=TS(r.num,t);if(o===n.num&&n.exclusive)o+=t;if(i===r.num&&r.exclusive)i-=t;if(o>i)return;if(o===i){if(o===Number.POSITIVE_INFINITY)return;if(o===Number.NEGATIVE_INFINITY)return}return[{num:o,exclusive:!1},{num:i,exclusive:!1}]}function PS(e,t){return Math.ceil(e/t)*t}function TS(e,t){return Math.floor(e/t)*t}function Dh(e,t){let n=Pr(e),r=Pr(t),{left:o,right:i,center:s}=zt(n,r);if(!s)return Q;let a=!1,c=!1;if(o)if(o.fromLeft)a=!0;else c=!0;if(i)if(i.fromLeft)a=!0;else c=!0;if(a&&c)return ne;if(a)return U;if(c)return W;return H}function jl(e,t){let n=Pr(e),r=Ar(t);if(!r)return U;let o=zt(n,r.range),i=st(o.center,r.multipleOf),s=zh(o.left,r.multipleOf),a=zh(o.right,r.multipleOf);if(!o.center)return Q;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!Nh(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return ne;if(c)return U;if(l)return W;return H}function Pr(e){let t,n;if(e.exclusiveMinimum!==void 0)t={num:e.exclusiveMinimum,exclusive:!0};else if(e.minimum!==void 0)t={num:e.minimum,exclusive:!1};else t={num:Number.NEGATIVE_INFINITY,exclusive:!0};if(e.exclusiveMaximum!==void 0)n={num:e.exclusiveMaximum,exclusive:!0};else if(e.maximum!==void 0)n={num:e.maximum,exclusive:!1};else n={num:Number.POSITIVE_INFINITY,exclusive:!0};return[t,n]}function zh(e,t){if(!e)return;if(e.fromLeft)return;return st(e.range,t)}function Lh(e,t){let n=Ar(e),r=Ar(t);if(!n&&!r)return H;if(!n)return W;if(!r)return U;let{range:o,multipleOf:i}=n,{range:s,multipleOf:a}=r,c=zt(o,s),l,u=0;if(c.center)u=$S(i,a),l=st(c.center,u);if(!l)return Q;let d=!1,h=!1,{left:g,right:y}=c;if(g&&st(g.range,g.fromLeft?i:a))if(g.fromLeft)d=!0;else h=!0;if(y&&st(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else h=!0;if(d=d||qh(n,l,u),h=h||qh(r,l,u),d&&h)return ne;if(d)return U;if(h)return W;return H}function qh({range:e,multipleOf:t},n,r){let o=zt(e,n);if(st(o.left?.range,t))return!0;if(st(o.right?.range,t))return!0;let i=st(o.center,t);if(!i)return!1;let s=Vh(n);if(Vh(i)>s)return!0;if(s===1)return!1;if(t<r)return!0;return!1}function $S(e,t){return e*t/Fh(e,t)}function Fh(e,t){if(e===0)return t;return Fh(t%e,e)}function Vh(e){if(!e)return 0;let[t,n]=e;return n.num-t.num+1}function _l(e,t){if(Mh(e)||Mh(t))return We;let n=Zh(e),r=Zh(t);if(n&&r)return Dh(e,t);else if(n)return jl(e,t);else if(r)return Tt(jl(t,e));else return Lh(e,t)}function Mh(e){let{multipleOf:t}=e;if(t===void 0)return!1;if(!Number.isInteger(t))return!0;if(t<0)return!0;return!1}function Zh(e){let{multipleOf:t}=e;if(t!==void 0&&Number.isInteger(t))return!1;if(e.type==="integer")return!1;return!0}var NS=En(0),zS=Ii(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function Uh(e,t,n){if(DS(t,n))return Q;let r=qS(t,n);if(!r)return Q;let o=Jh(t),i=Jh(n),s=(S)=>{let A=o(S),N=i(S);if(Bh(A,N))return e.calculate(A,N);else return pe},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=zS.variable({});for(let S of[...a].toSorted())u.push(s(S),LS);for(let S of[...c].toSorted())u.push(s(S),FS);for(let S of[...l].toSorted())u.push(s(S),MS);let{hasOptional1:d,hasOptional2:h}=r;if(d||h){let S=ZS(d,h);for(let L of[...VS(t,n)].toSorted()){let D=s(L);if(D!==pe)u.push(D,S)}let A=t.additionalProperties??Nt,N=n.additionalProperties??Nt;if(Bh(A,N)){let L=e.calculate(A,N);u.push(L,S)}}u.update((S)=>{if(!S.hasRejection){if(c.size>0)S.hasExtra2=!0;if(l.size>0)S.hasExtra1=!0}});let{requiredKeysCount:g}=r,y=pe;for(let{hasExtra1:S,hasExtra2:A,hasCommonInRequired:N,hasCommonOutRequired:L,hasRejection:D}of u)if(!N&&g>0)y|=Q;else if(!L&&g===0)y|=Q;else if(D)y|=Q;else if(S&&A)y|=ne;else if(S)y|=U;else if(A)y|=W;else y|=H;return y}function DS(e,t){let n=NS(e.minProperties,e.maxProperties,t.minProperties,t.maxProperties);return On(n)===w.Rejection}function qS(e,t){let n=new Set(e.required),r=new Set(t.required),o=new Set,i=new Set,s=n.size,a=r.size;for(let d of n){if(r.has(d))o.add(d);i.add(d)}for(let d of r){if(n.has(d))o.add(d);i.add(d)}let c=i.size;for(let d of o)n.delete(d),r.delete(d);let l=e.maxProperties??Number.MAX_SAFE_INTEGER,u=t.maxProperties??Number.MAX_SAFE_INTEGER;if(c>l||c>u)return null;return{requiredKeysCount:c,extraRequired1:n,extraRequired2:r,commonRequired:o,hasOptional1:l>s,hasOptional2:u>a}}function VS(e,t){let n=new Set(e.required),r=e.properties,o=t.properties,i=e.required,s=t.required;if(r)for(let a in r)n.add(a);if(o)for(let a in o)n.add(a);if(i)for(let a of i)n.delete(a);if(s)for(let a of s)n.delete(a);return n}var LS=(e,t)=>{switch(e){case w.Equals:{t.hasCommonInRequired=!0;break}case w.Containing:{t.hasExtra1=!0,t.hasCommonInRequired=!0;break}case w.ContainedBy:{t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case w.Intersection:{t.hasExtra1=!0,t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case w.Rejection:{t.hasRejection=!0;break}}},FS=(e,t)=>{switch(e){case w.Equals:case w.ContainedBy:{t.hasCommonInRequired=!0;break}case w.Intersection:case w.Containing:{t.hasExtra1=!0,t.hasCommonInRequired=!0;break}case w.Rejection:{t.hasRejection=!0;break}}},MS=(e,t)=>{switch(e){case w.Equals:case w.Containing:{t.hasCommonInRequired=!0;break}case w.Intersection:case w.ContainedBy:{t.hasExtra2=!0,t.hasCommonInRequired=!0;break}case w.Rejection:{t.hasRejection=!0;break}}},ZS=(e,t)=>(n,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(n){case w.Equals:{s=!0;break}case w.Containing:{o=!0,s=!0;break}case w.ContainedBy:{i=!0,s=!0;break}case w.Intersection:{o=!0,i=!0,s=!0;break}case w.Rejection:{o=!0,i=!0;break}}if(e&&o)r.hasExtra1=!0;if(t&&i)r.hasExtra2=!0;if(e&&t&&s)r.hasCommonOutRequired=!0};function Jh(e){let{properties:t,propertyNames:n,additionalProperties:r}=e,o=[];if(e.patternProperties)for(let i in e.patternProperties){let s=e.patternProperties[i],a=new RegExp(i,"i");o.push({pattern:a,schema:s})}return(i)=>{if(n&&pt(n,i)===Te.Invalid)return jr;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(t&&t[i])??r;if(!s)return Nt;return s}}function Bh(e,t){let n=ee(e),r=ee(t);return n!==I.Never||r!==I.Never}var JS=En(0);function Kh(e,t){if(t.format&&!e.format)return U;if(e.format&&t.format&&e.format!==t.format)return We;let n=JS(e.minLength,e.maxLength,t.minLength,t.maxLength),r=On(n),o=!!e.pattern,i=!!t.pattern;switch(r){case w.Rejection:return Q;case w.Containing:return o?We:U;case w.ContainedBy:return i?We:W;case w.Equals:{if(o&&i)return e.pattern===t.pattern?H:We;if(o)return H|W;if(i)return H|U;return H}case w.Intersection:{if(o&&i)return We;if(o)return ne|Q|W;if(i)return ne|Q|U;return ne}}}function Gh(e,t,n){let r={},o=[],i=Rh(US(e,r)),s=BS(),a=$h(e);r.isEquals=_h(xn),r.calculate=bl({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,h)=>{let g=h?Tt(d):d;if(!KS(g))return;let y=h?Wh(u,l):Wh(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(t,n);return{errorPath:o[0],expression:c}}var BS=()=>(e)=>{let t;switch(ee(e)){case I.Not:{t={kind:Fe.Not,expression:e.not};break}case I.Combination:{if("allOf"in e)t={kind:Fe.AllOf,expressions:Rl(e.allOf,I.Any)};else if("anyOf"in e)t={kind:Fe.AnyOf,expressions:Rl(e.anyOf,I.Never)};else if("oneOf"in e)t={kind:Fe.OneOf,expressions:Rl(e.oneOf,I.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{t={kind:Fe.Leaf};break}}return t},US=(e,t)=>(n,r)=>{let o=ee(n),i=ee(r);if(o===I.Extends||i===I.Extends)return e.calculate(n,r);switch(o){case I.Any:return i===I.Any?H:U;case I.Never:return i===I.Never?H:W}switch(i){case I.Any:return W;case I.Never:return U}if(o===I.EnumOrConst&&i===I.EnumOrConst)return Th(t,n,r);if(o===I.EnumOrConst)return Ol(n,r);if(i===I.EnumOrConst)return Tt(Ol(r,n));if(o!==i)return Q;switch(o){case I.Null:return H;case I.Numeric:return _l(n,r);case I.String:return Kh(n,r);case I.Boolean:return H;case I.Object:return Uh(t,n,r);case I.Array:return jh(t,n,r);default:throw Error(`invalid kind ${o}`)}};function Rl(e,t){return e.filter((n)=>ee(n)!==t)}function KS(e){return!kr(e)&&!Sr(e)&&(xr(e)||Cr(e)||Ir(e))}function Wh(e,t){let n=kl(t);if(!n)return;let r=ee(e),o=ee(t);if(r!==o)return[...n,"type"];let i=e,s=t;switch(o){case I.String:{if((i.minLength??0)<(s.minLength??0))return[...n,"minLength"];if((i.maxLength??Number.POSITIVE_INFINITY)>(s.maxLength??Number.POSITIVE_INFINITY))return[...n,"maxLength"];if(i.pattern!==s.pattern&&s.pattern)return[...n,"pattern"];if(i.format!==s.format&&s.format)return[...n,"format"];break}case I.Numeric:{if((i.minimum??i.exclusiveMinimum??Number.NEGATIVE_INFINITY)<(s.minimum??s.exclusiveMinimum??Number.NEGATIVE_INFINITY))return[...n,s.exclusiveMinimum==null?"minimum":"exclusiveMinimum"];if((i.maximum??i.exclusiveMaximum??Number.POSITIVE_INFINITY)>(s.maximum??s.exclusiveMaximum??Number.POSITIVE_INFINITY))return[...n,s.exclusiveMaximum==null?"maximum":"exclusiveMaximum"];if(i.multipleOf!==s.multipleOf&&s.multipleOf!=null)return[...n,"multipleOf"];break}case I.Array:{if((i.minItems??0)<(s.minItems??0))return[...n,"minItems"];if((i.maxItems??Number.POSITIVE_INFINITY)>(s.maxItems??Number.POSITIVE_INFINITY))return[...n,"maxItems"];if(!i.uniqueItems&&s.uniqueItems)return[...n,"uniqueItems"];break}case I.Object:{let a=new Set(i.required??[]);if((s.required??[]).some((c)=>!a.has(c)))return[...n,"required"];if((i.minProperties??0)<(s.minProperties??0))return[...n,"minProperties"];if((i.maxProperties??Number.POSITIVE_INFINITY)>(s.maxProperties??Number.POSITIVE_INFINITY))return[...n,"maxProperties"];break}case I.EnumOrConst:return[...n,s.const===void 0?"enum":"const"]}return n}class Tr{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,t){for(let n of this.extendsSchemaClasses)if(n.isMatch(e))return new n(At(),e,t);return null}isExtendsSchema(e){for(let t of this.extendsSchemaClasses)if(e instanceof t)return!0;return!1}calculate(e,t){let n=this.findMatchedClass(e,t),r=!(e instanceof n),o=pe,i;if(r)i=t.compare(e);else i=e.compare(t);for(let s of i){if(r)s=Tr.swap(s);o|=Pt(s)}return o}equals(e,t){let n=this.findMatchedClass(e,t);if(!(e instanceof n))return t.equals(e);else return e.equals(t)}findMatchedClass(e,t){for(let n of this.extendsSchemaClasses){if(e instanceof n)return n;if(t instanceof n)return n}throw Error("Invalid schema")}static swap(e){switch(e){case w.Containing:return w.ContainedBy;case w.ContainedBy:return w.Containing;default:return e}}}function Hh(e,t,n=!1){let r=t(e);if(Array.isArray(r)){let s=[];throw Al(s,r,"$"),new vi(s)}let{schema:o,warns:i}=r;if(n&&i.length>0){console.warn(`found ${i.length} warns after compile schema`);for(let s of i)console.warn(Cn(s))}return o}function Qh(e,t,n,r=!1){let o=n(e),i=n(t);if(Array.isArray(o)||Array.isArray(i)){let u=[];if(Array.isArray(o))Al(u,o,"$1");if(Array.isArray(i))Al(u,i,"$2");throw new vi(u)}let{schema:s,warns:a}=o,{schema:c,warns:l}=i;if(r){if(a.length>0)console.warn(`found ${a.length} warns after compile superSchema`);for(let u of a)console.warn(Cn(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(Cn(u))}return[s,c]}function Al(e,t,n){for(let r of t){let o={...r,path:[n,...r.path]};e.push(o)}}var $r=Object.freeze({True:0,False:1,Unknown:2});function Pl({extendsSchemaClasses:e,delegate:t}={}){let n=new Tr(e);return Object.freeze({compile:(o,i,s)=>Hh(o,(c)=>Si(c,n,i,t),s),isSubset:(o,i,s=!1)=>{let a=(y)=>Si(y,n,void 0,t),[c,l]=Qh(o,i,a,s),{errorPath:u,expression:d}=Gh(n,c,l),h=kr(d)||Sr(d),g=xr(d)||Cr(d)||Ir(d);if(h&&!g)return{result:$r.True};if(!h&&g)return{errorPath:u,result:$r.False};return{result:$r.Unknown}}})}var Ci=(e)=>typeof e==="string";var WS=Array.isArray;var GS=(e)=>e!==null&&typeof e==="object";var HS=(e)=>GS(e)&&!WS(e),Gt=(e)=>HS(e)?e:void 0;function QS(e){return Gt(e)?.type==="string"}function YS(e){let t=Gt(e),n=Gt(t?.error);if(t==null||n==null||t.packageId!=null&&!Ci(t.packageId)||n.message!=null&&!Ci(n.message))throw TypeError("Invalid schema comparison context.")}function XS(e){if(e==null)return{error:{}};return YS(e),e}class Dt{static setError(e,t,n){if(e instanceof Dt)e.context.error.message=n;else if(t instanceof Dt)t.context.error.message=n}constructor(e,t,n){this.id=e,this.value=t,this.context=XS(n)}compare(e){if(Ze(e)&&ee(e)===I.Any)return[w.ContainedBy];return this.compareImpl(e)}}class Nr extends Dt{static isMatch(e){let t=Gt(e)?.enum;return Array.isArray(t)&&t.every((n)=>Ci(n))}constructor(e,t,n){if(!Nr.isMatch(t))throw TypeError("Invalid single-select schema.");super(e,t,n)}compareImpl(e){if(QS(e))return[w.ContainedBy];if(e instanceof Nr){let t=new Set(this.value.enum),n=w.Equals;for(let r of e.value.enum){if(!t.has(r))n=w.ContainedBy;t.delete(r)}if(t.size===0)return[n];if(t.size===this.value.enum.length)return[w.Rejection];return[w.Intersection]}return[w.Rejection]}equals(e){if(e instanceof Nr){let t=new Set(this.value.enum);for(let n of e.value.enum){if(!t.has(n))return!1;t.delete(n)}return t.size===0}return!1}}class zr extends Dt{static isMatch(e){return Gt(e)?.contentMediaType==="oomol/bin"}constructor(e,t,n){if(!zr.isMatch(t))throw TypeError("Invalid binary schema.");super(e,t,n)}compareImpl(e){if(e instanceof zr)return[w.Equals];else return Dt.setError(this,e,"edgeError.binDiffType"),[w.Rejection]}equals(e){return e instanceof zr}}class Dr extends Dt{static isMatch(e){return Gt(e)?.contentMediaType==="oomol/artifact"}constructor(e,t,n){if(!Dr.isMatch(t))throw TypeError("Invalid Artifact schema.");super(e,t,n)}compareImpl(e){if(e instanceof Dr)return[w.Equals];return Dt.setError(this,e,"edgeError.artifactDiffType"),[w.Rejection]}equals(e){return e instanceof Dr}}function Yh(){return Pl({extendsSchemaClasses:[Nr,zr,Dr]})}var LR=Yh();var eI=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function Ei(e){return eI.has(e)}function Tl(e){if(e.kind!="task")return[];if("moduleId"in e.task)return(e.task.capabilities??[]).flatMap((t,n)=>t.kind=="workflow"?[{target:t,path:`task/capabilities/${n}`,tool:t.name}]:[]);if(e.task.executor.kind=="workflow")return[{target:{...e.task.executor,inputs:e.task.inputs.filter((t)=>("handle"in t)),outputs:e.task.outputs.filter((t)=>("handle"in t))},path:"task/executor"}];if(e.task.executor.kind=="agent")return e.task.executor.tools.flatMap((t,n)=>t.kind=="workflow"?[{target:t,path:`task/executor/tools/${n}`,tool:t.name}]:[]);return[]}var Oi=O({handle:C().min(1),jsonSchema:Pe(),nullable:he(),description:C().optional()}),YR=v({inputs:R(Oi).nullable(),outputs:R(Oi).nullable()});var Xh=O({version:b(1),flowId:C().min(1),name:C(),revisionId:C().min(1),publicationId:C().min(1),inputs:R(Oi),outputs:R(Oi).nullable()});var ey=O({version:b(1),direction:Z(["incoming","outgoing"]),total:xe().nonnegative(),nextOffset:xe().nonnegative().optional(),references:R(O({flowId:C(),name:C().nullable(),available:he(),draft:he(),live:O({publicationId:C(),enabled:he()}).nullable()}))});var $l=["GET","POST","PUT","PATCH","DELETE"];function ji(e){return e!=="GET"}function nI(e){return e.kind==="decision"}var Nl={choice:255,score:10};function ty(e){if(e.type==="noul"||e.criteria.length<=Nl[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,Nl.choice)};return{...e,criteria:e.criteria.slice(0,Nl.score)}}function rI(e){let t=e.map(ty);return t.every((n,r)=>n===e[r])?e:t}function ny(e){if(!nI(e.executor))return e;let t=e.executor.questions,n=rI(t);if(n===t)return e;let r=e.outputs.map((o)=>{if(!("handle"in o))return o;let i=t.findIndex((s)=>s.name===o.handle);if(i<0||t[i]===n[i]||!Ie(o.jsonSchema,ry(t[i])))return o;return{...o,jsonSchema:oI(n[i])}});return{...e,executor:{...e.executor,questions:n},outputs:r}}var zl={type:"number",minimum:0,maximum:1};function oI(e){return ry(ty(e))}function ry(e){let t={type:{const:e.type}};if(e.type==="noul")t.noul=zl;else{let n=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(t.confidence=zl,t.probabilities={type:"object",properties:Object.fromEntries(n.map((r)=>[r,zl])),required:n,additionalProperties:!1},e.type==="choice")t.choice={type:"string",...n.length?{enum:n}:{}};else t.score={type:"number",minimum:0,maximum:Math.max(0,n.length-1)},t.legend={type:"object",properties:Object.fromEntries(n.map((r)=>[r,{type:"string"}])),required:n,additionalProperties:!1}}return{type:"object",properties:t,required:Object.keys(t)}}function oy(e){for(let[t,n]of Object.entries(e))if(t.startsWith("auth.")&&n.kind=="value")throw TypeError("HTTP authentication accepts deployment variables and upstream outputs only.")}var iI=/^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Dl=20;function ql(e){return iI.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var iy=v({mode:Z(["fields","object"]).default("fields"),names:R(C()).default([])}),_i=v({method:Z(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:iy.default({mode:"fields",names:[]}),headers:iy.default({mode:"fields",names:[]}),bodyFormat:Z(["none","json","text","form"]).default("none"),authentication:Y([v({type:b("none")}),v({type:Z(["bearer","basic"])}),v({type:b("apiKey"),name:C(),in:Z(["header","query"])})]).default({type:"none"}),responseFormat:Z(["auto","json","text"]).default("auto"),statusPolicy:Z(["success","all"]).default("success")}),ay=_i.extend({kind:b("http-request")});function ft(e,t=0){if(t>64)throw TypeError("Value exceeds the maximum JSON depth.");if(e!=null&&typeof e=="object")for(let n of Object.values(e))ft(n,t+1)}var Vl=["code","connector","openapi","http-request","llm","decision"],Ri={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var mt=v({maxRetries:B().int().min(0).max(Ri.maxRetries),intervalMs:B().int().min(Ri.minIntervalMs).max(Ri.maxIntervalMs).multipleOf(Ri.intervalStepMs)});var qt=R(Y([O({type:b("cron"),expression:C(),timezone:C()}),O({type:b("every"),unit:Z(["day","hour","minute","month","week"]),value:B()})]));function cy(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var jn=it("kind",[v({kind:b("after"),durationMs:B().nullable()}),v({kind:b("at"),at:C(),timezone:C().optional()})]),Ll=it("kind",[jn.options[0].extend({durationMs:B().int().positive().max(Number.MAX_SAFE_INTEGER)}),jn.options[1].extend({at:wr.datetime({offset:!0}),timezone:C().refine(cy,"Select a valid IANA timezone.").optional()})]);var Vr={defaultMs:30000,minMs:1000,maxMs:60000};var ly={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var cI=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:ly.jsonSchema,nullable:!1,value:{}}];var zi=13,x=C(),Pi=x.describe('Account selection: omit while unconfigured; use an account ID to select it; use "" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.'),Yt=Pe(),Lr=R(x),Vt=O({description:x.optional(),jsonSchema:Yt,nullable:he(),handle:x}),lI=R(Vt.strict()),Qe=Vt.extend({value:Yt.optional()}),uy=O({collapsed:he().optional(),group:x}),uI=O({kind:b("node"),nodeId:x,output:x,system:b(!0).optional(),field:x.optional()}),fy=Y([uI,O({kind:b("binding"),bindingId:x})]),Fr=Y([O({kind:b("unset")}),O({kind:b("value"),value:Yt})]),Fl=Y([Fr,O({kind:b("sources"),sources:R(fy)})]),my=oe(x,Fl),Rn={inputs:R(Y([Qe,uy])),outputs:R(Y([Vt,uy]))},dI=v({kind:b("connector"),action:x,connectionId:x.optional(),connections:R(v({connectionId:x,alias:x.optional()}))}),Ul=Y([dI,v({kind:b("connector"),mode:b("shared")}),v({kind:b("connector"),mode:b("independent"),actions:R(v({action:x,connectionId:Pi.optional()}))}),v({kind:b("connector"),actionHints:R(x).optional(),connectionHints:R(v({action:x,connectionId:x,alias:x.optional()})).optional()})]),gy=v({kind:b("workflow"),name:x,flowId:x,revisionId:x,inputs:R(Vt),outputs:R(Vt).nullable()}),Kl=v({kind:b("http"),hosts:R(x.refine(ql,'Use a lowercase host name or IPv4 address, optionally prefixed by "*." for subdomains.')).min(1).max(Dl).describe('Hosts Code may call with context.fetch. "*.example.com" matches subdomains only.')}),Ti=Y([Ul,gy,Kl]),Ml=O({...Rn,name:x,moduleId:x,capabilities:R(Ti).optional()}),hy=Y([O({kind:b("value"),value:Yt}),O({kind:b("input"),input:x})]),pI=Y([hy,O({kind:b("model")})]),Di={id:x,name:x,description:x,approval:he(),inputs:R(Qe.extend({source:pI}))},Wl=O({...Di,kind:b("connector").optional(),action:x,connectionId:Pi.optional()}),Gl=gy.extend(Di),fI=it("type",[v({name:x,instructions:x,type:b("noul"),criteria:v({true:x.optional(),false:x.optional()}).optional()}),v({name:x,instructions:x,type:b("choice"),criteria:R(v({name:x,description:x}))}),v({name:x,instructions:x,type:b("score"),criteria:Lr})]),_n=O({...Rn,name:x,executor:Y([O({kind:b("connector"),action:x,connectionId:Pi.optional(),outputMode:b("value").optional()}),O({kind:b("openapi"),sourceUrl:x,method:x,path:x,serverUrl:x,document:Yt,auth:R(O({id:x,type:Z(["bearer","basic","apiKey"]),name:x.optional(),in:Z(["header","query"]).optional()}))}),v({kind:b("decision"),questions:R(fI)}),O({kind:b("llm"),mode:Z(["chat","json"])}),O({kind:b("agent"),code:he().optional(),model:x,prompt:x,maxRounds:B(),tools:R(Y([Gl,Wl])),notification:O({action:x,connectionId:Pi.optional(),inputDefinitions:R(Qe),messageHandle:x,inputs:oe(x,hy)}).optional()}),v({kind:b("workflow"),flowId:x,revisionId:x}),ay,nh])}),Zl=_n.transform(ny),dy=Y([O({kind:b("value"),value:Yt.optional(),jsonSchema:Yt.optional()}),O({kind:b("source"),source:fy})]),$i={matchMode:Z(["first","all"]),cases:R(O({description:x.optional(),output:x,groups:R(O({expressions:R(O({left:dy,operator:Z(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:dy.optional()}))}))}))},Mr={inputDefinitions:R(Qe),prompt:x},mI=O({allowedMethods:ot().optional(),allowedOrigins:Lr.optional(),noResponseBody:ot().optional(),responseBody:it("kind",[v({kind:b("workflow-outputs"),output:x.optional(),timeoutMs:B().int().min(Vr.minMs).max(Vr.maxMs).optional()}),v({kind:b("webhook-response"),nodeId:x.optional(),timeoutMs:B().int().min(Vr.minMs).max(Vr.maxMs).optional()})]).optional(),responseData:x.optional(),responseHeaders:oe(x,x).optional(),responseHeadersSource:v({kind:b("workflow-outputs"),output:x.optional()}).optional(),responseHeaderOutputs:oe(x,x).optional(),responseStatusCode:B().int().min(200).max(599).optional(),responseStatusCodeOutput:x.optional()}),Ni={bodyFields:R(Qe),method:Z($l),options:mI.optional()},py={configInputs:Rn.inputs,definitionVersion:b(2),description:x,displayName:x,key:x,name:x,outputs:R(Vt).refine((e)=>new Set(e.map((t)=>t.handle)).size===e.length,"Duplicate Trigger output handle."),provider:x},gI=O({body:O({allowArray:he(),allowEmpty:he(),formats:R(Z(["form","json","multipart","text"]))}),methods:R(Z(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:B()}),Jl=R(x.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),Ht={name:x,description:x.optional(),icon:x.optional()},Qt={maxExecutions:B().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:my,name:x.optional(),description:x.optional(),icon:x.optional(),timeoutMs:B().optional(),retry:mt.optional(),onError:Z(["stop","error"]).optional()},Ai=Y([v({...Qt,kind:b("webhook-response"),retry:ot().optional(),onError:ot().optional()}),v({...Qt,kind:b("outputs"),outputDefs:R(Vt.strict()),outputMappings:my}).omit({inputs:!0}),O({...Qt,inputs:oe(x,ot()),kind:b("condition"),...$i}),O({...Qt,inputs:rt().transform(()=>({})).default({}),kind:b("value"),values:R(Qe)}),O({...Qt,kind:b("task"),task:Y([Ml,Zl]),additionalInputs:R(Qe).optional()}),v({...Qt,kind:b("approval"),...Mr}).omit({timeoutMs:!0}),v({...Qt,kind:b("wait"),...Mr,autoContinue:jn.optional()}).omit({timeoutMs:!0}),O({...Ht,kind:b("manual")}),v({...Ht,kind:b("start"),inputDefs:lI}),v({...Ht,kind:b("error"),sourceFlowIds:Jl.optional()}),O({...Ht,kind:b("webhook"),...Ni}),O({...Ht,kind:b("cron"),cronTimes:qt}),O({...Ht,kind:b("poll"),connectionId:x.min(1).optional(),config:oe(x,Fr),definition:O({...py,type:b("poll")}),pollTimes:qt}),O({...Ht,kind:b("integration"),connectionId:x.min(1).optional(),config:oe(x,Fr),definition:O({...py,type:b("integration"),endpoint:gI})})]),ct={input:Qe,port:Vt,ports:Rn,condition:v($i),wait:v(Mr),waitAutoContinue:Ll,webhook:v(Ni),schedule:qt,capabilities:R(Ti),connector:_n.shape.executor.options[0].omit({kind:!0}).strict(),openapi:_n.shape.executor.options[1].omit({kind:!0}).strict(),decision:_n.shape.executor.options[2].omit({kind:!0}).strict(),llm:_n.shape.executor.options[3].omit({kind:!0}).strict(),agent:_n.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Bl=O({source:x,target:x,sourceHandle:x.optional()}),Oe={nodeId:x,target:ot().optional()},hI=O({nodes:oe(x,Ai),edges:R(Bl).default([])}),yy=O({kind:b("variable"),target:x}),by=O({name:x,imports:Lr,source:x}),yI=Wg(bI,O({bindings:oe(x,yy),graph:hI})),wy=O({modelVersion:Y([b(2),b(4),b(5),b(6),b(7),b(8),b(9),b(10),b(11),b(12),b(zi)]),document:yI,modules:oe(x,by)}),LA=wy.extend({kind:b("open-flow-flow-revision"),version:b(1)});function bI(e){let t=at(e);if(t.tasks!==void 0&&(t.tasks===null||typeof t.tasks!=="object"||Array.isArray(t.tasks)||Object.keys(t.tasks).length>0))throw TypeError("Independent Task definitions are no longer supported.");if(Object.values(at(at(t.graph).nodes)).some((r)=>Object.hasOwn(at(r),"taskId")))throw TypeError("Task references are no longer supported.");let n=t.subflows;if(n!==void 0&&(n===null||typeof n!=="object"||Array.isArray(n)||Object.keys(n).length>0))throw TypeError("Subflows are no longer supported.");if(Object.values(at(at(t.graph).nodes)).some((r)=>at(r).kind==="subflow"))throw TypeError("Subflow nodes are no longer supported.");if(["inputDefs","outputDefs","outputMappings"].some((r)=>Object.hasOwn(t,r)))throw TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");if(Object.values(at(at(t.graph).nodes)).some((r)=>at(r).kind=="start"&&Object.hasOwn(at(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function at(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function An(e){ft(e);let t=wy.parse(e);return vI(t),xy(t.document),t}var wI={"graph.trigger.sources.set":{nodeId:x,before:Jl.optional(),value:Jl.optional()},"binding.create":{bindingId:x,binding:yy},"binding.delete":{bindingId:x},"binding.target.set":{bindingId:x,before:x,value:x},"graph.edge.connect":{edge:Bl,target:ot().optional()},"graph.edge.disconnect":{edge:Bl,target:ot().optional()},"graph.node.create":{...Oe,node:Ai},"graph.node.replace":{...Oe,before:Ai,node:Ai},"graph.node.delete":Oe,"graph.node.field.set":Y([O({...Oe,kind:b("graph.node.field.set"),field:b("retry"),before:mt.optional(),value:mt.optional()}),O({...Oe,kind:b("graph.node.field.set"),field:b("connectionId"),before:x.min(1).optional(),value:x.min(1).optional()}),O({...Oe,kind:b("graph.node.field.set"),field:Z(["description","icon","name","onError"]),before:x.optional(),value:x.optional()}),O({...Oe,kind:b("graph.node.field.set"),field:b("maxExecutions"),before:B().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:B().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),O({...Oe,kind:b("graph.node.field.set"),field:b("timeoutMs"),before:B().optional(),value:B().optional()})]),"graph.node.input.set":{...Oe,handle:x,before:Fl.optional(),value:Fl.optional()},"graph.node.additional-inputs.set":{...Oe,before:R(Qe).optional(),value:R(Qe).optional()},"graph.node.condition.set":{...Oe,before:O($i),value:O($i)},"graph.node.values.set":{...Oe,before:R(Qe),value:R(Qe)},"graph.node.resolution.set":{...Oe,before:v({...Mr,autoContinue:jn.optional()}),value:v({...Mr,autoContinue:jn.optional()})},"graph.node.webhook.set":{...Oe,before:O(Ni),value:O(Ni)},"graph.node.task.ports.set":{...Oe,before:O(Rn),value:O(Rn)},"graph.node.task.name.set":{...Oe,before:x,value:x},"graph.node.task.capabilities.set":{...Oe,before:R(Ti).optional(),value:R(Ti).optional()},"graph.trigger.config.set":{nodeId:x,name:x,before:Fr.optional(),value:Fr.optional()},"graph.trigger.schedule.set":{nodeId:x,before:qt,value:qt},"module.create":{moduleId:x,module:by},"module.delete":{moduleId:x},"module.rename":{moduleId:x,before:x,name:x},"module.source.replace":{moduleId:x,beforeImports:Lr,beforeSource:x,imports:Lr,source:x},"graph.node.task.set":{...Oe,before:Y([Ml,Zl]),value:Y([Ml,Zl])}},vy=new Map(Object.entries(wI).map(([e,t])=>[e,t instanceof K?t:O({kind:b(e),...t})])),FA=R(Y([...vy.values()])).min(1);function Zr(e,t,n){try{return n(e)}catch(r){if(!(r instanceof xk))throw r;throw TypeError(`operations[${t}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function ky(e,t){let{kind:n}=Zr(e,t,O({kind:x}).parse),r=vy.get(n);if(r==null)throw TypeError(`operations[${t}]: Unknown operation ${JSON.stringify(n)}.`);return Zr(e,t,r.parse)}function vI(e){if(e.modelVersion<13&&Object.values(e.document.graph.nodes).some((t)=>t.kind==="task"&&("executor"in t.task)&&t.task.executor.kind==="skip-duplicates"))throw Error("Skip Duplicates requires Flow model v13.");if(e.modelVersion<12&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("moduleId"in t.task)&&t.task.capabilities?.some((n)=>n.kind=="http")))throw TypeError("Code HTTP access requires Flow model version 12.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("executor"in t.task)&&t.task.executor.kind=="http-request"))throw TypeError("HTTP Request requires Flow model version 11.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("moduleId"in t.task?t.task.capabilities?.some((n)=>n.kind=="workflow"):t.task.executor.kind=="agent"&&t.task.executor.tools.some((n)=>n.kind=="workflow"))))throw TypeError("Workflow tools require Flow model version 11.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="webhook"&&(t.options?.responseBody!=null||t.options?.responseStatusCodeOutput!=null||t.options?.responseHeadersSource!=null||t.options?.responseHeaderOutputs!=null)))throw TypeError("Dynamic Webhook responses require Flow model version 10.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((t)=>("retry"in t)&&t.retry!=null))throw TypeError("Node retries require Flow model version 9.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((t)=>{if(t.onError!=null)return!0;if([...Object.values("inputs"in t?t.inputs:{}),...Object.values(t.kind=="outputs"?t.outputMappings:{})].some((r)=>r.kind=="sources"&&r.sources.some((o)=>o.kind=="node"&&o.system)))return!0;return t.kind=="condition"&&t.cases.some((r)=>r.groups.some((o)=>o.expressions.some((i)=>[i.left,i.right].some((s)=>s?.kind=="source"&&s.source.kind=="node"&&s.source.system))))}))throw TypeError("Node error handling requires Flow model version 9.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((t)=>t.kind==="webhook-response"))throw TypeError("Webhook response nodes require Flow model version 10.");if(e.modelVersion<8&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="outputs"))throw TypeError("Workflow outputs require Flow model version 8.");if(e.modelVersion<7&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="start"))throw TypeError("Start Triggers require Flow model version 7.");if(e.modelVersion<6&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="task"&&("executor"in t.task)))throw TypeError("Node-owned managed Tasks require Flow model version 6.");if(e.modelVersion<5&&Object.values(e.document.graph.nodes).some((t)=>t.kind=="error"))throw TypeError("Error workflows require Flow model version 5.")}function xy(e){for(let t of Object.values(e.graph.nodes))if(t.kind=="task"&&"executor"in t.task&&["openapi","http-request"].includes(t.task.executor.kind))oy(t.inputs)}var Sy=v({mode:Z(["chat","json"]),resultSchema:Pe(),model:Pe().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:Pe().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:Pe().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var SI=Y([v({schemes:R(C().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),v({type:Z(["bearer","basic"])}),v({type:b("apiKey"),name:C().min(1),in:Z(["header","query"])})]),Iy=v({sourceUrl:C().min(1),path:C().min(1),method:C().min(1),serverUrl:C().optional(),authentication:SI.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var z=C().min(1),Ye=Pe(),eu=oe(z,Ye),qi=["start","outputs","webhook-response","workflow","webhook","cron","error","poll","integration","code","connector","agent","llm","decision","openapi","http-request","skip-duplicates","condition","value","wait","approval"],tu=Z(qi),gt=z.describe('An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as "step", reference "$step", never bare "step". Aliases are local to one batch.'),Hl=v({kind:b("output"),node:gt,port:z.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:C().optional()}),Ql=v({kind:b("system"),node:gt,port:b("error"),field:C().optional()}),Yl=v({kind:b("variable"),name:z}),Cy=Y([Hl,Ql,Yl,v({kind:b("value"),value:Ye}),v({kind:b("unset")}),v({kind:b("default")}),v({kind:b("sources"),sources:R(Y([Hl,Ql,Yl])).min(1)})]),Ey=Y([v({kind:b("value"),value:Ye.optional(),schema:Ye.optional()}),Hl,Ql,Yl]),Oy=oe(z,Di.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved."),II=Y([Gl.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:Oy}).strict(),Wl.omit({id:!0,inputs:!0}).extend({inputs:Oy}).strict()]),CI=R(Y([Ul,v({kind:b("workflow"),name:z,flowId:z}),Kl])),EI=v({...ct.connector.shape,messageHandle:z,inputs:oe(z,Y([v({kind:b("value"),value:Ye}),v({kind:b("input"),input:z})]))}),Vi=v({schema:Ye.optional(),nullable:he().optional(),description:C().optional()}),Pn=oe(z,Vi.extend({default:Ye.optional()})).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data."),Ay=oe(z,Vi).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs."),OI=Ay.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs."),Py=oe(z,Vi.extend({schema:Ye,nullable:he()})),jy=oe(z,Vi).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Xl=v({left:Ey,operator:ct.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:Ey.optional()}),_y=v({all:R(Xl)}),jI=Y([Xl,_y,v({any:R(Y([Xl,_y]))})]),xt={"webhook-response":v({}),workflow:v({flowId:z}),start:v({inputDefs:Ay.default({})}),outputs:v({outputDefs:OI.default({})}),error:v({sourceFlowIds:R(z).optional()}),webhook:ct.webhook.omit({bodyFields:!0}).extend({body:Pn}).strict(),cron:v({schedule:ct.schedule}),poll:v({key:z,connectionId:z.optional(),schedule:ct.schedule}),integration:v({key:z,connectionId:z.optional()}),code:v({inputs:Pn,outputs:jy,capabilities:CI.optional()}),connector:ct.connector.omit({outputMode:!0}).strict(),openapi:Iy,"http-request":_i,"skip-duplicates":bi,agent:ct.agent.omit({prompt:!0,tools:!0}).extend({inputs:Pn,resultSchema:Ye.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:R(II),notification:EI.optional()}).strict(),llm:Sy.extend({inputs:Pn}),decision:ct.decision,condition:v({match:Z(["first","all"]),branches:R(v({name:z,description:C().optional(),when:jI}))}),value:v({values:eu,outputs:jy}),wait:v({inputs:Pn,autoContinue:ct.waitAutoContinue.optional().describe("Wait only. Omit to disable; clear config.autoContinue to remove. after counts from each wait registration; at requires an explicit offset and continues immediately if already past. Optional timezone preserves the editor zone; at remains the absolute instant. Server requires the deadline to precede the 7-day expiry.")}),approval:v({inputs:Pn})},_I={onError:Z(["stop","error"]).optional(),name:z.optional(),description:C().optional(),icon:C().optional(),maxExecutions:xe().positive().optional(),timeoutMs:B().nonnegative().optional(),retry:mt.partial().optional().describe('Node retry policy for Code, Connector, OpenAPI, LLM and AI Decision. Omitted update fields preserve the policy; use clear: [["retry"]] to disable it. maxRetries counts additional attempts; intervalMs is 1000\u201360000 in whole seconds.')},RI=v({..._I,config:eu.optional().describe('Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. ["config","inputs","amount","schema","type"].')}),AI=it("op",[v({op:b("node.add"),as:z.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),type:tu,name:z,onError:Z(["stop","error"]).optional(),retry:mt.optional(),config:eu.optional(),inputs:oe(z,Cy).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:C().optional(),prompt:C().optional()}),v({op:b("node.update"),node:gt,set:RI.optional(),clear:R(R(z).min(1)).optional()}),v({op:b("node.refresh"),node:gt,tool:z.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),v({op:b("node.remove"),node:gt}),v({op:b("input.set"),node:gt,input:z,source:Cy}),v({op:Z(["edge.connect","edge.disconnect"]),source:gt,target:gt,branch:z.optional()}),v({op:b("text.edit"),node:gt,field:Z(["code","prompt"]),oldText:z,newText:C()}),v({op:b("text.set"),node:gt,field:Z(["code","prompt"]),text:C()})]),Jr=v({baseRevision:z,requestId:z.max(256),edits:R(AI).min(1).max(1000)}),Li=v({revision:z.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:R(z).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:v({node:z,field:Z(["code","prompt"]),start:xe().positive().default(1),lines:xe().min(1).max(200).default(80)}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")}).refine((e)=>e.nodes==null||e.text==null,"Choose nodes or text.").meta({not:{required:["nodes","text"]},description:"Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."}),nu=v({revisionId:z}),Fi=v({revision:z.optional(),query:z.max(1000),type:tu.optional(),offset:xe().nonnegative().default(0),limit:xe().min(1).max(100).default(20)}),Ty=v({type:tu.optional(),action:z.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),Ry={read:{schema:Li,guidance:"Read Start and Outputs node details for their interface definitions and data sources. Choose one mode: outline (omit nodes and text), node details (nodes), or text excerpt (text). nodes and text are mutually exclusive. Text defaults to 80 lines, at most 200 lines and 24000 characters. For the complete text, repeat at nextStart with the same revision until truncated is false.",examples:[{},{revision:"REVISION",nodes:["NODE"]},{revision:"REVISION",text:{node:"NODE",field:"prompt",start:1,lines:80}}]},search:{schema:Fi,guidance:"Search names, configurations and text. Keep the returned revision when following nextOffset or reading a match.",examples:[{query:"Customer summary",type:"agent"}]},edit:{schema:Jr,guidance:'Edit Start config.inputDefs and Outputs config.outputDefs through node.add or node.update; clear paths are relative to the node, e.g. ["config","inputDefs","amount"]. Set Outputs values with input.set. Use the observed revision as baseRevision and a stable requestId. Edits are ordered and atomic. node.add.as declares a batch-local alias without $. Every later reference to that new node must use $alias, including node, edge source/target and output source node fields; a bare alias is not the node ID. Use returned node references in later batches. Updates recursively merge objects (including schemas); {} preserves existing fields. Arrays replace as a whole. Remove fields with clear paths. Text replacement requires exactly one match. Read the target text first. A saved draft can have validation diagnostics.',examples:[{baseRevision:"REVISION",requestId:"CREATE_REQUEST",edits:[{op:"node.add",as:"start",type:"start",name:"Start"},{op:"node.add",as:"step",type:"code",name:"Process",code:"export default ({value}) => ({result:value})"},{op:"edge.connect",source:"$start",target:"$step"},{op:"node.update",node:"$step",set:{description:"Created and connected in one atomic edit."}}]},{baseRevision:"REVISION",requestId:"REQUEST",edits:[{op:"text.edit",node:"NODE",field:"prompt",oldText:"Original rule.",newText:"Updated rule."}]}]},check:{schema:nu,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}},PI=[...Yu(sn).builtinModules].filter((e)=>!e.startsWith("node:")),TI=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${PI.join(", ")}, with or without the node: prefix; fs is a fresh in-memory filesystem containing /tmp per execution. require, dynamic import, packages and the http/net builtins are unavailable. To call HTTP APIs, declare their hosts in config.capabilities as {kind: "http", hosts: ["api.example.com", "*.example.org"]} and use context.fetch(url, {method, headers, body}); it returns status, ok, headers.get(), text(), json() and bytes(), does not follow redirects, adds no credentials, and limits bodies to 1 MiB. Prefer an HTTP Request node for a single call without transformation and Connector Actions for services with accounts. context provides inputs, signal, getPrevious(), fetch, actions, workflows, artifact, flowId, runId and blockId. Select workflows through config.capabilities: [{kind: "workflow", flowId, name}]. Call context.workflows.call(name, input) and await its business output. The platform derives input/output types. Refresh a selected workflow tool with node.refresh and tool: its name. Calls obey node and Run time limits.`;function ru(e){if(!Object.hasOwn(Ry,e))return;let t=Ry[e];return{request:gn(t.schema,{io:"input"}),guidance:t.guidance,examples:t.examples}}function ou(e){return e==null?{types:qi,request:gn(Jr),guidance:"Read a node type schema before creating or configuring it. Use $alias to reference a preceding node.add in the same batch. Read returns stable node references. Long code and prompt fields use text reads and edits. Changes use the observed baseRevision and a stable requestId."}:{type:e,onError:e=="skip-duplicates"||Vl.some((t)=>t==e)?{enum:["stop","error"]}:!1,retry:Vl.some((t)=>t==e)?gn(mt):!1,inputSources:["poll","integration"].includes(e)?["value","unset","default"]:["start","outputs","error","cron","webhook","value","condition"].includes(e)?[]:["value","unset","default","output","system","variable","sources"],extensibleInputs:["code","agent","llm","wait","approval"].includes(e),guidance:e=="webhook-response"?'Prepare an HTTP response using fixed inputs body (any JSON, default empty text), statusCode (number, default 200) and headers (scalar-valued object, default {}). Select this node in Webhook options.responseBody as {kind: "webhook-response", nodeId: "node reference", timeoutMs: 30000}. Its first completion responds immediately while the Run continues. It has no business outputs. Multiple response nodes are allowed; each Webhook selects one reachable node.':e=="outputs"?"Declare output fields through config.outputDefs. Set their values through node.add.inputs or input.set. Outputs is a singleton execution sink; it waits for its predecessors and produces workflow business outputs independently of node logs. No downstream edges or data references to Outputs are allowed.":e=="webhook"?'Use options.responseBody: {kind: "webhook-response", nodeId: "node ID or $alias", timeoutMs: 30000} to respond on the selected node\u2019s first completion while the Run continues. Body, statusCode and headers come exclusively from that node; clear workflow-output-only status/header references when switching. Alternatively configure options.responseBody as {kind: "workflow-outputs", output?: "top-level output name", timeoutMs?: 30000} to respond after the Run succeeds. Omit output for the complete object. Connect Webhook to Outputs. Timeout is 1000\u201360000 ms; HTTP timeout does not cancel the Run. Strings return text; other values return JSON. Only in this mode, options.responseStatusCodeOutput can select a numeric top-level workflow output as the HTTP status, overriding the preserved fixed responseStatusCode (default 200). Its runtime value must be an integer from 200 to 599, excluding 204, 205, 304; missing or invalid values return 500. Use responseHeaders for fixed text headers. In workflow-output mode, responseHeaderOutputs maps header names to top-level output names; values can be string, number or boolean and are converted to text. Alternatively responseHeadersSource: {kind: "workflow-outputs", output?: "object field"} replaces the entire header object (omit output for all outputs), preserving but ignoring per-header settings. Missing, null, complex or invalid header values return 500 without fallback. Header restrictions and Content-Type policy still apply. Omit responseBody for immediate responseData. Clear options.responseBody, options.responseStatusCodeOutput, options.responseHeadersSource and options.responseHeaderOutputs explicitly to switch back.':e=="start"?"Declare workflow inputs through config.inputDefs; read them in Start node details. REST calls and manual runs supply them as trigger.outputs. Downstream nodes bind these parameters as Start outputs. Start has no input sources or defaults; non-nullable parameters are required, and omitted nullable parameters become null.":e=="condition"?"Edit branch operands through config.branches. A branch can test one expression, all expressions, or any alternatives. Unmatched execution uses branch otherwise.":["poll","integration"].includes(e)?"Configure static parameters with node.add.inputs or input.set. Definitions come from the selected Trigger key; execution output and variable sources are unavailable.":e=="llm"?"Configure model settings, message templates and history as defaults. Input bindings with the same names override these defaults; named business inputs can be bound directly. Template strings interpolate {{name}}.":e=="skip-duplicates"?"Bind an items array. Configure fields as dot-separated identity paths; an empty list uses each scalar item. Outputs are items and duplicates. History belongs to this node and commits only when the Run completes successfully. Fields accept strings or finite numbers; missing or complex values reject the batch.":e=="http-request"?"Configure method, query/headers modes and names, bodyFormat, authentication, responseFormat and statusPolicy. Bind url, query.<name>/header.<name> or whole query/headers objects, body and auth.token (Basic: auth.username/auth.password). Credentials accept variables or upstream outputs only. Outputs: body, statusCode, headers. Authentication is replaced as a complete choice.":e=="openapi"?"Select an operation; the tool resolves its ports and authentication. Read authenticationChoices from node details. authentication is replaced as a complete choice. Bind advertised credentials through inputs.":e=="workflow"?"Select another workflow with config.flowId. A workflow cannot call itself, including in a disconnected node. Owned unpublished or unavailable targets may be saved as incomplete drafts. Use node.refresh to load the current published interface.":e=="agent"?'Tools accept Connector Actions or {kind: "workflow", flowId, name, description, approval, inputs}. Workflow parameter sources use model, input or value. The platform derives the interface. Refresh a workflow tool with node.refresh and tool: its name.':e=="code"?TI:"Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.",example:{op:"node.add",as:"step",type:e,name:"Step",...{start:{config:{inputDefs:{}}},outputs:{config:{outputDefs:{}}},workflow:{config:{flowId:"<Flow ID>"}},connector:{config:{action:"<Action ID>",connectionId:"<Connection ID>"}},poll:{config:{key:"<Trigger key>",schedule:[{type:"every",unit:"minute",value:5}]}},integration:{config:{key:"<Trigger key>"}},"skip-duplicates":{config:{fields:["id"]},inputs:{items:{kind:"value",value:[{id:"a"},{id:"b"}]}}},"http-request":{config:{},inputs:{url:{kind:"value",value:"https://example.com"}}},openapi:{config:{sourceUrl:"https://example.com/openapi.json",path:"/items",method:"get"}},code:{code:"export default ({value}) => ({result:value})",inputs:{value:{kind:"value",value:"Hello"}}},condition:{config:{match:"first",branches:[{name:"yes",when:{left:{kind:"value",value:120},operator:">",right:{kind:"value",value:100}}}]}},value:{config:{values:{threshold:100,region:"EU"}}},webhook:{config:{method:"POST",body:{orderId:{schema:{type:"string"},nullable:!1}}}},wait:{prompt:"Continue processing this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},approval:{prompt:"Approve this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},llm:{config:{model:{model:"deepseek-v4-flash"},template:[{role:"user",content:"Summarize {{order}}."}]},inputs:{order:{kind:"value",value:{orderId:"A-1",total:42}}}},agent:{config:{model:"deepseek-v4-flash"},inputs:{orders:{kind:"value",value:[{orderId:"A-1",total:42}]}},prompt:"Summarize {{orders}}."}}[e]},configuration:gn(xt[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var $y=O({code:z,message:C(),nodes:R(z),field:C().optional(),line:B().optional(),column:B().optional()}),Ny=O({flowId:z,revisionId:z,valid:he(),diagnostics:R($y),version:b(1)}),zy=O({flowId:z,saved:b(!0),revision:z,nodes:oe(z,z),changes:R(O({index:xe(),op:z,node:z.optional()})),validation:O({status:Z(["valid","invalid","unavailable"]),diagnostics:R($y).optional()}),version:b(1)}),Dy=O({flowId:z,revision:z,data:O({nodes:R(oe(C(),Ye)).optional(),edges:R(Ye).optional(),text:oe(C(),Ye).optional()}),version:b(1)}),qy=O({flowId:z,revision:z,data:O({matches:R(O({node:z.optional(),field:z,line:xe().optional(),excerpt:C()})),total:xe(),nextOffset:xe().optional()}),version:b(1)});var q={authenticationRequired:"authentication.required",authorizationDenied:"authorization.denied",bindingUnresolved:"binding.unresolved",connectorActionNotFound:"connector.action-not-found",connectorAccessConflict:"connector.access-conflict",connectorAccessInvalid:"connector.access-invalid",connectorAccessRequired:"connector.access-required",connectorAccessUnsupported:"connector.access-unsupported",connectorUnconfigured:"connector.unconfigured",connectorUnavailable:"connector.unavailable",connectorConsoleUnconfigured:"connector.console-unconfigured",engineUnavailable:"engine.unavailable",engineUnsupported:"engine.unsupported",eventSourceInvalid:"event-source.invalid",eventSourceIdentityUnavailable:"event-source.identity-unavailable",eventSourceNotFound:"event-source.not-found",eventSourceConflict:"event-source.conflict",flowInvalid:"flow.invalid",flowRepairRequired:"flow.repair-required",flowUpgradeRequired:"flow.upgrade-required",flowNotFound:"flow.not-found",flowBusy:"flow.busy",flowConflict:"flow.conflict",flowPresentationConflict:"flow.presentation-conflict",flowRevisionConflict:"flow.revision-conflict",liveConflict:"live.conflict",liveNotFound:"live.not-found",pageInvalidCursor:"page.invalid-cursor",publicationConflict:"publication.conflict",publicationNotFound:"publication.not-found",publicationUnsupported:"publication.unsupported",publishOperationNotFound:"publication.operation-not-found",routeNotFound:"route.not-found",runConflict:"run.conflict",runEventsExpired:"run.events-expired",runInvalid:"run.invalid",runNotFound:"run.not-found",runNotTerminal:"run.not-terminal",runOverloaded:"run.overloaded",runWaitNotFound:"run.wait-not-found",triggerKeyInvalid:"trigger-key.invalid",triggerKeyNotFound:"trigger-key.not-found",triggerNotFound:"trigger.not-found",tagInvalid:"tag.invalid",tagConflict:"tag.conflict",tagNotFound:"tag.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},NI={[q.eventSourceInvalid]:{status:400},[q.eventSourceIdentityUnavailable]:{status:409},[q.eventSourceNotFound]:{status:404},[q.eventSourceConflict]:{status:409},[q.authenticationRequired]:{status:401},[q.authorizationDenied]:{status:403},[q.bindingUnresolved]:{status:409},[q.connectorActionNotFound]:{status:404},[q.connectorAccessConflict]:{status:412},[q.connectorAccessInvalid]:{status:409},[q.connectorAccessRequired]:{status:409},[q.connectorAccessUnsupported]:{status:409},[q.connectorUnconfigured]:{status:503},[q.connectorUnavailable]:{status:503},[q.connectorConsoleUnconfigured]:{status:503},[q.engineUnavailable]:{status:503},[q.engineUnsupported]:{status:409},[q.flowInvalid]:{status:400},[q.flowRepairRequired]:{status:409},[q.flowUpgradeRequired]:{status:409},[q.flowNotFound]:{status:404},[q.flowBusy]:{status:409},[q.flowConflict]:{status:409},[q.flowPresentationConflict]:{status:412},[q.flowRevisionConflict]:{status:412},[q.liveConflict]:{status:412},[q.liveNotFound]:{status:404},[q.pageInvalidCursor]:{status:400},[q.publicationConflict]:{status:409},[q.publicationNotFound]:{status:404},[q.publicationUnsupported]:{status:409},[q.publishOperationNotFound]:{status:404},[q.routeNotFound]:{status:404},[q.runConflict]:{status:409},[q.runEventsExpired]:{status:410},[q.runInvalid]:{status:400},[q.runNotFound]:{status:404},[q.runNotTerminal]:{status:409},[q.runOverloaded]:{status:429},[q.runWaitNotFound]:{status:404},[q.triggerKeyInvalid]:{status:409},[q.triggerKeyNotFound]:{status:404},[q.triggerNotFound]:{status:404},[q.tagInvalid]:{status:400},[q.tagConflict]:{status:409},[q.tagNotFound]:{status:404},[q.variableInvalid]:{status:400},[q.variableLimitReached]:{status:409},[q.variableNotFound]:{status:404}};class _e extends Error{constructor(e,t,n,r){super(n);this.code=t,this.details=r,this.name="ApiError",this.status=e}}class Vy extends _e{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function p(e){throw new Vy(e)}function k(e){if(e==null||typeof e!="object"||Array.isArray(e))return p("Expected an object.");return e}function f(e){return typeof e=="string"&&e.length>0?e:p("Expected a non-empty string.")}function F(e,t){let n=t.filter((r)=>!Object.hasOwn(e,r));if(n.length>0)p(`Missing fields: ${n.join(", ")}.`)}function Ly(e,t){let n=Object.keys(e);if(n.length!=t.length||n.some((r)=>!t.includes(r))){let r=t.filter((i)=>!Object.hasOwn(e,i)),o=n.filter((i)=>!t.includes(i));p([r.length>0?`Missing fields: ${r.join(", ")}.`:"",o.length>0?`Unexpected fields: ${o.join(", ")}.`:""].filter(Boolean).join(" "))}}function ie(e){return Number.isSafeInteger(e)?e:p("Expected a safe integer.")}function ve(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map(ve);let t=k(e);return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,ve(r)]))}function Mi(e){if(e==null)return;return f(e)}function Tn(e){let t=k(e),n=t.liveEnd==null?void 0:k(t.liveEnd);if(n!=null&&typeof n.enabled!="boolean")return p();let{operation:r,sourcePublicationId:o}=t;if(t.version!=1)return p();if(r!="publish"&&r!="rollback")return p();if(o!=null&&typeof o!="string")return p();return{...n==null?{}:{liveEnd:{enabled:n.enabled,endedAt:f(n.endedAt)}},actorId:f(t.actorId),closureDigest:f(t.closureDigest),createdAt:f(t.createdAt),engineContract:f(t.engineContract),flowId:f(t.flowId),modelVersion:ie(t.modelVersion),operation:r,publicationId:f(t.publicationId),sharedAccessDigest:f(t.sharedAccessDigest),revisionDigest:f(t.revisionDigest),revisionId:f(t.revisionId),...o==null?{}:{sourcePublicationId:o},version:1}}function iu(e){let t=k(e),n=t.status,r={createdAt:f(t.createdAt),flowId:f(t.flowId),operationId:f(t.operationId),revisionId:f(t.revisionId),updatedAt:f(t.updatedAt),version:1};if(t.version!=1)return p();switch(n){case"pending":return F(t,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:n};case"succeeded":return F(t,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:f(t.publicationId),status:n};case"failed":{F(t,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=k(t.issue),i=o.nodeId;return F(o,["code","message",...i==null?[]:["nodeId"]]),{...r,issue:{code:f(o.code),message:f(o.message),...i==null?{}:{nodeId:f(i)}},status:n}}default:return p()}}function su(e){let t=k(e),{status:n,publication:r}=t;if(t.version!=1||typeof t.hasUnpublishedChanges!="boolean")return p();if(n!="not-published"&&n!="runnable"&&n!="suspended")return p();if(n=="not-published"&&r!==null)return p();if(n!="not-published"&&r===null)return p();return{flowId:f(t.flowId),hasUnpublishedChanges:t.hasUnpublishedChanges,publication:r===null?null:Tn(r),revision:ie(t.revision),status:n,version:1}}function Fy(e){let t=k(e),{nextCursor:n,total:r}=t;if(t.version!=1||!Array.isArray(t.publications))return p();if(n!=null&&typeof n!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...n==null?{}:{nextCursor:n},publications:t.publications.map(Tn),...r==null?{}:{total:r},version:1}}var My=R(Y([v({handle:C().min(1),description:C().optional(),jsonSchema:Pe(),nullable:he(),value:Pe().optional()}),v({group:C(),collapsed:he().optional()})]));function au(e){let t=k(e),n=t.type;if(n!="integration"&&n!="poll")return p();return{description:typeof t.description=="string"?t.description:p(),displayName:f(t.displayName),key:f(t.key),name:f(t.name),provider:f(t.provider),type:n}}function Br(e){let t=k(e),n=au(t),r={configInputs:My.parse(t.configInputs),definitionVersion:t.definitionVersion===2?2:p(),description:n.description,displayName:n.displayName,key:n.key,name:n.name,outputs:(Array.isArray(t.outputs)?t.outputs:p()).map((l)=>{let u=k(l);return Object.assign({handle:f(u.handle),jsonSchema:ve(u.jsonSchema),nullable:typeof u.nullable==="boolean"?u.nullable:p()},u.description==null?{}:{description:f(u.description)})}),provider:n.provider};if(n.type=="poll")return{...r,type:"poll"};let o=k(t.endpoint),i=k(o.body);if(!Array.isArray(o.methods)||!Array.isArray(i.formats)||typeof i.allowArray!="boolean"||typeof i.allowEmpty!="boolean")return p();let s=o.methods.map(f),a=i.formats.map(f),c=ie(o.successStatus);if(s.some((l)=>!["DELETE","GET","HEAD","PATCH","POST","PUT"].includes(l))||a.some((l)=>!["form","json","multipart","text"].includes(l))||c<200||c>299)return p();return{...r,endpoint:{body:{allowArray:i.allowArray,allowEmpty:i.allowEmpty,formats:a},methods:s,successStatus:c},type:"integration"}}var zI=new Set(["error","cron","integration","poll","webhook"]),DI=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),qI=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function Ur(e){let t=k(e),n=t.health,r=t.listener==null?void 0:k(t.listener);if(r!=null&&r.health!="healthy"&&r.health!="failed"&&r.health!="needs_reauth")return p();let o=t.kind,i=ie(t.runtimeVersion);if(t.version!=1||typeof n!="string"||!DI.has(n))return p();if(typeof o!="string"||!zI.has(o))return p();if(i<=0)return p();return{...t.currentPublicationId==null?{}:{currentPublicationId:f(t.currentPublicationId)},...t.currentRevisionId==null?{}:{currentRevisionId:f(t.currentRevisionId)},...t.endpointUrl==null?{}:{endpointUrl:f(t.endpointUrl)},...r==null?{}:{listener:{health:r.health,...r.lastErrorCode==null?{}:{lastErrorCode:f(r.lastErrorCode)}}},flowId:f(t.flowId),health:n,kind:o,...t.lastErrorCode==null?{}:{lastErrorCode:f(t.lastErrorCode)},runtimeVersion:i,triggerNodeId:f(t.triggerNodeId),updatedAt:f(t.updatedAt),version:1}}function Zy(e){let t=k(e);if(t.version!=1)return p();return{binding:Ur(t.binding),version:1}}function VI(e){let t=k(e),n=t.kind;if(typeof n!="string"||!qI.has(n))return p();let r=Mi(t.errorCode),o=Mi(t.errorMessage);if(o!=null&&o.length>512)return p();return{activityId:f(t.activityId),createdAt:f(t.createdAt),...r==null?{}:{errorCode:r},...o==null?{}:{errorMessage:o},kind:n}}function Jy(e){let t=k(e),n=Mi(t.nextCursor);if(t.version!=1||!Array.isArray(t.activities))return p();return{activities:t.activities.map(VI),...n==null?{}:{nextCursor:n},version:1}}function By(e){let t=k(e),n=ie(t.filtered);if(t.version!=1||!Array.isArray(t.events)||typeof t.hasMore!="boolean"||n<0)return p();return{events:t.events.map((r)=>{let o=k(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,ve(s)]))}),filtered:n,hasMore:t.hasMore,version:1}}var Xt={nodeId:C().min(1),name:C(),description:C().optional()},Kr=rt().transform(Ur),Uy={provider:C().min(1),inputs:oe(C(),it("kind",[O({kind:b("value"),value:Pe()}),O({kind:b("unset")})]))},FI=it("type",[O({...Xt,type:b("start"),config:xt.start}),O({...Xt,type:b("manual"),config:O({})}),O({...Xt,type:b("webhook"),config:xt.webhook,binding:Kr}),O({...Xt,type:b("cron"),config:xt.cron,binding:Kr}),O({...Xt,type:b("error"),config:xt.error,binding:Kr}),O({...Xt,...Uy,type:b("poll"),config:xt.poll,binding:Kr}),O({...Xt,...Uy,type:b("integration"),config:xt.integration,binding:Kr})]);function Ky(e){let t=k(e),n=f(t.flowId);if(t.version!=1||!Array.isArray(t.entries))return p();if(t.publication===null){if(t.inputDefs!==null||t.status!="not-published"||t.entries.length!=0||Object.hasOwn(t,"enabled"))return p();return{flowId:n,inputDefs:null,publication:null,status:"not-published",entries:[],version:1}}let r=Tn(t.publication),o=t.status;if(r.flowId!=n||typeof t.enabled!="boolean")return p();if(o!="runnable"&&o!="suspended")return p();if(!t.enabled&&t.status=="runnable")return p();let i=Py.safeParse(t.inputDefs);if(!i.success)return p();return{flowId:n,inputDefs:i.data,publication:r,status:o,enabled:t.enabled,entries:MI(t.entries,r),version:1}}function MI(e,t){let n=R(FI).safeParse(e);if(!n.success)return p();let r=new Set;for(let o of n.data){if(r.has(o.nodeId))return p();if(r.add(o.nodeId),o.type!="start"&&o.type!="manual"&&(o.binding.flowId!=t.flowId||o.binding.triggerNodeId!=o.nodeId||o.binding.kind!=o.type||o.binding.currentPublicationId!=t.publicationId||o.binding.currentRevisionId!=t.revisionId))return p();if(o.type=="webhook"&&(!o.binding.endpointUrl||!ji(o.config.method)&&Object.keys(o.config.body).length>0))return p()}return n.data}function Zi(e,t){if(!e||typeof e!="object"||!t||typeof t!="object")return{};let n=e,r=t;if(typeof n.version!="string"||![n.pixelRatio,n.iconSize,n.width,n.height].every((o)=>Number.isInteger(o)&&o>0)||![n.bleed,r.x,r.y].every((o)=>Number.isInteger(o)&&o>=0)||r.x+n.iconSize>n.width||r.y+n.iconSize>n.height)return{};try{for(let o of[n.lightUrl,n.darkUrl])if(typeof o!="string"||!["https:","http:","data:"].includes(new URL(o).protocol))return{}}catch{return{}}return{iconSprite:n,iconSpritePosition:{x:r.x,y:r.y}}}function Wy(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Gy(e){return{...e,cases:e.cases.map((t)=>({...t,groups:t.groups.map((n)=>({...n,expressions:n.expressions.map((r)=>({...r,left:Wy(r.left),...r.right==null?{}:{right:Wy(r.right)}}))}))}))}}var uu=80;function Wr(e){let t=e.trim();if(t.length==0)return"empty";if(t.length>uu)return"tooLong";for(let n of t){let r=n.charCodeAt(0);if(r<=31||r>=127&&r<=159)return"controlCharacter"}if(!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(t))return"specialCharacter"}function Qy(e,t){let n=e=="jira.on_issue_event"||e=="intercom.on_conversation_event"||e=="sentry.on_issue_alert"||e=="zoom.on_recording_ready"||e=="fireflies.on_meeting_ready"?["sourceId","eventTypes"]:e=="slackbot.on_event"?["sourceId","eventTypes","channelIds"]:e=="feishu_app_bot.on_event"?["sourceId","eventTypes","resource","chatIds"]:e=="linear.on_issue_changed"?["teamId","stateIds"]:[];return{...t,...Object.fromEntries(n.map((r)=>[r,{kind:"unset"}]))}}function Yy(e,t){return{...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([n,r])=>{if((r.kind=="poll"||r.kind=="integration")&&(t==null||r.connectionId==t)){let{connectionId:i,...s}=r;return[n,s]}if(r.kind!="task")return[n,r];if("executor"in r.task){let i=r.task.executor,s=(a)=>{if(a.connectionId==="")return a;if(t!=null&&a.connectionId!=t)return a;let{connectionId:c,...l}=a;return l};if(i.kind=="connector")return[n,{...r,task:{...r.task,executor:s(i)}}];if(i.kind=="agent")return[n,{...r,task:{...r.task,executor:{...i,tools:i.tools.map(s),...i.notification==null?{}:{notification:s(i.notification)}}}}];return[n,r]}let o=r.task.capabilities?.map((i)=>{if(i.kind=="workflow"||i.kind=="http")return i;if(!("mode"in i)){if("action"in i){let{connectionId:s,...a}=i;return{...a,connections:i.connections.filter((c)=>t!=null&&c.connectionId!=t),...s!=null&&t!=null&&s!=t?{connectionId:s}:{}}}return{...i,...t==null&&(i.connectionHints?.length??0)>0?{actionHints:[...new Set([...i.actionHints??[],...i.connectionHints.map((s)=>s.action)])]}:{},...i.connectionHints==null?{}:{connectionHints:i.connectionHints.filter((s)=>t!=null&&s.connectionId!=t)}}}if(i.mode!="independent")return i;return{...i,actions:i.actions.map((s)=>{if(s.connectionId==="")return s;if(t!=null&&s.connectionId!=t)return s;let{connectionId:a,...c}=s;return c})}});return[n,o==null?r:{...r,task:{...r.task,capabilities:o}}]}))}}var GI=v({kind:b("open-flow-workflow"),version:b(1),name:C().optional(),icon:C().optional(),description:C().optional(),content:rt(),presentation:oe(C(),Pe()).optional()});function $n(e){ft(e,-1);let t=GI.parse(e);return{...t,content:An(t.content)}}function Xy(e){if(e.kind!="sources"||!e.sources.some((n)=>n.kind=="binding"))return e;let t=e.sources.filter((n)=>n.kind!="binding");return t.length==0?{kind:"unset"}:{kind:"sources",sources:t}}function du(e){let t=$n(e),n=t.content.document.graph,r=Yy(n),o=Object.fromEntries(Object.entries(r.nodes).map(([i,s])=>{let a=s;if("inputs"in a)a={...a,inputs:Object.fromEntries(Object.entries(a.inputs).map(([c,l])=>[c,Xy(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,Xy(l)]))};if(a.kind=="condition")a=Gy(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Qy(a.definition.key,a.config)};return[i,a]}));return{file:{...t,content:{...t.content,document:{...t.content.document,bindings:{},graph:{...r,nodes:o}}}},summary:{changedNodeIds:Object.keys(o).filter((i)=>!Ie(o[i],n.nodes[i])),removedBindings:Object.keys(t.content.document.bindings).length}}}function eb(e){return`${JSON.stringify(du(e).file,null,2)}
61
- `}function tb(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var nb=R(v({flowId:C().min(1),file:rt()})).min(1),HI=v({kind:b("open-flow-workflow-bundle"),version:b(1),entryFlowId:C().min(1),workflows:nb}),QI=v({version:b(1),entryFlowId:C().min(1),workflows:nb,unavailableFlowIds:R(C().min(1))});function rb(e,t,n=[]){let r=e.map(({flowId:s,file:a})=>({flowId:s,file:$n(a)})),o=new Set(r.map(({flowId:s})=>s));if(o.size!=r.length||!o.has(t))throw TypeError("Workflow identities must be unique and include the entry workflow.");let i=new Set(n);if(i.size!=n.length||n.some((s)=>o.has(s)))throw TypeError("Invalid unavailable workflow identities.");for(let{file:s}of r)for(let a of Object.values(s.content.document.graph.nodes))for(let{target:c}of Tl(a))if(c.flowId&&!o.has(c.flowId)&&!i.has(c.flowId))throw TypeError("A referenced workflow is missing from the bundle.");return r}function ob(e){ft(e,-4);let t=HI.parse(e);return{...t,workflows:rb(t.workflows,t.entryFlowId)}}function ib(e){ft(e,-4);let t=QI.parse(e);return{...t,workflows:rb(t.workflows,t.entryFlowId,t.unavailableFlowIds)}}function sb(e){let t=ob(e);return{...t,workflows:t.workflows.map(({flowId:n,file:r})=>({flowId:n,file:du(r).file}))}}function ab(e){if(e.unavailableFlowIds.length)throw TypeError("Some referenced workflows are unavailable.");return sb({kind:"open-flow-workflow-bundle",version:1,entryFlowId:e.entryFlowId,workflows:e.workflows})}function cb(e){return`${JSON.stringify(sb(e),null,2)}
62
- `}function lb(e){let t=JSON.parse(e);return t!=null&&typeof t=="object"&&"kind"in t&&t.kind=="open-flow-workflow-bundle"?ob(t):$n(t)}var XI=it("kind",[v({kind:b("admin-delegation")}),v({kind:b("policy"),ruleId:C().min(1).nullable()})]);function Bi(e){return XI.parse(e)}function pb(e){let t=k(e);if(!Array.isArray(t.bots))return p("Leina bots: expected an array.");let n=t.bots.map((r)=>{let o=k(r);if(!Array.isArray(o.platforms))return p("Leina platforms: expected an array.");return{leinaId:f(o.leinaId),name:f(o.name),status:f(o.status),platforms:o.platforms.map(f)}});if(new Set(n.map((r)=>r.leinaId)).size!=n.length)return p("Leina bots: duplicate identifiers.");return n}function eC(e){let t=k(e);if(F(t,["actionIds","allActions","triggerIds","allTriggers","configured","proxy"]),!Array.isArray(t.actionIds))return p("permissions.actionIds: expected an array.");if(!Array.isArray(t.triggerIds))return p("permissions.triggerIds: expected an array.");if(typeof t.allActions!="boolean")return p("permissions.allActions: expected a boolean.");if(typeof t.allTriggers!="boolean")return p("permissions.allTriggers: expected a boolean.");if(typeof t.configured!="boolean")return p("permissions.configured: expected a boolean.");if(typeof t.proxy!="boolean")return p("permissions.proxy: expected a boolean.");let n=t.actionIds.map(f),r=t.triggerIds.map(f);if(new Set(n).size!=n.length)return p("permissions.actionIds: duplicate IDs.");if(t.allActions&&n.length!=0)return p("permissions.actionIds: must be empty when allActions is true.");if(new Set(r).size!=r.length)return p("permissions.triggerIds: duplicate IDs.");if(t.allTriggers&&r.length!=0)return p("permissions.triggerIds: must be empty when allTriggers is true.");if(t.proxy&&(!t.allActions||!t.allTriggers||t.configured))return p("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");return{actionIds:n,triggerIds:r,allTriggers:t.allTriggers,allActions:t.allActions,configured:t.configured,proxy:t.proxy}}function fb(e,t){let n=k(e),{policyRevision:r,status:o,isDefault:i}=n,s=Object.hasOwn(n,"displayName")&&!Object.hasOwn(n,"connectionDisplayName"),a=t&&Object.hasOwn(n,"permissions")?eC(n.permissions):void 0,c=n.permissionGroupName;if(F(n,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName","providerId",...t?[]:["status"]]),r!==void 0&&typeof r!="string")return p("policyRevision: expected a string.");if(t&&i!==void 0&&typeof i!="boolean")return p("isDefault: expected a boolean.");if(c!==void 0&&c!==null&&typeof c!="string")return p("permissionGroupName: expected a string or null.");if(!t&&o!="active"&&o!="forbidden"&&o!="invalid"&&o!="missing")return p();let l;try{l=Bi(n.source)}catch{return p("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.")}return{accessBindingId:f(n.accessBindingId),connectionId:f(n.connectionId),source:l,connectionDisplayName:f(s?n.displayName:n.connectionDisplayName),...t&&typeof i=="boolean"?{isDefault:i}:{},...a==null?{}:{permissions:a},...c===void 0?{}:{permissionGroupName:c},...r==null?{}:{policyRevision:r},providerId:f(n.providerId),...t?{}:{status:o}}}function fu(e){if(e!="implicit"&&e!="selectable")return p("mode: expected implicit or selectable.");return e}function Nn(e){let t=k(e);F(t,["accessRevision","bindings","mode","sharedAccessDigest","version"]);let n=ie(t.accessRevision);if(t.version!=1||n<0||!Array.isArray(t.bindings))return p();if("providerIds"in t&&!Array.isArray(t.providerIds))return p();let r=t.providerIds==null?void 0:t.providerIds.map((s)=>f(s));if(r!=null&&new Set(r).size!=r.length)return p();let o=t.discardedBindingCount==null?0:ie(t.discardedBindingCount);if(o<0)return p();let i=[];for(let s of t.bindings)try{i.push(fb(s,!1))}catch(a){if(!(a instanceof _e)||a.code!="response.invalid")throw a;if(s!=null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.accessBindingId=="string"&&s.accessBindingId.length>0&&typeof s.providerId=="string"&&s.providerId.length>0)i.push({accessBindingId:s.accessBindingId,providerId:s.providerId,connectionId:null,source:null,status:"invalid",connectionDisplayName:typeof s.connectionDisplayName=="string"&&s.connectionDisplayName.length>0?s.connectionDisplayName:typeof s.displayName=="string"&&s.displayName.length>0?s.displayName:s.providerId,permissionGroupName:typeof s.permissionGroupName=="string"?s.permissionGroupName:null});else o++}if(new Set(i.map((s)=>s.accessBindingId)).size!=i.length)return p();return{accessRevision:n,...o==0?{}:{discardedBindingCount:o},...r==null?{}:{providerIds:r},bindings:i,mode:fu(t.mode),sharedAccessDigest:f(t.sharedAccessDigest),version:1}}function ub(e){if(!Array.isArray(e))return p();let t=e.map((n)=>{let r=k(n);F(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName"]);let o;try{o=Bi(r.source)}catch{return p()}if(r.permissionGroupName!=null&&typeof r.permissionGroupName!="string")return p();return{accessBindingId:f(r.accessBindingId),connectionId:f(r.connectionId),providerId:f(r.providerId),source:o,connectionDisplayName:f(r.connectionDisplayName),..."permissionGroupName"in r?{permissionGroupName:r.permissionGroupName}:{}}});if(new Set(t.map((n)=>n.accessBindingId)).size!=t.length)return p();return t}function mu(e){let t=k(e);if(F(t,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),t.version!=2)return p();let n=fu(t.mode),r=ub(t.sharedBindings),o=ub(t.selectedBindings);if(n=="implicit"&&(r.length>0||o.length>0))return p();return{mode:n,sharedAccessDigest:f(t.sharedAccessDigest),sharedBindings:r,selectedBindings:o,version:2}}function tC(e,t){let n=k(e);if(F(n,["candidates","mode","providerId","version"]),n.version!=1)return p("version: expected 1.");if(f(n.providerId)!=t)return p("providerId: does not match the requested provider.");if(!Array.isArray(n.candidates))return p("candidates: expected an array.");let r=n.candidates.map((o)=>fb(o,!0));if(r.some((o)=>o.providerId!=t))return p("candidates[].providerId: does not match the requested provider.");if(new Set(r.map((o)=>o.accessBindingId)).size!=r.length)return p("candidates[].accessBindingId: duplicate IDs.");return{candidates:r,mode:fu(n.mode),providerId:t,version:1}}function mb(e,t){let n=k(e);if(F(n,["results","version"]),n.version!=1)return p("version: expected 1.");if(!Array.isArray(n.results))return p("results: expected an array.");let r=new Set(t),o=n.results.map((i)=>{let s=k(i),a=f(s.providerId);if(!r.delete(a))return p("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return tC(s,a);F(s,["providerId","error"]);let c=k(s.error);return F(c,["code","message"]),{providerId:a,error:{code:f(c.code),message:f(c.message)}}});if(r.size!=0)return p("results: missing requested providers.");return{results:o,version:1}}function zn(e){let t=k(e);if(F(t,[...Object.hasOwn(t,"providerAccountId")?["providerAccountId"]:[],...Object.hasOwn(t,"alias")?["alias"]:[],...Object.hasOwn(t,"builtInAccount")?["builtInAccount"]:[],"connectionId","displayName","isDefault","serviceId","status"]),t.builtInAccount!==void 0&&typeof t.builtInAccount!="boolean")return p();let n=t.status;if(n!="active"&&n!="disconnected"&&n!="error"&&n!="reauth_required")return p();if(typeof t.isDefault!="boolean")return p();return{...t.providerAccountId===void 0?{}:{providerAccountId:f(t.providerAccountId)},...t.alias===void 0?{}:{alias:f(t.alias)},...t.builtInAccount===void 0?{}:{builtInAccount:t.builtInAccount},connectionId:f(t.connectionId),displayName:f(t.displayName),isDefault:t.isDefault,serviceId:f(t.serviceId),status:n}}function gb(e,t=!1){let n=k(e),r=n.description,o=t&&Object.hasOwn(n,"value");if(F(n,["jsonSchema","nullable",...r==null?[]:["description"],...o?["value"]:[]]),r!=null&&typeof r!="string")return p();if(typeof n.nullable!="boolean")return p();return{...r==null?{}:{description:r},jsonSchema:ve(n.jsonSchema),nullable:n.nullable,...o?{value:ve(n.value)}:{}}}function nC(e){return gb(e,!0)}function db(e,t){return Object.fromEntries(Object.entries(k(e)).map(([n,r])=>[n,t(r)]))}function rC(e){let t=k(e),{homepageUrl:n,icon:r}=t;if(F(t,["actionId",...Object.hasOwn(t,"operationType")?["operationType"]:[],...Object.hasOwn(t,"inputSchema")?["inputSchema"]:[],...Object.hasOwn(t,"outputSchema")?["outputSchema"]:[],"authenticated","description",...n==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in t?["iconSprite"]:[],..."iconSpritePosition"in t?["iconSpritePosition"]:[],"inputs","name","outputs","serviceId","serviceName"]),n!=null&&typeof n!="string"||r!=null&&typeof r!="string")return p();return{...t.inputSchema===void 0?{}:{inputSchema:ve(t.inputSchema)},...t.outputSchema===void 0?{}:{outputSchema:ve(t.outputSchema)},actionId:f(t.actionId),...t.operationType==null?{}:{operationType:f(t.operationType)},authenticated:typeof t.authenticated=="boolean"?t.authenticated:p(),description:typeof t.description=="string"?t.description:p(),...n==null?{}:{homepageUrl:n},...r==null?{}:{icon:r},...Zi(t.iconSprite,t.iconSpritePosition),inputs:db(t.inputs,nC),name:f(t.name),outputs:db(t.outputs,gb),serviceId:f(t.serviceId),serviceName:f(t.serviceName)}}function Ui(e){let{defaultConnection:t,...n}=k(e),r=rC(n);if(t==null)return r;let o=zn(t);if(o.serviceId!=r.serviceId||o.status!="active")return p();return{...r,defaultConnection:o}}function hb(e){let t=k(e),{homepageUrl:n,icon:r}=t;if(t.noSetup!==void 0&&typeof t.noSetup!="boolean")return p();if(F(t,[...Object.hasOwn(t,"noSetup")?["noSetup"]:[],"serviceId","serviceName",...n==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in t?["iconSprite"]:[],..."iconSpritePosition"in t?["iconSpritePosition"]:[]]),n!=null&&typeof n!="string"||r!=null&&typeof r!="string")return p();return{...n==null?{}:{homepageUrl:n},...r==null?{}:{icon:r},...Zi(t.iconSprite,t.iconSpritePosition),serviceId:f(t.serviceId),serviceName:f(t.serviceName),...t.noSetup===void 0?{}:{noSetup:t.noSetup}}}function gu(e){return{actionId:e.actionId,authenticated:e.authenticated,...e.defaultConnection==null?{}:{defaultConnection:{connectionId:e.defaultConnection.connectionId,displayName:e.defaultConnection.displayName,status:e.defaultConnection.status}},description:e.description,name:e.name,serviceId:e.serviceId,serviceName:e.serviceName}}var Dn=C().min(1).max(256),bb=O({appId:Dn.nullable(),workspaceId:Dn.optional(),installationId:Dn.optional(),organizationId:Dn.optional(),projectId:Dn.optional(),projectKey:Dn.optional(),subscriptionStatus:Z(["idle","pending","ready","error"]).optional(),lastError:C().optional(),signingSecretConfigured:he().optional(),manageSubscriptions:he().nullable(),verificationTokenConfigured:he().nullable(),encryptKeyConfigured:he().nullable(),verifiedAt:C().nullable()});var qn=C().min(1).max(256),sC=C().regex(/^[a-z][a-z0-9_.:]{0,127}$/),aC=C().trim().min(1).max(128),wb=O({version:b(1),sourceId:qn,revision:xe().positive(),name:aC,provider:Z(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...bb.shape,connectionId:qn,teamId:qn.nullable(),enabled:he(),eventTypes:R(sC),endpointUrl:C().nullable(),lastReceivedAt:C().nullable(),updatedAt:C(),consumers:R(O({flowId:qn,flowName:C(),triggerNodeId:qn}))});function Ki(e){return wb.parse(e)}function hu(e){return O({version:b(1),sources:R(wb),teamId:qn.nullable().optional()}).parse(e)}function yu(e){let t=k(e);if(F(t,["version","locale","definitions","display"]),t.version!=3||!Gu(t.locale)||!Array.isArray(t.definitions))return p();let n=t.definitions.map(Br),r=k(t.display),o=new Set(n.map((s)=>s.key));if(o.size!=n.length||Object.keys(r).length!=o.size)return p();let i=Object.fromEntries(n.map((s)=>{let{key:a}=s,c=k(r[a]);return F(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:vb(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:cC(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:f(c.displayName),description:f(c.description),outputs:vb(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:t.locale,definitions:n,display:i}}function vb(e,t){let n=k(e);return Ly(n,t),Object.fromEntries(Object.entries(n).map(([r,o])=>[r,f(o)]))}function cC(e,t){let n=k(e);if(Object.keys(n).some((r)=>!t.includes(r)))return p();return Object.fromEntries(Object.entries(n).map(([r,o])=>{let i=f(o);return i.trim().length==0?p():[r,i]}))}function bu(e,t){if(t==null)return e;let n=t.toLowerCase();return e.filter((r)=>[r.description,r.displayName,r.key,r.name,r.provider,r.type].some((o)=>o.toLowerCase().includes(n)))}var lC=v({pointer:C().max(4096).default(""),offset:B().int().nonnegative().default(0),limit:B().int().min(1).max(100).default(20),maxBytes:B().int().min(1).max(1048576).default(15000)});var uC=Pe(),kb=O({pointer:C(),type:Z(["object","array","string","number","boolean","null"]),length:B().int().nonnegative().optional(),complete:he(),value:uC.optional()}),dC=kb.extend({offset:B().int().nonnegative(),nextOffset:B().int().positive().optional(),entries:R(kb).optional()}),xb=O({resultId:C().min(1),callId:C().min(1),toolId:C().min(1),source:it("kind",[O({kind:b("connector"),action:C().min(1)}),O({kind:b("code")}),O({kind:b("workflow"),flowId:C().min(1)})]),bytes:B().int().nonnegative(),digest:C().regex(/^[a-f0-9]{64}$/),createdAt:C().datetime()}),pC=O({version:b(1),runId:C(),results:R(xb),nextAfter:C().optional()}),fC=O({version:b(1),runId:C(),result:xb,page:dC});function wu(e){return pC.parse(e)}function vu(e){return fC.parse(e)}function Sb(e){if(!Array.isArray(e))return p();return e.map((t)=>typeof t=="string"||Number.isSafeInteger(t)?t:p())}function mC(e){let t=k(e),n=f(t.kind);if(n=="artifact"||n=="binary"||n=="nullable")return{kind:n};if(n=="schema")return{kind:n,path:t.path==null?void 0:Sb(t.path)};if(n!="keyword"||typeof t.keyword!="string"||!Ei(t.keyword))return p();return{kind:n,keyword:t.keyword,path:Sb(t.path),source:t.source===void 0?void 0:ve(t.source),target:t.target===void 0?void 0:ve(t.target)}}function gC(e){let t=k(e),n=t.values==null?void 0:k(t.values);return{code:f(t.code),column:ie(t.column),...t.fields===void 0?{}:{fields:Array.isArray(t.fields)?t.fields.map(f):p()},line:ie(t.line),message:f(t.message),mismatch:t.mismatch==null?void 0:mC(t.mismatch),path:typeof t.path=="string"?t.path:p(),...n==null?{}:{values:Object.fromEntries(Object.entries(n).map(([r,o])=>[r,typeof o=="string"||typeof o=="number"?o:p()]))}}}function Ib(e){let t=k(e);if(t.version!=1||typeof t.valid!="boolean"||!Array.isArray(t.diagnostics))return p();return{closureDigest:f(t.closureDigest),diagnostics:t.diagnostics.map(gC),engineContract:f(t.engineContract),flowId:f(t.flowId),modelVersion:ie(t.modelVersion),revisionDigest:f(t.revisionDigest),revisionId:f(t.revisionId),valid:t.valid,version:1}}var Cb=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function Eb(e,t){let n=new URLSearchParams({...e==null?{}:{flowId:e},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/providers${n?`?${n}`:""}`,decode:(r)=>{let o=k(r);if(F(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return p();return o.providers.map(hb)}}}function Ob(e,t,n){let r=new URLSearchParams({...t==null?{}:{flowId:t},...n==null?{}:{locale:n}}).toString();return{path:`/v1/connector/actions/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=k(o);if(F(i,["action","version"]),i.version!=1)return p();return Ui(i.action)}}}function jb(e){return{path:`/v1/connector/connections${Cb(e)}`,decode:(t)=>{let n=k(t);if(F(n,["connections","version"]),n.version!=1||!Array.isArray(n.connections))return p();return n.connections.map(zn)}}}function _b(e,t){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${Cb(t)}`,decode:(n)=>{let r=k(n);if(F(r,["connections","serviceId","version"]),r.version!=1||f(r.serviceId)!=e||!Array.isArray(r.connections))return p();return r.connections.map(zn)}}}function Gr(e){return Array.isArray(e)?e.map(f):p()}function hC(e){let t=k(e),n=t.draft===null?null:k(t.draft),r=k(t.sharedAccess);if(n!=null&&!Array.isArray(n.connections))return p();if(!Array.isArray(r.bindings))return p();let o=ie(r.accessRevision);if(o<0)return p();return{draft:n==null?null:{...n.calledFlowIds===void 0?{}:{calledFlowIds:Gr(n.calledFlowIds)},variableNames:Gr(n.variableNames),errorSourceFlowIds:Gr(n.errorSourceFlowIds),connections:n.connections.map((i)=>{let s=k(i);return{providerId:f(s.providerId),connectionId:f(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:Gr(r.providerIds),bindings:r.bindings.map((i)=>{let s=k(i);return{providerId:f(s.providerId),connectionId:s.connectionId===null?null:f(s.connectionId),accessBindingId:f(s.accessBindingId)}})}}}function Xe(e){let t=k(e),n=t.status;if(t.version!=1)return p();if(n!="active"&&n!="retiring")return p();let r=t.live==null?void 0:k(t.live);if(r!=null&&(typeof r.enabled!="boolean"||typeof r.hasStart!="boolean"))return p();return{...r==null?{}:{live:{enabled:r.enabled,hasStart:r.hasStart,publicationId:f(r.publicationId),revisionId:f(r.revisionId)}},tagIds:t.tagIds===void 0?[]:Gr(t.tagIds),createdAt:f(t.createdAt),...t.connectorTeamId==null?{}:{connectorTeamId:f(t.connectorTeamId)},draftRevisionId:f(t.draftRevisionId),resourceReferences:hC(t.resourceReferences),flowId:f(t.flowId),name:f(t.name),...t.icon===void 0?{}:{icon:f(t.icon)},...t.description===void 0?{}:{description:f(t.description)},status:n,updatedAt:f(t.updatedAt),version:1}}function yC(e){let t=k(e),n=ie(t.referenceCount);if(n<0)return p();return{...Xe(t),referenceCount:n}}function Rb(e){let t=k(e);if(t.version!=1||!Array.isArray(t.flows))return p();let{nextCursor:n,total:r}=t;if(n!=null&&typeof n!="string")return p();if(r!=null&&!Number.isSafeInteger(r))return p();return{...n==null?{}:{nextCursor:n},flows:t.flows.map(yC),...r==null?{}:{total:r},version:1}}function Wi(e){let t=k(e);if(F(t,["name","updatedAt","value","version"]),t.version!=1||typeof t.value!="string")return p();let n=f(t.updatedAt);try{if(new Date(n).toISOString()!=n)return p()}catch{return p()}return{name:f(t.name),updatedAt:n,value:t.value,version:1}}function Ab(e){let t=k(e),{referenceCount:n,...r}=t,o=ie(n);if(o<0)return p();return{...Wi(r),referenceCount:o}}function Pb(e){let t=k(e);if(typeof t.enabled!="boolean")return p();return{flowId:f(t.flowId),flowName:f(t.flowName),nodeId:f(t.nodeId),nodeName:f(t.nodeName),enabled:t.enabled}}function Tb(e){let t=k(e);if(F(t,["version","references"]),t.version!=1||!Array.isArray(t.references))return p();return{version:1,references:t.references.map((n)=>{let r=k(n);if(F(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return p();let o=r.live===null?null:k(r.live);if(o!=null){if(F(o,["publicationId","enabled"]),typeof o.enabled!="boolean")return p()}return{flowId:f(r.flowId),flowName:f(r.flowName),draft:r.draft,live:o==null?null:{publicationId:f(o.publicationId),enabled:o.enabled}}})}}function ku(e){let t=k(e),n=t.parentRevisionId;if(t.version!=1||n!==null&&typeof n!="string")return p();return{actorId:f(t.actorId),createdAt:f(t.createdAt),digest:f(t.digest),flowId:f(t.flowId),modelVersion:ie(t.modelVersion),parentRevisionId:n,revisionId:f(t.revisionId),version:1}}function Hr(e){let t=k(e);try{return{...ku(t),content:An(t.content)}}catch{return p()}}function $b(e){let t=k(e),n=k(t.content),r=k(k(n.document).graph),o=Object.entries(k(r.nodes)).flatMap(([i,s])=>{let a=k(s);if(a.kind=="outputs"||Object.hasOwn(a,"inputs"))return[];let c=f(a.kind);if(a.name!==void 0&&typeof a.name!="string")return p();return[{triggerId:f(i),kind:c,...a.name===void 0?{}:{name:a.name}}]});return{...ku(t),triggers:o}}function Gi(e){let t=k(e);if(t.version!=1||ie(t.revision)<1)return p();return{revision:ie(t.revision),updatedAt:f(t.updatedAt),value:Object.fromEntries(Object.entries(k(t.value)).map(([n,r])=>[n,ve(r)])),version:1}}function Qr(e){let t=k(e);if(t.version!=1)return p();return{revision:ku(t.revision),version:1}}function Nb(e){let t=k(e);if(t.version!=1||t.kind!="snapshot")return p();return{draft:Hr(t.draft),kind:"snapshot",version:1}}var bC=["canceled","completed","failed","indeterminate"],Hi=[...bC,"queued","running","starting","waiting"];var wC=new Set(Hi);function Qi(e){return typeof e=="string"&&wC.has(e)?e:p()}function qb(e){let t=k(e),{source:n,startedAt:r,finishedAt:o}=t;if(t.version!=1||n!="draft"&&n!="live")return p();if(r!=null&&typeof r!="string")return p();if(o!=null&&typeof o!="string")return p();return{createdAt:f(t.createdAt),...o==null?{}:{finishedAt:o},flowId:f(t.flowId),revisionId:f(t.revisionId),runId:f(t.runId),source:n,...r==null?{}:{startedAt:r},status:Qi(t.status),version:1}}function vC(e){let t=k(e);F(t,["actions","expiresAt","nodeId","prompt","waitId","waitingSince"]);let n=t.actions;if(!Array.isArray(n)||!(n.length==1&&n[0]=="continue"||n.length==2&&n[0]=="approve"&&n[1]=="reject"))return p();return{actions:n,...t.autoContinueAt===void 0?{}:{autoContinueAt:f(t.autoContinueAt)},expiresAt:f(t.expiresAt),nodeId:f(t.nodeId),prompt:f(t.prompt),waitId:f(t.waitId),waitingSince:f(t.waitingSince)}}function zb(e){let t=k(e);return{flowId:f(t.flowId),runId:f(t.runId),nodeId:f(t.nodeId),executionId:f(t.executionId),...t.callId==null?{}:{callId:f(t.callId)}}}function kC(e){let t=k(e);if(!["workbench","cli","mcp","api","trigger","workflow"].includes(t.channel))return p();return{channel:t.channel,...t.actorId===void 0?{}:{actorId:f(t.actorId)}}}function Yi(e){let t=k(e),n=qb(t),r=t.eventsExpiresAt;if(r!=null&&typeof r!="string")return p();if(t.waiting!==void 0||!Array.isArray(t.waits))return p();let o=t.waits.map(vC);if(new Set(o.map((a)=>a.waitId)).size!=o.length||n.status=="waiting"&&o.length==0&&(!Array.isArray(t.calls)||t.calls.length==0)||["completed","failed","canceled","indeterminate"].includes(n.status)&&o.length>0)return p();if(t.occurrenceId!==void 0&&t.triggerNodeId===void 0)return p();let i={status:n.status,waits:o};if(t.calls!==void 0&&!Array.isArray(t.calls))return p();let s={...n,...t.initiator===void 0?{}:{initiator:kC(t.initiator)},...xC(t),...t.triggerNodeId===void 0?{}:{triggerNodeId:f(t.triggerNodeId)},...t.caller===void 0?{}:{caller:zb(t.caller)},...t.calls===void 0?{}:{calls:t.calls.map((a)=>Object.assign(zb(a),{status:k(a).status===null?null:Qi(k(a).status)}))},closureDigest:f(t.closureDigest),engineContract:f(t.engineContract),engineDigest:f(t.engineDigest),...r==null?{}:{eventsExpiresAt:r},modelVersion:ie(t.modelVersion),sharedAccessDigest:f(t.sharedAccessDigest),revisionDigest:f(t.revisionDigest),...i};switch(n.source){case"draft":return{...s,source:"draft"};case"live":return{...s,publicationId:f(t.publicationId),source:"live",...t.occurrenceId===void 0?{}:{occurrenceId:f(t.occurrenceId),triggerNodeId:f(t.triggerNodeId)}}}}function Vb(e){let t=k(e),n=t.nextCursor;if(t.version!=1||!Array.isArray(t.runs))return p();if(n!=null&&typeof n!="string")return p();return{flowId:f(t.flowId),...n==null?{}:{nextCursor:n},runs:t.runs.map(qb),version:1}}function Lb(e){let t=k(e),n=Qi(t.status);if(t.version!=1||typeof t.cancelAccepted!="boolean"||n=="queued"||n=="starting"||n=="running"||n=="waiting")return p();return{cancelAccepted:t.cancelAccepted,runId:f(t.runId),status:n,version:1}}function Fb(e){let t=k(e);F(t,["action","comment","resolutionAccepted","resolvedAt","runId","status","version","waitId"]);let{action:n,resolvedAt:r}=t;if(t.version!=1||typeof t.resolutionAccepted!="boolean"||t.comment!==null&&typeof t.comment!="string"||n!==null&&n!="approve"&&n!="continue"&&n!="reject"||r!==null&&typeof r!="string"||n===null!=(r===null)||t.resolutionAccepted&&n===null)return p();return{action:n,comment:t.comment,resolutionAccepted:t.resolutionAccepted,resolvedAt:r,runId:f(t.runId),status:Qi(t.status),version:1,waitId:f(t.waitId)}}function Mb(e){let t=k(e),n=t.status;if(t.version!=1)return p();let r={finishedAt:f(t.finishedAt),runId:f(t.runId),version:1};if(n=="completed"){if(!Object.hasOwn(t,"result"))return p();return{...r,result:t.result,status:"completed"}}if(n=="canceled")return{...r,status:"canceled"};if(n=="failed"){let o=k(t.error);return{...r,error:Db(o),status:"failed"}}if(n=="indeterminate"){let o=k(t.error);return{...r,error:Db(o),status:"indeterminate"}}return p()}function xC(e){let t=e.errorSource==null?void 0:k(e.errorSource);if(e.errorDispatches!=null&&!Array.isArray(e.errorDispatches))return p();return{...t==null?{}:{errorSource:{flowId:f(t.flowId),runId:f(t.runId)}},...e.errorDispatches==null?{}:{errorDispatches:e.errorDispatches.map((n)=>{let r=k(n),o=f(r.flowId);switch(r.status){case"pending":return{status:"pending",flowId:o};case"dispatched":return{status:"dispatched",flowId:o,runId:f(r.runId)};case"failed":return{status:"failed",flowId:o,message:f(r.message)};default:return p()}})}}}function Db(e){return{code:f(e.code),message:f(e.message),...e.nodeId===void 0?{}:{nodeId:f(e.nodeId)},...e.jobId===void 0?{}:{jobId:f(e.jobId)},...e.path===void 0?{}:{path:(Array.isArray(e.path)?e.path:p()).map(f)}}}function Yr(){let e=globalThis.crypto;if(e!=null){try{if(typeof e.randomUUID=="function")return e.randomUUID()}catch{}if(typeof e.getRandomValues=="function"){let t=e.getRandomValues(new Uint8Array(16));t[6]=(t[6]??0)&15|64,t[8]=(t[8]??0)&63|128;let n=Array.from(t,(r)=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function xu(e={}){return{query:e.query?.trim().toLowerCase()??"",tagIds:[...new Set(e.tagIds??[])].toSorted(),untagged:e.untagged??!1}}function Xi(e){let t=k(e);if(t.version!=1)return p();return{tagId:f(t.tagId),name:f(t.name),version:1}}function Zb(e){let t=k(e),n=ie(t.referenceCount);if(n<0)return p();return{...Xi(t),referenceCount:n}}function SC(e){let t=k(e);if(t.version!=1||!Array.isArray(t.flows)||t.flows.length==0)return p();let n=Xe(t.flow),r=t.flows.map(Xe);if(new Set(r.map((o)=>o.flowId)).size!=r.length||!r.some((o)=>o.flowId==n.flowId))return p();return{version:1,flow:n,flows:r}}function Bb(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function IC(e){let t=k(e),n=ie(t.sequence);if(n<0)return p();let r={createdAt:f(t.createdAt),sequence:n},o=k(t.payload),i=t.kind;switch(i){case"run.queued":return{...r,kind:i,payload:{}};case"run.started":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),...o.parentScopeId===void 0?{}:{parentScopeId:f(o.parentScopeId)}}};case"run.progress":return{...r,kind:i,payload:{flowId:f(o.flowId),scopeId:f(o.scopeId),progress:Jb(o.progress)}};case"run.waiting":if(!Array.isArray(o.waitIds))return p();return{...r,kind:i,payload:{waitIds:o.waitIds.map((s)=>f(s))}};case"wait.created":{let s=o.autoContinueAt===void 0?{}:{autoContinueAt:f(o.autoContinueAt)};return{...r,kind:i,payload:{...s,expiresAt:f(o.expiresAt),nodeId:f(o.nodeId),waitId:f(o.waitId),waitingSince:f(o.waitingSince)}}}case"run.resolved":{let{action:s,source:a}=o;if(a!==void 0&&a!=="manual"&&a!=="automatic")return p();let c=a===void 0?{}:{source:a};if(s!=="approve"&&s!=="continue"&&s!=="reject")return p();if(o.comment!==null&&typeof o.comment!="string")return p();return{...r,kind:i,payload:{...c,action:s,comment:o.comment,resolvedAt:f(o.resolvedAt),waitId:f(o.waitId)}}}case"run.completed":case"run.canceled":case"run.failed":case"run.indeterminate":return{...r,kind:i,payload:{result:ve(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,ve(a)]))};case"node.started":case"node.completed":case"node.failed":case"node.log":case"node.progress":case"node.artifact":{let s={flowId:f(o.flowId),scopeId:f(o.scopeId),nodeId:f(o.nodeId),executionId:f(o.executionId)};switch(i){case"node.started":{let a=o.nodeKind;if(a!==void 0&&a!=="approval"&&a!=="condition"&&a!=="connector"&&a!=="javascript"&&a!=="decision"&&a!=="openapi"&&a!=="http-request"&&a!=="skip-duplicates"&&a!=="llm"&&a!=="agent"&&a!=="value"&&a!=="outputs"&&a!=="webhook-response"&&a!=="workflow"&&a!=="wait")return p();return{...r,kind:i,payload:{...s,...a===void 0?{}:{nodeKind:a},...o.nodeTitle===void 0?{}:{nodeTitle:f(o.nodeTitle)},...o.operation===void 0?{}:{operation:f(o.operation)}}}}case"node.completed":return{...r,kind:i,payload:{...s,...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(k(o.systemOutputs)).map(([a,c])=>[a,ve(c)]))},outputs:Object.fromEntries(Object.entries(k(o.outputs)).map(([a,c])=>[a,ve(c)]))}};case"node.failed":{let a=k(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(k(o.systemOutputs)).map(([c,l])=>[c,ve(l)]))},error:{code:f(a.code),message:f(a.message)}}}}case"node.log":{let a=o.level;if(a!=="debug"&&a!=="info"&&a!=="warn"&&a!=="error")return p();return{...r,kind:i,payload:{...s,level:a,message:f(o.message)}}}case"node.progress":return{...r,kind:i,payload:{...s,progress:Jb(o.progress)}};case"node.artifact":{let a=k(o.artifact),c=ie(a.size),l=f(a.digest);if(a.kind!="artifact"||c<0||!/^sha256:[0-9a-f]{64}$/.test(l))return p();return{...r,kind:i,payload:{...s,artifact:{kind:"artifact",id:f(a.id),name:f(a.name),size:c,digest:l,...a.mediaType===void 0?{}:{mediaType:f(a.mediaType)}}}}}}}default:return p()}}function Jb(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:p()}function CC(e){let t=k(e),n=t.eventsExpiresAt,r=ie(t.nextAfter);if(t.version!=1||!Array.isArray(t.events)||typeof t.done!="boolean"||typeof t.historyComplete!="boolean")return p();if(n!=null&&typeof n!="string")return p();if(r<0)return p();return{done:t.done,events:t.events.map(IC),...n==null?{}:{eventsExpiresAt:n},historyComplete:t.historyComplete,nextAfter:r,runId:f(t.runId),version:1}}var _=encodeURIComponent;function en(e){return`${e}-${Yr()}`}class Su{constructor(e,t="api"){this.channel=t,this.requestControl=e}async loadOpenApiDocument(e,t){let n=k(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:t}));if(n.version!=1)return p();return ve(n.document)}async listFlows(e={}){let t=new URLSearchParams,n=xu(e);if(n.query)t.set("query",n.query);if(n.tagIds.length)t.set("tagIds",n.tagIds.join(","));if(n.untagged)t.set("untagged","true");if(e.cursor!=null)t.set("cursor",e.cursor);if(e.limit!=null)t.set("limit",String(e.limit));if(e.includeTotal!=null)t.set("includeTotal",String(e.includeTotal));let r=t.size==0?"":`?${t}`;return Rb(await this.request(`/v1/flows${r}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,t){return hu(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${_(e)}`),{signal:t}))}async listEventSourceConnections(e,t,n="feishu"){let r=k(await this.request(`/v1/event-sources/connections?kind=${n}${e==null?"":`&teamId=${_(e)}`}`,{signal:t}));if(F(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return p();return r.connections.map(zn)}async createEventSource(e){return Ki(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,t){return Ki(await this.request(`/v1/event-sources/${_(e)}`,{method:"PUT",body:JSON.stringify(t)}))}async deleteEventSource(e,t){await this.request(`/v1/event-sources/${_(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:t})})}async listVariables(){let e=k(await this.request("/v1/variables"));if(F(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return p();return{variables:e.variables.map(Ab),version:1}}async getFlowReferences(e,t={}){let n=new URLSearchParams({direction:t.direction??"incoming",offset:String(t.offset??0),limit:String(t.limit??50)});return ey.parse(await this.request(`/v1/flows/${_(e)}/references?${n}`,{signal:t.signal}))}async getWorkflowContract(e,t){return Xh.parse(await this.request(`/v1/flows/${_(e)}/call-contract`,{signal:t}))}async getVariableReferences(e,t){return Tb(await this.request(`/v1/variables/${_(e)}/references`,{signal:t}))}async getVariable(e){return Wi(await this.request(`/v1/variables/${_(e)}`))}async putVariable(e,t){return Wi(await this.request(`/v1/variables/${_(e)}`,{body:JSON.stringify({value:t}),method:"PUT"}))}async deleteVariable(e){let t=k(await this.request(`/v1/variables/${_(e)}`,{method:"DELETE"}));if(F(t,["version"]),t.version!=1)return p()}async exportFlow(e){let t=await this.request(`/v1/flows/${_(e)}/export`);try{return $n(t)}catch{return p()}}async getFlowExportPreview(e){let t=await this.request(`/v1/flows/${_(e)}/export-preview`);try{return ib(t)}catch{return p()}}async exportFlowBundle(e){let t=await this.getFlowExportPreview(e);if(t.unavailableFlowIds.length)throw new _e(400,"flow.invalid","Some referenced workflows are unavailable.");return ab(t)}async importFlowBundle(e,t={}){return SC(await this.request("/v1/flows/import-bundle",{method:"POST",headers:{"Idempotency-Key":t.idempotencyKey??`flow-${Yr()}`},body:JSON.stringify({file:e,name:t.name,teamId:t.teamId,tagIds:t.tagIds,version:1})}))}async importFlow(e,t={}){return Xe(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":t.idempotencyKey??`flow-${Yr()}`},body:JSON.stringify({file:e,name:t.name,teamId:t.teamId,tagIds:t.tagIds,version:1})}))}async createFlow(e,t=`flow-${Yr()}`,n,r,o){return Xe(await this.request("/v1/flows",{body:JSON.stringify({name:e,...n==null?{}:{teamId:n},...r==null?{}:{tagIds:r},...o==null?{}:{presentation:o},version:1}),headers:{"idempotency-key":t},method:"POST"}))}async broadcastCanvas(e,t){let n=k(await this.request(`/v1/flows/${_(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:t})}));if(F(n,["version","flowId","broadcast"]),n.version!=1||n.broadcast!==!0||n.flowId!==e)return p();return{version:1,flowId:f(n.flowId),broadcast:!0}}async getFlow(e){return Xe(await this.request(`/v1/flows/${_(e)}`))}async getErrorListeners(e,t){let n=k(await this.request(`/v1/flows/${_(e)}/error-listeners`,{signal:t}));if(n.version!=1||!Array.isArray(n.listeners))return p();return n.listeners.map(Pb)}async listTags(e){let t=k(await this.request("/v1/tags",{signal:e}));if(t.version!=1||!Array.isArray(t.tags))return p();return{tags:t.tags.map(Zb),version:1}}async createTag(e){return Xi(await this.request("/v1/tags",{method:"POST",body:JSON.stringify({name:e,version:1})}))}async renameTag(e,t){return Xi(await this.request(`/v1/tags/${_(e)}`,{method:"PATCH",body:JSON.stringify({name:t,version:1})}))}async deleteTag(e){if(k(await this.request(`/v1/tags/${_(e)}`,{method:"DELETE"})).version!=1)p()}async setFlowTags(e,t){return Xe(await this.request(`/v1/flows/${_(e)}/tags`,{method:"PUT",body:JSON.stringify({tagIds:t,version:1})}))}async updateFlow(e,t){return Xe(await this.request(`/v1/flows/${_(e)}`,{method:"PATCH",body:JSON.stringify({...t,version:1})}))}async getFlowState(e,t){let n=ml.safeParse(await this.request(`/v1/flows/${_(e)}/state?scope=${t}`));return n.success&&n.data.scope===t?n.data:p()}async getFlowStateSummary(e,t,n){let r=rh.safeParse(await this.request(`/v1/flows/${_(e)}/state/summary?scope=${t}`,{signal:n}));return r.success&&r.data.scope===t?r.data:p()}async getFlowStateValues(e,t,n,r){let o=oh.safeParse(await this.request(`/v1/flows/${_(e)}/state/read`,{method:"POST",body:JSON.stringify({version:1,scope:t,keys:n}),signal:r}));return o.success&&o.data.scope===t&&o.data.values.length===n.length&&o.data.values.every((i,s)=>i.key===n[s])?o.data:p()}async clearFlowState(e,t,n){let r=k(await this.request(`/v1/flows/${_(e)}/state?scope=${t}${n==null?"":`&key=${encodeURIComponent(n)}`}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)p()}async clearFlowDedupe(e,t,n){let r=k(await this.request(`/v1/flows/${_(e)}/dedupe?scope=${t}&space=${encodeURIComponent(n)}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)p()}async clearAllFlowDedupe(e,t){let n=k(await this.request(`/v1/flows/${_(e)}/dedupe/all?scope=${t}`,{method:"DELETE"}));if(n.version!==1||n.cleared!==!0)p()}async renameFlow(e,t){return this.updateFlow(e,{name:t})}async deleteFlow(e){return Xe(await this.request(`/v1/flows/${_(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,t){let n=k(await this.request(`/v1/trigger-keys${t==null?"":`?locale=${encodeURIComponent(t)}`}`,{signal:e}));if(n.version!=1||!Array.isArray(n.keys))return p();return n.keys.map(au)}async listTriggerDefinitions(e){let t=k(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(t.version!=2||!Array.isArray(t.definitions))return p();return t.definitions.map(Br)}async readCatalog(e,t,n){let r=new Headers;if(t)r.set("if-none-match",t);let o=await this.response(e.path,{headers:r,signal:n},!0),i=o.headers.get("etag")?.trim()||null;if(o.status==304)return{modified:!1,etag:i};return{modified:!0,data:e.decode(await o.json()),etag:i}}async getTriggerCatalog(e,t,n){let r=new Headers;if(t?.etag)r.set("if-none-match",t.etag);let o=await this.response(`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,{headers:r,signal:n},!0);if(o.status==304){if(t==null)return p();return{...t,etag:o.headers.get("etag")?.trim()||t.etag}}return{data:yu(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,t){let n=k(await this.request(`/v1/trigger-keys/${_(e)}`,{signal:t}));if(n.version!=1)return p();return Br(n.definition)}async listFlowTriggerBindings(e,t){let n=k(await this.request(`/v1/flows/${_(e)}/triggers`,{signal:t}));if(n.version!=1||f(n.flowId)!=e||!Array.isArray(n.bindings))return p();return n.bindings.map(Ur)}async getFlowTriggerBinding(e,t){return Zy(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}`))}async listFlowTriggerActivities(e,t,n={}){let r=new URLSearchParams;if(n.cursor!=null)r.set("cursor",n.cursor);if(n.limit!=null)r.set("limit",String(n.limit));let o=r.size==0?"":`?${r}`;return Jy(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/activities${o}`))}async testFlowPollTrigger(e,t){return By(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let t=k(await this.request(`/v1/flows/${_(e)}/editor`));if(t.version!=1)return p();let n={flow:Xe(t.flow),draft:Hr(t.draft),live:su(t.live),presentation:Gi(t.presentation),version:1};if(n.flow.flowId!=e||n.draft.flowId!=e||n.live.flowId!=e||n.flow.draftRevisionId!=n.draft.revisionId)return p();return n}async getPublicationPresentation(e,t,n){let r=k(await this.request(`/v1/flows/${_(e)}/publications/${_(t)}/presentation`,{signal:n}));if(r.version!=1)return p();return{version:1,presentation:r.presentation===null?null:Gi(r.presentation)}}async getPresentation(e){return Gi(await this.request(`/v1/flows/${_(e)}/presentation`))}async getDraft(e){return Hr(await this.request(`/v1/flows/${_(e)}/draft`))}async syncDraft(e){return Nb(await this.request(`/v1/flows/${_(e)}/draft/sync`))}async getRevision(e,t,n){return Hr(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}`,{signal:n}))}async getRevisionTriggers(e,t,n){let r=$b(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}`,{signal:n}));if(r.flowId!=e||r.revisionId!=t)return p();return r}async listTriggerConfigOptions(e,t,n,r){let o=k(await this.request(`/v1/flows/${_(e)}/triggers/${_(t)}/options/${_(n)}`,{signal:r}));if(F(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return p();return o.options.map((i)=>{let s=k(i);F(s,["value","label",...s.color==null?[]:["color"]]);let a=s.color==null?void 0:f(s.color);if(a!=null&&!/^#[0-9a-fA-F]{6}$/.test(a))return p();return a==null?{value:f(s.value),label:f(s.label)}:{value:f(s.value),label:f(s.label),color:a}})}async listConnectorTeams(e){let t=k(await this.request("/v1/connector/teams",{signal:e}));if(F(t,["enabled","teams","version"]),t.version!=1||typeof t.enabled!="boolean"||!Array.isArray(t.teams))return p();return{enabled:t.enabled,teams:t.teams.map((n)=>{let r=k(n);if(F(r,["id","name","systemCreated"]),typeof r.systemCreated!="boolean")return p();return{id:f(r.id),name:f(r.name),systemCreated:r.systemCreated}}),version:1}}async listConnectorProviders(e,t,n){let r=Eb(t,n);return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,t){return pb(await this.request(`/v1/connector/leina/bots?flowId=${_(e)}`,{signal:t}))}async removeConnectionUsage(e,t,n,r,o){return Qr(await this.request(`/v1/flows/${_(e)}/connection-usage/remove`,{method:"POST",headers:{"idempotency-key":o},body:JSON.stringify({connectionId:t,expectedRevisionId:n,expectedAccessRevision:r,version:1})}))}async getConnectorAccess(e,t){return Nn(await this.request(`/v1/flows/${_(e)}/connector-access`,{signal:t}))}async getPublishedConnectorAccess(e,t,n){return mu(await this.request(`/v1/flows/${_(e)}/connector-access?publicationId=${_(t)}`,{signal:n}))}async listProviderAccessBindingCandidates(e,t,n){return mb(await this.request(`/v1/flows/${_(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:t,version:1}),signal:n}),t)}async setConnectorService(e,t,n,r){return Nn(await this.request(`/v1/flows/${_(e)}/connector-access/${_(t)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:n?"PUT":"DELETE"}))}async addProviderAccessBinding(e,t,n,r){return Nn(await this.request(`/v1/flows/${_(e)}/connector-access/${_(t)}`,{body:JSON.stringify({accessBindingId:n,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,t,n,r){return Nn(await this.request(`/v1/flows/${_(e)}/connector-access/${_(t)}`,{body:JSON.stringify({accessBindingId:n,expectedAccessRevision:r,version:1}),method:"DELETE"}))}async listConnectorActions(e,t,n,r){return await this.connectorActions({...r==null?{}:{locale:r},...n==null?{}:{flowId:n},...e==null?{}:{service:e}},t)}async searchConnectorActions(e,t,n,r){return await this.connectorActions({...r==null?{}:{locale:r},...n==null?{}:{flowId:n},q:e.trim()},t)}async getConnectorAction(e,t,n,r,o=!1){let i=Ob(e,n,r);return this.connectorRequest(i.path,"actions",t,i.decode,o)}async listAllConnectorConnections(e,t,n=!1){let r=jb(t);return this.connectorRequest(r.path,"connections",e,r.decode,n)}async listConnectorConnections(e,t,n,r=!1){let o=_b(e,n);return this.connectorRequest(o.path,"connections",t,o.decode,r)}async createConnectorConnectionPage(e,t,n){let r=new URLSearchParams;if(t!=null)r.set("flowId",t);if(n!=null)r.set("teamId",n);let o=k(await this.request(`/v1/connector/connections/${_(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(F(o,["url","version"]),o.version!=1)return p();try{let i=new URL(f(o.url));if(i.protocol!="http:"&&i.protocol!="https:")return p();return i.href}catch{return p()}}async readAuthoring(e,t={}){return Dy.parse(await this.request(`/v1/flows/${_(e)}/authoring/read`,{method:"POST",body:JSON.stringify(t)}))}async searchAuthoring(e,t){return qy.parse(await this.request(`/v1/flows/${_(e)}/authoring/search`,{method:"POST",body:JSON.stringify(t)}))}async authoringSchema(e,t){return k(await this.request(`/v1/flows/${_(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(t)}))}async editAuthoring(e,t){return zy.parse(await this.request(`/v1/flows/${_(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":t.requestId},body:JSON.stringify(t)}))}async checkAuthoring(e,t){return Ny.parse(await this.request(`/v1/flows/${_(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:t})}))}async changeDraft(e,t,n,r=en("change")){return Qr(await this.request(`/v1/flows/${_(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:t,operations:n,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,t,n=en("repair")){return Qr(await this.request(`/v1/flows/${_(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n},method:"POST"}))}async upgradeDraft(e,t,n={}){return Qr(await this.request(`/v1/flows/${_(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:t,version:1}),headers:{"idempotency-key":n.idempotencyKey??en("upgrade")},method:"POST"}))}async checkFlow(e,t){return Ib(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/check`,{body:JSON.stringify({engineContract:sn,version:1}),method:"POST"}))}async getLiveDetails(e,t){let n=Ky(await this.request(`/v1/flows/${_(e)}/live/details`,{signal:t}));if(n.flowId!=e)return p();return n}async getLive(e,t){return su(await this.request(`/v1/flows/${_(e)}/live`,{signal:t}))}async listPublications(e,t={},n){let r=new URLSearchParams;if(t.cursor!=null)r.set("cursor",t.cursor);if(t.limit!=null)r.set("limit",String(t.limit));if(t.includeTotal!=null)r.set("includeTotal",String(t.includeTotal));let o=r.size==0?"":`?${r}`;return Fy(await this.request(`/v1/flows/${_(e)}/publications${o}`,{signal:n}))}async createDraftRun(e,t,n){let r=Yi(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/runs`,{body:JSON.stringify({engineContract:sn,inputs:n.inputs??{},trigger:n.trigger,version:2}),headers:{"idempotency-key":n.idempotencyKey??en("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:p()}async createLiveRun(e,t){let n=Yi(await this.request("/v1/runs",{body:JSON.stringify({inputs:t.inputs??{},trigger:t.trigger,publicationId:e,version:2}),headers:{"idempotency-key":t.idempotencyKey??en("run"),"x-open-flow-client":this.channel},method:"POST"}));return n.source=="live"?n:p()}async setFlowEnabled(e,t,n){return Xe(await this.request(`/v1/flows/${_(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:n,expectedPublicationId:t,version:1})}))}async publishFlow(e,t,n,r={}){return iu(await this.request(`/v1/flows/${_(e)}/revisions/${_(t)}/publications`,{body:JSON.stringify({engineContract:sn,expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??en("publication")},method:"POST"}))}async getPublishOperation(e,t,n){return iu(await this.request(`/v1/flows/${_(e)}/publish-operations/${_(t)}`,{signal:n}))}async rollbackFlow(e,t,n,r={}){return Tn(await this.request(`/v1/flows/${_(e)}/publications/${_(t)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:n,version:1}),headers:{"idempotency-key":r.idempotencyKey??en("publication")},method:"POST"}))}async getRun(e,t){return Yi(await this.request(`/v1/runs/${_(e)}`,{signal:t}))}async listRuns(e,t={}){let n=new URLSearchParams;if(t.cursor!=null)n.set("cursor",t.cursor);if(t.limit!=null)n.set("limit",String(t.limit));if(t.status!=null)n.set("status",t.status);if(t.pendingWait!=null)n.set("pendingWait",String(t.pendingWait));if(t.source!=null)n.set("source",t.source);if(t.createdFrom!=null)n.set("createdFrom",t.createdFrom);if(t.createdBefore!=null)n.set("createdBefore",t.createdBefore);if(t.runId!=null)n.set("runId",t.runId);let r=n.size==0?"":`?${n}`;return Vb(await this.request(`/v1/flows/${_(e)}/runs${r}`))}async getRunEvents(e,t={},n){let r=new URLSearchParams;if(t.after!=null)r.set("after",String(t.after));if(t.limit!=null)r.set("limit",String(t.limit));let o=r.size==0?"":`?${r}`;return CC(await this.request(`/v1/runs/${_(e)}/events${o}`,{signal:n}))}async listRunResults(e,t,n){return wu(await this.request(`/v1/runs/${_(e)}/results${t==null?"":`?after=${encodeURIComponent(t)}`}`,{signal:n}))}async readRunResult(e,t,n={},r){let o=new URLSearchParams(Object.entries(n).map(([i,s])=>[i,String(s)]));return vu(await this.request(`/v1/runs/${_(e)}/results/${_(t)}?${o}`,{signal:r}))}async downloadRunResult(e,t,n){return(await this.response(`/v1/runs/${_(e)}/results/${_(t)}/content`,{signal:n})).blob()}async getRunResult(e,t){return Mb(await this.request(`/v1/runs/${_(e)}/result`,{signal:t}))}async cancelRun(e){return Lb(await this.request(`/v1/runs/${_(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,t,n,r){return Fb(await this.request(`/v1/runs/${_(e)}/waits/${_(t)}/resolve`,{body:JSON.stringify({action:n,comment:r,version:1}),method:"POST"}))}async connectorActions(e,t){let n=Object.entries(e).map(([o,i])=>`${_(o)}=${_(i)}`).join("&"),r=n==""?"":`?${n}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",t,(o)=>{let i=k(o);if(F(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return p();return i.actions.map(Ui)})}async connectorRequest(e,t,n,r,o=!1){return r(await this.request(e,{signal:n}))}async response(e,t,n=!1){let r=new Headers(t.headers);if(t.body!=null)r.set("content-type","application/json");let o=await this.requestControl(e,{...t,headers:r});if(!o.ok&&!(n&&o.status==304)){let i;try{i=await o.json()}catch{return p()}let s=k(i).error,a=s==null?void 0:k(s);throw new _e(o.status,typeof a?.code=="string"?a.code:"request.failed",typeof a?.message=="string"?a.message:`Request failed with status ${o.status}.`,a?.details==null?void 0:k(a.details))}return o}async request(e,t={}){let n=await this.response(e,t);try{return await n.json()}catch{return p()}}}import{randomUUID as AC}from"crypto";class E extends Error{constructor(e,t,n){super(t);this.code=e,this.details=n,this.name="CliError"}}function es(e,t){let n=e.trim();if(Wr(n)!=null)throw new E("cli.invalid-arguments",`${t} name must be between 1 and ${uu} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return n}var EC=100,Iu=100,Cu=100,OC=new Set(["canceled","completed","failed","indeterminate"]);async function jC(e){let t=[],n=new Set,r;do{let o=await e.listFlows({cursor:r,limit:EC});if(t.push(...o.flows),r=o.nextCursor,r!=null&&n.has(r))throw new E("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)n.add(r)}while(r!=null);return t}function _C(e,t){let n=e.find((o)=>o.flowId==t);if(n!=null)return n;let r=e.filter((o)=>o.name==t);if(r.length==1)return r[0];if(r.length>1)throw new E("flow.ambiguous",`Flow name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new E("flow.not-found",`Flow ${JSON.stringify(t)} was not found.`)}async function ke(e,t){try{return await e.getFlow(t)}catch(n){if(!(n instanceof _e)||n.code!="flow.invalid"&&n.code!="flow.not-found")throw n}return _C(await jC(e),t)}async function Ub(e,t,n){if(n.expectedRevision!=null&&n.expectedRevision!=t.draftRevisionId&&!n.options.includes("idempotency-key"))throw new E("flow.revision-conflict","The Flow Draft changed. Inspect it before submitting a new mutation.",{expectedRevisionId:n.expectedRevision,actualRevisionId:t.draftRevisionId,flowId:t.flowId});let r=await e.getRevision(t.flowId,n.expectedRevision??t.draftRevisionId);return{draft:r,flow:t,graph:r.content.document.graph}}function RC(e,t){let n=e.find((o)=>o.actionId==t);if(n!=null)return n;let r=e.filter((o)=>o.name==t);if(r.length==1)return r[0];if(r.length>1)throw new E("connector.action-ambiguous",`Connector Action name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({actionId:o,name:i,serviceId:s})=>({actionId:o,name:i,serviceId:s}))});throw new E("connector.action-not-found",`Connector Action ${JSON.stringify(t)} was not found.`)}async function Kb(e,t,n){try{return await e.getConnectorAction(t,void 0,n)}catch(r){if(!(r instanceof _e)||r.status!=404)throw r}return RC(await e.searchConnectorActions(t,void 0,n),t)}function Eu(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function Wb(e,t){try{return await e.getTriggerKey(t)}catch(o){if(!(o instanceof _e)||o.status!=404)throw o}let r=(await e.listTriggerKeys()).filter((o)=>o.name==t||o.displayName==t);if(r.length==1)return await e.getTriggerKey(r[0].key);if(r.length>1)throw new E("trigger-key.ambiguous",`Trigger Key name ${JSON.stringify(t)} is ambiguous.`,{candidates:r.map(({displayName:o,key:i,provider:s})=>({displayName:o,key:i,provider:s}))});throw new E("trigger-key.not-found",`Trigger Key ${JSON.stringify(t)} was not found.`)}function Gb(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function Ou(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function le(e,t,n){if(e.length!=t)throw new E("cli.invalid-arguments",`Usage: ${n}`)}function M(e,t,n,r){e.stdout.write(t?`${JSON.stringify(n)}
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(n===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(n!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Em(e){let n=e.anyOf;if(!Array.isArray(n)||n.length===0||e.type!==void 0)return;let t=[];for(let r of n){if(!r||typeof r!=="object")return;Em(r);let o=Object.keys(r);if(o.length!==1||o[0]!=="type")return;let i=r.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!t.includes(s))t.push(s)}}delete e.anyOf,e.type=t.length===1?t[0]:t}var Am=new Set(["type","properties","required","additionalProperties"]),Cm=["oneOf","anyOf"];function Pm(e){let n=e.additionalProperties;if(n===void 0||n===!1||typeof n!=="object"||n===null)return null;return Object.keys(n).length?n:null}function Rc(e){let n=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Am.has(s))return null;n.push(i)}let t={},r=new Set;for(let i of n){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(t,s))continue;let a=[];for(let l of n){let u=l.properties?.[s]??Pm(l);if(u===null||u===void 0)continue;if(!a.some((d)=>JSON.stringify(d)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:Rc(a)??{allOf:a};qe(t,s,c)}for(let s of i.required??[])r.add(s)}let o={type:"object",properties:t};if(r.size)o.required=[...r];if(n.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of n){let a=Pm(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function Hk(e){let n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let o of Am)if(o in e)return;let t=n.filter((o)=>Cm.some((i)=>Array.isArray(o[i]))),r=null;if(!t.length)r=Rc(n);else{let o=t[0],i=Cm.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=n.filter((c)=>c!==o),a=o[i].map((c)=>Rc([...s,c]));if(a.some((c)=>!c))return;r={[i]:a}}if(!r)return;delete e.allOf,$r(e,r)}function zr(e,n){let t=e.seen.get(n);if(!t)throw Error("Unprocessed schema. This is a bug in Zod.");let r=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},d=c.ref;if(c.ref=null,d){r(d);let m=e.seen.get(d),y=m.schema;if(y.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(y);else $r(l,y);if($r(l,u),a._zod.parent===d)for(let j in l){if(j==="$ref"||j==="allOf")continue;if(!(j in u))delete l[j]}if(y.$ref&&m.def)for(let j in l){if(j==="$ref"||j==="allOf")continue;if(j in m.def&&JSON.stringify(l[j])===JSON.stringify(m.def[j]))delete l[j]}}let p=a._zod.parent;if(p&&p!==d){r(p);let m=e.seen.get(p);if(m?.schema.$ref){if(l.$ref=m.schema.$ref,m.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in m.def&&JSON.stringify(l[y])===JSON.stringify(m.def[y]))delete l[y]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())r(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Em(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let d=a.get(u);if(d)d.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])Hk(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(n)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}$r(o,t.defId?t.schema:t.def??t.schema);let i=e.metadataRegistry.get(n)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;qe(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...n["~standard"],jsonSchema:{input:Dr(n,"input",e.processors),output:Dr(n,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function Ue(e,n){let t=n??{seen:new Set};if(t.seen.has(e))return!1;t.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return Ue(r.element,t);if(r.type==="set")return Ue(r.valueType,t);if(r.type==="lazy")return Ue(r.getter(),t);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 Ue(r.innerType,t);if(r.type==="intersection")return Ue(r.left,t)||Ue(r.right,t);if(r.type==="record"||r.type==="map")return Ue(r.keyType,t)||Ue(r.valueType,t);if(r.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return Ue(r.in,t)||Ue(r.out,t)}if(r.type==="object"){for(let o in r.shape)if(Ue(r.shape[o],t))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(Ue(o,t))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(Ue(o,t))return!0;if(r.rest&&Ue(r.rest,t))return!0;return!1}return!1}var Tm=(e,n={})=>(t)=>{let r=Lr({...t,processors:n});return ve(e,r),Mr(r,e),zr(r,e)},Dr=(e,n,t={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=Lr({...o??{},target:i,io:n,processors:t});return ve(e,s),Mr(s,e),zr(s,e)};var Rn=(e,n,t)=>{if(e[n]===void 0||t>e[n])e[n]=t},_n=(e,n,t)=>{if(e[n]===void 0||t<e[n])e[n]=t},Om=(e,n)=>{Rn(e,"minimum",n),_n(e,"maximum",n)},$m=(e,n)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(n))e.multipleOf.push(n)},Dm=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},Lm=(e,n)=>{e.mime=e.mime?e.mime.filter((t)=>n.includes(t)):[...n]},Mm=(e,n)=>{if(e.format=n,n.includes("int"))e.isInt=!0},Nm=(e,n)=>Rn(e,"minimum",n.minimum),jm=(e,n)=>_n(e,"maximum",n.maximum),Rm=(e)=>(n,t)=>{Mm(n,t.format);let[r,o]=e[t.format];Rn(n,"minimum",r),_n(n,"maximum",o)},Gk={greater_than:(e,n)=>Rn(e,n.inclusive?"minimum":"exclusiveMinimum",n.value),less_than:(e,n)=>_n(e,n.inclusive?"maximum":"exclusiveMaximum",n.value),multiple_of:(e,n)=>$m(e,n.value),number_format:Rm(Bo),bigint_format:Rm(Uo),min_length:Nm,max_length:jm,length_equals:(e,n)=>Om(e,n.length),min_size:Nm,max_size:jm,size_equals:(e,n)=>Om(e,n.size),string_format:(e,n)=>{if(Mm(e,n.format),n.pattern)Dm(e,n.pattern);if(n.format==="base64"||n.format==="base64url")e.contentEncoding=n.format;if(n.local||n.precision===-1)e.laxFormat=!0},mime_type:(e,n)=>Lm(e,n.mime)};function Le(e){let n={},t=e._zod.def,r=e._zod.traits.has("$ZodCheck")?[e,...t.checks??[]]:t.checks??[];for(let i of r)Gk[i._zod.def.check]?.(n,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)Rn(n,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)Rn(n,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)_n(n,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)_n(n,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)$m(n,o.multipleOf);if(o.format!==void 0){if(n.format??(n.format=o.format),o.format.includes("int"))n.isInt=!0}if(o.mime)Lm(n,o.mime);for(let i of o.patterns??[])Dm(n,i);return n}var Qk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Xk=new Map([[nc,Oa],[li,Na]]),zm=(e)=>Xk.get(e)??e,Dc=(e,n,t,r)=>{let o=t;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=Le(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=Qk[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let d=[...c].map(zm);if(d.length===1)o.pattern=d[0].source;else if(d.length>1)o.allOf=[...d.map((p)=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))]}},Lc=(e,n,t,r)=>{let o=t,{minimum:i,maximum:s,multipleOf:a,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Le(e);o.type=u?"integer":"number";let d=typeof l==="number"&&l>=(i??Number.NEGATIVE_INFINITY),p=typeof c==="number"&&c<=(s??Number.POSITIVE_INFINITY),m=n.target==="draft-04"||n.target==="openapi-3.0";if(d)if(m)o.minimum=l,o.exclusiveMinimum=!0;else o.exclusiveMinimum=l;else if(typeof i==="number")o.minimum=i;if(p)if(m)o.maximum=c,o.exclusiveMaximum=!0;else o.exclusiveMaximum=c;else if(typeof s==="number")o.maximum=s;if(a){let y=new Set;for(let L of a)if(Number.isFinite(L)&&L!==0)y.add(Math.abs(L));else Me(e,n,o,r,`A multipleOf divisor of ${L} cannot be represented in JSON Schema`);let[I,...j]=y;if(I!==void 0)o.multipleOf=I;if(j.length)o.allOf=[...o.allOf??[],...j.map((L)=>({multipleOf:L}))]}},Mc=(e,n,t,r)=>{t.type="boolean"},zc=(e,n,t,r)=>{Me(e,n,t,r,"BigInt cannot be represented in JSON Schema")},Fc=(e,n,t,r)=>{Me(e,n,t,r,"Symbols cannot be represented in JSON Schema")},qc=(e,n,t,r)=>{if(n.target==="openapi-3.0")t.type="string",t.nullable=!0,t.enum=[null];else t.type="null"},Vc=(e,n,t,r)=>{Me(e,n,t,r,"Undefined cannot be represented in JSON Schema")},Bc=(e,n,t,r)=>{Me(e,n,t,r,"Void cannot be represented in JSON Schema")},Uc=(e,n,t,r)=>{t.not={}},Jc=(e,n,t,r)=>{},Zc=(e,n,t,r)=>{},Kc=(e,n,t,r)=>{Me(e,n,t,r,"Date cannot be represented in JSON Schema")},Wc=(e,n,t,r)=>{let o=e._zod.def,i=br(o.entries);if(i.length===0){t.not={};return}if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";t.enum=i},Hc=(e,n,t,r)=>{let o=e._zod.def;if(o.values.length===0){t.not={};return}let i=[];for(let s of o.values)if(s===void 0){if(Me(e,n,t,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof s==="bigint"){if(Me(e,n,t,r,"BigInt literals cannot be represented in JSON Schema"))return;i.push(Number(s))}else i.push(s);if(i.length===0);else if(i.length===1){let s=i[0];if(t.type=s===null?"null":typeof s,n.target==="draft-04"||n.target==="openapi-3.0")t.enum=[s];else t.const=s}else{if(i.every((s)=>typeof s==="number"))t.type="number";if(i.every((s)=>typeof s==="string"))t.type="string";if(i.every((s)=>typeof s==="boolean"))t.type="boolean";if(i.every((s)=>s===null))t.type="null";t.enum=i}},Gc=(e,n,t,r)=>{Me(e,n,t,r,"NaN cannot be represented in JSON Schema")},Qc=(e,n,t,r)=>{let o=t,i=e._zod.pattern;if(!i)throw Error("Pattern not found in template literal");o.type="string",o.pattern=i.source},Xc=(e,n,t,r)=>{let o=t;o.type="string",o.format="binary",o.contentEncoding="binary";let{minimum:i,maximum:s,mime:a}=Le(e);if(i!==void 0)o.minLength=i;if(s!==void 0)o.maxLength=s;if(!a)return;if(a.length===0)o.not={};else if(a.length===1)o.contentMediaType=a[0];else o.anyOf=a.map((c)=>({contentMediaType:c}))},Yc=(e,n,t,r)=>{t.type="boolean"},el=(e,n,t,r)=>{Me(e,n,t,r,"Custom types cannot be represented in JSON Schema")},tl=(e,n,t,r)=>{Me(e,n,t,r,"Function types cannot be represented in JSON Schema")},nl=(e,n,t,r)=>{Me(e,n,t,r,"Transforms cannot be represented in JSON Schema")},rl=(e,n,t,r)=>{Me(e,n,t,r,"Map cannot be represented in JSON Schema")},ol=(e,n,t,r)=>{Me(e,n,t,r,"Set cannot be represented in JSON Schema")},il=(e,n,t,r)=>{let o=t,i=e._zod.def,{minimum:s,maximum:a}=Le(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ve(i.element,n,{...r,path:[...r.path,"items"]})};function Fr(e){let n=e._zod.def;if(n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform"))return Fr(n.out);if(n.type==="catch")return Fr(n.innerType);return e._zod.optin}var sl=(e,n,t,r)=>{let o=t,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&Me(e,n,o,r,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)qe(o.properties,l,ve(s[l],n,{...r,path:[...r.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(n.io==="input"?Fr(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(n.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ve(i.catchall,n,{...r,path:[...r.path,"additionalProperties"]})},$i=(e,n,t,r)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>ve(a,n,{...r,path:[...r.path,i?"oneOf":"anyOf",c]}));if(i)t.oneOf=s;else t.anyOf=s},al=(e,n,t,r)=>{let o=e._zod.def,i=ve(o.left,n,{...r,path:[...r.path,"allOf",0]}),s=ve(o.right,n,{...r,path:[...r.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];t.allOf=c,n.intersections.push(c)},cl=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="array";let s=n.target==="draft-2020-12"?"prefixItems":"items",a=n.target==="draft-2020-12"?"items":n.target==="openapi-3.0"?"items":"additionalItems",c=i.items.map((I,j)=>ve(I,n,{...r,path:[...r.path,s,j]})),l=i.rest?ve(i.rest,n,{...r,path:[...r.path,a,...n.target==="openapi-3.0"?[i.items.length]:[]]}):null,u=i.items.length;while(u>0){let I=i.items[u-1];if(!(n.io==="input"?Fr(I)!==void 0:I._zod.optout==="optional"))break;u--}let d=i.items.length,p=!i.rest;if(n.target==="draft-2020-12"){if(o.prefixItems=c,p)o.items=!1;else if(l)o.items=l;if(u>0)o.minItems=u;if(p)o.maxItems=d}else if(n.target==="openapi-3.0"){if(o.items={anyOf:c},l)o.items.anyOf.push(l);if(u>0)o.minItems=u;if(p)o.maxItems=d}else{if(o.items=c,p)o.additionalItems=!1;else if(l)o.additionalItems=l;if(u>0)o.minItems=u;if(p)o.maxItems=d}let{minimum:m,maximum:y}=Le(e);if(typeof m==="number")o.minItems=m;if(typeof y==="number")o.maxItems=y};function _c(e,n,t){if(n.$ref){if(t.has(n))return n;t.add(n);let y=e.get(n)?.def;if(!y)return n;let I=_c(e,y,t);return I===y?n:I}for(let y of["anyOf","oneOf"]){let I=n[y];if(!Array.isArray(I))continue;let j=I.map((L)=>_c(e,L,t));if(j.some((L,F)=>L!==I[F]))n={...n,[y]:j}}let r=Array.isArray(n.type)?n.type:[n.type],o=!r.includes("string")&&r.some((y)=>y==="number"||y==="integer"),i=n.enum??(n.const!==void 0?[n.const]:void 0);if(!o&&!i?.some((y)=>typeof y==="number"))return n;let{minimum:s,maximum:a,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:p,...m}=n;if(m.enum)m.enum=m.enum.map((y)=>typeof y==="number"?String(y):y);else if(typeof m.const==="number")m.const=String(m.const);if(!o)return m;if(m.type="string",!i)m.pattern=(r.includes("number")?fn:Pr).source;return m}var $c=new WeakMap;function Yk(e){let n=new Map;for(let r of e.seen.values())if(r.def&&!n.has(r.schema))n.set(r.schema,r);let t=new Map;for(let r of $c.get(e)??[]){let o=e.seen.get(r),i=(o?.def??o?.schema)?.propertyNames;if(!i||i===!0||t.has(i))continue;let s=_c(n,i,new Set);if(s!==i)t.set(i,s)}if(!t.size)return;for(let r of e.seen.values())for(let o of[r.schema,r.def]){let i=o&&t.get(o.propertyNames);if(i)o.propertyNames=i}}var ll=(e,n,t,r)=>{let o=t,i=e._zod.def;o.type="object";let s=i.keyType,a=Le(s).patterns;if(i.mode==="loose"&&a&&a.size>0){let u=ve(i.valueType,n,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let d of a)qe(o.patternProperties,zm(d).source,u)}else{if(n.target==="draft-07"||n.target==="draft-2020-12"){o.propertyNames=ve(i.keyType,n,{...r,path:[...r.path,"propertyNames"]});let u=$c.get(n);if(!u)u=[],$c.set(n,u),n.deferred.push(()=>Yk(n));u.push(e)}o.additionalProperties=ve(i.valueType,n,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=n.io==="input"&&Fr(i.valueType)!==void 0;if(c&&!i.partial&&!l){let u=[...c].filter((d)=>typeof d==="string"||typeof d==="number");if(u.length>0)o.required=u.map(String)}},ul=(e,n,t,r)=>{let o=e._zod.def,i=ve(o.innerType,n,r),s=n.seen.get(e);if(n.target==="openapi-3.0")s.ref=o.innerType,t.nullable=!0;else t.anyOf=[i,{type:"null"}]},dl=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},pl=Symbol();function Fm(e,n,t,r,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return Me(n,t,r,o,"BigInt defaults cannot be represented in JSON Schema"),pl}var fl=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s=Fm(o.defaultValue,e,n,t,r);if(s!==pl)t.default=s},hl=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);if(i.ref=o.innerType,n.io!=="input")return;let s=Fm(o.defaultValue,e,n,t,r);if(s!==pl)t._prefault=s},ml=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{Me(e,n,t,r,"Dynamic catch values are not supported in JSON Schema");return}t.default=s},yl=(e,n,t,r)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=n.io==="input"?i?o.out:o.in:o.out;ve(s,n,r);let a=n.seen.get(e);a.ref=s},gl=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType,t.readOnly=!0},bl=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},Di=(e,n,t,r)=>{let o=e._zod.def;ve(o.innerType,n,r);let i=n.seen.get(e);i.ref=o.innerType},xl=(e,n,t,r)=>{let o=e._zod.innerType;ve(o,n,r);let i=n.seen.get(e);i.ref=o},_m={string:Dc,number:Lc,boolean:Mc,bigint:zc,symbol:Fc,null:qc,undefined:Vc,void:Bc,never:Uc,any:Jc,unknown:Zc,date:Kc,enum:Wc,literal:Hc,nan:Gc,template_literal:Qc,file:Xc,success:Yc,custom:el,function:tl,transform:nl,map:rl,set:ol,array:il,object:sl,union:$i,intersection:al,tuple:cl,record:ll,nullable:ul,nonoptional:dl,default:fl,prefault:hl,catch:ml,pipe:yl,readonly:gl,promise:bl,optional:Di,lazy:xl};function $n(e,n){if("_idmap"in e){let r=e,o=Lr({...n,processors:_m}),i={};for(let c of r._idmap.entries()){let[l,u]=c;ve(u,o)}let s={},a={registry:r,uri:n?.uri,defs:i};o.external=a;for(let c of r._idmap.entries()){let[l,u]=c;Mr(o,u),qe(s,l,zr(o,u))}if(Object.keys(i).length>0){let c=o.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[c]:i}}return{schemas:s}}let t=Lr({...n,processors:_m});return ve(e,t),Mr(t,e),zr(t,e)}var qm=new WeakSet([Object.prototype,Error.prototype]);function Mi(e,n,t){Object.defineProperty(e,n,{configurable:!0,enumerable:!1,get(){let r=t(this);return Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,n,{value:r,configurable:!0,writable:!0})}})}var Vm=(e,n)=>{xp.init(e,n),e.name="ZodError";let t=Object.getPrototypeOf(e);if(qm.has(t))return;qm.add(t),Mi(t,"format",(r)=>(o)=>vp(r,o)),Mi(t,"flatten",(r)=>(o)=>wp(r,o)),Mi(t,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,xr,2)}),Mi(t,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,xr,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},nS=g("ZodError",Vm),it=g("ZodError",Vm,void 0,{Parent:Error});var Bm=Sr(it),Um=Ir(it),Jm=Xo(it),Zm=Yo(it),Km=Sp(it),Wm=Ip(it),Hm=Cp(it),Gm=Pp(it),Qm=Ep(it),Xm=Ap(it),Ym=Tp(it),ey=Op(it);function oS(){if(!Fe.localeError)Ve(dc())}function mn(){if(!Fe.memoizer)Ve({memoizer:Mh()})}var Q=g("ZodType",(e,n)=>(oS(),H.init(e,n),e.def=n,e.type=n.type,e),{check(...e){let n=this.def;return this.clone(nt(n,{checks:[...n.checks??[],...e.map((t)=>typeof t==="function"?{_zod:{check:t,def:{check:"custom"},onattach:[]}}:t)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,n){return St(this,e,n)},brand(){return this},register(e,n){return e.add(this,n),this},refine(e,n){return this.check(By(e,n))},superRefine(e,n){return this.check(Uy(e,n))},overwrite(e){return this.check(Rt(e))},optional(){return zi(this)},exactOptional(){return Cy(this)},nullable(){return Fi(this)},nullish(){return zi(Fi(this))},nonoptional(e){return Ny(this,e)},array(){return A(this)},or(e){return te([this,e])},and(e){return gy(this,e)},transform(e){return wl(this,Ul(e))},default(e){return Ay(this,e)},prefault(e){return Oy(this,e)},catch(e){return _y(this,e)},pipe(e){return wl(this,e)},readonly(){return My(this)},describe(e){let n=this.clone();return Xe.add(n,{description:e}),n},meta(...e){if(e.length===0)return Xe.get(this);let n=this.clone();return Xe.add(n,e[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...n){return n.length===0?e(this):e(this,...n)},get "~standard"(){return kr(this,"~standard",{...tc(this),jsonSchema:{input:Dr(this,"input"),output:Dr(this,"output")}})},set "~standard"(e){Nt(this,"~standard",e)},parse:function e(n,t){return Bm(this,n,t,{callee:e})},parseAsync:async function e(n,t){return await Um(this,n,t,{callee:e})},safeParse(e,n){return Jm(this,e,n)},async safeParseAsync(e,n){return Zm(this,e,n)},get spa(){return this?.safeParseAsync},set spa(e){Nt(this,"spa",e)},validate(e,n){return da(this,e,n)},validateAsync(e,n){return pa(this,e,n)},encode:function e(n,t){return Km(this,n,t,{callee:e})},decode:function e(n,t){return Wm(this,n,t,{callee:e})},encodeAsync:async function e(n,t){return await Hm(this,n,t,{callee:e})},decodeAsync:async function e(n,t){return await Gm(this,n,t,{callee:e})},safeEncode(e,n){return Qm(this,e,n)},safeDecode(e,n){return Xm(this,e,n)},async safeEncodeAsync(e,n){return Ym(this,e,n)},async safeDecodeAsync(e,n){return ey(this,e,n)},toJSONSchema(e){return Tm(this,{})(e)},get description(){return Xe.get(this)?.description},get _def(){return this._zod.def}}),vl=g("_ZodString",(e,n)=>{Tn.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Dc(e,t,r,o)},Go({format:(e)=>Le(e).format??null,minLength:(e)=>Le(e).minimum??null,maxLength:(e)=>Le(e).maximum??null},{regex(...e){return this.check(ki(...e))},includes(...e){return this.check(Ci(...e))},startsWith(...e){return this.check(Pi(...e))},endsWith(...e){return this.check(Ei(...e))},min(...e){return this.check(hn(...e))},max(...e){return this.check(Rr(...e))},length(...e){return this.check(_r(...e))},nonempty(...e){return this.check(hn(1,...e))},lowercase(e){return this.check(Si(e))},uppercase(e){return this.check(Ii(e))},trim(){return this.check(Ni())},normalize(...e){return this.check(Oi(...e))},toLowerCase(){return this.check(ji())},toUpperCase(){return this.check(Ri())},slugify(){return this.check(_i())}})),kl=g("ZodString",(e,n)=>{Tn.init(e,n),vl.init(e,n)},{email(e){return this.check(pc(Sl,e))},url(e){return this.check(gi(qi,e))},jwt(e){return this.check(jc(zl,e))},emoji(e){return this.check(bc(Cl,e))},guid(e){return this.check(fc(Il,e))},uuid(e){return this.check(hc(_t,e))},uuidv4(e){return this.check(mc(_t,e))},uuidv6(e){return this.check(yc(_t,e))},uuidv7(e){return this.check(gc(_t,e))},nanoid(e){return this.check(xc(Pl,e))},cuid(e){return this.check(wc(El,e))},cuid2(e){return this.check(vc(Al,e))},ulid(e){return this.check(kc(Tl,e))},base64(e){return this.check(Tc(Dl,e))},base64url(e){return this.check(Oc(Ll,e))},xid(e){return this.check(Sc(Ol,e))},ksuid(e){return this.check(Ic(Nl,e))},ipv4(e){return this.check(Cc(jl,e))},ipv6(e){return this.check(Pc(Rl,e))},cidrv4(e){return this.check(Ec(_l,e))},cidrv6(e){return this.check(Ac($l,e))},e164(e){return this.check(Nc(Ml,e))},datetime(e){return this.check(bi(Dn,e))},date(e){return this.check(xi(Ln,e))},time(e){return this.check(wi(Mn,e))},duration(e){return this.check(vi(zn,e))}});function k(e){return Vh(kl,e)}var be=g("ZodStringFormat",(e,n)=>{he.init(e,n),vl.init(e,n)}),Dn=g("ZodISODateTime",(e,n)=>{Nf.init(e,n),be.init(e,n)}),Ln=g("ZodISODate",(e,n)=>{jf.init(e,n),be.init(e,n)}),Mn=g("ZodISOTime",(e,n)=>{Rf.init(e,n),be.init(e,n)}),zn=g("ZodISODuration",(e,n)=>{_f.init(e,n),be.init(e,n)}),Sl=g("ZodEmail",(e,n)=>{wf.init(e,n),be.init(e,n)});function iS(e){return pc(Sl,e)}var Il=g("ZodGUID",(e,n)=>{bf.init(e,n),be.init(e,n)});function sS(e){return fc(Il,e)}var _t=g("ZodUUID",(e,n)=>{xf.init(e,n),be.init(e,n)});function aS(e){return hc(_t,e)}function cS(e){return mc(_t,e)}function lS(e){return yc(_t,e)}function uS(e){return gc(_t,e)}var qi=g("ZodURL",(e,n)=>{Sf.init(e,n),be.init(e,n)});function dS(e){return gi(qi,e)}function pS(e){return gi(qi,{protocol:Cr,hostname:Ra,...T(e)})}var Cl=g("ZodEmoji",(e,n)=>{If.init(e,n),be.init(e,n)});function fS(e){return bc(Cl,e)}var Pl=g("ZodNanoID",(e,n)=>{Cf.init(e,n),be.init(e,n)});function hS(e){return xc(Pl,e)}var El=g("ZodCUID",(e,n)=>{Pf.init(e,n),be.init(e,n)});function mS(e){return wc(El,e)}var Al=g("ZodCUID2",(e,n)=>{Ef.init(e,n),be.init(e,n)});function yS(e){return vc(Al,e)}var Tl=g("ZodULID",(e,n)=>{Af.init(e,n),be.init(e,n)});function gS(e){return kc(Tl,e)}var Ol=g("ZodXID",(e,n)=>{Tf.init(e,n),be.init(e,n)});function bS(e){return Sc(Ol,e)}var Nl=g("ZodKSUID",(e,n)=>{Of.init(e,n),be.init(e,n)});function xS(e){return Ic(Nl,e)}var jl=g("ZodIPv4",(e,n)=>{$f.init(e,n),be.init(e,n)});function wS(e){return Cc(jl,e)}var ty=g("ZodMAC",(e,n)=>{Mf.init(e,n),be.init(e,n)});function vS(e){return Bh(ty,e)}var Rl=g("ZodIPv6",(e,n)=>{Lf.init(e,n),be.init(e,n)});function kS(e){return Pc(Rl,e)}var _l=g("ZodCIDRv4",(e,n)=>{zf.init(e,n),be.init(e,n)});function SS(e){return Ec(_l,e)}var $l=g("ZodCIDRv6",(e,n)=>{Ff.init(e,n),be.init(e,n)});function IS(e){return Ac($l,e)}var Dl=g("ZodBase64",(e,n)=>{Vf.init(e,n),be.init(e,n)});function CS(e){return Tc(Dl,e)}var Ll=g("ZodBase64URL",(e,n)=>{Bf.init(e,n),be.init(e,n)});function PS(e){return Oc(Ll,e)}var Ml=g("ZodE164",(e,n)=>{Uf.init(e,n),be.init(e,n)});function ES(e){return Nc(Ml,e)}var ny=g("ZodCreditCard",(e,n)=>{Jf.init(e,n),be.init(e,n)});function AS(e){return Uh(ny,e)}var ry=g("ZodIBAN",(e,n)=>{Zf.init(e,n),be.init(e,n)});function TS(e){return Jh(ry,e)}var zl=g("ZodJWT",(e,n)=>{Kf.init(e,n),be.init(e,n)});function OS(e){return jc(zl,e)}var Fn=g("ZodCustomStringFormat",(e,n)=>{Wf.init(e,n),be.init(e,n)});function NS(e,n,t={}){return jn(Fn,e,n,t)}function jS(e){return jn(Fn,"hostname",ja,e)}function RS(e){return jn(Fn,"hex",Ka,e)}function _S(e){return jn(Fn,"currency_code",$a,e)}function $S(e,n){let t=n?.enc??"hex",r=`${e}_${t}`,o=Vt[r];if(!o)throw Error(`Unrecognized hash format: ${r}`);return jn(Fn,r,o,n)}var Fl=g("ZodNumber",(e,n)=>{rc.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Lc(e,t,r,o),e.isFinite=!0},Go({minValue:(e)=>{let{minimum:n,exclusiveMinimum:t}=Le(e);return Math.max(n??Number.NEGATIVE_INFINITY,t??Number.NEGATIVE_INFINITY)},maxValue:(e)=>{let{maximum:n,exclusiveMaximum:t}=Le(e);return Math.min(n??Number.POSITIVE_INFINITY,t??Number.POSITIVE_INFINITY)},isInt:(e)=>{let{isInt:n,multipleOf:t}=Le(e);return!!n||!!t?.some(Number.isSafeInteger)},format:(e)=>Le(e).format??null},{gt(e,n){return this.check(Ut(e,n))},gte(e,n){return this.check(ht(e,n))},min(e,n){return this.check(ht(e,n))},lt(e,n){return this.check(Bt(e,n))},lte(e,n){return this.check(ft(e,n))},max(e,n){return this.check(ft(e,n))},int(e){return this.check(Ne(e))},safe(e){return this.check(Ne(e))},positive(e){return this.check(Ut(0,e))},nonnegative(e){return this.check(ht(0,e))},negative(e){return this.check(Bt(0,e))},nonpositive(e){return this.check(ft(0,e))},multipleOf(e,n){return this.check(On(e,n))},step(e,n){return this.check(On(e,n))},finite(){return this}}));function M(e){return Zh(Fl,e)}var qn=g("ZodNumberFormat",(e,n)=>{Hf.init(e,n),Fl.init(e,n)});function Ne(e){return Kh(qn,e)}function DS(e){return Wh(qn,e)}function LS(e){return Hh(qn,e)}function MS(e){return Gh(qn,e)}function zS(e){return Qh(qn,e)}var ql=g("ZodBoolean",(e,n)=>{ui.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Mc(e,t,r,o)});function me(e){return Xh(ql,e)}var Vl=g("ZodBigInt",(e,n)=>{oc.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>zc(e,t,r,o)},Go({minValue:(e)=>Le(e).minimum??null,maxValue:(e)=>Le(e).maximum??null,format:(e)=>Le(e).format??null},{gte(e,n){return this.check(ht(e,n))},min(e,n){return this.check(ht(e,n))},gt(e,n){return this.check(Ut(e,n))},lt(e,n){return this.check(Bt(e,n))},lte(e,n){return this.check(ft(e,n))},max(e,n){return this.check(ft(e,n))},positive(e){return this.check(Ut(BigInt(0),e))},negative(e){return this.check(Bt(BigInt(0),e))},nonpositive(e){return this.check(ft(BigInt(0),e))},nonnegative(e){return this.check(ht(BigInt(0),e))},multipleOf(e,n){return this.check(On(e,n))}}));function FS(e){return Yh(Vl,e)}var Bl=g("ZodBigIntFormat",(e,n)=>{Gf.init(e,n),Vl.init(e,n)});function qS(e){return em(Bl,e)}function VS(e){return tm(Bl,e)}var oy=g("ZodSymbol",(e,n)=>{Qf.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Fc(e,t,r,o)});function BS(e){return nm(oy,e)}var iy=g("ZodUndefined",(e,n)=>{Xf.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Vc(e,t,r,o)});function US(e){return rm(iy,e)}var sy=g("ZodNull",(e,n)=>{Yf.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>qc(e,t,r,o)});function ay(e){return om(sy,e)}var cy=g("ZodAny",(e,n)=>{eh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Jc(e,t,r,o)});function JS(){return im(cy)}var ly=g("ZodUnknown",(e,n)=>{th.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Zc(e,t,r,o)});function mt(){return sm(ly)}var uy=g("ZodNever",(e,n)=>{nh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Uc(e,t,r,o)});function yt(e){return am(uy,e)}var dy=g("ZodVoid",(e,n)=>{rh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Bc(e,t,r,o)});function ZS(e){return cm(dy,e)}var py=g("ZodDate",(e,n)=>{oh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Kc(e,t,r,o),e.min=(t,r)=>e.check(ht(t,r)),e.max=(t,r)=>e.check(ft(t,r))},Go({minDate:(e)=>{let{minimum:n}=Le(e);return n?new Date(n):null},maxDate:(e)=>{let{maximum:n}=Le(e);return n?new Date(n):null}},{}));function KS(e){return lm(py,e)}var fy=g("ZodArray",(e,n)=>{mn(),ih.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>il(e,t,r,o),e.element=n.element},{min(e,n){return this.check(hn(e,n))},nonempty(e){return this.check(hn(1,e))},max(e,n){return this.check(Rr(e,n))},length(e,n){return this.check(_r(e,n))},unwrap(){return this.element}});function A(e,n){return ym(fy,e,n)}function WS(e){let n=e._zod.def.shape;return U(Object.keys(n))}var Vi=g("ZodObject",(e,n)=>{mn(),ch.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>sl(e,t,r,o),Dv(e,"shape",(t)=>t._zod.def.shape,!1)},{keyof(){return U(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(nt(this._zod.def,{catchall:e}))},passthrough(){return this.clone(nt(this._zod.def,{catchall:mt()}))},loose(){return this.clone(nt(this._zod.def,{catchall:mt()}))},strict(){return this.clone(nt(this._zod.def,{catchall:yt()}))},strip(){return this.clone(nt(this._zod.def,{catchall:void 0}))},extend(e){return Av(this,e)},safeExtend(e){return Tv(this,e)},merge(e){return Ov(this,e)},pick(e){return Pv(this,e)},omit(e){return Ev(this,e)},partial(...e){return up(Ui,this,e[0])},exactPartial(...e){return up(Jl,this,e[0],"exactPartial")},required(...e){return Nv(Zl,this,e[0])}});function E(e,n){let t={type:"object",shape:e??{},...T(n)};return new Vi(t)}function w(e,n){return new Vi({type:"object",shape:e,catchall:yt(),...T(n)})}function HS(e,n){return new Vi({type:"object",shape:e,catchall:mt(),...T(n)})}var Bi=g("ZodUnion",(e,n)=>{di.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>$i(e,t,r,o),e.options=n.options});function te(e,n){return new Bi({type:"union",options:e,...T(n)})}var hy=g("ZodXor",(e,n)=>{Bi.init(e,n),lh.init(e,n),e._zod.processJSONSchema=(t,r,o)=>$i(e,t,r,o),e.options=n.options});function GS(e,n){return new hy({type:"union",options:e,inclusive:!1,...T(n)})}var my=g("ZodDiscriminatedUnion",(e,n)=>{Bi.init(e,n),uh.init(e,n)});function gt(e,n,t){return new my({type:"union",options:n,discriminator:e,...T(t)})}var yy=g("ZodIntersection",(e,n)=>{dh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>al(e,t,r,o)});function gy(e,n){return new yy({type:"intersection",left:e,right:n})}var by=g("ZodTuple",(e,n)=>{mn(),sc.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>cl(e,t,r,o)},{rest(e){return this.clone({...this._zod.def,rest:e})},partial(){let e=this._zod.def;if(e.checks?.length)throw Error(".partial() cannot be used on tuple schemas containing refinements");return this.clone({...e,items:e.items.map((n)=>new Ui({type:"optional",innerType:n}))})}});function xy(e,n,t){let r=n instanceof H,o=r?t:n;return new by({type:"tuple",items:e,rest:r?n:null,...T(o)})}var Vr=g("ZodRecord",(e,n)=>{mn(),ph.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ll(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType});function re(e,n,t){if(!n||!n._zod)return new Vr({type:"record",keyType:k(),valueType:e,...T(n)});return new Vr({type:"record",keyType:e,valueType:n,...T(t)})}function QS(e,n,t){return new Vr({type:"record",keyType:e,valueType:n,...T(t),partial:!0})}function XS(e,n,t){return new Vr({type:"record",keyType:e,valueType:n,mode:"loose",...T(t)})}var wy=g("ZodMap",(e,n)=>{mn(),fh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>rl(e,t,r,o),e.keyType=n.keyType,e.valueType=n.valueType,e.min=(...t)=>e.check(Jt(...t)),e.nonempty=(t)=>e.check(Jt(1,t)),e.max=(...t)=>e.check(Nn(...t)),e.size=(...t)=>e.check(jr(...t))});function YS(e,n,t){return new wy({type:"map",keyType:e,valueType:n,...T(t)})}var vy=g("ZodSet",(e,n)=>{mn(),hh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ol(e,t,r,o),e.min=(...t)=>e.check(Jt(...t)),e.nonempty=(t)=>e.check(Jt(1,t)),e.max=(...t)=>e.check(Nn(...t)),e.size=(...t)=>e.check(jr(...t))});function eI(e,n){return new vy({type:"set",valueType:e,...T(n)})}var Br=g("ZodEnum",(e,n)=>{mh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(r,o,i)=>Wc(e,r,o,i),e.enum=n.entries,e.options=[...e._zod.values];let t=new Set(Object.keys(n.entries));e.extract=(r,o)=>{let i={};for(let s of r)if(t.has(s))i[s]=n.entries[s];else throw Error(`Key ${s} not found in enum`);return new Br({...n,checks:[],...T(o),entries:i})},e.exclude=(r,o)=>{let i={...n.entries};for(let s of r)if(t.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Br({...n,checks:[],...T(o),entries:i})}});function U(e,n){let t=Array.isArray(e)?Object.fromEntries(e.map((r)=>[r,r])):e;return new Br({type:"enum",entries:t,...T(n)})}function tI(e,n){return new Br({type:"enum",entries:e,...T(n)})}var ky=g("ZodLiteral",(e,n)=>{yh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Hc(e,t,r,o),e.values=new Set(n.values),Object.defineProperty(e,"value",{get(){if(n.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return n.values[0]}})});function b(e,n){return new ky({type:"literal",values:Array.isArray(e)?e:[e],...T(n)})}var Sy=g("ZodFile",(e,n)=>{gh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Xc(e,t,r,o),e.min=(t,r)=>e.check(Jt(t,r)),e.max=(t,r)=>e.check(Nn(t,r)),e.mime=(t,r)=>e.check(Ti(Array.isArray(t)?t:[t],r))});function nI(e){return gm(Sy,e)}var Iy=g("ZodTransform",(e,n)=>{mn(),bh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>nl(e,t,r,o),e._zod.parse=(t,r)=>{if(r.direction==="backward")throw new An(e.constructor.name);t.addIssue=(i)=>{if(typeof i==="string")t.issues.push(dn(i,t.value,n));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=t.value;s.inst??(s.inst=e),t.issues.push(dn(s))}};let o=n.transform(t.value,t);if(o instanceof Promise)return o.then((i)=>(t.value=i,t));return t.value=o,t}});function Ul(e){return new Iy({type:"transform",transform:e})}var Ui=g("ZodOptional",(e,n)=>{ac.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Di(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function zi(e){return new Ui({type:"optional",innerType:e})}var Jl=g("ZodExactOptional",(e,n)=>{xh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Di(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Cy(e){return new Jl({type:"optional",innerType:e})}var Py=g("ZodNullable",(e,n)=>{wh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ul(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Fi(e){return new Py({type:"nullable",innerType:e})}function rI(e){return zi(Fi(e))}var Ey=g("ZodDefault",(e,n)=>{vh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>fl(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ay(e,n){return new Ey({type:"default",innerType:e,get defaultValue(){return typeof n==="function"?n():na(n)}})}var Ty=g("ZodPrefault",(e,n)=>{kh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>hl(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Oy(e,n){return new Ty({type:"prefault",innerType:e,get defaultValue(){return typeof n==="function"?n():na(n)}})}var Zl=g("ZodNonOptional",(e,n)=>{Sh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>dl(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Ny(e,n){return new Zl({type:"nonoptional",innerType:e,...T(n)})}var jy=g("ZodSuccess",(e,n)=>{Ih.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Yc(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function oI(e){return new jy({type:"success",innerType:e})}var Ry=g("ZodCatch",(e,n)=>{Ch.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>ml(e,t,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function _y(e,n){return new Ry({type:"catch",innerType:e,catchValue:typeof n==="function"?n:hp(n)})}var $y=g("ZodNaN",(e,n)=>{Ph.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Gc(e,t,r,o)});function iI(e){return um($y,e)}var Ji=g("ZodPipe",(e,n)=>{cc.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>yl(e,t,r,o),e.in=n.in,e.out=n.out});function wl(e,n){return new Ji({type:"pipe",in:e,out:n})}var Zi=g("ZodCodec",(e,n)=>{Ji.init(e,n),pi.init(e,n)});function sI(e,n,t){return new Zi({type:"pipe",in:e,out:n,transform:t.decode,reverseTransform:t.encode})}function aI(e){let n=e._zod.def;return new Zi({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var Dy=g("ZodPreprocess",(e,n)=>{Ji.init(e,n),Eh.init(e,n)}),Ly=g("ZodReadonly",(e,n)=>{Ah.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>gl(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function My(e){return new Ly({type:"readonly",innerType:e})}var zy=g("ZodTemplateLiteral",(e,n)=>{Th.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qc(e,t,r,o)});function cI(e,n){return new zy({type:"template_literal",parts:e,...T(n)})}var Fy=g("ZodLazy",(e,n)=>{jh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>xl(e,t,r,o),e.unwrap=()=>e._zod.def.getter()});function Kl(e){return new Fy({type:"lazy",getter:e})}var qy=g("ZodPromise",(e,n)=>{Nh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>bl(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function lI(e){return new qy({type:"promise",innerType:e})}var Vy=g("ZodFunction",(e,n)=>{Oh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>tl(e,t,r,o)});function uI(e){return new Vy({type:"function",input:Array.isArray(e?.input)?xy(e?.input):e?.input??A(mt()),output:e?.output??mt()})}var Ki=g("ZodCustom",(e,n)=>{Rh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>el(e,t,r,o)});function dI(e){let n=new we({check:"custom"});return n._zod.check=e,n}function pI(e,n){return bm(Ki,e??(()=>!0),n)}function By(e,n={}){return xm(Ki,e,n)}function Uy(e,n){return wm(e,n)}var fI=vm,hI=km,Jy=g("ZodInstanceOf",(e,n)=>{Ki.init(e,n)},{properties(e,n){return this.check(Ai(e,n))}});function mI(e,n={}){let t=new Jy({type:"custom",check:"custom",fn:(r)=>r instanceof e,abort:!0,...T(n)});return t._zod.bag.Class=e,t._zod.check=(r)=>{if(!(r.value instanceof e))r.issues.push({code:"invalid_type",expected:e.name,input:r.value,inst:t,path:[...t._zod.def.path??[]]})},t}var yI=(...e)=>Sm({Codec:Zi,Boolean:ql,String:kl},...e);function De(e){let n=Kl(()=>te([k(e),M(),me(),ay(),A(n),re(k(),n)]));return n}function Zy(e,n){return new Dy({type:"pipe",in:Ul(e),out:n})}function gI(e){return bi(Dn,e)}function bI(e){return xi(Ln,e)}function xI(e){return wi(Mn,e)}function wI(e){return vi(zn,e)}var D={...Wl,...Li,iso:Ur},vI=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function kI(e,n){let t=e.$schema;if(t==="https://json-schema.org/draft/2020-12/schema")return"draft-2020-12";if(t==="http://json-schema.org/draft-07/schema#")return"draft-7";if(t==="http://json-schema.org/draft-04/schema#")return"draft-4";return n??"draft-2020-12"}function Ky(e,n){return e.map((t,r)=>r<n?t:t.optional())}function SI(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function II(e,n){if(!e.startsWith("#"))throw Error("External $ref is not supported, only local refs (#/...) are allowed");let t=e.slice(1).split("/").filter(Boolean);if(t.length===0)return n.rootSchema;let r=n.version==="draft-2020-12"?"$defs":"definitions";if(t[0]===r){let o=t[1]===void 0?void 0:SI(t[1]);if(!o||!n.defs[o])throw Error(`Reference not found: ${e}`);return n.defs[o]}throw Error(`Reference not found: ${e}`)}function CI(e,n){return D.transform((r)=>r).check((r)=>{let o=r.value;if(typeof o!=="object"||o===null||Array.isArray(o))return;let i=Object.getOwnPropertyNames(o);if(n.minProperties!==void 0&&i.length<n.minProperties)r.issues.push({origin:"object",code:"too_small",minimum:n.minProperties,inclusive:!0,message:`Too small: expected object to have >=${n.minProperties} properties`,input:o,inst:e,continue:!0});if(n.maxProperties!==void 0&&i.length>n.maxProperties)r.issues.push({origin:"object",code:"too_big",maximum:n.maxProperties,inclusive:!0,message:`Too big: expected object to have <=${n.maxProperties} properties`,input:o,inst:e,continue:!0});if(n.keySchema)for(let s of i){let a=n.keySchema.safeParse(s);if(a.success)continue;r.issues.push({code:"invalid_key",origin:"record",issues:a.error.issues,input:s,path:[s],continue:!0})}}).pipe(e)}function Hl(e,n){if(e===null)return"z";let t=typeof e;if(t!=="object"){if(t==="number"&&Number.isNaN(e))return null;let r=String(e);return`${t[0]}${r.length}:${r}`}if(n.has(e))return null;n.add(e);try{if(Array.isArray(e)){let i=[];for(let s of e){let a=Hl(s,n);if(a===null)return null;i.push(a)}return`a${i.length}:[${i.join(",")}]`}let r=Object.keys(e).sort(),o=[];for(let i of r){let s=Hl(e[i],n);if(s===null)return null;o.push(`${i.length}:${i}=${s}`)}return`o${o.length}:{${o.join(",")}}`}finally{n.delete(e)}}var PI=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),EI=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Jr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(Jr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([n,t])=>{if(PI.has(n))return Jr(t);if(!EI.has(n)||typeof t!=="object"||t===null)return!1;return Object.values(t).some(Jr)})}function Wy(e){return e===1?"element":"elements"}function AI(e,n){return D.transform((r)=>r).check((r)=>{let o=r.value;if(!Array.isArray(o))return;if(n.uniqueItems===!0){let i=new Map;for(let s=0;s<o.length;s++){let a=Hl(o[s],new Set);if(a===null)continue;let c=i.get(a);if(c===void 0){i.set(a,s);continue}r.issues.push({code:"custom",message:`Array items must be unique: element at index ${s} duplicates the one at index ${c}`,input:o,path:[s],continue:!0})}}if(n.containsSchema){let i=n.minContains??1,s=n.maxContains!==void 0?n.maxContains+1:Number.POSITIVE_INFINITY,a=0;for(let c of o)if(n.containsSchema.safeParse(c).success&&++a>=s)break;if(a<i)r.issues.push({code:"custom",message:`Array must contain at least ${i} matching ${Wy(i)}; found ${a}`,input:o,continue:!0});if(n.maxContains!==void 0&&a>n.maxContains)r.issues.push({code:"custom",message:`Array must contain at most ${n.maxContains} matching ${Wy(n.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Hy(e,n){if(e===!1)return;if(e===void 0||e===!0)return D.any();return Je(e,n)}var TI=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Gy(e,n){if(e.not!==void 0){if(typeof e.not==="object"&&Object.keys(e.not).length===0)return D.never();throw Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let o=e.$ref;if(n.refs.has(o))return n.refs.get(o);if(n.processing.has(o))return D.lazy(()=>{if(!n.refs.has(o))throw Error(`Circular reference not resolved: ${o}`);return n.refs.get(o)});n.processing.add(o);let i=II(o,n),s=Je(i,n);return n.refs.set(o,s),n.processing.delete(o),s}if(e.enum!==void 0){let o=e.enum;if(n.version==="openapi-3.0"&&e.nullable===!0&&o.length===1&&o[0]===null)return D.null();if(o.length===0)return D.never();if(o.length===1)return D.literal(o[0]);if(o.every((s)=>typeof s==="string"))return D.enum(o);let i=o.map((s)=>D.literal(s));if(i.length<2)return i[0];return D.union([i[0],i[1],...i.slice(2)])}if(e.const!==void 0)return D.literal(e.const);let t=e.type;if(Array.isArray(t)){let o=t.map((i)=>{let s={...e,type:i};return Gy(s,n)});if(o.length===0)return D.never();if(o.length===1)return o[0];return D.union(o)}if(!t)return D.any();let r;switch(t){case"string":{let o=D.string();if(e.format){let i=e.format;if(i==="email")o=o.check(D.email());else if(i==="uri"||i==="uri-reference")o=o.check(D.url());else if(i==="uuid"||i==="guid")o=o.check(D.uuid());else if(i==="date-time")o=o.check(D.iso.datetime({offset:!0}));else if(i==="date")o=o.check(D.iso.date());else if(i==="time")o=o.check(D.regex(TI));else if(i==="duration")o=o.check(D.iso.duration());else if(i==="hostname")o=o.check(D.hostname());else if(i==="ipv4")o=o.check(D.ipv4());else if(i==="ipv6")o=o.check(D.ipv6());else if(i==="mac")o=o.check(D.mac());else if(i==="cidr")o=o.check(D.cidrv4());else if(i==="cidr-v6")o=o.check(D.cidrv6());else if(i==="base64")o=o.check(D.base64());else if(i==="base64url")o=o.check(D.base64url());else if(i==="e164")o=o.check(D.e164());else if(i==="credit_card")o=o.check(D.creditCard());else if(i==="iban")o=o.check(D.iban());else if(i==="jwt")o=o.check(D.jwt());else if(i==="emoji")o=o.check(D.emoji());else if(i==="nanoid")o=o.check(D.nanoid());else if(i==="cuid")o=o.check(D.cuid());else if(i==="cuid2")o=o.check(D.cuid2());else if(i==="ulid")o=o.check(D.ulid());else if(i==="xid")o=o.check(D.xid());else if(i==="ksuid")o=o.check(D.ksuid())}if(typeof e.minLength==="number")o=o.min(e.minLength);if(typeof e.maxLength==="number")o=o.max(e.maxLength);if(e.pattern)o=o.regex(new RegExp(e.pattern));r=o;break}case"number":case"integer":{let o=t==="integer"?D.number().int():D.number();if(typeof e.minimum==="number"&&e.exclusiveMinimum!==!0)o=o.min(e.minimum);if(typeof e.maximum==="number"&&e.exclusiveMaximum!==!0)o=o.max(e.maximum);if(typeof e.exclusiveMinimum==="number")o=o.gt(e.exclusiveMinimum);else if(e.exclusiveMinimum===!0&&typeof e.minimum==="number")o=o.gt(e.minimum);if(typeof e.exclusiveMaximum==="number")o=o.lt(e.exclusiveMaximum);else if(e.exclusiveMaximum===!0&&typeof e.maximum==="number")o=o.lt(e.maximum);if(typeof e.multipleOf==="number")o=o.multipleOf(e.multipleOf);r=o;break}case"boolean":{r=D.boolean();break}case"null":{r=D.null();break}case"object":{let o={},i=e.properties||{},s=new Set(e.required||[]),a=typeof e.additionalProperties==="object"?Je(e.additionalProperties,n):void 0;for(let[d,p]of Object.entries(i)){let m=Je(p,n);qe(o,d,s.has(d)?m:m.optional())}if(e.patternProperties){let d=e.patternProperties,p=Object.keys(d),m=[];for(let I of p){let j=Je(d[I],n),L=D.string().regex(new RegExp(I));m.push(D.looseRecord(L,j))}let y=[];if(Object.keys(o).length>0)y.push(D.object(o).passthrough());if(y.push(...m),y.length===0)r=D.object({}).passthrough();else if(y.length===1)r=y[0];else{let I=D.intersection(y[0],y[1]);for(let j=2;j<y.length;j++)I=D.intersection(I,y[j]);r=I}if(e.additionalProperties===!1){let I=Object.keys(o),j=p.map((F)=>new RegExp(F)),L=r;r=r.check((F)=>{if(!jt(F.value))return;let z=[];for(let ge of Object.keys(F.value)){if(I.includes(ge))continue;if(j.some((Se)=>Se.test(ge)))continue;z.push(ge)}if(z.length)F.issues.push({code:"unrecognized_keys",keys:z,input:F.value,inst:L})})}}else{let d=D.object(o);if(e.additionalProperties===!1)r=d.strict();else if(a)r=d.catchall(a);else r=d.passthrough()}let c=e.propertyNames!==void 0&&e.propertyNames!==!0,l=typeof e.minProperties==="number"?e.minProperties:void 0,u=typeof e.maxProperties==="number"?e.maxProperties:void 0;if(c||l!==void 0||u!==void 0){let d;if(c){let p=typeof e.propertyNames==="object"&&e.propertyNames.type===void 0?{type:"string",...e.propertyNames}:e.propertyNames;d=Je(p,n)}r=CI(r,{keySchema:d,minProperties:l,maxProperties:u})}break}case"array":{let{prefixItems:o,items:i}=e;if(o&&Array.isArray(o)){let s=typeof e.minItems==="number"?e.minItems:0,a=o.map((d)=>Je(d,n)),c=Ky(a,s),l=!Array.isArray(i)?Hy(i,n):void 0,u=D.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(D.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(D.maxLength(e.maxItems))}else if(Array.isArray(i)){let s=typeof e.minItems==="number"?e.minItems:0,a=i.map((d)=>Je(d,n)),c=Ky(a,s),l=Hy(e.additionalItems,n),u=D.tuple(c);if(r=l?u.rest(l):u,typeof e.minItems==="number")r=r.check(D.minLength(e.minItems));if(typeof e.maxItems==="number")r=r.check(D.maxLength(e.maxItems))}else if(i!==void 0){let s=Je(i,n),a=D.array(s);if(typeof e.minItems==="number")a=a.min(e.minItems);if(typeof e.maxItems==="number")a=a.max(e.maxItems);r=a}else r=D.array(D.any());if(e.uniqueItems===!0||e.contains!==void 0)r=AI(r,{uniqueItems:e.uniqueItems===!0,containsSchema:e.contains!==void 0?Je(e.contains,n):void 0,minContains:typeof e.minContains==="number"?e.minContains:void 0,maxContains:typeof e.maxContains==="number"?e.maxContains:void 0});break}default:throw Error(`Unsupported type: ${t}`)}return r}function Je(e,n){if(typeof e==="boolean")return e?D.any():D.never();let t=Gy(e,n),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map((l)=>Je(l,n)),c=D.union(a);t=r?D.intersection(t,c):c}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map((l)=>Je(l,n)),c=D.xor(a);t=r?D.intersection(t,c):c}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)t=r?t:D.any();else{let a=r?t:Je(e.allOf[0],n),c=r?0:1;for(let l=c;l<e.allOf.length;l++)a=D.intersection(a,Je(e.allOf[l],n));t=a}if(e.nullable===!0&&n.version==="openapi-3.0")t=D.nullable(t);if(e.readOnly===!0)t=D.readonly(t);if(e.default!==void 0)t=t.default(e.default);let o={},i=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of i)if(a in e)o[a]=e[a];let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)if(a in e)o[a]=e[a];if(e.type==="object"&&e.$ref===void 0){if(e.propertyNames!==void 0&&!Jr(e.propertyNames))o.propertyNames=e.propertyNames;for(let a of["minProperties","maxProperties"])if(e[a]!==void 0)o[a]=e[a]}if(e.type==="array"&&e.$ref===void 0){if(e.contains!==void 0&&!Jr(e.contains))o.contains=e.contains;for(let a of["uniqueItems","minContains","maxContains"])if(e[a]!==void 0)o[a]=e[a]}for(let a of Object.keys(e))if(!vI.has(a))qe(o,a,e[a]);if(Object.keys(o).length>0)n.registry.add(t,o);if(e.description)t=t.describe(e.description);return t}function Qy(e,n){if(typeof e==="boolean")return e?D.any():D.never();let t;try{t=JSON.parse(JSON.stringify(e))}catch{throw Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas")}let r=kI(t,n?.defaultTarget),o=t.$defs||t.definitions||{},i={version:r,defs:o,refs:new Map,processing:new Set,rootSchema:t,registry:n?.registry??Xe};return Je(t,i)}var Xy=Object.prototype.hasOwnProperty;function je(e,n){var t,r;if(e===n)return!0;if(e&&n&&(t=e.constructor)===n.constructor){if(t===Date)return e.getTime()===n.getTime();if(t===RegExp)return e.toString()===n.toString();if(t===Array){if((r=e.length)===n.length)while(r--&&je(e[r],n[r]));return r===-1}if(!t||typeof e==="object"){r=0;for(t in e){if(Xy.call(e,t)&&++r&&!Xy.call(n,t))return!1;if(!(t in n)||!je(e[t],n[t]))return!1}return Object.keys(n).length===r}}return e!==e&&n!==n}var Gl={maxKeys:16,maxBytes:1048576},Ql=k().min(1).refine((e)=>new TextEncoder().encode(e).length<=256),OI=w({scope:U(["draft","live"]),values:b(!1).optional()}),XO=OI.omit({values:!0}),Yy=w({scope:U(["draft","live"]),keys:A(Ql).min(1).max(Gl.maxKeys).refine((e)=>new Set(e).size===e.length,"State keys must be distinct.")}),YO=w({scope:U(["draft","live"]),key:Ql.optional()}),e0=w({scope:U(["draft","live"]),space:k().regex(/^(flow|node:.+)$/)}),t0=w({scope:U(["draft","live"])}),Wi=w({fields:A(k().refine((e)=>e.length>0&&e.split(".").every((n)=>n.length>0),"Use a nonempty dot-separated field path.")).refine((e)=>new Set(e).size===e.length,"Identity fields must be distinct.").default([])}),eg=Wi.extend({kind:b("skip-duplicates")});var Xl=E({version:b(1),scope:U(["draft","live"]),limits:E({maxValueBytes:M().positive(),maxValues:M().int().positive(),maxSpaces:M().int().positive(),maxIdentities:M().positive(),maxRunWrites:M().positive()}),values:A(w({key:k(),size:M().nonnegative(),updatedAt:M()})),spaces:A(E({space:k(),count:M().nonnegative(),pendingCount:M().nonnegative(),reservedCount:M().nonnegative(),updatedAt:M()}))}),tg=Xl.extend({values:w({count:M().int().nonnegative(),updatedAt:M().nullable()})}),ng=E({version:b(1),scope:U(["draft","live"]),values:A(w({key:Ql,value:De()})).min(1).max(Gl.maxKeys)}).refine((e)=>{let n=new TextEncoder;return e.values.reduce((t,r)=>t+(r.value===null?0:n.encode(JSON.stringify(r.value)).byteLength),0)<=Gl.maxBytes},"State values exceed the 1 MiB read limit.");var NI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,jI=[0,31,28,31,30,31,30,31,31,30,31,30,31],RI=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i,_I=/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,$I=/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,DI=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,LI=/^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,MI=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,zI=/^(?:\/(?:[^~/]|~0|~1)*)*$/,FI=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,qI=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,VI=(e)=>{if(e[0]==='"')return!1;let[n,t,...r]=e.split("@");if(!n||!t||r.length!==0||n.length>64||t.length>253)return!1;if(n[0]==="."||n.endsWith(".")||n.includes(".."))return!1;if(!/^[a-z0-9.-]+$/i.test(t)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(n))return!1;return t.split(".").every((o)=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(o))},BI=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,UI=/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,JI=(e)=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e));function Ct(e){return e.test.bind(e)}var rg={date:og,time:ig.bind(void 0,!1),"date-time":WI,duration:JI,uri:QI,"uri-reference":Ct($I),"uri-template":Ct(DI),url:Ct(LI),email:VI,hostname:Ct(_I),ipv4:Ct(BI),ipv6:Ct(UI),regex:YI,uuid:Ct(MI),"json-pointer":Ct(zI),"json-pointer-uri-fragment":Ct(FI),"relative-json-pointer":Ct(qI)};function ZI(e){return e%4===0&&(e%100!==0||e%400===0)}function og(e){let n=e.match(NI);if(!n)return!1;let t=+n[1],r=+n[2],o=+n[3];return r>=1&&r<=12&&o>=1&&o<=(r==2&&ZI(t)?29:jI[r])}function ig(e,n){let t=n.match(RI);if(!t)return!1;let r=+t[1],o=+t[2],i=+t[3],s=!!t[5];return(r<=23&&o<=59&&i<=59||r==23&&o==59&&i==60)&&(!e||s)}var KI=/t|\s/i;function WI(e){let n=e.split(KI);return n.length==2&&og(n[0])&&ig(!0,n[1])}var HI=/\/|:/,GI=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function QI(e){return HI.test(e)&&GI.test(e)}var XI=/[^\\]\\Z/;function YI(e){if(XI.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(n){return!1}}var sg=0;function Zt(){let e=sg;return sg+=1,e}function Bn(e){if(typeof e==="object"&&e!==null&&!Object.isFrozen(e)){for(let n of Object.getOwnPropertyNames(e)){let t=Reflect.get(e,n);Bn(t)}Object.freeze(e)}return e}function Yl(e,n){let t={};for(let r of n)if(r in e)t[r]=e[r];return t}function Hi(e){if(typeof e!=="object"||e===null)return e;else if(Array.isArray(e)){let n=[];for(let[t,r]of e.entries())n[t]=Hi(r);return n}else{let n={};for(let t in e)n[t]=Hi(e[t]);return n}}function Vn(e,n){if(e===n)return!0;if(e===null)return!1;if(typeof e!=="object")return!1;if(typeof e!==typeof n)return!1;if(Array.isArray(e)){if(!Array.isArray(n))return!1;if(e.length!==n.length)return!1;for(let[t,r]of e.entries())if(!Vn(r,n[t]))return!1}else{if(Array.isArray(n))return!1;for(let t in e){if(!(t in n))return!1;if(!Vn(e[t],n[t]))return!1}for(let t in n)if(!(t in e))return!1}return!0}var v=Object.freeze({Equals:0,Containing:1,ContainedBy:2,Rejection:3,Intersection:4}),ee=Kt(v.Equals),G=Kt(v.Containing),X=Kt(v.ContainedBy),oe=Kt(v.Rejection),ue=Kt(v.Intersection),$t=Bn([[v.Equals,ee],[v.Containing,G],[v.ContainedBy,X],[v.Rejection,oe],[v.Intersection,ue]]),ke=0,st=(()=>{let e=ke;for(let[n,t]of $t)e|=t;return e})();function Zr(e){return!!(e&ee)}function Kr(e){return!!(e&G)}function Wr(e){return!!(e&X)}function Hr(e){return!!(e&oe)}function Gr(e){return!!(e&ue)}function Kt(e){return 1<<e}function eu(e){let n=ke,t=0,r={push:(o)=>{if(t===0)n=o;else n=eC(n,o,e);return t+=1,n}};return Object.defineProperties(r,{result:{get:()=>n},count:{get:()=>t}}),r}function eC(e,n,t){let r=ke;for(let[o,i]of $t)if(i&e){for(let[s,a]of $t)if(a&n){if(r|=t(o,s),r===st)return r}}return r}var Pe=Object.freeze({Save:0,OneOf:1,AllOf:2,AnyOf:3,Not:4,Swap:5});function ag(e,n){switch(e){case Pe.Save:return n[0];case Pe.OneOf:return tC(n);case Pe.AllOf:case Pe.AnyOf:return Qr(e,n);case Pe.Not:case Pe.Swap:return tu(e,n[0])}}function Wt(e){return tu(Pe.Swap,e)}function tC(e){if(e.length===1)return e[0];let n=Qr(Pe.AnyOf,e),t=[];for(let i=0;i<e.length;++i)for(let s=i+1;s<e.length;++s){let a=e[i],c=e[s],l=Qr(Pe.AllOf,[a,c]);t.push(l)}let r=Qr(Pe.AnyOf,t),o=tu(Pe.Not,r);return Qr(Pe.AllOf,[n,o])}function Qr(e,n){if(n.length<0)throw Error("invalid expressions: empty array");let t;switch(e){case Pe.AllOf:{t=eu(nC);break}case Pe.AnyOf:{t=eu(rC);break}default:throw Error(`invalid operator ${e}`)}for(let r of n)t.push(r);return t.result}function tu(e,n){let t,r=ke;switch(e){case Pe.Not:{t=oC;break}case Pe.Swap:{t=iC;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of $t)if(i&n)r|=t(o);return r}function nC(e,n){let t=ke;switch(e){case v.Equals:{switch(n){case v.Equals:{t=ee;break}case v.Containing:{t=ee;break}case v.ContainedBy:{t=X;break}case v.Rejection:{t=ke;break}case v.Intersection:{t=X;break}}break}case v.Containing:{switch(n){case v.Equals:{t=ee;break}case v.Containing:{t=ee|G;break}case v.ContainedBy:{t=X;break}case v.Rejection:{t=oe;break}case v.Intersection:{t=ue|X;break}}break}case v.ContainedBy:{switch(n){case v.Equals:{t=X;break}case v.Containing:{t=X;break}case v.ContainedBy:{t=X;break}case v.Rejection:{t=ke;break}case v.Intersection:{t=X;break}}break}case v.Rejection:{switch(n){case v.Equals:{t=ke;break}case v.Containing:{t=oe;break}case v.ContainedBy:{t=ke;break}case v.Rejection:{t=oe;break}case v.Intersection:{t=oe;break}}break}case v.Intersection:{switch(n){case v.Equals:{t=X;break}case v.Containing:{t=ue|X;break}case v.ContainedBy:{t=X;break}case v.Rejection:{t=oe;break}case v.Intersection:{t=X|oe|ue;break}}break}}return t}function rC(e,n){let t=ke;switch(e){case v.Equals:{switch(n){case v.Equals:{t=ee;break}case v.Containing:{t=G;break}case v.ContainedBy:{t=ee;break}case v.Rejection:{t=G;break}case v.Intersection:{t=G;break}}break}case v.Containing:{switch(n){case v.Equals:{t=G;break}case v.Containing:{t=G;break}case v.ContainedBy:{t=G;break}case v.Rejection:{t=G;break}case v.Intersection:{t=G;break}}break}case v.ContainedBy:{switch(n){case v.Equals:{t=ee;break}case v.Containing:{t=G;break}case v.ContainedBy:{t=ee|X;break}case v.Rejection:{t=ue;break}case v.Intersection:{t=G|ue;break}}break}case v.Rejection:{switch(n){case v.Equals:{t=G;break}case v.Containing:{t=G;break}case v.ContainedBy:{t=ue;break}case v.Rejection:{t=oe;break}case v.Intersection:{t=ue;break}}break}case v.Intersection:{switch(n){case v.Equals:{t=G;break}case v.Containing:{t=G;break}case v.ContainedBy:{t=G|ue;break}case v.Rejection:{t=ue;break}case v.Intersection:{t=G|ue;break}}break}}return t}function oC(e){let n=ke;switch(e){case v.Equals:{n=oe;break}case v.Containing:{n=oe;break}case v.ContainedBy:{n=ue;break}case v.Rejection:{n=ee|G;break}case v.Intersection:{n=X|ue;break}}return n}function iC(e){let n=ke;switch(e){case v.Equals:{n=ee;break}case v.Containing:{n=X;break}case v.ContainedBy:{n=G;break}case v.Rejection:{n=oe;break}case v.Intersection:{n=ue;break}}return n}var Ye=Object.freeze({Leaf:0,Not:1,AllOf:2,AnyOf:3,OneOf:4});var nu=(e)=>(n,t)=>{let r={parent:null,swapped:!1,expressions:null,calculation:{operator:Pe.Save,results:[ke],willSwap:!1,count:0}},o=[{parent:{node:r,index:0},swapped:!1,expressions:[n,t],calculation:null}],i=[];while(o.length>0||i.length>0){while(o.length>0){let u=o.pop();s(u)}while(i.length>0){let u=i.pop();c(u)}}function s(u){let d=ee,[p,m]=u.expressions;if(!e.equals(p,m)){let y=e.describe(p);if(y.kind!==Ye.Leaf){let[L,F]=a(y,!1);u.expressions=null,u.calculation=L;for(let[z,ge]of F.entries())o.push({parent:{node:u,index:z},swapped:u.swapped,expressions:[ge,m],calculation:null});return}let I=e.describe(m);if(I.kind!==Ye.Leaf){let[L,F]=a(I,!0);u.expressions=null,u.calculation=L;for(let[z,ge]of F.entries())o.push({parent:{node:u,index:z},swapped:!u.swapped,expressions:[ge,p],calculation:null});return}if(d=e.calculate(p,m),e.observeCalculation?.(p,m,d,u.swapped),d===ke)throw Error("cannot response expression as none")}u.expressions=null,u.calculation={operator:Pe.Save,results:[d],willSwap:!1,count:0},i.push(u)}function a(u,d){let p=Pe.Save,m;switch(u.kind){case Ye.Not:{p=Pe.Not,m=[u.expression];break}case Ye.AllOf:{p=Pe.AllOf,m=[...u.expressions];break}case Ye.AnyOf:{p=Pe.AnyOf,m=[...u.expressions];break}case Ye.OneOf:{p=Pe.OneOf,m=[...u.expressions];break}default:throw Error(`invalid kind ${u.kind}`)}return[{operator:p,willSwap:d,count:0,results:Array(m.length).fill(-1)},m]}function c(u){let{calculation:d,parent:p}=u,m=ag(d.operator,d.results);if(m===ke)m=X;if(d.willSwap)m=Wt(m);if(p){let y=p.node.calculation,I=y.results;if(I[p.index]=m,y.count+=1,y.count>=I.length)i.push(p.node)}}let l=r.calculation.results[0];if(l===0)throw Error("cannot find result of root");return l};class Gi extends Error{constructor(e=[]){super(sC(e));this.name="SchemaError",this.items=e}}var Un=Object.freeze({Compiled:0,External:1});function Jn(e){switch(e.kind){case Un.Compiled:{let{message:n,path:t}=e;return`${n} (at ${t.length>0?t.join("."):"$root"})`}case Un.External:return String(e.error)}}function sC(e){switch(e.length){case 0:return"without any items";case 1:return Jn(e[0]);default:return`${Jn(e[0])} ... omit the rest ${e.length-1} items`}}var aC=new Set(["type","enum","const","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","items","additionalItems","maxItems","minItems","uniqueItems","contains","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames","if","then","else","allOf","anyOf","oneOf","not","format","contentMediaType","contentEncoding","definitions"]);function Pt(e){return aC.has(e)}function cg(e){for(let n in e)if(Pt(n))return!1;return!0}function Ze(e,...n){return{...e,path:[...e.path,...n]}}function et(e){if(typeof e==="boolean")throw Error("JSONSchema7Definition cannot be boolean");return e}function Ht({path:e,errors:n},t,...r){n.push(lg(e,r,t))}function de({path:e,warns:n},t,...r){n.push(lg(e,r,t))}function lg(e,n,t){return{kind:Un.Compiled,message:t,path:[...e,...n]}}function Qi(e){for(let n in e){let t=e[n];if(t===void 0)delete e[n];else if(t&&typeof t==="object"){if(Array.isArray(t)){if(t.length===0)delete e[n]}else if(cC(t))delete e[n]}}return e}function cC(e){for(let n in e)return!1;return!0}var Xr=Symbol("compiledId"),ru=Symbol("compiledKind"),ou=Symbol("compiledPath"),ug=Symbol("validatorLoader"),C=Object.freeze({Extends:0,Never:1,Any:2,Null:3,String:4,Numeric:5,Boolean:6,Object:7,Array:8,Not:9,Combination:10,EnumOrConst:11}),Gt=Bn(Xi(C.Any,Zt(),{},()=>()=>!0)),Yr=Bn(Xi(C.Never,Zt(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function eo(e){if(e===null||typeof e!=="object")return!1;return Xr in e}function tt(e){if(e===null||typeof e!=="object")return!1;return Xr in e&&ru in e}function ce(e){if(tt(e))return e[ru];else return C.Extends}function yn(e){if(tt(e)||eo(e))return e[Xr];else return e.id}function iu(e){return tt(e)?e[ou]:void 0}function su(e){if(e===null||typeof e!=="object")return e;return Object.defineProperty(e,Xr,{value:Zt(),configurable:!1,writable:!1,enumerable:!1}),e}function Ae(e,n,t,r=[]){return Xi(e,Zt(),n,t&&(()=>t.compile(n)),r)}function to(e){return Xi(C.Never,Zt(),{...e},e[ug],e[ou])}function Xi(e,n,t,r,o=[]){let i=null;return Object.defineProperties(t,{[ru]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Xr]:{value:n,configurable:!1,writable:!1,enumerable:!1},[ou]:{value:o,configurable:!1,writable:!1,enumerable:!1},[ug]:{value:r,configurable:!1,writable:!1,enumerable:!1},isValid:{configurable:!1,enumerable:!1,get:()=>{if(r){if(!i)i=r();return i}else return}}}),t}function fg(e,n){let t=lC(e,n),r=dg(e,"maxItems",n),o=dg(e,"minItems",n),i=uC(e,n),s=n.uniqueItems,a;if(Array.isArray(t))a=dC(e,n);else if(n.additionalItems)de(e,"it is needless when items is not array","additionalItems");if(!t||!i||a===null)return null;let c=!1,l=!1;if(Array.isArray(t)){if(r!==void 0&&r<=t.length)t=t.splice(r),a=pg(a,e.delegate);let p=t.findIndex((m)=>ce(m)===C.Never);if(p!==-1){if(t=t.splice(p),a=pg(a,e.delegate),r===void 0)r=t.length,l=!0}if(o!==void 0&&t.length<o)de(e,`length(${t.length}) of items if less than minItems(${o})`),c=!0;if(t.length===0&&a&&ce(a)===C.Never)c=!0}else if(ce(t)===C.Never)c=!0;if(r!==void 0&&o!==void 0&&r<o){if(!l)de(e,`maxItems(${r}) is less than minItems(${o})`);c=!0}let u=c?C.Never:C.Array,d=Qi({type:"array",items:t,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return Ae(u,d,e.delegate,e.path)}function lC(e,{items:n}){if(!n)return Ae(C.Any,{},e.delegate,e.path);if(Array.isArray(n)){let t=[],r=!1;for(let[o,i]of n.entries()){let s=Ze(e,"items",o),a=Ke(s,et(i));if(!a){r=!0;continue}t.push(a)}if(r)return null;return t}else{let t=Ze(e,"items"),r=et(n);return Ke(t,r)}}function dg(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){de(e,"find NaN",n);return}if(r<0){de(e,`find invalid number ${r}`,n);return}return r}function uC(e,{contains:n}){if(!n)return Ae(C.Any,{},e.delegate,e.path);let t=Ze(e,"contains"),r=et(n);return Ke(t,r)}function dC(e,{additionalItems:n}){switch(typeof n){case"boolean":if(n)return Ae(C.Any,{},e.delegate,e.path);else return!1;case"object":{let t=Ze(e,"additionalItems");return Ke(t,n)}default:return Ae(C.Any,{},e.delegate,e.path)}}function pg(e,n){if(e===void 0)return Ae(C.Never,{type:"string",maxLength:0,minLength:1},n);else if(tt(e))return ce(e)===C.Never?e:to(e);else return e}var hg=Object.freeze(["allOf","anyOf","oneOf"]);function au(e,n,t,r){if(t.length===0)return Ht(e,"disable empty list",n),null;let o=[];for(let[c,l]of t.entries()){let u=Ze(e,n,c),d=et(l),p=Ke(u,d);if(p)o.push(p)}if(o.length<t.length)return null;let i=0,s=0;for(let c of o)switch(ce(c)){case C.Any:{i+=1;break}case C.Never:{s+=1;break}}let a=C.Combination;switch(n){case"allOf":{if(s>0)a=C.Never;else if(i===o.length)a=C.Any;else if(!pC(o))a=C.Never;break}case"anyOf":{if(i>0)a=C.Any;else if(s===o.length)a=C.Never;break}case"oneOf":{if(i>1)a=C.Never;else if(s===o.length)a=C.Never;else if(i===1&&s===o.length-1)a=C.Any;break}}return Ae(a,{[n]:o},r,e.path)}function pC(e){let n=null;for(let t of e){let r=ce(t);switch(r){case C.Any:case C.Never:break;default:{if(n===null)n=r;else if(n!==r)return!1;break}}}return!0}var Be=Object.freeze({Valid:0,Invalid:1,Unknown:2});function Et(e,n){let t=e.isValid;if(t)if(t(n)===!0)return Be.Valid;else return Be.Invalid;else return Be.Unknown}function mg(e,n,t,r){let o,i=!1;if(n){if(n.length===0)return Ht(e,"disable empty list","enum"),null;o=[];for(let[c,l]of n.entries())switch(Et(r,l)){case Be.Valid:{o.push(su(l));break}case Be.Invalid:{de(e,"cannot pass JSON schema of currently schema object","enum",c);break}}if(o.length===0)de(e,"all of elements from list is rejected by currently schema object","enum")}if(t!==void 0&&Et(r,t)===Be.Invalid)i=!0;if(o){if(o.length===0)i=!0;else if(t!==void 0){let c=!1;for(let l of o)if(Vn(l,t)){c=!0;break}if(!c)i=!0}}let s=i?C.Never:C.EnumOrConst,a={};if(r.type)a.type=r.type;if(o)a.enum=o;if(t!==void 0)a.const=su(Hi(t));return Ae(s,a,e.delegate,e.path)}var fC=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function gg(e,n){let t=Object.keys(n).filter((y)=>!fC.has(y)&&Pt(y));if(t.length>0)de(e,`type="object" will exclude other keys: ${t.toSorted().join(", ")}`);let r=yg(e,"maxProperties",n),o=yg(e,"minProperties",n),i=hC(e,n),s=mC(e,n),a=yC(e,n),c=bC(e,n);if(!i||!s||!a||!c)return null;let l=gC(e,s,a,n);if(!l)return null;let u=xC(i,s,a,l),d=wC(e,u,c,n),p=vC(e,i,l,d,r,o)?C.Never:C.Object,m=Qi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:IC(s),dependencies:CC(c,n),propertyNames:a});return Ae(p,m,e.delegate,e.path)}function yg(e,n,t){let r=t[n];if(r===void 0)return;if(Number.isNaN(r)){de(e,"find NaN",n);return}if(r<0){de(e,`find invalid number ${r}`,n);return}return r}function hC(e,{additionalProperties:n}){if(n===!1)return Ae(C.Never,{type:"string",maxLength:0,minLength:1},e.delegate,e.path);if(typeof n!=="object")return Ae(C.Any,{},e.delegate,e.path);let t=Ze(e,"additionalProperties"),r=et(n);return Ke(t,r)}function mC(e,{patternProperties:n}){let t=!1,r={};for(let o in n){let i=SC(o);if(i instanceof Error){de(e,`property name invalid. ${o}`,"patternProperties",o);continue}let s=et(n[o]),a=Ze(e,"patternProperties",o),c=Ke(a,s);if(!c){t=!0;continue}r[o]=[c,i]}if(t)return null;return r}function yC(e,{propertyNames:n}){if(!n)return Ae(C.Any,{},e.delegate,e.path);n=et(n);let t=Ze(e,"propertyNames"),r=Ke(t,n);if(!r)return null;let o=ce(r);if(o!==C.String&&o!==C.Any)return to(r);return r}function gC(e,n,t,{properties:r}){let o=!1;if(!r)return{};let i={};for(let s in r){if(Et(t,s)===Be.Invalid){de(e,`key ${JSON.stringify(s)} cannot pass JSON schema from propertyNames`,"properties");continue}let a=xg(n,s);if(a&&ce(a)===C.Never){de(e,`key ${JSON.stringify(s)} matches a pattern that has a impossible(never) schema`,"properties");continue}let c=et(r[s]),l=Ze(e,"properties",s),u=Ke(l,c);if(!u){o=!0;continue}i[s]=u}if(o)return null;return i}function bC(e,{dependencies:n}){if(!n)return[{},{}];let t={},r={};for(let o in n){let i=et(n[o]);if(Array.isArray(i)){let{keys:s,duplicated:a}=bg(i);if(a)de(e,`found duplicated property names: ${a.join(", ")}`,"dependencies",o);t[o]=s}else{let s=Ze(e,"dependencies",o),a=Ke(s,i);if(a){let c=ce(a);if(c===C.Object||c===C.Any)r[o]=a;else if(c===C.Extends)r[o]=Yr;else r[o]=to(a)}}}return[t,r]}function xC(e,n,t,r){return(o)=>{if(Et(t,o)===Be.Invalid)return!0;let i=xg(n,o);if(i&&ce(i)===C.Never)return!0;let s=r[o]??e;if(ce(s)===C.Never)return!0;return!1}}function wC(e,n,t,{required:r}){if(!r)return[];let o=bg(r);if(o.duplicated)de(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(kC(t,a).some((l)=>n(l)))s.push(a);else i.push(a);if(s.length>0)de(e,`key ${s.map((a)=>JSON.stringify(a)).join(", ")} will ban by another condition`,"required");return i}function vC(e,n,t,r,o,i){if(o!==void 0&&i!==void 0&&o<i)return de(e,`maxProperties(${o}) is less than minProperties(${i})`),!0;if(o!==void 0&&r.length>o)return de(e,`length(${r.length}) of required is greater than maxProperties(${o})`),!0;if(i!==void 0&&r.length<i)return de(e,`length(${r.length}) of required is less than minProperties(${i})`),!0;if(ce(n)!==C.Never)return!1;for(let s in t){let a=t[s];if(ce(a)!==C.Never)return!1}return!0}function kC([e,n],t){let r=[t],o=new Set(r);while(r.length>0){let s=r.pop(),a=n[s],c=e[s];if(a){if(ce(a)===C.Object)i(a.required)}if(c)i(c)}function i(s){if(s){for(let a of s)if(!o.has(a))o.add(a),r.push(a)}}return[...o]}function bg(e){let n=new Set,t=new Set;for(let r of e)if(n.has(r))t.add(r);else n.add(r);if(t.size===0)return{keys:[...e],duplicated:null};else return{keys:[...n],duplicated:[...t]}}function xg(e,n){for(let t in e){let[r,o]=e[t];if(o.test(n))return r}return null}function SC(e){try{return new RegExp(e,"i")}catch(n){if(n instanceof SyntaxError)return n;else throw n}}function IC(e){let n={};for(let t in e)n[t]=e[t][0];return n}function CC([e,n],{dependencies:t}){let r={};for(let o in t){let i=e[o],s=n[o];r[o]=i||s}return r}var cu=new Set(["type","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum"]),wg=new Set(["type","format","maxLength","minLength","pattern"]);function kg(e,n){let{type:t}=n;switch(t){case"number":case"integer":return PC(e,n);case"string":return AC(e,n);case"boolean":case"null":{let r=Object.keys(n).filter((s)=>Pt(s)&&s!=="type");if(r.length>0)de(e,`key "type" will exclude other keys: ${r.toSorted().join(", ")}`);let o=t==="null"?C.Null:C.Boolean;return Ae(o,{type:t},e.delegate,e.path)}default:return Ht(e,`invalid type ${JSON.stringify(t)}`),null}}function PC(e,n){let t=Object.keys(n).filter((u)=>!cu.has(u)&&Pt(u));if(t.length>0)de(e,`type=${JSON.stringify(n.type)} will exclude other keys: ${t.toSorted().join(", ")}`);let r=Yl(n,cu);for(let u of cu){let d=r[u];if(u!=="type"&&d!==void 0&&Number.isNaN(d))de(e,"found NaN",u),delete r[u]}let{maximum:o,exclusiveMaximum:i,minimum:s,exclusiveMinimum:a}=r;if(o!==void 0&&i!==void 0){if(o===i)delete r.maximum;else if(o<i)delete r.exclusiveMaximum;else if(o>i)delete r.maximum}if(s!==void 0&&a!==void 0){if(s===a)delete r.minimum;else if(s<a)delete r.exclusiveMinimum;else if(s>a)delete r.minimum}let{multipleOf:c}=r;if(c===0)delete r.multipleOf,r.type="number",de(e,"cannot be 0","multipleOf");let l=C.Numeric;if(!EC(r))l=C.Never;return Ae(l,r,e.delegate,e.path)}function EC(e){let{maximum:n,exclusiveMaximum:t,minimum:r,exclusiveMinimum:o}=e;if(n!==void 0&&r!==void 0)return n>=r;else if(t!==void 0&&r!==void 0)return t>r;else if(n!==void 0&&o!==void 0)return n>o;else if(t!==void 0&&o!==void 0)return t>o;else return!0}function AC(e,n){let t=Object.keys(n).filter((a)=>!wg.has(a)&&Pt(a));if(t.length>0)de(e,`type="string" will exclude other keys: ${t.toSorted().join(", ")}`);let r=Yl(n,wg);vg(e,r,"maxLength"),vg(e,r,"minLength");let{maxLength:o,minLength:i}=r,s=C.String;if(o!==void 0){if(o<0)s=C.Never;else if(o!==void 0&&i!==void 0&&o<i)s=C.Never}return Ae(s,r,e.delegate,e.path)}function vg(e,n,t){let r=n[t];if(r!==void 0){if(Number.isNaN(r))de(e,"found NaN",t),delete n[t]}}var Sg=Object.freeze([]);function Yi(e,n,t,r){if(tt(e))return{schema:e,warns:Sg};if(n.isExtendsSchema(e))return{schema:e,warns:Sg};if(r){let s=r.isSchema(e);if(typeof s==="object"){let a=[];for(let c of s)a.push({kind:Un.External,error:c});if(a.length>0)return a}else if(s===!1)throw Error("it is not a JSON Schema 7")}let o={delegate:r,payload:t,extends:n,path:[],errors:[],warns:[]},i=Ke(o,e);if(i)Ig(o.errors.length===0,"found errors (it should be empty)");else return Ig(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function Ig(e,n){if(!e)throw Error(n)}function Ke(e,n){if(e.extends.isExtendsSchema(n))return n;if(tt(n))return n;let t=e.extends.tryCompiledExtendsSchema(n,e.payload);if(t)return t;let r=n,o=!1,{enum:i,const:s}=n;if(i||s!==void 0){let{enum:c,const:l,...u}=n;r=u,o=!0}let a=TC(e,r);if(a&&o)a=mg(e,i,s,a);if(!a)return null;return a}function TC(e,n){for(let t of hg){let r=n[t];if(r){let o=Object.keys(n).filter((s)=>Pt(s)&&s!==t);if(o.length>0)de(e,`composition key ${JSON.stringify(t)} will exclude other keys: ${o.toSorted().join(", ")}`);let i=au(e,t,r);if(!i)return null;return i}}{let t=et(n.not);if(t){let r=Object.keys(n).filter((a)=>Pt(a)&&a!=="not");if(r.length>0)de(e,`key "not" will exclude other keys: ${r.toSorted().join(", ")}`);let o=Ze(e,"not"),i=Ke(o,t);if(!i)return null;let s=C.Not;switch(ce(i)){case C.Never:{s=C.Any;break}case C.Any:{s=C.Never;break}}return Ae(s,{not:i},e.delegate,e.path)}}if(n.type){let{type:t}=n;if(Array.isArray(t)){let{type:r,...o}=n;return au(e,"anyOf",t.map((i)=>({...o,type:i})))}switch(t){case"object":return gg(e,n);case"array":return fg(e,n);default:return kg(e,n)}}if(cg(n))return Ae(C.Any,{},e.delegate,e.path);return Ht(e,"unrecognized"),null}class lu{constructor(e){let n=Object.freeze(e.toSorted());if(n.length>32)throw Error(`cannot define ${n.length} keys which is greater than 32`);this.keys=n,this.clazz=class extends Cg{constructor(t){super(n,t)}};for(let[t,r]of this.keys.entries()){let o=1<<t;Object.defineProperty(this.clazz.prototype,r,{enumerable:!0,get:function(){return!!(this.int32&o)},set:function(s){if(s)this.int32|=o;else this.int32&=~o}})}}toBundle(e){let n=0;if(typeof e==="number")n=e;else if(e){for(let[t,r]of this.keys.entries())if(e[r])n|=1<<t}return new this.clazz(n)}}class Cg{constructor(e,n){this.keys=e,this.int32=n}toInt32(){return this.int32}toString(){let e={};for(let n of this.keys)e[n]=this[n];return JSON.stringify(e)}}function es(e){return new Pg(e)}class Pg{constructor(e){this.description=new lu(e)}get keys(){return this.description.keys}variable(e){let n;if(e)n=this.description.toBundle(e).toInt32();return new Eg(this.description,n)}}class Eg{constructor(e,n){this.values=new Set;if(this.description=e,n!==void 0)this.values.add(n)}[Symbol.iterator](){let e=this.values[Symbol.iterator]();return{next:()=>{let n=e.next();if(n.done)return n;else return{done:!1,value:this.description.toBundle(n.value)}}}}assign(e){let{values:n}=e;for(let t of n)this.values.add(t);return this}push(e,n){let t=new Set;for(let r of this.values)for(let[o,i]of $t)if(e&i){let s=this.description.toBundle(r);n(o,s),t.add(s.toInt32())}this.values=t}update(e){let n=new Set;for(let t of this.values){let r=this.description.toBundle(t);e(r),n.add(r.toInt32())}this.values=n}}function Qt(e,n){let[t]=e,[r]=n;if(t.num<r.num)return OC(e,n);else if(t.num>r.num)return NC(e,n);else return jC(e,n)}function OC(e,n){let[t,r]=e,[o,i]=n;if(r.num<=o.num){let s=r.exclusive,a=o.exclusive;if(r.num<o.num||s||a)return{left:{fromLeft:!0,range:e},right:{fromLeft:!1,range:n}}}if(r.num<=i.num){let s=!0,a=!1;if(r.num===i.num){let c=r.exclusive,l=i.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!1,range:[ct(r),i]};return{left:{fromLeft:!0,range:[t,ct(o)]},center:[o,r],right:c}}}return{left:{fromLeft:!0,range:[t,ct(o)]},center:[o,i],right:{fromLeft:!0,range:[ct(i),r]}}}function NC(e,n){let[t,r]=e,[o,i]=n;if(t.num>=i.num){let s=i.exclusive,a=t.exclusive;if(t.num>i.num||s||a)return{left:{fromLeft:!1,range:n},right:{fromLeft:!0,range:e}}}if(i.num<=r.num){let s=!0,a=!1;if(r.num===i.num){let c=i.exclusive,l=r.exclusive;s=c!==l,a=!c&&l}if(!a){let c;if(s)c={fromLeft:!0,range:[ct(i),r]};return{left:{fromLeft:!1,range:[o,ct(t)]},center:[t,i],right:c}}}return{left:{fromLeft:!1,range:[o,ct(t)]},center:[t,r],right:{fromLeft:!1,range:[ct(r),i]}}}function jC(e,n){let[t,r]=e,[o,i]=n,s=t.exclusive,a=o.exclusive,c,l=t;if(!s&&a)l=o,c={fromLeft:!0,range:[t,ct(o)]};else if(s&&!a)c={fromLeft:!1,range:[o,ct(t)]};if(r.num<=i.num){let u=!0,d=!1;if(r.num===i.num){let p=r.exclusive,m=i.exclusive;u=p!==m,d=!p&&m}if(!d){let p;if(u)p={fromLeft:!1,range:[ct(r),i]};return{left:c,center:[l,r],right:p}}}return{left:c,center:[l,i],right:{fromLeft:!0,range:[ct(i),r]}}}function ct(e){return{num:e.num,exclusive:!e.exclusive}}var Zn=(e)=>(n=e,t=Number.POSITIVE_INFINITY,r=e,o=Number.POSITIVE_INFINITY)=>{let{left:i,center:s,right:a}=Qt([{num:n,exclusive:!1},{num:t,exclusive:!1}],[{num:r,exclusive:!1},{num:o,exclusive:!1}]),c,l,u;if(i)c={min:i.range[0].num,max:i.range[1].num,isFrom1:i.fromLeft};if(a)l={min:a.range[0].num,max:a.range[1].num,isFrom1:a.fromLeft};if(s)u={min:s[0].num,max:s[1].num};return{left:c,right:l,intersection:u}};function Kn({left:e,right:n,intersection:t}){if(!t)return v.Rejection;let r=!1,o=!1;if(e)if(e.isFrom1)r=!0;else o=!0;if(n)if(n.isFrom1)r=!0;else o=!0;if(r&&o)return v.Intersection;if(r)return v.Containing;if(o)return v.ContainedBy;return v.Equals}var RC=Zn(0),_C=es(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function Tg({calculate:e},n,t){let r=RC(n.minItems,n.maxItems,t.minItems,t.maxItems),o=Kn(r);if(o===v.Rejection)return oe;let[i,s]=Ag(n),[a,c]=Ag(t),l=Math.max(i.length,a.length)+1,u=Math.min(l,r.intersection.max),d=_C.variable({}),p=Math.min(n.minItems??0,t.minItems??0);for(let y=0;y<u;y++){let I=i[y]??s,j=a[y]??c,L=e(I,j);d.push(L,(F,z)=>{switch(F){case v.Equals:{if(!z.hasRejection)z.hasCommon=!0;break}case v.Containing:{if(!z.hasRejection)z.hasCommon=!0;z.hasExtra1=!0;break}case v.ContainedBy:{if(!z.hasRejection)z.hasCommon=!0;z.hasExtra2=!0;break}case v.Intersection:{if(!z.hasRejection)z.hasCommon=!0;z.hasExtra1=!0,z.hasExtra2=!0;break}case v.Rejection:{if(y<p)z.hasCommonBroken=!0;z.hasRejection=!0,z.hasExtra1=!0,z.hasExtra2=!0;break}}})}d.update((y)=>{switch(o){case v.Containing:{y.hasExtra1=!0;break}case v.ContainedBy:{y.hasExtra2=!0;break}case v.Intersection:{y.hasExtra1=!0,y.hasExtra2=!0;break}}if(n.uniqueItems&&!t.uniqueItems&&(t.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra2=!0;else if(!n.uniqueItems&&t.uniqueItems&&(n.maxItems??Number.POSITIVE_INFINITY)>1)y.hasExtra1=!0;if(n.maxItems===0||t.maxItems===0){if(y.hasCommon=!0,n.maxItems!==0)y.hasExtra1=!0;if(t.maxItems!==0)y.hasExtra2=!0}});let m=ke;for(let{hasExtra1:y,hasExtra2:I,hasCommon:j,hasCommonBroken:L}of d){let F=j;if(L)F=!1;if(!F)m|=oe;else if(y&&I)m|=ue;else if(y)m|=G;else if(I)m|=X;else m|=ee}return m}function Ag({items:e,additionalItems:n}){if(Array.isArray(e))return[e,n??Gt];else return[[],e??Gt]}function Og(e){let n=new Map;return(t,r)=>{let o=eo(t),i=eo(r);if(o!==i)return!1;if(!o)return t===r;return jg(n,t,r,e)}}function Ng(e){let n=new Map;return(t,r)=>jg(n,t,r,e)}function jg(e,n,t,r){let o=yn(n),i=yn(t),s=`${o}/${i}`,a=e.get(s);if(a===void 0)e.set(s,a=r(n,t));return a}function _g(e,n,t){let r=uu(n),o=uu(t),i=!1,s=!1,a=!1;for(let c of r){if(Rg(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(Rg(e,r,c))a=!0;else s=!0;if(s&&a)break}if(!a)return oe;if(i&&s)return ue;if(i)return G;if(s)return X;return ee}function du(e,n){let t=!1,r=!1;for(let o of uu(e)){switch(Et(n,o)){case Be.Valid:{t=!0;break}case Be.Invalid:{r=!0;break}case Be.Unknown:return st}if(t&&r)break}if(t&&r)return ue;if(t)return ee|X;if(r)return oe;if(ce(n)===C.Never)return ee;return X}function uu({const:e,enum:n}){if(e!==void 0)return[e];if(n)return n;throw Error("invalid branch")}function Rg({isEquals:e},n,t){for(let r of n)if(e(r,t))return!0;return!1}function $g(e){function n(s,a){let c=e.isExtendsSchema(s),l=e.isExtendsSchema(a);if(c||l)return e.equals(s,a);else return r(s,a)}let t=new Map;function r(s,a){let c=yn(s),l=yn(a);if(c===l)return!0;let u=`${c}/${l}`,d=t.get(u);if(d===void 0)d=o(s,a),t.set(u,d);return d}function o(s,a){if(Array.isArray(s)){if(!Array.isArray(a))return!1;if(s.length!==a.length)return!1;for(let[c,l]of s.entries())if(!i(l,a[c]))return!1}else{if(Array.isArray(a))return!1;for(let c in s){if(!(c in a))return!1;let l=Reflect.get(s,c),u=Reflect.get(a,c);if(!i(l,u))return!1}for(let c in a)if(!(c in s))return!1}return!0}function i(s,a){if(s===a)return!0;if(s===null||a===null)return!1;if(typeof s!=="object")return!1;if(typeof s!==typeof a)return!1;if(tt(s)&&tt(a))return r(s,a);return o(s,a)}return n}function no(e){let n=ro(e),t=e.multipleOf??1,r=bt(n,t);if(!r)return null;return{multipleOf:t,range:r}}function Dg([e,n]){if(e.num!==n.num)return!1;if(e.exclusive)return!1;if(n.exclusive)return!1;return!0}function bt(e,n){if(!e)return;let[t,r]=e,o=$C(t.num,n),i=DC(r.num,n);if(o===t.num&&t.exclusive)o+=n;if(i===r.num&&r.exclusive)i-=n;if(o>i)return;if(o===i){if(o===Number.POSITIVE_INFINITY)return;if(o===Number.NEGATIVE_INFINITY)return}return[{num:o,exclusive:!1},{num:i,exclusive:!1}]}function $C(e,n){return Math.ceil(e/n)*n}function DC(e,n){return Math.floor(e/n)*n}function Mg(e,n){let t=ro(e),r=ro(n),{left:o,right:i,center:s}=Qt(t,r);if(!s)return oe;let a=!1,c=!1;if(o)if(o.fromLeft)a=!0;else c=!0;if(i)if(i.fromLeft)a=!0;else c=!0;if(a&&c)return ue;if(a)return G;if(c)return X;return ee}function pu(e,n){let t=ro(e),r=no(n);if(!r)return G;let o=Qt(t,r.range),i=bt(o.center,r.multipleOf),s=Lg(o.left,r.multipleOf),a=Lg(o.right,r.multipleOf);if(!o.center)return oe;let c=!1,l=!1;if(o.left?.fromLeft)c=!0;if(o.right?.fromLeft)c=!0;if(!i||!Dg(o.center))c=!0;if(s)l=!0;if(a)l=!0;if(c&&l)return ue;if(c)return G;if(l)return X;return ee}function ro(e){let n,t;if(e.exclusiveMinimum!==void 0)n={num:e.exclusiveMinimum,exclusive:!0};else if(e.minimum!==void 0)n={num:e.minimum,exclusive:!1};else n={num:Number.NEGATIVE_INFINITY,exclusive:!0};if(e.exclusiveMaximum!==void 0)t={num:e.exclusiveMaximum,exclusive:!0};else if(e.maximum!==void 0)t={num:e.maximum,exclusive:!1};else t={num:Number.POSITIVE_INFINITY,exclusive:!0};return[n,t]}function Lg(e,n){if(!e)return;if(e.fromLeft)return;return bt(e.range,n)}function qg(e,n){let t=no(e),r=no(n);if(!t&&!r)return ee;if(!t)return X;if(!r)return G;let{range:o,multipleOf:i}=t,{range:s,multipleOf:a}=r,c=Qt(o,s),l,u=0;if(c.center)u=LC(i,a),l=bt(c.center,u);if(!l)return oe;let d=!1,p=!1,{left:m,right:y}=c;if(m&&bt(m.range,m.fromLeft?i:a))if(m.fromLeft)d=!0;else p=!0;if(y&&bt(y.range,y.fromLeft?i:a))if(y.fromLeft)d=!0;else p=!0;if(d=d||zg(t,l,u),p=p||zg(r,l,u),d&&p)return ue;if(d)return G;if(p)return X;return ee}function zg({range:e,multipleOf:n},t,r){let o=Qt(e,t);if(bt(o.left?.range,n))return!0;if(bt(o.right?.range,n))return!0;let i=bt(o.center,n);if(!i)return!1;let s=Fg(t);if(Fg(i)>s)return!0;if(s===1)return!1;if(n<r)return!0;return!1}function LC(e,n){return e*n/Vg(e,n)}function Vg(e,n){if(e===0)return n;return Vg(n%e,e)}function Fg(e){if(!e)return 0;let[n,t]=e;return t.num-n.num+1}function fu(e,n){if(Bg(e)||Bg(n))return st;let t=Ug(e),r=Ug(n);if(t&&r)return Mg(e,n);else if(t)return pu(e,n);else if(r)return Wt(pu(n,e));else return qg(e,n)}function Bg(e){let{multipleOf:n}=e;if(n===void 0)return!1;if(!Number.isInteger(n))return!0;if(n<0)return!0;return!1}function Ug(e){let{multipleOf:n}=e;if(n!==void 0&&Number.isInteger(n))return!1;if(e.type==="integer")return!1;return!0}var MC=Zn(0),zC=es(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function Kg(e,n,t){if(FC(n,t))return oe;let r=qC(n,t);if(!r)return oe;let o=Jg(n),i=Jg(t),s=(I)=>{let j=o(I),L=i(I);if(Zg(j,L))return e.calculate(j,L);else return ke},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=zC.variable({});for(let I of[...a].toSorted())u.push(s(I),BC);for(let I of[...c].toSorted())u.push(s(I),UC);for(let I of[...l].toSorted())u.push(s(I),JC);let{hasOptional1:d,hasOptional2:p}=r;if(d||p){let I=ZC(d,p);for(let F of[...VC(n,t)].toSorted()){let z=s(F);if(z!==ke)u.push(z,I)}let j=n.additionalProperties??Gt,L=t.additionalProperties??Gt;if(Zg(j,L)){let F=e.calculate(j,L);u.push(F,I)}}u.update((I)=>{if(!I.hasRejection){if(c.size>0)I.hasExtra2=!0;if(l.size>0)I.hasExtra1=!0}});let{requiredKeysCount:m}=r,y=ke;for(let{hasExtra1:I,hasExtra2:j,hasCommonInRequired:L,hasCommonOutRequired:F,hasRejection:z}of u)if(!L&&m>0)y|=oe;else if(!F&&m===0)y|=oe;else if(z)y|=oe;else if(I&&j)y|=ue;else if(I)y|=G;else if(j)y|=X;else y|=ee;return y}function FC(e,n){let t=MC(e.minProperties,e.maxProperties,n.minProperties,n.maxProperties);return Kn(t)===v.Rejection}function qC(e,n){let t=new Set(e.required),r=new Set(n.required),o=new Set,i=new Set,s=t.size,a=r.size;for(let d of t){if(r.has(d))o.add(d);i.add(d)}for(let d of r){if(t.has(d))o.add(d);i.add(d)}let c=i.size;for(let d of o)t.delete(d),r.delete(d);let l=e.maxProperties??Number.MAX_SAFE_INTEGER,u=n.maxProperties??Number.MAX_SAFE_INTEGER;if(c>l||c>u)return null;return{requiredKeysCount:c,extraRequired1:t,extraRequired2:r,commonRequired:o,hasOptional1:l>s,hasOptional2:u>a}}function VC(e,n){let t=new Set(e.required),r=e.properties,o=n.properties,i=e.required,s=n.required;if(r)for(let a in r)t.add(a);if(o)for(let a in o)t.add(a);if(i)for(let a of i)t.delete(a);if(s)for(let a of s)t.delete(a);return t}var BC=(e,n)=>{switch(e){case v.Equals:{n.hasCommonInRequired=!0;break}case v.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case v.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case v.Intersection:{n.hasExtra1=!0,n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case v.Rejection:{n.hasRejection=!0;break}}},UC=(e,n)=>{switch(e){case v.Equals:case v.ContainedBy:{n.hasCommonInRequired=!0;break}case v.Intersection:case v.Containing:{n.hasExtra1=!0,n.hasCommonInRequired=!0;break}case v.Rejection:{n.hasRejection=!0;break}}},JC=(e,n)=>{switch(e){case v.Equals:case v.Containing:{n.hasCommonInRequired=!0;break}case v.Intersection:case v.ContainedBy:{n.hasExtra2=!0,n.hasCommonInRequired=!0;break}case v.Rejection:{n.hasRejection=!0;break}}},ZC=(e,n)=>(t,r)=>{if(r.hasRejection)return;let o=!1,i=!1,s=!1;switch(t){case v.Equals:{s=!0;break}case v.Containing:{o=!0,s=!0;break}case v.ContainedBy:{i=!0,s=!0;break}case v.Intersection:{o=!0,i=!0,s=!0;break}case v.Rejection:{o=!0,i=!0;break}}if(e&&o)r.hasExtra1=!0;if(n&&i)r.hasExtra2=!0;if(e&&n&&s)r.hasCommonOutRequired=!0};function Jg(e){let{properties:n,propertyNames:t,additionalProperties:r}=e,o=[];if(e.patternProperties)for(let i in e.patternProperties){let s=e.patternProperties[i],a=new RegExp(i,"i");o.push({pattern:a,schema:s})}return(i)=>{if(t&&Et(t,i)===Be.Invalid)return Yr;for(let{pattern:a,schema:c}of o)if(a.test(i))return c;let s=(n&&n[i])??r;if(!s)return Gt;return s}}function Zg(e,n){let t=ce(e),r=ce(n);return t!==C.Never||r!==C.Never}var KC=Zn(0);function Wg(e,n){if(n.format&&!e.format)return G;if(e.format&&n.format&&e.format!==n.format)return st;let t=KC(e.minLength,e.maxLength,n.minLength,n.maxLength),r=Kn(t),o=!!e.pattern,i=!!n.pattern;switch(r){case v.Rejection:return oe;case v.Containing:return o?st:G;case v.ContainedBy:return i?st:X;case v.Equals:{if(o&&i)return e.pattern===n.pattern?ee:st;if(o)return ee|X;if(i)return ee|G;return ee}case v.Intersection:{if(o&&i)return st;if(o)return ue|oe|X;if(i)return ue|oe|G;return ue}}}function Gg(e,n,t){let r={},o=[],i=Ng(HC(e,r)),s=WC(),a=$g(e);r.isEquals=Og(Vn),r.calculate=nu({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,p)=>{let m=p?Wt(d):d;if(!GC(m))return;let y=p?Hg(u,l):Hg(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(n,t);return{errorPath:o[0],expression:c}}var WC=()=>(e)=>{let n;switch(ce(e)){case C.Not:{n={kind:Ye.Not,expression:e.not};break}case C.Combination:{if("allOf"in e)n={kind:Ye.AllOf,expressions:hu(e.allOf,C.Any)};else if("anyOf"in e)n={kind:Ye.AnyOf,expressions:hu(e.anyOf,C.Never)};else if("oneOf"in e)n={kind:Ye.OneOf,expressions:hu(e.oneOf,C.Never)};else throw Error(`invalid combination JSON Schema: ${JSON.stringify(e)}`);break}default:{n={kind:Ye.Leaf};break}}return n},HC=(e,n)=>(t,r)=>{let o=ce(t),i=ce(r);if(o===C.Extends||i===C.Extends)return e.calculate(t,r);switch(o){case C.Any:return i===C.Any?ee:G;case C.Never:return i===C.Never?ee:X}switch(i){case C.Any:return X;case C.Never:return G}if(o===C.EnumOrConst&&i===C.EnumOrConst)return _g(n,t,r);if(o===C.EnumOrConst)return du(t,r);if(i===C.EnumOrConst)return Wt(du(r,t));if(o!==i)return oe;switch(o){case C.Null:return ee;case C.Numeric:return fu(t,r);case C.String:return Wg(t,r);case C.Boolean:return ee;case C.Object:return Kg(n,t,r);case C.Array:return Tg(n,t,r);default:throw Error(`invalid kind ${o}`)}};function hu(e,n){return e.filter((t)=>ce(t)!==n)}function GC(e){return!Zr(e)&&!Wr(e)&&(Kr(e)||Gr(e)||Hr(e))}function Hg(e,n){let t=iu(n);if(!t)return;let r=ce(e),o=ce(n);if(r!==o)return[...t,"type"];let i=e,s=n;switch(o){case C.String:{if((i.minLength??0)<(s.minLength??0))return[...t,"minLength"];if((i.maxLength??Number.POSITIVE_INFINITY)>(s.maxLength??Number.POSITIVE_INFINITY))return[...t,"maxLength"];if(i.pattern!==s.pattern&&s.pattern)return[...t,"pattern"];if(i.format!==s.format&&s.format)return[...t,"format"];break}case C.Numeric:{if((i.minimum??i.exclusiveMinimum??Number.NEGATIVE_INFINITY)<(s.minimum??s.exclusiveMinimum??Number.NEGATIVE_INFINITY))return[...t,s.exclusiveMinimum==null?"minimum":"exclusiveMinimum"];if((i.maximum??i.exclusiveMaximum??Number.POSITIVE_INFINITY)>(s.maximum??s.exclusiveMaximum??Number.POSITIVE_INFINITY))return[...t,s.exclusiveMaximum==null?"maximum":"exclusiveMaximum"];if(i.multipleOf!==s.multipleOf&&s.multipleOf!=null)return[...t,"multipleOf"];break}case C.Array:{if((i.minItems??0)<(s.minItems??0))return[...t,"minItems"];if((i.maxItems??Number.POSITIVE_INFINITY)>(s.maxItems??Number.POSITIVE_INFINITY))return[...t,"maxItems"];if(!i.uniqueItems&&s.uniqueItems)return[...t,"uniqueItems"];break}case C.Object:{let a=new Set(i.required??[]);if((s.required??[]).some((c)=>!a.has(c)))return[...t,"required"];if((i.minProperties??0)<(s.minProperties??0))return[...t,"minProperties"];if((i.maxProperties??Number.POSITIVE_INFINITY)>(s.maxProperties??Number.POSITIVE_INFINITY))return[...t,"maxProperties"];break}case C.EnumOrConst:return[...t,s.const===void 0?"enum":"const"]}return t}class oo{constructor(e=[]){this.extendsSchemaClasses=Object.freeze([...e])}tryCompiledExtendsSchema(e,n){for(let t of this.extendsSchemaClasses)if(t.isMatch(e))return new t(Zt(),e,n);return null}isExtendsSchema(e){for(let n of this.extendsSchemaClasses)if(e instanceof n)return!0;return!1}calculate(e,n){let t=this.findMatchedClass(e,n),r=!(e instanceof t),o=ke,i;if(r)i=n.compare(e);else i=e.compare(n);for(let s of i){if(r)s=oo.swap(s);o|=Kt(s)}return o}equals(e,n){let t=this.findMatchedClass(e,n);if(!(e instanceof t))return n.equals(e);else return e.equals(n)}findMatchedClass(e,n){for(let t of this.extendsSchemaClasses){if(e instanceof t)return t;if(n instanceof t)return t}throw Error("Invalid schema")}static swap(e){switch(e){case v.Containing:return v.ContainedBy;case v.ContainedBy:return v.Containing;default:return e}}}function Qg(e,n,t=!1){let r=n(e);if(Array.isArray(r)){let s=[];throw mu(s,r,"$"),new Gi(s)}let{schema:o,warns:i}=r;if(t&&i.length>0){console.warn(`found ${i.length} warns after compile schema`);for(let s of i)console.warn(Jn(s))}return o}function Xg(e,n,t,r=!1){let o=t(e),i=t(n);if(Array.isArray(o)||Array.isArray(i)){let u=[];if(Array.isArray(o))mu(u,o,"$1");if(Array.isArray(i))mu(u,i,"$2");throw new Gi(u)}let{schema:s,warns:a}=o,{schema:c,warns:l}=i;if(r){if(a.length>0)console.warn(`found ${a.length} warns after compile superSchema`);for(let u of a)console.warn(Jn(u));if(l.length>0)console.warn(`found ${l.length} warns after compile subSchema`);for(let u of l)console.warn(Jn(u))}return[s,c]}function mu(e,n,t){for(let r of n){let o={...r,path:[t,...r.path]};e.push(o)}}var io=Object.freeze({True:0,False:1,Unknown:2});function yu({extendsSchemaClasses:e,delegate:n}={}){let t=new oo(e);return Object.freeze({compile:(o,i,s)=>Qg(o,(c)=>Yi(c,t,i,n),s),isSubset:(o,i,s=!1)=>{let a=(y)=>Yi(y,t,void 0,n),[c,l]=Xg(o,i,a,s),{errorPath:u,expression:d}=Gg(t,c,l),p=Zr(d)||Wr(d),m=Kr(d)||Gr(d)||Hr(d);if(p&&!m)return{result:io.True};if(!p&&m)return{errorPath:u,result:io.False};return{result:io.Unknown}}})}var ts=(e)=>typeof e==="string";var QC=Array.isArray;var XC=(e)=>e!==null&&typeof e==="object";var YC=(e)=>XC(e)&&!QC(e),gn=(e)=>YC(e)?e:void 0;function eP(e){return gn(e)?.type==="string"}function tP(e){let n=gn(e),t=gn(n?.error);if(n==null||t==null||n.packageId!=null&&!ts(n.packageId)||t.message!=null&&!ts(t.message))throw TypeError("Invalid schema comparison context.")}function nP(e){if(e==null)return{error:{}};return tP(e),e}class Xt{static setError(e,n,t){if(e instanceof Xt)e.context.error.message=t;else if(n instanceof Xt)n.context.error.message=t}constructor(e,n,t){this.id=e,this.value=n,this.context=nP(t)}compare(e){if(tt(e)&&ce(e)===C.Any)return[v.ContainedBy];return this.compareImpl(e)}}class so extends Xt{static isMatch(e){let n=gn(e)?.enum;return Array.isArray(n)&&n.every((t)=>ts(t))}constructor(e,n,t){if(!so.isMatch(n))throw TypeError("Invalid single-select schema.");super(e,n,t)}compareImpl(e){if(eP(e))return[v.ContainedBy];if(e instanceof so){let n=new Set(this.value.enum),t=v.Equals;for(let r of e.value.enum){if(!n.has(r))t=v.ContainedBy;n.delete(r)}if(n.size===0)return[t];if(n.size===this.value.enum.length)return[v.Rejection];return[v.Intersection]}return[v.Rejection]}equals(e){if(e instanceof so){let n=new Set(this.value.enum);for(let t of e.value.enum){if(!n.has(t))return!1;n.delete(t)}return n.size===0}return!1}}class ao extends Xt{static isMatch(e){return gn(e)?.contentMediaType==="oomol/bin"}constructor(e,n,t){if(!ao.isMatch(n))throw TypeError("Invalid binary schema.");super(e,n,t)}compareImpl(e){if(e instanceof ao)return[v.Equals];else return Xt.setError(this,e,"edgeError.binDiffType"),[v.Rejection]}equals(e){return e instanceof ao}}class co extends Xt{static isMatch(e){return gn(e)?.contentMediaType==="oomol/artifact"}constructor(e,n,t){if(!co.isMatch(n))throw TypeError("Invalid Artifact schema.");super(e,n,t)}compareImpl(e){if(e instanceof co)return[v.Equals];return Xt.setError(this,e,"edgeError.artifactDiffType"),[v.Rejection]}equals(e){return e instanceof co}}function Yg(){return yu({extendsSchemaClasses:[so,ao,co]})}var K1=Yg();var rP=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function ns(e){return rP.has(e)}function rs(e){if(e.kind!="task")return[];if("moduleId"in e.task)return(e.task.capabilities??[]).flatMap((n,t)=>n.kind=="workflow"?[{target:n,path:`task/capabilities/${t}`,tool:n.name}]:[]);if(e.task.executor.kind=="workflow")return[{target:{...e.task.executor,inputs:e.task.inputs.filter((n)=>("handle"in n)),outputs:e.task.outputs.filter((n)=>("handle"in n))},path:"task/executor"}];if(e.task.executor.kind=="agent")return e.task.executor.tools.flatMap((n,t)=>n.kind=="workflow"?[{target:n,path:`task/executor/tools/${t}`,tool:n.name}]:[]);return[]}var os=E({handle:k().min(1),jsonSchema:De(),nullable:me(),description:k().optional()}),ij=w({inputs:A(os).nullable(),outputs:A(os).nullable()});var eb=E({version:b(1),flowId:k().min(1),name:k(),revisionId:k().min(1),publicationId:k().min(1),inputs:A(os),outputs:A(os).nullable()});var tb=E({version:b(1),direction:U(["incoming","outgoing"]),total:Ne().nonnegative(),nextOffset:Ne().nonnegative().optional(),references:A(E({flowId:k(),name:k().nullable(),available:me(),draft:me(),live:E({publicationId:k(),enabled:me()}).nullable()}))});var gu=["GET","POST","PUT","PATCH","DELETE"];function is(e){return e!=="GET"}var Wn=w({mode:U(["fields","object"]).default("fields"),names:A(k()).default([])});var lo=w({providerId:k().min(1),connectionId:k().optional(),method:U(["GET","POST","PUT","PATCH","DELETE"]).default("GET"),query:Wn.default({mode:"fields",names:[]}),headers:Wn.default({mode:"fields",names:[]}),bodyFormat:U(["none","json"]).default("none")}),nb=lo.extend({kind:b("connector-proxy")});function fP(e){return e.kind==="decision"}var xu={choice:255,score:10};function rb(e){if(e.type==="noul"||e.criteria.length<=xu[e.type])return e;if(e.type==="choice")return{...e,criteria:e.criteria.slice(0,xu.choice)};return{...e,criteria:e.criteria.slice(0,xu.score)}}function hP(e){let n=e.map(rb);return n.every((t,r)=>t===e[r])?e:n}function ob(e){if(!fP(e.executor))return e;let n=e.executor.questions,t=hP(n);if(t===n)return e;let r=e.outputs.map((o)=>{if(!("handle"in o))return o;let i=n.findIndex((s)=>s.name===o.handle);if(i<0||n[i]===t[i]||!je(o.jsonSchema,ib(n[i])))return o;return{...o,jsonSchema:mP(t[i])}});return{...e,executor:{...e.executor,questions:t},outputs:r}}var wu={type:"number",minimum:0,maximum:1};function mP(e){return ib(rb(e))}function ib(e){let n={type:{const:e.type}};if(e.type==="noul")n.noul=wu;else{let t=e.type==="choice"?e.criteria.map((r)=>r.name):e.criteria.map((r,o)=>String(o));if(n.confidence=wu,n.probabilities={type:"object",properties:Object.fromEntries(t.map((r)=>[r,wu])),required:t,additionalProperties:!1},e.type==="choice")n.choice={type:"string",...t.length?{enum:t}:{}};else n.score={type:"number",minimum:0,maximum:Math.max(0,t.length-1)},n.legend={type:"object",properties:Object.fromEntries(t.map((r)=>[r,{type:"string"}])),required:t,additionalProperties:!1}}return{type:"object",properties:n,required:Object.keys(n)}}function sb(e){for(let[n,t]of Object.entries(e))if(n.startsWith("auth.")&&t.kind=="value")throw TypeError("HTTP authentication accepts deployment variables and upstream outputs only.")}var yP=/^(?:\*\.)?(?=.{1,253}$)(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,vu=20;function ku(e){return yP.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var ss=w({method:U(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"]).default("GET"),query:Wn.default({mode:"fields",names:[]}),headers:Wn.default({mode:"fields",names:[]}),bodyFormat:U(["none","json","text","form"]).default("none"),authentication:te([w({type:b("none")}),w({type:U(["bearer","basic"])}),w({type:b("apiKey"),name:k(),in:U(["header","query"])})]).default({type:"none"}),responseFormat:U(["auto","json","text"]).default("auto"),statusPolicy:U(["success","all"]).default("success")}),ab=ss.extend({kind:b("http-request")});function xt(e,n=0){if(n>64)throw TypeError("Value exceeds the maximum JSON depth.");if(e!=null&&typeof e=="object")for(let t of Object.values(e))xt(t,n+1)}var Su=["code","connector","openapi","http-request","llm","decision"],as={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var At=w({maxRetries:M().int().min(0).max(as.maxRetries),intervalMs:M().int().min(as.minIntervalMs).max(as.maxIntervalMs).multipleOf(as.intervalStepMs)});var en=A(te([E({type:b("cron"),expression:k(),timezone:k()}),E({type:b("every"),unit:U(["day","hour","minute","month","week"]),value:M()})]));function cb(e){try{return Intl.DateTimeFormat("en",{timeZone:e}),!0}catch{return!1}}var Hn=gt("kind",[w({kind:b("after"),durationMs:M().nullable()}),w({kind:b("at"),at:k(),timezone:k().optional()})]),Iu=gt("kind",[Hn.options[0].extend({durationMs:M().int().positive().max(Number.MAX_SAFE_INTEGER)}),Hn.options[1].extend({at:Ur.datetime({offset:!0}),timezone:k().refine(cb,"Select a valid IANA timezone.").optional()})]);var uo={defaultMs:30000,minMs:1000,maxMs:60000};var lb={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var gP=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:lb.jsonSchema,nullable:!1,value:{}}];var yo=14,S=k(),ls=S.describe('Account selection: omit while unconfigured; use an account ID to select it; use "" to explicitly defer configuration. Deferred Actions fail if called; deferred Agent tools are excluded from the callable tool set. Not supported by Triggers.'),wn=De(),po=A(S),tn=E({description:S.optional(),jsonSchema:wn,nullable:me(),handle:S}),bP=A(tn.strict()),lt=tn.extend({value:wn.optional()}),ub=E({collapsed:me().optional(),group:S}),xP=E({kind:b("node"),nodeId:S,output:S,system:b(!0).optional(),field:S.optional()}),fb=te([xP,E({kind:b("binding"),bindingId:S})]),fo=te([E({kind:b("unset")}),E({kind:b("value"),value:wn})]),Cu=te([fo,E({kind:b("sources"),sources:A(fb)})]),hb=re(S,Cu),Qn={inputs:A(te([lt,ub])),outputs:A(te([tn,ub]))},wP=w({kind:b("connector"),action:S,connectionId:S.optional(),connections:A(w({connectionId:S,alias:S.optional()}))}),Ou=te([wP,w({kind:b("connector"),mode:b("shared")}),w({kind:b("connector"),mode:b("independent"),actions:A(w({action:S,connectionId:ls.optional()}))}),w({kind:b("connector"),actionHints:A(S).optional(),connectionHints:A(w({action:S,connectionId:S,alias:S.optional()})).optional()})]),mb=w({kind:b("workflow"),name:S,flowId:S,revisionId:S,inputs:A(tn),outputs:A(tn).nullable()}),Nu=w({kind:b("http"),hosts:A(S.refine(ku,'Use a lowercase host name or IPv4 address, optionally prefixed by "*." for subdomains.')).min(1).max(vu).describe('Hosts Code may call with context.fetch. "*.example.com" matches subdomains only.')}),us=te([Ou,mb,Nu]),Pu=E({...Qn,name:S,moduleId:S,capabilities:A(us).optional()}),yb=te([E({kind:b("value"),value:wn}),E({kind:b("input"),input:S})]),vP=te([yb,E({kind:b("model")})]),fs={id:S,name:S,description:S,approval:me(),inputs:A(lt.extend({source:vP}))},ju=E({...fs,kind:b("connector").optional(),action:S,connectionId:ls.optional()}),Ru=mb.extend(fs),kP=gt("type",[w({name:S,instructions:S,type:b("noul"),criteria:w({true:S.optional(),false:S.optional()}).optional()}),w({name:S,instructions:S,type:b("choice"),criteria:A(w({name:S,description:S}))}),w({name:S,instructions:S,type:b("score"),criteria:po})]),Gn=E({...Qn,name:S,executor:te([E({kind:b("connector"),action:S,connectionId:ls.optional(),outputMode:b("value").optional()}),E({kind:b("openapi"),sourceUrl:S,method:S,path:S,serverUrl:S,document:wn,auth:A(E({id:S,type:U(["bearer","basic","apiKey"]),name:S.optional(),in:U(["header","query"]).optional()}))}),w({kind:b("decision"),questions:A(kP)}),E({kind:b("llm"),mode:U(["chat","json"])}),E({kind:b("agent"),code:me().optional(),model:S,prompt:S,maxRounds:M(),tools:A(te([Ru,ju])),notification:E({action:S,connectionId:ls.optional(),inputDefinitions:A(lt),messageHandle:S,inputs:re(S,yb)}).optional()}),w({kind:b("workflow"),flowId:S,revisionId:S}),ab,eg,nb])}),Eu=Gn.transform(ob),db=te([E({kind:b("value"),value:wn.optional(),jsonSchema:wn.optional()}),E({kind:b("source"),source:fb})]),ds={matchMode:U(["first","all"]),cases:A(E({description:S.optional(),output:S,groups:A(E({expressions:A(E({left:db,operator:U(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:db.optional()}))}))}))},ho={inputDefinitions:A(lt),prompt:S},SP=E({allowedMethods:yt().optional(),allowedOrigins:po.optional(),noResponseBody:yt().optional(),responseBody:gt("kind",[w({kind:b("workflow-outputs"),output:S.optional(),timeoutMs:M().int().min(uo.minMs).max(uo.maxMs).optional()}),w({kind:b("webhook-response"),nodeId:S.optional(),timeoutMs:M().int().min(uo.minMs).max(uo.maxMs).optional()})]).optional(),responseData:S.optional(),responseHeaders:re(S,S).optional(),responseHeadersSource:w({kind:b("workflow-outputs"),output:S.optional()}).optional(),responseHeaderOutputs:re(S,S).optional(),responseStatusCode:M().int().min(200).max(599).optional(),responseStatusCodeOutput:S.optional()}),ps={bodyFields:A(lt),method:U(gu),options:SP.optional()},pb={configInputs:Qn.inputs,definitionVersion:b(2),description:S,displayName:S,key:S,name:S,outputs:A(tn).refine((e)=>new Set(e.map((n)=>n.handle)).size===e.length,"Duplicate Trigger output handle."),provider:S},IP=E({body:E({allowArray:me(),allowEmpty:me(),formats:A(U(["form","json","multipart","text"]))}),methods:A(U(["DELETE","GET","HEAD","PATCH","POST","PUT"])),successStatus:M()}),Au=A(S.min(1)).refine((e)=>new Set(e).size===e.length,"Duplicate source Flow ID."),bn={name:S,description:S.optional(),icon:S.optional()},xn={maxExecutions:M().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),inputs:hb,name:S.optional(),description:S.optional(),icon:S.optional(),timeoutMs:M().optional(),retry:At.optional(),onError:U(["stop","error"]).optional()},cs=te([w({...xn,kind:b("webhook-response"),retry:yt().optional(),onError:yt().optional()}),w({...xn,kind:b("outputs"),outputDefs:A(tn.strict()),outputMappings:hb}).omit({inputs:!0}),E({...xn,inputs:re(S,yt()),kind:b("condition"),...ds}),E({...xn,inputs:mt().transform(()=>({})).default({}),kind:b("value"),values:A(lt)}),E({...xn,kind:b("task"),task:te([Pu,Eu]),additionalInputs:A(lt).optional()}),w({...xn,kind:b("approval"),...ho}).omit({timeoutMs:!0}),w({...xn,kind:b("wait"),...ho,autoContinue:Hn.optional()}).omit({timeoutMs:!0}),E({...bn,kind:b("manual")}),w({...bn,kind:b("start"),inputDefs:bP}),w({...bn,kind:b("error"),sourceFlowIds:Au.optional()}),E({...bn,kind:b("webhook"),...ps}),E({...bn,kind:b("cron"),cronTimes:en}),E({...bn,kind:b("poll"),connectionId:S.min(1).optional(),config:re(S,fo),definition:E({...pb,type:b("poll")}),pollTimes:en}),E({...bn,kind:b("integration"),connectionId:S.min(1).optional(),config:re(S,fo),definition:E({...pb,type:b("integration"),endpoint:IP})})]),vt={input:lt,port:tn,ports:Qn,condition:w(ds),wait:w(ho),waitAutoContinue:Iu,webhook:w(ps),schedule:en,capabilities:A(us),connector:Gn.shape.executor.options[0].omit({kind:!0}).strict(),openapi:Gn.shape.executor.options[1].omit({kind:!0}).strict(),decision:Gn.shape.executor.options[2].omit({kind:!0}).strict(),llm:Gn.shape.executor.options[3].omit({kind:!0}).strict(),agent:Gn.shape.executor.options[4].omit({kind:!0,notification:!0}).strict()},Tu=E({source:S,target:S,sourceHandle:S.optional()}),ze={nodeId:S,target:yt().optional()},CP=E({nodes:re(S,cs),edges:A(Tu).default([])}),gb=E({kind:b("variable"),target:S}),bb=E({name:S,imports:po,source:S}),PP=Zy(EP,E({bindings:re(S,gb),graph:CP})),xb=E({modelVersion:te([b(2),b(4),b(5),b(6),b(7),b(8),b(9),b(10),b(11),b(12),b(13),b(yo)]),document:PP,modules:re(S,bb)}),nR=xb.extend({kind:b("open-flow-flow-revision"),version:b(1)});function EP(e){let n=wt(e);if(n.tasks!==void 0&&(n.tasks===null||typeof n.tasks!=="object"||Array.isArray(n.tasks)||Object.keys(n.tasks).length>0))throw TypeError("Independent Task definitions are no longer supported.");if(Object.values(wt(wt(n.graph).nodes)).some((r)=>Object.hasOwn(wt(r),"taskId")))throw TypeError("Task references are no longer supported.");let t=n.subflows;if(t!==void 0&&(t===null||typeof t!=="object"||Array.isArray(t)||Object.keys(t).length>0))throw TypeError("Subflows are no longer supported.");if(Object.values(wt(wt(n.graph).nodes)).some((r)=>wt(r).kind==="subflow"))throw TypeError("Subflow nodes are no longer supported.");if(["inputDefs","outputDefs","outputMappings"].some((r)=>Object.hasOwn(n,r)))throw TypeError("Workflow interface configuration must belong to Start and Outputs nodes.");if(Object.values(wt(wt(n.graph).nodes)).some((r)=>wt(r).kind=="start"&&Object.hasOwn(wt(r),"parameters")))throw TypeError("Legacy Start.parameters is unsupported; configure node.inputDefs.");return e}function wt(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)?e:{}}function Xn(e){xt(e);let n=xb.parse(e);return TP(n),kb(n.document),n}var AP={"graph.trigger.sources.set":{nodeId:S,before:Au.optional(),value:Au.optional()},"binding.create":{bindingId:S,binding:gb},"binding.delete":{bindingId:S},"binding.target.set":{bindingId:S,before:S,value:S},"graph.edge.connect":{edge:Tu,target:yt().optional()},"graph.edge.disconnect":{edge:Tu,target:yt().optional()},"graph.node.create":{...ze,node:cs},"graph.node.replace":{...ze,before:cs,node:cs},"graph.node.delete":ze,"graph.node.field.set":te([E({...ze,kind:b("graph.node.field.set"),field:b("retry"),before:At.optional(),value:At.optional()}),E({...ze,kind:b("graph.node.field.set"),field:b("connectionId"),before:S.min(1).optional(),value:S.min(1).optional()}),E({...ze,kind:b("graph.node.field.set"),field:U(["description","icon","name","onError"]),before:S.optional(),value:S.optional()}),E({...ze,kind:b("graph.node.field.set"),field:b("maxExecutions"),before:M().int().positive().max(Number.MAX_SAFE_INTEGER).optional(),value:M().int().positive().max(Number.MAX_SAFE_INTEGER).optional()}),E({...ze,kind:b("graph.node.field.set"),field:b("timeoutMs"),before:M().optional(),value:M().optional()})]),"graph.node.input.set":{...ze,handle:S,before:Cu.optional(),value:Cu.optional()},"graph.node.additional-inputs.set":{...ze,before:A(lt).optional(),value:A(lt).optional()},"graph.node.condition.set":{...ze,before:E(ds),value:E(ds)},"graph.node.values.set":{...ze,before:A(lt),value:A(lt)},"graph.node.resolution.set":{...ze,before:w({...ho,autoContinue:Hn.optional()}),value:w({...ho,autoContinue:Hn.optional()})},"graph.node.webhook.set":{...ze,before:E(ps),value:E(ps)},"graph.node.task.ports.set":{...ze,before:E(Qn),value:E(Qn)},"graph.node.task.name.set":{...ze,before:S,value:S},"graph.node.task.capabilities.set":{...ze,before:A(us).optional(),value:A(us).optional()},"graph.trigger.config.set":{nodeId:S,name:S,before:fo.optional(),value:fo.optional()},"graph.trigger.schedule.set":{nodeId:S,before:en,value:en},"module.create":{moduleId:S,module:bb},"module.delete":{moduleId:S},"module.rename":{moduleId:S,before:S,name:S},"module.source.replace":{moduleId:S,beforeImports:po,beforeSource:S,imports:po,source:S},"graph.node.task.set":{...ze,before:te([Pu,Eu]),value:te([Pu,Eu])}},wb=new Map(Object.entries(AP).map(([e,n])=>[e,n instanceof Q?n:E({kind:b(e),...n})])),rR=A(te([...wb.values()])).min(1);function mo(e,n,t){try{return t(e)}catch(r){if(!(r instanceof nS))throw r;throw TypeError(`operations[${n}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function vb(e,n){let{kind:t}=mo(e,n,E({kind:S}).parse),r=wb.get(t);if(r==null)throw TypeError(`operations[${n}]: Unknown operation ${JSON.stringify(t)}.`);return mo(e,n,r.parse)}function TP(e){if(e.modelVersion<14&&Object.values(e.document.graph.nodes).some((n)=>n.kind==="task"&&("executor"in n.task)&&n.task.executor.kind==="connector-proxy"))throw TypeError("Custom API Request requires Flow model v14.");if(e.modelVersion<13&&Object.values(e.document.graph.nodes).some((n)=>n.kind==="task"&&("executor"in n.task)&&n.task.executor.kind==="skip-duplicates"))throw Error("Skip Duplicates requires Flow model v13.");if(e.modelVersion<12&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("moduleId"in n.task)&&n.task.capabilities?.some((t)=>t.kind=="http")))throw TypeError("Code HTTP access requires Flow model version 12.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)&&n.task.executor.kind=="http-request"))throw TypeError("HTTP Request requires Flow model version 11.");if(e.modelVersion<11&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("moduleId"in n.task?n.task.capabilities?.some((t)=>t.kind=="workflow"):n.task.executor.kind=="agent"&&n.task.executor.tools.some((t)=>t.kind=="workflow"))))throw TypeError("Workflow tools require Flow model version 11.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="webhook"&&(n.options?.responseBody!=null||n.options?.responseStatusCodeOutput!=null||n.options?.responseHeadersSource!=null||n.options?.responseHeaderOutputs!=null)))throw TypeError("Dynamic Webhook responses require Flow model version 10.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>("retry"in n)&&n.retry!=null))throw TypeError("Node retries require Flow model version 9.");if(e.modelVersion<9&&Object.values(e.document.graph.nodes).some((n)=>{if(n.onError!=null)return!0;if([...Object.values("inputs"in n?n.inputs:{}),...Object.values(n.kind=="outputs"?n.outputMappings:{})].some((r)=>r.kind=="sources"&&r.sources.some((o)=>o.kind=="node"&&o.system)))return!0;return n.kind=="condition"&&n.cases.some((r)=>r.groups.some((o)=>o.expressions.some((i)=>[i.left,i.right].some((s)=>s?.kind=="source"&&s.source.kind=="node"&&s.source.system))))}))throw TypeError("Node error handling requires Flow model version 9.");if(e.modelVersion<10&&Object.values(e.document.graph.nodes).some((n)=>n.kind==="webhook-response"))throw TypeError("Webhook response nodes require Flow model version 10.");if(e.modelVersion<8&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="outputs"))throw TypeError("Workflow outputs require Flow model version 8.");if(e.modelVersion<7&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="start"))throw TypeError("Start Triggers require Flow model version 7.");if(e.modelVersion<6&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="task"&&("executor"in n.task)))throw TypeError("Node-owned managed Tasks require Flow model version 6.");if(e.modelVersion<5&&Object.values(e.document.graph.nodes).some((n)=>n.kind=="error"))throw TypeError("Error workflows require Flow model version 5.")}function kb(e){for(let n of Object.values(e.graph.nodes))if(n.kind=="task"&&"executor"in n.task&&["openapi","http-request"].includes(n.task.executor.kind))sb(n.inputs)}var Sb=w({mode:U(["chat","json"]),resultSchema:De(),model:De().optional().describe("Default model settings: {model, temperature?, top_p?, max_tokens?}. A bound model input takes precedence."),template:De().optional().describe('Default message templates: [{role: "system" | "user" | "assistant", content: "Text with {{namedInput}}"}].'),messages:De().optional().describe("Default conversation history, prepended without template interpolation; an array of {role, content} or null.")});var jP=te([w({schemes:A(k().min(1)).describe("One complete security alternative advertised by this operation; [] selects no authentication.")}),w({type:U(["bearer","basic"])}),w({type:b("apiKey"),name:k().min(1),in:U(["header","query"])})]),Ib=w({sourceUrl:k().min(1),path:k().min(1),method:k().min(1),serverUrl:k().optional(),authentication:jP.optional().describe("Omit to use the operation default. Bind credentials through the advertised node inputs.")});var q=k().min(1),ut=De(),Mu=re(q,ut),hs=["start","outputs","webhook-response","workflow","webhook","cron","error","poll","integration","code","connector","connector-proxy","agent","llm","decision","openapi","http-request","skip-duplicates","condition","value","wait","approval"],zu=U(hs),Tt=q.describe('An existing node reference returned by read/search, or $alias for a preceding node.add in this edit batch. For node.add.as "step", reference "$step", never bare "step". Aliases are local to one batch.'),_u=w({kind:b("output"),node:Tt,port:q.optional().describe("Omit for a node with one output. For multiple outputs, choose a name from node details."),field:k().optional()}),$u=w({kind:b("system"),node:Tt,port:b("error"),field:k().optional()}),Du=w({kind:b("variable"),name:q}),Cb=te([_u,$u,Du,w({kind:b("value"),value:ut}),w({kind:b("unset")}),w({kind:b("default")}),w({kind:b("sources"),sources:A(te([_u,$u,Du])).min(1)})]),Pb=te([w({kind:b("value"),value:ut.optional(),schema:ut.optional()}),_u,$u,Du]),Eb=re(q,fs.inputs.element.shape.source).optional().describe("Tool input sources by name. The platform resolves types from the selected Action or workflow. New inputs default to model-provided; omitted existing sources are preserved."),RP=te([Ru.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:Eb}).strict(),ju.omit({id:!0,inputs:!0}).extend({inputs:Eb}).strict()]),_P=A(te([Ou,w({kind:b("workflow"),name:q,flowId:q}),Nu])),$P=w({...vt.connector.shape,messageHandle:q,inputs:re(q,te([w({kind:b("value"),value:ut}),w({kind:b("input"),input:q})]))}),ms=w({schema:ut.optional(),nullable:me().optional(),description:k().optional()}),Yn=re(q,ms.extend({default:ut.optional()})).describe("Optional business input constraints by name. A binding to a new Code, Agent, LLM, Wait or Approval input automatically declares an input accepting any JSON. Existing constraints are preserved. Omitted schema accepts any JSON; omitted nullable is true. Use default for inherited values; input.set supplies data."),Nb=re(q,ms).describe("Workflow input definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Supply call values as trigger.outputs."),DP=Nb.describe("Workflow output definitions by name. Omitted schema accepts any JSON; omitted nullable is true. No defaults. Set values on the Outputs node with input.set or node.add.inputs."),jb=re(q,ms.extend({schema:ut,nullable:me()})),Ab=re(q,ms).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Lu=w({left:Pb,operator:vt.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:Pb.optional()}),Tb=w({all:A(Lu)}),LP=te([Lu,Tb,w({any:A(te([Lu,Tb]))})]),Dt={"webhook-response":w({}),workflow:w({flowId:q}),start:w({inputDefs:Nb.default({})}),outputs:w({outputDefs:DP.default({})}),error:w({sourceFlowIds:A(q).optional()}),webhook:vt.webhook.omit({bodyFields:!0}).extend({body:Yn}).strict(),cron:w({schedule:vt.schedule}),poll:w({key:q,connectionId:q.optional(),schedule:vt.schedule}),integration:w({key:q,connectionId:q.optional()}),code:w({inputs:Yn,outputs:Ab,capabilities:_P.optional()}),connector:vt.connector.omit({outputMode:!0}).strict(),"connector-proxy":lo,openapi:Ib,"http-request":ss,"skip-duplicates":Wi,agent:vt.agent.omit({prompt:!0,tools:!0}).extend({inputs:Yn,resultSchema:ut.describe("JSON schema of the final result. Defaults to text. The tool manages the output definition; references can omit port."),tools:A(RP),notification:$P.optional()}).strict(),llm:Sb.extend({inputs:Yn}),decision:vt.decision,condition:w({match:U(["first","all"]),branches:A(w({name:q,description:k().optional(),when:LP}))}),value:w({values:Mu,outputs:Ab}),wait:w({inputs:Yn,autoContinue:vt.waitAutoContinue.optional().describe("Wait only. Omit to disable; clear config.autoContinue to remove. after counts from each wait registration; at requires an explicit offset and continues immediately if already past. Optional timezone preserves the editor zone; at remains the absolute instant. Server requires the deadline to precede the 7-day expiry.")}),approval:w({inputs:Yn})},MP={onError:U(["stop","error"]).optional(),name:q.optional(),description:k().optional(),icon:k().optional(),maxExecutions:Ne().positive().optional(),timeoutMs:M().nonnegative().optional(),retry:At.partial().optional().describe('Node retry policy for Code, Connector, OpenAPI, LLM and AI Decision. Omitted update fields preserve the policy; use clear: [["retry"]] to disable it. maxRetries counts additional attempts; intervalMs is 1000\u201360000 in whole seconds.')},zP=w({...MP,config:Mu.optional().describe('Recursively merge configuration; omitted fields remain unchanged and arrays replace as a whole. This includes schema objects: {} does not clear an existing schema. Use clear paths to remove fields, e.g. ["config","inputs","amount","schema","type"].')}),FP=gt("op",[w({op:b("node.add"),as:q.regex(/^[A-Za-z][\w-]*$/).describe("Unique batch-local alias without the $ prefix. Later edits must reference this new node as $alias; the bare alias is not its node ID."),type:zu,name:q,onError:U(["stop","error"]).optional(),retry:At.optional(),config:Mu.optional(),inputs:re(q,Cb).optional().describe("Input data sources, applied after creation, as input.set operations. Execution edges are separate."),code:k().optional(),prompt:k().optional()}),w({op:b("node.update"),node:Tt,set:zP.optional(),clear:A(A(q).min(1)).optional()}),w({op:b("node.refresh"),node:Tt,tool:q.optional().describe("Name of a workflow tool on an Agent or Code node. Omit for a Call Workflow node.")}),w({op:b("node.remove"),node:Tt}),w({op:b("input.set"),node:Tt,input:q,source:Cb}),w({op:U(["edge.connect","edge.disconnect"]),source:Tt,target:Tt,branch:q.optional()}),w({op:b("text.edit"),node:Tt,field:U(["code","prompt"]),oldText:q,newText:k()}),w({op:b("text.set"),node:Tt,field:U(["code","prompt"]),text:k()})]),er=w({baseRevision:q,requestId:q.max(256),edits:A(FP).min(1).max(1000)}),ys=w({revision:q.optional().describe("Fixed revision from a previous read; omit to read the current draft."),nodes:A(q).min(1).max(100).optional().describe("Node references to read in one batch. Mutually exclusive with text. Long texts return metadata."),text:w({node:q,field:U(["code","prompt"]),start:Ne().positive().default(1),lines:Ne().min(1).max(200).default(80)}).optional().describe("Read code or prompt by line (1-based). Mutually exclusive with nodes. Follow nextStart at the same revision until truncated is false.")}).refine((e)=>e.nodes==null||e.text==null,"Choose nodes or text.").meta({not:{required:["nodes","text"]},description:"Omit nodes and text for an outline; provide nodes for details, or text for an excerpt."}),Fu=w({revisionId:q}),gs=w({revision:q.optional(),query:q.max(1000),type:zu.optional(),offset:Ne().nonnegative().default(0),limit:Ne().min(1).max(100).default(20)}),qu=w({type:zu.optional(),action:q.optional()}).refine((e)=>e.type==null||e.action==null,"Choose type or action."),Ob={read:{schema:ys,guidance:"Read Start and Outputs node details for their interface definitions and data sources. Choose one mode: outline (omit nodes and text), node details (nodes), or text excerpt (text). nodes and text are mutually exclusive. Text defaults to 80 lines, at most 200 lines and 24000 characters. For the complete text, repeat at nextStart with the same revision until truncated is false.",examples:[{},{revision:"REVISION",nodes:["NODE"]},{revision:"REVISION",text:{node:"NODE",field:"prompt",start:1,lines:80}}]},search:{schema:gs,guidance:"Search names, configurations and text. Keep the returned revision when following nextOffset or reading a match.",examples:[{query:"Customer summary",type:"agent"}]},edit:{schema:er,guidance:'Edit Start config.inputDefs and Outputs config.outputDefs through node.add or node.update; clear paths are relative to the node, e.g. ["config","inputDefs","amount"]. Set Outputs values with input.set. Use the observed revision as baseRevision and a stable requestId. Edits are ordered and atomic. node.add.as declares a batch-local alias without $. Every later reference to that new node must use $alias, including node, edge source/target and output source node fields; a bare alias is not the node ID. Use returned node references in later batches. Updates recursively merge objects (including schemas); {} preserves existing fields. Arrays replace as a whole. Remove fields with clear paths. Text replacement requires exactly one match. Read the target text first. A saved draft can have validation diagnostics.',examples:[{baseRevision:"REVISION",requestId:"CREATE_REQUEST",edits:[{op:"node.add",as:"start",type:"start",name:"Start"},{op:"node.add",as:"step",type:"code",name:"Process",code:"export default ({value}) => ({result:value})"},{op:"edge.connect",source:"$start",target:"$step"},{op:"node.update",node:"$step",set:{description:"Created and connected in one atomic edit."}}]},{baseRevision:"REVISION",requestId:"REQUEST",edits:[{op:"text.edit",node:"NODE",field:"prompt",oldText:"Original rule.",newText:"Updated rule."}]}]},check:{schema:Fu,guidance:"Check a fixed revision. In the CLI, pass this identity with --revision REVISION.",examples:[{revisionId:"REVISION"}]}},qP=[...qo(ln).builtinModules].filter((e)=>!e.startsWith("node:")),VP=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${qP.join(", ")}, with or without the node: prefix; fs is a fresh in-memory filesystem containing /tmp per execution. require, dynamic import, packages and the http/net builtins are unavailable. To call HTTP APIs, declare their hosts in config.capabilities as {kind: "http", hosts: ["api.example.com", "*.example.org"]} and use context.fetch(url, {method, headers, body}); it returns status, ok, headers.get(), text(), json() and bytes(), does not follow redirects, adds no credentials, and limits bodies to 1 MiB. Prefer an HTTP Request node for a single call without transformation and Connector Actions for services with accounts. context provides inputs, signal, getPrevious(), fetch, actions, workflows, artifact, flowId, runId and blockId. Select workflows through config.capabilities: [{kind: "workflow", flowId, name}]. Call context.workflows.call(name, input) and await its business output. The platform derives input/output types. Refresh a selected workflow tool with node.refresh and tool: its name. Calls obey node and Run time limits.`;function Vu(e){if(!Object.hasOwn(Ob,e))return;let n=Ob[e];return{request:$n(n.schema,{io:"input"}),guidance:n.guidance,examples:n.examples}}function bs(e){return e==null?{types:hs,request:$n(er),guidance:"Read a node type schema before creating or configuring it. Use $alias to reference a preceding node.add in the same batch. Read returns stable node references. Long code and prompt fields use text reads and edits. Changes use the observed baseRevision and a stable requestId."}:{type:e,onError:e=="skip-duplicates"||e=="connector-proxy"||Su.some((n)=>n==e)?{enum:["stop","error"]}:!1,retry:Su.some((n)=>n==e)?$n(At):!1,inputSources:["poll","integration"].includes(e)?["value","unset","default"]:["start","outputs","error","cron","webhook","value","condition"].includes(e)?[]:["value","unset","default","output","system","variable","sources"],extensibleInputs:["code","agent","llm","wait","approval"].includes(e),guidance:e=="webhook-response"?'Prepare an HTTP response using fixed inputs body (any JSON, default empty text), statusCode (number, default 200) and headers (scalar-valued object, default {}). Select this node in Webhook options.responseBody as {kind: "webhook-response", nodeId: "node reference", timeoutMs: 30000}. Its first completion responds immediately while the Run continues. It has no business outputs. Multiple response nodes are allowed; each Webhook selects one reachable node.':e=="outputs"?"Declare output fields through config.outputDefs. Set their values through node.add.inputs or input.set. Outputs is a singleton execution sink; it waits for its predecessors and produces workflow business outputs independently of node logs. No downstream edges or data references to Outputs are allowed.":e=="webhook"?'Use options.responseBody: {kind: "webhook-response", nodeId: "node ID or $alias", timeoutMs: 30000} to respond on the selected node\u2019s first completion while the Run continues. Body, statusCode and headers come exclusively from that node; clear workflow-output-only status/header references when switching. Alternatively configure options.responseBody as {kind: "workflow-outputs", output?: "top-level output name", timeoutMs?: 30000} to respond after the Run succeeds. Omit output for the complete object. Connect Webhook to Outputs. Timeout is 1000\u201360000 ms; HTTP timeout does not cancel the Run. Strings return text; other values return JSON. Only in this mode, options.responseStatusCodeOutput can select a numeric top-level workflow output as the HTTP status, overriding the preserved fixed responseStatusCode (default 200). Its runtime value must be an integer from 200 to 599, excluding 204, 205, 304; missing or invalid values return 500. Use responseHeaders for fixed text headers. In workflow-output mode, responseHeaderOutputs maps header names to top-level output names; values can be string, number or boolean and are converted to text. Alternatively responseHeadersSource: {kind: "workflow-outputs", output?: "object field"} replaces the entire header object (omit output for all outputs), preserving but ignoring per-header settings. Missing, null, complex or invalid header values return 500 without fallback. Header restrictions and Content-Type policy still apply. Omit responseBody for immediate responseData. Clear options.responseBody, options.responseStatusCodeOutput, options.responseHeadersSource and options.responseHeaderOutputs explicitly to switch back.':e=="start"?"Declare workflow inputs through config.inputDefs; read them in Start node details. REST calls and manual runs supply them as trigger.outputs. Downstream nodes bind these parameters as Start outputs. Start has no input sources or defaults; non-nullable parameters are required, and omitted nullable parameters become null.":e=="condition"?"Edit branch operands through config.branches. A branch can test one expression, all expressions, or any alternatives. Unmatched execution uses branch otherwise.":["poll","integration"].includes(e)?"Configure static parameters with node.add.inputs or input.set. Definitions come from the selected Trigger key; execution output and variable sources are unavailable.":e=="llm"?"Configure model settings, message templates and history as defaults. Input bindings with the same names override these defaults; named business inputs can be bound directly. Template strings interpolate {{name}}.":e=="skip-duplicates"?"Bind an items array. Configure fields as dot-separated identity paths; an empty list uses each scalar item. Outputs are items and duplicates. History belongs to this node and commits only when the Run completes successfully. Fields accept strings or finite numbers; missing or complex values reject the batch.":e=="connector-proxy"?'Call a Provider API using its Connector account. Configure providerId, connectionId, method and query/headers modes and names. Bind endpoint, query.<name>/header.<name> or complete query/headers objects, and optional body. Setting or binding body automatically selects JSON; clearing it omits the body. Explicit null is a JSON body. Outputs: body, statusCode, headers, bodyEncoding. Proxy permissions are independent of Action permissions. Upstream HTTP errors remain response data when Connector returns a successful proxy result. Unsupported Providers fail at execution. Use connectionId: "" to defer account configuration. Retries are not supported.':e=="http-request"?"Configure method, query/headers modes and names, bodyFormat, authentication, responseFormat and statusPolicy. Bind url, query.<name>/header.<name> or whole query/headers objects, body and auth.token (Basic: auth.username/auth.password). Credentials accept variables or upstream outputs only. Outputs: body, statusCode, headers. Authentication is replaced as a complete choice.":e=="openapi"?"Select an operation; the tool resolves its ports and authentication. Read authenticationChoices from node details. authentication is replaced as a complete choice. Bind advertised credentials through inputs.":e=="workflow"?"Select another workflow with config.flowId. A workflow cannot call itself, including in a disconnected node. Owned unpublished or unavailable targets may be saved as incomplete drafts. Use node.refresh to load the current published interface.":e=="connector"?"Select an Action and account. The platform derives ports from its schema. Open or dynamic response objects expose the complete response as one output; closed objects expose named fields. Read the created node for output names. Bind the whole response for dynamic fields; declared direct properties also support output field selection. Local edits preserve saved ports and response mapping.":e=="agent"?'Tools accept Connector Actions or {kind: "workflow", flowId, name, description, approval, inputs}. Workflow parameter sources use model, input or value. The platform derives the interface. Refresh a workflow tool with node.refresh and tool: its name.':e=="code"?VP:"Supply business configuration and input data. Fixed definitions are assembled by the tool. Existing constraints and defaults are preserved on partial updates.",example:{op:"node.add",as:"step",type:e,name:"Step",...{start:{config:{inputDefs:{}}},outputs:{config:{outputDefs:{}}},workflow:{config:{flowId:"<Flow ID>"}},connector:{config:{action:"<Action ID>",connectionId:"<Connection ID>"}},"connector-proxy":{config:{providerId:"github",connectionId:""},inputs:{endpoint:{kind:"value",value:"/user"}}},poll:{config:{key:"<Trigger key>",schedule:[{type:"every",unit:"minute",value:5}]}},integration:{config:{key:"<Trigger key>"}},"skip-duplicates":{config:{fields:["id"]},inputs:{items:{kind:"value",value:[{id:"a"},{id:"b"}]}}},"http-request":{config:{},inputs:{url:{kind:"value",value:"https://example.com"}}},openapi:{config:{sourceUrl:"https://example.com/openapi.json",path:"/items",method:"get"}},code:{code:"export default ({value}) => ({result:value})",inputs:{value:{kind:"value",value:"Hello"}}},condition:{config:{match:"first",branches:[{name:"yes",when:{left:{kind:"value",value:120},operator:">",right:{kind:"value",value:100}}}]}},value:{config:{values:{threshold:100,region:"EU"}}},webhook:{config:{method:"POST",body:{orderId:{schema:{type:"string"},nullable:!1}}}},wait:{prompt:"Continue processing this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},approval:{prompt:"Approve this order?",inputs:{order:{kind:"value",value:{orderId:"A-1"}}}},llm:{config:{model:{model:"deepseek-v4-flash"},template:[{role:"user",content:"Summarize {{order}}."}]},inputs:{order:{kind:"value",value:{orderId:"A-1",total:42}}}},agent:{config:{model:"deepseek-v4-flash"},inputs:{orders:{kind:"value",value:[{orderId:"A-1",total:42}]}},prompt:"Summarize {{orders}}."}}[e]},configuration:$n(Dt[e].partial()),texts:e=="code"?["code"]:["agent","wait","approval"].includes(e)?["prompt"]:[]}}var Rb=E({code:q,message:k(),nodes:A(q),field:k().optional(),line:M().optional(),column:M().optional()}),_b=E({flowId:q,revisionId:q,valid:me(),diagnostics:A(Rb),version:b(1)}),$b=E({flowId:q,saved:b(!0),revision:q,nodes:re(q,q),changes:A(E({index:Ne(),op:q,node:q.optional()})),validation:E({status:U(["valid","invalid","unavailable"]),diagnostics:A(Rb).optional()}),version:b(1)}),Db=E({flowId:q,revision:q,data:E({nodes:A(re(k(),ut)).optional(),edges:A(ut).optional(),text:re(k(),ut).optional()}),version:b(1)}),Lb=E({flowId:q,revision:q,data:E({matches:A(E({node:q.optional(),field:q,line:Ne().optional(),excerpt:k()})),total:Ne(),nextOffset:Ne().optional()}),version:b(1)});var J={authenticationRequired:"authentication.required",authorizationDenied:"authorization.denied",bindingUnresolved:"binding.unresolved",connectorActionNotFound:"connector.action-not-found",connectorAccessConflict:"connector.access-conflict",connectorAccessInvalid:"connector.access-invalid",connectorAccessRequired:"connector.access-required",connectorAccessUnsupported:"connector.access-unsupported",connectorUnconfigured:"connector.unconfigured",connectorUnavailable:"connector.unavailable",connectorConsoleUnconfigured:"connector.console-unconfigured",engineUnavailable:"engine.unavailable",engineUnsupported:"engine.unsupported",eventSourceInvalid:"event-source.invalid",eventSourceIdentityUnavailable:"event-source.identity-unavailable",eventSourceNotFound:"event-source.not-found",eventSourceConflict:"event-source.conflict",flowInvalid:"flow.invalid",flowRepairRequired:"flow.repair-required",flowUpgradeRequired:"flow.upgrade-required",flowNotFound:"flow.not-found",flowBusy:"flow.busy",flowConflict:"flow.conflict",flowPresentationConflict:"flow.presentation-conflict",flowRevisionConflict:"flow.revision-conflict",liveConflict:"live.conflict",liveNotFound:"live.not-found",pageInvalidCursor:"page.invalid-cursor",publicationConflict:"publication.conflict",publicationNotFound:"publication.not-found",publicationUnsupported:"publication.unsupported",publishOperationNotFound:"publication.operation-not-found",routeNotFound:"route.not-found",runConflict:"run.conflict",runEventsExpired:"run.events-expired",runInvalid:"run.invalid",runNotFound:"run.not-found",runNotTerminal:"run.not-terminal",runOverloaded:"run.overloaded",runWaitNotFound:"run.wait-not-found",triggerKeyInvalid:"trigger-key.invalid",triggerKeyNotFound:"trigger-key.not-found",triggerNotFound:"trigger.not-found",tagInvalid:"tag.invalid",tagConflict:"tag.conflict",tagNotFound:"tag.not-found",variableInvalid:"variable.invalid",variableLimitReached:"variable.limit-reached",variableNotFound:"variable.not-found"},UP={[J.eventSourceInvalid]:{status:400},[J.eventSourceIdentityUnavailable]:{status:409},[J.eventSourceNotFound]:{status:404},[J.eventSourceConflict]:{status:409},[J.authenticationRequired]:{status:401},[J.authorizationDenied]:{status:403},[J.bindingUnresolved]:{status:409},[J.connectorActionNotFound]:{status:404},[J.connectorAccessConflict]:{status:412},[J.connectorAccessInvalid]:{status:409},[J.connectorAccessRequired]:{status:409},[J.connectorAccessUnsupported]:{status:409},[J.connectorUnconfigured]:{status:503},[J.connectorUnavailable]:{status:503},[J.connectorConsoleUnconfigured]:{status:503},[J.engineUnavailable]:{status:503},[J.engineUnsupported]:{status:409},[J.flowInvalid]:{status:400},[J.flowRepairRequired]:{status:409},[J.flowUpgradeRequired]:{status:409},[J.flowNotFound]:{status:404},[J.flowBusy]:{status:409},[J.flowConflict]:{status:409},[J.flowPresentationConflict]:{status:412},[J.flowRevisionConflict]:{status:412},[J.liveConflict]:{status:412},[J.liveNotFound]:{status:404},[J.pageInvalidCursor]:{status:400},[J.publicationConflict]:{status:409},[J.publicationNotFound]:{status:404},[J.publicationUnsupported]:{status:409},[J.publishOperationNotFound]:{status:404},[J.routeNotFound]:{status:404},[J.runConflict]:{status:409},[J.runEventsExpired]:{status:410},[J.runInvalid]:{status:400},[J.runNotFound]:{status:404},[J.runNotTerminal]:{status:409},[J.runOverloaded]:{status:429},[J.runWaitNotFound]:{status:404},[J.triggerKeyInvalid]:{status:409},[J.triggerKeyNotFound]:{status:404},[J.triggerNotFound]:{status:404},[J.tagInvalid]:{status:400},[J.tagConflict]:{status:409},[J.tagNotFound]:{status:404},[J.variableInvalid]:{status:400},[J.variableLimitReached]:{status:409},[J.variableNotFound]:{status:404}};class Re extends Error{constructor(e,n,t,r){super(t);this.code=n,this.details=r,this.name="ApiError",this.status=e}}class Mb extends Re{constructor(e){super(502,"response.invalid",`The Control API returned an invalid response.${e==null?"":` ${e}`}`);this.detail=e}}function f(e){throw new Mb(e)}function x(e){if(e==null||typeof e!="object"||Array.isArray(e))return f("Expected an object.");return e}function h(e){return typeof e=="string"&&e.length>0?e:f("Expected a non-empty string.")}function K(e,n){let t=n.filter((r)=>!Object.hasOwn(e,r));if(t.length>0)f(`Missing fields: ${t.join(", ")}.`)}function zb(e,n){let t=Object.keys(e);if(t.length!=n.length||t.some((r)=>!n.includes(r))){let r=n.filter((i)=>!Object.hasOwn(e,i)),o=t.filter((i)=>!n.includes(i));f([r.length>0?`Missing fields: ${r.join(", ")}.`:"",o.length>0?`Unexpected fields: ${o.join(", ")}.`:""].filter(Boolean).join(" "))}}function pe(e){return Number.isSafeInteger(e)?e:f("Expected a safe integer.")}function Ie(e){if(e===null||typeof e=="boolean"||typeof e=="string")return e;if(typeof e=="number"&&Number.isFinite(e))return e;if(Array.isArray(e))return e.map(Ie);let n=x(e);return Object.fromEntries(Object.entries(n).map(([t,r])=>[t,Ie(r)]))}function xs(e){if(e==null)return;return h(e)}function tr(e){let n=x(e),t=n.liveEnd==null?void 0:x(n.liveEnd);if(t!=null&&typeof t.enabled!="boolean")return f();let{operation:r,sourcePublicationId:o}=n;if(n.version!=1)return f();if(r!="publish"&&r!="rollback")return f();if(o!=null&&typeof o!="string")return f();return{...t==null?{}:{liveEnd:{enabled:t.enabled,endedAt:h(t.endedAt)}},actorId:h(n.actorId),closureDigest:h(n.closureDigest),createdAt:h(n.createdAt),engineContract:h(n.engineContract),flowId:h(n.flowId),modelVersion:pe(n.modelVersion),operation:r,publicationId:h(n.publicationId),sharedAccessDigest:h(n.sharedAccessDigest),revisionDigest:h(n.revisionDigest),revisionId:h(n.revisionId),...o==null?{}:{sourcePublicationId:o},version:1}}function Bu(e){let n=x(e),t=n.status,r={createdAt:h(n.createdAt),flowId:h(n.flowId),operationId:h(n.operationId),revisionId:h(n.revisionId),updatedAt:h(n.updatedAt),version:1};if(n.version!=1)return f();switch(t){case"pending":return K(n,["createdAt","flowId","operationId","revisionId","status","updatedAt","version"]),{...r,status:t};case"succeeded":return K(n,["createdAt","flowId","operationId","publicationId","revisionId","status","updatedAt","version"]),{...r,publicationId:h(n.publicationId),status:t};case"failed":{K(n,["createdAt","flowId","issue","operationId","revisionId","status","updatedAt","version"]);let o=x(n.issue),i=o.nodeId;return K(o,["code","message",...i==null?[]:["nodeId"]]),{...r,issue:{code:h(o.code),message:h(o.message),...i==null?{}:{nodeId:h(i)}},status:t}}default:return f()}}function Uu(e){let n=x(e),{status:t,publication:r}=n;if(n.version!=1||typeof n.hasUnpublishedChanges!="boolean")return f();if(t!="not-published"&&t!="runnable"&&t!="suspended")return f();if(t=="not-published"&&r!==null)return f();if(t!="not-published"&&r===null)return f();return{flowId:h(n.flowId),hasUnpublishedChanges:n.hasUnpublishedChanges,publication:r===null?null:tr(r),revision:pe(n.revision),status:t,version:1}}function Fb(e){let n=x(e),{nextCursor:t,total:r}=n;if(n.version!=1||!Array.isArray(n.publications))return f();if(t!=null&&typeof t!="string")return f();if(r!=null&&!Number.isSafeInteger(r))return f();return{...t==null?{}:{nextCursor:t},publications:n.publications.map(tr),...r==null?{}:{total:r},version:1}}var qb=A(te([w({handle:k().min(1),description:k().optional(),jsonSchema:De(),nullable:me(),value:De().optional()}),w({group:k(),collapsed:me().optional()})]));function Ju(e){let n=x(e),t=n.type;if(t!="integration"&&t!="poll")return f();return{description:typeof n.description=="string"?n.description:f(),displayName:h(n.displayName),key:h(n.key),name:h(n.name),provider:h(n.provider),type:t}}function nr(e){let n=x(e),t=Ju(n),r={configInputs:qb.parse(n.configInputs),definitionVersion:n.definitionVersion===2?2:f(),description:t.description,displayName:t.displayName,key:t.key,name:t.name,outputs:(Array.isArray(n.outputs)?n.outputs:f()).map((l)=>{let u=x(l);return Object.assign({handle:h(u.handle),jsonSchema:Ie(u.jsonSchema),nullable:typeof u.nullable==="boolean"?u.nullable:f()},u.description==null?{}:{description:h(u.description)})}),provider:t.provider};if(t.type=="poll")return{...r,type:"poll"};let o=x(n.endpoint),i=x(o.body);if(!Array.isArray(o.methods)||!Array.isArray(i.formats)||typeof i.allowArray!="boolean"||typeof i.allowEmpty!="boolean")return f();let s=o.methods.map(h),a=i.formats.map(h),c=pe(o.successStatus);if(s.some((l)=>!["DELETE","GET","HEAD","PATCH","POST","PUT"].includes(l))||a.some((l)=>!["form","json","multipart","text"].includes(l))||c<200||c>299)return f();return{...r,endpoint:{body:{allowArray:i.allowArray,allowEmpty:i.allowEmpty,formats:a},methods:s,successStatus:c},type:"integration"}}var JP=new Set(["error","cron","integration","poll","webhook"]),ZP=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),KP=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function go(e){let n=x(e),t=n.health,r=n.listener==null?void 0:x(n.listener);if(r!=null&&r.health!="healthy"&&r.health!="failed"&&r.health!="needs_reauth")return f();let o=n.kind,i=pe(n.runtimeVersion);if(n.version!=1||typeof t!="string"||!ZP.has(t))return f();if(typeof o!="string"||!JP.has(o))return f();if(i<=0)return f();return{...n.currentPublicationId==null?{}:{currentPublicationId:h(n.currentPublicationId)},...n.currentRevisionId==null?{}:{currentRevisionId:h(n.currentRevisionId)},...n.endpointUrl==null?{}:{endpointUrl:h(n.endpointUrl)},...r==null?{}:{listener:{health:r.health,...r.lastErrorCode==null?{}:{lastErrorCode:h(r.lastErrorCode)}}},flowId:h(n.flowId),health:t,kind:o,...n.lastErrorCode==null?{}:{lastErrorCode:h(n.lastErrorCode)},runtimeVersion:i,triggerNodeId:h(n.triggerNodeId),updatedAt:h(n.updatedAt),version:1}}function Vb(e){let n=x(e);if(n.version!=1)return f();return{binding:go(n.binding),version:1}}function WP(e){let n=x(e),t=n.kind;if(typeof t!="string"||!KP.has(t))return f();let r=xs(n.errorCode),o=xs(n.errorMessage);if(o!=null&&o.length>512)return f();return{activityId:h(n.activityId),createdAt:h(n.createdAt),...r==null?{}:{errorCode:r},...o==null?{}:{errorMessage:o},kind:t}}function Bb(e){let n=x(e),t=xs(n.nextCursor);if(n.version!=1||!Array.isArray(n.activities))return f();return{activities:n.activities.map(WP),...t==null?{}:{nextCursor:t},version:1}}function Ub(e){let n=x(e),t=pe(n.filtered);if(n.version!=1||!Array.isArray(n.events)||typeof n.hasMore!="boolean"||t<0)return f();return{events:n.events.map((r)=>{let o=x(r);return Object.fromEntries(Object.entries(o).map(([i,s])=>[i,Ie(s)]))}),filtered:t,hasMore:n.hasMore,version:1}}var vn={nodeId:k().min(1),name:k(),description:k().optional()},bo=mt().transform(go),Jb={provider:k().min(1),inputs:re(k(),gt("kind",[E({kind:b("value"),value:De()}),E({kind:b("unset")})]))},GP=gt("type",[E({...vn,type:b("start"),config:Dt.start}),E({...vn,type:b("manual"),config:E({})}),E({...vn,type:b("webhook"),config:Dt.webhook,binding:bo}),E({...vn,type:b("cron"),config:Dt.cron,binding:bo}),E({...vn,type:b("error"),config:Dt.error,binding:bo}),E({...vn,...Jb,type:b("poll"),config:Dt.poll,binding:bo}),E({...vn,...Jb,type:b("integration"),config:Dt.integration,binding:bo})]);function Zb(e){let n=x(e),t=h(n.flowId);if(n.version!=1||!Array.isArray(n.entries))return f();if(n.publication===null){if(n.inputDefs!==null||n.status!="not-published"||n.entries.length!=0||Object.hasOwn(n,"enabled"))return f();return{flowId:t,inputDefs:null,publication:null,status:"not-published",entries:[],version:1}}let r=tr(n.publication),o=n.status;if(r.flowId!=t||typeof n.enabled!="boolean")return f();if(o!="runnable"&&o!="suspended")return f();if(!n.enabled&&n.status=="runnable")return f();let i=jb.safeParse(n.inputDefs);if(!i.success)return f();return{flowId:t,inputDefs:i.data,publication:r,status:o,enabled:n.enabled,entries:QP(n.entries,r),version:1}}function QP(e,n){let t=A(GP).safeParse(e);if(!t.success)return f();let r=new Set;for(let o of t.data){if(r.has(o.nodeId))return f();if(r.add(o.nodeId),o.type!="start"&&o.type!="manual"&&(o.binding.flowId!=n.flowId||o.binding.triggerNodeId!=o.nodeId||o.binding.kind!=o.type||o.binding.currentPublicationId!=n.publicationId||o.binding.currentRevisionId!=n.revisionId))return f();if(o.type=="webhook"&&(!o.binding.endpointUrl||!is(o.config.method)&&Object.keys(o.config.body).length>0))return f()}return t.data}function ws(e,n){if(!e||typeof e!="object"||!n||typeof n!="object")return{};let t=e,r=n;if(typeof t.version!="string"||![t.pixelRatio,t.iconSize,t.width,t.height].every((o)=>Number.isInteger(o)&&o>0)||![t.bleed,r.x,r.y].every((o)=>Number.isInteger(o)&&o>=0)||r.x+t.iconSize>t.width||r.y+t.iconSize>t.height)return{};try{for(let o of[t.lightUrl,t.darkUrl])if(typeof o!="string"||!["https:","http:","data:"].includes(new URL(o).protocol))return{}}catch{return{}}return{iconSprite:t,iconSpritePosition:{x:r.x,y:r.y}}}function Kb(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Wb(e){return{...e,cases:e.cases.map((n)=>({...n,groups:n.groups.map((t)=>({...t,expressions:t.expressions.map((r)=>({...r,left:Kb(r.left),...r.right==null?{}:{right:Kb(r.right)}}))}))}))}}var Ku=80;function xo(e){let n=e.trim();if(n.length==0)return"empty";if(n.length>Ku)return"tooLong";for(let t of n){let r=t.charCodeAt(0);if(r<=31||r>=127&&r<=159)return"controlCharacter"}if(!/^[\p{L}\p{N}](?:[\p{L}\p{N} _-]*[\p{L}\p{N}])?$/u.test(n))return"specialCharacter"}function Xb(e,n){let t=e=="jira.on_issue_event"||e=="intercom.on_conversation_event"||e=="sentry.on_issue_alert"||e=="zoom.on_recording_ready"||e=="fireflies.on_meeting_ready"?["sourceId","eventTypes"]:e=="slackbot.on_event"?["sourceId","eventTypes","channelIds"]:e=="feishu_app_bot.on_event"?["sourceId","eventTypes","resource","chatIds"]:e=="linear.on_issue_changed"?["teamId","stateIds"]:[];return{...n,...Object.fromEntries(t.map((r)=>[r,{kind:"unset"}]))}}function Yb(e,n){return{...e,nodes:Object.fromEntries(Object.entries(e.nodes).map(([t,r])=>{if((r.kind=="poll"||r.kind=="integration")&&(n==null||r.connectionId==n)){let{connectionId:i,...s}=r;return[t,s]}if(r.kind!="task")return[t,r];if("executor"in r.task){let i=r.task.executor,s=(a)=>{if(a.connectionId==="")return a;if(n!=null&&a.connectionId!=n)return a;let{connectionId:c,...l}=a;return l};if(i.kind=="connector"||i.kind=="connector-proxy")return[t,{...r,task:{...r.task,executor:s(i)}}];if(i.kind=="agent")return[t,{...r,task:{...r.task,executor:{...i,tools:i.tools.map(s),...i.notification==null?{}:{notification:s(i.notification)}}}}];return[t,r]}let o=r.task.capabilities?.map((i)=>{if(i.kind=="workflow"||i.kind=="http")return i;if(!("mode"in i)){if("action"in i){let{connectionId:s,...a}=i;return{...a,connections:i.connections.filter((c)=>n!=null&&c.connectionId!=n),...s!=null&&n!=null&&s!=n?{connectionId:s}:{}}}return{...i,...n==null&&(i.connectionHints?.length??0)>0?{actionHints:[...new Set([...i.actionHints??[],...i.connectionHints.map((s)=>s.action)])]}:{},...i.connectionHints==null?{}:{connectionHints:i.connectionHints.filter((s)=>n!=null&&s.connectionId!=n)}}}if(i.mode!="independent")return i;return{...i,actions:i.actions.map((s)=>{if(s.connectionId==="")return s;if(n!=null&&s.connectionId!=n)return s;let{connectionId:a,...c}=s;return c})}});return[t,o==null?r:{...r,task:{...r.task,capabilities:o}}]}))}}var nE=w({kind:b("open-flow-workflow"),version:b(1),name:k().optional(),icon:k().optional(),description:k().optional(),content:mt(),presentation:re(k(),De()).optional()});function nn(e){xt(e,-1);let n=nE.parse(e);return{...n,content:Xn(n.content)}}function ex(e){if(e.kind!="sources"||!e.sources.some((t)=>t.kind=="binding"))return e;let n=e.sources.filter((t)=>t.kind!="binding");return n.length==0?{kind:"unset"}:{kind:"sources",sources:n}}function Wu(e){let n=nn(e),t=n.content.document.graph,r=Yb(t),o=Object.fromEntries(Object.entries(r.nodes).map(([i,s])=>{let a=s;if("inputs"in a)a={...a,inputs:Object.fromEntries(Object.entries(a.inputs).map(([c,l])=>[c,ex(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,ex(l)]))};if(a.kind=="condition")a=Wb(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Xb(a.definition.key,a.config)};return[i,a]}));return{file:{...n,content:{...n.content,document:{...n.content.document,bindings:{},graph:{...r,nodes:o}}}},summary:{changedNodeIds:Object.keys(o).filter((i)=>!je(o[i],t.nodes[i])),removedBindings:Object.keys(n.content.document.bindings).length}}}function tx(e,n={}){return`${JSON.stringify(n.clean===!1?nn(e):Wu(e).file,null,2)}
65
+ `}function nx(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var rx=A(w({flowId:k().min(1),file:mt()})).min(1),rE=w({kind:b("open-flow-workflow-bundle"),version:b(1),entryFlowId:k().min(1),workflows:rx}),oE=w({version:b(1),entryFlowId:k().min(1),workflows:rx,unavailableFlowIds:A(k().min(1))});function ox(e,n,t=[]){let r=e.map(({flowId:s,file:a})=>({flowId:s,file:nn(a)})),o=new Set(r.map(({flowId:s})=>s));if(o.size!=r.length||!o.has(n))throw TypeError("Workflow identities must be unique and include the entry workflow.");let i=new Set(t);if(i.size!=t.length||t.some((s)=>o.has(s)))throw TypeError("Invalid unavailable workflow identities.");for(let{file:s}of r)for(let a of Object.values(s.content.document.graph.nodes))for(let{target:c}of rs(a))if(c.flowId&&!o.has(c.flowId)&&!i.has(c.flowId))throw TypeError("A referenced workflow is missing from the bundle.");return r}function ix(e){xt(e,-4);let n=rE.parse(e);return{...n,workflows:ox(n.workflows,n.entryFlowId)}}function sx(e){xt(e,-4);let n=oE.parse(e);return{...n,workflows:ox(n.workflows,n.entryFlowId,n.unavailableFlowIds)}}function ax(e){let n=ix(e);return{...n,workflows:n.workflows.map(({flowId:t,file:r})=>({flowId:t,file:Wu(r).file}))}}function cx(e){if(e.unavailableFlowIds.length)throw TypeError("Some referenced workflows are unavailable.");return ax({kind:"open-flow-workflow-bundle",version:1,entryFlowId:e.entryFlowId,workflows:e.workflows})}function lx(e){return`${JSON.stringify(ax(e),null,2)}
66
+ `}function ux(e){let n=JSON.parse(e);return n!=null&&typeof n=="object"&&"kind"in n&&n.kind=="open-flow-workflow-bundle"?ix(n):nn(n)}var sE=gt("kind",[w({kind:b("admin-delegation")}),w({kind:b("policy"),ruleId:k().min(1).nullable()})]);function Is(e){return sE.parse(e)}function mx(e){let n=x(e);if(!Array.isArray(n.bots))return f("Leina bots: expected an array.");let t=n.bots.map((r)=>{let o=x(r);if(!Array.isArray(o.platforms))return f("Leina platforms: expected an array.");return{leinaId:h(o.leinaId),name:h(o.name),status:h(o.status),platforms:o.platforms.map(h)}});if(new Set(t.map((r)=>r.leinaId)).size!=t.length)return f("Leina bots: duplicate identifiers.");return t}function aE(e){let n=x(e);if(K(n,["actionIds","allActions","triggerIds","allTriggers","configured","proxy"]),!Array.isArray(n.actionIds))return f("permissions.actionIds: expected an array.");if(!Array.isArray(n.triggerIds))return f("permissions.triggerIds: expected an array.");if(typeof n.allActions!="boolean")return f("permissions.allActions: expected a boolean.");if(typeof n.allTriggers!="boolean")return f("permissions.allTriggers: expected a boolean.");if(typeof n.configured!="boolean")return f("permissions.configured: expected a boolean.");if(typeof n.proxy!="boolean")return f("permissions.proxy: expected a boolean.");let t=n.actionIds.map(h),r=n.triggerIds.map(h);if(new Set(t).size!=t.length)return f("permissions.actionIds: duplicate IDs.");if(n.allActions&&t.length!=0)return f("permissions.actionIds: must be empty when allActions is true.");if(new Set(r).size!=r.length)return f("permissions.triggerIds: duplicate IDs.");if(n.allTriggers&&r.length!=0)return f("permissions.triggerIds: must be empty when allTriggers is true.");if(n.proxy&&(!n.allActions||!n.allTriggers||n.configured))return f("permissions.proxy: requires allActions=true, allTriggers=true and configured=false.");return{actionIds:t,triggerIds:r,allTriggers:n.allTriggers,allActions:n.allActions,configured:n.configured,proxy:n.proxy}}function yx(e,n){let t=x(e),{policyRevision:r,status:o,isDefault:i}=t,s=Object.hasOwn(t,"displayName")&&!Object.hasOwn(t,"connectionDisplayName"),a=n&&Object.hasOwn(t,"permissions")?aE(t.permissions):void 0,c=t.permissionGroupName;if(K(t,["accessBindingId","connectionId","source",s?"displayName":"connectionDisplayName","providerId",...n?[]:["status"]]),r!==void 0&&typeof r!="string")return f("policyRevision: expected a string.");if(n&&i!==void 0&&typeof i!="boolean")return f("isDefault: expected a boolean.");if(c!==void 0&&c!==null&&typeof c!="string")return f("permissionGroupName: expected a string or null.");if(!n&&o!="active"&&o!="forbidden"&&o!="invalid"&&o!="missing")return f();let l;try{l=Is(t.source)}catch{return f("source: expected { kind: 'admin-delegation' } or { kind: 'policy', ruleId: string | null }.")}return{accessBindingId:h(t.accessBindingId),connectionId:h(t.connectionId),source:l,connectionDisplayName:h(s?t.displayName:t.connectionDisplayName),...n&&typeof i=="boolean"?{isDefault:i}:{},...a==null?{}:{permissions:a},...c===void 0?{}:{permissionGroupName:c},...r==null?{}:{policyRevision:r},providerId:h(t.providerId),...n?{}:{status:o}}}function Hu(e){if(e!="implicit"&&e!="selectable")return f("mode: expected implicit or selectable.");return e}function rr(e){let n=x(e);K(n,["accessRevision","bindings","mode","sharedAccessDigest","version"]);let t=pe(n.accessRevision);if(n.version!=1||t<0||!Array.isArray(n.bindings))return f();if("providerIds"in n&&!Array.isArray(n.providerIds))return f();let r=n.providerIds==null?void 0:n.providerIds.map((s)=>h(s));if(r!=null&&new Set(r).size!=r.length)return f();let o=n.discardedBindingCount==null?0:pe(n.discardedBindingCount);if(o<0)return f();let i=[];for(let s of n.bindings)try{i.push(yx(s,!1))}catch(a){if(!(a instanceof Re)||a.code!="response.invalid")throw a;if(s!=null&&typeof s=="object"&&!Array.isArray(s)&&typeof s.accessBindingId=="string"&&s.accessBindingId.length>0&&typeof s.providerId=="string"&&s.providerId.length>0)i.push({accessBindingId:s.accessBindingId,providerId:s.providerId,connectionId:null,source:null,status:"invalid",connectionDisplayName:typeof s.connectionDisplayName=="string"&&s.connectionDisplayName.length>0?s.connectionDisplayName:typeof s.displayName=="string"&&s.displayName.length>0?s.displayName:s.providerId,permissionGroupName:typeof s.permissionGroupName=="string"?s.permissionGroupName:null});else o++}if(new Set(i.map((s)=>s.accessBindingId)).size!=i.length)return f();return{accessRevision:t,...o==0?{}:{discardedBindingCount:o},...r==null?{}:{providerIds:r},bindings:i,mode:Hu(n.mode),sharedAccessDigest:h(n.sharedAccessDigest),version:1}}function fx(e){if(!Array.isArray(e))return f();let n=e.map((t)=>{let r=x(t);K(r,["accessBindingId","connectionId","providerId","source","connectionDisplayName"]);let o;try{o=Is(r.source)}catch{return f()}if(r.permissionGroupName!=null&&typeof r.permissionGroupName!="string")return f();return{accessBindingId:h(r.accessBindingId),connectionId:h(r.connectionId),providerId:h(r.providerId),source:o,connectionDisplayName:h(r.connectionDisplayName),..."permissionGroupName"in r?{permissionGroupName:r.permissionGroupName}:{}}});if(new Set(n.map((t)=>t.accessBindingId)).size!=n.length)return f();return n}function Gu(e){let n=x(e);if(K(n,["mode","sharedAccessDigest","sharedBindings","selectedBindings","version"]),n.version!=2)return f();let t=Hu(n.mode),r=fx(n.sharedBindings),o=fx(n.selectedBindings);if(t=="implicit"&&(r.length>0||o.length>0))return f();return{mode:t,sharedAccessDigest:h(n.sharedAccessDigest),sharedBindings:r,selectedBindings:o,version:2}}function cE(e,n){let t=x(e);if(K(t,["candidates","mode","providerId","version"]),t.version!=1)return f("version: expected 1.");if(h(t.providerId)!=n)return f("providerId: does not match the requested provider.");if(!Array.isArray(t.candidates))return f("candidates: expected an array.");let r=t.candidates.map((o)=>yx(o,!0));if(r.some((o)=>o.providerId!=n))return f("candidates[].providerId: does not match the requested provider.");if(new Set(r.map((o)=>o.accessBindingId)).size!=r.length)return f("candidates[].accessBindingId: duplicate IDs.");return{candidates:r,mode:Hu(t.mode),providerId:n,version:1}}function gx(e,n){let t=x(e);if(K(t,["results","version"]),t.version!=1)return f("version: expected 1.");if(!Array.isArray(t.results))return f("results: expected an array.");let r=new Set(n),o=t.results.map((i)=>{let s=x(i),a=h(s.providerId);if(!r.delete(a))return f("results[].providerId: duplicate or unrequested provider.");if(!Object.hasOwn(s,"error"))return cE(s,a);K(s,["providerId","error"]);let c=x(s.error);return K(c,["code","message"]),{providerId:a,error:{code:h(c.code),message:h(c.message)}}});if(r.size!=0)return f("results: missing requested providers.");return{results:o,version:1}}function or(e){let n=x(e);if(K(n,[...Object.hasOwn(n,"providerAccountId")?["providerAccountId"]:[],...Object.hasOwn(n,"alias")?["alias"]:[],...Object.hasOwn(n,"builtInAccount")?["builtInAccount"]:[],"connectionId","displayName","isDefault","serviceId","status"]),n.builtInAccount!==void 0&&typeof n.builtInAccount!="boolean")return f();let t=n.status;if(t!="active"&&t!="disconnected"&&t!="error"&&t!="reauth_required")return f();if(typeof n.isDefault!="boolean")return f();return{...n.providerAccountId===void 0?{}:{providerAccountId:h(n.providerAccountId)},...n.alias===void 0?{}:{alias:h(n.alias)},...n.builtInAccount===void 0?{}:{builtInAccount:n.builtInAccount},connectionId:h(n.connectionId),displayName:h(n.displayName),isDefault:n.isDefault,serviceId:h(n.serviceId),status:t}}function bx(e,n=!1){let t=x(e),r=t.description,o=n&&Object.hasOwn(t,"value");if(K(t,["jsonSchema","nullable",...r==null?[]:["description"],...o?["value"]:[]]),r!=null&&typeof r!="string")return f();if(typeof t.nullable!="boolean")return f();return{...r==null?{}:{description:r},jsonSchema:Ie(t.jsonSchema),nullable:t.nullable,...o?{value:Ie(t.value)}:{}}}function lE(e){return bx(e,!0)}function hx(e,n){return Object.fromEntries(Object.entries(x(e)).map(([t,r])=>[t,n(r)]))}function wo(e){let n=x(e),{homepageUrl:t,icon:r}=n;if(K(n,["actionId",...Object.hasOwn(n,"operationType")?["operationType"]:[],...Object.hasOwn(n,"inputSchema")?["inputSchema"]:[],...Object.hasOwn(n,"outputSchema")?["outputSchema"]:[],"authenticated","description",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[],"inputs","name","outputs","serviceId","serviceName"]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return f();return{...n.inputSchema===void 0?{}:{inputSchema:Ie(n.inputSchema)},...n.outputSchema===void 0?{}:{outputSchema:Ie(n.outputSchema)},actionId:h(n.actionId),...n.operationType==null?{}:{operationType:h(n.operationType)},authenticated:typeof n.authenticated=="boolean"?n.authenticated:f(),description:typeof n.description=="string"?n.description:f(),...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...ws(n.iconSprite,n.iconSpritePosition),inputs:hx(n.inputs,lE),name:h(n.name),outputs:hx(n.outputs,bx),serviceId:h(n.serviceId),serviceName:h(n.serviceName)}}function Cs(e){let{defaultConnection:n,...t}=x(e),r=wo(t);if(n==null)return r;let o=or(n);if(o.serviceId!=r.serviceId||o.status!="active")return f();return{...r,defaultConnection:o}}function xx(e){let n=x(e),{homepageUrl:t,icon:r}=n;if(n.noSetup!==void 0&&typeof n.noSetup!="boolean")return f();if(K(n,[...Object.hasOwn(n,"noSetup")?["noSetup"]:[],"serviceId","serviceName",...t==null?[]:["homepageUrl"],...r==null?[]:["icon"],..."iconSprite"in n?["iconSprite"]:[],..."iconSpritePosition"in n?["iconSpritePosition"]:[]]),t!=null&&typeof t!="string"||r!=null&&typeof r!="string")return f();return{...t==null?{}:{homepageUrl:t},...r==null?{}:{icon:r},...ws(n.iconSprite,n.iconSpritePosition),serviceId:h(n.serviceId),serviceName:h(n.serviceName),...n.noSetup===void 0?{}:{noSetup:n.noSetup}}}function Yu(e){return{actionId:e.actionId,authenticated:e.authenticated,...e.defaultConnection==null?{}:{defaultConnection:{connectionId:e.defaultConnection.connectionId,displayName:e.defaultConnection.displayName,status:e.defaultConnection.status}},description:e.description,name:e.name,serviceId:e.serviceId,serviceName:e.serviceName}}var ir=k().min(1).max(256),wx=E({appId:ir.nullable(),workspaceId:ir.optional(),installationId:ir.optional(),organizationId:ir.optional(),projectId:ir.optional(),projectKey:ir.optional(),subscriptionStatus:U(["idle","pending","ready","error"]).optional(),lastError:k().optional(),signingSecretConfigured:me().optional(),manageSubscriptions:me().nullable(),verificationTokenConfigured:me().nullable(),encryptKeyConfigured:me().nullable(),verifiedAt:k().nullable()});var sr=k().min(1).max(256),yE=k().regex(/^[a-z][a-z0-9_.:]{0,127}$/),gE=k().trim().min(1).max(128),vx=E({version:b(1),sourceId:sr,revision:Ne().positive(),name:gE,provider:U(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...wx.shape,connectionId:sr,teamId:sr.nullable(),enabled:me(),eventTypes:A(yE),endpointUrl:k().nullable(),lastReceivedAt:k().nullable(),updatedAt:k(),consumers:A(E({flowId:sr,flowName:k(),triggerNodeId:sr}))});function Ps(e){return vx.parse(e)}function ed(e){return E({version:b(1),sources:A(vx),teamId:sr.nullable().optional()}).parse(e)}function Es(e){let n=x(e);if(K(n,["version","locale","definitions","display"]),n.version!=3||!Wd(n.locale)||!Array.isArray(n.definitions))return f();let t=n.definitions.map(nr),r=x(n.display),o=new Set(t.map((s)=>s.key));if(o.size!=t.length||Object.keys(r).length!=o.size)return f();let i=Object.fromEntries(t.map((s)=>{let{key:a}=s,c=x(r[a]);return K(c,["configInputs","configInputLabels","displayName","description","outputs"]),[a,{configInputs:kx(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:bE(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:h(c.displayName),description:h(c.description),outputs:kx(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:n.locale,definitions:t,display:i}}function kx(e,n){let t=x(e);return zb(t,n),Object.fromEntries(Object.entries(t).map(([r,o])=>[r,h(o)]))}function bE(e,n){let t=x(e);if(Object.keys(t).some((r)=>!n.includes(r)))return f();return Object.fromEntries(Object.entries(t).map(([r,o])=>{let i=h(o);return i.trim().length==0?f():[r,i]}))}function td(e,n){if(n==null)return e;let t=n.toLowerCase();return e.filter((r)=>[r.description,r.displayName,r.key,r.name,r.provider,r.type].some((o)=>o.toLowerCase().includes(t)))}var xE=w({pointer:k().max(4096).default(""),offset:M().int().nonnegative().default(0),limit:M().int().min(1).max(100).default(20),maxBytes:M().int().min(1).max(1048576).default(15000)});var wE=De(),Sx=E({pointer:k(),type:U(["object","array","string","number","boolean","null"]),length:M().int().nonnegative().optional(),complete:me(),value:wE.optional()}),vE=Sx.extend({offset:M().int().nonnegative(),nextOffset:M().int().positive().optional(),entries:A(Sx).optional()}),Ix=E({resultId:k().min(1),callId:k().min(1),toolId:k().min(1),source:gt("kind",[E({kind:b("connector"),action:k().min(1)}),E({kind:b("code")}),E({kind:b("workflow"),flowId:k().min(1)})]),bytes:M().int().nonnegative(),digest:k().regex(/^[a-f0-9]{64}$/),createdAt:k().datetime()}),kE=E({version:b(1),runId:k(),results:A(Ix),nextAfter:k().optional()}),SE=E({version:b(1),runId:k(),result:Ix,page:vE});function nd(e){return kE.parse(e)}function rd(e){return SE.parse(e)}function IE(e){if(e==null||typeof e!="object"||Array.isArray(e))return;let n=e;if(n.version!==1||!Object.hasOwn(n,"body")||!(n.etag===null||typeof n.etag=="string")||typeof n.validatedAt!="number"||!Number.isFinite(n.validatedAt)||n.validatedAt<0)return;return{version:1,body:Ie(n.body),etag:n.etag,validatedAt:n.validatedAt}}function CE(e,n){if(n==null)return e;if(n.aborted)return e.catch(()=>{}),Promise.reject(n.reason);return new Promise((t,r)=>{let o=()=>r(n.reason);n.addEventListener("abort",o,{once:!0}),e.then(t,r).finally(()=>n.removeEventListener("abort",o))})}class od{#e;constructor(e){this.#e=new Map;if(this.options=e,!e.scope.trim())throw TypeError("Control cache scope must be nonempty.");if(e.maxAgeMs!=null&&(!Number.isFinite(e.maxAgeMs)||e.maxAgeMs<0))throw TypeError("Control cache maxAgeMs must be finite and nonnegative.")}async read(e,n,t,r,o=!1){r?.throwIfAborted();let i=JSON.stringify(["open-flow:catalog",1,this.options.scope,e.path]),s=await CE(this.#t(i,e,n,this.options.maxAgeMs??t,o||this.options.mode=="refresh"),r),a=e.decode(structuredClone(s.body));try{this.options.onRead?.({...s,body:structuredClone(s.body)})}catch{}return{data:a,etag:s.etag}}#t(e,n,t,r,o){let i=this.#e.get(e);if(i!=null){if(!o||i.fresh)return i.promise;return i.promise.catch(()=>{return}).then(()=>this.#t(e,n,t,r,!0))}let s=this.#n(e,n,t,r,o).finally(()=>{if(this.#e.get(e)?.promise===s)this.#e.delete(e)});return this.#e.set(e,{fresh:o,promise:s}),s}async#n(e,n,t,r,o){let i;try{let u=await this.options.delegate.get(e);if(i=IE(u),i!=null)n.decode(structuredClone(i.body));if(u!==void 0&&i==null)await this.options.delegate.delete(e)}catch{i=void 0;try{await this.options.delegate.delete(e)}catch{}}let s=Date.now(),a=i==null||i.validatedAt>s||s-i.validatedAt>=r;if(i!=null&&(this.options.mode=="offline"||!o&&!a))return{...i,path:n.path,source:"cache",stale:a};if(this.options.mode=="offline")throw new Re(503,"catalog.cache-miss",`No compatible cached response for ${n.path}.`);let c=await t(i?.etag??null);if(!c.modified&&i==null)throw new Re(502,"response.invalid","A catalog returned 304 without a cached response.");let l={version:1,body:c.modified?c.data:i.body,etag:c.etag??(c.modified?null:i.etag),validatedAt:Date.now()};n.decode(structuredClone(l.body));try{await this.options.delegate.set(e,structuredClone({...l}))}catch{}return{...l,path:n.path,source:c.modified?"network":"revalidated",stale:!1}}}function Cx(e){if(!Array.isArray(e))return f();return e.map((n)=>typeof n=="string"||Number.isSafeInteger(n)?n:f())}function PE(e){let n=x(e),t=h(n.kind);if(t=="artifact"||t=="binary"||t=="nullable")return{kind:t};if(t=="schema")return{kind:t,path:n.path==null?void 0:Cx(n.path)};if(t!="keyword"||typeof n.keyword!="string"||!ns(n.keyword))return f();return{kind:t,keyword:n.keyword,path:Cx(n.path),source:n.source===void 0?void 0:Ie(n.source),target:n.target===void 0?void 0:Ie(n.target)}}function EE(e){let n=x(e),t=n.values==null?void 0:x(n.values);return{code:h(n.code),column:pe(n.column),...n.fields===void 0?{}:{fields:Array.isArray(n.fields)?n.fields.map(h):f()},line:pe(n.line),message:h(n.message),mismatch:n.mismatch==null?void 0:PE(n.mismatch),path:typeof n.path=="string"?n.path:f(),...t==null?{}:{values:Object.fromEntries(Object.entries(t).map(([r,o])=>[r,typeof o=="string"||typeof o=="number"?o:f()]))}}}function Px(e){let n=x(e);if(n.version!=1||typeof n.valid!="boolean"||!Array.isArray(n.diagnostics))return f();return{closureDigest:h(n.closureDigest),diagnostics:n.diagnostics.map(EE),engineContract:h(n.engineContract),flowId:h(n.flowId),modelVersion:pe(n.modelVersion),revisionDigest:h(n.revisionDigest),revisionId:h(n.revisionId),valid:n.valid,version:1}}var Ex=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function Ax(e,n){let t=new URLSearchParams({...e==null?{}:{flowId:e},...n==null?{}:{locale:n}}).toString();return{path:`/v1/connector/providers${t?`?${t}`:""}`,decode:(r)=>{let o=x(r);if(K(o,["providers","version"]),o.version!=1||!Array.isArray(o.providers))return f();return o.providers.map(xx)}}}function Tx(e,n,t){let r=new URLSearchParams({...n==null?{}:{flowId:n},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/actions/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=x(o);if(K(i,["action","version"]),i.version!=1)return f();return Cs(i.action)}}}function Ox(e,n,t){let r=new URLSearchParams({...n==null?{}:{flowId:n},...t==null?{}:{locale:t}}).toString();return{path:`/v1/connector/action-metadata/${encodeURIComponent(e)}${r?`?${r}`:""}`,decode:(o)=>{let i=x(o);if(K(i,["action","version"]),i.version!=1)return f();let s=wo(i.action);if(s.actionId!=e)return f("action.actionId: does not match the requested Action.");return s}}}function Nx(e){return{path:`/v1/connector/connections${Ex(e)}`,decode:(n)=>{let t=x(n);if(K(t,["connections","version"]),t.version!=1||!Array.isArray(t.connections))return f();return t.connections.map(or)}}}function jx(e,n){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${Ex(n)}`,decode:(t)=>{let r=x(t);if(K(r,["connections","serviceId","version"]),r.version!=1||h(r.serviceId)!=e||!Array.isArray(r.connections))return f();return r.connections.map(or)}}}function vo(e){return Array.isArray(e)?e.map(h):f()}function AE(e){let n=x(e),t=n.draft===null?null:x(n.draft),r=x(n.sharedAccess);if(t!=null&&!Array.isArray(t.connections))return f();if(!Array.isArray(r.bindings))return f();let o=pe(r.accessRevision);if(o<0)return f();return{draft:t==null?null:{...t.calledFlowIds===void 0?{}:{calledFlowIds:vo(t.calledFlowIds)},variableNames:vo(t.variableNames),errorSourceFlowIds:vo(t.errorSourceFlowIds),connections:t.connections.map((i)=>{let s=x(i);return{providerId:h(s.providerId),connectionId:h(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:vo(r.providerIds),bindings:r.bindings.map((i)=>{let s=x(i);return{providerId:h(s.providerId),connectionId:s.connectionId===null?null:h(s.connectionId),accessBindingId:h(s.accessBindingId)}})}}}function dt(e){let n=x(e),t=n.status;if(n.version!=1)return f();if(t!="active"&&t!="retiring")return f();let r=n.live==null?void 0:x(n.live);if(r!=null&&(typeof r.enabled!="boolean"||typeof r.hasStart!="boolean"))return f();return{...r==null?{}:{live:{enabled:r.enabled,hasStart:r.hasStart,publicationId:h(r.publicationId),revisionId:h(r.revisionId)}},tagIds:n.tagIds===void 0?[]:vo(n.tagIds),createdAt:h(n.createdAt),...n.connectorTeamId==null?{}:{connectorTeamId:h(n.connectorTeamId)},draftRevisionId:h(n.draftRevisionId),resourceReferences:AE(n.resourceReferences),flowId:h(n.flowId),name:h(n.name),...n.icon===void 0?{}:{icon:h(n.icon)},...n.description===void 0?{}:{description:h(n.description)},status:t,updatedAt:h(n.updatedAt),version:1}}function TE(e){let n=x(e),t=pe(n.referenceCount);if(t<0)return f();return{...dt(n),referenceCount:t}}function Rx(e){let n=x(e);if(n.version!=1||!Array.isArray(n.flows))return f();let{nextCursor:t,total:r}=n;if(t!=null&&typeof t!="string")return f();if(r!=null&&!Number.isSafeInteger(r))return f();return{...t==null?{}:{nextCursor:t},flows:n.flows.map(TE),...r==null?{}:{total:r},version:1}}function As(e){let n=x(e);if(K(n,["name","updatedAt","value","version"]),n.version!=1||typeof n.value!="string")return f();let t=h(n.updatedAt);try{if(new Date(t).toISOString()!=t)return f()}catch{return f()}return{name:h(n.name),updatedAt:t,value:n.value,version:1}}function _x(e){let n=x(e),{referenceCount:t,...r}=n,o=pe(t);if(o<0)return f();return{...As(r),referenceCount:o}}function $x(e){let n=x(e);if(typeof n.enabled!="boolean")return f();return{flowId:h(n.flowId),flowName:h(n.flowName),nodeId:h(n.nodeId),nodeName:h(n.nodeName),enabled:n.enabled}}function Dx(e){let n=x(e);if(K(n,["version","references"]),n.version!=1||!Array.isArray(n.references))return f();return{version:1,references:n.references.map((t)=>{let r=x(t);if(K(r,["flowId","flowName","draft","live"]),typeof r.draft!="boolean")return f();let o=r.live===null?null:x(r.live);if(o!=null){if(K(o,["publicationId","enabled"]),typeof o.enabled!="boolean")return f()}return{flowId:h(r.flowId),flowName:h(r.flowName),draft:r.draft,live:o==null?null:{publicationId:h(o.publicationId),enabled:o.enabled}}})}}function id(e){let n=x(e),t=n.parentRevisionId;if(n.version!=1||t!==null&&typeof t!="string")return f();return{actorId:h(n.actorId),createdAt:h(n.createdAt),digest:h(n.digest),flowId:h(n.flowId),modelVersion:pe(n.modelVersion),parentRevisionId:t,revisionId:h(n.revisionId),version:1}}function ko(e){let n=x(e);try{return{...id(n),content:Xn(n.content)}}catch{return f()}}function Lx(e){let n=x(e),t=x(n.content),r=x(x(t.document).graph),o=Object.entries(x(r.nodes)).flatMap(([i,s])=>{let a=x(s);if(a.kind=="outputs"||Object.hasOwn(a,"inputs"))return[];let c=h(a.kind);if(a.name!==void 0&&typeof a.name!="string")return f();return[{triggerId:h(i),kind:c,...a.name===void 0?{}:{name:a.name}}]});return{...id(n),triggers:o}}function Ts(e){let n=x(e);if(n.version!=1||pe(n.revision)<1)return f();return{revision:pe(n.revision),updatedAt:h(n.updatedAt),value:Object.fromEntries(Object.entries(x(n.value)).map(([t,r])=>[t,Ie(r)])),version:1}}function So(e){let n=x(e);if(n.version!=1)return f();return{revision:id(n.revision),version:1}}function Mx(e){let n=x(e);if(n.version!=1||n.kind!="snapshot")return f();return{draft:ko(n.draft),kind:"snapshot",version:1}}var OE=["canceled","completed","failed","indeterminate"],Os=[...OE,"queued","running","starting","waiting"];var NE=new Set(Os);function Ns(e){return typeof e=="string"&&NE.has(e)?e:f()}function qx(e){let n=x(e),{source:t,startedAt:r,finishedAt:o}=n;if(n.version!=1||t!="draft"&&t!="live")return f();if(r!=null&&typeof r!="string")return f();if(o!=null&&typeof o!="string")return f();return{createdAt:h(n.createdAt),...o==null?{}:{finishedAt:o},flowId:h(n.flowId),revisionId:h(n.revisionId),runId:h(n.runId),source:t,...r==null?{}:{startedAt:r},status:Ns(n.status),version:1}}function jE(e){let n=x(e);K(n,["actions","expiresAt","nodeId","prompt","waitId","waitingSince"]);let t=n.actions;if(!Array.isArray(t)||!(t.length==1&&t[0]=="continue"||t.length==2&&t[0]=="approve"&&t[1]=="reject"))return f();return{actions:t,...n.autoContinueAt===void 0?{}:{autoContinueAt:h(n.autoContinueAt)},expiresAt:h(n.expiresAt),nodeId:h(n.nodeId),prompt:h(n.prompt),waitId:h(n.waitId),waitingSince:h(n.waitingSince)}}function zx(e){let n=x(e);return{flowId:h(n.flowId),runId:h(n.runId),nodeId:h(n.nodeId),executionId:h(n.executionId),...n.callId==null?{}:{callId:h(n.callId)}}}function RE(e){let n=x(e);if(!["workbench","cli","mcp","api","trigger","workflow"].includes(n.channel))return f();return{channel:n.channel,...n.actorId===void 0?{}:{actorId:h(n.actorId)}}}function js(e){let n=x(e),t=qx(n),r=n.eventsExpiresAt;if(r!=null&&typeof r!="string")return f();if(n.waiting!==void 0||!Array.isArray(n.waits))return f();let o=n.waits.map(jE);if(new Set(o.map((a)=>a.waitId)).size!=o.length||t.status=="waiting"&&o.length==0&&(!Array.isArray(n.calls)||n.calls.length==0)||["completed","failed","canceled","indeterminate"].includes(t.status)&&o.length>0)return f();if(n.occurrenceId!==void 0&&n.triggerNodeId===void 0)return f();let i={status:t.status,waits:o};if(n.calls!==void 0&&!Array.isArray(n.calls))return f();let s={...t,...n.initiator===void 0?{}:{initiator:RE(n.initiator)},..._E(n),...n.triggerNodeId===void 0?{}:{triggerNodeId:h(n.triggerNodeId)},...n.caller===void 0?{}:{caller:zx(n.caller)},...n.calls===void 0?{}:{calls:n.calls.map((a)=>Object.assign(zx(a),{status:x(a).status===null?null:Ns(x(a).status)}))},closureDigest:h(n.closureDigest),engineContract:h(n.engineContract),engineDigest:h(n.engineDigest),...r==null?{}:{eventsExpiresAt:r},modelVersion:pe(n.modelVersion),sharedAccessDigest:h(n.sharedAccessDigest),revisionDigest:h(n.revisionDigest),...i};switch(t.source){case"draft":return{...s,source:"draft"};case"live":return{...s,publicationId:h(n.publicationId),source:"live",...n.occurrenceId===void 0?{}:{occurrenceId:h(n.occurrenceId),triggerNodeId:h(n.triggerNodeId)}}}}function Vx(e){let n=x(e),t=n.nextCursor;if(n.version!=1||!Array.isArray(n.runs))return f();if(t!=null&&typeof t!="string")return f();return{flowId:h(n.flowId),...t==null?{}:{nextCursor:t},runs:n.runs.map(qx),version:1}}function Bx(e){let n=x(e),t=Ns(n.status);if(n.version!=1||typeof n.cancelAccepted!="boolean"||t=="queued"||t=="starting"||t=="running"||t=="waiting")return f();return{cancelAccepted:n.cancelAccepted,runId:h(n.runId),status:t,version:1}}function Ux(e){let n=x(e);K(n,["action","comment","resolutionAccepted","resolvedAt","runId","status","version","waitId"]);let{action:t,resolvedAt:r}=n;if(n.version!=1||typeof n.resolutionAccepted!="boolean"||n.comment!==null&&typeof n.comment!="string"||t!==null&&t!="approve"&&t!="continue"&&t!="reject"||r!==null&&typeof r!="string"||t===null!=(r===null)||n.resolutionAccepted&&t===null)return f();return{action:t,comment:n.comment,resolutionAccepted:n.resolutionAccepted,resolvedAt:r,runId:h(n.runId),status:Ns(n.status),version:1,waitId:h(n.waitId)}}function Jx(e){let n=x(e),t=n.status;if(n.version!=1)return f();let r={finishedAt:h(n.finishedAt),runId:h(n.runId),version:1};if(t=="completed"){if(!Object.hasOwn(n,"result"))return f();return{...r,result:n.result,status:"completed"}}if(t=="canceled")return{...r,status:"canceled"};if(t=="failed"){let o=x(n.error);return{...r,error:Fx(o),status:"failed"}}if(t=="indeterminate"){let o=x(n.error);return{...r,error:Fx(o),status:"indeterminate"}}return f()}function _E(e){let n=e.errorSource==null?void 0:x(e.errorSource);if(e.errorDispatches!=null&&!Array.isArray(e.errorDispatches))return f();return{...n==null?{}:{errorSource:{flowId:h(n.flowId),runId:h(n.runId)}},...e.errorDispatches==null?{}:{errorDispatches:e.errorDispatches.map((t)=>{let r=x(t),o=h(r.flowId);switch(r.status){case"pending":return{status:"pending",flowId:o};case"dispatched":return{status:"dispatched",flowId:o,runId:h(r.runId)};case"failed":return{status:"failed",flowId:o,message:h(r.message)};default:return f()}})}}}function Fx(e){return{code:h(e.code),message:h(e.message),...e.nodeId===void 0?{}:{nodeId:h(e.nodeId)},...e.jobId===void 0?{}:{jobId:h(e.jobId)},...e.path===void 0?{}:{path:(Array.isArray(e.path)?e.path:f()).map(h)}}}function Io(){let e=globalThis.crypto;if(e!=null){try{if(typeof e.randomUUID=="function")return e.randomUUID()}catch{}if(typeof e.getRandomValues=="function"){let n=e.getRandomValues(new Uint8Array(16));n[6]=(n[6]??0)&15|64,n[8]=(n[8]??0)&63|128;let t=Array.from(n,(r)=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function sd(e={}){return{query:e.query?.trim().toLowerCase()??"",tagIds:[...new Set(e.tagIds??[])].toSorted(),untagged:e.untagged??!1}}function Rs(e){let n=x(e);if(n.version!=1)return f();return{tagId:h(n.tagId),name:h(n.name),version:1}}function Zx(e){let n=x(e),t=pe(n.referenceCount);if(t<0)return f();return{...Rs(n),referenceCount:t}}function $E(e){let n=x(e);if(n.version!=1||!Array.isArray(n.flows)||n.flows.length==0)return f();let t=dt(n.flow),r=n.flows.map(dt);if(new Set(r.map((o)=>o.flowId)).size!=r.length||!r.some((o)=>o.flowId==t.flowId))return f();return{version:1,flow:t,flows:r}}function Wx(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function DE(e){let n=x(e),t=pe(n.sequence);if(t<0)return f();let r={createdAt:h(n.createdAt),sequence:t},o=x(n.payload),i=n.kind;switch(i){case"run.queued":return{...r,kind:i,payload:{}};case"run.started":return{...r,kind:i,payload:{flowId:h(o.flowId),scopeId:h(o.scopeId),...o.parentScopeId===void 0?{}:{parentScopeId:h(o.parentScopeId)}}};case"run.progress":return{...r,kind:i,payload:{flowId:h(o.flowId),scopeId:h(o.scopeId),progress:Kx(o.progress)}};case"run.waiting":if(!Array.isArray(o.waitIds))return f();return{...r,kind:i,payload:{waitIds:o.waitIds.map((s)=>h(s))}};case"wait.created":{let s=o.autoContinueAt===void 0?{}:{autoContinueAt:h(o.autoContinueAt)};return{...r,kind:i,payload:{...s,expiresAt:h(o.expiresAt),nodeId:h(o.nodeId),waitId:h(o.waitId),waitingSince:h(o.waitingSince)}}}case"run.resolved":{let{action:s,source:a}=o;if(a!==void 0&&a!=="manual"&&a!=="automatic")return f();let c=a===void 0?{}:{source:a};if(s!=="approve"&&s!=="continue"&&s!=="reject")return f();if(o.comment!==null&&typeof o.comment!="string")return f();return{...r,kind:i,payload:{...c,action:s,comment:o.comment,resolvedAt:h(o.resolvedAt),waitId:h(o.waitId)}}}case"run.completed":case"run.canceled":case"run.failed":case"run.indeterminate":return{...r,kind:i,payload:{result:Ie(o.result)}};case"run.events-truncated":return{...r,kind:i,payload:Object.fromEntries(Object.entries(o).map(([s,a])=>[s,Ie(a)]))};case"node.started":case"node.completed":case"node.failed":case"node.log":case"node.progress":case"node.artifact":{let s={flowId:h(o.flowId),scopeId:h(o.scopeId),nodeId:h(o.nodeId),executionId:h(o.executionId)};switch(i){case"node.started":{let a=o.nodeKind;if(a!==void 0&&a!=="approval"&&a!=="condition"&&a!=="connector"&&a!=="connector-proxy"&&a!=="javascript"&&a!=="decision"&&a!=="openapi"&&a!=="http-request"&&a!=="skip-duplicates"&&a!=="llm"&&a!=="agent"&&a!=="value"&&a!=="outputs"&&a!=="webhook-response"&&a!=="workflow"&&a!=="wait")return f();return{...r,kind:i,payload:{...s,...a===void 0?{}:{nodeKind:a},...o.nodeTitle===void 0?{}:{nodeTitle:h(o.nodeTitle)},...o.operation===void 0?{}:{operation:h(o.operation)}}}}case"node.completed":return{...r,kind:i,payload:{...s,...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(x(o.systemOutputs)).map(([a,c])=>[a,Ie(c)]))},outputs:Object.fromEntries(Object.entries(x(o.outputs)).map(([a,c])=>[a,Ie(c)]))}};case"node.failed":{let a=x(o.error);return{...r,kind:i,payload:{...s,...o.handled===!0?{handled:!0}:{},...o.systemOutputs===void 0?{}:{systemOutputs:Object.fromEntries(Object.entries(x(o.systemOutputs)).map(([c,l])=>[c,Ie(l)]))},error:{code:h(a.code),message:h(a.message)}}}}case"node.log":{let a=o.level;if(a!=="debug"&&a!=="info"&&a!=="warn"&&a!=="error")return f();return{...r,kind:i,payload:{...s,level:a,message:h(o.message)}}}case"node.progress":return{...r,kind:i,payload:{...s,progress:Kx(o.progress)}};case"node.artifact":{let a=x(o.artifact),c=pe(a.size),l=h(a.digest);if(a.kind!="artifact"||c<0||!/^sha256:[0-9a-f]{64}$/.test(l))return f();return{...r,kind:i,payload:{...s,artifact:{kind:"artifact",id:h(a.id),name:h(a.name),size:c,digest:l,...a.mediaType===void 0?{}:{mediaType:h(a.mediaType)}}}}}}}default:return f()}}function Kx(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:f()}function LE(e){let n=x(e),t=n.eventsExpiresAt,r=pe(n.nextAfter);if(n.version!=1||!Array.isArray(n.events)||typeof n.done!="boolean"||typeof n.historyComplete!="boolean")return f();if(t!=null&&typeof t!="string")return f();if(r<0)return f();return{done:n.done,events:n.events.map(DE),...t==null?{}:{eventsExpiresAt:t},historyComplete:n.historyComplete,nextAfter:r,runId:h(n.runId),version:1}}var O=encodeURIComponent;function kn(e){return`${e}-${Io()}`}class ad{constructor(e,n="api",t={}){if(this.options=t,this.channel=n,this.requestControl=e,t.cache!=null)this.catalogCache=new od(t.cache)}async loadOpenApiDocument(e,n){let t=x(await this.request("/v1/openapi/document",{method:"POST",body:JSON.stringify({url:e,version:1}),signal:n}));if(t.version!=1)return f();return Ie(t.document)}async listFlows(e={}){let n=new URLSearchParams,t=sd(e);if(t.query)n.set("query",t.query);if(t.tagIds.length)n.set("tagIds",t.tagIds.join(","));if(t.untagged)n.set("untagged","true");if(e.cursor!=null)n.set("cursor",e.cursor);if(e.limit!=null)n.set("limit",String(e.limit));if(e.includeTotal!=null)n.set("includeTotal",String(e.includeTotal));let r=n.size==0?"":`?${n}`;return Rx(await this.request(`/v1/flows${r}`,e.signal==null?void 0:{signal:e.signal}))}async listEventSources(e,n){return ed(await this.request("/v1/event-sources"+(e==null?"":`?flowId=${O(e)}`),{signal:n}))}async listEventSourceConnections(e,n,t="feishu"){let r=x(await this.request(`/v1/event-sources/connections?kind=${t}${e==null?"":`&teamId=${O(e)}`}`,{signal:n}));if(K(r,["version","connections"]),r.version!=1||!Array.isArray(r.connections))return f();return r.connections.map(or)}async createEventSource(e){return Ps(await this.request("/v1/event-sources",{method:"POST",body:JSON.stringify(e)}))}async updateEventSource(e,n){return Ps(await this.request(`/v1/event-sources/${O(e)}`,{method:"PUT",body:JSON.stringify(n)}))}async deleteEventSource(e,n){await this.request(`/v1/event-sources/${O(e)}`,{method:"DELETE",body:JSON.stringify({version:1,expectedRevision:n})})}async listVariables(){let e=x(await this.request("/v1/variables"));if(K(e,["variables","version"]),e.version!=1||!Array.isArray(e.variables))return f();return{variables:e.variables.map(_x),version:1}}async getFlowReferences(e,n={}){let t=new URLSearchParams({direction:n.direction??"incoming",offset:String(n.offset??0),limit:String(n.limit??50)});return tb.parse(await this.request(`/v1/flows/${O(e)}/references?${t}`,{signal:n.signal}))}async getWorkflowContract(e,n){return eb.parse(await this.request(`/v1/flows/${O(e)}/call-contract`,{signal:n}))}async getVariableReferences(e,n){return Dx(await this.request(`/v1/variables/${O(e)}/references`,{signal:n}))}async getVariable(e){return As(await this.request(`/v1/variables/${O(e)}`))}async putVariable(e,n){return As(await this.request(`/v1/variables/${O(e)}`,{body:JSON.stringify({value:n}),method:"PUT"}))}async deleteVariable(e){let n=x(await this.request(`/v1/variables/${O(e)}`,{method:"DELETE"}));if(K(n,["version"]),n.version!=1)return f()}async exportFlow(e){let n=await this.request(`/v1/flows/${O(e)}/export`);try{return nn(n)}catch{return f()}}async getFlowExportPreview(e){let n=await this.request(`/v1/flows/${O(e)}/export-preview`);try{return sx(n)}catch{return f()}}async exportFlowBundle(e){let n=await this.getFlowExportPreview(e);if(n.unavailableFlowIds.length)throw new Re(400,"flow.invalid","Some referenced workflows are unavailable.");return cx(n)}async importFlowBundle(e,n={}){return $E(await this.request("/v1/flows/import-bundle",{method:"POST",headers:{"Idempotency-Key":n.idempotencyKey??`flow-${Io()}`},body:JSON.stringify({file:e,name:n.name,teamId:n.teamId,tagIds:n.tagIds,version:1})}))}async importFlow(e,n={}){return dt(await this.request("/v1/flows/import",{method:"POST",headers:{"Idempotency-Key":n.idempotencyKey??`flow-${Io()}`},body:JSON.stringify({file:e,name:n.name,teamId:n.teamId,tagIds:n.tagIds,version:1})}))}async createFlow(e,n=`flow-${Io()}`,t,r,o){return dt(await this.request("/v1/flows",{body:JSON.stringify({name:e,...t==null?{}:{teamId:t},...r==null?{}:{tagIds:r},...o==null?{}:{presentation:o},version:1}),headers:{"idempotency-key":n},method:"POST"}))}async broadcastCanvas(e,n){let t=x(await this.request(`/v1/flows/${O(e)}/canvas`,{method:"POST",body:JSON.stringify({version:1,command:n})}));if(K(t,["version","flowId","broadcast"]),t.version!=1||t.broadcast!==!0||t.flowId!==e)return f();return{version:1,flowId:h(t.flowId),broadcast:!0}}async getFlow(e){return dt(await this.request(`/v1/flows/${O(e)}`))}async getErrorListeners(e,n){let t=x(await this.request(`/v1/flows/${O(e)}/error-listeners`,{signal:n}));if(t.version!=1||!Array.isArray(t.listeners))return f();return t.listeners.map($x)}async listTags(e){let n=x(await this.request("/v1/tags",{signal:e}));if(n.version!=1||!Array.isArray(n.tags))return f();return{tags:n.tags.map(Zx),version:1}}async createTag(e){return Rs(await this.request("/v1/tags",{method:"POST",body:JSON.stringify({name:e,version:1})}))}async renameTag(e,n){return Rs(await this.request(`/v1/tags/${O(e)}`,{method:"PATCH",body:JSON.stringify({name:n,version:1})}))}async deleteTag(e){if(x(await this.request(`/v1/tags/${O(e)}`,{method:"DELETE"})).version!=1)f()}async setFlowTags(e,n){return dt(await this.request(`/v1/flows/${O(e)}/tags`,{method:"PUT",body:JSON.stringify({tagIds:n,version:1})}))}async updateFlow(e,n){return dt(await this.request(`/v1/flows/${O(e)}`,{method:"PATCH",body:JSON.stringify({...n,version:1})}))}async getFlowState(e,n){let t=Xl.safeParse(await this.request(`/v1/flows/${O(e)}/state?scope=${n}`));return t.success&&t.data.scope===n?t.data:f()}async getFlowStateSummary(e,n,t){let r=tg.safeParse(await this.request(`/v1/flows/${O(e)}/state/summary?scope=${n}`,{signal:t}));return r.success&&r.data.scope===n?r.data:f()}async getFlowStateValues(e,n,t,r){let o=ng.safeParse(await this.request(`/v1/flows/${O(e)}/state/read`,{method:"POST",body:JSON.stringify({version:1,scope:n,keys:t}),signal:r}));return o.success&&o.data.scope===n&&o.data.values.length===t.length&&o.data.values.every((i,s)=>i.key===t[s])?o.data:f()}async clearFlowState(e,n,t){let r=x(await this.request(`/v1/flows/${O(e)}/state?scope=${n}${t==null?"":`&key=${encodeURIComponent(t)}`}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)f()}async clearFlowDedupe(e,n,t){let r=x(await this.request(`/v1/flows/${O(e)}/dedupe?scope=${n}&space=${encodeURIComponent(t)}`,{method:"DELETE"}));if(r.version!==1||r.cleared!==!0)f()}async clearAllFlowDedupe(e,n){let t=x(await this.request(`/v1/flows/${O(e)}/dedupe/all?scope=${n}`,{method:"DELETE"}));if(t.version!==1||t.cleared!==!0)f()}async renameFlow(e,n){return this.updateFlow(e,{name:n})}async deleteFlow(e){return dt(await this.request(`/v1/flows/${O(e)}`,{method:"DELETE"}))}async listTriggerKeys(e,n){let t=x(await this.request(`/v1/trigger-keys${n==null?"":`?locale=${encodeURIComponent(n)}`}`,{signal:e}));if(t.version!=1||!Array.isArray(t.keys))return f();return t.keys.map(Ju)}async listTriggerDefinitions(e){let n=x(await this.request("/v1/trigger-keys/catalog",{signal:e}));if(n.version!=2||!Array.isArray(n.definitions))return f();return n.definitions.map(nr)}async readCatalog(e,n,t){let r=new Headers;if(n)r.set("if-none-match",n);let o=await this.response(e.path,{headers:r,signal:t},!0),i=o.headers.get("etag")?.trim()||null;if(o.status==304)return{modified:!1,etag:i};return{modified:!0,data:e.decode(await o.json()),etag:i}}async getTriggerCatalog(e,n,t){if(this.catalogCache!=null){let i=await this.catalogResponse({path:`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,decode:Es},300000,t);return{data:i.data,etag:i.etag}}let r=new Headers;if(n?.etag)r.set("if-none-match",n.etag);let o=await this.response(`/v1/trigger-keys/catalog?locale=${encodeURIComponent(e)}`,{headers:r,signal:t},!0);if(o.status==304){if(n==null)return f();return{...n,etag:o.headers.get("etag")?.trim()||n.etag}}return{data:Es(await o.json()),etag:o.headers.get("etag")?.trim()||null}}async getTriggerKey(e,n){if(this.catalogCache!=null)return(await this.catalogResponse({path:`/v1/trigger-keys/${O(e)}`,decode:(r)=>{let o=x(r);if(o.version!=1)return f();let i=nr(o.definition);if(i.key!=e)return f("Trigger key does not match the requested definition.");return i}},300000,n)).data;let t=x(await this.request(`/v1/trigger-keys/${O(e)}`,{signal:n}));if(t.version!=1)return f();return nr(t.definition)}async listFlowTriggerBindings(e,n){let t=x(await this.request(`/v1/flows/${O(e)}/triggers`,{signal:n}));if(t.version!=1||h(t.flowId)!=e||!Array.isArray(t.bindings))return f();return t.bindings.map(go)}async getFlowTriggerBinding(e,n){return Vb(await this.request(`/v1/flows/${O(e)}/triggers/${O(n)}`))}async listFlowTriggerActivities(e,n,t={}){let r=new URLSearchParams;if(t.cursor!=null)r.set("cursor",t.cursor);if(t.limit!=null)r.set("limit",String(t.limit));let o=r.size==0?"":`?${r}`;return Bb(await this.request(`/v1/flows/${O(e)}/triggers/${O(n)}/activities${o}`))}async testFlowPollTrigger(e,n){return Ub(await this.request(`/v1/flows/${O(e)}/triggers/${O(n)}/test`,{body:JSON.stringify({version:1}),method:"POST"}))}async getEditor(e){let n=x(await this.request(`/v1/flows/${O(e)}/editor`));if(n.version!=1)return f();let t={flow:dt(n.flow),draft:ko(n.draft),live:Uu(n.live),presentation:Ts(n.presentation),version:1};if(t.flow.flowId!=e||t.draft.flowId!=e||t.live.flowId!=e||t.flow.draftRevisionId!=t.draft.revisionId)return f();return t}async getPublicationPresentation(e,n,t){let r=x(await this.request(`/v1/flows/${O(e)}/publications/${O(n)}/presentation`,{signal:t}));if(r.version!=1)return f();return{version:1,presentation:r.presentation===null?null:Ts(r.presentation)}}async getPresentation(e){return Ts(await this.request(`/v1/flows/${O(e)}/presentation`))}async getDraft(e){return ko(await this.request(`/v1/flows/${O(e)}/draft`))}async syncDraft(e){return Mx(await this.request(`/v1/flows/${O(e)}/draft/sync`))}async getRevision(e,n,t){return ko(await this.request(`/v1/flows/${O(e)}/revisions/${O(n)}`,{signal:t}))}async getRevisionTriggers(e,n,t){let r=Lx(await this.request(`/v1/flows/${O(e)}/revisions/${O(n)}`,{signal:t}));if(r.flowId!=e||r.revisionId!=n)return f();return r}async listTriggerConfigOptions(e,n,t,r){let o=x(await this.request(`/v1/flows/${O(e)}/triggers/${O(n)}/options/${O(t)}`,{signal:r}));if(K(o,["options","version"]),o.version!=1||!Array.isArray(o.options)||o.options.length>1000)return f();return o.options.map((i)=>{let s=x(i);K(s,["value","label",...s.color==null?[]:["color"]]);let a=s.color==null?void 0:h(s.color);if(a!=null&&!/^#[0-9a-fA-F]{6}$/.test(a))return f();return a==null?{value:h(s.value),label:h(s.label)}:{value:h(s.value),label:h(s.label),color:a}})}async listConnectorTeams(e){let n=x(await this.request("/v1/connector/teams",{signal:e}));if(K(n,["enabled","teams","version"]),n.version!=1||typeof n.enabled!="boolean"||!Array.isArray(n.teams))return f();return{enabled:n.enabled,teams:n.teams.map((t)=>{let r=x(t);if(K(r,["id","name","systemCreated"]),typeof r.systemCreated!="boolean")return f();return{id:h(r.id),name:h(r.name),systemCreated:r.systemCreated}}),version:1}}async listConnectorProviders(e,n,t){let r=Ax(n,t);if(this.catalogCache!=null)return(await this.catalogResponse(r,300000,e)).data;return this.connectorRequest(r.path,"providers",e,r.decode)}async listLeinaBots(e,n){return mx(await this.request(`/v1/connector/leina/bots?flowId=${O(e)}`,{signal:n}))}async removeConnectionUsage(e,n,t,r,o){return So(await this.request(`/v1/flows/${O(e)}/connection-usage/remove`,{method:"POST",headers:{"idempotency-key":o},body:JSON.stringify({connectionId:n,expectedRevisionId:t,expectedAccessRevision:r,version:1})}))}async getConnectorAccess(e,n){return rr(await this.request(`/v1/flows/${O(e)}/connector-access`,{signal:n}))}async getPublishedConnectorAccess(e,n,t){return Gu(await this.request(`/v1/flows/${O(e)}/connector-access?publicationId=${O(n)}`,{signal:t}))}async listProviderAccessBindingCandidates(e,n,t){return gx(await this.request(`/v1/flows/${O(e)}/connector-access/candidates/query`,{method:"POST",body:JSON.stringify({providerIds:n,version:1}),signal:t}),n)}async setConnectorService(e,n,t,r){return rr(await this.request(`/v1/flows/${O(e)}/connector-access/${O(n)}/service`,{body:JSON.stringify({expectedAccessRevision:r,version:1}),method:t?"PUT":"DELETE"}))}async addProviderAccessBinding(e,n,t,r){return rr(await this.request(`/v1/flows/${O(e)}/connector-access/${O(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"PUT"}))}async removeProviderAccessBinding(e,n,t,r){return rr(await this.request(`/v1/flows/${O(e)}/connector-access/${O(n)}`,{body:JSON.stringify({accessBindingId:t,expectedAccessRevision:r,version:1}),method:"DELETE"}))}async listConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},...e==null?{}:{service:e}},n)}async searchConnectorActions(e,n,t,r){return await this.connectorActions({...r==null?{}:{locale:r},...t==null?{}:{flowId:t},q:e.trim()},n)}async getConnectorAction(e,n,t,r,o=!1){let i=Tx(e,t,r);return this.connectorRequest(i.path,"actions",n,i.decode,o)}async listConnectorActionMetadata(e,n,t,r){return this.connectorMetadata({...e==null?{}:{service:e},...t==null?{}:{flowId:t},...r==null?{}:{locale:r}},n)}async searchConnectorActionMetadata(e,n,t,r){return this.connectorMetadata({q:e.trim(),...t==null?{}:{flowId:t},...r==null?{}:{locale:r}},n)}async getConnectorActionMetadata(e,n,t,r,o=!1){return(await this.catalogResponse(Ox(e,t,r),30000,n,o)).data}async listAllConnectorConnections(e,n,t=!1){let r=Nx(n);return this.connectorRequest(r.path,"connections",e,r.decode,t)}async listConnectorConnections(e,n,t,r=!1){let o=jx(e,t);return this.connectorRequest(o.path,"connections",n,o.decode,r)}async createConnectorConnectionPage(e,n,t){let r=new URLSearchParams;if(n!=null)r.set("flowId",n);if(t!=null)r.set("teamId",t);let o=x(await this.request(`/v1/connector/connections/${O(e)}/page${r.size==0?"":`?${r}`}`,{body:JSON.stringify({version:1}),method:"POST"}));if(K(o,["url","version"]),o.version!=1)return f();try{let i=new URL(h(o.url));if(i.protocol!="http:"&&i.protocol!="https:")return f();return i.href}catch{return f()}}async readAuthoring(e,n={}){return Db.parse(await this.request(`/v1/flows/${O(e)}/authoring/read`,{method:"POST",body:JSON.stringify(n)}))}async searchAuthoring(e,n){return Lb.parse(await this.request(`/v1/flows/${O(e)}/authoring/search`,{method:"POST",body:JSON.stringify(n)}))}async authoringSchema(e,n){return x(await this.request(`/v1/flows/${O(e)}/authoring/schema`,{method:"POST",body:JSON.stringify(n)}))}async editAuthoring(e,n){return $b.parse(await this.request(`/v1/flows/${O(e)}/authoring/edit`,{method:"POST",headers:{"idempotency-key":n.requestId},body:JSON.stringify(n)}))}async checkAuthoring(e,n){return _b.parse(await this.request(`/v1/flows/${O(e)}/authoring/check`,{method:"POST",body:JSON.stringify({revisionId:n})}))}async changeDraft(e,n,t,r=kn("change")){return So(await this.request(`/v1/flows/${O(e)}/draft/changes`,{body:JSON.stringify({expectedRevisionId:n,operations:t,version:1}),headers:{"idempotency-key":r},method:"POST"}))}async repairDraft(e,n,t=kn("repair")){return So(await this.request(`/v1/flows/${O(e)}/draft/repair`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t},method:"POST"}))}async upgradeDraft(e,n,t={}){return So(await this.request(`/v1/flows/${O(e)}/draft/upgrade`,{body:JSON.stringify({expectedRevisionId:n,version:1}),headers:{"idempotency-key":t.idempotencyKey??kn("upgrade")},method:"POST"}))}async checkFlow(e,n){return Px(await this.request(`/v1/flows/${O(e)}/revisions/${O(n)}/check`,{body:JSON.stringify({engineContract:ln,version:1}),method:"POST"}))}async getLiveDetails(e,n){let t=Zb(await this.request(`/v1/flows/${O(e)}/live/details`,{signal:n}));if(t.flowId!=e)return f();return t}async getLive(e,n){return Uu(await this.request(`/v1/flows/${O(e)}/live`,{signal:n}))}async listPublications(e,n={},t){let r=new URLSearchParams;if(n.cursor!=null)r.set("cursor",n.cursor);if(n.limit!=null)r.set("limit",String(n.limit));if(n.includeTotal!=null)r.set("includeTotal",String(n.includeTotal));let o=r.size==0?"":`?${r}`;return Fb(await this.request(`/v1/flows/${O(e)}/publications${o}`,{signal:t}))}async createDraftRun(e,n,t){let r=js(await this.request(`/v1/flows/${O(e)}/revisions/${O(n)}/runs`,{body:JSON.stringify({engineContract:ln,inputs:t.inputs??{},trigger:t.trigger,version:2}),headers:{"idempotency-key":t.idempotencyKey??kn("run"),"x-open-flow-client":this.channel},method:"POST"}));return r.source=="draft"?r:f()}async createLiveRun(e,n){let t=js(await this.request("/v1/runs",{body:JSON.stringify({inputs:n.inputs??{},trigger:n.trigger,publicationId:e,version:2}),headers:{"idempotency-key":n.idempotencyKey??kn("run"),"x-open-flow-client":this.channel},method:"POST"}));return t.source=="live"?t:f()}async setFlowEnabled(e,n,t){return dt(await this.request(`/v1/flows/${O(e)}/enabled`,{method:"PUT",body:JSON.stringify({enabled:t,expectedPublicationId:n,version:1})}))}async publishFlow(e,n,t,r={}){return Bu(await this.request(`/v1/flows/${O(e)}/revisions/${O(n)}/publications`,{body:JSON.stringify({engineContract:ln,expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??kn("publication")},method:"POST"}))}async getPublishOperation(e,n,t){return Bu(await this.request(`/v1/flows/${O(e)}/publish-operations/${O(n)}`,{signal:t}))}async rollbackFlow(e,n,t,r={}){return tr(await this.request(`/v1/flows/${O(e)}/publications/${O(n)}/rollback`,{body:JSON.stringify({expectedLivePublicationId:t,version:1}),headers:{"idempotency-key":r.idempotencyKey??kn("publication")},method:"POST"}))}async getRun(e,n){return js(await this.request(`/v1/runs/${O(e)}`,{signal:n}))}async listRuns(e,n={}){let t=new URLSearchParams;if(n.cursor!=null)t.set("cursor",n.cursor);if(n.limit!=null)t.set("limit",String(n.limit));if(n.status!=null)t.set("status",n.status);if(n.pendingWait!=null)t.set("pendingWait",String(n.pendingWait));if(n.source!=null)t.set("source",n.source);if(n.createdFrom!=null)t.set("createdFrom",n.createdFrom);if(n.createdBefore!=null)t.set("createdBefore",n.createdBefore);if(n.runId!=null)t.set("runId",n.runId);let r=t.size==0?"":`?${t}`;return Vx(await this.request(`/v1/flows/${O(e)}/runs${r}`))}async getRunEvents(e,n={},t){let r=new URLSearchParams;if(n.after!=null)r.set("after",String(n.after));if(n.limit!=null)r.set("limit",String(n.limit));let o=r.size==0?"":`?${r}`;return LE(await this.request(`/v1/runs/${O(e)}/events${o}`,{signal:t}))}async listRunResults(e,n,t){return nd(await this.request(`/v1/runs/${O(e)}/results${n==null?"":`?after=${encodeURIComponent(n)}`}`,{signal:t}))}async readRunResult(e,n,t={},r){let o=new URLSearchParams(Object.entries(t).map(([i,s])=>[i,String(s)]));return rd(await this.request(`/v1/runs/${O(e)}/results/${O(n)}?${o}`,{signal:r}))}async downloadRunResult(e,n,t){return(await this.response(`/v1/runs/${O(e)}/results/${O(n)}/content`,{signal:t})).blob()}async getRunResult(e,n){return Jx(await this.request(`/v1/runs/${O(e)}/result`,{signal:n}))}async cancelRun(e){return Bx(await this.request(`/v1/runs/${O(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,n,t,r){return Ux(await this.request(`/v1/runs/${O(e)}/waits/${O(n)}/resolve`,{body:JSON.stringify({action:t,comment:r,version:1}),method:"POST"}))}async catalogResponse(e,n,t,r=!1){if(this.catalogCache!=null)return this.catalogCache.read(e,(i)=>this.readCatalog({path:e.path,decode:Ie},i),n,t,r);let o=await this.readCatalog(e,null,t);if(!o.modified)return f();return{data:o.data,etag:o.etag}}async connectorMetadata(e,n){let t=new URLSearchParams(e).toString();return(await this.catalogResponse({path:`/v1/connector/action-metadata${t?`?${t}`:""}`,decode:(r)=>{let o=x(r);if(K(o,["actions","version"]),o.version!=1||!Array.isArray(o.actions))return f();return o.actions.map(wo)}},30000,n)).data}async connectorActions(e,n){let t=Object.entries(e).map(([o,i])=>`${O(o)}=${O(i)}`).join("&"),r=t==""?"":`?${t}`;return this.connectorRequest(`/v1/connector/actions${r}`,"actions",n,(o)=>{let i=x(o);if(K(i,["actions","version"]),i.version!=1||!Array.isArray(i.actions))return f();return i.actions.map(Cs)})}async connectorRequest(e,n,t,r,o=!1){return r(await this.request(e,{signal:t}))}async response(e,n,t=!1){if(this.options.cache?.mode=="offline")throw new Re(503,"control.offline","Network requests are disabled for this Control client.");let r=new Headers(n.headers);if(n.body!=null)r.set("content-type","application/json");let o=await this.requestControl(e,{...n,headers:r});if(!o.ok&&!(t&&o.status==304)){let i;try{i=await o.json()}catch{return f()}let s=x(i).error,a=s==null?void 0:x(s);throw new Re(o.status,typeof a?.code=="string"?a.code:"request.failed",typeof a?.message=="string"?a.message:`Request failed with status ${o.status}.`,a?.details==null?void 0:x(a.details))}return o}async request(e,n={}){let t=await this.response(e,n);try{return await t.json()}catch{return f()}}}import{randomUUID as BE}from"crypto";class P extends Error{constructor(e,n,t){super(n);this.code=e,this.details=t,this.name="CliError"}}function _s(e,n){let t=e.trim();if(xo(t)!=null)throw new P("cli.invalid-arguments",`${n} name must be between 1 and ${Ku} characters and use only letters, numbers, spaces, hyphens, or underscores.`);return t}var ME=100,cd=100,ld=100,zE=new Set(["canceled","completed","failed","indeterminate"]);async function FE(e){let n=[],t=new Set,r;do{let o=await e.listFlows({cursor:r,limit:ME});if(n.push(...o.flows),r=o.nextCursor,r!=null&&t.has(r))throw new P("page.invalid-cursor","The deployment returned a repeated Flow cursor.");if(r!=null)t.add(r)}while(r!=null);return n}function qE(e,n){let t=e.find((o)=>o.flowId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new P("flow.ambiguous",`Flow name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({flowId:o,name:i})=>({flowId:o,name:i}))});throw new P("flow.not-found",`Flow ${JSON.stringify(n)} was not found.`)}async function Te(e,n){try{return await e.getFlow(n)}catch(t){if(!(t instanceof Re)||t.code!="flow.invalid"&&t.code!="flow.not-found")throw t}return qE(await FE(e),n)}async function Hx(e,n,t){if(t.expectedRevision!=null&&t.expectedRevision!=n.draftRevisionId&&!t.options.includes("idempotency-key"))throw new P("flow.revision-conflict","The Flow Draft changed. Inspect it before submitting a new mutation.",{expectedRevisionId:t.expectedRevision,actualRevisionId:n.draftRevisionId,flowId:n.flowId});let r=await e.getRevision(n.flowId,t.expectedRevision??n.draftRevisionId);return{draft:r,flow:n,graph:r.content.document.graph}}function VE(e,n){let t=e.find((o)=>o.actionId==n);if(t!=null)return t;let r=e.filter((o)=>o.name==n);if(r.length==1)return r[0];if(r.length>1)throw new P("connector.action-ambiguous",`Connector Action name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({actionId:o,name:i,serviceId:s})=>({actionId:o,name:i,serviceId:s}))});throw new P("connector.action-not-found",`Connector Action ${JSON.stringify(n)} was not found.`)}async function Gx(e,n,t){try{return await e.getConnectorAction(n,void 0,t)}catch(r){if(!(r instanceof Re)||r.status!=404)throw r}return VE(await e.searchConnectorActions(n,void 0,t),n)}function ud(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function Qx(e,n){try{return await e.getTriggerKey(n)}catch(o){if(!(o instanceof Re)||o.status!=404)throw o}let r=(await e.listTriggerKeys()).filter((o)=>o.name==n||o.displayName==n);if(r.length==1)return await e.getTriggerKey(r[0].key);if(r.length>1)throw new P("trigger-key.ambiguous",`Trigger Key name ${JSON.stringify(n)} is ambiguous.`,{candidates:r.map(({displayName:o,key:i,provider:s})=>({displayName:o,key:i,provider:s}))});throw new P("trigger-key.not-found",`Trigger Key ${JSON.stringify(n)} was not found.`)}function Xx(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function dd(e){return`${e.name} ${e.actionId} ${e.serviceName} ${e.serviceId}`}function xe(e,n,t){if(e.length!=n)throw new P("cli.invalid-arguments",`Usage: ${t}`)}function W(e,n,t,r){e.stdout.write(n?`${JSON.stringify(t)}
63
67
  `:`${r}
64
- `)}function St(e){return`${e.name} ${e.flowId} ${e.status}`}function Xr(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function eo(e){let t=e.source=="draft"?"":` ${e.publicationId}`;return`${e.source} ${e.status} ${e.runId} ${e.revisionId}${t}${e.waits.length==0?"":`
65
- ${JSON.stringify(e.waits)}`}`}function Hb(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function Qb(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function Vn(e,t,n,r){try{if(e=="-")return await r.readStdin();if(!e.startsWith("@"))return e;let o=e.slice(1);if(o.length==0)throw new E("cli.invalid-arguments",`${t} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof E)throw o;throw new E(n,o instanceof Error?o.message:String(o))}}async function to(e,t){if(e==null)return{};let n=await Vn(e,"input","flow.authoring-unreadable",t),r;try{r=JSON.parse(n)}catch{throw new E("cli.invalid-arguments","Input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new E("cli.invalid-arguments","Input must be a JSON object.");return r}async function Yb(e,t){if(e.input==null)return{};let n=await Vn(e.input,"--input","run.input-unreadable",t),r;try{r=JSON.parse(n)}catch{throw new E("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new E("run.input-invalid","Run input must be an object keyed by node ID.");for(let o of Object.values(r))if(o==null||typeof o!="object"||Array.isArray(o))throw new E("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function no(e,t,n){let r=new Set,o;do{let i=await e.listPublications(t,{cursor:o,limit:Iu}),s=i.publications.find((a)=>a.publicationId==n);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new E("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new E("publication.not-found",`Publication ${JSON.stringify(n)} was not found.`)}async function ju(e,t,n,r=60000){let o=Date.now()+r,i=t;while(!OC.has(i.status)&&i.waits.length==0){let s=o-Date.now();if(s<=0)return{run:i,timedOut:!0};if(await n.wait(Math.min(1000,s)),Date.now()>=o)return{run:i,timedOut:!0};try{i=await e.getRun(i.runId,AbortSignal.timeout(Math.max(1,o-Date.now())))}catch(a){if(Date.now()>=o||a instanceof Error&&a.name=="TimeoutError")return{run:i,timedOut:!0};throw new E("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function ro(e,t=!1){if(t)return 3;if(e.waits.length>0)return 2;return e.status=="failed"||e.status=="canceled"||e.status=="indeterminate"?1:0}function Xb(e){return new E(e.code,e.message,{status:e.status,...e.details})}async function _u(e,t,n,r,o=60000){let i=Date.now()+o,s=n;while(s.status=="pending"){let a=i-Date.now();if(a<=0)return{operation:s,timedOut:!0};if(await r.wait(Math.min(1000,a)),Date.now()>=i)return{operation:s,timedOut:!0};try{s=await e.getPublishOperation(t,s.operationId,AbortSignal.timeout(Math.max(1,i-Date.now())))}catch(c){if(Date.now()>=i||c instanceof Error&&c.name=="TimeoutError")return{operation:s,timedOut:!0};throw new E("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:t,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var PC=new Set(Hi);function ew(e){let t=!1,n=[],r,o,i,s=AC(),a,c=[],l=[],u,d,h,g,y,S,A,N,L,D,fe,ge,se,qe,Lt,tn,Ft,nn,Zn,so=!1,ss,Fu=!1,as,cs,Mu=[],Zu="draft",ls,us,ds,ps,fs,Ju=[],Bu=!1,Uu=!1;for(let rn=0;rn<e.length;rn+=1){let Jn=e[rn],ao=Jn.startsWith("--")?Jn.indexOf("="):-1,P=ao<0?Jn:Jn.slice(0,ao),Bn=ao<0?void 0:Jn.slice(ao+1);if(Bn!=null&&["--json","--follow","--wait","--yes","--pending-wait","--include-dependencies"].includes(P))throw new E("cli.invalid-arguments",`${P} does not accept a value.`);if(P.startsWith("--")){let V=P.slice(2);if(l.includes(V)&&V!="set"&&V!="unset"&&V!="tag")throw new E("cli.invalid-arguments",`Duplicate option --${V}.`);l.push(V)}if(["--scope","--key","--space"].includes(P)){let V=Bn??e[++rn];if(V==null||V.startsWith("--"))throw new E("cli.invalid-arguments",`${P} requires a value.`);if(P==="--scope")r=V;else if(P==="--key")o=V;else i=V}else if(P=="--json")Fu=!0;else if(P=="--include-dependencies")t=!0;else if(P=="--follow")so=!0;else if(P=="--wait")Bu=!0;else if(P=="--yes")Uu=!0;else if(P=="--pending-wait")ls=!0;else if(P=="--idempotency-key"||P=="--expected-publication"||P=="--revision"||P=="--publication"||P=="--pointer"||P=="--offset"||P=="--max-bytes"||P=="--code"||P=="--connection"||P=="--cron"||P=="--description"||P=="--every"||P=="--expected-revision"||P=="--file"||P=="--flow"||P=="--name"||P=="--source"||P=="--input"||P=="--trigger"||P=="--outputs"||P=="--status"||P=="--cursor"||P=="--limit"||P=="--after"||P=="--comment"||P=="--timeout"||P=="--timezone"||P=="--tag"||P=="--set"||P=="--unset"){let V=Bn??e[rn+1];if(V==null||V.length==0||Bn==null&&V.startsWith("-")&&V!="-")throw new E("cli.invalid-arguments",`${P} requires a value.`);if(Bn==null)rn++;if(P=="--idempotency-key")s=V;else if(P=="--expected-publication")a=V;else if(P=="--revision")h=V;else if(P=="--publication")g=V;else if(P=="--pointer")y=V;else if(P=="--after")L=V;else if(P=="--code")fe=V;else if(P=="--connection")ge=V;else if(P=="--cron")se=V;else if(P=="--description")Lt=V;else if(P=="--every")tn=V;else if(P=="--expected-revision")Ft=V;else if(P=="--file")nn=V;else if(P=="--flow")Zn=V;else if(P=="--name")cs=V;else if(P=="--comment")ds=V;else if(P=="--input")ss=V;else if(P=="--trigger")u=V;else if(P=="--outputs")d=V;else if(P=="--cursor")qe=V;else if(P=="--timezone")fs=V;else if(P=="--tag")n.push(V);else if(P=="--set")Mu.push(V);else if(P=="--unset")Ju.push(V);else if(P=="--source"){if(V!="draft"&&V!="live")throw new E("cli.invalid-arguments","--source must be draft or live.");Zu=V}else if(P=="--status"){if(!PC.has(V))throw new E("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(V)}.`);us=V}else{let It=Number(V),Lw=P=="--offset"?0:1;if(!Number.isSafeInteger(It)||It<Lw||P=="--limit"&&It>100||P=="--max-bytes"&&It>1048576)throw new E("cli.invalid-arguments",`${P} has an invalid value.`);if(P=="--limit")as=It;else if(P=="--offset")S=It;else if(P=="--max-bytes")A=It;else ps=It}}else if(P.startsWith("-"))throw new E("cli.invalid-arguments",`Unknown option ${JSON.stringify(P)}.`);else c.push(P)}if(L!=null){if(c[0]=="runs"&&c[1]=="results")N=L;else if(D=Number(L),!Number.isSafeInteger(D)||D<0)throw new E("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{includeDependencies:t,tags:n,scope:r,key:o,space:i,idempotencyKey:s,...N==null?{}:{resultAfter:N},...A==null?{}:{maxBytes:A},...S==null?{}:{offset:S},...y==null?{}:{pointer:y},...h==null?{}:{revision:h},...g==null?{}:{publication:g},...ds==null?{}:{comment:ds},...a==null?{}:{expectedPublication:a},...D==null?{}:{after:D},...fe==null?{}:{code:fe},...ge==null?{}:{connection:ge},...se==null?{}:{cron:se},...qe==null?{}:{cursor:qe},...Lt==null?{}:{description:Lt},...tn==null?{}:{every:tn},...Ft==null?{}:{expectedRevision:Ft},...nn==null?{}:{file:nn},...Zn==null?{}:{flow:Zn},follow:so,...ss==null?{}:{input:ss},json:Fu,...as==null?{}:{limit:as},...cs==null?{}:{name:cs},positionals:c,options:l,...u==null?{}:{trigger:u},...d==null?{}:{outputs:d},sets:Mu,source:Zu,...us==null?{}:{status:us},...ls==null?{}:{pendingWait:ls},...ps==null?{}:{timeoutMs:ps},...fs==null?{}:{timezone:fs},unsets:Ju,wait:Bu,yes:Uu}}var TC=0.1,$C=3,oo=it("type",[v({type:b("focus"),nodeId:C().min(1)}),v({type:b("zoom"),zoom:B().min(TC).max($C)}),v({type:b("pan"),dx:B(),dy:B()}),v({type:b("fit")})]);var Ru=C().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var Ln=C().min(1),HC=Pe(),QC=v({kind:b("graph.trigger.create"),nodeId:Ln,key:Ln,connectionId:Ln.optional(),name:Ln.optional(),config:oe(Ln,HC),schedule:qt.readonly().optional()});function Au(e){return ft(e),R(rt()).min(1).parse(e).map((t,n)=>{let{kind:r}=Zr(t,n,O({kind:Ln}).parse);return r=="graph.trigger.create"?Zr(t,n,QC.parse):ky(t,n)})}var tw=[{snapshot:{configInputs:[{handle:"baseId",jsonSchema:{type:"string",pattern:"^app[A-Za-z0-9]{14}$"},nullable:!1},{handle:"formula",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"tableIdOrName",jsonSchema:{type:"string",minLength:1,maxLength:255},nullable:!1},{handle:"triggerField",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^[^}]*$"},nullable:!1},{handle:"view",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"fields",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"maxRecordsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:1000},nullable:!1,value:200}],definitionVersion:2,description:"Polls an Airtable table and triggers when a record is created or updated, ordered by a time field.",displayName:"Record Created or Updated",key:"airtable.on_record_changed",name:"on_record_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{baseId:{type:"string"},createdTime:{type:"string"},fields:{type:"object"},recordId:{type:"string"},tableIdOrName:{type:"string"},triggerField:{type:"string"},triggerFieldValue:{type:"string"}},additionalProperties:!1,required:["baseId","tableIdOrName","recordId","createdTime","triggerField","triggerFieldValue","fields"]}},nullable:!1}],provider:"airtable",type:"poll"},options:!1},{snapshot:{key:"asana.on_task_event",provider:"asana",name:"on_task_event",displayName:"Project Task Event",description:"Receives tasks added to a project, completion changes, and selected custom field changes. Task details represent current state, not historical state.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!0},successStatus:200},configInputs:[{handle:"projectId",jsonSchema:{type:"string",minLength:1,title:"Project ID"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["task.added","task.completed","task.field_changed"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["task.added","task.completed"]},{handle:"customFieldId",jsonSchema:{type:"string",minLength:1,title:"Custom field ID"},nullable:!0}],outputs:[{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},task:{type:"object"},change:{type:"object"}},required:["event","task","change"]}},nullable:!1}]},callback:{headers:["x-hook-secret","x-hook-signature"],query:[]},options:!1},{snapshot:{key:"calendly.on_booking_event",provider:"calendly",name:"on_booking_event",displayName:"Booking Created or Canceled",description:"Receives bookings and cancellations, preserving reschedule links. Requires a Personal Access Token connection.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"scope",jsonSchema:{type:"string",enum:["user","organization"],title:"Scope"},nullable:!1,value:"user"},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["invitee.created","invitee.canceled"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["invitee.created","invitee.canceled"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["invitee.created","invitee.canceled"]},nullable:!1},{handle:"inviteeUri",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["calendly-webhook-signature"],query:[]},options:!1},{snapshot:{key:"clickup.on_task_event",provider:"clickup",name:"on_task_event",displayName:"Task Event",description:"Receives task creation, status changes, and new comments in a ClickUp Workspace or List.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"workspaceId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"Workspace ID"},nullable:!1},{handle:"listId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"List ID"},nullable:!0},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["taskCreated","taskStatusUpdated","taskCommentPosted"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},nullable:!1},{handle:"taskId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-signature"],query:[]},options:!1},{snapshot:{key:"feishu_app_bot.on_event",provider:"feishu_app_bot",name:"on_event",displayName:"Application Event",description:"Receives selected Feishu application events through a shared event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.]{0,127}$"},minItems:1,maxItems:200,uniqueItems:!0,title:"Event types"},nullable:!1},{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",minLength:1,maxLength:256},maxItems:100,uniqueItems:!0,title:"Chat IDs"},nullable:!0,description:"Leave empty to receive events from all chats available to the source."},{handle:"resource",jsonSchema:{type:"object",properties:{kind:{type:"string",enum:["document","calendar","approval"]},id:{type:"string",minLength:1,maxLength:256},documentType:{type:"string",enum:["doc","docx","sheet","bitable","file","folder"]}},additionalProperties:!1,required:["kind","id"],title:"Resource subscription"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"tenantKey",jsonSchema:{type:"string"},nullable:!1},{handle:"occurredAt",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"feishu"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},verificationToken:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},manageSubscriptions:{type:"boolean"}},required:["version","name","connectionId","teamId","verificationToken","encryptKey","eventTypes","manageSubscriptions"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"feishu",provider:"feishu_app_bot",triggerId:"feishu_app_bot.on_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"feishu"},{snapshot:{key:"fireflies.on_meeting_ready",provider:"fireflies",name:"on_meeting_ready",displayName:"Meeting Transcript or Summary Ready",description:"Receives separate transcript and summary readiness events through Fireflies Webhooks V2 after checking meeting access.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["meeting.transcribed","meeting.summarized"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"fireflies"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]}}},required:["kind","version","name","connectionId","teamId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"fireflies",provider:"fireflies",triggerId:"fireflies.on_meeting_ready",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"fireflies"},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["*","branch_protection_configuration","branch_protection_rule","check_run","check_suite","code_scanning_alert","commit_comment","create","custom_property_values","delete","dependabot_alert","deploy_key","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issue_comment","issue_dependencies","issues","label","member","meta","milestone","package","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","pull_request_review_thread","push","registry_package","release","repository","repository_advisory","repository_import","repository_ruleset","repository_vulnerability_alert","secret_scanning_alert","secret_scanning_alert_location","secret_scanning_scan","security_and_analysis","star","status","sub_issues","team_add","watch","workflow_job","workflow_run"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1}],definitionVersion:2,description:"Triggers when selected GitHub webhook events occur in a repository.",displayName:"Repository Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.on_repo_event",name:"on_repo_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"github",type:"integration"},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1},{handle:"number",jsonSchema:{type:"integer",minimum:1},nullable:!1,description:"Number of the pull request to watch."}],definitionVersion:2,description:"Watches one pull request using notifications and periodic checks. Starts from its current state; reports observed changes, not every intermediate transition or review event.",displayName:"Watch Pull Request",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.watch_pull_request",name:"watch_pull_request",provider:"github",type:"integration",outputs:[{handle:"pullRequest",jsonSchema:{type:"object",properties:{id:{type:"integer"},number:{type:"integer"},title:{type:"string"},url:{type:"string"},state:{type:"string",enum:["open","closed"]},draft:{type:"boolean"},merged:{type:"boolean"},updatedAt:{type:"string"},headSha:{type:"string"},baseSha:{type:"string"}},additionalProperties:!1,required:["id","number","title","url","state","draft","merged","updatedAt","headSha","baseSha"]},nullable:!1},{handle:"version",jsonSchema:{type:"string"},nullable:!1}]},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["push","tag_push","issues","confidential_issues","note","confidential_note","merge_requests","job","pipeline","wiki_page","deployment","feature_flag","releases","milestone","emoji","resource_access_token","resource_deploy_token"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"project",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$"},nullable:!1},{handle:"pushBranchFilter",jsonSchema:{type:"string",maxLength:255},nullable:!1,value:""}],definitionVersion:2,description:"Triggers when selected GitLab webhook events occur in a project.",displayName:"Project Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"gitlab.on_project_event",name:"on_project_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"gitlabEvent",jsonSchema:{type:"string"},nullable:!1}],provider:"gitlab",type:"integration"},callback:{headers:["idempotency-key","x-gitlab-event","x-gitlab-token"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"labelNamesOrIds",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,description:"Only trigger on messages carrying all of these labels, referenced by name or ID.",value:[]},{handle:"readStatus",jsonSchema:{type:"string",enum:["Read","Unread","All"]},nullable:!1,value:"All"},{handle:"search",jsonSchema:{type:"string"},nullable:!1,description:"Gmail search-syntax query the message must match.",value:""},{handle:"sender",jsonSchema:{type:"string"},nullable:!1,description:"Only trigger on messages whose sender matches this address or name.",value:""},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on draft messages."},{handle:"includeSpamAndTrash",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages in SPAM and TRASH."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls the Gmail mailbox and triggers when a new message is received.",displayName:"New Message Received",key:"gmail.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{historyId:{type:["string","null"]},labelIds:{type:"array",items:{type:"string"}},messageId:{type:"string"},messageTimestamp:{type:"string"},sender:{type:"string"},subject:{type:"string"},threadId:{type:"string"},to:{type:"string"}},additionalProperties:!1,required:["messageId","threadId","historyId","labelIds","subject","sender","to","messageTimestamp"]}},nullable:!1}],provider:"gmail",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"calendarId",jsonSchema:{type:"string",minLength:1,maxLength:1024},nullable:!1},{handle:"changes",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","cancelled"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated","cancelled"]},{handle:"matchTerm",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxEventsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100}],definitionVersion:2,description:"Polls a Google Calendar and triggers when an event is created, updated or cancelled.",displayName:"Event Changed",key:"googlecalendar.on_event_changed",name:"on_event_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{attendeeEmails:{type:"array",items:{type:"string"}},calendarId:{type:"string"},changeType:{type:"string",enum:["created","updated","cancelled"]},created:{type:["string","null"]},creatorEmail:{type:["string","null"]},description:{type:["string","null"]},end:{type:["object","null"]},eventId:{type:"string"},eventType:{type:["string","null"]},htmlLink:{type:["string","null"]},isAllDay:{type:"boolean"},location:{type:["string","null"]},organizerEmail:{type:["string","null"]},recurringEventId:{type:["string","null"]},start:{type:["object","null"]},status:{type:"string"},summary:{type:["string","null"]},updated:{type:["string","null"]}},additionalProperties:!1,required:["changeType","calendarId","eventId","status","summary","description","location","htmlLink","start","end","isAllDay","organizerEmail","creatorEmail","attendeeEmails","recurringEventId","eventType","created","updated"]}},nullable:!1}],provider:"googlecalendar",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Uses a Google Drive changes.watch channel and triggers when Drive changes are available.",displayName:"Changes Detected",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.changes_detected",name:"changes_detected",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeId:{type:"string"},changeType:{type:["string","null"]},driveId:{type:["string","null"]},file:{type:["object","null"]},fileId:{type:["string","null"]},notification:{type:"object",properties:{changedTypes:{type:"array",items:{type:"string"}},messageNumber:{type:["string","null"]},resourceState:{type:"string"},resourceUri:{type:["string","null"]}},additionalProperties:!1,required:["resourceState","changedTypes","messageNumber","resourceUri"]},removed:{type:"boolean"},time:{type:["string","null"]}},additionalProperties:!1,required:["changeId","changeType","removed","time","fileId","driveId","file","notification"]}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"changeType",jsonSchema:{type:"string",enum:["created","updated"]},nullable:!1},{handle:"driveId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{0,512}$"},nullable:!1,value:""},{handle:"folderId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{2,512}$"},nullable:!1},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"mimeTypes",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"namePrefix",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxFilesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.",displayName:"File or Folder Change in a Folder",key:"googledrive.on_file_change",name:"on_file_change",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdTime:{type:["string","null"]},driveId:{type:["string","null"]},eventType:{type:"string",enum:["file_created","file_updated","folder_created","folder_updated"]},fileId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifyingUser:{type:["object","null"]},mimeType:{type:"string"},modifiedTime:{type:["string","null"]},name:{type:"string"},parents:{type:"array",items:{type:"string"}},size:{type:"string"},webViewLink:{type:["string","null"]}},additionalProperties:!1,required:["eventType","itemType","fileId","name","mimeType","createdTime","modifiedTime","parents","webViewLink","driveId","lastModifyingUser"]}},nullable:!1}],provider:"googledrive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Monitors Drive changes using notifications and periodic scans of the same change stream.",displayName:"Watch Changes",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.watch_changes",name:"watch_changes",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object"}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"columnRange",jsonSchema:{type:"string",pattern:"^[A-Za-z]{1,3}(?::[A-Za-z]{1,3})?$"},nullable:!1,value:"A:ZZZ"},{handle:"sheet",jsonSchema:{type:"string",minLength:1},nullable:!1},{handle:"spreadsheetId",jsonSchema:{type:"string",minLength:1},nullable:!1},{group:"Advanced settings",collapsed:!0},{handle:"dateTimeRender",jsonSchema:{type:"string",enum:["FORMATTED_STRING","SERIAL_NUMBER"]},nullable:!1,value:"FORMATTED_STRING"},{handle:"firstDataRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:2},{handle:"headerRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:1},{handle:"maxRowsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100},{handle:"valueRender",jsonSchema:{type:"string",enum:["UNFORMATTED_VALUE","FORMATTED_VALUE","FORMULA"]},nullable:!1,value:"UNFORMATTED_VALUE"}],definitionVersion:2,description:"Polls a sheet and triggers once for every new row appended below the last row already seen.",displayName:"New Row Added",key:"googlesheets.on_row_added",name:"on_row_added",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{row:{type:"object"},rowNumber:{type:"integer"},sheetId:{type:"integer"},sheetTitle:{type:"string"},spreadsheetId:{type:"string"},values:{type:"array",items:{}}},additionalProperties:!1,required:["spreadsheetId","sheetId","sheetTitle","rowNumber","row","values"]}},nullable:!1}],provider:"googlesheets",type:"poll"},options:!1},{snapshot:{key:"intercom.on_conversation_event",provider:"intercom",name:"on_conversation_event",displayName:"Customer Conversation or Ticket",description:"Receives customer conversations, customer replies and new tickets from a verified Intercom application event source. Administrator replies are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["conversation.user.created","conversation.user.replied","ticket.created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"workspaceId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object",properties:{},additionalProperties:!0},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"intercom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"intercom",provider:"intercom",triggerId:"intercom.on_conversation_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"intercom"},{snapshot:{key:"jira.on_issue_event",provider:"jira",name:"on_issue_event",displayName:"Issue or Comment Event",description:"Receives Jira Cloud issue creation, issue updates and new comments through a shared project webhook with automatic renewal.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["jira:issue_created","jira:issue_updated","comment_created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"cloudId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"jira"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},project:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]}}},required:["kind","version","name","connectionId","teamId","project","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"jira",provider:"jira",triggerId:"jira.on_issue_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!0},options:!1,eventSource:"jira"},{snapshot:{configInputs:[{handle:"teamId",jsonSchema:{type:"string",pattern:"^[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}$",title:"Team ID"},nullable:!1,description:"Linear Team UUID. Use Copy model UUID in Linear to find it."},{handle:"stateIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[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}$"},maxItems:50,uniqueItems:!0,title:"Issue statuses"},nullable:!1,value:[],description:"Choose statuses from the selected Team. Empty means all statuses. Matches the current status, not every transition into it."}],definitionVersion:2,description:"Watches new and updated issues in a Linear team with periodic checks. Starts from now without running existing issues. Reports observed current states, not deletions or every intermediate status change.",displayName:"Issue Created or Updated",key:"linear.on_issue_changed",name:"on_issue_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string"},identifier:{type:"string"},title:{type:"string"},url:{type:"string"},teamId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},state:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"}},additionalProperties:!1,required:["id","name","type"]}},additionalProperties:!1,required:["id","identifier","title","url","teamId","createdAt","updatedAt","state"]}},nullable:!1}],provider:"linear",type:"poll"},options:!0},{snapshot:{configInputs:[{handle:"dataSourceId",jsonSchema:{type:"string",pattern:"^(?:|[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})$"},nullable:!1,value:""},{handle:"databaseId",jsonSchema:{type:"string",pattern:"^[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}$"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["page_added","page_updated"]},minItems:1,uniqueItems:!0},nullable:!1,value:["page_added"]},{group:"Advanced settings",collapsed:!0},{handle:"includeProperties",jsonSchema:{type:"boolean"},nullable:!1,value:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Notion database and triggers when a page is added to it or an existing page is edited.",displayName:"Database Page Added or Updated",key:"notion.on_database_page_event",name:"on_database_page_event",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdBy:{type:"object"},createdTime:{type:"string"},dataSourceId:{type:"string"},databaseId:{type:"string"},event:{type:"string",enum:["page_added","page_updated"]},lastEditedBy:{type:"object"},lastEditedTime:{type:"string"},pageId:{type:"string"},properties:{type:"object"},title:{type:"string"},url:{type:"string"}},additionalProperties:!1,required:["event","pageId","databaseId","dataSourceId","url","title","createdTime","lastEditedTime","createdBy","lastEditedBy"]}},nullable:!1}],provider:"notion",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","deleted"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated"]},{handle:"itemId",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"parentFolderId",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls the OneDrive change feed and triggers when a file or folder is created, updated or deleted.",displayName:"File or Folder Changed",key:"one_drive.on_item_changed",name:"on_item_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeType:{type:"string",enum:["created","updated","deleted"]},createdDateTime:{type:["string","null"]},driveId:{type:["string","null"]},eTag:{type:["string","null"]},itemId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifiedDateTime:{type:["string","null"]},mimeType:{type:["string","null"]},name:{type:"string"},parentFolderId:{type:["string","null"]},size:{type:["number","null"]},webUrl:{type:"string"}},additionalProperties:!1,required:["itemId","name","changeType","itemType","size","mimeType","webUrl","parentFolderId","driveId","createdDateTime","lastModifiedDateTime","eTag"]}},nullable:!1}],provider:"one_drive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"folder",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_=-]*$"},nullable:!1,value:"inbox",description:"A well-known mail folder name, folder ID, or an empty string for the whole mailbox."},{handle:"readStatus",jsonSchema:{type:"string",enum:["All","Read","Unread"]},nullable:!1,value:"All"},{handle:"senderAddress",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Exact sender address, or empty for any sender."},{handle:"subjectContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Case-insensitive subject text."},{handle:"withAttachmentsOnly",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Microsoft Outlook mail folder and triggers when a new message arrives.",displayName:"New Message Received",key:"outlook.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{bodyPreview:{type:"string"},categories:{type:"array",items:{type:"string"}},conversationId:{type:"string"},from:{type:"string"},fromName:{type:"string"},hasAttachments:{type:"boolean"},importance:{type:"string"},internetMessageId:{type:"string"},isDraft:{type:"boolean"},isRead:{type:"boolean"},messageId:{type:"string"},parentFolderId:{type:"string"},receivedDateTime:{type:"string"},subject:{type:"string"},to:{type:"array",items:{type:"string"}},webLink:{type:"string"}},additionalProperties:!1,required:["messageId","internetMessageId","conversationId","subject","bodyPreview","from","fromName","to","receivedDateTime","hasAttachments","isRead","isDraft","importance","categories","parentFolderId","webLink"]}},nullable:!1}],provider:"outlook",type:"poll"},options:!1},{snapshot:{key:"pandadoc.on_document_event",provider:"pandadoc",name:"on_document_event",displayName:"Document Status Changed",description:"Receives document status changes in the connected workspace, optionally only when the entire document is completed.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!0,allowEmpty:!1},successStatus:200},configInputs:[{handle:"completedOnly",jsonSchema:{type:"boolean",title:"Completed documents only"},nullable:!1,value:!0}],outputs:[{handle:"events",nullable:!1,jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},data:{type:"object"}},required:["event","data"]}}}]},callback:{headers:[],query:["signature"]},options:!1},{snapshot:{key:"pipedrive.on_crm_event",provider:"pipedrive",name:"on_crm_event",displayName:"Deal or Contact Event",description:"Receives new deals or contacts, or actual changes to a deal stage or status using Pipedrive Webhooks v2.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventType",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"],title:"Event"},nullable:!1,value:"deal.created"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["authorization"],query:[]},options:!1},{snapshot:{key:"resend.on_email_event",provider:"resend",name:"on_email_event",displayName:"Email Received, Bounced or Complained",description:"Receives inbound email, bounce, and complaint notifications. Read message bodies and attachments with Actions.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["email.received","email.bounced","email.complained"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["email.received","email.bounced","email.complained"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["email.received","email.bounced","email.complained"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"emailId",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["svix-id","svix-signature","svix-timestamp"],query:[]},options:!1},{snapshot:{key:"sentry.on_issue_alert",provider:"sentry",name:"on_issue_alert",displayName:"Issue Alert",description:"Receives Issue Alert Rule notifications from a verified Sentry Custom Integration installation.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"projectIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]+$"},uniqueItems:!0,title:"Project IDs"},nullable:!0},{handle:"ruleNames",jsonSchema:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0,title:"Alert rule names"},nullable:!0},{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["issue.alert"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["issue.alert"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"organizationId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"sentry"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},installationId:{type:"string",minLength:1,maxLength:256},organizationId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"issue.alert"}}},required:["kind","version","name","connectionId","teamId","appId","installationId","organizationId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"sentry",provider:"sentry",triggerId:"sentry.on_issue_alert",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"sentry"},{snapshot:{configInputs:[{handle:"topics",jsonSchema:{type:"array",items:{type:"string",enum:["app/scopes_update","app/uninstalled","app_purchases_one_time/update","app_subscriptions/approaching_capped_amount","app_subscriptions/update","bulk_operations/finish","carts/create","carts/update","channels/delete","checkout_and_accounts_configurations/update","checkouts/create","checkouts/delete","checkouts/update","collection_listings/add","collection_listings/remove","collection_listings/update","collection_publications/create","collection_publications/delete","collection_publications/update","collections/create","collections/delete","collections/update","companies/create","companies/delete","companies/update","company_contact_roles/assign","company_contact_roles/revoke","company_contacts/create","company_contacts/delete","company_contacts/update","company_locations/create","company_locations/delete","company_locations/update","customer.joined_segment","customer.left_segment","customer.tags_added","customer.tags_removed","customer_account_settings/update","customer_groups/create","customer_groups/delete","customer_groups/update","customers/create","customers/delete","customers/disable","customers/enable","customers/purchasing_summary","customers/update","customers_email_marketing_consent/update","customers_marketing_consent/update","delivery_promise_settings/update","disputes/create","disputes/update","domains/create","domains/destroy","domains/update","draft_orders/create","draft_orders/delete","draft_orders/update","fulfillment_events/create","fulfillment_events/delete","fulfillment_holds/added","fulfillment_holds/released","fulfillment_orders/cancellation_request_accepted","fulfillment_orders/cancellation_request_rejected","fulfillment_orders/cancellation_request_submitted","fulfillment_orders/cancelled","fulfillment_orders/fulfillment_request_accepted","fulfillment_orders/fulfillment_request_rejected","fulfillment_orders/fulfillment_request_submitted","fulfillment_orders/fulfillment_service_failed_to_complete","fulfillment_orders/hold_released","fulfillment_orders/line_items_prepared_for_local_delivery","fulfillment_orders/line_items_prepared_for_pickup","fulfillment_orders/manually_reported_progress_stopped","fulfillment_orders/merged","fulfillment_orders/moved","fulfillment_orders/order_routing_complete","fulfillment_orders/placed_on_hold","fulfillment_orders/progress_reported","fulfillment_orders/rescheduled","fulfillment_orders/scheduled_fulfillment_order_ready","fulfillment_orders/split","fulfillments/create","fulfillments/update","inventory_items/create","inventory_items/delete","inventory_items/update","inventory_levels/connect","inventory_levels/disconnect","inventory_levels/update","locales/create","locales/destroy","locales/update","locations/activate","locations/create","locations/deactivate","locations/delete","locations/update","machine_translation_batch/completed","metafield_definitions/create","metafield_definitions/delete","metafield_definitions/update","order_transactions/create","orders/cancelled","orders/create","orders/delete","orders/edited","orders/fulfilled","orders/link_requested","orders/paid","orders/partially_fulfilled","orders/risk_assessment_changed","orders/shopify_protect_eligibility_changed","orders/updated","payment_schedules/due","payment_terms/create","payment_terms/delete","payment_terms/update","product_feeds/create","product_feeds/full_sync","product_feeds/full_sync_finish","product_feeds/incremental_sync","product_feeds/update","product_listings/add","product_listings/remove","product_listings/update","product_publications/create","product_publications/delete","product_publications/update","products/create","products/delete","products/update","profiles/create","profiles/delete","profiles/update","publications/delete","refunds/create","returns/approve","returns/cancel","returns/close","returns/decline","returns/process","returns/reopen","returns/request","returns/update","reverse_deliveries/attach_deliverable","reverse_fulfillment_orders/dispose","scheduled_product_listings/add","scheduled_product_listings/remove","scheduled_product_listings/update","segments/create","segments/delete","segments/update","selling_plan_groups/create","selling_plan_groups/delete","selling_plan_groups/update","shop/update","subscription_billing_attempts/challenged","subscription_billing_attempts/failure","subscription_billing_attempts/success","subscription_billing_cycle_edits/create","subscription_billing_cycle_edits/delete","subscription_billing_cycle_edits/update","subscription_billing_cycles/skip","subscription_billing_cycles/unskip","subscription_contracts/activate","subscription_contracts/cancel","subscription_contracts/create","subscription_contracts/expire","subscription_contracts/fail","subscription_contracts/pause","subscription_contracts/update","tax_partners/update","tax_summaries/create","tender_transactions/create","themes/create","themes/delete","themes/publish","themes/update","variants/in_stock","variants/out_of_stock"]},minItems:1,maxItems:20,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when selected Shopify webhook topics occur in the connected store.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"shopify.on_shop_event",name:"on_shop_event",outputs:[{handle:"apiVersion",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"shopDomain",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"triggeredAt",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"shopify",type:"integration"},callback:{headers:["x-shopify-api-version","x-shopify-event-id","x-shopify-shop-domain","x-shopify-topic","x-shopify-triggered-at","x-shopify-webhook-id"],query:["open_flow_callback"]},options:!1},{snapshot:{configInputs:[{handle:"channelId",jsonSchema:{type:"string",pattern:"^[CDG][A-Z0-9]{2,31}$"},nullable:!1,description:"Slack conversation ID to watch, e.g. C0122KQ70S7E."},{handle:"fromUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Only trigger on messages written by these Slack user IDs. Empty means any author."},{handle:"ignoreUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Never trigger on messages written by these Slack user IDs."},{handle:"textContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Only trigger when message text contains this string, case-insensitively."},{group:"Advanced settings",collapsed:!0},{handle:"includeBotMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages posted by bots and apps."},{handle:"includeSystemMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on Slack system notices."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:15,description:"Maximum number of messages processed per poll."}],definitionVersion:2,description:"Polls one Slack conversation and triggers when a new message is posted to it.",displayName:"New Channel Message",key:"slack.on_message_posted",name:"on_message_posted",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{botId:{type:["string","null"]},channelId:{type:"string"},files:{type:"array",items:{type:"object",properties:{id:{type:"string"},mimetype:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["id","name","mimetype"]}},messageTs:{type:"string"},subtype:{type:["string","null"]},text:{type:"string"},threadTs:{type:["string","null"]},userId:{type:["string","null"]}},additionalProperties:!1,required:["channelId","messageTs","threadTs","userId","botId","subtype","text","files"]}},nullable:!1}],provider:"slack",type:"poll"},options:!1},{snapshot:{key:"slackbot.on_event",provider:"slackbot",name:"on_event",displayName:"Mention or Direct Message",description:"Receives user mentions and new direct messages through a shared Slack application event source. Slack Connect events are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["app_mention","message.im"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["app_mention","message.im"]},{handle:"channelIds",jsonSchema:{type:"array",items:{type:"string",minLength:1},maxItems:100,uniqueItems:!0,title:"Channel IDs"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"teamId",jsonSchema:{type:"string"},nullable:!1},{handle:"channel",jsonSchema:{type:"string"},nullable:!1},{handle:"user",jsonSchema:{type:"string"},nullable:!1},{handle:"text",jsonSchema:{type:"string"},nullable:!1},{handle:"ts",jsonSchema:{type:"string"},nullable:!1},{handle:"threadTs",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"slack"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",pattern:"^A[A-Z0-9]+$"},workspaceId:{type:"string",pattern:"^T[A-Z0-9]+$"},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["app_mention","message.im"]}}},required:["kind","version","name","connectionId","teamId","appId","workspaceId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"slack",provider:"slackbot",triggerId:"slackbot.on_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"slack"},{snapshot:{configInputs:[{handle:"apiVersion",jsonSchema:{type:"string",maxLength:40},nullable:!1,value:""},{handle:"events",jsonSchema:{type:"array",items:{type:"string",maxLength:120,pattern:"^(\\*|[a-z0-9_]+(?:\\.[a-z0-9_]+)+)$"},minItems:1,uniqueItems:!0},nullable:!1},{handle:"includeConnectedAccounts",jsonSchema:{type:"boolean"},nullable:!1,value:!1}],definitionVersion:2,description:"Triggers when selected Stripe events happen on the connected account.",displayName:"Account Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"stripe.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"livemode",jsonSchema:{type:"boolean"},nullable:!1}],provider:"stripe",type:"integration"},callback:{headers:["stripe-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form"},nullable:!1,description:"Choose a form accessible to this Connection."}],definitionVersion:2,description:"Receives new Tally form submissions through a signed, automatically managed webhook.",displayName:"Form Response",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"tally.on_form_response",name:"on_form_response",outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},createdAt:{type:"string"},formId:{type:"string"},submissionId:{type:"string"},responseId:{type:"string"},fields:{type:"array",items:{type:"object",properties:{key:{type:"string"},type:{type:"string"},label:{type:["string","null"]},value:{},options:{type:"array",items:{type:"object"}}},required:["key","type","label","value"]}}},required:["eventId","createdAt","formId","submissionId","responseId","fields"]}}],provider:"tally",type:"integration"},callback:{headers:["tally-signature"],query:[]},options:!0},{snapshot:{configInputs:[{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^-?[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram chat IDs. Empty means every chat."},{handle:"dropPendingUpdates",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Discard updates queued before the webhook is created or resumed."},{handle:"updates",jsonSchema:{type:"array",items:{enum:["*","message","edited_message","channel_post","edited_channel_post","business_connection","business_message","edited_business_message","deleted_business_messages","guest_message","message_reaction","message_reaction_count","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","purchased_paid_media","poll","poll_answer","my_chat_member","chat_member","chat_join_request","chat_boost","removed_chat_boost","managed_bot","subscription"]},minItems:1,uniqueItems:!0},nullable:!1,description:"Telegram update types that trigger a Run. Use * for the Telegram default set."},{handle:"userIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram user IDs. Empty means every user."}],definitionVersion:2,description:"Triggers when the connected Telegram bot receives a selected update.",displayName:"Bot Update",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"telegram.on_update",name:"on_update",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"telegram",type:"integration"},callback:{headers:["x-telegram-bot-api-secret-token"],query:[]},options:!1},{snapshot:{key:"typeform.on_form_response",provider:"typeform",name:"on_form_response",displayName:"Completed Form Response",description:"Receives complete Typeform submissions through an automatically managed signed webhook.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form ID"},nullable:!1}],outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},form_id:{type:"string"},token:{type:"string"},submitted_at:{type:"string"},answers:{type:"array",items:{type:"object"}},definition:{type:"object"}},required:["eventId","form_id","token","submitted_at","answers"]}}]},callback:{headers:["typeform-signature"],query:[]},options:!1},{snapshot:{key:"vercel.on_deployment_event",provider:"vercel",name:"on_deployment_event",displayName:"Deployment Ready or Failed",description:"Receives successful and failed deployments for a Vercel project.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"teamId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Team ID"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Project ID"},nullable:!1},{handle:"environment",jsonSchema:{type:"string",enum:["all","production","preview"],title:"Environment"},nullable:!1,value:"all"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deployment.ready","deployment.error"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"deploymentId",jsonSchema:{type:"string"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-vercel-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["coupon.created","coupon.updated","coupon.deleted","coupon.restored","customer.created","customer.updated","customer.deleted","order.created","order.updated","order.deleted","order.restored","product.created","product.updated","product.deleted","product.restored","product.published"]},minItems:1,maxItems:16,uniqueItems:!0},nullable:!1},{handle:"webhookName",jsonSchema:{type:"string",minLength:1,maxLength:120},nullable:!1,value:"OOMOL Trigger"}],definitionVersion:2,description:"Triggers when selected WooCommerce store events occur.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"woocommerce.on_store_event",name:"on_store_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"resource",jsonSchema:{type:"string"},nullable:!1},{handle:"source",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"woocommerce",type:"integration"},callback:{headers:["x-wc-webhook-delivery-id","x-wc-webhook-event","x-wc-webhook-id","x-wc-webhook-resource","x-wc-webhook-signature","x-wc-webhook-source","x-wc-webhook-topic"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["zen:event-type:ticket.agent_assignment_changed","zen:event-type:ticket.attachment_linked_to_comment","zen:event-type:ticket.attachment_redacted_from_comment","zen:event-type:ticket.brand_changed","zen:event-type:ticket.comment_added","zen:event-type:ticket.comment_made_private","zen:event-type:ticket.comment_redacted","zen:event-type:ticket.created","zen:event-type:ticket.csat_received","zen:event-type:ticket.csat_requested","zen:event-type:ticket.custom_field_changed","zen:event-type:ticket.custom_status_changed","zen:event-type:ticket.description_changed","zen:event-type:ticket.email_ccs_changed","zen:event-type:ticket.external_id_changed","zen:event-type:ticket.followers_changed","zen:event-type:ticket.form_changed","zen:event-type:ticket.group_assignment_changed","zen:event-type:ticket.marked_as_spam","zen:event-type:ticket.merged","zen:event-type:ticket.next_sla_breach_changed","zen:event-type:ticket.ola_policy_changed","zen:event-type:ticket.organization_changed","zen:event-type:ticket.permanently_deleted","zen:event-type:ticket.priority_changed","zen:event-type:ticket.problem_link_changed","zen:event-type:ticket.requester_changed","zen:event-type:ticket.schedule_changed","zen:event-type:ticket.sla_policy_changed","zen:event-type:ticket.soft_deleted","zen:event-type:ticket.status_changed","zen:event-type:ticket.subject_changed","zen:event-type:ticket.submitter_changed","zen:event-type:ticket.tags_changed","zen:event-type:ticket.task_due_at_changed","zen:event-type:ticket.type_changed","zen:event-type:ticket.undeleted","zen:event-type:organization.created","zen:event-type:organization.custom_field_changed","zen:event-type:organization.deleted","zen:event-type:organization.external_id_changed","zen:event-type:organization.name_changed","zen:event-type:organization.tags_changed","zen:event-type:user.active_changed","zen:event-type:user.alias_changed","zen:event-type:user.created","zen:event-type:user.custom_field_changed","zen:event-type:user.custom_role_changed","zen:event-type:user.default_group_changed","zen:event-type:user.deleted","zen:event-type:user.details_changed","zen:event-type:user.external_id_changed","zen:event-type:user.group_membership_created","zen:event-type:user.group_membership_deleted","zen:event-type:user.identity_changed","zen:event-type:user.identity_created","zen:event-type:user.identity_deleted","zen:event-type:user.last_login_changed","zen:event-type:user.merged","zen:event-type:user.name_changed","zen:event-type:user.notes_changed","zen:event-type:user.only_private_comments_changed","zen:event-type:user.organization_membership_created","zen:event-type:user.organization_membership_deleted","zen:event-type:user.password_changed","zen:event-type:user.photo_changed","zen:event-type:user.role_changed","zen:event-type:user.suspended_changed","zen:event-type:user.tags_changed","zen:event-type:user.time_zone_changed"]},minItems:1,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when one of the selected Zendesk account events occurs.",displayName:"Event Subscription",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"zendesk.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"subject",jsonSchema:{type:"string"},nullable:!1}],provider:"zendesk",type:"integration"},callback:{headers:["x-zendesk-webhook-signature","x-zendesk-webhook-signature-timestamp"],query:[]},options:!1},{snapshot:{key:"zoom.on_recording_ready",provider:"zoom",name:"on_recording_ready",displayName:"Cloud Recording Ready",description:"Receives completed cloud recordings hosted by the connected Zoom user through a verified application event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["recording.completed"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["recording.completed"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingUuid",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"zoom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"recording.completed"}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"zoom",provider:"zoom",triggerId:"zoom.on_recording_ready",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"zoom"}];function nw(e){return Xg(e).extend({name:C().trim().min(1).max(128)})}var rw=tw.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),ow=Y(rw.map((e)=>nw(e.createSchema))),iw=nw(rw[0].updateSchema),sw=v({version:b(1),expectedRevision:xe().positive()});var aw={start:"A Start node with a required message parameter. Supply it through trigger.outputs.",error:"A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",webhook:"A Webhook start node.","webhook-response":"An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.",cron:"An hourly scheduled start node.",poll:"Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",integration:"Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",decision:"AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.","skip-duplicates":"Skip items already recorded by successful Runs. Configure identity fields; an empty list uses each string or numeric item. History is private to the node and only commits after Run success.","http-request":"A single HTTP request. Bind url and request inputs; outputs are body, statusCode and headers.",openapi:"A fixed JSON API operation. Replace the example document and URL before running.",connector:"A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.",code:"A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",condition:"A condition with true and false execution branches.",value:"A fixed value node.",approval:"An Approval with approve and reject decision branches and a built-in notification output.",wait:"A Wait with a continue action and a built-in notification output.",agent:"An Agent with code computation enabled. Configure a model available in the deployment.","llm-chat":"An LLM chat Task and its node; configure a model available in the deployment.","llm-json":"An LLM JSON Task and its node; configure a model available in the deployment.","poll-notification":"Gmail events \u2192 JavaScript text formatting \u2192 Connector notification. Replace connection/action IDs and match the notification input ports."},XC=Object.keys(aw),eE=XC.map((e)=>({name:e,description:aw[e]}));var pz=v({comment:Ru}),Fn=Pe(),Se=C().min(1),be=b(1),ts=Se.refine((e)=>e==e.trim()&&Wr(e)==null,"Flow name is invalid."),ns=R(Se).transform((e)=>[...new Set(e)].toSorted()),nE=Se.transform((e)=>e.trim()).refine((e)=>Wr(e)==null,"Tag name is invalid."),cw=oe(C(),oe(C(),Fn)),lw=v({nodeId:Se,outputs:oe(C(),Fn)}),X={readFlowState:th.extend({version:be}),canvas:v({command:oo,version:be}),authoringCheck:nu,authoringEdit:Jr,authoringRead:Li,authoringSearch:Fi,authoringSchema:Ty,loadOpenApiDocument:v({url:C().min(1).max(8192),version:be}),createEventSource:ow,updateEventSource:iw,eventSourceRevision:sw,importFlow:v({file:Fn,name:ts.optional(),teamId:Se.optional(),tagIds:ns.optional(),version:be}),createFlow:v({name:ts,teamId:Se.optional(),tagIds:ns.optional(),presentation:oe(C(),Fn).optional(),version:be}),saveTag:v({name:nE,version:be}),setFlowTags:v({tagIds:ns,version:be}),updateFlow:v({name:ts.optional(),icon:C().nullable().optional(),description:C().nullable().optional(),tagIds:ns.optional(),version:be}).refine((e)=>e.name!==void 0||e.icon!==void 0||e.description!==void 0||e.tagIds!==void 0,"Flow settings are empty."),renameFlow:v({name:ts,version:be}),changeDraft:v({expectedRevisionId:Se,operations:R(Fn).min(1),version:be}),repairDraft:v({expectedRevisionId:Se,version:be}),upgradeDraft:v({expectedRevisionId:Se,version:be}),setEnabled:v({enabled:he(),expectedPublicationId:Se,version:be}),updatePresentation:v({expectedRevision:xe().positive(),value:oe(C(),Fn),version:be}),checkFlow:v({engineContract:Se,version:be}),publishFlow:v({engineContract:Se,expectedLivePublicationId:Se.nullable(),version:be}),rollbackFlow:v({expectedLivePublicationId:Se,version:be}),createDraftRun:v({engineContract:Se,inputs:cw,trigger:lw,version:b(2)}),createLiveRun:v({publicationId:Se,inputs:cw,trigger:lw,version:b(2)}),resolveWait:v({action:Z(["approve","continue","reject"]),comment:Ru,version:be}),putVariable:v({value:C().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:v({providerIds:R(Se.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:be}),removeConnectionUsage:v({connectionId:Se,expectedRevisionId:Se,expectedAccessRevision:xe().nonnegative(),version:be}),setConnectorService:v({expectedAccessRevision:xe().nonnegative(),version:be}),addProviderAccessBinding:v({accessBindingId:Se,expectedAccessRevision:xe().nonnegative(),version:be}),removeProviderAccessBinding:v({accessBindingId:Se,expectedAccessRevision:xe().nonnegative(),version:be}),versionOnly:v({version:be})};function te(e){return(t)=>e.parse(t)}var fz={readFlowState:te(X.readFlowState),canvas:te(X.canvas),authoringCheck:te(X.authoringCheck),authoringEdit:te(X.authoringEdit),authoringRead:te(X.authoringRead),authoringSearch:te(X.authoringSearch),authoringSchema:te(X.authoringSchema),loadOpenApiDocument:te(X.loadOpenApiDocument),createEventSource:te(X.createEventSource),updateEventSource:te(X.updateEventSource),eventSourceRevision:te(X.eventSourceRevision),importFlow:te(X.importFlow),createFlow:te(X.createFlow),saveTag:te(X.saveTag),setFlowTags:te(X.setFlowTags),updateFlow:te(X.updateFlow),renameFlow:te(X.renameFlow),changeDraft(e){let t=X.changeDraft.parse(e);return{...t,operations:Au(t.operations)}},repairDraft:te(X.repairDraft),upgradeDraft:te(X.upgradeDraft),setEnabled:te(X.setEnabled),updatePresentation:te(X.updatePresentation),checkFlow:te(X.checkFlow),publishFlow:te(X.publishFlow),rollbackFlow:te(X.rollbackFlow),createDraftRun:te(X.createDraftRun),createLiveRun:te(X.createLiveRun),resolveWait:te(X.resolveWait),putVariable:te(X.putVariable),queryConnectorAccessCandidates:te(X.queryConnectorAccessCandidates),removeConnectionUsage:te(X.removeConnectionUsage),setConnectorService:te(X.setConnectorService),addProviderAccessBinding:te(X.addProviderAccessBinding),removeProviderAccessBinding:te(X.removeProviderAccessBinding),versionOnly:te(X.versionOnly)};var Pu=["expected-revision","idempotency-key"],Tu=["cursor","limit"],uw=[["state show","<flow> --scope <draft|live> [--key <key>]",["scope","key"]],["state clear","<flow> --scope <draft|live> [--key <key>] --yes",["scope","key","yes"]],["dedupe clear","<flow> --scope <draft|live> --space <space> --yes",["scope","space","yes"]],["canvas","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["read","<flow> [--input JSON|@file|- | --file path|-]",["input","file"]],["search","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["edit","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["list","[--cursor <cursor>] [--limit <count>]",Tu],["export","<flow>",["include-dependencies"]],["import","--file <path|->",["file","name","idempotency-key","tag"]],["create","<name>",["idempotency-key"]],["show","<flow>",[]],["live","<flow>",[]],["rename","<flow> <new-name>",[]],["delete","<flow> --yes",["yes"]],["check","<flow> [--revision <revisionId>]",["revision"]],["enable","<flow> --expected-publication <publicationId>",["expected-publication"]],["disable","<flow> --expected-publication <publicationId>",["expected-publication"]],["connector code-access","<flow> [--publication <publicationId>]",["publication"]],["connector candidates","<flow> <provider> [provider ...]",[]],["connector code-allow","<flow> <provider> <binding> <access-revision>",[]],["connector code-remove","<flow> <provider> <binding> <access-revision>",[]],["connector remove-usage","<flow> <connection> <access-revision>",Pu],["connector providers","[--flow <flow>]",["flow"]],["connector teams","",[]],["connector search","<query> [--flow <flow>]",["flow"]],["connector show","<action> [--flow <flow>]",["flow"]],["connector connections","<service> [--flow <flow>]",["flow"]],["event-source list","",[]],["trigger search","[query]",[]],["trigger show","<key>",[]],["run","<flow>",[...Pu,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...Tu]],["runs show","<run>",[]],["runs wait","<run>",["timeout"]],["runs resolve","<run> <wait> <continue|approve|reject>",["comment"]],["runs events","<run>",["after","limit","follow","timeout"]],["runs result","<run>",[]],["runs results","<run> [--after <resultId>]",["after"]],["runs read-result","<run> <result>",["pointer","offset","limit","max-bytes"]],["runs download-result","<run> <result>",[]],["runs cancel","<run>",[]],["publish","<flow>",[...Pu,"expected-publication","timeout"]],["publications list","<flow>",Tu],["publications show","<flow> <publication>",[]],["publications wait","<flow> <operation>",["timeout"]],["publications operation","<flow> <operation>",[]],["rollback","<flow> <publication>",["expected-publication","idempotency-key"]],["open","[flow]",[]],["workbench","[flow]",[]],["schema","[read|search|edit|check|node-type]",["flow","input"]]],rE={scope:{description:"Required State scope; never defaults to live.",type:"string",enum:["draft","live"]},key:{description:"Business state key to read or clear; omit to inspect metadata or clear all business values.",type:"string"},space:{description:"Deduplication space: flow or node:<nodeId>.",type:"string"},revision:{description:"Exact Revision to read or check; defaults to the current Draft.",type:"string"},publication:{description:"Exact Publication ID whose fixed Code connections are read; defaults to the Draft.",type:"string"},pointer:{description:"JSON Pointer within the stored result; defaults to the root.",type:"string"},offset:{description:"Page offset at the selected pointer.",type:"integer",minimum:0,default:0},"max-bytes":{description:"Maximum result page bytes.",type:"integer",minimum:1,maximum:1048576,default:15000},"expected-revision":{description:"Base Revision ID from read. Required with an explicit idempotency key for draft edits and draft runs.",type:"string"},"expected-publication":{description:"Fixed Publication ID. Use none when publishing without a Live Publication.",type:"string"},"idempotency-key":{description:"Stable identity of one mutation. Reuse only with the identical arguments and base identity.",type:"string"},source:{description:"Execution source.",type:"string",enum:["draft","live"],default:"draft"},trigger:{description:"Exact Trigger ID or unambiguous name. The Start node is selected automatically; a sole legacy Manual Trigger remains supported.",type:"string"},timeout:{description:"Wait budget in milliseconds; expiration does not cancel the operation. For node set, the node execution timeout.",type:"integer",minimum:1,default:60000},limit:{description:"Maximum items in one page.",type:"integer",minimum:1,maximum:100,default:100},after:{description:"Resume events after this sequence number; use nextAfter from the preceding response.",type:"integer",minimum:0,default:0},cursor:{description:"Opaque nextCursor from the preceding page; keep the same filters.",type:"string"},comment:{description:"Optional plain-text Wait decision comment (up to 2,000 Unicode code points).",type:"string"},"pending-wait":{description:"List runs with unresolved waits, including running and queued runs.",type:"boolean"},status:{description:"Filter runs by status.",type:"string",enum:["queued","starting","running","waiting","completed","failed","canceled","indeterminate"]},"include-dependencies":{description:"Include all referenced workflow drafts in one JSON bundle.",type:"boolean"},tag:{description:"Tag ID applied to every imported workflow; repeat to select multiple tags.",type:"string"},file:{description:"Authoring request or workflow JSON file path, or - for stdin.",type:"string"},code:{description:"JavaScript source, @file, or - for stdin.",type:"string"},input:{description:"Authoring request JSON; literal JSON, @file, or -. For run, node ID to input values.",type:"string"},outputs:{description:"Start parameters or other Trigger outputs: literal JSON, @file, or -. Defaults to {}.",type:"string"},set:{description:"handle=value; repeat for multiple fields. Values use port schemas, JSON, @file, or -.",type:"string"},unset:{description:"Input/config handle to remove; repeat for multiple fields.",type:"string"},connection:{description:"Exact active Connection ID, unambiguous display name, or default.",type:"string"},flow:{description:"Exact Flow ID or unambiguous name; fixes Connector Team scope.",type:"string"},name:{description:"Display name.",type:"string"},description:{description:"Trigger description.",type:"string"},cron:{description:"Cron expression; combine with --timezone. Mutually exclusive with --every.",type:"string"},timezone:{description:"IANA time zone for --cron.",type:"string"},every:{description:"Interval such as 5m, 1h, or 1d. Mutually exclusive with --cron.",type:"string"},wait:{description:"Wait until terminal, waiting for an action, or the wait budget expires."},follow:{description:"Stream event pages as NDJSON with --json; stop on terminal, Wait, or timeout."},yes:{description:"Confirm the requested deletion."},json:{description:"Machine-readable JSON results and errors; NDJSON for followed events."},help:{description:"Show this command contract without contacting the host."}};function $u(e,t="oo flow"){let n=e.join(" ");return uw.filter(([r])=>n==""||r==n||r.startsWith(`${n} `)).map(([r,o,i])=>({command:r,usage:`${t} ${r} ${o} [--json]`,options:[...i,"json","help"].map((s)=>Object.assign({name:`--${s}`,value:!["json","help","wait","follow","yes","pending-wait","include-dependencies"].includes(s),repeatable:s=="set"||s=="unset"||s=="tag"},rE[s],r=="runs results"&&s=="after"?{type:"string",minimum:void 0,default:void 0,description:"Result ID from nextAfter on the preceding page."}:{},r=="runs read-result"&&s=="limit"?{default:20}:{}))}))}function dw(e){return uw.find(([t])=>t==e.slice(0,t.split(" ").length).join(" "))?.[2]}function pw(e="edits"){let t=ru(e);if(t!=null)return t;if(e=="edits")return ou();if(e=="outputs")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",description:"Named Start parameters or other Trigger outputs. Start uses the workflow inputDefs returned by flow read; other triggers define their own output contracts. Omitted nullable Start parameters become null; required parameters must be supplied."};if(qi.includes(e))return ou(e);if(e=="input")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:{type:"object",additionalProperties:!0},description:"Node ID -> input handle -> JSON value."};return}function Nu(e){if(e=="canvas")return{request:gn(oo,{io:"input"}),guidance:"Broadcast transient viewport commands; success does not confirm execution. No Presentation save, offline queue or replay. Pan uses screen pixels; zoom is an absolute ratio (0.1\u20133); fit includes all nodes. Repeating pan moves again; do not automatically retry an uncertain response.",examples:[{type:"focus",nodeId:"NODE_ID"},{type:"zoom",zoom:0.8},{type:"pan",dx:200,dy:-100},{type:"fit"}]};return ru(e)}function fw(e,t="oo flow"){if(e=="export")return[`${t} export FLOW_ID > template.openflow.json`];if(e=="import")return[`${t} import --file template.openflow.json --name "Imported workflow" --idempotency-key IMPORT_KEY --json`];if(e=="schema")return[`${t} schema read --json`,`${t} schema agent --json`,`${t} schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json`];let n=Nu(e);if(n==null)return oE(t);if(e=="check")return[`${t} check FLOW_ID --revision REVISION --json`];return n.examples.map((r)=>`${t} ${e} FLOW_ID${Object.keys(r).length==0?"":` --input '${JSON.stringify(r)}'`} --json`)}function oE(e){return[`${e} list --limit 20 --json`,`${e} read FLOW_ID --json`,`${e} live FLOW_ID --json`,`${e} schema code --json`,`${e} edit FLOW_ID --file edits.json --json`,`${e} connector search email --flow FLOW_ID --json`,`${e} run FLOW_ID --expected-revision REVISION_ID --idempotency-key RUN_KEY --wait --timeout 60000 --json`,`${e} runs wait RUN_ID --timeout 60000 --json`,`${e} runs resolve RUN_ID WAIT_ID approve --json`,`${e} runs events RUN_ID --after 0 --follow --timeout 60000 --json`]}import{basename as sE}from"path";async function mw(e,t,n,r,o){let[i,s,a,...c]=n;switch(i){case"code-access":case"candidates":case"code-allow":case"code-remove":case"remove-usage":{let l=i=="code-access"?1:i=="candidates"?2:i=="remove-usage"?3:4;if(i=="candidates"?n.length<l+1:n.length!=l+1)throw new E("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=iE(t),d;if(i=="code-access")d=r.publication==null?await e.getConnectorAccess(u):await e.getPublishedConnectorAccess(u,r.publication);else if(i=="candidates")d=await e.listProviderAccessBindingCandidates(u,n.slice(2));else{let h=Number(n.at(-1));if(!Number.isSafeInteger(h)||h<0)throw new E("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let g=await Ub(e,t,r);d=await e.removeConnectionUsage(u,a,g.draft.revisionId,h,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],h);else d=await e.removeProviderAccessBinding(u,a,c[0],h)}M(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,t?.flowId);M(o,r.json,{providers:l,kind:"connector.providers",version:1},l.map((u)=>`${u.serviceName} ${u.serviceId}`).join(`
66
- `));return}case"teams":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector teams [--json]`);let l=await e.listConnectorTeams();M(o,r.json,{...l,kind:"connector.teams"},l.teams.map((u)=>`${u.name} ${u.id}`).join(`
67
- `));return}case"search":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector search <query> [--json]`);let l=s.trim();if(l.length==0||l.length>256)throw new E("cli.invalid-arguments","Connector search query must contain 1\u2013256 characters.");let u=await e.searchConnectorActions(l,void 0,t?.flowId);M(o,r.json,{actions:u.map(gu),kind:"connector.search",query:l,version:1},u.map(Ou).join(`
68
- `));return}case"show":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector show <action> [--json]`);let l=await Kb(e,s,t?.flowId);M(o,r.json,{action:l,kind:"connector.show",version:1},Ou(l));return}case"connections":{if(s==null||a!=null)throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector connections <service> [--json]`);let l=await e.listConnectorConnections(s,void 0,t?.flowId);M(o,r.json,{connections:l,kind:"connector.connections",serviceId:s,version:1},l.map(Gb).join(`
69
- `));return}default:throw new E("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function gw(e,t,n,r){let[o,i,s]=t;switch(o){case"search":{if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger search [query] [--json]`);let a=i?.trim().toLowerCase();if(a!=null&&(a.length==0||a.length>256))throw new E("cli.invalid-arguments","Trigger search query must contain 1\u2013256 characters.");let c=bu(await e.listTriggerKeys(),a);M(r,n.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(Eu).join(`
70
- `));return}case"show":{if(i==null||s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger show <key> [--json]`);let a=await Wb(e,i);M(r,n.json,{definition:a,kind:"trigger.show",version:1},Eu(a));return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function iE(e){if(e==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function rs(e){if(e.publication==null)return`not-published ${e.flowId}`;return[`live ${e.flowId} ${e.publication.publicationId} ${e.publication.revisionId} ${e.status} enabled=${e.enabled}`,`inputDefs=${JSON.stringify(e.inputDefs)}`,...e.entries.flatMap((t)=>[`${t.type} ${t.nodeId} ${t.name}`,..."binding"in t?[` health=${t.binding.health}${t.binding.lastErrorCode==null?"":` error=${t.binding.lastErrorCode}`}`,...t.binding.listener==null?[]:[` listener=${JSON.stringify(t.binding.listener)}`],...t.binding.endpointUrl==null?[]:[` url=${t.binding.endpointUrl}`]]:[],..."provider"in t?[` provider=${t.provider} inputs=${JSON.stringify(t.inputs)}`]:[],` config=${JSON.stringify(t.config)}`])].join(`
71
- `)}async function hw(e,t,n,r){le(t,1,`${r.commandPrefix??"oo flow"} run <flow> [--source draft|live] [--trigger <name|id>] [--outputs <json|@file|->] [--input <json|@file|->] [--wait] [--json]`);let o=await ke(e,t[0]),i=await Yb(n,r),s=n.source=="live"?n.expectedPublication==null?await e.getLive(o.flowId):{publication:await no(e,o.flowId,n.expectedPublication)}:void 0;if(n.source=="live"&&s?.publication==null)throw new E("live.not-found",`Flow ${JSON.stringify(t[0])} has no Live Publication.`);let a=s?.publication?.revisionId??n.expectedRevision??o.draftRevisionId,{triggers:c}=await e.getRevisionTriggers(o.flowId,a),l=c.filter((D)=>D.kind=="start"),u=l.length==1?l[0].triggerId:c.length==1&&c[0]?.kind=="manual"?c[0].triggerId:void 0,d=n.trigger??u;if(d==null)throw new E("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:c.map(({triggerId:D,name:fe})=>({triggerId:D,name:fe}))});let h=c.find((D)=>D.triggerId==d),g=c.filter((D)=>D.name==d);if(h==null&&g.length>1)throw new E("trigger.ambiguous",`Trigger name ${JSON.stringify(d)} is ambiguous.`,{candidates:g.map(({triggerId:D,name:fe})=>({triggerId:D,name:fe}))});let y=h??g[0];if(y==null)throw new E("trigger.not-found",`Trigger ${JSON.stringify(d)} was not found.`);let S={};if(n.outputs!=null){let D=await Vn(n.outputs,"--outputs","run.input-unreadable",r);try{let fe=JSON.parse(D);if(fe==null||typeof fe!=="object"||Array.isArray(fe))throw Error("Expected output object.");S=fe}catch{throw new E("run.input-invalid","Trigger outputs must be valid JSON.")}}let A={nodeId:y.triggerId,outputs:S},N;if(s?.publication!=null)N=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:A,idempotencyKey:n.idempotencyKey});else N=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:A,idempotencyKey:n.idempotencyKey});let L=n.wait?await ju(e,N,r,n.timeoutMs):{run:N,timedOut:!1};return M(r,n.json,{kind:"run.create",idempotencyKey:n.idempotencyKey,...L,version:1},eo(L.run)),ro(L.run,L.timedOut)}async function yw(e,t,n,r){let[o,...i]=t;switch(o){case"list":{if(le(i,0,`${r.commandPrefix??"oo flow"} runs list --flow <flow> [--status <status>] [--pending-wait] [--cursor <cursor>] [--limit <count>] [--json]`),n.flow==null)throw new E("cli.invalid-arguments",`${r.commandPrefix??"oo flow"} runs list requires --flow <flow>.`);let s=await ke(e,n.flow),a=await e.listRuns(s.flowId,{...n.cursor==null?{}:{cursor:n.cursor},limit:n.limit??Cu,...n.status==null?{}:{status:n.status},...n.pendingWait==null?{}:{pendingWait:n.pendingWait}});M(r,n.json,{kind:"run.list",...a,version:1},a.runs.map(Hb).join(`
72
- `));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} runs show <run> [--json]`);let s=await e.getRun(i[0]);M(r,n.json,{kind:"run.show",run:s,version:1},eo(s));return}case"wait":{le(i,1,`${r.commandPrefix??"oo flow"} runs wait <run> [--timeout <milliseconds>] [--json]`);let s=i[0],a=Date.now()+(n.timeoutMs??60000);try{let c=await e.getRun(s,AbortSignal.timeout(n.timeoutMs??60000)),l=await ju(e,c,r,Math.max(0,a-Date.now()));return M(r,n.json,{kind:"run.wait",runId:s,...l,version:1},eo(l.run)),ro(l.run,l.timedOut)}catch(c){if(Date.now()>=a||c instanceof Error&&c.name=="TimeoutError")return M(r,n.json,{kind:"run.wait",runId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(c instanceof E)throw c;throw new E("run.wait-failed",c instanceof Error?c.message:String(c),{runId:s})}}case"resolve":{le(i,3,`${r.commandPrefix??"oo flow"} runs resolve <run> <wait> <continue|approve|reject> [--comment <text>] [--json]`);let[s,a,c]=i;if(c!="continue"&&c!="approve"&&c!="reject")throw new E("cli.invalid-arguments","Invalid Wait action.");let l=await e.resolveRunWait(s,a,c,n.comment);M(r,n.json,{kind:"run.resolve",resolution:l,version:1},JSON.stringify(l));return}case"events":{le(i,1,`${r.commandPrefix??"oo flow"} runs events <run> [--after <sequence>] [--limit <count>] [--follow] [--timeout <milliseconds>] [--json]`);let s=i[0],a=n.after??0,c=Date.now()+(n.timeoutMs??60000),l;try{do{if(n.follow&&Date.now()>=c)break;let u=await e.getRunEvents(s,{after:a,limit:n.limit??Cu},n.follow?AbortSignal.timeout(Math.max(1,c-Date.now())):void 0);if(a=u.nextAfter,M(r,n.json,{...u,kind:"run.events",runId:s,version:1},u.events.map(Qb).join(`
73
- `)),!n.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),Bb(u.events.at(-1)))return ro(l);if(n.after!=null&&u.events.length==0&&u.done)return ro(l);if(l.waits.length>0)return M(r,n.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},eo(l)),2;let d=c-Date.now();if(d<=0)break;if(u.events.length==0)await r.wait(Math.min(1000,d))}while(n.follow)}catch(u){if(!n.follow||Date.now()<c&&!(u instanceof Error&&u.name=="TimeoutError"))throw new E("run.events-failed",u instanceof Error?u.message:String(u),{runId:s,nextAfter:a})}return M(r,n.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!0,version:1},`timeout ${s} ${a}`),3}case"results":{le(i,1,`${r.commandPrefix??"oo flow"} runs results <run> [--after <resultId>]`);let s=await e.listRunResults(i[0],n.resultAfter);M(r,n.json,{kind:"run.results",...s},JSON.stringify(s));return}case"read-result":{le(i,2,`${r.commandPrefix??"oo flow"} runs read-result <run> <result> [--pointer <pointer>] [--offset <offset>] [--limit <limit>] [--max-bytes <bytes>]`);let s=await e.readRunResult(i[0],i[1],{pointer:n.pointer??"",offset:n.offset??0,...n.limit==null?{}:{limit:n.limit},...n.maxBytes==null?{}:{maxBytes:n.maxBytes}});M(r,n.json,{kind:"run.result-page",...s},JSON.stringify(s));return}case"download-result":{le(i,2,`${r.commandPrefix??"oo flow"} runs download-result <run> <result>`);let s=await e.downloadRunResult(i[0],i[1]);r.stdout.write(await s.text());return}case"result":{le(i,1,`${r.commandPrefix??"oo flow"} runs result <run> [--json]`);let s=await e.getRunResult(i[0]);return M(r,n.json,{kind:"run.result",result:s,version:1},JSON.stringify(s)),s.status=="completed"?0:1}case"cancel":{le(i,1,`${r.commandPrefix??"oo flow"} runs cancel <run> [--json]`);let s=await e.cancelRun(i[0]);M(r,n.json,{cancellation:s,kind:"run.cancel",version:1},`${s.status} ${s.runId} ${s.cancelAccepted?"accepted":"already-terminal"}`);return}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} runs <list|show|wait|resolve|events|result|results|read-result|download-result|cancel>`)}}async function bw(e,t,n,r){le(t,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await ke(e,t[0]),i=n.expectedPublication=="none"?null:n.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId??null,s=await e.publishFlow(o.flowId,n.expectedRevision??o.draftRevisionId,i,{idempotencyKey:n.idempotencyKey}),a=await _u(e,o.flowId,s,r,n.timeoutMs);if(s=a.operation,s.status=="pending")return M(r,n.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:n.idempotencyKey,flowId:o.flowId,...a,version:1},JSON.stringify(s)),3;if(s.status=="failed")throw new E(s.issue.code,s.issue.message,{...s.issue.nodeId==null?{}:{nodeId:s.issue.nodeId},operationId:s.operationId,flowId:o.flowId,idempotencyKey:n.idempotencyKey});let c=[],l=`${r.commandPrefix??"oo flow"} live ${o.flowId} --json`,u;try{if(u=await e.getLiveDetails(o.flowId),u.publication?.publicationId!=s.publicationId)c.push({code:"live.publication-changed",message:`Publication ${s.publicationId} succeeded. Current Live is ${u.publication?.publicationId??"not-published"}; the returned entries describe that current version.`})}catch{c.push({code:"live.details-read-failed",message:`Publication ${s.publicationId} succeeded, but its current online entries could not be read. Query ${l}.`})}let d=u?.publication?.publicationId==s.publicationId?u.publication:void 0;if(d==null)try{d=await no(e,o.flowId,s.publicationId)}catch{c.push({code:"publication.read-failed",message:`Publication ${s.publicationId} succeeded, but its metadata could not be read. Query ${l}.`})}M(r,n.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:n.idempotencyKey,operation:s,...d==null?{}:{publication:d},...u==null?{}:{live:u},...c.length==0?{}:{warnings:c},version:1},[d==null?`published ${s.publicationId} ${s.revisionId}`:Xr(d),...u==null?[]:[rs(u)],...c.map((h)=>`Warning: ${h.message}`)].join(`
74
- `))}async function ww(e,t,n,r){let[o,i,s,...a]=t;if(i==null||a.length>0)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`);let c=await ke(e,i);if(o=="list"){if(s!=null)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications list <flow> [--cursor <cursor>] [--limit <count>]`);let l=await e.listPublications(c.flowId,{...n.cursor==null?{}:{cursor:n.cursor},limit:n.limit??Iu});M(r,n.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Xr).join(`
75
- `));return}if((o=="operation"||o=="wait")&&s!=null){let l=Date.now()+(n.timeoutMs??60000);try{let u=await e.getPublishOperation(c.flowId,s,o=="wait"?AbortSignal.timeout(n.timeoutMs??60000):void 0),d=o=="wait"?await _u(e,c.flowId,u,r,Math.max(0,l-Date.now())):{operation:u,timedOut:!1};return M(r,n.json,{kind:`publication.${o}`,flowId:c.flowId,...d,version:1},JSON.stringify(d.operation)),d.operation.status=="failed"?1:d.operation.status=="pending"?3:0}catch(u){if(o=="wait"&&(Date.now()>=l||u instanceof Error&&u.name=="TimeoutError"))return M(r,n.json,{kind:"publication.wait",flowId:c.flowId,operationId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(u instanceof E)throw u;throw new E("publication.wait-failed",u instanceof Error?u.message:String(u),{flowId:c.flowId,operationId:s})}}if(o=="show"&&s!=null){let l=await no(e,c.flowId,s);M(r,n.json,{kind:"publication.show",publication:l,version:1},Xr(l));return}throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function vw(e,t,n,r){le(t,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await ke(e,t[0]),i=await no(e,o.flowId,t[1]),s=n.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId;if(s==null)throw new E("live.not-found",`Flow ${JSON.stringify(t[0])} has no Live Publication.`);let a=await e.rollbackFlow(o.flowId,i.publicationId,s,{idempotencyKey:n.idempotencyKey});M(r,n.json,{kind:"publication.rollback",expectedPublicationId:s,idempotencyKey:n.idempotencyKey,publication:a,version:1},Xr(a))}async function kw(e,t,n,r){let[o,...i]=n.positionals;switch(o){case"state":case"dedupe":{if(le(i,2,`${r.commandPrefix??"oo flow"} ${o} <show|clear> <flow> --scope <draft|live>`),n.scope!=="draft"&&n.scope!=="live")throw new E("cli.invalid-arguments","Explicit --scope draft or --scope live is required.");let[s,a]=i;if(s!=="clear"&&!(o==="state"&&s==="show"))throw new E("cli.invalid-arguments","Unknown State operation.");if(s==="clear"&&!n.yes)throw new E("cli.invalid-arguments","Clearing State requires --yes.");let c=await ke(e,a);if(s==="show"){let l=n.key==null?await e.getFlowState(c.flowId,n.scope):await e.getFlowStateValues(c.flowId,n.scope,[n.key]);M(r,n.json,{kind:"flow.state",...l},JSON.stringify(l,null,2))}else{if(o==="state")await e.clearFlowState(c.flowId,n.scope,n.key);else{if(n.space==null)throw new E("cli.invalid-arguments","--space is required.");await e.clearFlowDedupe(c.flowId,n.scope,n.space)}M(r,n.json,{kind:"flow.state.cleared",scope:n.scope},`Cleared ${n.scope} ${o}.`)}return}case"canvas":{if(le(i,1,`${r.commandPrefix??"oo flow"} canvas <flow> (--input JSON|@file|- | --file path|-) [--json]`),n.file!=null&&n.input!=null)throw new E("cli.invalid-arguments","Choose --input or --file.");let s=n.file==null?n.input:n.file=="-"?"-":`@${n.file}`;if(s==null)throw new E("cli.invalid-arguments","Canvas requires --input or --file.");let a=await to(s,r),c=await ke(e,i[0]),l=await e.broadcastCanvas(c.flowId,a);M(r,n.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{if(le(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> [--input JSON|@file|-] [--file path|-] --json`),n.file!=null&&n.input!=null)throw new E("cli.invalid-arguments","Choose --input or --file.");let s=n.file==null?n.input:n.file=="-"?"-":`@${n.file}`,a=await to(s,r),c=a.requestId;if(o=="edit"&&(typeof c!="string"||c.length==0))throw new E("cli.invalid-arguments","Edit requires a non-empty requestId.");let l=await ke(e,i[0]),u=o=="read"?await e.readAuthoring(l.flowId,a):o=="search"?await e.searchAuthoring(l.flowId,a):await e.editAuthoring(l.flowId,a);r.stdout.write(`${JSON.stringify(u)}
76
- `);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await aE(e,i.slice(1)):n.flow==null?void 0:await ke(e,n.flow);return await mw(e,a,i,n,r)}case"event-source":{if(i.length!=1||i[0]!="list")throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} event-source list [--json]`);let s=await e.listEventSources(),a=`No event sources are visible to this identity. Run "${r.commandPrefix??"oo flow"} workbench" to create and verify a Feishu event source, then list again.`;M(r,n.json,{...s,kind:"event-source.list",...s.sources.length==0?{guidance:a}:{}},s.sources.length==0?a:s.sources.map((c)=>[c.sourceId,c.name,c.teamId??"-",c.connectionId,!c.enabled?"disabled":c.verifiedAt==null?"unverified":"verified",c.eventTypes.join(",")].join("\t")).join(`
77
- `));return}case"run":return await hw(e,i,n,r);case"runs":return await yw(e,i,n,r);case"publish":return await bw(e,i,n,r);case"publications":return await ww(e,i,n,r);case"rollback":return await vw(e,i,n,r);case"trigger":return await gw(e,i,n,r);case"open":case"workbench":{if(i.length>1)throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} ${o} [flow] [--json]`);if(t.getWorkbenchUrl==null)throw new E("workbench.unavailable","This CLI host cannot provide a Workbench URL.");let s=i[0]==null?void 0:await ke(e,i[0]),a=await t.getWorkbenchUrl(s?.flowId);if(o=="open")await r.openUrl(a);M(r,n.json,{...s==null?{}:{flow:s},kind:`flow.${o}`,url:a,version:1},a);return}case"list":{le(i,0,`${r.commandPrefix??"oo flow"} list [--json]`);let s=await e.listFlows({cursor:n.cursor,limit:n.limit??100});M(r,n.json,{...s,kind:"flow.list",version:1},s.flows.map(St).join(`
78
- `));return}case"export":{le(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await ke(e,i[0]);r.stdout.write(n.includeDependencies?cb(await e.exportFlowBundle(s.flowId)):eb(await e.exportFlow(s.flowId)));return}case"import":{if(le(i,0,`${r.commandPrefix??"oo flow"} import --file <path|-> [--name name] [--json]`),n.file==null)throw new E("cli.invalid-arguments","Import requires --file <path|->.");let s=lb(await Vn(n.file=="-"?"-":`@${n.file}`,"file","flow.import-unreadable",r)),a=s.kind=="open-flow-workflow-bundle"?s.workflows.find((d)=>d.flowId==s.entryFlowId).file:s,c=n.name??a.name??(n.file=="-"?Hu(r.language??"en"):tb(sE(n.file))),l={name:es(c,"Flow"),idempotencyKey:n.idempotencyKey,...n.tags.length?{tagIds:n.tags}:{}};if(s.kind=="open-flow-workflow-bundle"){let d=await e.importFlowBundle(s,l);M(r,n.json,{...d,idempotencyKey:n.idempotencyKey,kind:"flow.import"},d.flows.map(St).join(`
79
- `));return}let u=await e.importFlow(s,l);M(r,n.json,{flow:u,idempotencyKey:n.idempotencyKey,kind:"flow.import",version:1},St(u));return}case"create":{le(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(es(i[0],"Flow"),n.idempotencyKey);M(r,n.json,{flow:s,idempotencyKey:n.idempotencyKey,kind:"flow.create",version:1},St(s));return}case"live":{le(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await ke(e,i[0]),a=await e.getLiveDetails(s.flowId);M(r,n.json,{kind:"flow.live",live:a,version:1},rs(a));return}case"show":{le(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await ke(e,i[0]);M(r,n.json,{flow:s,kind:"flow.show",version:1},St(s));return}case"rename":{le(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await ke(e,i[0]),a=await e.renameFlow(s.flowId,es(i[1],"Flow"));M(r,n.json,{flow:a,kind:"flow.rename",version:1},St(a));return}case"delete":{if(le(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!n.yes)throw new E("flow.confirmation-required","Flow deletion requires --yes.");let s=await ke(e,i[0]),a=await e.deleteFlow(s.flowId);M(r,n.json,{flow:a,kind:"flow.delete",version:1},St(a));return}case"enable":case"disable":{if(le(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> --expected-publication <publicationId>`),n.expectedPublication==null||n.expectedPublication=="none")throw new E("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await ke(e,i[0]),a=await e.setFlowEnabled(s.flowId,n.expectedPublication,o=="enable");M(r,n.json,{flow:a,kind:`flow.${o}`,version:1},St(a));return}case"check":{le(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await ke(e,i[0]),a=n.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return M(r,n.json,{check:c,valid:c.valid,revisionId:a,kind:"flow.check",scope:"revision",version:1},`${c.valid?"valid":"invalid"} revision ${s.name} ${s.flowId}`),c.valid?0:1}default:throw new E("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} <list|create|show|live|read|search|edit|canvas|schema|rename|delete|check|enable|disable|connector|event-source|trigger|run|runs|publish|publications|rollback|workbench>`)}}async function aE(e,t){let n=t[0];if(n==null)throw new E("cli.invalid-arguments","A Flow reference is required.");return await ke(e,n)}var Mn={};var Sw=(e)=>e,os=Object.is,cE=(e,t)=>{if(os(e,t))return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;let n=e.length;if(t.length!==n)return!1;for(let r=0;r<n;r++)if(!os(e[r],t[r]))return!1;return!0},lE=(e)=>e.value,uE=(e)=>e.map(lE),dE=(e)=>e.$version,is=(e,t)=>{try{e(t)}catch(n){console.error(n)}},Iw=(e,t)=>(e.set=t,e);var pE=Promise.resolve(),zu=new Set,fE=new Set,io=zu,Du,mE=()=>{let e=io;io=io===zu?fE:zu,Du=!1;for(let t of e)t.t();e.clear()},gE=(e)=>{io.add(e),Du=Du||pE.then(mE)},hE=(e)=>io.delete(e);var xw=new FinalizationRegistry(is),Cw=class{constructor(e,t,n){if(this.#r=e,this.q=(t?.equal??os)||void 0,this.e=t?.eager,this.m=t?.name,this.#t=t?.onDisposeValue,n){let r=new WeakRef(this),o=()=>{if(i){let s=i;i=void 0,s()}},i=n(()=>{let s=r.deref();if(s)s.n();else o()});if(i)xw.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=Mn;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#r();if(this.c===Mn)this.w(e);else if(!this.q?.(e,this.c)){if(this.w(e),this.s&1)this.s|=2}}return this.c};n=()=>{if(this.#o)console.error(this.c,Error(`${this.m||""} disposed`));if(this.s|=4,this.b.size){if(this.s|=1,this[3])this.#n(3);if(this[2]){if(this.u(),this.s&2)this.#n(2)}if(this[1])gE(this);else this.s&=-4}};a(e,t){let n=this.b.get(e);if(n)this[n]--;return this.b.set(e,t),this[t]++,()=>this.r(e)}r(e){if(e){let t=this.b.get(e);if(t)this.b.delete(e),this[t]--}else this.b.clear(),this[1]=this[2]=this[3]=0,hE(this)}t(){if(this[1]){if(this.u(),this.s&2)this.#n(1)}this.s&=-4}d(){let e=this.c;if(this.r(),xw.unregister(this),this.#e?.(),this.#o=!0,this.#t&&e!==Mn)this.#t(e)}w(e){this.w=this.q?.(e,e)?this.y:this.x,this.w(e)}x(e){let t=this.c;if(this.c=e,this.v=Symbol(),this.#t&&t!==Mn&&t!==e)this.#t(t)}y(e){let t=this.c;if(this.c=this.v=e,this.#t&&t!==Mn&&t!==e)this.#t(t)}[1]=0;[2]=0;[3]=0;#e;#t;#r;#n(e){for(let[t,n]of this.b)if(n===e)is(t,this.c)}#o},yE=class{#e=new WeakSet;constructor(e){this.g=e.g,this.e=e.e,this.u=e.u,this.n=e.n,this.b=e.b}get v(){return this.g.v}g;b;e;u;n;a(e,t){return this.#e.add(e),this.g.a(e,t)}r(e){if(e){if(this.#e.has(e))this.#e.delete(e),this.g.r(e)}else for(let t of this.g.b.keys())this.r(t)}d(){this.r()}},qu=class{#e;constructor(e){this.#e=e,this.get=e.u,e.u()}get name(){return this.#e.m}get $version(){return this.get(),this.#e.v}get value(){return this.get()}set value(e){this.set?.(e)}set;get;ref(e){let t=new qu(new yE(this.#e));return e&&this.set?Iw(t,this.set):t}reaction(e,t=this.#e.e){return this.#e.a(e,t?2:1)}subscribe(e,t=this.#e.e){let n=this.reaction(e,t);return is(e,this.get()),n}$valCompute(e){return this.#e.a(e,3)}unsubscribe(e){this.#e.r(e)}dispose(){this.#e.d()}toString(){return String(this.get())}toJSON(e){let t=this.get();return t&&t.toJSON?t.toJSON(e):t}},bE=(e,t)=>{let n=e,o=new Cw(()=>n,t),i=(a)=>{if(!o.q?.(a,n))n=a,o.n()};return[new qu(o),i]},Vu=(e,t)=>Iw(...bE(e,t));var Ew=(e,t,n)=>new qu(new Cw(e,n,t)),Ow=(e,t=Sw,n)=>{let r,o;return Ew(()=>{let i=e.map(dE);if(!o||!cE(i,o))o=i,r=t(uE(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(is)},n)};var Lu=(e,t=Sw,n)=>{let r,o=Mn;return Ew(()=>{let i=e.$version;if(!os(i,o))o=i,r=t(e.value);return r},(i)=>e.$valCompute(i),n)};var jw=(e,t={},n="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")t[n+r]=o;else jw(o,t,n+r+".");return t},wE=(e)=>{let t=[],n=[],r=/{{(\S+?)}}/gi,o,i=0;while(o=r.exec(e))t.push(e.slice(i,o.index),""),n.push(o[1]),i=o.index+o[0].length;if(t.push(e.slice(i)),n.length<=0)return!1;return(s)=>{for(let a=n.length-1;a>=0;a--)t[a*2+1]=s[n[a]]??n[a];return t.join("")}},_w=class e{constructor(t,n,r){this.t=(i,s)=>this.t$.get()(i,s),this.fetcher=r?.fetcher;let o=new Map;this.locales$=Vu(n),this.lang$=Vu(t),this.locale$=Ow([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=Lu(this.locale$,jw),this.t$=Lu(this.a,(i)=>((s,a,c)=>{if(c){let l=c["@"];if(l!=null){let u=`${a}@${l}`;if(s[u])a=u}else{let u=c[":option"];if(u!=null){let d;a=s[d=`${a}.${u}`]||s[d=`${a}.other`]?d:a}}if(s[a]){let u=o.get(a);if(u??o.set(a,u=wE(s[a])),u)return u(c)}}return s[a]||a}).bind(o.clear(),i))}static async preload(t,n){return new e(t,{[t]:await n(t)},{fetcher:n})}get lang(){return this.lang$.value}get locales(){return this.locales$.value}get locale(){return this.locale$.value}async switchLang(t){if(!this.locales$.value[t]&&this.fetcher)this.addLocale(t,await this.fetcher(t));this.lang$.set(t)}hasKey(t){return!!this.a.value[t]}addLocale(t,n){this.locales$.set({...this.locales,[t]:n})}dispose(){this.lang$.dispose(),this.t$.dispose(),this.locales$.dispose(),this.locale$.dispose(),this.a.dispose()}};var Rw={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var Aw={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var Pw={help:{usage:"\u4F7F\u3044\u65B9\uFF1A{{command}}",title:"Open Flow \u30B3\u30DE\u30F3\u30C9",options:"\u30AA\u30D7\u30B7\u30E7\u30F3\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var Tw={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var $w={help:{usage:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435: {{command}}",title:"\u041A\u043E\u043C\u0430\u043D\u0434\u044B Open Flow",options:"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: --json, --cursor <cursor>, --limit <count>"}};var Nw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var zw={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var OE={en:Rw,"zh-CN":Nw,"zh-TW":zw,ja:Pw,ko:Tw,ru:$w,fr:Aw},jE=Object.fromEntries(gs.map((e)=>[e,OE[e]]));function Dw(e=Wu){return new _w(lo([e]),jE)}function _E(e,t){let n=t.filter((i)=>!i.startsWith("-")),r=$u(n,e.commandPrefix);while(r.length==0&&n.length>0)n.pop(),r=$u(n,e.commandPrefix);let o=Dw(e.language);try{let i=r.length==1?Nu(r[0].command):void 0,s=fw(r.length==1?r[0].command:"",e.commandPrefix),a={kind:"cli.help",version:1,commands:r.length==1?r:r.map(({command:c,usage:l})=>({command:c,usage:l})),...i==null?{}:{request:i.request},examples:s,exitCodes:{0:"Success or accepted asynchronous operation.",1:"Error or unsuccessful terminal Run.",2:"Run is waiting for an explicit action; inspect run.waits.",3:"Waiting timed out or publication is pending; the operation continues."},notes:i==null?[...e.scopeGuidance??["The oo host selects the team for the whole invocation with --team <name>; Flow commands use that authenticated scope."],"--timeout is a wait budget in milliseconds (default 60000).","--follow --json writes NDJSON pages immediately; resume from nextAfter.","Use read/search to locate nodes, schema read|search|edit|check for requests, and schema <type> for configuration and ports.","Use edit with baseRevision, requestId and an ordered edits array. Read selected text before an exact text.edit.","Retry mutations with the same idempotency key, fixed revision/publication and identical arguments."]:[i.guidance,...r[0].command=="check"?[]:["Use either --input (literal JSON, @file, or - for stdin) or --file (path or -), never both."]]};return t.includes("--json")?JSON.stringify(a):[o.t("help.title"),"",...r.map((c)=>r.length!=1?c.usage:`${c.usage}
68
+ `)}function Lt(e){return`${e.name} ${e.flowId} ${e.status}`}function Co(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function Po(e){let n=e.source=="draft"?"":` ${e.publicationId}`;return`${e.source} ${e.status} ${e.runId} ${e.revisionId}${n}${e.waits.length==0?"":`
69
+ ${JSON.stringify(e.waits)}`}`}function Yx(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function ew(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function ar(e,n,t,r){try{if(e=="-")return await r.readStdin();if(!e.startsWith("@"))return e;let o=e.slice(1);if(o.length==0)throw new P("cli.invalid-arguments",`${n} @ requires a file path.`);return await r.readFile(o)}catch(o){if(o instanceof P)throw o;throw new P(t,o instanceof Error?o.message:String(o))}}async function Eo(e,n){if(e==null)return{};let t=await ar(e,"input","flow.authoring-unreadable",n),r;try{r=JSON.parse(t)}catch{throw new P("cli.invalid-arguments","Input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new P("cli.invalid-arguments","Input must be a JSON object.");return r}async function tw(e,n){if(e.input==null)return{};let t=await ar(e.input,"--input","run.input-unreadable",n),r;try{r=JSON.parse(t)}catch{throw new P("run.input-invalid","Run input must be valid JSON.")}if(r==null||typeof r!="object"||Array.isArray(r))throw new P("run.input-invalid","Run input must be an object keyed by node ID.");for(let o of Object.values(r))if(o==null||typeof o!="object"||Array.isArray(o))throw new P("run.input-invalid","Each Run input node must contain an object keyed by input handle.");return r}async function Ao(e,n,t){let r=new Set,o;do{let i=await e.listPublications(n,{cursor:o,limit:cd}),s=i.publications.find((a)=>a.publicationId==t);if(s!=null)return s;if(o=i.nextCursor,o!=null&&r.has(o))throw new P("page.invalid-cursor","The deployment returned a repeated Publication cursor.");if(o!=null)r.add(o)}while(o!=null);throw new P("publication.not-found",`Publication ${JSON.stringify(t)} was not found.`)}async function pd(e,n,t,r=60000){let o=Date.now()+r,i=n;while(!zE.has(i.status)&&i.waits.length==0){let s=o-Date.now();if(s<=0)return{run:i,timedOut:!0};if(await t.wait(Math.min(1000,s)),Date.now()>=o)return{run:i,timedOut:!0};try{i=await e.getRun(i.runId,AbortSignal.timeout(Math.max(1,o-Date.now())))}catch(a){if(Date.now()>=o||a instanceof Error&&a.name=="TimeoutError")return{run:i,timedOut:!0};throw new P("run.wait-failed",a instanceof Error?a.message:String(a),{runId:i.runId})}}return{run:i,timedOut:!1}}function To(e,n=!1){if(n)return 3;if(e.waits.length>0)return 2;return e.status=="failed"||e.status=="canceled"||e.status=="indeterminate"?1:0}function nw(e){return new P(e.code,e.message,{status:e.status,...e.details})}async function fd(e,n,t,r,o=60000){let i=Date.now()+o,s=t;while(s.status=="pending"){let a=i-Date.now();if(a<=0)return{operation:s,timedOut:!0};if(await r.wait(Math.min(1000,a)),Date.now()>=i)return{operation:s,timedOut:!0};try{s=await e.getPublishOperation(n,s.operationId,AbortSignal.timeout(Math.max(1,i-Date.now())))}catch(c){if(Date.now()>=i||c instanceof Error&&c.name=="TimeoutError")return{operation:s,timedOut:!0};throw new P("publication.wait-failed",c instanceof Error?c.message:String(c),{flowId:n,operationId:s.operationId})}}return{operation:s,timedOut:!1}}var UE=new Set(Os);function rw(e){let n=!1,t=[],r,o,i,s=BE(),a,c=[],l=[],u,d,p,m,y,I,j,L,F,z,ge,Se,fe,Ge,sn,In,an,Cn,hr,$o=!1,Vs,Fd=!1,Bs,Us,qd=[],Vd="draft",Js,Zs,Ks,Ws,Hs,Bd=[],Ud=!1,Jd=!1;for(let Pn=0;Pn<e.length;Pn+=1){let mr=e[Pn],Do=mr.startsWith("--")?mr.indexOf("="):-1,R=Do<0?mr:mr.slice(0,Do),yr=Do<0?void 0:mr.slice(Do+1);if(yr!=null&&["--json","--follow","--wait","--yes","--pending-wait","--include-dependencies"].includes(R))throw new P("cli.invalid-arguments",`${R} does not accept a value.`);if(R.startsWith("--")){let Z=R.slice(2);if(l.includes(Z)&&Z!="set"&&Z!="unset"&&Z!="tag")throw new P("cli.invalid-arguments",`Duplicate option --${Z}.`);l.push(Z)}if(["--scope","--key","--space"].includes(R)){let Z=yr??e[++Pn];if(Z==null||Z.startsWith("--"))throw new P("cli.invalid-arguments",`${R} requires a value.`);if(R==="--scope")r=Z;else if(R==="--key")o=Z;else i=Z}else if(R=="--json")Fd=!0;else if(R=="--include-dependencies")n=!0;else if(R=="--follow")$o=!0;else if(R=="--wait")Ud=!0;else if(R=="--yes")Jd=!0;else if(R=="--pending-wait")Js=!0;else if(R=="--idempotency-key"||R=="--expected-publication"||R=="--revision"||R=="--publication"||R=="--pointer"||R=="--offset"||R=="--max-bytes"||R=="--code"||R=="--connection"||R=="--cron"||R=="--description"||R=="--every"||R=="--expected-revision"||R=="--file"||R=="--flow"||R=="--name"||R=="--source"||R=="--input"||R=="--trigger"||R=="--outputs"||R=="--status"||R=="--cursor"||R=="--limit"||R=="--after"||R=="--comment"||R=="--timeout"||R=="--timezone"||R=="--tag"||R=="--set"||R=="--unset"){let Z=yr??e[Pn+1];if(Z==null||Z.length==0||yr==null&&Z.startsWith("-")&&Z!="-")throw new P("cli.invalid-arguments",`${R} requires a value.`);if(yr==null)Pn++;if(R=="--idempotency-key")s=Z;else if(R=="--expected-publication")a=Z;else if(R=="--revision")p=Z;else if(R=="--publication")m=Z;else if(R=="--pointer")y=Z;else if(R=="--after")F=Z;else if(R=="--code")ge=Z;else if(R=="--connection")Se=Z;else if(R=="--cron")fe=Z;else if(R=="--description")sn=Z;else if(R=="--every")In=Z;else if(R=="--expected-revision")an=Z;else if(R=="--file")Cn=Z;else if(R=="--flow")hr=Z;else if(R=="--name")Us=Z;else if(R=="--comment")Ks=Z;else if(R=="--input")Vs=Z;else if(R=="--trigger")u=Z;else if(R=="--outputs")d=Z;else if(R=="--cursor")Ge=Z;else if(R=="--timezone")Hs=Z;else if(R=="--tag")t.push(Z);else if(R=="--set")qd.push(Z);else if(R=="--unset")Bd.push(Z);else if(R=="--source"){if(Z!="draft"&&Z!="live")throw new P("cli.invalid-arguments","--source must be draft or live.");Vd=Z}else if(R=="--status"){if(!UE.has(Z))throw new P("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(Z)}.`);Zs=Z}else{let zt=Number(Z),yv=R=="--offset"?0:1;if(!Number.isSafeInteger(zt)||zt<yv||R=="--limit"&&zt>100||R=="--max-bytes"&&zt>1048576)throw new P("cli.invalid-arguments",`${R} has an invalid value.`);if(R=="--limit")Bs=zt;else if(R=="--offset")I=zt;else if(R=="--max-bytes")j=zt;else Ws=zt}}else if(R.startsWith("-"))throw new P("cli.invalid-arguments",`Unknown option ${JSON.stringify(R)}.`);else c.push(R)}if(F!=null){if(c[0]=="runs"&&c[1]=="results")L=F;else if(z=Number(F),!Number.isSafeInteger(z)||z<0)throw new P("cli.invalid-arguments","--after must be a non-negative event sequence.")}return{includeDependencies:n,tags:t,scope:r,key:o,space:i,idempotencyKey:s,...L==null?{}:{resultAfter:L},...j==null?{}:{maxBytes:j},...I==null?{}:{offset:I},...y==null?{}:{pointer:y},...p==null?{}:{revision:p},...m==null?{}:{publication:m},...Ks==null?{}:{comment:Ks},...a==null?{}:{expectedPublication:a},...z==null?{}:{after:z},...ge==null?{}:{code:ge},...Se==null?{}:{connection:Se},...fe==null?{}:{cron:fe},...Ge==null?{}:{cursor:Ge},...sn==null?{}:{description:sn},...In==null?{}:{every:In},...an==null?{}:{expectedRevision:an},...Cn==null?{}:{file:Cn},...hr==null?{}:{flow:hr},follow:$o,...Vs==null?{}:{input:Vs},json:Fd,...Bs==null?{}:{limit:Bs},...Us==null?{}:{name:Us},positionals:c,options:l,...u==null?{}:{trigger:u},...d==null?{}:{outputs:d},sets:qd,source:Vd,...Zs==null?{}:{status:Zs},...Js==null?{}:{pendingWait:Js},...Ws==null?{}:{timeoutMs:Ws},...Hs==null?{}:{timezone:Hs},unsets:Bd,wait:Ud,yes:Jd}}var JE=0.1,ZE=3,Oo=gt("type",[w({type:b("focus"),nodeId:k().min(1)}),w({type:b("zoom"),zoom:M().min(JE).max(ZE)}),w({type:b("pan"),dx:M(),dy:M()}),w({type:b("fit")})]);var Oe=Kl(()=>te([me(),w({type:te([U(["array","boolean","integer","null","number","object","string"]),A(U(["array","boolean","integer","null","number","object","string"])).min(1)]).optional(),const:De().optional(),allOf:A(Oe).min(1).optional(),anyOf:A(Oe).min(1).optional(),oneOf:A(Oe).min(1).optional(),not:Oe.optional(),if:Oe.optional(),then:Oe.optional(),else:Oe.optional(),$ref:k().optional(),$schema:U(["http://json-schema.org/draft-07/schema#","https://json-schema.org/draft-07/schema","https://json-schema.org/draft/2019-09/schema","https://json-schema.org/draft/2020-12/schema"]).optional(),$defs:re(k(),Oe).optional(),definitions:re(k(),Oe).optional(),pattern:k().refine((e)=>{try{return new RegExp(e,"u").source.length>0}catch{return!1}},"Invalid regular expression.").optional(),format:k().refine((e)=>Object.hasOwn(rg,e),"Unsupported string format.").optional(),multipleOf:M().positive().optional(),uniqueItems:me().optional(),contains:Oe.optional(),minContains:M().int().nonnegative().optional(),maxContains:M().int().nonnegative().optional(),minProperties:M().int().nonnegative().optional(),maxProperties:M().int().nonnegative().optional(),propertyNames:Oe.optional(),patternProperties:re(k().refine((e)=>{try{return new RegExp(e,"u").source.length>0}catch{return!1}},"Invalid regular expression."),Oe).optional(),dependentRequired:re(k(),A(k())).optional(),dependentSchemas:re(k(),Oe).optional(),dependencies:re(k(),te([Oe,A(k())])).optional(),prefixItems:A(Oe).optional(),additionalItems:Oe.optional(),unevaluatedItems:Oe.optional(),unevaluatedProperties:Oe.optional(),description:k().optional(),title:k().optional(),default:De().optional(),examples:A(De()).optional(),readOnly:me().optional(),writeOnly:me().optional(),deprecated:me().optional(),$comment:k().optional(),enum:A(De()).min(1).optional(),properties:re(k(),Oe).optional(),required:A(k()).optional(),additionalProperties:Oe.optional(),items:te([Oe,A(Oe)]).optional(),minItems:M().int().nonnegative().optional(),maxItems:M().int().nonnegative().optional(),minLength:M().int().nonnegative().optional(),maxLength:M().int().nonnegative().optional(),minimum:M().optional(),maximum:M().optional(),exclusiveMinimum:M().optional(),exclusiveMaximum:M().optional()}).transform(({title:e,default:n,examples:t,readOnly:r,writeOnly:o,deprecated:i,$comment:s,...a})=>a)]));Ow();var Td=k().trim().refine((e)=>[...e].length<=2000,"Wait comment must contain at most 2,000 Unicode code points.").nullable().optional();var dr=k().min(1),nT=De(),rT=w({kind:b("graph.trigger.create"),nodeId:dr,key:dr,connectionId:dr.optional(),name:dr.optional(),config:re(dr,nT),schedule:en.readonly().optional()});function Od(e){return xt(e),A(mt()).min(1).parse(e).map((n,t)=>{let{kind:r}=mo(n,t,E({kind:dr}).parse);return r=="graph.trigger.create"?mo(n,t,rT.parse):vb(n,t)})}var Nw=[{snapshot:{configInputs:[{handle:"baseId",jsonSchema:{type:"string",pattern:"^app[A-Za-z0-9]{14}$"},nullable:!1},{handle:"formula",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"tableIdOrName",jsonSchema:{type:"string",minLength:1,maxLength:255},nullable:!1},{handle:"triggerField",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^[^}]*$"},nullable:!1},{handle:"view",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"fields",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"maxRecordsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:1000},nullable:!1,value:200}],definitionVersion:2,description:"Polls an Airtable table and triggers when a record is created or updated, ordered by a time field.",displayName:"Record Created or Updated",key:"airtable.on_record_changed",name:"on_record_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{baseId:{type:"string"},createdTime:{type:"string"},fields:{type:"object"},recordId:{type:"string"},tableIdOrName:{type:"string"},triggerField:{type:"string"},triggerFieldValue:{type:"string"}},additionalProperties:!1,required:["baseId","tableIdOrName","recordId","createdTime","triggerField","triggerFieldValue","fields"]}},nullable:!1}],provider:"airtable",type:"poll"},options:!1},{snapshot:{key:"asana.on_task_event",provider:"asana",name:"on_task_event",displayName:"Project Task Event",description:"Receives tasks added to a project, completion changes, and selected custom field changes. Task details represent current state, not historical state.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!0},successStatus:200},configInputs:[{handle:"projectId",jsonSchema:{type:"string",minLength:1,title:"Project ID"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["task.added","task.completed","task.field_changed"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["task.added","task.completed"]},{handle:"customFieldId",jsonSchema:{type:"string",minLength:1,title:"Custom field ID"},nullable:!0}],outputs:[{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},task:{type:"object"},change:{type:"object"}},required:["event","task","change"]}},nullable:!1}]},callback:{headers:["x-hook-secret","x-hook-signature"],query:[]},options:!1},{snapshot:{key:"calendly.on_booking_event",provider:"calendly",name:"on_booking_event",displayName:"Booking Created or Canceled",description:"Receives bookings and cancellations, preserving reschedule links. Requires a Personal Access Token connection.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"scope",jsonSchema:{type:"string",enum:["user","organization"],title:"Scope"},nullable:!1,value:"user"},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["invitee.created","invitee.canceled"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["invitee.created","invitee.canceled"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["invitee.created","invitee.canceled"]},nullable:!1},{handle:"inviteeUri",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["calendly-webhook-signature"],query:[]},options:!1},{snapshot:{key:"clickup.on_task_event",provider:"clickup",name:"on_task_event",displayName:"Task Event",description:"Receives task creation, status changes, and new comments in a ClickUp Workspace or List.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"workspaceId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"Workspace ID"},nullable:!1},{handle:"listId",jsonSchema:{type:"string",pattern:"^[0-9]+$",title:"List ID"},nullable:!0},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["taskCreated","taskStatusUpdated","taskCommentPosted"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["taskCreated","taskStatusUpdated","taskCommentPosted"]},nullable:!1},{handle:"taskId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-signature"],query:[]},options:!1},{snapshot:{key:"feishu_app_bot.on_event",provider:"feishu_app_bot",name:"on_event",displayName:"Application Event",description:"Receives selected Feishu application events through a shared event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.]{0,127}$"},minItems:1,maxItems:200,uniqueItems:!0,title:"Event types"},nullable:!1},{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",minLength:1,maxLength:256},maxItems:100,uniqueItems:!0,title:"Chat IDs"},nullable:!0,description:"Leave empty to receive events from all chats available to the source."},{handle:"resource",jsonSchema:{type:"object",properties:{kind:{type:"string",enum:["document","calendar","approval"]},id:{type:"string",minLength:1,maxLength:256},documentType:{type:"string",enum:["doc","docx","sheet","bitable","file","folder"]}},additionalProperties:!1,required:["kind","id"],title:"Resource subscription"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"tenantKey",jsonSchema:{type:"string"},nullable:!1},{handle:"occurredAt",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"feishu"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},verificationToken:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},manageSubscriptions:{type:"boolean"}},required:["version","name","connectionId","teamId","verificationToken","encryptKey","eventTypes","manageSubscriptions"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"feishu",provider:"feishu_app_bot",triggerId:"feishu_app_bot.on_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"feishu"},{snapshot:{key:"fireflies.on_meeting_ready",provider:"fireflies",name:"on_meeting_ready",displayName:"Meeting Transcript or Summary Ready",description:"Receives separate transcript and summary readiness events through Fireflies Webhooks V2 after checking meeting access.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["meeting.transcribed","meeting.summarized"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"fireflies"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["meeting.transcribed","meeting.summarized"]}}},required:["kind","version","name","connectionId","teamId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"fireflies",provider:"fireflies",triggerId:"fireflies.on_meeting_ready",maximumBodyBytes:65536,applicationIngress:!1,managed:!1},options:!1,eventSource:"fireflies"},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["*","branch_protection_configuration","branch_protection_rule","check_run","check_suite","code_scanning_alert","commit_comment","create","custom_property_values","delete","dependabot_alert","deploy_key","deployment","deployment_status","discussion","discussion_comment","fork","gollum","issue_comment","issue_dependencies","issues","label","member","meta","milestone","package","page_build","project","project_card","project_column","public","pull_request","pull_request_review","pull_request_review_comment","pull_request_review_thread","push","registry_package","release","repository","repository_advisory","repository_import","repository_ruleset","repository_vulnerability_alert","secret_scanning_alert","secret_scanning_alert_location","secret_scanning_scan","security_and_analysis","star","status","sub_issues","team_add","watch","workflow_job","workflow_run"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1}],definitionVersion:2,description:"Triggers when selected GitHub webhook events occur in a repository.",displayName:"Repository Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.on_repo_event",name:"on_repo_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"github",type:"integration"},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"owner",jsonSchema:{type:"string",pattern:"^[a-zA-Z0-9](?:[a-zA-Z0-9]|-(?=[a-zA-Z0-9])){0,38}$"},nullable:!1},{handle:"repo",jsonSchema:{type:"string",pattern:"^(?!\\.{1,2}$)[a-zA-Z0-9._-]{1,100}$"},nullable:!1},{handle:"number",jsonSchema:{type:"integer",minimum:1},nullable:!1,description:"Number of the pull request to watch."}],definitionVersion:2,description:"Watches one pull request using notifications and periodic checks. Starts from its current state; reports observed changes, not every intermediate transition or review event.",displayName:"Watch Pull Request",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"github.watch_pull_request",name:"watch_pull_request",provider:"github",type:"integration",outputs:[{handle:"pullRequest",jsonSchema:{type:"object",properties:{id:{type:"integer"},number:{type:"integer"},title:{type:"string"},url:{type:"string"},state:{type:"string",enum:["open","closed"]},draft:{type:"boolean"},merged:{type:"boolean"},updatedAt:{type:"string"},headSha:{type:"string"},baseSha:{type:"string"}},additionalProperties:!1,required:["id","number","title","url","state","draft","merged","updatedAt","headSha","baseSha"]},nullable:!1},{handle:"version",jsonSchema:{type:"string"},nullable:!1}]},callback:{headers:["x-github-delivery","x-github-event","x-hub-signature-256"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["push","tag_push","issues","confidential_issues","note","confidential_note","merge_requests","job","pipeline","wiki_page","deployment","feature_flag","releases","milestone","emoji","resource_access_token","resource_deploy_token"]},minItems:1,uniqueItems:!0},nullable:!1},{handle:"insecureSsl",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"project",jsonSchema:{type:"string",minLength:1,maxLength:255,pattern:"^(?:[0-9]+|(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*(?:/(?!\\.{1,2}(?:/|$))[A-Za-z0-9_.][A-Za-z0-9_.-]*)*)$"},nullable:!1},{handle:"pushBranchFilter",jsonSchema:{type:"string",maxLength:255},nullable:!1,value:""}],definitionVersion:2,description:"Triggers when selected GitLab webhook events occur in a project.",displayName:"Project Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"gitlab.on_project_event",name:"on_project_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"gitlabEvent",jsonSchema:{type:"string"},nullable:!1}],provider:"gitlab",type:"integration"},callback:{headers:["idempotency-key","x-gitlab-event","x-gitlab-token"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"labelNamesOrIds",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,description:"Only trigger on messages carrying all of these labels, referenced by name or ID.",value:[]},{handle:"readStatus",jsonSchema:{type:"string",enum:["Read","Unread","All"]},nullable:!1,value:"All"},{handle:"search",jsonSchema:{type:"string"},nullable:!1,description:"Gmail search-syntax query the message must match.",value:""},{handle:"sender",jsonSchema:{type:"string"},nullable:!1,description:"Only trigger on messages whose sender matches this address or name.",value:""},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on draft messages."},{handle:"includeSpamAndTrash",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages in SPAM and TRASH."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls the Gmail mailbox and triggers when a new message is received.",displayName:"New Message Received",key:"gmail.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{historyId:{type:["string","null"]},labelIds:{type:"array",items:{type:"string"}},messageId:{type:"string"},messageTimestamp:{type:"string"},sender:{type:"string"},subject:{type:"string"},threadId:{type:"string"},to:{type:"string"}},additionalProperties:!1,required:["messageId","threadId","historyId","labelIds","subject","sender","to","messageTimestamp"]}},nullable:!1}],provider:"gmail",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"calendarId",jsonSchema:{type:"string",minLength:1,maxLength:1024},nullable:!1},{handle:"changes",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","cancelled"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated","cancelled"]},{handle:"matchTerm",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxEventsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100}],definitionVersion:2,description:"Polls a Google Calendar and triggers when an event is created, updated or cancelled.",displayName:"Event Changed",key:"googlecalendar.on_event_changed",name:"on_event_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{attendeeEmails:{type:"array",items:{type:"string"}},calendarId:{type:"string"},changeType:{type:"string",enum:["created","updated","cancelled"]},created:{type:["string","null"]},creatorEmail:{type:["string","null"]},description:{type:["string","null"]},end:{type:["object","null"]},eventId:{type:"string"},eventType:{type:["string","null"]},htmlLink:{type:["string","null"]},isAllDay:{type:"boolean"},location:{type:["string","null"]},organizerEmail:{type:["string","null"]},recurringEventId:{type:["string","null"]},start:{type:["object","null"]},status:{type:"string"},summary:{type:["string","null"]},updated:{type:["string","null"]}},additionalProperties:!1,required:["changeType","calendarId","eventId","status","summary","description","location","htmlLink","start","end","isAllDay","organizerEmail","creatorEmail","attendeeEmails","recurringEventId","eventType","created","updated"]}},nullable:!1}],provider:"googlecalendar",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Uses a Google Drive changes.watch channel and triggers when Drive changes are available.",displayName:"Changes Detected",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.changes_detected",name:"changes_detected",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeId:{type:"string"},changeType:{type:["string","null"]},driveId:{type:["string","null"]},file:{type:["object","null"]},fileId:{type:["string","null"]},notification:{type:"object",properties:{changedTypes:{type:"array",items:{type:"string"}},messageNumber:{type:["string","null"]},resourceState:{type:"string"},resourceUri:{type:["string","null"]}},additionalProperties:!1,required:["resourceState","changedTypes","messageNumber","resourceUri"]},removed:{type:"boolean"},time:{type:["string","null"]}},additionalProperties:!1,required:["changeId","changeType","removed","time","fileId","driveId","file","notification"]}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"changeType",jsonSchema:{type:"string",enum:["created","updated"]},nullable:!1},{handle:"driveId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{0,512}$"},nullable:!1,value:""},{handle:"folderId",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_-]{2,512}$"},nullable:!1},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"mimeTypes",jsonSchema:{type:"array",items:{type:"string",minLength:1}},nullable:!1,value:[]},{handle:"namePrefix",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxFilesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls one Google Drive folder and triggers when a file or folder directly inside it is created or updated.",displayName:"File or Folder Change in a Folder",key:"googledrive.on_file_change",name:"on_file_change",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdTime:{type:["string","null"]},driveId:{type:["string","null"]},eventType:{type:"string",enum:["file_created","file_updated","folder_created","folder_updated"]},fileId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifyingUser:{type:["object","null"]},mimeType:{type:"string"},modifiedTime:{type:["string","null"]},name:{type:"string"},parents:{type:"array",items:{type:"string"}},size:{type:"string"},webViewLink:{type:["string","null"]}},additionalProperties:!1,required:["eventType","itemType","fileId","name","mimeType","createdTime","modifiedTime","parents","webViewLink","driveId","lastModifyingUser"]}},nullable:!1}],provider:"googledrive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"driveId",jsonSchema:{type:"string",minLength:1,maxLength:256},nullable:!0,description:"Optional shared drive ID. Omit it to monitor the connected account."},{handle:"includeCorpusRemovals",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Include the accessible file resource when an item leaves the change corpus."},{handle:"includeItemsFromAllDrives",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include items from My Drive and shared drives."},{handle:"includeRemoved",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Include changes caused by deletion or loss of access."},{handle:"pageSize",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:100,description:"Maximum changes included in one Flow Run."},{handle:"restrictToMyDrive",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Restrict changes to the My Drive hierarchy."}],definitionVersion:2,description:"Monitors Drive changes using notifications and periodic scans of the same change stream.",displayName:"Watch Changes",endpoint:{body:{allowArray:!1,allowEmpty:!0,formats:["json"]},methods:["POST"],successStatus:204},key:"googledrive.watch_changes",name:"watch_changes",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object"}},nullable:!1}],provider:"googledrive",type:"integration"},callback:{headers:["x-goog-changed","x-goog-channel-id","x-goog-channel-token","x-goog-message-number","x-goog-resource-id","x-goog-resource-state","x-goog-resource-uri"],query:[]},options:!1,intervalMs:300000},{snapshot:{configInputs:[{handle:"columnRange",jsonSchema:{type:"string",pattern:"^[A-Za-z]{1,3}(?::[A-Za-z]{1,3})?$"},nullable:!1,value:"A:ZZZ"},{handle:"sheet",jsonSchema:{type:"string",minLength:1},nullable:!1},{handle:"spreadsheetId",jsonSchema:{type:"string",minLength:1},nullable:!1},{group:"Advanced settings",collapsed:!0},{handle:"dateTimeRender",jsonSchema:{type:"string",enum:["FORMATTED_STRING","SERIAL_NUMBER"]},nullable:!1,value:"FORMATTED_STRING"},{handle:"firstDataRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:2},{handle:"headerRow",jsonSchema:{type:"integer",minimum:1},nullable:!1,value:1},{handle:"maxRowsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:500},nullable:!1,value:100},{handle:"valueRender",jsonSchema:{type:"string",enum:["UNFORMATTED_VALUE","FORMATTED_VALUE","FORMULA"]},nullable:!1,value:"UNFORMATTED_VALUE"}],definitionVersion:2,description:"Polls a sheet and triggers once for every new row appended below the last row already seen.",displayName:"New Row Added",key:"googlesheets.on_row_added",name:"on_row_added",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{row:{type:"object"},rowNumber:{type:"integer"},sheetId:{type:"integer"},sheetTitle:{type:"string"},spreadsheetId:{type:"string"},values:{type:"array",items:{}}},additionalProperties:!1,required:["spreadsheetId","sheetId","sheetTitle","rowNumber","row","values"]}},nullable:!1}],provider:"googlesheets",type:"poll"},options:!1},{snapshot:{key:"intercom.on_conversation_event",provider:"intercom",name:"on_conversation_event",displayName:"Customer Conversation or Ticket",description:"Receives customer conversations, customer replies and new tickets from a verified Intercom application event source. Administrator replies are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["conversation.user.created","conversation.user.replied","ticket.created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"workspaceId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object",properties:{},additionalProperties:!0},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"intercom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["conversation.user.created","conversation.user.replied","ticket.created"]}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"intercom",provider:"intercom",triggerId:"intercom.on_conversation_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"intercom"},{snapshot:{key:"jira.on_issue_event",provider:"jira",name:"on_issue_event",displayName:"Issue or Comment Event",description:"Receives Jira Cloud issue creation, issue updates and new comments through a shared project webhook with automatic renewal.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]},minItems:1,maxItems:3,uniqueItems:!0,title:"Events"},nullable:!1,value:["jira:issue_created","jira:issue_updated","comment_created"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"cloudId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"jira"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},project:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:3,type:"array",items:{type:"string",enum:["jira:issue_created","jira:issue_updated","comment_created"]}}},required:["kind","version","name","connectionId","teamId","project","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"jira",provider:"jira",triggerId:"jira.on_issue_event",maximumBodyBytes:65536,applicationIngress:!1,managed:!0},options:!1,eventSource:"jira"},{snapshot:{configInputs:[{handle:"teamId",jsonSchema:{type:"string",pattern:"^[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}$",title:"Team ID"},nullable:!1,description:"Linear Team UUID. Use Copy model UUID in Linear to find it."},{handle:"stateIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[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}$"},maxItems:50,uniqueItems:!0,title:"Issue statuses"},nullable:!1,value:[],description:"Choose statuses from the selected Team. Empty means all statuses. Matches the current status, not every transition into it."}],definitionVersion:2,description:"Watches new and updated issues in a Linear team with periodic checks. Starts from now without running existing issues. Reports observed current states, not deletions or every intermediate status change.",displayName:"Issue Created or Updated",key:"linear.on_issue_changed",name:"on_issue_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{id:{type:"string"},identifier:{type:"string"},title:{type:"string"},url:{type:"string"},teamId:{type:"string"},createdAt:{type:"string"},updatedAt:{type:"string"},state:{type:"object",properties:{id:{type:"string"},name:{type:"string"},type:{type:"string"}},additionalProperties:!1,required:["id","name","type"]}},additionalProperties:!1,required:["id","identifier","title","url","teamId","createdAt","updatedAt","state"]}},nullable:!1}],provider:"linear",type:"poll"},options:!0},{snapshot:{configInputs:[{handle:"dataSourceId",jsonSchema:{type:"string",pattern:"^(?:|[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})$"},nullable:!1,value:""},{handle:"databaseId",jsonSchema:{type:"string",pattern:"^[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}$"},nullable:!1},{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["page_added","page_updated"]},minItems:1,uniqueItems:!0},nullable:!1,value:["page_added"]},{group:"Advanced settings",collapsed:!0},{handle:"includeProperties",jsonSchema:{type:"boolean"},nullable:!1,value:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Notion database and triggers when a page is added to it or an existing page is edited.",displayName:"Database Page Added or Updated",key:"notion.on_database_page_event",name:"on_database_page_event",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{createdBy:{type:"object"},createdTime:{type:"string"},dataSourceId:{type:"string"},databaseId:{type:"string"},event:{type:"string",enum:["page_added","page_updated"]},lastEditedBy:{type:"object"},lastEditedTime:{type:"string"},pageId:{type:"string"},properties:{type:"object"},title:{type:"string"},url:{type:"string"}},additionalProperties:!1,required:["event","pageId","databaseId","dataSourceId","url","title","createdTime","lastEditedTime","createdBy","lastEditedBy"]}},nullable:!1}],provider:"notion",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["created","updated","deleted"]},minItems:1,uniqueItems:!0},nullable:!1,value:["created","updated"]},{handle:"itemId",jsonSchema:{type:"string"},nullable:!1,value:""},{handle:"itemTypes",jsonSchema:{type:"array",items:{type:"string",enum:["file","folder"]},minItems:1,uniqueItems:!0},nullable:!1,value:["file"]},{handle:"parentFolderId",jsonSchema:{type:"string"},nullable:!1,value:""},{group:"Advanced settings",collapsed:!0},{handle:"maxItemsPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:200},nullable:!1,value:50}],definitionVersion:2,description:"Polls the OneDrive change feed and triggers when a file or folder is created, updated or deleted.",displayName:"File or Folder Changed",key:"one_drive.on_item_changed",name:"on_item_changed",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{changeType:{type:"string",enum:["created","updated","deleted"]},createdDateTime:{type:["string","null"]},driveId:{type:["string","null"]},eTag:{type:["string","null"]},itemId:{type:"string"},itemType:{type:"string",enum:["file","folder"]},lastModifiedDateTime:{type:["string","null"]},mimeType:{type:["string","null"]},name:{type:"string"},parentFolderId:{type:["string","null"]},size:{type:["number","null"]},webUrl:{type:"string"}},additionalProperties:!1,required:["itemId","name","changeType","itemType","size","mimeType","webUrl","parentFolderId","driveId","createdDateTime","lastModifiedDateTime","eTag"]}},nullable:!1}],provider:"one_drive",type:"poll"},options:!1},{snapshot:{configInputs:[{handle:"folder",jsonSchema:{type:"string",pattern:"^[A-Za-z0-9_=-]*$"},nullable:!1,value:"inbox",description:"A well-known mail folder name, folder ID, or an empty string for the whole mailbox."},{handle:"readStatus",jsonSchema:{type:"string",enum:["All","Read","Unread"]},nullable:!1,value:"All"},{handle:"senderAddress",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Exact sender address, or empty for any sender."},{handle:"subjectContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Case-insensitive subject text."},{handle:"withAttachmentsOnly",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{group:"Advanced settings",collapsed:!0},{handle:"includeDrafts",jsonSchema:{type:"boolean"},nullable:!1,value:!1},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:25}],definitionVersion:2,description:"Polls a Microsoft Outlook mail folder and triggers when a new message arrives.",displayName:"New Message Received",key:"outlook.on_message_received",name:"on_message_received",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{bodyPreview:{type:"string"},categories:{type:"array",items:{type:"string"}},conversationId:{type:"string"},from:{type:"string"},fromName:{type:"string"},hasAttachments:{type:"boolean"},importance:{type:"string"},internetMessageId:{type:"string"},isDraft:{type:"boolean"},isRead:{type:"boolean"},messageId:{type:"string"},parentFolderId:{type:"string"},receivedDateTime:{type:"string"},subject:{type:"string"},to:{type:"array",items:{type:"string"}},webLink:{type:"string"}},additionalProperties:!1,required:["messageId","internetMessageId","conversationId","subject","bodyPreview","from","fromName","to","receivedDateTime","hasAttachments","isRead","isDraft","importance","categories","parentFolderId","webLink"]}},nullable:!1}],provider:"outlook",type:"poll"},options:!1},{snapshot:{key:"pandadoc.on_document_event",provider:"pandadoc",name:"on_document_event",displayName:"Document Status Changed",description:"Receives document status changes in the connected workspace, optionally only when the entire document is completed.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!0,allowEmpty:!1},successStatus:200},configInputs:[{handle:"completedOnly",jsonSchema:{type:"boolean",title:"Completed documents only"},nullable:!1,value:!0}],outputs:[{handle:"events",nullable:!1,jsonSchema:{type:"array",items:{type:"object",properties:{event:{type:"string"},data:{type:"object"}},required:["event","data"]}}}]},callback:{headers:[],query:["signature"]},options:!1},{snapshot:{key:"pipedrive.on_crm_event",provider:"pipedrive",name:"on_crm_event",displayName:"Deal or Contact Event",description:"Receives new deals or contacts, or actual changes to a deal stage or status using Pipedrive Webhooks v2.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventType",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"],title:"Event"},nullable:!1,value:"deal.created"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deal.created","deal.stage_changed","deal.status_changed","person.created"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"objectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["authorization"],query:[]},options:!1},{snapshot:{key:"resend.on_email_event",provider:"resend",name:"on_email_event",displayName:"Email Received, Bounced or Complained",description:"Receives inbound email, bounce, and complaint notifications. Read message bodies and attachments with Actions.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["email.received","email.bounced","email.complained"]},minItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["email.received","email.bounced","email.complained"]}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["email.received","email.bounced","email.complained"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"emailId",jsonSchema:{type:"string"},nullable:!1},{handle:"createdAt",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["svix-id","svix-signature","svix-timestamp"],query:[]},options:!1},{snapshot:{key:"sentry.on_issue_alert",provider:"sentry",name:"on_issue_alert",displayName:"Issue Alert",description:"Receives Issue Alert Rule notifications from a verified Sentry Custom Integration installation.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"projectIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]+$"},uniqueItems:!0,title:"Project IDs"},nullable:!0},{handle:"ruleNames",jsonSchema:{type:"array",items:{type:"string",minLength:1},uniqueItems:!0,title:"Alert rule names"},nullable:!0},{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["issue.alert"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["issue.alert"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"organizationId",jsonSchema:{type:"string"},nullable:!1},{handle:"issueId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"sentry"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},installationId:{type:"string",minLength:1,maxLength:256},organizationId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"issue.alert"}}},required:["kind","version","name","connectionId","teamId","appId","installationId","organizationId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"sentry",provider:"sentry",triggerId:"sentry.on_issue_alert",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"sentry"},{snapshot:{configInputs:[{handle:"topics",jsonSchema:{type:"array",items:{type:"string",enum:["app/scopes_update","app/uninstalled","app_purchases_one_time/update","app_subscriptions/approaching_capped_amount","app_subscriptions/update","bulk_operations/finish","carts/create","carts/update","channels/delete","checkout_and_accounts_configurations/update","checkouts/create","checkouts/delete","checkouts/update","collection_listings/add","collection_listings/remove","collection_listings/update","collection_publications/create","collection_publications/delete","collection_publications/update","collections/create","collections/delete","collections/update","companies/create","companies/delete","companies/update","company_contact_roles/assign","company_contact_roles/revoke","company_contacts/create","company_contacts/delete","company_contacts/update","company_locations/create","company_locations/delete","company_locations/update","customer.joined_segment","customer.left_segment","customer.tags_added","customer.tags_removed","customer_account_settings/update","customer_groups/create","customer_groups/delete","customer_groups/update","customers/create","customers/delete","customers/disable","customers/enable","customers/purchasing_summary","customers/update","customers_email_marketing_consent/update","customers_marketing_consent/update","delivery_promise_settings/update","disputes/create","disputes/update","domains/create","domains/destroy","domains/update","draft_orders/create","draft_orders/delete","draft_orders/update","fulfillment_events/create","fulfillment_events/delete","fulfillment_holds/added","fulfillment_holds/released","fulfillment_orders/cancellation_request_accepted","fulfillment_orders/cancellation_request_rejected","fulfillment_orders/cancellation_request_submitted","fulfillment_orders/cancelled","fulfillment_orders/fulfillment_request_accepted","fulfillment_orders/fulfillment_request_rejected","fulfillment_orders/fulfillment_request_submitted","fulfillment_orders/fulfillment_service_failed_to_complete","fulfillment_orders/hold_released","fulfillment_orders/line_items_prepared_for_local_delivery","fulfillment_orders/line_items_prepared_for_pickup","fulfillment_orders/manually_reported_progress_stopped","fulfillment_orders/merged","fulfillment_orders/moved","fulfillment_orders/order_routing_complete","fulfillment_orders/placed_on_hold","fulfillment_orders/progress_reported","fulfillment_orders/rescheduled","fulfillment_orders/scheduled_fulfillment_order_ready","fulfillment_orders/split","fulfillments/create","fulfillments/update","inventory_items/create","inventory_items/delete","inventory_items/update","inventory_levels/connect","inventory_levels/disconnect","inventory_levels/update","locales/create","locales/destroy","locales/update","locations/activate","locations/create","locations/deactivate","locations/delete","locations/update","machine_translation_batch/completed","metafield_definitions/create","metafield_definitions/delete","metafield_definitions/update","order_transactions/create","orders/cancelled","orders/create","orders/delete","orders/edited","orders/fulfilled","orders/link_requested","orders/paid","orders/partially_fulfilled","orders/risk_assessment_changed","orders/shopify_protect_eligibility_changed","orders/updated","payment_schedules/due","payment_terms/create","payment_terms/delete","payment_terms/update","product_feeds/create","product_feeds/full_sync","product_feeds/full_sync_finish","product_feeds/incremental_sync","product_feeds/update","product_listings/add","product_listings/remove","product_listings/update","product_publications/create","product_publications/delete","product_publications/update","products/create","products/delete","products/update","profiles/create","profiles/delete","profiles/update","publications/delete","refunds/create","returns/approve","returns/cancel","returns/close","returns/decline","returns/process","returns/reopen","returns/request","returns/update","reverse_deliveries/attach_deliverable","reverse_fulfillment_orders/dispose","scheduled_product_listings/add","scheduled_product_listings/remove","scheduled_product_listings/update","segments/create","segments/delete","segments/update","selling_plan_groups/create","selling_plan_groups/delete","selling_plan_groups/update","shop/update","subscription_billing_attempts/challenged","subscription_billing_attempts/failure","subscription_billing_attempts/success","subscription_billing_cycle_edits/create","subscription_billing_cycle_edits/delete","subscription_billing_cycle_edits/update","subscription_billing_cycles/skip","subscription_billing_cycles/unskip","subscription_contracts/activate","subscription_contracts/cancel","subscription_contracts/create","subscription_contracts/expire","subscription_contracts/fail","subscription_contracts/pause","subscription_contracts/update","tax_partners/update","tax_summaries/create","tender_transactions/create","themes/create","themes/delete","themes/publish","themes/update","variants/in_stock","variants/out_of_stock"]},minItems:1,maxItems:20,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when selected Shopify webhook topics occur in the connected store.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"shopify.on_shop_event",name:"on_shop_event",outputs:[{handle:"apiVersion",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"shopDomain",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"triggeredAt",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"shopify",type:"integration"},callback:{headers:["x-shopify-api-version","x-shopify-event-id","x-shopify-shop-domain","x-shopify-topic","x-shopify-triggered-at","x-shopify-webhook-id"],query:["open_flow_callback"]},options:!1},{snapshot:{configInputs:[{handle:"channelId",jsonSchema:{type:"string",pattern:"^[CDG][A-Z0-9]{2,31}$"},nullable:!1,description:"Slack conversation ID to watch, e.g. C0122KQ70S7E."},{handle:"fromUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Only trigger on messages written by these Slack user IDs. Empty means any author."},{handle:"ignoreUserIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[UW][A-Z0-9]{2,31}$"}},nullable:!1,value:[],description:"Never trigger on messages written by these Slack user IDs."},{handle:"textContains",jsonSchema:{type:"string"},nullable:!1,value:"",description:"Only trigger when message text contains this string, case-insensitively."},{group:"Advanced settings",collapsed:!0},{handle:"includeBotMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on messages posted by bots and apps."},{handle:"includeSystemMessages",jsonSchema:{type:"boolean"},nullable:!1,value:!1,description:"Also trigger on Slack system notices."},{handle:"maxMessagesPerPoll",jsonSchema:{type:"integer",minimum:1,maximum:100},nullable:!1,value:15,description:"Maximum number of messages processed per poll."}],definitionVersion:2,description:"Polls one Slack conversation and triggers when a new message is posted to it.",displayName:"New Channel Message",key:"slack.on_message_posted",name:"on_message_posted",outputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"object",properties:{botId:{type:["string","null"]},channelId:{type:"string"},files:{type:"array",items:{type:"object",properties:{id:{type:"string"},mimetype:{type:"string"},name:{type:"string"}},additionalProperties:!1,required:["id","name","mimetype"]}},messageTs:{type:"string"},subtype:{type:["string","null"]},text:{type:"string"},threadTs:{type:["string","null"]},userId:{type:["string","null"]}},additionalProperties:!1,required:["channelId","messageTs","threadTs","userId","botId","subtype","text","files"]}},nullable:!1}],provider:"slack",type:"poll"},options:!1},{snapshot:{key:"slackbot.on_event",provider:"slackbot",name:"on_event",displayName:"Mention or Direct Message",description:"Receives user mentions and new direct messages through a shared Slack application event source. Slack Connect events are excluded.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["app_mention","message.im"]},minItems:1,maxItems:2,uniqueItems:!0,title:"Events"},nullable:!1,value:["app_mention","message.im"]},{handle:"channelIds",jsonSchema:{type:"array",items:{type:"string",minLength:1},maxItems:100,uniqueItems:!0,title:"Channel IDs"},nullable:!0}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"appId",jsonSchema:{type:"string"},nullable:!1},{handle:"teamId",jsonSchema:{type:"string"},nullable:!1},{handle:"channel",jsonSchema:{type:"string"},nullable:!1},{handle:"user",jsonSchema:{type:"string"},nullable:!1},{handle:"text",jsonSchema:{type:"string"},nullable:!1},{handle:"ts",jsonSchema:{type:"string"},nullable:!1},{handle:"threadTs",jsonSchema:{type:"string"},nullable:!0},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"slack"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",pattern:"^A[A-Z0-9]+$"},workspaceId:{type:"string",pattern:"^T[A-Z0-9]+$"},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:2,type:"array",items:{type:"string",enum:["app_mention","message.im"]}}},required:["kind","version","name","connectionId","teamId","appId","workspaceId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"slack",provider:"slackbot",triggerId:"slackbot.on_event",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"slack"},{snapshot:{configInputs:[{handle:"apiVersion",jsonSchema:{type:"string",maxLength:40},nullable:!1,value:""},{handle:"events",jsonSchema:{type:"array",items:{type:"string",maxLength:120,pattern:"^(\\*|[a-z0-9_]+(?:\\.[a-z0-9_]+)+)$"},minItems:1,uniqueItems:!0},nullable:!1},{handle:"includeConnectedAccounts",jsonSchema:{type:"boolean"},nullable:!1,value:!1}],definitionVersion:2,description:"Triggers when selected Stripe events happen on the connected account.",displayName:"Account Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"stripe.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"eventId",jsonSchema:{type:"string"},nullable:!1},{handle:"livemode",jsonSchema:{type:"boolean"},nullable:!1}],provider:"stripe",type:"integration"},callback:{headers:["stripe-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form"},nullable:!1,description:"Choose a form accessible to this Connection."}],definitionVersion:2,description:"Receives new Tally form submissions through a signed, automatically managed webhook.",displayName:"Form Response",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"tally.on_form_response",name:"on_form_response",outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},createdAt:{type:"string"},formId:{type:"string"},submissionId:{type:"string"},responseId:{type:"string"},fields:{type:"array",items:{type:"object",properties:{key:{type:"string"},type:{type:"string"},label:{type:["string","null"]},value:{},options:{type:"array",items:{type:"object"}}},required:["key","type","label","value"]}}},required:["eventId","createdAt","formId","submissionId","responseId","fields"]}}],provider:"tally",type:"integration"},callback:{headers:["tally-signature"],query:[]},options:!0},{snapshot:{configInputs:[{handle:"chatIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^-?[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram chat IDs. Empty means every chat."},{handle:"dropPendingUpdates",jsonSchema:{type:"boolean"},nullable:!1,value:!0,description:"Discard updates queued before the webhook is created or resumed."},{handle:"updates",jsonSchema:{type:"array",items:{enum:["*","message","edited_message","channel_post","edited_channel_post","business_connection","business_message","edited_business_message","deleted_business_messages","guest_message","message_reaction","message_reaction_count","inline_query","chosen_inline_result","callback_query","shipping_query","pre_checkout_query","purchased_paid_media","poll","poll_answer","my_chat_member","chat_member","chat_join_request","chat_boost","removed_chat_boost","managed_bot","subscription"]},minItems:1,uniqueItems:!0},nullable:!1,description:"Telegram update types that trigger a Run. Use * for the Telegram default set."},{handle:"userIds",jsonSchema:{type:"array",items:{type:"string",pattern:"^[0-9]{1,20}$"},maxItems:100,uniqueItems:!0},nullable:!1,value:[],description:"Only accept updates from these numeric Telegram user IDs. Empty means every user."}],definitionVersion:2,description:"Triggers when the connected Telegram bot receives a selected update.",displayName:"Bot Update",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:200},key:"telegram.on_update",name:"on_update",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1}],provider:"telegram",type:"integration"},callback:{headers:["x-telegram-bot-api-secret-token"],query:[]},options:!1},{snapshot:{key:"typeform.on_form_response",provider:"typeform",name:"on_form_response",displayName:"Completed Form Response",description:"Receives complete Typeform submissions through an automatically managed signed webhook.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"formId",jsonSchema:{type:"string",minLength:1,maxLength:128,title:"Form ID"},nullable:!1}],outputs:[{handle:"response",nullable:!1,jsonSchema:{type:"object",properties:{eventId:{type:"string"},form_id:{type:"string"},token:{type:"string"},submitted_at:{type:"string"},answers:{type:"array",items:{type:"object"}},definition:{type:"object"}},required:["eventId","form_id","token","submitted_at","answers"]}}]},callback:{headers:["typeform-signature"],query:[]},options:!1},{snapshot:{key:"vercel.on_deployment_event",provider:"vercel",name:"on_deployment_event",displayName:"Deployment Ready or Failed",description:"Receives successful and failed deployments for a Vercel project.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"teamId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Team ID"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string",minLength:1,maxLength:256,title:"Project ID"},nullable:!1},{handle:"environment",jsonSchema:{type:"string",enum:["all","production","preview"],title:"Environment"},nullable:!1,value:"all"}],outputs:[{handle:"event",jsonSchema:{type:"string",enum:["deployment.ready","deployment.error"]},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"deploymentId",jsonSchema:{type:"string"},nullable:!1},{handle:"projectId",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:["x-vercel-signature"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["coupon.created","coupon.updated","coupon.deleted","coupon.restored","customer.created","customer.updated","customer.deleted","order.created","order.updated","order.deleted","order.restored","product.created","product.updated","product.deleted","product.restored","product.published"]},minItems:1,maxItems:16,uniqueItems:!0},nullable:!1},{handle:"webhookName",jsonSchema:{type:"string",minLength:1,maxLength:120},nullable:!1,value:"OOMOL Trigger"}],definitionVersion:2,description:"Triggers when selected WooCommerce store events occur.",displayName:"Store Event",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"woocommerce.on_store_event",name:"on_store_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"resource",jsonSchema:{type:"string"},nullable:!1},{handle:"source",jsonSchema:{type:"string"},nullable:!1},{handle:"topic",jsonSchema:{type:"string"},nullable:!1},{handle:"webhookId",jsonSchema:{type:"string"},nullable:!1}],provider:"woocommerce",type:"integration"},callback:{headers:["x-wc-webhook-delivery-id","x-wc-webhook-event","x-wc-webhook-id","x-wc-webhook-resource","x-wc-webhook-signature","x-wc-webhook-source","x-wc-webhook-topic"],query:[]},options:!1},{snapshot:{configInputs:[{handle:"events",jsonSchema:{type:"array",items:{type:"string",enum:["zen:event-type:ticket.agent_assignment_changed","zen:event-type:ticket.attachment_linked_to_comment","zen:event-type:ticket.attachment_redacted_from_comment","zen:event-type:ticket.brand_changed","zen:event-type:ticket.comment_added","zen:event-type:ticket.comment_made_private","zen:event-type:ticket.comment_redacted","zen:event-type:ticket.created","zen:event-type:ticket.csat_received","zen:event-type:ticket.csat_requested","zen:event-type:ticket.custom_field_changed","zen:event-type:ticket.custom_status_changed","zen:event-type:ticket.description_changed","zen:event-type:ticket.email_ccs_changed","zen:event-type:ticket.external_id_changed","zen:event-type:ticket.followers_changed","zen:event-type:ticket.form_changed","zen:event-type:ticket.group_assignment_changed","zen:event-type:ticket.marked_as_spam","zen:event-type:ticket.merged","zen:event-type:ticket.next_sla_breach_changed","zen:event-type:ticket.ola_policy_changed","zen:event-type:ticket.organization_changed","zen:event-type:ticket.permanently_deleted","zen:event-type:ticket.priority_changed","zen:event-type:ticket.problem_link_changed","zen:event-type:ticket.requester_changed","zen:event-type:ticket.schedule_changed","zen:event-type:ticket.sla_policy_changed","zen:event-type:ticket.soft_deleted","zen:event-type:ticket.status_changed","zen:event-type:ticket.subject_changed","zen:event-type:ticket.submitter_changed","zen:event-type:ticket.tags_changed","zen:event-type:ticket.task_due_at_changed","zen:event-type:ticket.type_changed","zen:event-type:ticket.undeleted","zen:event-type:organization.created","zen:event-type:organization.custom_field_changed","zen:event-type:organization.deleted","zen:event-type:organization.external_id_changed","zen:event-type:organization.name_changed","zen:event-type:organization.tags_changed","zen:event-type:user.active_changed","zen:event-type:user.alias_changed","zen:event-type:user.created","zen:event-type:user.custom_field_changed","zen:event-type:user.custom_role_changed","zen:event-type:user.default_group_changed","zen:event-type:user.deleted","zen:event-type:user.details_changed","zen:event-type:user.external_id_changed","zen:event-type:user.group_membership_created","zen:event-type:user.group_membership_deleted","zen:event-type:user.identity_changed","zen:event-type:user.identity_created","zen:event-type:user.identity_deleted","zen:event-type:user.last_login_changed","zen:event-type:user.merged","zen:event-type:user.name_changed","zen:event-type:user.notes_changed","zen:event-type:user.only_private_comments_changed","zen:event-type:user.organization_membership_created","zen:event-type:user.organization_membership_deleted","zen:event-type:user.password_changed","zen:event-type:user.photo_changed","zen:event-type:user.role_changed","zen:event-type:user.suspended_changed","zen:event-type:user.tags_changed","zen:event-type:user.time_zone_changed"]},minItems:1,uniqueItems:!0},nullable:!1}],definitionVersion:2,description:"Triggers when one of the selected Zendesk account events occurs.",displayName:"Event Subscription",endpoint:{body:{allowArray:!1,allowEmpty:!1,formats:["json"]},methods:["POST"],successStatus:202},key:"zendesk.on_event",name:"on_event",outputs:[{handle:"body",jsonSchema:{type:"object"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"subject",jsonSchema:{type:"string"},nullable:!1}],provider:"zendesk",type:"integration"},callback:{headers:["x-zendesk-webhook-signature","x-zendesk-webhook-signature-timestamp"],query:[]},options:!1},{snapshot:{key:"zoom.on_recording_ready",provider:"zoom",name:"on_recording_ready",displayName:"Cloud Recording Ready",description:"Receives completed cloud recordings hosted by the connected Zoom user through a verified application event source.",definitionVersion:2,type:"integration",endpoint:{methods:["POST"],body:{formats:["json"],allowArray:!1,allowEmpty:!1},successStatus:200},configInputs:[{handle:"sourceId",jsonSchema:{type:"string",pattern:"^source_[0-9a-f]{32}$",title:"Event source"},nullable:!1},{handle:"eventTypes",jsonSchema:{type:"array",items:{type:"string",enum:["recording.completed"]},minItems:1,maxItems:1,uniqueItems:!0,title:"Events"},nullable:!1,value:["recording.completed"]}],outputs:[{handle:"event",jsonSchema:{type:"string"},nullable:!1},{handle:"deliveryId",jsonSchema:{type:"string"},nullable:!1},{handle:"accountId",jsonSchema:{type:"string"},nullable:!1},{handle:"meetingUuid",jsonSchema:{type:"string"},nullable:!1},{handle:"body",jsonSchema:{type:"object"},nullable:!1}]},callback:{headers:[],query:[]},source:{createSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{kind:{type:"string",const:"zoom"},version:{type:"number",const:1},name:{type:"string",minLength:1,maxLength:128},connectionId:{type:"string",minLength:1,maxLength:256},teamId:{anyOf:[{type:"string",minLength:1,maxLength:256},{type:"null"}]},appId:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},eventTypes:{minItems:1,maxItems:1,type:"array",items:{type:"string",const:"recording.completed"}}},required:["kind","version","name","connectionId","teamId","appId","signingSecret","eventTypes"],additionalProperties:!1},updateSchema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{version:{type:"number",const:1},expectedRevision:{type:"integer",exclusiveMinimum:0,maximum:9007199254740991},name:{type:"string",minLength:1,maxLength:128},enabled:{type:"boolean"},eventTypes:{minItems:1,maxItems:200,type:"array",items:{type:"string",pattern:"^[a-z][a-z0-9_.:]{0,127}$"}},verificationToken:{type:"string",minLength:1,maxLength:256},signingSecret:{type:"string",minLength:1,maxLength:256},encryptKey:{type:"string",minLength:1,maxLength:256}},required:["version","expectedRevision","name","enabled","eventTypes"],additionalProperties:!1},kind:"zoom",provider:"zoom",triggerId:"zoom.on_recording_ready",maximumBodyBytes:65536,applicationIngress:!0,managed:!1},options:!1,eventSource:"zoom"}];function jw(e){return Qy(e).extend({name:k().trim().min(1).max(128)})}var Rw=Nw.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),_w=te(Rw.map((e)=>jw(e.createSchema))),$w=jw(Rw[0].updateSchema),Dw=w({version:b(1),expectedRevision:Ne().positive()});var Lw={start:"A Start node with a required message parameter. Supply it through trigger.outputs.",error:"A Flow Error node. Select upstream Flows, then publish and enable this Flow to listen for failures in their automatic runs.",webhook:"A Webhook start node.","webhook-response":"An HTTP response node with body, statusCode and headers inputs. Select it from a reachable Webhook.",cron:"An hourly scheduled start node.",poll:"Gmail polling by key; replace CONNECTION_ID with an active Gmail connection.",integration:"Telegram webhook integration by key; replace CONNECTION_ID with an active Telegram connection.",decision:"AI Decision evaluates named questions against target and returns a complete answer object per output. Configure target before running.","skip-duplicates":"Skip items already recorded by successful Runs. Configure identity fields; an empty list uses each string or numeric item. History is private to the node and only commits after Run success.","http-request":"A single HTTP request. Bind url and request inputs; outputs are body, statusCode and headers.","connector-proxy":"A Provider API request through Connector Proxy. Select a Provider and account, then bind endpoint. Outputs preserve body, statusCode, headers and bodyEncoding.",openapi:"A fixed JSON API operation. Replace the example document and URL before running.",connector:"A Connector Task and its node. Replace ACTION_ID, CONNECTION_ID and port definitions using connector_get / connector show. Set connectionId to an empty string to defer account configuration; execution will require an account.",code:"A JavaScript module and its node. Use Code for custom computation; use Connector Tasks for existing actions.",condition:"A condition with true and false execution branches.",value:"A fixed value node.",approval:"An Approval with approve and reject decision branches and a built-in notification output.",wait:"A Wait with a continue action and a built-in notification output.",agent:"An Agent with code computation enabled. Configure a model available in the deployment.","llm-chat":"An LLM chat Task and its node; configure a model available in the deployment.","llm-json":"An LLM JSON Task and its node; configure a model available in the deployment.","poll-notification":"Gmail events \u2192 JavaScript text formatting \u2192 Connector notification. Replace connection/action IDs and match the notification input ports."},iT=Object.keys(Lw),sT=iT.map((e)=>({name:e,description:Lw[e]}));var cF=w({comment:Td}),pr=De(),$e=k().min(1),Ee=b(1),Ls=$e.refine((e)=>e==e.trim()&&xo(e)==null,"Flow name is invalid."),Ms=A($e).transform((e)=>[...new Set(e)].toSorted()),cT=$e.transform((e)=>e.trim()).refine((e)=>xo(e)==null,"Tag name is invalid."),Mw=re(k(),re(k(),pr)),zw=w({nodeId:$e,outputs:re(k(),pr)}),ae={readFlowState:Yy.extend({version:Ee}),canvas:w({command:Oo,version:Ee}),authoringCheck:Fu,authoringEdit:er,authoringRead:ys,authoringSearch:gs,authoringSchema:qu,loadOpenApiDocument:w({url:k().min(1).max(8192),version:Ee}),createEventSource:_w,updateEventSource:$w,eventSourceRevision:Dw,importFlow:w({file:pr,name:Ls.optional(),teamId:$e.optional(),tagIds:Ms.optional(),version:Ee}),createFlow:w({name:Ls,teamId:$e.optional(),tagIds:Ms.optional(),presentation:re(k(),pr).optional(),version:Ee}),saveTag:w({name:cT,version:Ee}),setFlowTags:w({tagIds:Ms,version:Ee}),updateFlow:w({name:Ls.optional(),icon:k().nullable().optional(),description:k().nullable().optional(),tagIds:Ms.optional(),version:Ee}).refine((e)=>e.name!==void 0||e.icon!==void 0||e.description!==void 0||e.tagIds!==void 0,"Flow settings are empty."),renameFlow:w({name:Ls,version:Ee}),changeDraft:w({expectedRevisionId:$e,operations:A(pr).min(1),version:Ee}),repairDraft:w({expectedRevisionId:$e,version:Ee}),upgradeDraft:w({expectedRevisionId:$e,version:Ee}),setEnabled:w({enabled:me(),expectedPublicationId:$e,version:Ee}),updatePresentation:w({expectedRevision:Ne().positive(),value:re(k(),pr),version:Ee}),checkFlow:w({engineContract:$e,version:Ee}),publishFlow:w({engineContract:$e,expectedLivePublicationId:$e.nullable(),version:Ee}),rollbackFlow:w({expectedLivePublicationId:$e,version:Ee}),createDraftRun:w({engineContract:$e,inputs:Mw,trigger:zw,version:b(2)}),createLiveRun:w({publicationId:$e,inputs:Mw,trigger:zw,version:b(2)}),resolveWait:w({action:U(["approve","continue","reject"]),comment:Td,version:Ee}),putVariable:w({value:k().refine((e)=>new TextEncoder().encode(e).byteLength<=65536,"Variable value is too large.")}),queryConnectorAccessCandidates:w({providerIds:A($e.max(256)).min(1).refine((e)=>new Set(e).size==e.length,"Duplicate provider IDs."),version:Ee}),removeConnectionUsage:w({connectionId:$e,expectedRevisionId:$e,expectedAccessRevision:Ne().nonnegative(),version:Ee}),setConnectorService:w({expectedAccessRevision:Ne().nonnegative(),version:Ee}),addProviderAccessBinding:w({accessBindingId:$e,expectedAccessRevision:Ne().nonnegative(),version:Ee}),removeProviderAccessBinding:w({accessBindingId:$e,expectedAccessRevision:Ne().nonnegative(),version:Ee}),versionOnly:w({version:Ee})};function le(e){return(n)=>e.parse(n)}var lF={readFlowState:le(ae.readFlowState),canvas:le(ae.canvas),authoringCheck:le(ae.authoringCheck),authoringEdit:le(ae.authoringEdit),authoringRead:le(ae.authoringRead),authoringSearch:le(ae.authoringSearch),authoringSchema:le(ae.authoringSchema),loadOpenApiDocument:le(ae.loadOpenApiDocument),createEventSource:le(ae.createEventSource),updateEventSource:le(ae.updateEventSource),eventSourceRevision:le(ae.eventSourceRevision),importFlow:le(ae.importFlow),createFlow:le(ae.createFlow),saveTag:le(ae.saveTag),setFlowTags:le(ae.setFlowTags),updateFlow:le(ae.updateFlow),renameFlow:le(ae.renameFlow),changeDraft(e){let n=ae.changeDraft.parse(e);return{...n,operations:Od(n.operations)}},repairDraft:le(ae.repairDraft),upgradeDraft:le(ae.upgradeDraft),setEnabled:le(ae.setEnabled),updatePresentation:le(ae.updatePresentation),checkFlow:le(ae.checkFlow),publishFlow:le(ae.publishFlow),rollbackFlow:le(ae.rollbackFlow),createDraftRun:le(ae.createDraftRun),createLiveRun:le(ae.createLiveRun),resolveWait:le(ae.resolveWait),putVariable:le(ae.putVariable),queryConnectorAccessCandidates:le(ae.queryConnectorAccessCandidates),removeConnectionUsage:le(ae.removeConnectionUsage),setConnectorService:le(ae.setConnectorService),addProviderAccessBinding:le(ae.addProviderAccessBinding),removeProviderAccessBinding:le(ae.removeProviderAccessBinding),versionOnly:le(ae.versionOnly)};var Nd=["expected-revision","idempotency-key"],jd=["cursor","limit"],Fw=[["state show","<flow> --scope <draft|live> [--key <key>]",["scope","key"]],["state clear","<flow> --scope <draft|live> [--key <key>] --yes",["scope","key","yes"]],["dedupe clear","<flow> --scope <draft|live> --space <space> --yes",["scope","space","yes"]],["canvas","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["read","<flow> [--input JSON|@file|- | --file path|-]",["input","file"]],["search","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["edit","<flow> (--input JSON|@file|- | --file path|-)",["input","file"]],["list","[--cursor <cursor>] [--limit <count>]",jd],["export","<flow>",["include-dependencies"]],["import","--file <path|->",["file","name","idempotency-key","tag"]],["create","<name>",["idempotency-key"]],["show","<flow>",[]],["live","<flow>",[]],["rename","<flow> <new-name>",[]],["delete","<flow> --yes",["yes"]],["check","<flow> [--revision <revisionId>]",["revision"]],["enable","<flow> --expected-publication <publicationId>",["expected-publication"]],["disable","<flow> --expected-publication <publicationId>",["expected-publication"]],["connector code-access","<flow> [--publication <publicationId>]",["publication"]],["connector candidates","<flow> <provider> [provider ...]",[]],["connector code-allow","<flow> <provider> <binding> <access-revision>",[]],["connector code-remove","<flow> <provider> <binding> <access-revision>",[]],["connector remove-usage","<flow> <connection> <access-revision>",Nd],["connector providers","[--flow <flow>]",["flow"]],["connector teams","",[]],["connector search","<query> [--flow <flow>]",["flow"]],["connector show","<action> [--flow <flow>]",["flow"]],["connector connections","<service> [--flow <flow>]",["flow"]],["event-source list","",[]],["trigger search","[query]",[]],["trigger show","<key>",[]],["run","<flow>",[...Nd,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...jd]],["runs show","<run>",[]],["runs wait","<run>",["timeout"]],["runs resolve","<run> <wait> <continue|approve|reject>",["comment"]],["runs events","<run>",["after","limit","follow","timeout"]],["runs result","<run>",[]],["runs results","<run> [--after <resultId>]",["after"]],["runs read-result","<run> <result>",["pointer","offset","limit","max-bytes"]],["runs download-result","<run> <result>",[]],["runs cancel","<run>",[]],["publish","<flow>",[...Nd,"expected-publication","timeout"]],["publications list","<flow>",jd],["publications show","<flow> <publication>",[]],["publications wait","<flow> <operation>",["timeout"]],["publications operation","<flow> <operation>",[]],["rollback","<flow> <publication>",["expected-publication","idempotency-key"]],["open","[flow]",[]],["workbench","[flow]",[]],["schema","[read|search|edit|check|node-type]",["flow","input"]]],lT={scope:{description:"Required State scope; never defaults to live.",type:"string",enum:["draft","live"]},key:{description:"Business state key to read or clear; omit to inspect metadata or clear all business values.",type:"string"},space:{description:"Deduplication space: flow or node:<nodeId>.",type:"string"},revision:{description:"Exact Revision to read or check; defaults to the current Draft.",type:"string"},publication:{description:"Exact Publication ID whose fixed Code connections are read; defaults to the Draft.",type:"string"},pointer:{description:"JSON Pointer within the stored result; defaults to the root.",type:"string"},offset:{description:"Page offset at the selected pointer.",type:"integer",minimum:0,default:0},"max-bytes":{description:"Maximum result page bytes.",type:"integer",minimum:1,maximum:1048576,default:15000},"expected-revision":{description:"Base Revision ID from read. Required with an explicit idempotency key for draft edits and draft runs.",type:"string"},"expected-publication":{description:"Fixed Publication ID. Use none when publishing without a Live Publication.",type:"string"},"idempotency-key":{description:"Stable identity of one mutation. Reuse only with the identical arguments and base identity.",type:"string"},source:{description:"Execution source.",type:"string",enum:["draft","live"],default:"draft"},trigger:{description:"Exact Trigger ID or unambiguous name. The Start node is selected automatically; a sole legacy Manual Trigger remains supported.",type:"string"},timeout:{description:"Wait budget in milliseconds; expiration does not cancel the operation. For node set, the node execution timeout.",type:"integer",minimum:1,default:60000},limit:{description:"Maximum items in one page.",type:"integer",minimum:1,maximum:100,default:100},after:{description:"Resume events after this sequence number; use nextAfter from the preceding response.",type:"integer",minimum:0,default:0},cursor:{description:"Opaque nextCursor from the preceding page; keep the same filters.",type:"string"},comment:{description:"Optional plain-text Wait decision comment (up to 2,000 Unicode code points).",type:"string"},"pending-wait":{description:"List runs with unresolved waits, including running and queued runs.",type:"boolean"},status:{description:"Filter runs by status.",type:"string",enum:["queued","starting","running","waiting","completed","failed","canceled","indeterminate"]},"include-dependencies":{description:"Include all referenced workflow drafts in one JSON bundle.",type:"boolean"},tag:{description:"Tag ID applied to every imported workflow; repeat to select multiple tags.",type:"string"},file:{description:"Authoring request or workflow JSON file path, or - for stdin.",type:"string"},code:{description:"JavaScript source, @file, or - for stdin.",type:"string"},input:{description:"Authoring request JSON; literal JSON, @file, or -. For run, node ID to input values.",type:"string"},outputs:{description:"Start parameters or other Trigger outputs: literal JSON, @file, or -. Defaults to {}.",type:"string"},set:{description:"handle=value; repeat for multiple fields. Values use port schemas, JSON, @file, or -.",type:"string"},unset:{description:"Input/config handle to remove; repeat for multiple fields.",type:"string"},connection:{description:"Exact active Connection ID, unambiguous display name, or default.",type:"string"},flow:{description:"Exact Flow ID or unambiguous name; fixes Connector Team scope.",type:"string"},name:{description:"Display name.",type:"string"},description:{description:"Trigger description.",type:"string"},cron:{description:"Cron expression; combine with --timezone. Mutually exclusive with --every.",type:"string"},timezone:{description:"IANA time zone for --cron.",type:"string"},every:{description:"Interval such as 5m, 1h, or 1d. Mutually exclusive with --cron.",type:"string"},wait:{description:"Wait until terminal, waiting for an action, or the wait budget expires."},follow:{description:"Stream event pages as NDJSON with --json; stop on terminal, Wait, or timeout."},yes:{description:"Confirm the requested deletion."},json:{description:"Machine-readable JSON results and errors; NDJSON for followed events."},help:{description:"Show this command contract without contacting the host."}};function Rd(e,n="oo flow"){let t=e.join(" ");return Fw.filter(([r])=>t==""||r==t||r.startsWith(`${t} `)).map(([r,o,i])=>({command:r,usage:`${n} ${r} ${o} [--json]`,options:[...i,"json","help"].map((s)=>Object.assign({name:`--${s}`,value:!["json","help","wait","follow","yes","pending-wait","include-dependencies"].includes(s),repeatable:s=="set"||s=="unset"||s=="tag"},lT[s],r=="runs results"&&s=="after"?{type:"string",minimum:void 0,default:void 0,description:"Result ID from nextAfter on the preceding page."}:{},r=="runs read-result"&&s=="limit"?{default:20}:{}))}))}function qw(e){return Fw.find(([n])=>n==e.slice(0,n.split(" ").length).join(" "))?.[2]}function Vw(e="edits"){let n=Vu(e);if(n!=null)return n;if(e=="edits")return bs();if(e=="outputs")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",description:"Named Start parameters or other Trigger outputs. Start uses the workflow inputDefs returned by flow read; other triggers define their own output contracts. Omitted nullable Start parameters become null; required parameters must be supplied."};if(hs.includes(e))return bs(e);if(e=="input")return{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",additionalProperties:{type:"object",additionalProperties:!0},description:"Node ID -> input handle -> JSON value."};return}function _d(e){if(e=="canvas")return{request:$n(Oo,{io:"input"}),guidance:"Broadcast transient viewport commands; success does not confirm execution. No Presentation save, offline queue or replay. Pan uses screen pixels; zoom is an absolute ratio (0.1\u20133); fit includes all nodes. Repeating pan moves again; do not automatically retry an uncertain response.",examples:[{type:"focus",nodeId:"NODE_ID"},{type:"zoom",zoom:0.8},{type:"pan",dx:200,dy:-100},{type:"fit"}]};return Vu(e)}function Bw(e,n="oo flow"){if(e=="export")return[`${n} export FLOW_ID > template.openflow.json`];if(e=="import")return[`${n} import --file template.openflow.json --name "Imported workflow" --idempotency-key IMPORT_KEY --json`];if(e=="schema")return[`${n} schema read --json`,`${n} schema agent --json`,`${n} schema --flow FLOW_ID --input '{"action":"ACTION_ID"}' --json`];let t=_d(e);if(t==null)return uT(n);if(e=="check")return[`${n} check FLOW_ID --revision REVISION --json`];return t.examples.map((r)=>`${n} ${e} FLOW_ID${Object.keys(r).length==0?"":` --input '${JSON.stringify(r)}'`} --json`)}function uT(e){return[`${e} list --limit 20 --json`,`${e} read FLOW_ID --json`,`${e} live FLOW_ID --json`,`${e} schema code --json`,`${e} edit FLOW_ID --file edits.json --json`,`${e} connector search email --flow FLOW_ID --json`,`${e} run FLOW_ID --expected-revision REVISION_ID --idempotency-key RUN_KEY --wait --timeout 60000 --json`,`${e} runs wait RUN_ID --timeout 60000 --json`,`${e} runs resolve RUN_ID WAIT_ID approve --json`,`${e} runs events RUN_ID --after 0 --follow --timeout 60000 --json`]}import{basename as pT}from"path";async function Uw(e,n,t,r,o){let[i,s,a,...c]=t;switch(i){case"code-access":case"candidates":case"code-allow":case"code-remove":case"remove-usage":{let l=i=="code-access"?1:i=="candidates"?2:i=="remove-usage"?3:4;if(i=="candidates"?t.length<l+1:t.length!=l+1)throw new P("cli.invalid-arguments",`Invalid arguments for connector ${i}. See --help.`);let u=dT(n),d;if(i=="code-access")d=r.publication==null?await e.getConnectorAccess(u):await e.getPublishedConnectorAccess(u,r.publication);else if(i=="candidates")d=await e.listProviderAccessBindingCandidates(u,t.slice(2));else{let p=Number(t.at(-1));if(!Number.isSafeInteger(p)||p<0)throw new P("cli.invalid-arguments","Access revision must be a nonnegative integer.");if(i=="remove-usage"){let m=await Hx(e,n,r);d=await e.removeConnectionUsage(u,a,m.draft.revisionId,p,r.idempotencyKey)}else if(i=="code-allow")d=await e.addProviderAccessBinding(u,a,c[0],p);else d=await e.removeProviderAccessBinding(u,a,c[0],p)}W(o,r.json,{...d,kind:`connector.${i}`},JSON.stringify(d,null,2));return}case"providers":{if(s!=null)throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector providers [--flow <flow>] [--json]`);let l=await e.listConnectorProviders(void 0,n?.flowId);W(o,r.json,{providers:l,kind:"connector.providers",version:1},l.map((u)=>`${u.serviceName} ${u.serviceId}`).join(`
70
+ `));return}case"teams":{if(s!=null)throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector teams [--json]`);let l=await e.listConnectorTeams();W(o,r.json,{...l,kind:"connector.teams"},l.teams.map((u)=>`${u.name} ${u.id}`).join(`
71
+ `));return}case"search":{if(s==null||a!=null)throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector search <query> [--json]`);let l=s.trim();if(l.length==0||l.length>256)throw new P("cli.invalid-arguments","Connector search query must contain 1\u2013256 characters.");let u=await e.searchConnectorActions(l,void 0,n?.flowId);W(o,r.json,{actions:u.map(Yu),kind:"connector.search",query:l,version:1},u.map(dd).join(`
72
+ `));return}case"show":{if(s==null||a!=null)throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector show <action> [--json]`);let l=await Gx(e,s,n?.flowId);W(o,r.json,{action:l,kind:"connector.show",version:1},dd(l));return}case"connections":{if(s==null||a!=null)throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector connections <service> [--json]`);let l=await e.listConnectorConnections(s,void 0,n?.flowId);W(o,r.json,{connections:l,kind:"connector.connections",serviceId:s,version:1},l.map(Xx).join(`
73
+ `));return}default:throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function Jw(e,n,t,r){let[o,i,s]=n;switch(o){case"search":{if(s!=null)throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger search [query] [--json]`);let a=i?.trim().toLowerCase();if(a!=null&&(a.length==0||a.length>256))throw new P("cli.invalid-arguments","Trigger search query must contain 1\u2013256 characters.");let c=td(await e.listTriggerKeys(),a);W(r,t.json,{keys:c,kind:"trigger.search",query:a,version:1},c.map(ud).join(`
74
+ `));return}case"show":{if(i==null||s!=null)throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger show <key> [--json]`);let a=await Qx(e,i);W(r,t.json,{definition:a,kind:"trigger.show",version:1},ud(a));return}default:throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function dT(e){if(e==null)throw new P("cli.invalid-arguments","A Flow reference is required.");return e.flowId}function zs(e){if(e.publication==null)return`not-published ${e.flowId}`;return[`live ${e.flowId} ${e.publication.publicationId} ${e.publication.revisionId} ${e.status} enabled=${e.enabled}`,`inputDefs=${JSON.stringify(e.inputDefs)}`,...e.entries.flatMap((n)=>[`${n.type} ${n.nodeId} ${n.name}`,..."binding"in n?[` health=${n.binding.health}${n.binding.lastErrorCode==null?"":` error=${n.binding.lastErrorCode}`}`,...n.binding.listener==null?[]:[` listener=${JSON.stringify(n.binding.listener)}`],...n.binding.endpointUrl==null?[]:[` url=${n.binding.endpointUrl}`]]:[],..."provider"in n?[` provider=${n.provider} inputs=${JSON.stringify(n.inputs)}`]:[],` config=${JSON.stringify(n.config)}`])].join(`
75
+ `)}async function Zw(e,n,t,r){xe(n,1,`${r.commandPrefix??"oo flow"} run <flow> [--source draft|live] [--trigger <name|id>] [--outputs <json|@file|->] [--input <json|@file|->] [--wait] [--json]`);let o=await Te(e,n[0]),i=await tw(t,r),s=t.source=="live"?t.expectedPublication==null?await e.getLive(o.flowId):{publication:await Ao(e,o.flowId,t.expectedPublication)}:void 0;if(t.source=="live"&&s?.publication==null)throw new P("live.not-found",`Flow ${JSON.stringify(n[0])} has no Live Publication.`);let a=s?.publication?.revisionId??t.expectedRevision??o.draftRevisionId,{triggers:c}=await e.getRevisionTriggers(o.flowId,a),l=c.filter((z)=>z.kind=="start"),u=l.length==1?l[0].triggerId:c.length==1&&c[0]?.kind=="manual"?c[0].triggerId:void 0,d=t.trigger??u;if(d==null)throw new P("run.trigger-required","Choose a start node with --trigger <name|id>.",{candidates:c.map(({triggerId:z,name:ge})=>({triggerId:z,name:ge}))});let p=c.find((z)=>z.triggerId==d),m=c.filter((z)=>z.name==d);if(p==null&&m.length>1)throw new P("trigger.ambiguous",`Trigger name ${JSON.stringify(d)} is ambiguous.`,{candidates:m.map(({triggerId:z,name:ge})=>({triggerId:z,name:ge}))});let y=p??m[0];if(y==null)throw new P("trigger.not-found",`Trigger ${JSON.stringify(d)} was not found.`);let I={};if(t.outputs!=null){let z=await ar(t.outputs,"--outputs","run.input-unreadable",r);try{let ge=JSON.parse(z);if(ge==null||typeof ge!=="object"||Array.isArray(ge))throw Error("Expected output object.");I=ge}catch{throw new P("run.input-invalid","Trigger outputs must be valid JSON.")}}let j={nodeId:y.triggerId,outputs:I},L;if(s?.publication!=null)L=await e.createLiveRun(s.publication.publicationId,{inputs:i,trigger:j,idempotencyKey:t.idempotencyKey});else L=await e.createDraftRun(o.flowId,a,{inputs:i,trigger:j,idempotencyKey:t.idempotencyKey});let F=t.wait?await pd(e,L,r,t.timeoutMs):{run:L,timedOut:!1};return W(r,t.json,{kind:"run.create",idempotencyKey:t.idempotencyKey,...F,version:1},Po(F.run)),To(F.run,F.timedOut)}async function Kw(e,n,t,r){let[o,...i]=n;switch(o){case"list":{if(xe(i,0,`${r.commandPrefix??"oo flow"} runs list --flow <flow> [--status <status>] [--pending-wait] [--cursor <cursor>] [--limit <count>] [--json]`),t.flow==null)throw new P("cli.invalid-arguments",`${r.commandPrefix??"oo flow"} runs list requires --flow <flow>.`);let s=await Te(e,t.flow),a=await e.listRuns(s.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??ld,...t.status==null?{}:{status:t.status},...t.pendingWait==null?{}:{pendingWait:t.pendingWait}});W(r,t.json,{kind:"run.list",...a,version:1},a.runs.map(Yx).join(`
76
+ `));return}case"show":{xe(i,1,`${r.commandPrefix??"oo flow"} runs show <run> [--json]`);let s=await e.getRun(i[0]);W(r,t.json,{kind:"run.show",run:s,version:1},Po(s));return}case"wait":{xe(i,1,`${r.commandPrefix??"oo flow"} runs wait <run> [--timeout <milliseconds>] [--json]`);let s=i[0],a=Date.now()+(t.timeoutMs??60000);try{let c=await e.getRun(s,AbortSignal.timeout(t.timeoutMs??60000)),l=await pd(e,c,r,Math.max(0,a-Date.now()));return W(r,t.json,{kind:"run.wait",runId:s,...l,version:1},Po(l.run)),To(l.run,l.timedOut)}catch(c){if(Date.now()>=a||c instanceof Error&&c.name=="TimeoutError")return W(r,t.json,{kind:"run.wait",runId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(c instanceof P)throw c;throw new P("run.wait-failed",c instanceof Error?c.message:String(c),{runId:s})}}case"resolve":{xe(i,3,`${r.commandPrefix??"oo flow"} runs resolve <run> <wait> <continue|approve|reject> [--comment <text>] [--json]`);let[s,a,c]=i;if(c!="continue"&&c!="approve"&&c!="reject")throw new P("cli.invalid-arguments","Invalid Wait action.");let l=await e.resolveRunWait(s,a,c,t.comment);W(r,t.json,{kind:"run.resolve",resolution:l,version:1},JSON.stringify(l));return}case"events":{xe(i,1,`${r.commandPrefix??"oo flow"} runs events <run> [--after <sequence>] [--limit <count>] [--follow] [--timeout <milliseconds>] [--json]`);let s=i[0],a=t.after??0,c=Date.now()+(t.timeoutMs??60000),l;try{do{if(t.follow&&Date.now()>=c)break;let u=await e.getRunEvents(s,{after:a,limit:t.limit??ld},t.follow?AbortSignal.timeout(Math.max(1,c-Date.now())):void 0);if(a=u.nextAfter,W(r,t.json,{...u,kind:"run.events",runId:s,version:1},u.events.map(ew).join(`
77
+ `)),!t.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),Wx(u.events.at(-1)))return To(l);if(t.after!=null&&u.events.length==0&&u.done)return To(l);if(l.waits.length>0)return W(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},Po(l)),2;let d=c-Date.now();if(d<=0)break;if(u.events.length==0)await r.wait(Math.min(1000,d))}while(t.follow)}catch(u){if(!t.follow||Date.now()<c&&!(u instanceof Error&&u.name=="TimeoutError"))throw new P("run.events-failed",u instanceof Error?u.message:String(u),{runId:s,nextAfter:a})}return W(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!0,version:1},`timeout ${s} ${a}`),3}case"results":{xe(i,1,`${r.commandPrefix??"oo flow"} runs results <run> [--after <resultId>]`);let s=await e.listRunResults(i[0],t.resultAfter);W(r,t.json,{kind:"run.results",...s},JSON.stringify(s));return}case"read-result":{xe(i,2,`${r.commandPrefix??"oo flow"} runs read-result <run> <result> [--pointer <pointer>] [--offset <offset>] [--limit <limit>] [--max-bytes <bytes>]`);let s=await e.readRunResult(i[0],i[1],{pointer:t.pointer??"",offset:t.offset??0,...t.limit==null?{}:{limit:t.limit},...t.maxBytes==null?{}:{maxBytes:t.maxBytes}});W(r,t.json,{kind:"run.result-page",...s},JSON.stringify(s));return}case"download-result":{xe(i,2,`${r.commandPrefix??"oo flow"} runs download-result <run> <result>`);let s=await e.downloadRunResult(i[0],i[1]);r.stdout.write(await s.text());return}case"result":{xe(i,1,`${r.commandPrefix??"oo flow"} runs result <run> [--json]`);let s=await e.getRunResult(i[0]);return W(r,t.json,{kind:"run.result",result:s,version:1},JSON.stringify(s)),s.status=="completed"?0:1}case"cancel":{xe(i,1,`${r.commandPrefix??"oo flow"} runs cancel <run> [--json]`);let s=await e.cancelRun(i[0]);W(r,t.json,{cancellation:s,kind:"run.cancel",version:1},`${s.status} ${s.runId} ${s.cancelAccepted?"accepted":"already-terminal"}`);return}default:throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} runs <list|show|wait|resolve|events|result|results|read-result|download-result|cancel>`)}}async function Ww(e,n,t,r){xe(n,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await Te(e,n[0]),i=t.expectedPublication=="none"?null:t.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId??null,s=await e.publishFlow(o.flowId,t.expectedRevision??o.draftRevisionId,i,{idempotencyKey:t.idempotencyKey}),a=await fd(e,o.flowId,s,r,t.timeoutMs);if(s=a.operation,s.status=="pending")return W(r,t.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:t.idempotencyKey,flowId:o.flowId,...a,version:1},JSON.stringify(s)),3;if(s.status=="failed")throw new P(s.issue.code,s.issue.message,{...s.issue.nodeId==null?{}:{nodeId:s.issue.nodeId},operationId:s.operationId,flowId:o.flowId,idempotencyKey:t.idempotencyKey});let c=[],l=`${r.commandPrefix??"oo flow"} live ${o.flowId} --json`,u;try{if(u=await e.getLiveDetails(o.flowId),u.publication?.publicationId!=s.publicationId)c.push({code:"live.publication-changed",message:`Publication ${s.publicationId} succeeded. Current Live is ${u.publication?.publicationId??"not-published"}; the returned entries describe that current version.`})}catch{c.push({code:"live.details-read-failed",message:`Publication ${s.publicationId} succeeded, but its current online entries could not be read. Query ${l}.`})}let d=u?.publication?.publicationId==s.publicationId?u.publication:void 0;if(d==null)try{d=await Ao(e,o.flowId,s.publicationId)}catch{c.push({code:"publication.read-failed",message:`Publication ${s.publicationId} succeeded, but its metadata could not be read. Query ${l}.`})}W(r,t.json,{kind:"publication.publish",expectedPublicationId:i,idempotencyKey:t.idempotencyKey,operation:s,...d==null?{}:{publication:d},...u==null?{}:{live:u},...c.length==0?{}:{warnings:c},version:1},[d==null?`published ${s.publicationId} ${s.revisionId}`:Co(d),...u==null?[]:[zs(u)],...c.map((p)=>`Warning: ${p.message}`)].join(`
78
+ `))}async function Hw(e,n,t,r){let[o,i,s,...a]=n;if(i==null||a.length>0)throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`);let c=await Te(e,i);if(o=="list"){if(s!=null)throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications list <flow> [--cursor <cursor>] [--limit <count>]`);let l=await e.listPublications(c.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??cd});W(r,t.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Co).join(`
79
+ `));return}if((o=="operation"||o=="wait")&&s!=null){let l=Date.now()+(t.timeoutMs??60000);try{let u=await e.getPublishOperation(c.flowId,s,o=="wait"?AbortSignal.timeout(t.timeoutMs??60000):void 0),d=o=="wait"?await fd(e,c.flowId,u,r,Math.max(0,l-Date.now())):{operation:u,timedOut:!1};return W(r,t.json,{kind:`publication.${o}`,flowId:c.flowId,...d,version:1},JSON.stringify(d.operation)),d.operation.status=="failed"?1:d.operation.status=="pending"?3:0}catch(u){if(o=="wait"&&(Date.now()>=l||u instanceof Error&&u.name=="TimeoutError"))return W(r,t.json,{kind:"publication.wait",flowId:c.flowId,operationId:s,timedOut:!0,version:1},`timeout ${s}`),3;if(u instanceof P)throw u;throw new P("publication.wait-failed",u instanceof Error?u.message:String(u),{flowId:c.flowId,operationId:s})}}if(o=="show"&&s!=null){let l=await Ao(e,c.flowId,s);W(r,t.json,{kind:"publication.show",publication:l,version:1},Co(l));return}throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function Gw(e,n,t,r){xe(n,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await Te(e,n[0]),i=await Ao(e,o.flowId,n[1]),s=t.expectedPublication??(await e.getLive(o.flowId)).publication?.publicationId;if(s==null)throw new P("live.not-found",`Flow ${JSON.stringify(n[0])} has no Live Publication.`);let a=await e.rollbackFlow(o.flowId,i.publicationId,s,{idempotencyKey:t.idempotencyKey});W(r,t.json,{kind:"publication.rollback",expectedPublicationId:s,idempotencyKey:t.idempotencyKey,publication:a,version:1},Co(a))}async function Qw(e,n,t,r){let[o,...i]=t.positionals;switch(o){case"state":case"dedupe":{if(xe(i,2,`${r.commandPrefix??"oo flow"} ${o} <show|clear> <flow> --scope <draft|live>`),t.scope!=="draft"&&t.scope!=="live")throw new P("cli.invalid-arguments","Explicit --scope draft or --scope live is required.");let[s,a]=i;if(s!=="clear"&&!(o==="state"&&s==="show"))throw new P("cli.invalid-arguments","Unknown State operation.");if(s==="clear"&&!t.yes)throw new P("cli.invalid-arguments","Clearing State requires --yes.");let c=await Te(e,a);if(s==="show"){let l=t.key==null?await e.getFlowState(c.flowId,t.scope):await e.getFlowStateValues(c.flowId,t.scope,[t.key]);W(r,t.json,{kind:"flow.state",...l},JSON.stringify(l,null,2))}else{if(o==="state")await e.clearFlowState(c.flowId,t.scope,t.key);else{if(t.space==null)throw new P("cli.invalid-arguments","--space is required.");await e.clearFlowDedupe(c.flowId,t.scope,t.space)}W(r,t.json,{kind:"flow.state.cleared",scope:t.scope},`Cleared ${t.scope} ${o}.`)}return}case"canvas":{if(xe(i,1,`${r.commandPrefix??"oo flow"} canvas <flow> (--input JSON|@file|- | --file path|-) [--json]`),t.file!=null&&t.input!=null)throw new P("cli.invalid-arguments","Choose --input or --file.");let s=t.file==null?t.input:t.file=="-"?"-":`@${t.file}`;if(s==null)throw new P("cli.invalid-arguments","Canvas requires --input or --file.");let a=await Eo(s,r),c=await Te(e,i[0]),l=await e.broadcastCanvas(c.flowId,a);W(r,t.json,{...l,kind:"flow.canvas"},`Broadcast canvas ${a.type} for ${c.flowId}; execution is not confirmed.`);return}case"read":case"search":case"edit":{if(xe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> [--input JSON|@file|-] [--file path|-] --json`),t.file!=null&&t.input!=null)throw new P("cli.invalid-arguments","Choose --input or --file.");let s=t.file==null?t.input:t.file=="-"?"-":`@${t.file}`,a=await Eo(s,r),c=a.requestId;if(o=="edit"&&(typeof c!="string"||c.length==0))throw new P("cli.invalid-arguments","Edit requires a non-empty requestId.");let l=await Te(e,i[0]),u=o=="read"?await e.readAuthoring(l.flowId,a):o=="search"?await e.searchAuthoring(l.flowId,a):await e.editAuthoring(l.flowId,a);r.stdout.write(`${JSON.stringify(u)}
80
+ `);return}case"connector":{let a=["code-access","candidates","code-allow","code-remove","remove-usage"].includes(i[0]??"")?await fT(e,i.slice(1)):t.flow==null?void 0:await Te(e,t.flow);return await Uw(e,a,i,t,r)}case"event-source":{if(i.length!=1||i[0]!="list")throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} event-source list [--json]`);let s=await e.listEventSources(),a=`No event sources are visible to this identity. Run "${r.commandPrefix??"oo flow"} workbench" to create and verify a Feishu event source, then list again.`;W(r,t.json,{...s,kind:"event-source.list",...s.sources.length==0?{guidance:a}:{}},s.sources.length==0?a:s.sources.map((c)=>[c.sourceId,c.name,c.teamId??"-",c.connectionId,!c.enabled?"disabled":c.verifiedAt==null?"unverified":"verified",c.eventTypes.join(",")].join("\t")).join(`
81
+ `));return}case"run":return await Zw(e,i,t,r);case"runs":return await Kw(e,i,t,r);case"publish":return await Ww(e,i,t,r);case"publications":return await Hw(e,i,t,r);case"rollback":return await Gw(e,i,t,r);case"trigger":return await Jw(e,i,t,r);case"open":case"workbench":{if(i.length>1)throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} ${o} [flow] [--json]`);if(n.getWorkbenchUrl==null)throw new P("workbench.unavailable","This CLI host cannot provide a Workbench URL.");let s=i[0]==null?void 0:await Te(e,i[0]),a=await n.getWorkbenchUrl(s?.flowId);if(o=="open")await r.openUrl(a);W(r,t.json,{...s==null?{}:{flow:s},kind:`flow.${o}`,url:a,version:1},a);return}case"list":{xe(i,0,`${r.commandPrefix??"oo flow"} list [--json]`);let s=await e.listFlows({cursor:t.cursor,limit:t.limit??100});W(r,t.json,{...s,kind:"flow.list",version:1},s.flows.map(Lt).join(`
82
+ `));return}case"export":{xe(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await Te(e,i[0]);r.stdout.write(t.includeDependencies?lx(await e.exportFlowBundle(s.flowId)):tx(await e.exportFlow(s.flowId)));return}case"import":{if(xe(i,0,`${r.commandPrefix??"oo flow"} import --file <path|-> [--name name] [--json]`),t.file==null)throw new P("cli.invalid-arguments","Import requires --file <path|->.");let s=ux(await ar(t.file=="-"?"-":`@${t.file}`,"file","flow.import-unreadable",r)),a=s.kind=="open-flow-workflow-bundle"?s.workflows.find((d)=>d.flowId==s.entryFlowId).file:s,c=t.name??a.name??(t.file=="-"?Hd(r.language??"en"):nx(pT(t.file))),l={name:_s(c,"Flow"),idempotencyKey:t.idempotencyKey,...t.tags.length?{tagIds:t.tags}:{}};if(s.kind=="open-flow-workflow-bundle"){let d=await e.importFlowBundle(s,l);W(r,t.json,{...d,idempotencyKey:t.idempotencyKey,kind:"flow.import"},d.flows.map(Lt).join(`
83
+ `));return}let u=await e.importFlow(s,l);W(r,t.json,{flow:u,idempotencyKey:t.idempotencyKey,kind:"flow.import",version:1},Lt(u));return}case"create":{xe(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(_s(i[0],"Flow"),t.idempotencyKey);W(r,t.json,{flow:s,idempotencyKey:t.idempotencyKey,kind:"flow.create",version:1},Lt(s));return}case"live":{xe(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await Te(e,i[0]),a=await e.getLiveDetails(s.flowId);W(r,t.json,{kind:"flow.live",live:a,version:1},zs(a));return}case"show":{xe(i,1,`${r.commandPrefix??"oo flow"} show <flow> [--json]`);let s=await Te(e,i[0]);W(r,t.json,{flow:s,kind:"flow.show",version:1},Lt(s));return}case"rename":{xe(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await Te(e,i[0]),a=await e.renameFlow(s.flowId,_s(i[1],"Flow"));W(r,t.json,{flow:a,kind:"flow.rename",version:1},Lt(a));return}case"delete":{if(xe(i,1,`${r.commandPrefix??"oo flow"} delete <flow> --yes [--json]`),!t.yes)throw new P("flow.confirmation-required","Flow deletion requires --yes.");let s=await Te(e,i[0]),a=await e.deleteFlow(s.flowId);W(r,t.json,{flow:a,kind:"flow.delete",version:1},Lt(a));return}case"enable":case"disable":{if(xe(i,1,`${r.commandPrefix??"oo flow"} ${o} <flow> --expected-publication <publicationId>`),t.expectedPublication==null||t.expectedPublication=="none")throw new P("cli.invalid-arguments","--expected-publication must identify the observed Live publication.");let s=await Te(e,i[0]),a=await e.setFlowEnabled(s.flowId,t.expectedPublication,o=="enable");W(r,t.json,{flow:a,kind:`flow.${o}`,version:1},Lt(a));return}case"check":{xe(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await Te(e,i[0]),a=t.revision??s.draftRevisionId,c=await e.checkAuthoring(s.flowId,a);return W(r,t.json,{check:c,valid:c.valid,revisionId:a,kind:"flow.check",scope:"revision",version:1},`${c.valid?"valid":"invalid"} revision ${s.name} ${s.flowId}`),c.valid?0:1}default:throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} <list|create|show|live|read|search|edit|canvas|schema|rename|delete|check|enable|disable|connector|event-source|trigger|run|runs|publish|publications|rollback|workbench>`)}}async function fT(e,n){let t=n[0];if(t==null)throw new P("cli.invalid-arguments","A Flow reference is required.");return await Te(e,t)}var fr={};var Yw=(e)=>e,Fs=Object.is,hT=(e,n)=>{if(Fs(e,n))return!0;if(!Array.isArray(e)||!Array.isArray(n))return!1;let t=e.length;if(n.length!==t)return!1;for(let r=0;r<t;r++)if(!Fs(e[r],n[r]))return!1;return!0},mT=(e)=>e.value,yT=(e)=>e.map(mT),gT=(e)=>e.$version,qs=(e,n)=>{try{e(n)}catch(t){console.error(t)}},ev=(e,n)=>(e.set=n,e);var bT=Promise.resolve(),$d=new Set,xT=new Set,_o=$d,Dd,wT=()=>{let e=_o;_o=_o===$d?xT:$d,Dd=!1;for(let n of e)n.t();e.clear()},vT=(e)=>{_o.add(e),Dd=Dd||bT.then(wT)},kT=(e)=>_o.delete(e);var Xw=new FinalizationRegistry(qs),tv=class{constructor(e,n,t){if(this.#n=e,this.q=(n?.equal??Fs)||void 0,this.e=n?.eager,this.m=n?.name,this.#t=n?.onDisposeValue,t){let r=new WeakRef(this),o=()=>{if(i){let s=i;i=void 0,s()}},i=t(()=>{let s=r.deref();if(s)s.n();else o()});if(i)Xw.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=fr;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#n();if(this.c===fr)this.w(e);else if(!this.q?.(e,this.c)){if(this.w(e),this.s&1)this.s|=2}}return this.c};n=()=>{if(this.#o)console.error(this.c,Error(`${this.m||""} disposed`));if(this.s|=4,this.b.size){if(this.s|=1,this[3])this.#r(3);if(this[2]){if(this.u(),this.s&2)this.#r(2)}if(this[1])vT(this);else this.s&=-4}};a(e,n){let t=this.b.get(e);if(t)this[t]--;return this.b.set(e,n),this[n]++,()=>this.r(e)}r(e){if(e){let n=this.b.get(e);if(n)this.b.delete(e),this[n]--}else this.b.clear(),this[1]=this[2]=this[3]=0,kT(this)}t(){if(this[1]){if(this.u(),this.s&2)this.#r(1)}this.s&=-4}d(){let e=this.c;if(this.r(),Xw.unregister(this),this.#e?.(),this.#o=!0,this.#t&&e!==fr)this.#t(e)}w(e){this.w=this.q?.(e,e)?this.y:this.x,this.w(e)}x(e){let n=this.c;if(this.c=e,this.v=Symbol(),this.#t&&n!==fr&&n!==e)this.#t(n)}y(e){let n=this.c;if(this.c=this.v=e,this.#t&&n!==fr&&n!==e)this.#t(n)}[1]=0;[2]=0;[3]=0;#e;#t;#n;#r(e){for(let[n,t]of this.b)if(t===e)qs(n,this.c)}#o},ST=class{#e=new WeakSet;constructor(e){this.g=e.g,this.e=e.e,this.u=e.u,this.n=e.n,this.b=e.b}get v(){return this.g.v}g;b;e;u;n;a(e,n){return this.#e.add(e),this.g.a(e,n)}r(e){if(e){if(this.#e.has(e))this.#e.delete(e),this.g.r(e)}else for(let n of this.g.b.keys())this.r(n)}d(){this.r()}},Ld=class{#e;constructor(e){this.#e=e,this.get=e.u,e.u()}get name(){return this.#e.m}get $version(){return this.get(),this.#e.v}get value(){return this.get()}set value(e){this.set?.(e)}set;get;ref(e){let n=new Ld(new ST(this.#e));return e&&this.set?ev(n,this.set):n}reaction(e,n=this.#e.e){return this.#e.a(e,n?2:1)}subscribe(e,n=this.#e.e){let t=this.reaction(e,n);return qs(e,this.get()),t}$valCompute(e){return this.#e.a(e,3)}unsubscribe(e){this.#e.r(e)}dispose(){this.#e.d()}toString(){return String(this.get())}toJSON(e){let n=this.get();return n&&n.toJSON?n.toJSON(e):n}},IT=(e,n)=>{let t=e,o=new tv(()=>t,n),i=(a)=>{if(!o.q?.(a,t))t=a,o.n()};return[new Ld(o),i]},Md=(e,n)=>ev(...IT(e,n));var nv=(e,n,t)=>new Ld(new tv(e,t,n)),rv=(e,n=Yw,t)=>{let r,o;return nv(()=>{let i=e.map(gT);if(!o||!hT(i,o))o=i,r=n(yT(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(qs)},t)};var zd=(e,n=Yw,t)=>{let r,o=fr;return nv(()=>{let i=e.$version;if(!Fs(i,o))o=i,r=n(e.value);return r},(i)=>e.$valCompute(i),t)};var ov=(e,n={},t="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")n[t+r]=o;else ov(o,n,t+r+".");return n},CT=(e)=>{let n=[],t=[],r=/{{(\S+?)}}/gi,o,i=0;while(o=r.exec(e))n.push(e.slice(i,o.index),""),t.push(o[1]),i=o.index+o[0].length;if(n.push(e.slice(i)),t.length<=0)return!1;return(s)=>{for(let a=t.length-1;a>=0;a--)n[a*2+1]=s[t[a]]??t[a];return n.join("")}},iv=class e{constructor(n,t,r){this.t=(i,s)=>this.t$.get()(i,s),this.fetcher=r?.fetcher;let o=new Map;this.locales$=Md(t),this.lang$=Md(n),this.locale$=rv([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=zd(this.locale$,ov),this.t$=zd(this.a,(i)=>((s,a,c)=>{if(c){let l=c["@"];if(l!=null){let u=`${a}@${l}`;if(s[u])a=u}else{let u=c[":option"];if(u!=null){let d;a=s[d=`${a}.${u}`]||s[d=`${a}.other`]?d:a}}if(s[a]){let u=o.get(a);if(u??o.set(a,u=CT(s[a])),u)return u(c)}}return s[a]||a}).bind(o.clear(),i))}static async preload(n,t){return new e(n,{[n]:await t(n)},{fetcher:t})}get lang(){return this.lang$.value}get locales(){return this.locales$.value}get locale(){return this.locale$.value}async switchLang(n){if(!this.locales$.value[n]&&this.fetcher)this.addLocale(n,await this.fetcher(n));this.lang$.set(n)}hasKey(n){return!!this.a.value[n]}addLocale(n,t){this.locales$.set({...this.locales,[n]:t})}dispose(){this.lang$.dispose(),this.t$.dispose(),this.locales$.dispose(),this.locale$.dispose(),this.a.dispose()}};var sv={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var av={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var cv={help:{usage:"\u4F7F\u3044\u65B9\uFF1A{{command}}",title:"Open Flow \u30B3\u30DE\u30F3\u30C9",options:"\u30AA\u30D7\u30B7\u30E7\u30F3\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var lv={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var uv={help:{usage:"\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435: {{command}}",title:"\u041A\u043E\u043C\u0430\u043D\u0434\u044B Open Flow",options:"\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B: --json, --cursor <cursor>, --limit <count>"}};var dv={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var pv={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var RT={en:sv,"zh-CN":dv,"zh-TW":pv,ja:cv,ko:lv,ru:uv,fr:av},_T=Object.fromEntries(Qs.map((e)=>[e,RT[e]]));function fv(e=Kd){return new iv(Mo([e]),_T)}function $T(e,n){let t=n.filter((i)=>!i.startsWith("-")),r=Rd(t,e.commandPrefix);while(r.length==0&&t.length>0)t.pop(),r=Rd(t,e.commandPrefix);let o=fv(e.language);try{let i=r.length==1?_d(r[0].command):void 0,s=Bw(r.length==1?r[0].command:"",e.commandPrefix),a={kind:"cli.help",version:1,commands:r.length==1?r:r.map(({command:c,usage:l})=>({command:c,usage:l})),...i==null?{}:{request:i.request},examples:s,exitCodes:{0:"Success or accepted asynchronous operation.",1:"Error or unsuccessful terminal Run.",2:"Run is waiting for an explicit action; inspect run.waits.",3:"Waiting timed out or publication is pending; the operation continues."},notes:i==null?[...e.scopeGuidance??["The oo host selects the team for the whole invocation with --team <name>; Flow commands use that authenticated scope."],"--timeout is a wait budget in milliseconds (default 60000).","--follow --json writes NDJSON pages immediately; resume from nextAfter.","Use read/search to locate nodes, schema read|search|edit|check for requests, and schema <type> for configuration and ports.","Use edit with baseRevision, requestId and an ordered edits array. Read selected text before an exact text.edit.","Retry mutations with the same idempotency key, fixed revision/publication and identical arguments."]:[i.guidance,...r[0].command=="check"?[]:["Use either --input (literal JSON, @file, or - for stdin) or --file (path or -), never both."]]};return n.includes("--json")?JSON.stringify(a):[o.t("help.title"),"",...r.map((c)=>r.length!=1?c.usage:`${c.usage}
80
84
  Options: ${c.options.map((l)=>l.name+(l.value?" <value>":"")+(l.description==null?"":`: ${l.description}`)).join(`
81
85
  `)}`),"",o.t("help.options"),"",...a.notes,"",...s].join(`
82
- `)}finally{o.dispose()}}function RE(e){return e.length==0||e.includes("--help")||e.includes("-h")}function AE(e){return e.positionals[0]=="schema"&&e.flow==null}async function qw(e,t,n){let r,o;try{if(RE(e))return n.stdout.write(`${_E(n,e)}
83
- `),0;r=ew(e);let i=dw(r.positionals);if(i==null)throw new E("cli.invalid-arguments",`Unknown command. Use ${n.commandPrefix??"oo flow"} --help.`);for(let a of r.options)if(a!="json"&&!i.includes(a))throw new E("cli.invalid-arguments",`Option --${a} is not supported by this command.`);if(r.options.includes("idempotency-key")){let a=r.positionals[0]=="run"&&r.source=="live";if(i.includes("expected-revision")&&!a&&r.expectedRevision==null)throw new E("cli.invalid-arguments","An explicit idempotency key requires --expected-revision for a repeatable mutation.");if((a||r.positionals[0]=="publish"||r.positionals[0]=="rollback")&&r.expectedPublication==null)throw new E("cli.invalid-arguments","An explicit idempotency key requires --expected-publication (use none for the first publication).")}if(r.timeoutMs!=null&&r.positionals[0]=="run"&&!r.wait)throw new E("cli.invalid-arguments","--timeout requires --wait for run.");if(r.timeoutMs!=null&&r.positionals[0]=="runs"&&r.positionals[1]=="events"&&!r.follow)throw new E("cli.invalid-arguments","--timeout requires --follow for events.");if(r.positionals[0]=="run"&&(r.source=="live"&&r.expectedRevision!=null||r.source=="draft"&&r.expectedPublication!=null))throw new E("cli.invalid-arguments","Use --expected-revision for draft runs and --expected-publication for live runs.");if(AE(r)){if(r.positionals.length>2)throw new E("cli.invalid-arguments",`Usage: ${n.commandPrefix??"oo flow"} schema [read|search|edit|check|edits|node-type|input|outputs]`);let a=pw(r.positionals[1]);if(a==null)throw new E("cli.invalid-arguments","Unknown schema. Use read, search, edit, check, or a node type such as agent or code.");return n.stdout.write(`${JSON.stringify(a)}
84
- `),0}let s=new Su(async(a,c)=>{let l=new Headers(c?.headers).get("idempotency-key");return o=l==null?void 0:{path:a,idempotencyKey:l,...typeof c?.body=="string"?{request:JSON.parse(c.body)}:{}},await t.request(a,c)},"cli");if(r.positionals[0]=="schema"&&r.flow!=null){let a=r.input==null?{type:r.positionals[1]}:await to(r.input,n),c=await ke(s,r.flow);return n.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
85
- `),0}return await kw(s,t,r,n)??0}catch(i){let s;if(i instanceof E)s=i;else if(i instanceof _e)s=Xb(i);else s=new E("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof _e)&&!(i instanceof E)||i instanceof _e&&i.code=="response.invalid"))s=new E("flow.mutation-outcome-unknown","The mutation outcome is unknown. Retry the exact request with the same idempotency key.",o);if(e.includes("--json"))n.stderr.write(`${JSON.stringify({error:{code:s.code,...s.details==null?{}:{details:s.details},message:s.message},version:1})}
86
- `);else n.stderr.write(`${s.code}: ${s.message}
87
- `);return 1}}async function NE(e){let t=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],n=PE(t[0],t.slice(1),{stdio:"ignore"});if(await new Promise((o,i)=>{n.once("error",i),n.once("exit",o)})!=0)throw Error("The system browser could not be opened.")}async function Vw(e,t,n){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:n.version})}
88
- `:`${n.version}
89
- `),0;return await qw(e,{request:t.cloudRequest??(async()=>{throw new E("host.unavailable","Open Flow Control API is not configured in this CLI host.")}),getWorkbenchUrl:t.getWorkbenchUrl},{commandPrefix:n.commandPrefix,scopeGuidance:n.scopeGuidance,env:process.env,language:lo([t.language]),openUrl:NE,readFile:async(r)=>await TE(r,"utf8"),readStdin:async()=>{let r="";for await(let o of process.stdin)r+=String(o);return r},stderr:process.stderr,stdout:process.stdout,wait:async(r)=>await $E(r)})}async function CD(e,t={}){return await Vw(e,t,{version:Ku})}export{CD as runOpenFlowCommand};
86
+ `)}finally{o.dispose()}}function DT(e){return e.length==0||e.includes("--help")||e.includes("-h")}function LT(e){return e.positionals[0]=="schema"&&e.flow==null}async function hv(e,n,t){let r,o;try{if(DT(e))return t.stdout.write(`${$T(t,e)}
87
+ `),0;r=rw(e);let i=qw(r.positionals);if(i==null)throw new P("cli.invalid-arguments",`Unknown command. Use ${t.commandPrefix??"oo flow"} --help.`);for(let a of r.options)if(a!="json"&&!i.includes(a))throw new P("cli.invalid-arguments",`Option --${a} is not supported by this command.`);if(r.options.includes("idempotency-key")){let a=r.positionals[0]=="run"&&r.source=="live";if(i.includes("expected-revision")&&!a&&r.expectedRevision==null)throw new P("cli.invalid-arguments","An explicit idempotency key requires --expected-revision for a repeatable mutation.");if((a||r.positionals[0]=="publish"||r.positionals[0]=="rollback")&&r.expectedPublication==null)throw new P("cli.invalid-arguments","An explicit idempotency key requires --expected-publication (use none for the first publication).")}if(r.timeoutMs!=null&&r.positionals[0]=="run"&&!r.wait)throw new P("cli.invalid-arguments","--timeout requires --wait for run.");if(r.timeoutMs!=null&&r.positionals[0]=="runs"&&r.positionals[1]=="events"&&!r.follow)throw new P("cli.invalid-arguments","--timeout requires --follow for events.");if(r.positionals[0]=="run"&&(r.source=="live"&&r.expectedRevision!=null||r.source=="draft"&&r.expectedPublication!=null))throw new P("cli.invalid-arguments","Use --expected-revision for draft runs and --expected-publication for live runs.");if(LT(r)){if(r.positionals.length>2)throw new P("cli.invalid-arguments",`Usage: ${t.commandPrefix??"oo flow"} schema [read|search|edit|check|edits|node-type|input|outputs]`);let a=Vw(r.positionals[1]);if(a==null)throw new P("cli.invalid-arguments","Unknown schema. Use read, search, edit, check, or a node type such as agent or code.");return t.stdout.write(`${JSON.stringify(a)}
88
+ `),0}let s=new ad(async(a,c)=>{let l=new Headers(c?.headers).get("idempotency-key");return o=l==null?void 0:{path:a,idempotencyKey:l,...typeof c?.body=="string"?{request:JSON.parse(c.body)}:{}},await n.request(a,c)},"cli");if(r.positionals[0]=="schema"&&r.flow!=null){let a=r.input==null?{type:r.positionals[1]}:await Eo(r.input,t),c=await Te(s,r.flow);return t.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
89
+ `),0}return await Qw(s,n,r,t)??0}catch(i){let s;if(i instanceof P)s=i;else if(i instanceof Re)s=nw(i);else s=new P("flow.unexpected",i instanceof Error?i.message:String(i));if(o!=null&&(!(i instanceof Re)&&!(i instanceof P)||i instanceof Re&&i.code=="response.invalid"))s=new P("flow.mutation-outcome-unknown","The mutation outcome is unknown. Retry the exact request with the same idempotency key.",o);if(e.includes("--json"))t.stderr.write(`${JSON.stringify({error:{code:s.code,...s.details==null?{}:{details:s.details},message:s.message},version:1})}
90
+ `);else t.stderr.write(`${s.code}: ${s.message}
91
+ `);return 1}}async function qT(e){let n=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],t=MT(n[0],n.slice(1),{stdio:"ignore"});if(await new Promise((o,i)=>{t.once("error",i),t.once("exit",o)})!=0)throw Error("The system browser could not be opened.")}async function mv(e,n,t){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:t.version})}
92
+ `:`${t.version}
93
+ `),0;return await hv(e,{request:n.cloudRequest??(async()=>{throw new P("host.unavailable","Open Flow Control API is not configured in this CLI host.")}),getWorkbenchUrl:n.getWorkbenchUrl},{commandPrefix:t.commandPrefix,scopeGuidance:t.scopeGuidance,env:process.env,language:Mo([n.language]),openUrl:qT,readFile:async(r)=>await zT(r,"utf8"),readStdin:async()=>{let r="";for await(let o of process.stdin)r+=String(o);return r},stderr:process.stderr,stdout:process.stdout,wait:async(r)=>await FT(r)})}async function kq(e,n={}){return await mv(e,n,{version:Zd})}export{kq as runOpenFlowCommand};