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

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 (30) hide show
  1. package/dist/browser/{FlowCanvas-CHIaMaBv.js → FlowCanvas-SqPUBqze.js} +3 -3
  2. package/dist/browser/{createResourceDialog-C0E5yPe6.js → createResourceDialog-CB3eiK7e.js} +3 -3
  3. package/dist/browser/{dialog-b3hsdu8i.js → dialog-Bi-MVTGj.js} +1 -1
  4. package/dist/browser/{exportPng-DGHcejgy.js → exportPng-CLZKdNzR.js} +2 -2
  5. package/dist/browser/{flowChanges-BvSWezEb.js → flowChanges-CnOOPJJR.js} +15 -12
  6. package/dist/browser/{flowWorkspace-BKnMRClO.js → flowWorkspace-B79fy3Me.js} +8 -8
  7. package/dist/browser/{markdownContent-BR9-1ikU.js → markdownContent-D0BBrFcF.js} +1 -1
  8. package/dist/browser/preview.css +12 -10
  9. package/dist/browser/preview.js +3 -1
  10. package/dist/browser/theme.css +3 -1
  11. package/dist/browser/{tooltip-DSBF3bRw.js → tooltip-BZ6tpqnr.js} +3 -1
  12. package/dist/browser/ui.css +12 -10
  13. package/dist/browser/ui.d.ts +1 -0
  14. package/dist/browser/ui.js +110 -63
  15. package/dist/browser/workbench.css +12 -10
  16. package/dist/browser/workbench.js +7 -7
  17. package/dist/browser/{workbenchSelect-Di1Bm_-d.js → workbenchSelect-CHOeceKA.js} +2 -2
  18. package/dist/browser/{wrapLayout-B0AT8_-i.js → wrapLayout-BB_qwy3k.js} +1 -1
  19. package/dist/command/index.js +32 -32
  20. package/dist/common/control-api-conformance.js +12 -9
  21. package/dist/common/control-api.js +12 -9
  22. package/dist/common/control-requests.js +8 -2
  23. package/dist/common/flow-semantics.js +7 -1
  24. package/dist/common/mcp.js +12 -9
  25. package/dist/render/browser/runtime.css +12 -10
  26. package/dist/render/browser/runtime.js +3 -1
  27. package/package.json +1 -1
  28. package/src/control/common/api.ts +13 -9
  29. package/src/control/common/authoring.ts +2 -1
  30. package/src/flow/common/graph.ts +10 -1
@@ -1,15 +1,15 @@
1
1
  // @bun
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?`
2
+ var bv=Object.defineProperty;var xv=(e)=>e;function wv(e,n){this[e]=xv.bind(null,n)}var Mo=(e,n)=>{for(var t in n)bv(e,t,{get:n[t],enumerable:!0,configurable:!0,set:wv.bind(n,t)})};var vv=(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 lw{start;end;filename;identifierName;constructor(e,n){this.start=e,this.end=n}}function nA(e,n){let{line:t,column:r,index:o}=e;return new ur(t,r+n,o+n)}function ew(e,n,t){Object.defineProperty(e,n,{enumerable:!1,configurable:!0,value:t})}function lA({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 ew(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})}),ew(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]=lA({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 hd{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 uw.set(e,t),t}function We(e,n){return B(e,{beforeExpr:ie,binop:n})}function B(e,n={}){return++To,yd.push(e),gd.push(n.binop??-1),bd.push(n.beforeExpr??!1),xd.push(n.startsExpr??!1),dw.push(n.prefix??!1),md.push(new hd(e,n)),To}function ne(e,n={}){return++To,uw.set(e,To),yd.push(e),gd.push(n.binop??-1),bd.push(n.beforeExpr??!1),xd.push(n.startsExpr??!1),dw.push(n.prefix??!1),md.push(new hd("name",n)),To}function _e(e){return e>=89&&e<=129}function Sn(e){return e>=54&&e<=129}function fA(e){return e>=54&&e<=132}function hA(e){return bd[e]}function mA(e){return xd[e]}function tw(e){return e>=125&&e<=127}function pw(e){return e>=54&&e<=88}function yA(e){return e>=117&&e<=119}function gA(e){return e>=120&&e<=126}function wd(e){return yd[e]}function bA(e){return gd[e]}function xA(e){return e>=20&&e<=21}function wA(e){return md[e]}class Ao{constructor(e,n){this.token=e,this.preserveSpace=!!n}token;preserveSpace}function pd(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 vd(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&&nw.test(String.fromCharCode(e));return!isNaN(e)&&e<=1114111&&(nw.test(String.fromCodePoint(e))||pd(e,fw))}function hw(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&&rw.test(String.fromCharCode(e));return!isNaN(e)&&e<=1114111&&(rw.test(String.fromCodePoint(e))||pd(e,fw)||pd(e,vA))}function kA(e,n,t){return e===64&&n===64&&vd(t)}class $s{flags=0;names=new Map;firstLexicalName="";constructor(e){this.flags=e}}class Sd{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 $s(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 CA(e){return e.type==="DeclareExportAllDeclaration"||e.type==="DeclareExportDeclaration"&&(!e.declaration||e.declaration.type!=="TypeAlias"&&e.declaration.type!=="InterfaceDeclaration")}function ow(e){return e.importKind==="type"||e.importKind==="typeof"}function EA(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 iw(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 xw{constructor(e,n,t,r){if(this.start=t,this.end=0,r!==void 0)this.loc=new lw(r);if(e&128)this.range=[t,0];if(r!==void 0&&n)this.loc.filename=n}type=""}function _A(e){if(e==null)throw Error(`Unexpected ${e} value.`);return e}function sw(e){if(!e)throw Error("Assert fail")}function DA(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 aw(e){return e==="private"||e==="public"||e==="protected"}function LA(e){return e==="in"||e==="out"}function fd(e){if(e.extra?.parenthesized)return!1;switch(e.type){case"Identifier":return!0;case"MemberExpression":return!e.computed&&fd(e.object);case"TSInstantiationExpression":return fd(e.expression);default:return!1}}function zA(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 vw(e.object)}function FA(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(ww(e,n)||qA(e,n))return!0;if(t==="TemplateLiteral"&&e.expressions.length===0)return!0;if(zA(e))return!0;return!1}function ww(e,n){if(n)return e.type==="Literal"&&(typeof e.value==="number"||("bigint"in e));return e.type==="NumericLiteral"||e.type==="BigIntLiteral"}function qA(e,n){if(e.type==="UnaryExpression"){let{operator:t,argument:r}=e;if(t==="-"&&ww(r,n))return!0}return!1}function vw(e){if(e.type==="Identifier")return!0;if(e.type!=="MemberExpression"||e.computed)return!1;return vw(e.object)}function ZA(e){let n={};for(let t of Object.keys(e))n[t]=wA(e[t]);return n}var Xx="BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED",rA,Yx,_s=(e)=>e.type==="UpdateExpression"?Yx.UpdateExpression[`${e.prefix}`]:Yx[e.type],oA,iA,sA,aA,cA,He,uA=(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,ud=!0,Eo=!0,rn=!0,dA=!0,uw,To=-1,md,yd,gd,bd,xd,dw,pA,Ce,nw,rw,fw,vA,kd,eM,tM,nM,mw,yw,SA,IA,V,PA,AA,TA=(e)=>class extends e{flowPragma=void 0;getScopeHandler(){return yw}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=AA.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(CA(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:PA[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(!SA.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(fA(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(pw(this.state.type)){let c=wd(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||tw(t))return!this.state.containsEsc;return super.shouldParseExportDeclaration()}isExportDefaultSpecifier(){let{type:t}=this.state;if(t===122||tw(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 EA(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(kA(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=ow(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=ow(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}},OA,NA,rM,jA,Lt,RA=(e)=>class extends e{jsxReadToken(){let t="",r=this.state.pos;for(;;){if(this.state.pos>=this.length)throw this.raise(Lt.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(Lt.UnexpectedToken,this.state.curPosition(),{unexpected:this.input[this.state.pos],HTMLEntity:o===125?"&rbrace;":"&gt;"});default:if(iw(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
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\`.
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(iw(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=OA[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(hw(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(pw(this.state.type))t.name=wd(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(Lt.AttributeIsEmpty,t);return t;case 138:case 130:return this.parseExprAtom();default:throw this.raise(Lt.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(Lt.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(Lt.MissingClosingTagFragment,s);else if(!on(i)&&on(s))this.raise(Lt.MissingClosingTagElement,s,{openingTagName:lr(i.name)});else if(!on(i)&&!on(s)){if(lr(s.name)!==lr(i.name))this.raise(Lt.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(Lt.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(vd(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=hA(o)}},gw,bw,oM,dd,$A,N,MA=(e)=>class extends e{getScopeHandler(){return bw}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(aw(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(LA(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 _A(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":DA(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 yA(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(){sw(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(!fd(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 gA(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(xA(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&&mA(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(bA(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(!FA(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(aw(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?nA(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(sw(!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(vd(t)){if(dd.lastIndex=r,dd.test(this.input)){let o=this.codePointAtPos(dd.lastIndex);if(!hw(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}},VA,cw,BA=(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(cw.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(wd(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(cw.UnexpectedSpace,this.state.lastTokEndLoc)}},UA=(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)}},JA,iM,sM;var kw=vv(()=>{rA={ImportMetaOutsideModule:{message:`import.meta may appear only with 'sourceType: "module"'`,code:Xx},ImportOutsideModule:{message:`'import' and 'export' may appear only with 'sourceType: "module"'`,code:Xx}},Yx={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"},oA={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
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)}
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."},iA={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."},sA={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)}\`.`},aA={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."},cA={UnsupportedBind:"Binding should be performed on object property.",UnsupportedBindRHS:"The right-hand side of binding can not be super or import."};He={...kt(rA),...kt(oA),...kt(iA),...kt(sA),...kt`pipelineOperator`(aA),...kt`functionBind`(cA)};uw=new Map;md=[],yd=[],gd=[],bd=[],xd=[],dw=[];pA={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:Eo}),assign:B("_=",{beforeExpr:ie,isAssign:Eo}),slashAssign:B("_=",{beforeExpr:ie,isAssign:Eo}),xorAssign:B("_=",{beforeExpr:ie,isAssign:Eo}),moduloAssign:B("_=",{beforeExpr:ie,isAssign:Eo}),incDec:B("++/--",{prefix:rn,postfix:dA,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:ud,beforeExpr:ie}),_for:se("for",{isLoop:ud}),_while:se("while",{isLoop:ud}),_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 Ao("{"),j_oTag:new Ao("<tag"),j_cTag:new Ao("</tag"),j_expr:new Ao("<tag>...</tag>",!0)},nw=/[\p{ID_Start}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1]/u,rw=/[\p{ID_Continue}\u088f\u0c5c\u0cdc\ua7ce\ua7cf\ua7d2\ua7d4\ua7f1\u1acf-\u1add\u1ae0-\u1aeb]/u,fw=[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],vA=[3834,1,3173,7,633,9,51450,0,3,0,8,1,6,0];kd={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"]},eM=new Set(kd.keyword),tM=new Set(kd.strict),nM=new Set(kd.strictBind);mw=class mw extends $s{declareFunctions=new Set};yw=class yw extends Sd{createScope(e){return new mw(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)}};SA=new Set(["_","any","bool","boolean","empty","extends","false","interface","mixed","null","number","static","string","true","typeof","void"]),IA={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`(IA);PA={const:"declare export var",let:"declare export var",type:"export type",interface:"export interface"};AA=/\*?\s*@((?:no)?flow)\b/,OA={__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"},NA=/\r\n|[\r\n\u2028\u2029]/,rM=new RegExp(NA.source,"g");jA={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 <>...</>?"},Lt=kt`jsx`(jA);gw=class gw extends $s{tsNames=new Map};bw=class bw extends Sd{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 gw(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)}};oM=xw.prototype,dd=/in(?:stanceof)?|as|satisfies/y;$A={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`($A);VA={ClassNameIsRequired:"A class name is required.",UnexpectedSpace:"Unexpected space in placeholder."},cw=kt`placeholders`(VA),JA={estree:uA,jsx:RA,flow:TA,typescript:MA,v8intrinsic:UA,placeholders:BA},iM=Object.keys(JA);sM=ZA(pA)});var Vt={};Mo(Vt,{anyString:()=>za,base64:()=>Oa,base64url:()=>Na,bigint:()=>qa,boolean:()=>Va,browserEmail:()=>tk,cidrv4:()=>Aa,cidrv6:()=>Ta,creditCard:()=>ti,cuid:()=>ha,cuid2:()=>ma,currencyCode:()=>$a,date:()=>Da,datetime:()=>Ma,domain:()=>Ra,duration:()=>va,e164:()=>_a,email:()=>Sa,emoji:()=>Ia,extendedDuration:()=>Wv,guid:()=>ka,hex:()=>Ka,hostname:()=>ja,html5Email:()=>Xv,httpProtocol:()=>Pr,iban:()=>ni,idnEmail:()=>ek,integer:()=>Er,ipv4:()=>Ca,ipv6:()=>Pa,ksuid:()=>ba,lowercase:()=>Ja,mac:()=>Ea,md5_base64:()=>ik,md5_base64url:()=>sk,md5_hex:()=>ok,nanoid:()=>xa,nanoidOfLength:()=>wa,null:()=>Ba,number:()=>fn,rfc5322Email:()=>Yv,sha1_base64:()=>ck,sha1_base64url:()=>lk,sha1_hex:()=>ak,sha256_base64:()=>dk,sha256_base64url:()=>pk,sha256_hex:()=>uk,sha384_base64:()=>hk,sha384_base64url:()=>mk,sha384_hex:()=>fk,sha512_base64:()=>gk,sha512_base64url:()=>bk,sha512_hex:()=>yk,string:()=>Fa,time:()=>La,ulid:()=>ya,undefined:()=>Ua,unicodeEmail:()=>jp,uppercase:()=>Za,uuid:()=>pn,uuid4:()=>Hv,uuid6:()=>Gv,uuid7:()=>Qv,xid:()=>ga});var Wl={};Mo(Wl,{ZodAny:()=>ly,ZodArray:()=>hy,ZodBase64:()=>Dl,ZodBase64URL:()=>Ll,ZodBigInt:()=>Vl,ZodBigIntFormat:()=>Bl,ZodBoolean:()=>ql,ZodCIDRv4:()=>_l,ZodCIDRv6:()=>$l,ZodCUID:()=>El,ZodCUID2:()=>Al,ZodCatch:()=>_y,ZodCodec:()=>Ki,ZodCreditCard:()=>ry,ZodCustom:()=>Wi,ZodCustomStringFormat:()=>Fn,ZodDate:()=>fy,ZodDefault:()=>Ay,ZodDiscriminatedUnion:()=>yy,ZodE164:()=>Ml,ZodEmail:()=>Sl,ZodEmoji:()=>Cl,ZodEnum:()=>Ur,ZodExactOptional:()=>Jl,ZodFile:()=>Iy,ZodFunction:()=>By,ZodGUID:()=>Il,ZodIBAN:()=>oy,ZodIPv4:()=>jl,ZodIPv6:()=>Rl,ZodISODate:()=>Ln,ZodISODateTime:()=>Dn,ZodISODuration:()=>zn,ZodISOTime:()=>Mn,ZodInstanceOf:()=>Zy,ZodIntersection:()=>gy,ZodJWT:()=>zl,ZodKSUID:()=>Nl,ZodLazy:()=>qy,ZodLiteral:()=>Sy,ZodMAC:()=>ny,ZodMap:()=>vy,ZodNaN:()=>Dy,ZodNanoID:()=>Pl,ZodNever:()=>dy,ZodNonOptional:()=>Zl,ZodNull:()=>ay,ZodNullable:()=>Ey,ZodNumber:()=>Fl,ZodNumberFormat:()=>qn,ZodObject:()=>Bi,ZodOptional:()=>Ji,ZodPipe:()=>Zi,ZodPrefault:()=>Oy,ZodPreprocess:()=>Ly,ZodPromise:()=>Vy,ZodReadonly:()=>My,ZodRecord:()=>Br,ZodSet:()=>ky,ZodString:()=>kl,ZodStringFormat:()=>be,ZodSuccess:()=>Ry,ZodSymbol:()=>iy,ZodTemplateLiteral:()=>Fy,ZodTransform:()=>Cy,ZodTuple:()=>xy,ZodType:()=>Q,ZodULID:()=>Tl,ZodURL:()=>Vi,ZodUUID:()=>_t,ZodUndefined:()=>sy,ZodUnion:()=>Ui,ZodUnknown:()=>uy,ZodVoid:()=>py,ZodXID:()=>Ol,ZodXor:()=>my,_ZodString:()=>vl,_default:()=>Ty,_function:()=>dI,any:()=>ZS,array:()=>A,base64:()=>PS,base64url:()=>ES,bigint:()=>qS,boolean:()=>me,catch:()=>$y,check:()=>pI,cidrv4:()=>IS,cidrv6:()=>CS,codec:()=>aI,creditCard:()=>TS,cuid:()=>yS,cuid2:()=>gS,currencyCode:()=>$S,custom:()=>fI,date:()=>WS,describe:()=>hI,discriminatedUnion:()=>gt,e164:()=>AS,email:()=>sS,emoji:()=>hS,enum:()=>U,exactOptional:()=>Py,file:()=>rI,float32:()=>LS,float64:()=>MS,function:()=>dI,guid:()=>aS,hash:()=>DS,hex:()=>_S,hostname:()=>RS,httpUrl:()=>fS,iban:()=>OS,instanceof:()=>yI,int:()=>Ne,int32:()=>zS,int64:()=>VS,intersection:()=>by,invertCodec:()=>cI,ipv4:()=>vS,ipv6:()=>SS,json:()=>De,jwt:()=>NS,keyof:()=>HS,ksuid:()=>wS,lazy:()=>Kl,literal:()=>b,looseObject:()=>GS,looseRecord:()=>YS,mac:()=>kS,map:()=>eI,meta:()=>mI,nan:()=>sI,nanoid:()=>mS,nativeEnum:()=>nI,never:()=>yt,nonoptional:()=>jy,null:()=>cy,nullable:()=>qi,nullish:()=>oI,number:()=>M,object:()=>E,optional:()=>Fi,partialRecord:()=>XS,pipe:()=>wl,prefault:()=>Ny,preprocess:()=>Ky,promise:()=>uI,readonly:()=>zy,record:()=>re,refine:()=>Uy,set:()=>tI,strictObject:()=>w,string:()=>k,stringFormat:()=>jS,stringbool:()=>gI,success:()=>iI,superRefine:()=>Jy,symbol:()=>US,templateLiteral:()=>lI,transform:()=>Ul,tuple:()=>wy,uint32:()=>FS,uint64:()=>BS,ulid:()=>bS,undefined:()=>JS,union:()=>te,unknown:()=>mt,url:()=>pS,uuid:()=>cS,uuidv4:()=>lS,uuidv6:()=>uS,uuidv7:()=>dS,void:()=>KS,xid:()=>xS,xor:()=>QS});var Mi={};Mo(Mi,{endsWith:()=>Ai,gt:()=>Ut,gte:()=>ht,includes:()=>Pi,length:()=>$r,lowercase:()=>Ii,lt:()=>Bt,lte:()=>ft,maxLength:()=>_r,maxSize:()=>Nn,mime:()=>Oi,minLength:()=>hn,minSize:()=>Jt,multipleOf:()=>On,negative:()=>fm,nonnegative:()=>mm,nonpositive:()=>hm,normalize:()=>Ni,overwrite:()=>Rt,positive:()=>pm,properties:()=>Ti,property:()=>ym,regex:()=>Si,size:()=>Rr,slugify:()=>$i,startsWith:()=>Ei,toLowerCase:()=>Ri,toUpperCase:()=>_i,trim:()=>ji,uppercase:()=>Ci});var Jr={};Mo(Jr,{ZodISODate:()=>Ln,ZodISODateTime:()=>Dn,ZodISODuration:()=>zn,ZodISOTime:()=>Mn,date:()=>xI,datetime:()=>bI,duration:()=>vI,time:()=>wI});var Kd="0.1.0-beta.88";var Qs=["en","zh-CN","zh-TW","ja","ko","ru","fr"],Wd="en";var Gs=new Map(Qs.map((e)=>[e.toLowerCase(),e])),Sv=new Set(["hk","mo","tw"]);function Hd(e){return typeof e=="string"&&Gs.get(e.toLowerCase())==e}function zo(e,n="en"){for(let t of e){let r=t==null?void 0:Iv(t);if(r!=null)return r}return n}function Iv(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)=>Sv.has(o))?"zh-TW":"zh-CN"}return Gs.get(r[0])}function Gd(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 FT}from"child_process";import{readFile as qT}from"fs/promises";import{setTimeout as VT}from"timers/promises";var ln="open-flow-engine/v11";var cn=(e)=>`export const engineContract = ${JSON.stringify(e)}
7
7
  export function identity(value) { return value }
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(`
8
+ `,Fo={workflowTools:!0,httpRequests:!0,waitAutoContinue:!0,webhookResponses:!0,platformExports:new Set(["engineContract","identity"]),platformModule:"open-flow:platform",platformSource:cn("open-flow-engine/v8")},qo={...Fo,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")},Qd={...qo,codeFetch:!0,platformSource:cn("open-flow-engine/v9")},Xd={...Qd,flowState:!0,platformSource:cn("open-flow-engine/v10")},Cv={...Xd,connectorProxy:!0,platformSource:cn("open-flow-engine/v11")};function Vo(e){if(e=="open-flow-engine/v11")return Cv;if(e=="open-flow-engine/v10")return Xd;if(e=="open-flow-engine/v9")return Qd;if(e=="open-flow-engine/v8")return Fo;if(e=="open-flow-engine/v8/nodejs-compat-v1")return qo;if(e=="open-flow-engine/v7"||e=="open-flow-engine/v7/nodejs-compat-v1")return{...e.endsWith("/nodejs-compat-v1")?qo:Fo,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"?Fo:qo,workflowTools:!1,httpRequests:!1,waitAutoContinue:!1,webhookResponses:!1,platformSource:cn(e)};return}function xr(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 wr(e,n){if(typeof n==="bigint")return n.toString();return n}class ep{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 vr(e){return new ep(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 tp(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 Yd=Symbol("evaluating");function np(e,n,t){let r=void 0;Object.defineProperty(e,n,{get(){if(r===Yd)return;if(r===void 0)r=Yd,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 kr(e){let n=Object.getOwnPropertyDescriptor(e,"shape");return n?.get?n.get.raw:n?.value}function Ot(e){return kr(e._zod.def)??e._zod.def.shape}function rp(e,n,t){Object.defineProperty(e,n,{get(){let r=t();return qe(this,n,r),r},enumerable:!0,configurable:!0})}function op(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)rp(e,i,()=>{let a=n._zod.def.shape[i];return r?r(a,i):a});else op(e,i,r?r(s.value,i):s.value)}}function Pv(e,n){for(let t of Reflect.ownKeys(n)){let r=Object.getOwnPropertyDescriptor(n,t);if(!r.enumerable)continue;if(r.get)rp(e,t,()=>n[t]);else op(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 ip(e){return JSON.stringify(e)}function sp(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 ap=vr(()=>{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 Bo=new Set(["string","number","symbol"]),cp=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 lp(e){return Object.keys(e).filter((n)=>e[n]._zod.optin!==void 0&&e[n]._zod.optout==="optional")}var Uo=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Jo={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Ev(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,Zo(e,n)),St(e,nt(t,{shape:i,checks:[]}))}function Zo(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 Av(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(Zo(e,n)),s={};return un(s,e,Reflect.ownKeys(Ot(e)).filter((a)=>!i.has(a))),St(e,nt(t,{shape:s,checks:[]}))}function Tv(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:up(e,n)}))}function up(e,n){let t={};return un(t,e,Reflect.ownKeys(Ot(e))),Pv(t,n),t}function Ov(e,n){if(!jt(n))throw Error("Invalid input to safeExtend: expected a plain object");return St(e,nt(e._zod.def,{shape:up(e,n)}))}function Nv(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 dp(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(Zo(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 jv(e,n,t){let r=t?new Set(Zo(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 pp(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 br(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 Ko(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:br(e.inst?._zod.def?.error?.(e))??br(i?.(e))??br(n?.error?.(e))??br(t.customError?.(e))??br(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 Wo(e){if(e instanceof Set)return"set";if(e instanceof Map)return"map";if(e instanceof File)return"file";return"unknown"}var Rv=/[\uD800-\uDBFF]/;function Ho(e){let n=e.length;if(!Rv.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 Go(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function fp(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 hp(e,n){for(let t in n){let r=Object.getOwnPropertyDescriptor(n,t);if(r.get)Object.defineProperty(e,t,{...r,enumerable:!1});else _v(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 Sr(e,n,t){return Nt(e,n,t,!1)}function Qo(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 _v(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,Dv={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,Dv);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 Lv(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 Mv="~constantCatch";function mp(e){let n=()=>e;return n[Mv]=!0,n}var yp;var ia={value:void 0,enumerable:!1},gp="captureStackTrace"in Error?Error:null;function zv(e){let n=gp;if(n){let t=n.stackTraceLimit;if(typeof t==="number"){try{n.stackTraceLimit=0}catch{return gp=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),hp(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?zv(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"}}(yp=globalThis).__zod_globalConfig??(yp.__zod_globalConfig={});var Fe=globalThis.__zod_globalConfig;function Ve(e){if(e)Object.assign(Fe,e);return Fe}function Fv(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,wr,2)),e.message}function qv(e){this._zod.message=e}var Vv={get:Fv,set:qv,enumerable:!0,configurable:!0},aa={value:void 0,enumerable:!1},bp=new WeakSet([Object.prototype,Error.prototype]),xp=(e,n)=>{e.name="$ZodError",aa.value=n,Object.defineProperty(e,"issues",aa),aa.value=void 0,Object.defineProperty(e,"message",Vv);let t=Object.getPrototypeOf(e);if(!bp.has(t))bp.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})}})},wp=g("$ZodError",xp),ca=g("$ZodError",xp,void 0,{Parent:Error});function Bv(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 vp(e,n=(t)=>t.message){let t={},r=[];for(let o of e.issues)if(o.path.length>0)Bv(t,o.path[0],()=>[]).push(n(o));else r.push(n(o));return{formErrors:r,fieldErrors:t}}function kp(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 Xo(e,n){return{callee:n?.callee??e,Err:n?.Err}}var Ir=(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=Ir(ca),Cr=(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=Cr(ca),Yo=(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?Sp(e,i.issues,o):{success:!0,data:i.value}};function Sp(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 ei=(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?Sp(e,i.issues,o):{success:!0,data:i.value}};var Jv=Symbol.for("zod.compile.invalid"),Zv=Symbol.for("zod.compile.fallback"),da=(e,n,t)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(n)!==Jv)return!0;if(r.definite===!0&&t===void 0)return!1}return Kv(e,n,t)};function Kv(e,n,t){let r=t?{...t,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)r[Zv]=!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},Ip=(e)=>{let n=Ir(e),t=(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return n(r,o,a,Xo(t,s))};return t};var Cp=(e)=>{let n=Ir(e),t=(r,o,i,s)=>n(r,o,i,Xo(t,s));return t};var Pp=(e)=>{let n=Cr(e),t=async(r,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await n(r,o,a,Xo(t,s))};return t};var Ep=(e)=>{let n=Cr(e),t=async(r,o,i,s)=>await n(r,o,i,Xo(t,s));return t};var Ap=(e)=>(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Yo(e)(n,t,o)};var Tp=(e)=>(n,t,r)=>Yo(e)(n,t,r);var Op=(e)=>async(n,t,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return ei(e)(n,t,o)};var Np=(e)=>async(n,t,r)=>ei(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)?)?)$/,Wv=/^[-+]?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})$`)},Hv=pn(4),Gv=pn(6),Qv=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,}$/,Xv=/^[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])?)*$/,Yv=/^(([^<>()\[\]\\.,;:\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,}))$/,jp=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,ek=jp,tk=/^[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])?)*$/,nk="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$";function Ia(){return new RegExp(nk,"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}$/,Pr=/^https?$/,_a=/^\+[1-9]\d{6,14}$/,ti=/^\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)$/,ni=/^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/,Rp="(?:(?:\\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 rk(e){return new RegExp(`^${e}$`)}var Da=rk(Rp);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(`^${Rp}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?$/,Er=/^-?\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 Ar(e,n){return new RegExp(`^[A-Za-z0-9+/]{${e}}${n}$`)}function Tr(e){return new RegExp(`^[A-Za-z0-9_-]{${e}}$`)}var ok=/^[0-9a-fA-F]{32}$/,ik=Ar(22,"=="),sk=Tr(22),ak=/^[0-9a-fA-F]{40}$/,ck=Ar(27,"="),lk=Tr(27),uk=/^[0-9a-fA-F]{64}$/,dk=Ar(43,"="),pk=Tr(43),fk=/^[0-9a-fA-F]{96}$/,hk=Ar(64,""),mk=Tr(64),yk=/^[0-9a-fA-F]{128}$/,gk=Ar(86,"=="),bk=Tr(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},ri={number:"number",bigint:"bigint",object:"date"},Ga=g("$ZodCheckLessThan",(e,n)=>{we.init(e,n);let t=ri[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value<=n.value:r.value<n.value)return;r.issues.push({origin:ri[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=ri[typeof n.value];e._zod.check=(r)=>{if(n.inclusive?r.value>=n.value:r.value>n.value)return;r.issues.push({origin:ri[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})}}),_p=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):tp(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]=Uo[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})}}),Dp=g("$ZodCheckBigIntFormat",(e,n)=>{we.init(e,n);let[t,r]=Jo[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})}}),Lp=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:Wo(o),code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Mp=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:Wo(o),code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),zp=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:Wo(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})}}),Fp=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?Ho(o):i)<=n.maximum)return;let a=Go(o);r.issues.push({origin:a,code:"too_big",maximum:n.maximum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),qp=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?Ho(o):i)>=n.minimum)return;let a=Go(o);r.issues.push({origin:a,code:"too_small",minimum:n.minimum,inclusive:!0,input:o,inst:e,continue:!n.abort})}}),Vp=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?Ho(o):i;if(s===n.length)return;let a=Go(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})}}),Or=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=()=>{})}),Bp=g("$ZodCheckRegex",(e,n)=>{Or.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})}}),Up=g("$ZodCheckLowerCase",(e,n)=>{n.pattern??(n.pattern=Ja),Or.init(e,n)}),Jp=g("$ZodCheckUpperCase",(e,n)=>{n.pattern??(n.pattern=Za),Or.init(e,n)}),Zp=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})}}),Kp=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})}}),Wp=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 oi(e,n,t){if(e.issues.length)n.issues.push(...rt(t,e.issues))}var Hp=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)=>oi(o,t,n.property));oi(r,t,n.property);return}}),Gp=g("$ZodCheckProperties",(e,n)=>{we.init(e,n),Sr(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)=>oi(l,r,s)));else oi(c,r,s)}if(i)return Promise.all(i).then(()=>{return});return}}),Qp=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})}}),Xp=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
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
10
  ${n.join(`
11
11
  `)}
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)=>`
12
+ };`)(...Object.values(this.closed))}}var ef={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=ef;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(pp(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(Ko(a.issues,m,e),!u)u=Qe(a,m)});else{if(a.issues.length===m)continue;if(Ko(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 Sr(this,"~standard",tc(this))},set "~standard"(e){Nt(this,"~standard",e)}}),bf=(e,n)=>e.issues.length?{issues:e.issues.map((t)=>ot(t,n,Ve()))}:{value:e.value};async function xk(e,n){let t={async:!0};return bf(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 bf(r,t)}catch(r){}return xk(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)=>{Or.init(e,n),Tn.init(e,n)}),xf=g("$ZodGUID",(e,n)=>{n.pattern??(n.pattern=ka),he.init(e,n)}),wf=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)}),vf=g("$ZodEmail",(e,n)=>{n.pattern??(n.pattern=Sa),he.init(e,n)}),kf=1,ci=2;function Sf(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function wk(e,n){if(!("normalize"in n)&&!("hostname"in n)&&!("protocol"in n))return Sf(e)||ci;return vk(e,n)}function vk(e,n){if(!n.normalize&&n.protocol?.source===Pr.source&&!/^https?:\/\//i.test(e))return kf;try{if(typeof URL<"u"){let t=URL;if(typeof t.parse==="function")return t.parse(e)??ci}return new URL(e)}catch{return ci}}var kk=/[\t\n\r]/g;function tf(e){return e.replace(kk,"")}function Sk(e,n){return n.lastIndex=0,n.test(e.hostname)}function Ik(e,n){return n.lastIndex=0,n.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}var If=g("$ZodURL",(e,n)=>{he.init(e,n),e._zod.check=(t)=>{try{let r=t.value.trim(),o=wk(r,n);if(o===kf){t.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:t.value,inst:e,continue:!n.abort});return}if(o===ci){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort});return}if(o===!0){t.value=tf(r);return}if(n.hostname&&!Sk(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&&!Ik(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:tf(r);return}catch(r){t.issues.push({code:"invalid_format",format:"url",input:t.value,inst:e,continue:!n.abort})}}}),Cf=g("$ZodEmoji",(e,n)=>{n.pattern??(n.pattern=Ia()),he.init(e,n)}),Pf=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)}),Ef=g("$ZodCUID",(e,n)=>{n.pattern??(n.pattern=ha),he.init(e,n)}),Af=g("$ZodCUID2",(e,n)=>{n.pattern??(n.pattern=ma),he.init(e,n)}),Tf=g("$ZodULID",(e,n)=>{n.pattern??(n.pattern=ya),he.init(e,n)}),Of=g("$ZodXID",(e,n)=>{n.pattern??(n.pattern=ga),he.init(e,n)}),Nf=g("$ZodKSUID",(e,n)=>{n.pattern??(n.pattern=ba),he.init(e,n)}),jf=g("$ZodISODateTime",(e,n)=>{n.pattern??(n.pattern=Ma(n)),he.init(e,n)}),Rf=g("$ZodISODate",(e,n)=>{n.pattern??(n.pattern=Da),he.init(e,n)}),_f=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)}),Df=g("$ZodIPv4",(e,n)=>{n.pattern??(n.pattern=Ca),he.init(e,n)}),Ck=/^[0-9a-fA-F:.]+$/;function Lf(e){if(!Ck.test(e))return!1;return Sf(`http://[${e}]`)}var Mf=g("$ZodIPv6",(e,n)=>{n.pattern??(n.pattern=Pa),he.init(e,n),e._zod.check=(t)=>{if(!Lf(t.value))t.issues.push({code:"invalid_format",format:"ipv6",input:t.value,inst:e,continue:!n.abort})}}),zf=g("$ZodMAC",(e,n)=>{n.pattern??(n.pattern=Ea(n.delimiter)),he.init(e,n)}),Ff=g("$ZodCIDRv4",(e,n)=>{n.pattern??(n.pattern=Aa),he.init(e,n)});function Pk(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 Lf(t)}var qf=g("$ZodCIDRv6",(e,n)=>{n.pattern??(n.pattern=Ta),he.init(e,n),e._zod.check=(t)=>{if(!Pk(t.value))t.issues.push({code:"invalid_format",format:"cidrv6",input:t.value,inst:e,continue:!n.abort})}});function Vf(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}$/,Bf=g("$ZodBase64",(e,n)=>{n.pattern??(n.pattern=nc),he.init(e,n),e._zod.check=(t)=>{if(Vf(t.value))return;t.issues.push({code:"invalid_format",format:"base64",input:t.value,inst:e,continue:!n.abort})}}),ui=/^[A-Za-z0-9_-]*$/;function Ek(e){if(!ui.test(e))return!1;let n=e.replace(/[-_]/g,(r)=>r==="-"?"+":"/"),t=n.padEnd(Math.ceil(n.length/4)*4,"=");return Vf(t)}var Uf=g("$ZodBase64URL",(e,n)=>{n.pattern??(n.pattern=ui),he.init(e,n),e._zod.check=(t)=>{if(Ek(t.value))return;t.issues.push({code:"invalid_format",format:"base64url",input:t.value,inst:e,continue:!n.abort})}}),Jf=g("$ZodE164",(e,n)=>{n.pattern??(n.pattern=_a),he.init(e,n)}),Ak=/[- ]/g;function Tk(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 Ok(e){if(!ti.test(e))return!1;return Tk(e.replace(Ak,""))}var Zf=g("$ZodCreditCard",(e,n)=>{n.pattern??(n.pattern=ti),he.init(e,n),e._zod.check=(t)=>{if(Ok(t.value))return;t.issues.push({code:"invalid_format",format:"credit_card",input:t.value,inst:e,continue:!n.abort})}});function Nk(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 jk(e){if(!ni.test(e))return!1;return Nk(e)}var Kf=g("$ZodIBAN",(e,n)=>{n.pattern??(n.pattern=ni),he.init(e,n),e._zod.check=(t)=>{if(jk(t.value))return;t.issues.push({code:"invalid_format",format:"iban",input:t.value,inst:e,continue:!n.abort})}});function Rk(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 Wf=g("$ZodJWT",(e,n)=>{he.init(e,n),e._zod.check=(t)=>{if(Rk(t.value,n.alg))return;t.issues.push({code:"invalid_format",format:"jwt",input:t.value,inst:e,continue:!n.abort})}}),Hf=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}}),Gf=g("$ZodNumberFormat",(e,n)=>{$p.init(e,n),rc.init(e,n)}),di=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}}),Qf=g("$ZodBigIntFormat",(e,n)=>{Dp.init(e,n),oc.init(e,n)}),Xf=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}}),Yf=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}}),eh=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}}),th=g("$ZodAny",(e,n)=>{H.init(e,n),e._zod.parse=(t)=>t}),nh=g("$ZodUnknown",(e,n)=>{H.init(e,n),e._zod.parse=(t)=>t}),rh=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)}),oh=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}}),ih=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,Ko(i.issues,u,e),i}}return o(i,s)}}var _k=(e)=>Array.isArray(e)?e.length:-1,$k=(e)=>e instanceof Map?e.size:-1,Dk=(e)=>e instanceof Set?e.size:-1;function nf(e,n,t){if(e.issues.length)n.issues.push(...rt(t,e.issues));n.value[t]=e.value}var sh=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)=>nf(d,r,c)));else if(nf(u,r,c),a&&u.issues.length!==0&&Qe(u))break}if(s.length)return Promise.all(s).then(()=>r);return r},ic(e,_k)});function li(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 Lk=[];function ah(e){let n=Object.keys(e.shape),t=Object.getOwnPropertySymbols(e.shape),r=t.length?t:Lk,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=lp(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(n),numKeys:n.length,optionalKeys:new Set(i)}}function ch(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)=>li(j,t,y,n,d,p)));else li(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 Mk=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=vr(()=>ah(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)=>li(Se,l,j,d,F,z)));else li(ge,l,j,d,F,z)}if(!s)return p.length?Promise.all(p).then(()=>l):l;return ch(p,d,l,u,o.value,e,y===!0)}}),lh=g("$ZodObjectJIT",(e,n)=>{Mk.init(e,n);let t=e._zod.parse,r=vr(()=>ah(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
13
  let ${Se}_ab = false;
14
14
  for (let i = 0; i < ${Se}.issues.length; i++) {
15
15
  const iss = ${Se}.issues[i];
@@ -20,13 +20,13 @@ ${n.join(`
20
20
  if (${Se}_ab && ctx && ctx.abortEarly) {
21
21
  payload.value = newResult;
22
22
  return payload;
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(`
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)}]`:ip(Se),sn=`${Ge} in input`,In=m[Se],an=In?._zod?.optin,Cn=an!==void 0,mr=In?._zod?.optout==="optional";if(j.write(`const ${fe} = ${L(Ge)};`),Cn&&mr){let Do=an==="optional"?`${fe}_present`:`${fe}.value !== undefined || ${fe}_present`;j.write(`
24
24
  const ${fe}_present = ${sn};
25
25
  if (!${fe}.issues.length || ${fe}_present) {
26
26
  if (${fe}.issues.length) {${F(fe,Ge)}
27
27
  }
28
28
 
29
- if (${$o}) {
29
+ if (${Do}) {
30
30
  newResult[${Ge}] = ${fe}.value;
31
31
  }
32
32
  }
@@ -59,35 +59,35 @@ ${n.join(`
59
59
  if (${fe}.value !== undefined || ${sn}) {
60
60
  newResult[${Ge}] = ${fe}.value;
61
61
  }
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>
62
+ `)}return j.write("payload.value = newResult;"),j.write("return payload;"),j.compile()},s,a=En,c=!Fe.jitless,u=c&&ap.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 ch([],I,m,y,p,e,y?.abortEarly===!0)}return t(m,y)}});function rf(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 pi=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 rf(s,r,e,o);return Promise.all(s).then((a)=>rf(a,r,e,o))}});function of(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 uh=g("$ZodXor",(e,n)=>{pi.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 of(s,r,e,o);return Promise.all(s).then((a)=>of(a,r,e,o))}});function zk(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 dh=g("$ZodDiscriminatedUnion",(e,n)=>{n.inclusive=!1,pi.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=kr(o._zod.def);if(s&&!Object.prototype.hasOwnProperty.call(s,n.discriminator))throw Error(`Invalid discriminated union option at index "${i}"`)});let r=vr(()=>zk(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}}),ph=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])=>sf(t,c,l));return sf(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 sf(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=af(t,"optin"),l=af(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)=>cf(F,o,m)));else cf(L,o,m)}}if(a.length)return Promise.all(a).then(()=>lf(u,o,t,s,l));return lf(u,o,t,s,l)}});function af(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 cf(e,n,t){if(e.issues.length)n.issues.push(...rt(t,e.issues));n.value[t]=e.value}function lf(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 fh=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}}),hh=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])=>{uf(m,y,r,l,i,e,o)}));else uf(d,p,r,l,i,e,o)}if(s.length)return Promise.all(s).then(()=>r);return r},ic(e,$k)});function uf(e,n,t,r,o,i,s){if(e.issues.length)if(Bo.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(Bo.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 mh=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)=>df(d,r)));else df(u,r)}if(s.length)return Promise.all(s).then(()=>r);return r},ic(e,Dk)});function df(e,n){if(e.issues.length)n.issues.push(...e.issues);n.value.add(e.value)}var yh=g("$ZodEnum",(e,n)=>{H.init(e,n);let t=xr(n.entries),r=new Set(t);e._zod.values=r,Y(e,"pattern",(o)=>{let i=xr(o.def.entries).filter((s)=>Bo.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}}),gh=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}}),bh=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}}),xh=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 pf(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)=>pf(t,i));return pf(t,o)}return n.innerType._zod.run(t,r)}}),wh=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)}),vh=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)}}),kh=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)=>ff(i,n));return ff(o,n)}});function ff(e,n){if(e.value===void 0)e.value=n.defaultValue;return e}var Sh=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)}}),Ih=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)=>hf(i,e));return hf(o,e)}});function hf(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 Ch=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 mf(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 Ph=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)=>mf(t,i,n,r));return mf(t,o,n,r)}}),Eh=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)=>ii(s,n.in,r));return ii(i,n.in,r)}let o=n.in._zod.run(t,r);if(o instanceof Promise)return o.then((i)=>ii(i,n.out,r));return ii(o,n.out,r)}});function ii(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 fi=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)=>si(s,n,r));return si(i,n,r)}else{let i=n.out._zod.run(t,r);if(i instanceof Promise)return i.then((s)=>si(s,n,r));return si(i,n,r)}}});function si(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)=>ai(e,i,n.out,t));return ai(e,o,n.out,t)}else{let o=n.reverseTransform(e.value,e);if(o instanceof Promise)return o.then((i)=>ai(e,i,n.in,t));return ai(e,o,n.in,t)}}function ai(e,n,t,r){if(e.issues.length)return e.aborted=!0,e;return t._zod.run({value:n,issues:e.issues},r)}var Ah=g("$ZodPreprocess",(e,n)=>{cc.init(e,n)}),Th=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(yf);return yf(o)}});function yf(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function Fk(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?Er: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 Fk(e)}var Oh=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||cp.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}}),Nh=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)),jh=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))}),Rh=g("$ZodLazy",(e,n)=>{H.init(e,n),np(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)}),_h=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)=>gf(i,t,r,e));gf(o,t,r,e);return}});function gf(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 Dh extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}}var uc="~memo",$h=[];function Lh(e){return e!==null&&typeof e==="object"}function lc(e){return e.map((n)=>n.path?{...n,path:n.path.slice()}:{...n})}var Mh=new WeakMap,Nr=0,yi=1,jr=2;function gi(e,n,t){let r=Mh.get(e);if(r!==void 0)return r?jr:Nr;if(n.has(e))return jr;n.add(e);let o=Nr,i=(u)=>{if(o!==jr&&u?._zod){let d=gi(u,n,t);if(d>o)o=d}},s=(u,d)=>{let p=Nr;for(let m of Reflect.ownKeys(u)){let y=Object.getOwnPropertyDescriptor(u,m);if(d&&!y.enumerable)continue;let I=y.get?yi:y.value?._zod?gi(y.value,n,t):Nr;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=kr(c);a(u?s(u,!0):yi),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?gi(u,n,!1):yi);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),Vk(e,o)}function Vk(e,n){if(n!==yi)Mh.set(e,n===jr);return n}function Bk(e,n){let t=e.buckets.get(n);if(!t)t=new WeakMap,e.buckets.set(n,t);return t}var hi,mi=[],Uk={alloc(e,n,t){let r=hi;if(!r)return t;hi=void 0;let o={value:t,issues:null};return r.set(n.value,o),mi.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"&&Jk(i,o.value))throw new Dh;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=gi(e,new Set,!1);if(L===Nr){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(L===jr||r)t=!0;else r=!0}let u=c.value;if(!Lh(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=Bk(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}hi=p;let y=mi.length,I=s(c,l);hi=void 0;let j=mi.length>y?mi.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 zh(){return Uk}function Jk(e,n){let t=e[uc]?.backEdges;return t!==void 0&&Lh(n)&&t.has(n)}var Zk=()=>{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=fp(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:Zk()}}var Fh;class qh{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 Kk(){return new qh}(Fh=globalThis).__zod_globalRegistry??(Fh.__zod_globalRegistry=Kk());var Xe=globalThis.__zod_globalRegistry;function Vh(e){if(e.checks)e.checks=[...e.checks];return e}function Bh(e,n){return new e(Vh({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 bi(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 Uh(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 Jh(e,n){return new e({type:"string",format:"credit_card",check:"string_format",abort:!1,...T(n)})}function Zh(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 xi(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...T(n)})}function wi(e,n){return new e({type:"string",format:"date",check:"string_format",...T(n)})}function vi(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...T(n)})}function ki(e,n){return new e({type:"string",format:"duration",check:"string_format",...T(n)})}function Kh(e,n){return new e(Vh({type:"number",checks:[],...T(n)}))}function Wh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...T(n)})}function Hh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float32",...T(n)})}function Gh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"float64",...T(n)})}function Qh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"int32",...T(n)})}function Xh(e,n){return new e({type:"number",check:"number_format",abort:!1,format:"uint32",...T(n)})}function Yh(e,n){return new e({type:"boolean",...T(n)})}function em(e,n){return new e({type:"bigint",...T(n)})}function tm(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"int64",...T(n)})}function nm(e,n){return new e({type:"bigint",check:"bigint_format",abort:!1,format:"uint64",...T(n)})}function rm(e,n){return new e({type:"symbol",...T(n)})}function om(e,n){return new e({type:"undefined",...T(n)})}function im(e,n){return new e({type:"null",...T(n)})}function sm(e){return new e({type:"any"})}function am(e){return new e({type:"unknown"})}function cm(e,n){return new e({type:"never",...T(n)})}function lm(e,n){return new e({type:"void",...T(n)})}function um(e,n){return new e({type:"date",...T(n)})}function dm(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 pm(e){return Ut(0,e)}function fm(e){return Bt(0,e)}function hm(e){return ft(0,e)}function mm(e){return ht(0,e)}function On(e,n){return new _p({check:"multiple_of",...T(n),value:e})}function Nn(e,n){return new Lp({check:"max_size",...T(n),maximum:e})}function Jt(e,n){return new Mp({check:"min_size",...T(n),minimum:e})}function Rr(e,n){return new zp({check:"size_equals",...T(n),size:e})}function _r(e,n){return new Fp({check:"max_length",...T(n),maximum:e})}function hn(e,n){return new qp({check:"min_length",...T(n),minimum:e})}function $r(e,n){return new Vp({check:"length_equals",...T(n),length:e})}function Si(e,n){return new Bp({check:"string_format",format:"regex",...T(n),pattern:e})}function Ii(e){return new Up({check:"string_format",format:"lowercase",...T(e)})}function Ci(e){return new Jp({check:"string_format",format:"uppercase",...T(e)})}function Pi(e,n){return new Zp({check:"string_format",format:"includes",...T(n),includes:e})}function Ei(e,n){return new Kp({check:"string_format",format:"starts_with",...T(n),prefix:e})}function Ai(e,n){return new Wp({check:"string_format",format:"ends_with",...T(n),suffix:e})}function ym(e,n,t){return new Hp({check:"property",property:e,schema:n,...T(t)})}function Ti(e,n){return new Gp({check:"properties",shape:e,...T(n)})}function Oi(e,n){return new Qp({check:"mime_type",mime:e,...T(n)})}function Rt(e){return new Xp({check:"overwrite",tx:e})}function Ni(e){return Rt((n)=>n.normalize(e))}function ji(){return Rt((e)=>e.trim())}function Ri(){return Rt((e)=>e.toLowerCase())}function _i(){return Rt((e)=>e.toUpperCase())}function $i(){return Rt((e)=>sp(e))}function gm(e,n,t){return new e({type:"array",element:n,...T(t)})}function bm(e,n){return new e({type:"file",...T(n)})}function xm(e,n,t){let r=T(t);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:n,...r})}function wm(e,n,t){return new e({type:"custom",check:"custom",fn:n,...T(t)})}function vm(e,n){let t=Hk((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 Hk(e,n){let t=new we({check:"custom",...T(n)});return t._zod.check=e,t}function km(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 Sm(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 Im(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??fi,c=e.Boolean??di,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 Dr(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 Mr(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)Dr(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 Cm(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function zr(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}/${Cm(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+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>
63
63
 
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)}
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 Am(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;Am(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 Tm=new Set(["type","properties","required","additionalProperties"]),Pm=["oneOf","anyOf"];function Em(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(!Tm.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]??Em(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=Em(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 n=e.allOf;if(!Array.isArray(n)||n.length<2)return;for(let o of Tm)if(o in e)return;let t=n.filter((o)=>Pm.some((i)=>Array.isArray(o[i]))),r=null;if(!t.length)r=Rc(n);else{let o=t[0],i=Pm.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,Dr(e,r)}function Fr(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 Dr(l,y);if(Dr(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())Am(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(n)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Dr(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:Lr(n,"input",e.processors),output:Lr(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 Om=(e,n={})=>(t)=>{let r=Mr({...t,processors:n});return ve(e,r),zr(r,e),Fr(r,e)},Lr=(e,n,t={})=>(r)=>{let{libraryOptions:o,target:i}=r??{},s=Mr({...o??{},target:i,io:n,processors:t});return ve(e,s),zr(s,e),Fr(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},Nm=(e,n)=>{Rn(e,"minimum",n),_n(e,"maximum",n)},Dm=(e,n)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(n))e.multipleOf.push(n)},Lm=(e,n)=>{e.patterns??(e.patterns=new Set),e.patterns.add(n)},Mm=(e,n)=>{e.mime=e.mime?e.mime.filter((t)=>n.includes(t)):[...n]},zm=(e,n)=>{if(e.format=n,n.includes("int"))e.isInt=!0},jm=(e,n)=>Rn(e,"minimum",n.minimum),Rm=(e,n)=>_n(e,"maximum",n.maximum),_m=(e)=>(n,t)=>{zm(n,t.format);let[r,o]=e[t.format];Rn(n,"minimum",r),_n(n,"maximum",o)},Qk={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)=>Dm(e,n.value),number_format:_m(Uo),bigint_format:_m(Jo),min_length:jm,max_length:Rm,length_equals:(e,n)=>Nm(e,n.length),min_size:jm,max_size:Rm,size_equals:(e,n)=>Nm(e,n.size),string_format:(e,n)=>{if(zm(e,n.format),n.pattern)Lm(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)=>Mm(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)Qk[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)Dm(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)Mm(n,o.mime);for(let i of o.patterns??[])Lm(n,i);return n}var Xk={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Yk=new Map([[nc,Oa],[ui,Na]]),Fm=(e)=>Yk.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=Xk[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(Fm);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=xr(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 qr(e){let n=e._zod.def;if(n.type==="pipe"&&n.in._zod.traits.has("$ZodTransform"))return qr(n.out);if(n.type==="catch")return qr(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"?qr(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"]})},Di=(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"?qr(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:Er).source;return m}var $c=new WeakMap;function eS(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,Fm(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(()=>eS(n));u.push(e)}o.additionalProperties=ve(i.valueType,n,{...r,path:[...r.path,"additionalProperties"]})}let c=s._zod.values,l=n.io==="input"&&qr(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 qm(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=qm(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=qm(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},Li=(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:Di,intersection:al,tuple:cl,record:ll,nullable:ul,nonoptional:dl,default:fl,prefault:hl,catch:ml,pipe:yl,readonly:gl,promise:bl,optional:Li,lazy:xl};function $n(e,n){if("_idmap"in e){let r=e,o=Mr({...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;zr(o,u),qe(s,l,Fr(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=Mr({...n,processors:$m});return ve(e,t),zr(t,e),Fr(t,e)}var Vm=new WeakSet([Object.prototype,Error.prototype]);function zi(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 Bm=(e,n)=>{wp.init(e,n),e.name="ZodError";let t=Object.getPrototypeOf(e);if(Vm.has(t))return;Vm.add(t),zi(t,"format",(r)=>(o)=>kp(r,o)),zi(t,"flatten",(r)=>(o)=>vp(r,o)),zi(t,"addIssue",(r)=>(o)=>{r.issues.push(o),r.message=JSON.stringify(r.issues,wr,2)}),zi(t,"addIssues",(r)=>(o)=>{r.issues.push(...o),r.message=JSON.stringify(r.issues,wr,2)}),Object.defineProperty(t,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},rS=g("ZodError",Bm),it=g("ZodError",Bm,void 0,{Parent:Error});var Um=Ir(it),Jm=Cr(it),Zm=Yo(it),Km=ei(it),Wm=Ip(it),Hm=Cp(it),Gm=Pp(it),Qm=Ep(it),Xm=Ap(it),Ym=Tp(it),ey=Op(it),ty=Np(it);function iS(){if(!Fe.localeError)Ve(dc())}function mn(){if(!Fe.memoizer)Ve({memoizer:zh()})}var Q=g("ZodType",(e,n)=>(iS(),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(Uy(e,n))},superRefine(e,n){return this.check(Jy(e,n))},overwrite(e){return this.check(Rt(e))},optional(){return Fi(this)},exactOptional(){return Py(this)},nullable(){return qi(this)},nullish(){return Fi(qi(this))},nonoptional(e){return jy(this,e)},array(){return A(this)},or(e){return te([this,e])},and(e){return by(this,e)},transform(e){return wl(this,Ul(e))},default(e){return Ty(this,e)},prefault(e){return Ny(this,e)},catch(e){return $y(this,e)},pipe(e){return wl(this,e)},readonly(){return zy(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 Sr(this,"~standard",{...tc(this),jsonSchema:{input:Lr(this,"input"),output:Lr(this,"output")}})},set "~standard"(e){Nt(this,"~standard",e)},parse:function e(n,t){return Um(this,n,t,{callee:e})},parseAsync:async function e(n,t){return await Jm(this,n,t,{callee:e})},safeParse(e,n){return Zm(this,e,n)},async safeParseAsync(e,n){return Km(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 Wm(this,n,t,{callee:e})},decode:function e(n,t){return Hm(this,n,t,{callee:e})},encodeAsync:async function e(n,t){return await Gm(this,n,t,{callee:e})},decodeAsync:async function e(n,t){return await Qm(this,n,t,{callee:e})},safeEncode(e,n){return Xm(this,e,n)},safeDecode(e,n){return Ym(this,e,n)},async safeEncodeAsync(e,n){return ey(this,e,n)},async safeDecodeAsync(e,n){return ty(this,e,n)},toJSONSchema(e){return Om(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)},Qo({format:(e)=>Le(e).format??null,minLength:(e)=>Le(e).minimum??null,maxLength:(e)=>Le(e).maximum??null},{regex(...e){return this.check(Si(...e))},includes(...e){return this.check(Pi(...e))},startsWith(...e){return this.check(Ei(...e))},endsWith(...e){return this.check(Ai(...e))},min(...e){return this.check(hn(...e))},max(...e){return this.check(_r(...e))},length(...e){return this.check($r(...e))},nonempty(...e){return this.check(hn(1,...e))},lowercase(e){return this.check(Ii(e))},uppercase(e){return this.check(Ci(e))},trim(){return this.check(ji())},normalize(...e){return this.check(Ni(...e))},toLowerCase(){return this.check(Ri())},toUpperCase(){return this.check(_i())},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(bi(Vi,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(xi(Dn,e))},date(e){return this.check(wi(Ln,e))},time(e){return this.check(vi(Mn,e))},duration(e){return this.check(ki(zn,e))}});function k(e){return Bh(kl,e)}var be=g("ZodStringFormat",(e,n)=>{he.init(e,n),vl.init(e,n)}),Dn=g("ZodISODateTime",(e,n)=>{jf.init(e,n),be.init(e,n)}),Ln=g("ZodISODate",(e,n)=>{Rf.init(e,n),be.init(e,n)}),Mn=g("ZodISOTime",(e,n)=>{_f.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)=>{vf.init(e,n),be.init(e,n)});function sS(e){return pc(Sl,e)}var Il=g("ZodGUID",(e,n)=>{xf.init(e,n),be.init(e,n)});function aS(e){return fc(Il,e)}var _t=g("ZodUUID",(e,n)=>{wf.init(e,n),be.init(e,n)});function cS(e){return hc(_t,e)}function lS(e){return mc(_t,e)}function uS(e){return yc(_t,e)}function dS(e){return gc(_t,e)}var Vi=g("ZodURL",(e,n)=>{If.init(e,n),be.init(e,n)});function pS(e){return bi(Vi,e)}function fS(e){return bi(Vi,{protocol:Pr,hostname:Ra,...T(e)})}var Cl=g("ZodEmoji",(e,n)=>{Cf.init(e,n),be.init(e,n)});function hS(e){return bc(Cl,e)}var Pl=g("ZodNanoID",(e,n)=>{Pf.init(e,n),be.init(e,n)});function mS(e){return xc(Pl,e)}var El=g("ZodCUID",(e,n)=>{Ef.init(e,n),be.init(e,n)});function yS(e){return wc(El,e)}var Al=g("ZodCUID2",(e,n)=>{Af.init(e,n),be.init(e,n)});function gS(e){return vc(Al,e)}var Tl=g("ZodULID",(e,n)=>{Tf.init(e,n),be.init(e,n)});function bS(e){return kc(Tl,e)}var Ol=g("ZodXID",(e,n)=>{Of.init(e,n),be.init(e,n)});function xS(e){return Sc(Ol,e)}var Nl=g("ZodKSUID",(e,n)=>{Nf.init(e,n),be.init(e,n)});function wS(e){return Ic(Nl,e)}var jl=g("ZodIPv4",(e,n)=>{Df.init(e,n),be.init(e,n)});function vS(e){return Cc(jl,e)}var ny=g("ZodMAC",(e,n)=>{zf.init(e,n),be.init(e,n)});function kS(e){return Uh(ny,e)}var Rl=g("ZodIPv6",(e,n)=>{Mf.init(e,n),be.init(e,n)});function SS(e){return Pc(Rl,e)}var _l=g("ZodCIDRv4",(e,n)=>{Ff.init(e,n),be.init(e,n)});function IS(e){return Ec(_l,e)}var $l=g("ZodCIDRv6",(e,n)=>{qf.init(e,n),be.init(e,n)});function CS(e){return Ac($l,e)}var Dl=g("ZodBase64",(e,n)=>{Bf.init(e,n),be.init(e,n)});function PS(e){return Tc(Dl,e)}var Ll=g("ZodBase64URL",(e,n)=>{Uf.init(e,n),be.init(e,n)});function ES(e){return Oc(Ll,e)}var Ml=g("ZodE164",(e,n)=>{Jf.init(e,n),be.init(e,n)});function AS(e){return Nc(Ml,e)}var ry=g("ZodCreditCard",(e,n)=>{Zf.init(e,n),be.init(e,n)});function TS(e){return Jh(ry,e)}var oy=g("ZodIBAN",(e,n)=>{Kf.init(e,n),be.init(e,n)});function OS(e){return Zh(oy,e)}var zl=g("ZodJWT",(e,n)=>{Wf.init(e,n),be.init(e,n)});function NS(e){return jc(zl,e)}var Fn=g("ZodCustomStringFormat",(e,n)=>{Hf.init(e,n),be.init(e,n)});function jS(e,n,t={}){return jn(Fn,e,n,t)}function RS(e){return jn(Fn,"hostname",ja,e)}function _S(e){return jn(Fn,"hex",Ka,e)}function $S(e){return jn(Fn,"currency_code",$a,e)}function DS(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},Qo({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 Kh(Fl,e)}var qn=g("ZodNumberFormat",(e,n)=>{Gf.init(e,n),Fl.init(e,n)});function Ne(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)}function FS(e){return Xh(qn,e)}var ql=g("ZodBoolean",(e,n)=>{di.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Mc(e,t,r,o)});function me(e){return Yh(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)},Qo({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 qS(e){return em(Vl,e)}var Bl=g("ZodBigIntFormat",(e,n)=>{Qf.init(e,n),Vl.init(e,n)});function VS(e){return tm(Bl,e)}function BS(e){return nm(Bl,e)}var iy=g("ZodSymbol",(e,n)=>{Xf.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Fc(e,t,r,o)});function US(e){return rm(iy,e)}var sy=g("ZodUndefined",(e,n)=>{Yf.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Vc(e,t,r,o)});function JS(e){return om(sy,e)}var ay=g("ZodNull",(e,n)=>{eh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>qc(e,t,r,o)});function cy(e){return im(ay,e)}var ly=g("ZodAny",(e,n)=>{th.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Jc(e,t,r,o)});function ZS(){return sm(ly)}var uy=g("ZodUnknown",(e,n)=>{nh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Zc(e,t,r,o)});function mt(){return am(uy)}var dy=g("ZodNever",(e,n)=>{rh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Uc(e,t,r,o)});function yt(e){return cm(dy,e)}var py=g("ZodVoid",(e,n)=>{oh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Bc(e,t,r,o)});function KS(e){return lm(py,e)}var fy=g("ZodDate",(e,n)=>{ih.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))},Qo({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 WS(e){return um(fy,e)}var hy=g("ZodArray",(e,n)=>{mn(),sh.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(_r(e,n))},length(e,n){return this.check($r(e,n))},unwrap(){return this.element}});function A(e,n){return gm(hy,e,n)}function HS(e){let n=e._zod.def.shape;return U(Object.keys(n))}var Bi=g("ZodObject",(e,n)=>{mn(),lh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>sl(e,t,r,o),Lv(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 Tv(this,e)},safeExtend(e){return Ov(this,e)},merge(e){return Nv(this,e)},pick(e){return Ev(this,e)},omit(e){return Av(this,e)},partial(...e){return dp(Ji,this,e[0])},exactPartial(...e){return dp(Jl,this,e[0],"exactPartial")},required(...e){return jv(Zl,this,e[0])}});function E(e,n){let t={type:"object",shape:e??{},...T(n)};return new Bi(t)}function w(e,n){return new Bi({type:"object",shape:e,catchall:yt(),...T(n)})}function GS(e,n){return new Bi({type:"object",shape:e,catchall:mt(),...T(n)})}var Ui=g("ZodUnion",(e,n)=>{pi.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Di(e,t,r,o),e.options=n.options});function te(e,n){return new Ui({type:"union",options:e,...T(n)})}var my=g("ZodXor",(e,n)=>{Ui.init(e,n),uh.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Di(e,t,r,o),e.options=n.options});function QS(e,n){return new my({type:"union",options:e,inclusive:!1,...T(n)})}var yy=g("ZodDiscriminatedUnion",(e,n)=>{Ui.init(e,n),dh.init(e,n)});function gt(e,n,t){return new yy({type:"union",options:n,discriminator:e,...T(t)})}var gy=g("ZodIntersection",(e,n)=>{ph.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>al(e,t,r,o)});function by(e,n){return new gy({type:"intersection",left:e,right:n})}var xy=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 Ji({type:"optional",innerType:n}))})}});function wy(e,n,t){let r=n instanceof H,o=r?t:n;return new xy({type:"tuple",items:e,rest:r?n:null,...T(o)})}var Br=g("ZodRecord",(e,n)=>{mn(),fh.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 Br({type:"record",keyType:k(),valueType:e,...T(n)});return new Br({type:"record",keyType:e,valueType:n,...T(t)})}function XS(e,n,t){return new Br({type:"record",keyType:e,valueType:n,...T(t),partial:!0})}function YS(e,n,t){return new Br({type:"record",keyType:e,valueType:n,mode:"loose",...T(t)})}var vy=g("ZodMap",(e,n)=>{mn(),hh.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(Rr(...t))});function eI(e,n,t){return new vy({type:"map",keyType:e,valueType:n,...T(t)})}var ky=g("ZodSet",(e,n)=>{mn(),mh.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(Rr(...t))});function tI(e,n){return new ky({type:"set",valueType:e,...T(n)})}var Ur=g("ZodEnum",(e,n)=>{yh.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 Ur({...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 Ur({...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 Ur({type:"enum",entries:t,...T(n)})}function nI(e,n){return new Ur({type:"enum",entries:e,...T(n)})}var Sy=g("ZodLiteral",(e,n)=>{gh.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 Sy({type:"literal",values:Array.isArray(e)?e:[e],...T(n)})}var Iy=g("ZodFile",(e,n)=>{bh.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(Oi(Array.isArray(t)?t:[t],r))});function rI(e){return bm(Iy,e)}var Cy=g("ZodTransform",(e,n)=>{mn(),xh.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 Cy({type:"transform",transform:e})}var Ji=g("ZodOptional",(e,n)=>{ac.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Li(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Fi(e){return new Ji({type:"optional",innerType:e})}var Jl=g("ZodExactOptional",(e,n)=>{wh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Li(e,t,r,o),e.unwrap=()=>e._zod.def.innerType});function Py(e){return new Jl({type:"optional",innerType:e})}var Ey=g("ZodNullable",(e,n)=>{vh.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 qi(e){return new Ey({type:"nullable",innerType:e})}function oI(e){return Fi(qi(e))}var Ay=g("ZodDefault",(e,n)=>{kh.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 Ty(e,n){return new Ay({type:"default",innerType:e,get defaultValue(){return typeof n==="function"?n():na(n)}})}var Oy=g("ZodPrefault",(e,n)=>{Sh.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 Ny(e,n){return new Oy({type:"prefault",innerType:e,get defaultValue(){return typeof n==="function"?n():na(n)}})}var Zl=g("ZodNonOptional",(e,n)=>{Ih.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 jy(e,n){return new Zl({type:"nonoptional",innerType:e,...T(n)})}var Ry=g("ZodSuccess",(e,n)=>{Ch.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 iI(e){return new Ry({type:"success",innerType:e})}var _y=g("ZodCatch",(e,n)=>{Ph.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 _y({type:"catch",innerType:e,catchValue:typeof n==="function"?n:mp(n)})}var Dy=g("ZodNaN",(e,n)=>{Eh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Gc(e,t,r,o)});function sI(e){return dm(Dy,e)}var Zi=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 Zi({type:"pipe",in:e,out:n})}var Ki=g("ZodCodec",(e,n)=>{Zi.init(e,n),fi.init(e,n)});function aI(e,n,t){return new Ki({type:"pipe",in:e,out:n,transform:t.decode,reverseTransform:t.encode})}function cI(e){let n=e._zod.def;return new Ki({type:"pipe",in:n.out,out:n.in,transform:n.reverseTransform,reverseTransform:n.transform})}var Ly=g("ZodPreprocess",(e,n)=>{Zi.init(e,n),Ah.init(e,n)}),My=g("ZodReadonly",(e,n)=>{Th.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 zy(e){return new My({type:"readonly",innerType:e})}var Fy=g("ZodTemplateLiteral",(e,n)=>{Oh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>Qc(e,t,r,o)});function lI(e,n){return new Fy({type:"template_literal",parts:e,...T(n)})}var qy=g("ZodLazy",(e,n)=>{Rh.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 qy({type:"lazy",getter:e})}var Vy=g("ZodPromise",(e,n)=>{jh.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 uI(e){return new Vy({type:"promise",innerType:e})}var By=g("ZodFunction",(e,n)=>{Nh.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>tl(e,t,r,o)});function dI(e){return new By({type:"function",input:Array.isArray(e?.input)?wy(e?.input):e?.input??A(mt()),output:e?.output??mt()})}var Wi=g("ZodCustom",(e,n)=>{_h.init(e,n),Q.init(e,n),e._zod.processJSONSchema=(t,r,o)=>el(e,t,r,o)});function pI(e){let n=new we({check:"custom"});return n._zod.check=e,n}function fI(e,n){return xm(Wi,e??(()=>!0),n)}function Uy(e,n={}){return wm(Wi,e,n)}function Jy(e,n){return vm(e,n)}var hI=km,mI=Sm,Zy=g("ZodInstanceOf",(e,n)=>{Wi.init(e,n)},{properties(e,n){return this.check(Ti(e,n))}});function yI(e,n={}){let t=new Zy({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 gI=(...e)=>Im({Codec:Ki,Boolean:ql,String:kl},...e);function De(e){let n=Kl(()=>te([k(e),M(),me(),cy(),A(n),re(k(),n)]));return n}function Ky(e,n){return new Ly({type:"pipe",in:Ul(e),out:n})}function bI(e){return xi(Dn,e)}function xI(e){return wi(Ln,e)}function wI(e){return vi(Mn,e)}function vI(e){return ki(zn,e)}var D={...Wl,...Mi,iso:Jr},kI=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 SI(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 Wy(e,n){return e.map((t,r)=>r<n?t:t.optional())}function II(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function CI(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:II(t[1]);if(!o||!n.defs[o])throw Error(`Reference not found: ${e}`);return n.defs[o]}throw Error(`Reference not found: ${e}`)}function PI(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 EI=new Set(["items","prefixItems","additionalItems","additionalProperties","contains","propertyNames","not","if","then","else","allOf","anyOf","oneOf","unevaluatedItems","unevaluatedProperties","contentSchema"]),AI=new Set(["properties","patternProperties","dependentSchemas","dependencies","$defs","definitions"]);function Zr(e){if(typeof e!=="object"||e===null)return!1;if(Array.isArray(e))return e.some(Zr);if(typeof e.$ref==="string")return!0;return Object.entries(e).some(([n,t])=>{if(EI.has(n))return Zr(t);if(!AI.has(n)||typeof t!=="object"||t===null)return!1;return Object.values(t).some(Zr)})}function Hy(e){return e===1?"element":"elements"}function TI(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 ${Hy(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 ${Hy(n.maxContains)}`,input:o,continue:!0})}}).pipe(e)}function Gy(e,n){if(e===!1)return;if(e===void 0||e===!0)return D.any();return Je(e,n)}var OI=/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;function Qy(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=CI(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 Qy(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(OI));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=PI(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=Wy(a,s),l=!Array.isArray(i)?Gy(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=Wy(a,s),l=Gy(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=TI(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=Qy(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&&!Zr(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&&!Zr(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(!kI.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 Xy(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=SI(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 Yy=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(Yy.call(e,t)&&++r&&!Yy.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),NI=w({scope:U(["draft","live"]),values:b(!1).optional()}),e0=NI.omit({values:!0}),eg=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.")}),t0=w({scope:U(["draft","live"]),key:Ql.optional()}),n0=w({scope:U(["draft","live"]),space:k().regex(/^(flow|node:.+)$/)}),r0=w({scope:U(["draft","live"])}),Hi=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([])}),tg=Hi.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()}))}),ng=Xl.extend({values:w({count:M().int().nonnegative(),updatedAt:M().nullable()})}),rg=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 jI=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,RI=[0,31,28,31,30,31,30,31,31,30,31,30,31],_I=/^(\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,DI=/^(?:[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,LI=/^(?:(?:[^\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,MI=/^(?:(?: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,zI=/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,FI=/^(?:\/(?:[^~/]|~0|~1)*)*$/,qI=/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,VI=/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,BI=(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))},UI=/^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,JI=/^((([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,ZI=(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 og={date:ig,time:sg.bind(void 0,!1),"date-time":HI,duration:ZI,uri:XI,"uri-reference":Ct(DI),"uri-template":Ct(LI),url:Ct(MI),email:BI,hostname:Ct($I),ipv4:Ct(UI),ipv6:Ct(JI),regex:eC,uuid:Ct(zI),"json-pointer":Ct(FI),"json-pointer-uri-fragment":Ct(qI),"relative-json-pointer":Ct(VI)};function KI(e){return e%4===0&&(e%100!==0||e%400===0)}function ig(e){let n=e.match(jI);if(!n)return!1;let t=+n[1],r=+n[2],o=+n[3];return r>=1&&r<=12&&o>=1&&o<=(r==2&&KI(t)?29:RI[r])}function sg(e,n){let t=n.match(_I);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 WI=/t|\s/i;function HI(e){let n=e.split(WI);return n.length==2&&ig(n[0])&&sg(!0,n[1])}var GI=/\/|:/,QI=/^(?:[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 XI(e){return GI.test(e)&&QI.test(e)}var YI=/[^\\]\\Z/;function eC(e){if(YI.test(e))return!1;try{return new RegExp(e,"u"),!0}catch(n){return!1}}var ag=0;function Zt(){let e=ag;return ag+=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 Gi(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]=Gi(r);return n}else{let n={};for(let t in e)n[t]=Gi(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 Kr(e){return!!(e&ee)}function Wr(e){return!!(e&G)}function Hr(e){return!!(e&X)}function Gr(e){return!!(e&oe)}function Qr(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=tC(n,o,e);return t+=1,n}};return Object.defineProperties(r,{result:{get:()=>n},count:{get:()=>t}}),r}function tC(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 cg(e,n){switch(e){case Pe.Save:return n[0];case Pe.OneOf:return nC(n);case Pe.AllOf:case Pe.AnyOf:return Xr(e,n);case Pe.Not:case Pe.Swap:return tu(e,n[0])}}function Wt(e){return tu(Pe.Swap,e)}function nC(e){if(e.length===1)return e[0];let n=Xr(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=Xr(Pe.AllOf,[a,c]);t.push(l)}let r=Xr(Pe.AnyOf,t),o=tu(Pe.Not,r);return Xr(Pe.AllOf,[n,o])}function Xr(e,n){if(n.length<0)throw Error("invalid expressions: empty array");let t;switch(e){case Pe.AllOf:{t=eu(rC);break}case Pe.AnyOf:{t=eu(oC);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=iC;break}case Pe.Swap:{t=sC;break}default:throw Error(`invalid operator ${e}`)}for(let[o,i]of $t)if(i&n)r|=t(o);return r}function rC(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 oC(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 iC(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 sC(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=cg(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 Qi extends Error{constructor(e=[]){super(aC(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 aC(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 cC=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 cC.has(e)}function lg(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(ug(e,r,t))}function de({path:e,warns:n},t,...r){n.push(ug(e,r,t))}function ug(e,n,t){return{kind:Un.Compiled,message:t,path:[...e,...n]}}function Xi(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(lC(t))delete e[n]}}return e}function lC(e){for(let n in e)return!1;return!0}var Yr=Symbol("compiledId"),ru=Symbol("compiledKind"),ou=Symbol("compiledPath"),dg=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(Yi(C.Any,Zt(),{},()=>()=>!0)),eo=Bn(Yi(C.Never,Zt(),{type:"string",maxLength:0,minLength:1},()=>()=>!1));function to(e){if(e===null||typeof e!=="object")return!1;return Yr in e}function tt(e){if(e===null||typeof e!=="object")return!1;return Yr in e&&ru in e}function ce(e){if(tt(e))return e[ru];else return C.Extends}function yn(e){if(tt(e)||to(e))return e[Yr];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,Yr,{value:Zt(),configurable:!1,writable:!1,enumerable:!1}),e}function Ae(e,n,t,r=[]){return Yi(e,Zt(),n,t&&(()=>t.compile(n)),r)}function no(e){return Yi(C.Never,Zt(),{...e},e[dg],e[ou])}function Yi(e,n,t,r,o=[]){let i=null;return Object.defineProperties(t,{[ru]:{value:e,configurable:!1,writable:!1,enumerable:!1},[Yr]:{value:n,configurable:!1,writable:!1,enumerable:!1},[ou]:{value:o,configurable:!1,writable:!1,enumerable:!1},[dg]:{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 hg(e,n){let t=uC(e,n),r=pg(e,"maxItems",n),o=pg(e,"minItems",n),i=dC(e,n),s=n.uniqueItems,a;if(Array.isArray(t))a=pC(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=fg(a,e.delegate);let p=t.findIndex((m)=>ce(m)===C.Never);if(p!==-1){if(t=t.splice(p),a=fg(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=Xi({type:"array",items:t,contains:i,uniqueItems:s,maxItems:r,minItems:o,additionalItems:a});return Ae(u,d,e.delegate,e.path)}function uC(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 pg(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 dC(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 pC(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 fg(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:no(e);else return e}var mg=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(!fC(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 fC(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 yg(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(Gi(t));return Ae(s,a,e.delegate,e.path)}var hC=new Set(["type","maxProperties","minProperties","required","properties","patternProperties","additionalProperties","dependencies","propertyNames"]);function bg(e,n){let t=Object.keys(n).filter((y)=>!hC.has(y)&&Pt(y));if(t.length>0)de(e,`type="object" will exclude other keys: ${t.toSorted().join(", ")}`);let r=gg(e,"maxProperties",n),o=gg(e,"minProperties",n),i=mC(e,n),s=yC(e,n),a=gC(e,n),c=xC(e,n);if(!i||!s||!a||!c)return null;let l=bC(e,s,a,n);if(!l)return null;let u=wC(i,s,a,l),d=vC(e,u,c,n),p=kC(e,i,l,d,r,o)?C.Never:C.Object,m=Xi({type:"object",required:d,properties:l,minProperties:o,maxProperties:r,additionalProperties:i,patternProperties:CC(s),dependencies:PC(c,n),propertyNames:a});return Ae(p,m,e.delegate,e.path)}function gg(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 mC(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 yC(e,{patternProperties:n}){let t=!1,r={};for(let o in n){let i=IC(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 gC(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 no(r);return r}function bC(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=wg(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 xC(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}=xg(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]=eo;else r[o]=no(a)}}}return[t,r]}function wC(e,n,t,r){return(o)=>{if(Et(t,o)===Be.Invalid)return!0;let i=wg(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 vC(e,n,t,{required:r}){if(!r)return[];let o=xg(r);if(o.duplicated)de(e,`found duplicated required keys: ${o.duplicated.join(", ")}`,"required");let i=[],s=[];for(let a of o.keys)if(SC(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 kC(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 SC([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 xg(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 wg(e,n){for(let t in e){let[r,o]=e[t];if(o.test(n))return r}return null}function IC(e){try{return new RegExp(e,"i")}catch(n){if(n instanceof SyntaxError)return n;else throw n}}function CC(e){let n={};for(let t in e)n[t]=e[t][0];return n}function PC([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"]),vg=new Set(["type","format","maxLength","minLength","pattern"]);function Sg(e,n){let{type:t}=n;switch(t){case"number":case"integer":return EC(e,n);case"string":return TC(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 EC(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(!AC(r))l=C.Never;return Ae(l,r,e.delegate,e.path)}function AC(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 TC(e,n){let t=Object.keys(n).filter((a)=>!vg.has(a)&&Pt(a));if(t.length>0)de(e,`type="string" will exclude other keys: ${t.toSorted().join(", ")}`);let r=Yl(n,vg);kg(e,r,"maxLength"),kg(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 kg(e,n,t){let r=n[t];if(r!==void 0){if(Number.isNaN(r))de(e,"found NaN",t),delete n[t]}}var Ig=Object.freeze([]);function es(e,n,t,r){if(tt(e))return{schema:e,warns:Ig};if(n.isExtendsSchema(e))return{schema:e,warns:Ig};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)Cg(o.errors.length===0,"found errors (it should be empty)");else return Cg(o.errors.length>0,"cannot found any errors"),o.errors;return{schema:i,warns:o.warns}}function Cg(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=OC(e,r);if(a&&o)a=yg(e,i,s,a);if(!a)return null;return a}function OC(e,n){for(let t of mg){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 bg(e,n);case"array":return hg(e,n);default:return Sg(e,n)}}if(lg(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 Pg{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 Pg{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 ts(e){return new Eg(e)}class Eg{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 Ag(this.description,n)}}class Ag{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 NC(e,n);else if(t.num>r.num)return jC(e,n);else return RC(e,n)}function NC(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 jC(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 RC(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 _C=Zn(0),$C=ts(["hasCommon","hasExtra1","hasExtra2","hasRejection","hasCommonBroken"]);function Og({calculate:e},n,t){let r=_C(n.minItems,n.maxItems,t.minItems,t.maxItems),o=Kn(r);if(o===v.Rejection)return oe;let[i,s]=Tg(n),[a,c]=Tg(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 Tg({items:e,additionalItems:n}){if(Array.isArray(e))return[e,n??Gt];else return[[],e??Gt]}function Ng(e){let n=new Map;return(t,r)=>{let o=to(t),i=to(r);if(o!==i)return!1;if(!o)return t===r;return Rg(n,t,r,e)}}function jg(e){let n=new Map;return(t,r)=>Rg(n,t,r,e)}function Rg(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(_g(e,o,c))a=!0;else i=!0;if(i&&a)break}for(let c of o){if(_g(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 _g({isEquals:e},n,t){for(let r of n)if(e(r,t))return!0;return!1}function Dg(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 ro(e){let n=oo(e),t=e.multipleOf??1,r=bt(n,t);if(!r)return null;return{multipleOf:t,range:r}}function Lg([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=DC(t.num,n),i=LC(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 DC(e,n){return Math.ceil(e/n)*n}function LC(e,n){return Math.floor(e/n)*n}function zg(e,n){let t=oo(e),r=oo(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=oo(e),r=ro(n);if(!r)return G;let o=Qt(t,r.range),i=bt(o.center,r.multipleOf),s=Mg(o.left,r.multipleOf),a=Mg(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||!Lg(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 oo(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 Mg(e,n){if(!e)return;if(e.fromLeft)return;return bt(e.range,n)}function Vg(e,n){let t=ro(e),r=ro(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=MC(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||Fg(t,l,u),p=p||Fg(r,l,u),d&&p)return ue;if(d)return G;if(p)return X;return ee}function Fg({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=qg(t);if(qg(i)>s)return!0;if(s===1)return!1;if(n<r)return!0;return!1}function MC(e,n){return e*n/Bg(e,n)}function Bg(e,n){if(e===0)return n;return Bg(n%e,e)}function qg(e){if(!e)return 0;let[n,t]=e;return t.num-n.num+1}function fu(e,n){if(Ug(e)||Ug(n))return st;let t=Jg(e),r=Jg(n);if(t&&r)return zg(e,n);else if(t)return pu(e,n);else if(r)return Wt(pu(n,e));else return Vg(e,n)}function Ug(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 Jg(e){let{multipleOf:n}=e;if(n!==void 0&&Number.isInteger(n))return!1;if(e.type==="integer")return!1;return!0}var zC=Zn(0),FC=ts(["hasCommonInRequired","hasCommonOutRequired","hasExtra1","hasExtra2","hasRejection"]);function Wg(e,n,t){if(qC(n,t))return oe;let r=VC(n,t);if(!r)return oe;let o=Zg(n),i=Zg(t),s=(I)=>{let j=o(I),L=i(I);if(Kg(j,L))return e.calculate(j,L);else return ke},{commonRequired:a,extraRequired1:c,extraRequired2:l}=r,u=FC.variable({});for(let I of[...a].toSorted())u.push(s(I),UC);for(let I of[...c].toSorted())u.push(s(I),JC);for(let I of[...l].toSorted())u.push(s(I),ZC);let{hasOptional1:d,hasOptional2:p}=r;if(d||p){let I=KC(d,p);for(let F of[...BC(n,t)].toSorted()){let z=s(F);if(z!==ke)u.push(z,I)}let j=n.additionalProperties??Gt,L=t.additionalProperties??Gt;if(Kg(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 qC(e,n){let t=zC(e.minProperties,e.maxProperties,n.minProperties,n.maxProperties);return Kn(t)===v.Rejection}function VC(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 BC(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 UC=(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}}},JC=(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}}},ZC=(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}}},KC=(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 Zg(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 eo;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 Kg(e,n){let t=ce(e),r=ce(n);return t!==C.Never||r!==C.Never}var WC=Zn(0);function Hg(e,n){if(n.format&&!e.format)return G;if(e.format&&n.format&&e.format!==n.format)return st;let t=WC(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 Qg(e,n,t){let r={},o=[],i=jg(GC(e,r)),s=HC(),a=Dg(e);r.isEquals=Ng(Vn),r.calculate=nu({describe:s,equals:a,calculate:i,observeCalculation:(l,u,d,p)=>{let m=p?Wt(d):d;if(!QC(m))return;let y=p?Gg(u,l):Gg(l,u);if(y)o.push(y)}}),Object.freeze(r);let c=r.calculate(n,t);return{errorPath:o[0],expression:c}}var HC=()=>(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},GC=(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 Hg(t,r);case C.Boolean:return ee;case C.Object:return Wg(n,t,r);case C.Array:return Og(n,t,r);default:throw Error(`invalid kind ${o}`)}};function hu(e,n){return e.filter((t)=>ce(t)!==n)}function QC(e){return!Kr(e)&&!Hr(e)&&(Wr(e)||Qr(e)||Gr(e))}function Gg(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 io{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=io.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 Xg(e,n,t=!1){let r=n(e);if(Array.isArray(r)){let s=[];throw mu(s,r,"$"),new Qi(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 Yg(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 Qi(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 so=Object.freeze({True:0,False:1,Unknown:2});function yu({extendsSchemaClasses:e,delegate:n}={}){let t=new io(e);return Object.freeze({compile:(o,i,s)=>Xg(o,(c)=>es(c,t,i,n),s),isSubset:(o,i,s=!1)=>{let a=(y)=>es(y,t,void 0,n),[c,l]=Yg(o,i,a,s),{errorPath:u,expression:d}=Qg(t,c,l),p=Kr(d)||Hr(d),m=Wr(d)||Qr(d)||Gr(d);if(p&&!m)return{result:so.True};if(!p&&m)return{errorPath:u,result:so.False};return{result:so.Unknown}}})}var ns=(e)=>typeof e==="string";var XC=Array.isArray;var YC=(e)=>e!==null&&typeof e==="object";var eP=(e)=>YC(e)&&!XC(e),gn=(e)=>eP(e)?e:void 0;function tP(e){return gn(e)?.type==="string"}function nP(e){let n=gn(e),t=gn(n?.error);if(n==null||t==null||n.packageId!=null&&!ns(n.packageId)||t.message!=null&&!ns(t.message))throw TypeError("Invalid schema comparison context.")}function rP(e){if(e==null)return{error:{}};return nP(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=rP(t)}compare(e){if(tt(e)&&ce(e)===C.Any)return[v.ContainedBy];return this.compareImpl(e)}}class ao extends Xt{static isMatch(e){let n=gn(e)?.enum;return Array.isArray(n)&&n.every((t)=>ns(t))}constructor(e,n,t){if(!ao.isMatch(n))throw TypeError("Invalid single-select schema.");super(e,n,t)}compareImpl(e){if(tP(e))return[v.ContainedBy];if(e instanceof ao){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 ao){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 co extends Xt{static isMatch(e){return gn(e)?.contentMediaType==="oomol/bin"}constructor(e,n,t){if(!co.isMatch(n))throw TypeError("Invalid binary schema.");super(e,n,t)}compareImpl(e){if(e instanceof co)return[v.Equals];else return Xt.setError(this,e,"edgeError.binDiffType"),[v.Rejection]}equals(e){return e instanceof co}}class lo extends Xt{static isMatch(e){return gn(e)?.contentMediaType==="oomol/artifact"}constructor(e,n,t){if(!lo.isMatch(n))throw TypeError("Invalid Artifact schema.");super(e,n,t)}compareImpl(e){if(e instanceof lo)return[v.Equals];return Xt.setError(this,e,"edgeError.artifactDiffType"),[v.Rejection]}equals(e){return e instanceof lo}}function eb(){return yu({extendsSchemaClasses:[ao,co,lo]})}var H1=eb();var oP=new Set(["const","enum","exclusiveMaximum","exclusiveMinimum","maximum","maxItems","maxLength","maxProperties","minimum","minItems","minLength","minProperties","multipleOf","pattern","required","type"]);function rs(e){return oP.has(e)}function os(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 is=E({handle:k().min(1),jsonSchema:De(),nullable:me(),description:k().optional()}),aj=w({inputs:A(is).nullable(),outputs:A(is).nullable()});var tb=E({version:b(1),flowId:k().min(1),name:k(),revisionId:k().min(1),publicationId:k().min(1),inputs:A(is),outputs:A(is).nullable()});var nb=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 ss(e){return e!=="GET"}var Wn=w({mode:U(["fields","object"]).default("fields"),names:A(k()).default([])});var uo=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")}),rb=uo.extend({kind:b("connector-proxy")});function hP(e){return e.kind==="decision"}var xu={choice:255,score:10};function ob(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 mP(e){let n=e.map(ob);return n.every((t,r)=>t===e[r])?e:n}function ib(e){if(!hP(e.executor))return e;let n=e.executor.questions,t=mP(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,sb(n[i])))return o;return{...o,jsonSchema:yP(t[i])}});return{...e,executor:{...e.executor,questions:t},outputs:r}}var wu={type:"number",minimum:0,maximum:1};function yP(e){return sb(ob(e))}function sb(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 ab(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 gP=/^(?:\*\.)?(?=.{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 gP.test(e)&&(!e.startsWith("*.")||e.slice(2).includes("."))}var as=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")}),cb=as.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"],cs={maxRetries:5,minIntervalMs:1000,maxIntervalMs:60000,intervalStepMs:1000};var At=w({maxRetries:M().int().min(0).max(cs.maxRetries),intervalMs:M().int().min(cs.minIntervalMs).max(cs.maxIntervalMs).multipleOf(cs.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 lb(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:Jr.datetime({offset:!0}),timezone:k().refine(lb,"Select a valid IANA timezone.").optional()})]);var po={defaultMs:30000,minMs:1000,maxMs:60000};var ub={jsonSchema:{type:"object",additionalProperties:{type:["string","number","boolean"]}},nullable:!0};var bP=[{handle:"body",jsonSchema:{},nullable:!0,value:""},{handle:"statusCode",jsonSchema:{type:"number"},nullable:!1,value:200},{handle:"headers",jsonSchema:ub.jsonSchema,nullable:!1,value:{}}];var go=14,S=k(),us=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(),fo=A(S),tn=E({description:S.optional(),jsonSchema:wn,nullable:me(),handle:S}),xP=A(tn.strict()),lt=tn.extend({value:wn.optional()}),db=E({collapsed:me().optional(),group:S}),wP=E({kind:b("node"),nodeId:S,output:S,system:b(!0).optional(),field:S.optional()}),hb=te([wP,E({kind:b("binding"),bindingId:S})]),ho=te([E({kind:b("unset")}),E({kind:b("value"),value:wn})]),Cu=te([ho,E({kind:b("sources"),sources:A(hb)})]),mb=re(S,Cu),Qn={inputs:A(te([lt,db])),outputs:A(te([tn,db]))},vP=w({kind:b("connector"),action:S,connectionId:S.optional(),connections:A(w({connectionId:S,alias:S.optional()}))}),Ou=te([vP,w({kind:b("connector"),mode:b("shared")}),w({kind:b("connector"),mode:b("independent"),actions:A(w({action:S,connectionId:us.optional()}))}),w({kind:b("connector"),actionHints:A(S).optional(),connectionHints:A(w({action:S,connectionId:S,alias:S.optional()})).optional()})]),yb=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.')}),ds=te([Ou,yb,Nu]),Pu=E({...Qn,name:S,moduleId:S,capabilities:A(ds).optional()}),gb=te([E({kind:b("value"),value:wn}),E({kind:b("input"),input:S})]),kP=te([gb,E({kind:b("model")})]),hs={id:S,name:S,description:S,approval:me(),inputs:A(lt.extend({source:kP}))},ju=E({...hs,kind:b("connector").optional(),action:S,connectionId:us.optional()}),Ru=yb.extend(hs),SP=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:fo})]),Gn=E({...Qn,name:S,executor:te([E({kind:b("connector"),action:S,connectionId:us.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(SP)}),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:us.optional(),inputDefinitions:A(lt),messageHandle:S,inputs:re(S,gb)}).optional()}),w({kind:b("workflow"),flowId:S,revisionId:S}),cb,tg,rb])}),Eu=Gn.transform(ib),pb=te([E({kind:b("value"),value:wn.optional(),jsonSchema:wn.optional()}),E({kind:b("source"),source:hb})]),ps={matchMode:U(["first","all"]),cases:A(E({description:S.optional(),output:S,groups:A(E({expressions:A(E({left:pb,operator:U(["!=","<","<=","==",">",">=","contains","endsWith","hasKey","hasValue","isEmpty","isFalse","isNotEmpty","isNotNull","isNull","isTrue","notContains","notHasKey","notHasValue","startsWith"]),right:pb.optional()}))}))}))},mo={inputDefinitions:A(lt),prompt:S},IP=E({allowedMethods:yt().optional(),allowedOrigins:fo.optional(),noResponseBody:yt().optional(),responseBody:gt("kind",[w({kind:b("workflow-outputs"),output:S.optional(),timeoutMs:M().int().min(po.minMs).max(po.maxMs).optional()}),w({kind:b("webhook-response"),nodeId:S.optional(),timeoutMs:M().int().min(po.minMs).max(po.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()}),fs={bodyFields:A(lt),method:U(gu),options:IP.optional()},fb={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},CP=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:mb,name:S.optional(),description:S.optional(),icon:S.optional(),timeoutMs:M().optional(),retry:At.optional(),onError:U(["stop","error"]).optional()},ls=te([w({...xn,kind:b("webhook-response"),retry:yt().optional(),onError:yt().optional()}),w({...xn,kind:b("outputs"),outputDefs:A(tn.strict()),outputMappings:mb}).omit({inputs:!0}),E({...xn,inputs:re(S,yt()),kind:b("condition"),...ps}),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"),...mo}).omit({timeoutMs:!0}),w({...xn,kind:b("wait"),...mo,autoContinue:Hn.optional()}).omit({timeoutMs:!0}),E({...bn,kind:b("manual")}),w({...bn,kind:b("start"),inputDefs:xP}),w({...bn,kind:b("error"),sourceFlowIds:Au.optional()}),E({...bn,kind:b("webhook"),...fs}),E({...bn,kind:b("cron"),cronTimes:en}),E({...bn,kind:b("poll"),connectionId:S.min(1).optional(),config:re(S,ho),definition:E({...fb,type:b("poll")}),pollTimes:en}),E({...bn,kind:b("integration"),connectionId:S.min(1).optional(),config:re(S,ho),definition:E({...fb,type:b("integration"),endpoint:CP})})]),vt={input:lt,port:tn,ports:Qn,condition:w(ps),wait:w(mo),waitAutoContinue:Iu,webhook:w(fs),schedule:en,capabilities:A(ds),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()},PP=E({nodes:re(S,ls),edges:A(Tu).default([])}),bb=E({kind:b("variable"),target:S}),xb=E({name:S,imports:fo,source:S}),EP=Ky(AP,E({bindings:re(S,bb),graph:PP})),wb=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(go)]),document:EP,modules:re(S,xb)}),oR=wb.extend({kind:b("open-flow-flow-revision"),version:b(1)});function AP(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=wb.parse(e);return OP(n),Sb(n.document),n}var TP={"graph.trigger.sources.set":{nodeId:S,before:Au.optional(),value:Au.optional()},"binding.create":{bindingId:S,binding:bb},"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:ls},"graph.node.replace":{...ze,before:ls,node:ls},"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(ps),value:E(ps)},"graph.node.values.set":{...ze,before:A(lt),value:A(lt)},"graph.node.resolution.set":{...ze,before:w({...mo,autoContinue:Hn.optional()}),value:w({...mo,autoContinue:Hn.optional()})},"graph.node.webhook.set":{...ze,before:E(fs),value:E(fs)},"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(ds).optional(),value:A(ds).optional()},"graph.trigger.config.set":{nodeId:S,name:S,before:ho.optional(),value:ho.optional()},"graph.trigger.schedule.set":{nodeId:S,before:en,value:en},"module.create":{moduleId:S,module:xb},"module.delete":{moduleId:S},"module.rename":{moduleId:S,before:S,name:S},"module.source.replace":{moduleId:S,beforeImports:fo,beforeSource:S,imports:fo,source:S},"graph.node.task.set":{...ze,before:te([Pu,Eu]),value:te([Pu,Eu])}},vb=new Map(Object.entries(TP).map(([e,n])=>[e,n instanceof Q?n:E({kind:b(e),...n})])),iR=A(te([...vb.values()])).min(1);function yo(e,n,t){try{return t(e)}catch(r){if(!(r instanceof rS))throw r;throw TypeError(`operations[${n}]: ${r.issues.map((o)=>`${o.path.join(".")}: ${o.message}`).join("; ")}`,{cause:r})}}function kb(e,n){let{kind:t}=yo(e,n,E({kind:S}).parse),r=vb.get(t);if(r==null)throw TypeError(`operations[${n}]: Unknown operation ${JSON.stringify(t)}.`);return yo(e,n,r.parse)}function OP(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 Sb(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))ab(n.inputs)}var Ib=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 RP=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"])})]),Cb=w({sourceUrl:k().min(1),path:k().min(1),method:k().min(1),serverUrl:k().optional(),authentication:RP.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),er=["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(er),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}),Pb=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)})]),Eb=te([w({kind:b("value"),value:ut.optional(),schema:ut.optional()}),_u,$u,Du]),Ab=re(q,hs.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."),_P=te([Ru.omit({id:!0,inputs:!0,outputs:!0,revisionId:!0}).extend({inputs:Ab}).strict(),ju.omit({id:!0,inputs:!0}).extend({inputs:Ab}).strict()]),$P=A(te([Ou,w({kind:b("workflow"),name:q,flowId:q}),Nu])),DP=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."),jb=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."),LP=jb.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."),Rb=re(q,ms.extend({schema:ut,nullable:me()})),Tb=re(q,ms).describe("Code return fields by name. Omitted schema accepts any JSON; omitted nullable is true."),Lu=w({left:Eb,operator:vt.condition.shape.cases.element.shape.groups.element.shape.expressions.element.shape.operator,right:Eb.optional()}),Ob=w({all:A(Lu)}),MP=te([Lu,Ob,w({any:A(te([Lu,Ob]))})]),Dt={"webhook-response":w({}),workflow:w({flowId:q}),start:w({inputDefs:jb.default({})}),outputs:w({outputDefs:LP.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:Tb,capabilities:$P.optional()}),connector:vt.connector.omit({outputMode:!0}).strict(),"connector-proxy":uo,openapi:Cb,"http-request":as,"skip-duplicates":Hi,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(_P),notification:DP.optional()}).strict(),llm:Ib.extend({inputs:Yn}),decision:vt.decision,condition:w({match:U(["first","all"]),branches:A(w({name:q,description:k().optional(),when:MP}))}),value:w({values:Mu,outputs:Tb}),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})},zP={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.')},FP=w({...zP,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"].')}),qP=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,Pb).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:FP.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:Pb}),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()})]),tr=w({baseRevision:q,requestId:q.max(256),edits:A(qP).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."),Nb={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:tr,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"}]}},VP=[...Vo(ln).builtinModules].filter((e)=>!e.startsWith("node:")),BP=`Code is an ES module whose default export receives (inputs, context) and returns the business outputs. It may import the Node builtins ${VP.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(Nb,e))return;let n=Nb[e];return{request:$n(n.schema,{io:"input"}),guidance:n.guidance,examples:n.examples}}function bs(e){return e==null?{types:er,request:$n(tr),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"?BP:"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 _b=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(_b),version:b(1)}),Db=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(_b).optional()}),version:b(1)}),Lb=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)}),Mb=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"},JP={[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 zb 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 zb(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 Fb(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 nr(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:nr(r),revision:pe(n.revision),status:t,version:1}}function qb(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(nr),...r==null?{}:{total:r},version:1}}var Vb=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 rr(e){let n=x(e),t=Ju(n),r={configInputs:Vb.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 ZP=new Set(["error","cron","integration","poll","webhook"]),KP=new Set(["failed","healthy","initializing","needs_reauth","suspended"]),WP=new Set(["delivery.failed","health.failed","health.needs_reauth","health.recovered","health.suspended","operator.paused","operator.resumed"]);function bo(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"||!KP.has(t))return f();if(typeof o!="string"||!ZP.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 Bb(e){let n=x(e);if(n.version!=1)return f();return{binding:bo(n.binding),version:1}}function HP(e){let n=x(e),t=n.kind;if(typeof t!="string"||!WP.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 Ub(e){let n=x(e),t=xs(n.nextCursor);if(n.version!=1||!Array.isArray(n.activities))return f();return{activities:n.activities.map(HP),...t==null?{}:{nextCursor:t},version:1}}function Jb(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()},xo=mt().transform(bo),Zb={provider:k().min(1),inputs:re(k(),gt("kind",[E({kind:b("value"),value:De()}),E({kind:b("unset")})]))},QP=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:xo}),E({...vn,type:b("cron"),config:Dt.cron,binding:xo}),E({...vn,type:b("error"),config:Dt.error,binding:xo}),E({...vn,...Zb,type:b("poll"),config:Dt.poll,binding:xo}),E({...vn,...Zb,type:b("integration"),config:Dt.integration,binding:xo})]);function Kb(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=nr(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=Rb.safeParse(n.inputDefs);if(!i.success)return f();return{flowId:t,inputDefs:i.data,publication:r,status:o,enabled:n.enabled,entries:XP(n.entries,r),version:1}}function XP(e,n){let t=A(QP).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||!ss(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 Wb(e){return e.kind=="source"&&e.source.kind=="binding"?{kind:"value"}:e}function Hb(e){return{...e,cases:e.cases.map((n)=>({...n,groups:n.groups.map((t)=>({...t,expressions:t.expressions.map((r)=>({...r,left:Wb(r.left),...r.right==null?{}:{right:Wb(r.right)}}))}))}))}}var Ku=80;function wo(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 Yb(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 ex(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 rE=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=rE.parse(e);return{...n,content:Xn(n.content)}}function tx(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=ex(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,tx(l)]))};if(a.kind=="outputs")a={...a,outputMappings:Object.fromEntries(Object.entries(a.outputMappings).map(([c,l])=>[c,tx(l)]))};if(a.kind=="condition")a=Hb(a);if(a.kind=="error"&&a.sourceFlowIds!=null)a={...a,sourceFlowIds:[]};if(a.kind=="poll"||a.kind=="integration")a={...a,config:Yb(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 nx(e,n={}){return`${JSON.stringify(n.clean===!1?nn(e):Wu(e).file,null,2)}
65
+ `}function rx(e){return e.replace(/(?:\.openflow)?\.json$/i,"")}var ox=A(w({flowId:k().min(1),file:mt()})).min(1),oE=w({kind:b("open-flow-workflow-bundle"),version:b(1),entryFlowId:k().min(1),workflows:ox}),iE=w({version:b(1),entryFlowId:k().min(1),workflows:ox,unavailableFlowIds:A(k().min(1))});function ix(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 os(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 sx(e){xt(e,-4);let n=oE.parse(e);return{...n,workflows:ix(n.workflows,n.entryFlowId)}}function ax(e){xt(e,-4);let n=iE.parse(e);return{...n,workflows:ix(n.workflows,n.entryFlowId,n.unavailableFlowIds)}}function cx(e){let n=sx(e);return{...n,workflows:n.workflows.map(({flowId:t,file:r})=>({flowId:t,file:Wu(r).file}))}}function lx(e){if(e.unavailableFlowIds.length)throw TypeError("Some referenced workflows are unavailable.");return cx({kind:"open-flow-workflow-bundle",version:1,entryFlowId:e.entryFlowId,workflows:e.workflows})}function ux(e){return`${JSON.stringify(cx(e),null,2)}
66
+ `}function dx(e){let n=JSON.parse(e);return n!=null&&typeof n=="object"&&"kind"in n&&n.kind=="open-flow-workflow-bundle"?sx(n):nn(n)}var aE=gt("kind",[w({kind:b("admin-delegation")}),w({kind:b("policy"),ruleId:k().min(1).nullable()})]);function Is(e){return aE.parse(e)}function yx(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 cE(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 gx(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")?cE(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 or(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(gx(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 hx(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=hx(n.sharedBindings),o=hx(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 lE(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)=>gx(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 bx(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 lE(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 ir(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 xx(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 uE(e){return xx(e,!0)}function mx(e,n){return Object.fromEntries(Object.entries(x(e)).map(([t,r])=>[t,n(r)]))}function vo(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:mx(n.inputs,uE),name:h(n.name),outputs:mx(n.outputs,xx),serviceId:h(n.serviceId),serviceName:h(n.serviceName)}}function Cs(e){let{defaultConnection:n,...t}=x(e),r=vo(t);if(n==null)return r;let o=ir(n);if(o.serviceId!=r.serviceId||o.status!="active")return f();return{...r,defaultConnection:o}}function wx(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 sr=k().min(1).max(256),vx=E({appId:sr.nullable(),workspaceId:sr.optional(),installationId:sr.optional(),organizationId:sr.optional(),projectId:sr.optional(),projectKey:sr.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 ar=k().min(1).max(256),gE=k().regex(/^[a-z][a-z0-9_.:]{0,127}$/),bE=k().trim().min(1).max(128),kx=E({version:b(1),sourceId:ar,revision:Ne().positive(),name:bE,provider:U(["feishu","feishu_app_bot","slackbot","intercom","sentry","zoom","fireflies","jira"]),...vx.shape,connectionId:ar,teamId:ar.nullable(),enabled:me(),eventTypes:A(gE),endpointUrl:k().nullable(),lastReceivedAt:k().nullable(),updatedAt:k(),consumers:A(E({flowId:ar,flowName:k(),triggerNodeId:ar}))});function Ps(e){return kx.parse(e)}function ed(e){return E({version:b(1),sources:A(kx),teamId:ar.nullable().optional()}).parse(e)}function Es(e){let n=x(e);if(K(n,["version","locale","definitions","display"]),n.version!=3||!Hd(n.locale)||!Array.isArray(n.definitions))return f();let t=n.definitions.map(rr),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:Sx(c.configInputs,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),configInputLabels:xE(c.configInputLabels,s.configInputs.flatMap((l)=>("handle"in l)?[l.handle]:[])),displayName:h(c.displayName),description:h(c.description),outputs:Sx(c.outputs,s.outputs.map((l)=>l.handle))}]}));return{version:3,locale:n.locale,definitions:t,display:i}}function Sx(e,n){let t=x(e);return Fb(t,n),Object.fromEntries(Object.entries(t).map(([r,o])=>[r,h(o)]))}function xE(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 wE=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 vE=De(),Ix=E({pointer:k(),type:U(["object","array","string","number","boolean","null"]),length:M().int().nonnegative().optional(),complete:me(),value:vE.optional()}),kE=Ix.extend({offset:M().int().nonnegative(),nextOffset:M().int().positive().optional(),entries:A(Ix).optional()}),Cx=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()}),SE=E({version:b(1),runId:k(),results:A(Cx),nextAfter:k().optional()}),IE=E({version:b(1),runId:k(),result:Cx,page:kE});function nd(e){return SE.parse(e)}function rd(e){return IE.parse(e)}function CE(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 PE(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 PE(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=CE(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 Px(e){if(!Array.isArray(e))return f();return e.map((n)=>typeof n=="string"||Number.isSafeInteger(n)?n:f())}function EE(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:Px(n.path)};if(t!="keyword"||typeof n.keyword!="string"||!rs(n.keyword))return f();return{kind:t,keyword:n.keyword,path:Px(n.path),source:n.source===void 0?void 0:Ie(n.source),target:n.target===void 0?void 0:Ie(n.target)}}function AE(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:EE(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 Ex(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(AE),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 Ax=(e)=>e==null?"":`?flowId=${encodeURIComponent(e)}`;function Tx(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(wx)}}}function Ox(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 Nx(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=vo(i.action);if(s.actionId!=e)return f("action.actionId: does not match the requested Action.");return s}}}function jx(e){return{path:`/v1/connector/connections${Ax(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(ir)}}}function Rx(e,n){return{path:`/v1/connector/connections/${encodeURIComponent(e)}${Ax(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(ir)}}}function ko(e){return Array.isArray(e)?e.map(h):f()}function TE(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:ko(t.calledFlowIds)},variableNames:ko(t.variableNames),errorSourceFlowIds:ko(t.errorSourceFlowIds),connections:t.connections.map((i)=>{let s=x(i);return{providerId:h(s.providerId),connectionId:h(s.connectionId)}})},sharedAccess:{accessRevision:o,providerIds:ko(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?[]:ko(n.tagIds),createdAt:h(n.createdAt),...n.connectorTeamId==null?{}:{connectorTeamId:h(n.connectorTeamId)},draftRevisionId:h(n.draftRevisionId),resourceReferences:TE(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 OE(e){let n=x(e),t=pe(n.referenceCount);if(t<0)return f();return{...dt(n),referenceCount:t}}function _x(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(OE),...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 Dx(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 Lx(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 So(e){let n=x(e);try{return{...id(n),content:Xn(n.content)}}catch{return f()}}function Mx(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 Io(e){let n=x(e);if(n.version!=1)return f();return{revision:id(n.revision),version:1}}function zx(e){let n=x(e);if(n.version!=1||n.kind!="snapshot")return f();return{draft:So(n.draft),kind:"snapshot",version:1}}var NE=["canceled","completed","failed","indeterminate"],Os=[...NE,"queued","running","starting","waiting"];var jE=new Set(Os);function Ns(e){return typeof e=="string"&&jE.has(e)?e:f()}function Vx(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 RE(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 Fx(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 _E(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=Vx(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(RE);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:_E(n.initiator)},...$E(n),...n.triggerNodeId===void 0?{}:{triggerNodeId:h(n.triggerNodeId)},...n.caller===void 0?{}:{caller:Fx(n.caller)},...n.calls===void 0?{}:{calls:n.calls.map((a)=>Object.assign(Fx(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 Bx(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(Vx),version:1}}function Ux(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 Jx(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 Zx(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:qx(o),status:"failed"}}if(t=="indeterminate"){let o=x(n.error);return{...r,error:qx(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 qx(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 Co(){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 Kx(e){let n=x(e),t=pe(n.referenceCount);if(t<0)return f();return{...Rs(n),referenceCount:t}}function DE(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 Hx(e){return e?.kind=="run.completed"||e?.kind=="run.failed"||e?.kind=="run.canceled"||e?.kind=="run.indeterminate"}function LE(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:Wx(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:Wx(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 Wx(e){return typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=100?e:f()}function ME(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(LE),...t==null?{}:{eventsExpiresAt:t},historyComplete:n.historyComplete,nextAfter:r,runId:h(n.runId),version:1}}var O=encodeURIComponent;async function ad(e,n){try{return await e.json()}catch(t){if(n?.aborted)throw n.reason??t;return f(`HTTP ${e.status} response body is not JSON.`)}}function kn(e){return`${e}-${Co()}`}class cd{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 _x(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(ir)}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 nb.parse(await this.request(`/v1/flows/${O(e)}/references?${t}`,{signal:n.signal}))}async getWorkflowContract(e,n){return tb.parse(await this.request(`/v1/flows/${O(e)}/call-contract`,{signal:n}))}async getVariableReferences(e,n){return Lx(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 ax(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 lx(n)}async importFlowBundle(e,n={}){return DE(await this.request("/v1/flows/import-bundle",{method:"POST",headers:{"Idempotency-Key":n.idempotencyKey??`flow-${Co()}`},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-${Co()}`},body:JSON.stringify({file:e,name:n.name,teamId:n.teamId,tagIds:n.tagIds,version:1})}))}async createFlow(e,n=`flow-${Co()}`,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(Dx)}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(Kx),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=ng.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=rg.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(rr)}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 ad(o,t)),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 ad(o,t)),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=rr(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 rr(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(bo)}async getFlowTriggerBinding(e,n){return Bb(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 Ub(await this.request(`/v1/flows/${O(e)}/triggers/${O(n)}/activities${o}`))}async testFlowPollTrigger(e,n){return Jb(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:So(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 So(await this.request(`/v1/flows/${O(e)}/draft`))}async syncDraft(e){return zx(await this.request(`/v1/flows/${O(e)}/draft/sync`))}async getRevision(e,n,t){return So(await this.request(`/v1/flows/${O(e)}/revisions/${O(n)}`,{signal:t}))}async getRevisionTriggers(e,n,t){let r=Mx(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=Tx(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 yx(await this.request(`/v1/connector/leina/bots?flowId=${O(e)}`,{signal:n}))}async removeConnectionUsage(e,n,t,r,o){return Io(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 or(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 bx(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 or(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 or(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 or(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=Ox(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(Nx(e,t,r),30000,n,o)).data}async listAllConnectorConnections(e,n,t=!1){let r=jx(n);return this.connectorRequest(r.path,"connections",e,r.decode,t)}async listConnectorConnections(e,n,t,r=!1){let o=Rx(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 Lb.parse(await this.request(`/v1/flows/${O(e)}/authoring/read`,{method:"POST",body:JSON.stringify(n)}))}async searchAuthoring(e,n){return Mb.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 Db.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 Io(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 Io(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 Io(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 Ex(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=Kb(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 qb(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 nr(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 Bx(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 ME(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 Zx(await this.request(`/v1/runs/${O(e)}/result`,{signal:n}))}async cancelRun(e){return Ux(await this.request(`/v1/runs/${O(e)}/cancel`,{body:JSON.stringify({version:1}),method:"POST"}))}async resolveRunWait(e,n,t,r){return Jx(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(vo)}},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(`HTTP ${o.status} response did not include a JSON error body.`)}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={}){return await ad(await this.response(e,n),n.signal)}}var zE=0.1,FE=3,Po=gt("type",[w({type:b("focus"),nodeId:k().min(1)}),w({type:b("zoom"),zoom:M().min(zE).max(FE)}),w({type:b("pan"),dx:M(),dy:M()}),w({type:b("fit")})]);var Te=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(Te).min(1).optional(),anyOf:A(Te).min(1).optional(),oneOf:A(Te).min(1).optional(),not:Te.optional(),if:Te.optional(),then:Te.optional(),else:Te.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(),Te).optional(),definitions:re(k(),Te).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(og,e),"Unsupported string format.").optional(),multipleOf:M().positive().optional(),uniqueItems:me().optional(),contains:Te.optional(),minContains:M().int().nonnegative().optional(),maxContains:M().int().nonnegative().optional(),minProperties:M().int().nonnegative().optional(),maxProperties:M().int().nonnegative().optional(),propertyNames:Te.optional(),patternProperties:re(k().refine((e)=>{try{return new RegExp(e,"u").source.length>0}catch{return!1}},"Invalid regular expression."),Te).optional(),dependentRequired:re(k(),A(k())).optional(),dependentSchemas:re(k(),Te).optional(),dependencies:re(k(),te([Te,A(k())])).optional(),prefixItems:A(Te).optional(),additionalItems:Te.optional(),unevaluatedItems:Te.optional(),unevaluatedProperties:Te.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(),Te).optional(),required:A(k()).optional(),additionalProperties:Te.optional(),items:te([Te,A(Te)]).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)]));kw();var Id=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),GA=De(),QA=w({kind:b("graph.trigger.create"),nodeId:dr,key:dr,connectionId:dr.optional(),name:dr.optional(),config:re(dr,GA),schedule:en.readonly().optional()});function Cd(e){return xt(e),A(mt()).min(1).parse(e).map((n,t)=>{let{kind:r}=yo(n,t,E({kind:dr}).parse);return r=="graph.trigger.create"?yo(n,t,QA.parse):kb(n,t)})}var Sw=[{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 Iw(e){return Xy(e).extend({name:k().trim().min(1).max(128)})}var Cw=Sw.flatMap((e)=>("source"in e)&&e.source!=null?[e.source]:[]),Pw=te(Cw.map((e)=>Iw(e.createSchema))),Ew=Iw(Cw[0].updateSchema),Aw=w({version:b(1),expectedRevision:Ne().positive()});var Tw={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."},YA=Object.keys(Tw),eT=YA.map((e)=>({name:e,description:Tw[e]}));var nF=w({comment:Id}),pr=De(),$e=k().min(1),Ee=b(1),Ds=$e.refine((e)=>e==e.trim()&&wo(e)==null,"Flow name is invalid."),Ls=A($e).transform((e)=>[...new Set(e)].toSorted()),nT=$e.transform((e)=>e.trim()).refine((e)=>wo(e)==null,"Tag name is invalid."),Ow=re(k(),re(k(),pr)),Nw=w({nodeId:$e,outputs:re(k(),pr)}),ae={readFlowState:eg.extend({version:Ee}),canvas:w({command:Po,version:Ee}),authoringCheck:Fu,authoringEdit:tr,authoringRead:ys,authoringSearch:gs,authoringSchema:qu,loadOpenApiDocument:w({url:k().min(1).max(8192),version:Ee}),createEventSource:Pw,updateEventSource:Ew,eventSourceRevision:Aw,importFlow:w({file:pr,name:Ds.optional(),teamId:$e.optional(),tagIds:Ls.optional(),version:Ee}),createFlow:w({name:Ds,teamId:$e.optional(),tagIds:Ls.optional(),presentation:re(k(),pr).optional(),version:Ee}),saveTag:w({name:nT,version:Ee}),setFlowTags:w({tagIds:Ls,version:Ee}),updateFlow:w({name:Ds.optional(),icon:k().nullable().optional(),description:k().nullable().optional(),tagIds:Ls.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:Ds,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:Ow,trigger:Nw,version:b(2)}),createLiveRun:w({publicationId:$e,inputs:Ow,trigger:Nw,version:b(2)}),resolveWait:w({action:U(["approve","continue","reject"]),comment:Id,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 rF={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:Cd(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)};import{randomUUID as lT}from"crypto";class P extends Error{constructor(e,n,t){super(n);this.code=e,this.details=t,this.name="CliError"}}function Ms(e,n){let t=e.trim(),r=wo(t);if(r==null)return t;let o=`${n} names use letters (any language), numbers, spaces, hyphens, or underscores, and start and end with a letter or number.`,i={controlCharacter:`${n} name contains a control character. ${o}`,empty:`${n} name is required.`,specialCharacter:`${n} name ${rT(t)}. ${o}`,tooLong:`${n} name is ${t.length} UTF-16 code units long; the limit is ${Ku}.`}[r];throw new P("cli.invalid-arguments",i)}function rT(e){let n=[...e],t=n.find((r)=>!/[\p{L}\p{N} _-]/u.test(r));if(t!=null)return`contains unsupported character ${JSON.stringify(t)}`;return/[\p{L}\p{N}]/u.test(n[0])?"must end with a letter or number":"must start with a letter or number"}var oT=100,Pd=100,Ed=100,iT=new Set(["canceled","completed","failed","indeterminate"]);async function sT(e){let n=[],t=new Set,r;do{let o=await e.listFlows({cursor:r,limit:oT});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 aT(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 Oe(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 aT(await sT(e),n)}async function jw(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 cT(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 Rw(e,n,t){try{return await e.getConnectorAction(n,void 0,t)}catch(r){if(!(r instanceof Re)||r.status!=404)throw r}return cT(await e.searchConnectorActions(n,void 0,t),n)}function Ad(e){return`${e.displayName} ${e.key} ${e.provider} ${e.type}`}async function _w(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 $w(e){return`${e.displayName} ${e.connectionId} ${e.serviceId} ${e.status}${e.isDefault?"\tdefault":""}`}function Td(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)}
67
67
  `:`${r}
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(`
68
+ `)}function Mt(e){return`${e.name} ${e.flowId} ${e.status}`}function Oo(e){return`${e.operation} ${e.publicationId} ${e.revisionId} ${e.createdAt}`}function No(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 Dw(e){return`${e.source} ${e.status} ${e.runId} ${e.revisionId}`}function Lw(e){return`${e.sequence} ${e.kind} ${JSON.stringify(e.payload)}`}async function fr(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 jo(e,n){if(e==null)return{};let t=await fr(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 Mw(e,n){if(e.input==null)return{};let t=await fr(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 Ro(e,n,t){let r=new Set,o;do{let i=await e.listPublications(n,{cursor:o,limit:Pd}),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 Od(e,n,t,r=60000){let o=Date.now()+r,i=n;while(!iT.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 _o(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 zw(e){return new P(e.code,e.message,{status:e.status,...e.details})}async function Nd(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 uT=new Set(Os);function Fw(e){let n=!1,t=[],r,o,i,s=lT(),a,c=[],l=[],u,d,p,m,y,I,j,L,F,z,ge,Se,fe,Ge,sn,In,an,Cn,mr,Do=!1,Vs,qd=!1,Bs,Us,Vd=[],Bd="draft",Js,Zs,Ks,Ws,Hs,Ud=[],Jd=!1,Zd=!1;for(let Pn=0;Pn<e.length;Pn+=1){let yr=e[Pn],Lo=yr.startsWith("--")?yr.indexOf("="):-1,R=Lo<0?yr:yr.slice(0,Lo),gr=Lo<0?void 0:yr.slice(Lo+1);if(gr!=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=gr??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")qd=!0;else if(R=="--include-dependencies")n=!0;else if(R=="--follow")Do=!0;else if(R=="--wait")Jd=!0;else if(R=="--yes")Zd=!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=gr??e[Pn+1];if(Z==null||Z.length==0||gr==null&&Z.startsWith("-")&&Z!="-")throw new P("cli.invalid-arguments",`${R} requires a value.`);if(gr==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")mr=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")Vd.push(Z);else if(R=="--unset")Ud.push(Z);else if(R=="--source"){if(Z!="draft"&&Z!="live")throw new P("cli.invalid-arguments","--source must be draft or live.");Bd=Z}else if(R=="--status"){if(!uT.has(Z))throw new P("cli.invalid-arguments",`Unknown Run status ${JSON.stringify(Z)}.`);Zs=Z}else{let zt=Number(Z),gv=R=="--offset"?0:1;if(!Number.isSafeInteger(zt)||zt<gv||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},...mr==null?{}:{flow:mr},follow:Do,...Vs==null?{}:{input:Vs},json:qd,...Bs==null?{}:{limit:Bs},...Us==null?{}:{name:Us},positionals:c,options:l,...u==null?{}:{trigger:u},...d==null?{}:{outputs:d},sets:Vd,source:Bd,...Zs==null?{}:{status:Zs},...Js==null?{}:{pendingWait:Js},...Ws==null?{}:{timeoutMs:Ws},...Hs==null?{}:{timezone:Hs},unsets:Ud,wait:Jd,yes:Zd}}var jd=["expected-revision","idempotency-key"],Rd=["cursor","limit"],qw=[["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>]",Rd],["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>",jd],["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>",[...jd,"expected-publication","source","trigger","outputs","input","wait","timeout"]],["runs list","--flow <flow>",["flow","status","pending-wait",...Rd]],["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>",[...jd,"expected-publication","timeout"]],["publications list","<flow>",Rd],["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"]]],dT={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 _d(e,n="oo flow"){let t=e.join(" ");return qw.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"},dT[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 Vw(e){return qw.find(([n])=>n==e.slice(0,n.split(" ").length).join(" "))?.[2]}function Bw(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(er.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(Po,{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 Uw(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 pT(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 pT(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 hT}from"path";async function Jw(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=fT(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 jw(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
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}
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(Td).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 Rw(e,s,n?.flowId);W(o,r.json,{action:l,kind:"connector.show",version:1},Td(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($w).join(`
73
+ `));return}default:throw new P("cli.invalid-arguments",`Usage: ${o.commandPrefix??"oo flow"} connector <providers|teams|search|show|connections> ...`)}}async function Zw(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(Ad).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 _w(e,i);W(r,t.json,{definition:a,kind:"trigger.show",version:1},Ad(a));return}default:throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} trigger <search|show> ...`)}}function fT(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 Kw(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 Oe(e,n[0]),i=await Mw(t,r),s=t.source=="live"?t.expectedPublication==null?await e.getLive(o.flowId):{publication:await Ro(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 fr(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 Od(e,L,r,t.timeoutMs):{run:L,timedOut:!1};return W(r,t.json,{kind:"run.create",idempotencyKey:t.idempotencyKey,...F,version:1},No(F.run)),_o(F.run,F.timedOut)}async function Ww(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 Oe(e,t.flow),a=await e.listRuns(s.flowId,{...t.cursor==null?{}:{cursor:t.cursor},limit:t.limit??Ed,...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(Dw).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},No(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 Od(e,c,r,Math.max(0,a-Date.now()));return W(r,t.json,{kind:"run.wait",runId:s,...l,version:1},No(l.run)),_o(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??Ed},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(Lw).join(`
77
+ `)),!t.follow)return;if(l=await e.getRun(s,AbortSignal.timeout(Math.max(1,c-Date.now()))),Hx(u.events.at(-1)))return _o(l);if(t.after!=null&&u.events.length==0&&u.done)return _o(l);if(l.waits.length>0)return W(r,t.json,{kind:"run.wait",runId:s,run:l,nextAfter:a,timedOut:!1,version:1},No(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 Hw(e,n,t,r){xe(n,1,`${r.commandPrefix??"oo flow"} publish <flow> [--json]`);let o=await Oe(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 Nd(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 Ro(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}`:Oo(d),...u==null?[]:[zs(u)],...c.map((p)=>`Warning: ${p.message}`)].join(`
78
+ `))}async function Gw(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 Oe(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??Pd});W(r,t.json,{flow:c,kind:"publication.list",...l,version:1},l.publications.map(Oo).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 Nd(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 Ro(e,c.flowId,s);W(r,t.json,{kind:"publication.show",publication:l,version:1},Oo(l));return}throw new P("cli.invalid-arguments",`Usage: ${r.commandPrefix??"oo flow"} publications <list|show> <flow> [publication]`)}async function Qw(e,n,t,r){xe(n,2,`${r.commandPrefix??"oo flow"} rollback <flow> <publication> [--json]`);let o=await Oe(e,n[0]),i=await Ro(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},Oo(a))}async function Xw(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 Oe(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 jo(s,r),c=await Oe(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 jo(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 Oe(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 mT(e,i.slice(1)):t.flow==null?void 0:await Oe(e,t.flow);return await Jw(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 Kw(e,i,t,r);case"runs":return await Ww(e,i,t,r);case"publish":return await Hw(e,i,t,r);case"publications":return await Gw(e,i,t,r);case"rollback":return await Qw(e,i,t,r);case"trigger":return await Zw(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 Oe(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(Mt).join(`
82
+ `));return}case"export":{xe(i,1,`${r.commandPrefix??"oo flow"} export <flow>`);let s=await Oe(e,i[0]);r.stdout.write(t.includeDependencies?ux(await e.exportFlowBundle(s.flowId)):nx(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=dx(await fr(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=="-"?Gd(r.language??"en"):rx(hT(t.file))),l={name:Ms(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(Mt).join(`
83
+ `));return}let u=await e.importFlow(s,l);W(r,t.json,{flow:u,idempotencyKey:t.idempotencyKey,kind:"flow.import",version:1},Mt(u));return}case"create":{xe(i,1,`${r.commandPrefix??"oo flow"} create <name> [--json]`);let s=await e.createFlow(Ms(i[0],"Flow"),t.idempotencyKey);W(r,t.json,{flow:s,idempotencyKey:t.idempotencyKey,kind:"flow.create",version:1},Mt(s));return}case"live":{xe(i,1,`${r.commandPrefix??"oo flow"} live <flow> [--json]`);let s=await Oe(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 Oe(e,i[0]);W(r,t.json,{flow:s,kind:"flow.show",version:1},Mt(s));return}case"rename":{xe(i,2,`${r.commandPrefix??"oo flow"} rename <flow> <new-name> [--json]`);let s=await Oe(e,i[0]),a=await e.renameFlow(s.flowId,Ms(i[1],"Flow"));W(r,t.json,{flow:a,kind:"flow.rename",version:1},Mt(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 Oe(e,i[0]),a=await e.deleteFlow(s.flowId);W(r,t.json,{flow:a,kind:"flow.delete",version:1},Mt(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 Oe(e,i[0]),a=await e.setFlowEnabled(s.flowId,t.expectedPublication,o=="enable");W(r,t.json,{flow:a,kind:`flow.${o}`,version:1},Mt(a));return}case"check":{xe(i,1,`${r.commandPrefix??"oo flow"} check <flow> [--revision <revisionId>] [--json]`);let s=await Oe(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 mT(e,n){let t=n[0];if(t==null)throw new P("cli.invalid-arguments","A Flow reference is required.");return await Oe(e,t)}var hr={};var ev=(e)=>e,Fs=Object.is,yT=(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},gT=(e)=>e.value,bT=(e)=>e.map(gT),xT=(e)=>e.$version,qs=(e,n)=>{try{e(n)}catch(t){console.error(t)}},tv=(e,n)=>(e.set=n,e);var wT=Promise.resolve(),Dd=new Set,vT=new Set,$o=Dd,Ld,kT=()=>{let e=$o;$o=$o===Dd?vT:Dd,Ld=!1;for(let n of e)n.t();e.clear()},ST=(e)=>{$o.add(e),Ld=Ld||wT.then(kT)},IT=(e)=>$o.delete(e);var Yw=new FinalizationRegistry(qs),nv=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)Yw.register(this,this.#e=o)}}g=this;b=new Map;s=4;v;c=hr;q;e;m;u=()=>{if(this.s&4){this.s&=-5;let e=this.#n();if(this.c===hr)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])ST(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,IT(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(),Yw.unregister(this),this.#e?.(),this.#o=!0,this.#t&&e!==hr)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!==hr&&n!==e)this.#t(n)}y(e){let n=this.c;if(this.c=this.v=e,this.#t&&n!==hr&&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},CT=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()}},Md=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 Md(new CT(this.#e));return e&&this.set?tv(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}},PT=(e,n)=>{let t=e,o=new nv(()=>t,n),i=(a)=>{if(!o.q?.(a,t))t=a,o.n()};return[new Md(o),i]},zd=(e,n)=>tv(...PT(e,n));var rv=(e,n,t)=>new Md(new nv(e,t,n)),ov=(e,n=ev,t)=>{let r,o;return rv(()=>{let i=e.map(xT);if(!o||!yT(i,o))o=i,r=n(bT(e));return r},(i)=>{let s=e.map((a)=>a.$valCompute(i));return()=>s.forEach(qs)},t)};var Fd=(e,n=ev,t)=>{let r,o=hr;return rv(()=>{let i=e.$version;if(!Fs(i,o))o=i,r=n(e.value);return r},(i)=>e.$valCompute(i),t)};var iv=(e,n={},t="")=>{for(let[r,o]of Object.entries(e))if(typeof o==="string")n[t+r]=o;else iv(o,n,t+r+".");return n},ET=(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("")}},sv=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$=zd(t),this.lang$=zd(n),this.locale$=ov([this.lang$,this.locales$],([i,s])=>s[i]||{}),this.a=Fd(this.locale$,iv),this.t$=Fd(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=ET(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 av={help:{usage:"Usage: {{command}}",title:"Open Flow commands",options:"Options: --json, --cursor <cursor>, --limit <count>"}};var cv={help:{usage:"Utilisation : {{command}}",title:"Commandes Open Flow",options:"Options : --json, --cursor <cursor>, --limit <count>"}};var lv={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 uv={help:{usage:"\uC0AC\uC6A9\uBC95: {{command}}",title:"Open Flow \uBA85\uB839\uC5B4",options:"\uC635\uC158: --json, --cursor <cursor>, --limit <count>"}};var dv={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 pv={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9009\u9879\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var fv={help:{usage:"\u7528\u6CD5\uFF1A{{command}}",title:"Open Flow \u547D\u4EE4",options:"\u9078\u9805\uFF1A--json\u3001--cursor <cursor>\u3001--limit <count>"}};var $T={en:av,"zh-CN":pv,"zh-TW":fv,ja:lv,ko:uv,ru:dv,fr:cv},DT=Object.fromEntries(Qs.map((e)=>[e,$T[e]]));function hv(e=Wd){return new sv(zo([e]),DT)}function LT(e,n){let t=n.filter((i)=>!i.startsWith("-")),r=_d(t,e.commandPrefix);while(r.length==0&&t.length>0)t.pop(),r=_d(t,e.commandPrefix);let o=hv(e.language);try{let i=r.length==1?$d(r[0].command):void 0,s=Uw(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}
84
84
  Options: ${c.options.map((l)=>l.name+(l.value?" <value>":"")+(l.description==null?"":`: ${l.description}`)).join(`
85
85
  `)}`),"",o.t("help.options"),"",...a.notes,"",...s].join(`
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})}
86
+ `)}finally{o.dispose()}}function MT(e){return e.length==0||e.includes("--help")||e.includes("-h")}function zT(e){return e.positionals[0]=="schema"&&e.flow==null}async function mv(e,n,t){let r,o;try{if(MT(e))return t.stdout.write(`${LT(t,e)}
87
+ `),0;r=Fw(e);let i=Vw(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(zT(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=Bw(r.positionals[1]);if(a==null)throw new P("cli.invalid-arguments",`Unknown schema. Use read, search, edit, check, edits, input, outputs (Trigger outputs), or a node type: ${er.filter((c)=>c!="outputs").join(", ")}. For the Outputs node schema, run schema outputs --flow <flow>. Input sources such as variable are described by the edits schema.`);return t.stdout.write(`${JSON.stringify(a)}
88
+ `),0}let s=new cd(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 jo(r.input,t),c=await Oe(s,r.flow);return t.stdout.write(`${JSON.stringify(await s.authoringSchema(c.flowId,a))}
89
+ `),0}return await Xw(s,n,r,t)??0}catch(i){let s;if(i instanceof P)s=i;else if(i instanceof Re)s=zw(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
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})}
91
+ `);return 1}}async function BT(e){let n=process.platform=="darwin"?["open",e]:process.platform=="win32"?["rundll32","url.dll,FileProtocolHandler",e]:["xdg-open",e],t=FT(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 yv(e,n,t){if(e.includes("--version")||e.includes("-v"))return process.stdout.write(e.includes("--json")?`${JSON.stringify({version:t.version})}
92
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};
93
+ `),0;return await mv(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:zo([n.language]),openUrl:BT,readFile:async(r)=>await qT(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 VT(r)})}async function Cq(e,n={}){return await yv(e,n,{version:Kd})}export{Cq as runOpenFlowCommand};