onepipeline-ui 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,9 +66,9 @@ Error generating stack: `+e.message+`
66
66
  ]`,m={scope:`string`,variants:[u,l,d,f]},h={scope:`number`,variants:[{begin:`\\b0[bB][01]+(?:_[01]+)*\\b`},{begin:`\\b0[oO][0-7]+(?:_[0-7]+)*\\b`},{begin:`\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b`},{begin:`(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?`}],relevance:0},g=[`false`,`null`,`true`],_=`__CLASS__.__DIR__.__FILE__.__FUNCTION__.__COMPILER_HALT_OFFSET__.__LINE__.__METHOD__.__NAMESPACE__.__TRAIT__.die.echo.exit.include.include_once.print.require.require_once.array.abstract.and.as.binary.bool.boolean.break.callable.case.catch.class.clone.const.continue.declare.default.do.double.else.elseif.empty.enddeclare.endfor.endforeach.endif.endswitch.endwhile.enum.eval.extends.final.finally.float.for.foreach.from.global.goto.if.implements.instanceof.insteadof.int.integer.interface.isset.iterable.list.match|0.mixed.new.never.object.or.private.protected.public.readonly.real.return.string.switch.throw.trait.try.unset.use.var.void.while.xor.yield`.split(`.`),v=`Error|0.AppendIterator.ArgumentCountError.ArithmeticError.ArrayIterator.ArrayObject.AssertionError.BadFunctionCallException.BadMethodCallException.CachingIterator.CallbackFilterIterator.CompileError.Countable.DirectoryIterator.DivisionByZeroError.DomainException.EmptyIterator.ErrorException.Exception.FilesystemIterator.FilterIterator.GlobIterator.InfiniteIterator.InvalidArgumentException.IteratorIterator.LengthException.LimitIterator.LogicException.MultipleIterator.NoRewindIterator.OutOfBoundsException.OutOfRangeException.OuterIterator.OverflowException.ParentIterator.ParseError.RangeException.RecursiveArrayIterator.RecursiveCachingIterator.RecursiveCallbackFilterIterator.RecursiveDirectoryIterator.RecursiveFilterIterator.RecursiveIterator.RecursiveIteratorIterator.RecursiveRegexIterator.RecursiveTreeIterator.RegexIterator.RuntimeException.SeekableIterator.SplDoublyLinkedList.SplFileInfo.SplFileObject.SplFixedArray.SplHeap.SplMaxHeap.SplMinHeap.SplObjectStorage.SplObserver.SplPriorityQueue.SplQueue.SplStack.SplSubject.SplTempFileObject.TypeError.UnderflowException.UnexpectedValueException.UnhandledMatchError.ArrayAccess.BackedEnum.Closure.Fiber.Generator.Iterator.IteratorAggregate.Serializable.Stringable.Throwable.Traversable.UnitEnum.WeakReference.WeakMap.Directory.__PHP_Incomplete_Class.parent.php_user_filter.self.static.stdClass`.split(`.`),y={keyword:_,literal:(e=>{let t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t})(g),built_in:v},b=e=>e.map(e=>e.replace(/\|\d+$/,``)),x={variants:[{match:[/new/,t.concat(p,`+`),t.concat(`(?!`,b(v).join(`\\b|`),`\\b)`),i],scope:{1:`keyword`,4:`title.class`}}]},S=t.concat(r,`\\b(?!\\()`),C={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{2:`variable.constant`}},{match:[/::/,/class/],scope:{2:`variable.language`}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),S],scope:{1:`title.class`,3:`variable.constant`}},{match:[i,t.concat(`::`,t.lookahead(/(?!class\b)/))],scope:{1:`title.class`}},{match:[i,/::/,/class/],scope:{1:`title.class`,3:`variable.language`}}]},w={scope:`attr`,match:t.concat(r,t.lookahead(`:`),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:y,contains:[w,o,C,e.C_BLOCK_COMMENT_MODE,m,h,x]},E={relevance:0,match:[/\b/,t.concat(`(?!fn\\b|function\\b|`,b(_).join(`\\b|`),`|`,b(v).join(`\\b|`),`\\b)`),r,t.concat(p,`*`),t.lookahead(/(?=\()/)],scope:{3:`title.function.invoke`},contains:[T]};T.contains.push(E);let D=[w,C,e.C_BLOCK_COMMENT_MODE,m,h,x],O={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:`meta`,end:/]/,endScope:`meta`,keywords:{literal:g,keyword:[`new`,`array`]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:[`new`,`array`]},contains:[`self`,...D]},...D,{scope:`meta`,variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:y,contains:[O,e.HASH_COMMENT_MODE,e.COMMENT(`//`,`$`),e.COMMENT(`/\\*`,`\\*/`,{contains:[{scope:`doctag`,match:`@[A-Za-z]+`}]}),{match:/__halt_compiler\(\);/,keywords:`__halt_compiler`,starts:{scope:`comment`,end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:`meta`,endsParent:!0}]}},s,{scope:`variable.language`,match:/\$this\b/},o,E,C,{match:[/const/,/\s/,r],scope:{1:`keyword`,3:`variable.constant`}},x,{scope:`function`,relevance:0,beginKeywords:`fn function`,end:/[;{]/,excludeEnd:!0,illegal:`[$%\\[]`,contains:[{beginKeywords:`use`},e.UNDERSCORE_TITLE_MODE,{begin:`=>`,endsParent:!0},{scope:`params`,begin:`\\(`,end:`\\)`,excludeBegin:!0,excludeEnd:!0,keywords:y,contains:[`self`,O,o,C,e.C_BLOCK_COMMENT_MODE,m,h]}]},{scope:`class`,variants:[{beginKeywords:`enum`,illegal:/[($"]/},{beginKeywords:`class interface trait`,illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:`extends implements`},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:`namespace`,relevance:0,end:`;`,illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:`title.class`})]},{beginKeywords:`use`,relevance:0,end:`;`,contains:[{match:/\b(as|const|function)\b/,scope:`keyword`},e.UNDERSCORE_TITLE_MODE]},m,h]}}function XS(e){return{name:`PHP template`,subLanguage:`xml`,contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:`php`,contains:[{begin:`/\\*`,end:`\\*/`,skip:!0},{begin:`b"`,end:`"`,skip:!0},{begin:`b'`,end:`'`,skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function ZS(e){return{name:`Plain text`,aliases:[`text`,`txt`],disableAutodetect:!0}}function QS(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=`and.as.assert.async.await.break.case.class.continue.def.del.elif.else.except.finally.for.from.global.if.import.in.is.lambda.match.nonlocal|10.not.or.pass.raise.return.try.while.with.yield`.split(`.`),i={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:`__import__.abs.all.any.ascii.bin.bool.breakpoint.bytearray.bytes.callable.chr.classmethod.compile.complex.delattr.dict.dir.divmod.enumerate.eval.exec.filter.float.format.frozenset.getattr.globals.hasattr.hash.help.hex.id.input.int.isinstance.issubclass.iter.len.list.locals.map.max.memoryview.min.next.object.oct.open.ord.pow.print.property.range.repr.reversed.round.set.setattr.slice.sorted.staticmethod.str.sum.super.tuple.type.vars.zip`.split(`.`),literal:[`__debug__`,`Ellipsis`,`False`,`None`,`NotImplemented`,`True`],type:[`Any`,`Callable`,`Coroutine`,`Dict`,`List`,`Literal`,`Generic`,`Optional`,`Sequence`,`Set`,`Tuple`,`Type`,`Union`]},a={className:`meta`,begin:/^(>>>|\.\.\.) /},o={className:`subst`,begin:/\{/,end:/\}/,keywords:i,illegal:/#/},s={begin:/\{\{/,relevance:0},c={className:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,a,s,o]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,s,o]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,s,o]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},l=`[0-9](_?[0-9])*`,u=`(\\b(${l}))?\\.(${l})|\\b(${l})\\.`,d=`\\b|${r.join(`|`)}`,f={className:`number`,relevance:0,variants:[{begin:`(\\b(${l})|(${u}))[eE][+-]?(${l})[jJ]?(?=${d})`},{begin:`(${u})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${l})[jJ](?=${d})`}]},p={className:`comment`,begin:t.lookahead(/# type:/),end:/$/,keywords:i,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={className:`params`,variants:[{className:``,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,contains:[`self`,a,f,c,e.HASH_COMMENT_MODE]}]};return o.contains=[c,f,a],{name:`Python`,aliases:[`py`,`gyp`,`ipython`],unicodeRegex:!0,keywords:i,illegal:/(<\/|\?)|=>/,contains:[a,f,{scope:`variable.language`,match:/\bself\b/},{beginKeywords:`if`,relevance:0},{match:/\bor\b/,scope:`keyword`},c,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[m]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:`keyword`,3:`title.class`,6:`title.class.inherited`}},{className:`meta`,begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[f,m,c]}]}}function $S(e){return{aliases:[`pycon`],contains:[{className:`meta.prompt`,starts:{end:/ |$/,starts:{end:`$`,subLanguage:`python`}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function eC(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:`R`,keywords:{$pattern:n,keyword:`function if in break next repeat else for while`,literal:`NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10`,built_in:`LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm`},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:`doctag`,match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:`doctag`,begin:`@param`,end:/$/,contains:[{scope:`variable`,variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:`doctag`,match:/@[a-zA-Z]+/},{scope:`keyword`,match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:`string`,contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:`"`,end:`"`,relevance:0},{begin:`'`,end:`'`,relevance:0}]},{relevance:0,variants:[{scope:{1:`operator`,2:`number`},match:[i,r]},{scope:{1:`operator`,2:`number`},match:[/%[^%]*%/,r]},{scope:{1:`punctuation`,2:`number`},match:[a,r]},{scope:{2:`number`},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:`operator`},match:[n,/\s+/,/<-/,/\s+/]},{scope:`operator`,relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:`punctuation`,relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function tC(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),a={"variable.constant":[`__FILE__`,`__LINE__`,`__ENCODING__`],"variable.language":[`self`,`super`],keyword:`alias.and.begin.BEGIN.break.case.class.defined.do.else.elsif.end.END.ensure.for.if.in.module.next.not.or.redo.require.rescue.retry.return.then.undef.unless.until.when.while.yield.include.extend.prepend.public.private.protected.raise.throw`.split(`.`),built_in:[`proc`,`lambda`,`attr_accessor`,`attr_reader`,`attr_writer`,`define_method`,`private_constant`,`module_function`],literal:[`true`,`false`,`nil`]},o={className:`doctag`,begin:`@[A-Za-z]+`},s={begin:`#<`,end:`>`},c=[e.COMMENT(`#`,`$`,{contains:[o]}),e.COMMENT(`^=begin`,`^=end`,{contains:[o],relevance:10}),e.COMMENT(`^__END__`,e.MATCH_NOTHING_RE)],l={className:`subst`,begin:/#\{/,end:/\}/,keywords:a},u={className:`string`,contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},d=`[0-9](_?[0-9])*`,f={className:`number`,relevance:0,variants:[{begin:`\\b([1-9](_?[0-9])*|0)(\\.(${d}))?([eE][+-]?(${d})|r)?i?\\b`},{begin:`\\b0[dD][0-9](_?[0-9])*r?i?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*r?i?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*r?i?\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b`},{begin:`\\b0(_?[0-7])+r?i?\\b`}]},p={variants:[{match:/\(\)/},{className:`params`,begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:a}]},m=[u,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:`title.class`,4:`title.class.inherited`},keywords:a},{match:[/(include|extend)\s+/,i],scope:{2:`title.class`},keywords:a},{relevance:0,match:[i,/\.new[. (]/],scope:{1:`title.class`}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`},{relevance:0,match:r,scope:`title.class`},{match:[/def/,/\s+/,n],scope:{1:`keyword`,3:`title.function`},contains:[p]},{begin:e.IDENT_RE+`::`},{className:`symbol`,begin:e.UNDERSCORE_IDENT_RE+`(!|\\?)?:`,relevance:0},{className:`symbol`,begin:`:(?!\\s)`,contains:[u,{begin:n}],relevance:0},f,{className:`variable`,begin:`(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])`},{className:`params`,begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:a},{begin:`(`+e.RE_STARTERS_RE+`|unless)\\s*`,keywords:`unless`,contains:[{className:`regexp`,contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:`/`,end:`/[a-z]*`},{begin:/%r\{/,end:/\}[a-z]*/},{begin:`%r\\(`,end:`\\)[a-z]*`},{begin:`%r!`,end:`![a-z]*`},{begin:`%r\\[`,end:`\\][a-z]*`}]}].concat(s,c),relevance:0}].concat(s,c);l.contains=m,p.contains=m;let h=[{begin:/^\s*=>/,starts:{end:`$`,contains:m}},{className:`meta.prompt`,begin:`^([>?]>|[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]|(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>)(?=[ ])`,starts:{end:`$`,keywords:a,contains:m}}];return c.unshift(s),{name:`Ruby`,aliases:[`rb`,`gemspec`,`podspec`,`thor`,`irb`],keywords:a,illegal:/\/\*/,contains:[e.SHEBANG({binary:`ruby`})].concat(h,c,m)}}function nC(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:`title.function.invoke`,relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o=`abstract.as.async.await.become.box.break.const.continue.crate.do.dyn.else.enum.extern.false.final.fn.for.if.impl.in.let.loop.macro.match.mod.move.mut.override.priv.pub.ref.return.self.Self.static.struct.super.trait.true.try.type.typeof.union.unsafe.unsized.use.virtual.where.while.yield`.split(`.`),s=[`true`,`false`,`Some`,`None`,`Ok`,`Err`],c=`drop .Copy.Send.Sized.Sync.Drop.Fn.FnMut.FnOnce.ToOwned.Clone.Debug.PartialEq.PartialOrd.Eq.Ord.AsRef.AsMut.Into.From.Default.Iterator.Extend.IntoIterator.DoubleEndedIterator.ExactSizeIterator.SliceConcatExt.ToString.assert!.assert_eq!.bitflags!.bytes!.cfg!.col!.concat!.concat_idents!.debug_assert!.debug_assert_eq!.env!.eprintln!.panic!.file!.format!.format_args!.include_bytes!.include_str!.line!.local_data_key!.module_path!.option_env!.print!.println!.select!.stringify!.try!.unimplemented!.unreachable!.vec!.write!.writeln!.macro_rules!.assert_ne!.debug_assert_ne!`.split(`.`),l=[`i8`,`i16`,`i32`,`i64`,`i128`,`isize`,`u8`,`u16`,`u32`,`u64`,`u128`,`usize`,`f32`,`f64`,`str`,`char`,`bool`,`Box`,`Option`,`Result`,`String`,`Vec`];return{name:`Rust`,aliases:[`rs`],keywords:{$pattern:e.IDENT_RE+`!?`,type:l,keyword:o,literal:s,built_in:c},illegal:`</`,contains:[e.C_LINE_COMMENT_MODE,e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:`symbol`,begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:`string`,variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:`char.escape`,match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:`number`,variants:[{begin:`\\b0b([01_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0o([0-7_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b0x([A-Fa-f0-9_]+)([ui](8|16|32|64|128|size)|f(32|64))?`},{begin:`\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)([ui](8|16|32|64|128|size)|f(32|64))?`}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:`keyword`,3:`title.function`}},{className:`meta`,begin:`#!?\\[`,end:`\\]`,contains:[{className:`string`,begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:`keyword`,3:`keyword`,4:`variable`}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:`keyword`,3:`variable`,5:`keyword`}},{begin:[/type/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:`keyword`,3:`title.class`}},{begin:e.IDENT_RE+`::`,keywords:{keyword:`Self`,built_in:c,type:l}},{className:`punctuation`,begin:`->`},a]}}var rC=e=>({IMPORTANT:{scope:`meta`,begin:`!important`},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:`number`,begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:`built_in`,begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:`selector-attr`,begin:/\[/,end:/\]/,illegal:`$`,contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:`number`,begin:e.NUMBER_RE+`(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?`,relevance:0},CSS_VARIABLE:{className:`attr`,begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),iC=`a.abbr.address.article.aside.audio.b.blockquote.body.button.canvas.caption.cite.code.dd.del.details.dfn.div.dl.dt.em.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.html.i.iframe.img.input.ins.kbd.label.legend.li.main.mark.menu.nav.object.ol.optgroup.option.p.picture.q.quote.samp.section.select.source.span.strong.summary.sup.table.tbody.td.textarea.tfoot.th.thead.time.tr.ul.var.video`.split(`.`),aC=`defs.g.marker.mask.pattern.svg.switch.symbol.feBlend.feColorMatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feFlood.feGaussianBlur.feImage.feMerge.feMorphology.feOffset.feSpecularLighting.feTile.feTurbulence.linearGradient.radialGradient.stop.circle.ellipse.image.line.path.polygon.polyline.rect.text.use.textPath.tspan.foreignObject.clipPath`.split(`.`),oC=[...iC,...aC],sC=`any-hover.any-pointer.aspect-ratio.color.color-gamut.color-index.device-aspect-ratio.device-height.device-width.display-mode.forced-colors.grid.height.hover.inverted-colors.monochrome.orientation.overflow-block.overflow-inline.pointer.prefers-color-scheme.prefers-contrast.prefers-reduced-motion.prefers-reduced-transparency.resolution.scan.scripting.update.width.min-width.max-width.min-height.max-height`.split(`.`).sort().reverse(),cC=`active.any-link.blank.checked.current.default.defined.dir.disabled.drop.empty.enabled.first.first-child.first-of-type.fullscreen.future.focus.focus-visible.focus-within.has.host.host-context.hover.indeterminate.in-range.invalid.is.lang.last-child.last-of-type.left.link.local-link.not.nth-child.nth-col.nth-last-child.nth-last-col.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.past.placeholder-shown.read-only.read-write.required.right.root.scope.target.target-within.user-invalid.valid.visited.where`.split(`.`).sort().reverse(),lC=[`after`,`backdrop`,`before`,`cue`,`cue-region`,`first-letter`,`first-line`,`grammar-error`,`marker`,`part`,`placeholder`,`selection`,`slotted`,`spelling-error`].sort().reverse(),uC=`accent-color.align-content.align-items.align-self.alignment-baseline.all.anchor-name.animation.animation-composition.animation-delay.animation-direction.animation-duration.animation-fill-mode.animation-iteration-count.animation-name.animation-play-state.animation-range.animation-range-end.animation-range-start.animation-timeline.animation-timing-function.appearance.aspect-ratio.backdrop-filter.backface-visibility.background.background-attachment.background-blend-mode.background-clip.background-color.background-image.background-origin.background-position.background-position-x.background-position-y.background-repeat.background-size.baseline-shift.block-size.border.border-block.border-block-color.border-block-end.border-block-end-color.border-block-end-style.border-block-end-width.border-block-start.border-block-start-color.border-block-start-style.border-block-start-width.border-block-style.border-block-width.border-bottom.border-bottom-color.border-bottom-left-radius.border-bottom-right-radius.border-bottom-style.border-bottom-width.border-collapse.border-color.border-end-end-radius.border-end-start-radius.border-image.border-image-outset.border-image-repeat.border-image-slice.border-image-source.border-image-width.border-inline.border-inline-color.border-inline-end.border-inline-end-color.border-inline-end-style.border-inline-end-width.border-inline-start.border-inline-start-color.border-inline-start-style.border-inline-start-width.border-inline-style.border-inline-width.border-left.border-left-color.border-left-style.border-left-width.border-radius.border-right.border-right-color.border-right-style.border-right-width.border-spacing.border-start-end-radius.border-start-start-radius.border-style.border-top.border-top-color.border-top-left-radius.border-top-right-radius.border-top-style.border-top-width.border-width.bottom.box-align.box-decoration-break.box-direction.box-flex.box-flex-group.box-lines.box-ordinal-group.box-orient.box-pack.box-shadow.box-sizing.break-after.break-before.break-inside.caption-side.caret-color.clear.clip.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.color-scheme.column-count.column-fill.column-gap.column-rule.column-rule-color.column-rule-style.column-rule-width.column-span.column-width.columns.contain.contain-intrinsic-block-size.contain-intrinsic-height.contain-intrinsic-inline-size.contain-intrinsic-size.contain-intrinsic-width.container.container-name.container-type.content.content-visibility.counter-increment.counter-reset.counter-set.cue.cue-after.cue-before.cursor.cx.cy.direction.display.dominant-baseline.empty-cells.enable-background.field-sizing.fill.fill-opacity.fill-rule.filter.flex.flex-basis.flex-direction.flex-flow.flex-grow.flex-shrink.flex-wrap.float.flood-color.flood-opacity.flow.font.font-display.font-family.font-feature-settings.font-kerning.font-language-override.font-optical-sizing.font-palette.font-size.font-size-adjust.font-smooth.font-smoothing.font-stretch.font-style.font-synthesis.font-synthesis-position.font-synthesis-small-caps.font-synthesis-style.font-synthesis-weight.font-variant.font-variant-alternates.font-variant-caps.font-variant-east-asian.font-variant-emoji.font-variant-ligatures.font-variant-numeric.font-variant-position.font-variation-settings.font-weight.forced-color-adjust.gap.glyph-orientation-horizontal.glyph-orientation-vertical.grid.grid-area.grid-auto-columns.grid-auto-flow.grid-auto-rows.grid-column.grid-column-end.grid-column-start.grid-gap.grid-row.grid-row-end.grid-row-start.grid-template.grid-template-areas.grid-template-columns.grid-template-rows.hanging-punctuation.height.hyphenate-character.hyphenate-limit-chars.hyphens.icon.image-orientation.image-rendering.image-resolution.ime-mode.initial-letter.initial-letter-align.inline-size.inset.inset-area.inset-block.inset-block-end.inset-block-start.inset-inline.inset-inline-end.inset-inline-start.isolation.justify-content.justify-items.justify-self.kerning.left.letter-spacing.lighting-color.line-break.line-height.line-height-step.list-style.list-style-image.list-style-position.list-style-type.margin.margin-block.margin-block-end.margin-block-start.margin-bottom.margin-inline.margin-inline-end.margin-inline-start.margin-left.margin-right.margin-top.margin-trim.marker.marker-end.marker-mid.marker-start.marks.mask.mask-border.mask-border-mode.mask-border-outset.mask-border-repeat.mask-border-slice.mask-border-source.mask-border-width.mask-clip.mask-composite.mask-image.mask-mode.mask-origin.mask-position.mask-repeat.mask-size.mask-type.masonry-auto-flow.math-depth.math-shift.math-style.max-block-size.max-height.max-inline-size.max-width.min-block-size.min-height.min-inline-size.min-width.mix-blend-mode.nav-down.nav-index.nav-left.nav-right.nav-up.none.normal.object-fit.object-position.offset.offset-anchor.offset-distance.offset-path.offset-position.offset-rotate.opacity.order.orphans.outline.outline-color.outline-offset.outline-style.outline-width.overflow.overflow-anchor.overflow-block.overflow-clip-margin.overflow-inline.overflow-wrap.overflow-x.overflow-y.overlay.overscroll-behavior.overscroll-behavior-block.overscroll-behavior-inline.overscroll-behavior-x.overscroll-behavior-y.padding.padding-block.padding-block-end.padding-block-start.padding-bottom.padding-inline.padding-inline-end.padding-inline-start.padding-left.padding-right.padding-top.page.page-break-after.page-break-before.page-break-inside.paint-order.pause.pause-after.pause-before.perspective.perspective-origin.place-content.place-items.place-self.pointer-events.position.position-anchor.position-visibility.print-color-adjust.quotes.r.resize.rest.rest-after.rest-before.right.rotate.row-gap.ruby-align.ruby-position.scale.scroll-behavior.scroll-margin.scroll-margin-block.scroll-margin-block-end.scroll-margin-block-start.scroll-margin-bottom.scroll-margin-inline.scroll-margin-inline-end.scroll-margin-inline-start.scroll-margin-left.scroll-margin-right.scroll-margin-top.scroll-padding.scroll-padding-block.scroll-padding-block-end.scroll-padding-block-start.scroll-padding-bottom.scroll-padding-inline.scroll-padding-inline-end.scroll-padding-inline-start.scroll-padding-left.scroll-padding-right.scroll-padding-top.scroll-snap-align.scroll-snap-stop.scroll-snap-type.scroll-timeline.scroll-timeline-axis.scroll-timeline-name.scrollbar-color.scrollbar-gutter.scrollbar-width.shape-image-threshold.shape-margin.shape-outside.shape-rendering.speak.speak-as.src.stop-color.stop-opacity.stroke.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke-width.tab-size.table-layout.text-align.text-align-all.text-align-last.text-anchor.text-combine-upright.text-decoration.text-decoration-color.text-decoration-line.text-decoration-skip.text-decoration-skip-ink.text-decoration-style.text-decoration-thickness.text-emphasis.text-emphasis-color.text-emphasis-position.text-emphasis-style.text-indent.text-justify.text-orientation.text-overflow.text-rendering.text-shadow.text-size-adjust.text-transform.text-underline-offset.text-underline-position.text-wrap.text-wrap-mode.text-wrap-style.timeline-scope.top.touch-action.transform.transform-box.transform-origin.transform-style.transition.transition-behavior.transition-delay.transition-duration.transition-property.transition-timing-function.translate.unicode-bidi.user-modify.user-select.vector-effect.vertical-align.view-timeline.view-timeline-axis.view-timeline-inset.view-timeline-name.view-transition-name.visibility.voice-balance.voice-duration.voice-family.voice-pitch.voice-range.voice-rate.voice-stress.voice-volume.white-space.white-space-collapse.widows.width.will-change.word-break.word-spacing.word-wrap.writing-mode.x.y.z-index.zoom`.split(`.`).sort().reverse();function dC(e){let t=rC(e),n=lC,r=cC,i=`@[a-z-]+`,a={className:`variable`,begin:`(\\$[a-zA-Z-][a-zA-Z0-9_-]*)\\b`,relevance:0};return{name:`SCSS`,case_insensitive:!0,illegal:`[=/|']`,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:`selector-id`,begin:`#[A-Za-z0-9_-]+`,relevance:0},{className:`selector-class`,begin:`\\.[A-Za-z0-9_-]+`,relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:`selector-tag`,begin:`\\b(`+oC.join(`|`)+`)\\b`,relevance:0},{className:`selector-pseudo`,begin:`:(`+r.join(`|`)+`)`},{className:`selector-pseudo`,begin:`:(:)?(`+n.join(`|`)+`)`},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:`attribute`,begin:`\\b(`+uC.join(`|`)+`)\\b`},{begin:`\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b`},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:`@(page|font-face)`,keywords:{$pattern:i,keyword:`@page @font-face`}},{begin:`@`,end:`[{;]`,returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:`and or not only`,attribute:sC.join(` `)},contains:[{begin:i,className:`keyword`},{begin:/[a-z-]+(?=:)/,className:`attribute`},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function fC(e){return{name:`Shell Session`,aliases:[`console`,`shellsession`],contains:[{className:`meta.prompt`,begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:`bash`}}]}}function pC(e){let t=e.regex,n=e.COMMENT(`--`,`$`),r={scope:`string`,variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=[`true`,`false`,`unknown`],o=[`double precision`,`large object`,`with timezone`,`without timezone`],s=`bigint.binary.blob.boolean.char.character.clob.date.dec.decfloat.decimal.float.int.integer.interval.nchar.nclob.national.numeric.real.row.smallint.time.timestamp.varchar.varying.varbinary`.split(`.`),c=[`add`,`asc`,`collation`,`desc`,`final`,`first`,`last`,`view`],l=`abs.acos.all.allocate.alter.and.any.are.array.array_agg.array_max_cardinality.as.asensitive.asin.asymmetric.at.atan.atomic.authorization.avg.begin.begin_frame.begin_partition.between.bigint.binary.blob.boolean.both.by.call.called.cardinality.cascaded.case.cast.ceil.ceiling.char.char_length.character.character_length.check.classifier.clob.close.coalesce.collate.collect.column.commit.condition.connect.constraint.contains.convert.copy.corr.corresponding.cos.cosh.count.covar_pop.covar_samp.create.cross.cube.cume_dist.current.current_catalog.current_date.current_default_transform_group.current_path.current_role.current_row.current_schema.current_time.current_timestamp.current_path.current_role.current_transform_group_for_type.current_user.cursor.cycle.date.day.deallocate.dec.decimal.decfloat.declare.default.define.delete.dense_rank.deref.describe.deterministic.disconnect.distinct.double.drop.dynamic.each.element.else.empty.end.end_frame.end_partition.end-exec.equals.escape.every.except.exec.execute.exists.exp.external.extract.false.fetch.filter.first_value.float.floor.for.foreign.frame_row.free.from.full.function.fusion.get.global.grant.group.grouping.groups.having.hold.hour.identity.in.indicator.initial.inner.inout.insensitive.insert.int.integer.intersect.intersection.interval.into.is.join.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.language.large.last_value.lateral.lead.leading.left.like.like_regex.listagg.ln.local.localtime.localtimestamp.log.log10.lower.match.match_number.match_recognize.matches.max.member.merge.method.min.minute.mod.modifies.module.month.multiset.national.natural.nchar.nclob.new.no.none.normalize.not.nth_value.ntile.null.nullif.numeric.octet_length.occurrences_regex.of.offset.old.omit.on.one.only.open.or.order.out.outer.over.overlaps.overlay.parameter.partition.pattern.per.percent.percent_rank.percentile_cont.percentile_disc.period.portion.position.position_regex.power.precedes.precision.prepare.primary.procedure.ptf.range.rank.reads.real.recursive.ref.references.referencing.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.release.result.return.returns.revoke.right.rollback.rollup.row.row_number.rows.running.savepoint.scope.scroll.search.second.seek.select.sensitive.session_user.set.show.similar.sin.sinh.skip.smallint.some.specific.specifictype.sql.sqlexception.sqlstate.sqlwarning.sqrt.start.static.stddev_pop.stddev_samp.submultiset.subset.substring.substring_regex.succeeds.sum.symmetric.system.system_time.system_user.table.tablesample.tan.tanh.then.time.timestamp.timezone_hour.timezone_minute.to.trailing.translate.translate_regex.translation.treat.trigger.trim.trim_array.true.truncate.uescape.union.unique.unknown.unnest.update.upper.user.using.value.values.value_of.var_pop.var_samp.varbinary.varchar.varying.versioning.when.whenever.where.width_bucket.window.with.within.without.year`.split(`.`),u=`abs.acos.array_agg.asin.atan.avg.cast.ceil.ceiling.coalesce.corr.cos.cosh.count.covar_pop.covar_samp.cume_dist.dense_rank.deref.element.exp.extract.first_value.floor.json_array.json_arrayagg.json_exists.json_object.json_objectagg.json_query.json_table.json_table_primitive.json_value.lag.last_value.lead.listagg.ln.log.log10.lower.max.min.mod.nth_value.ntile.nullif.percent_rank.percentile_cont.percentile_disc.position.position_regex.power.rank.regr_avgx.regr_avgy.regr_count.regr_intercept.regr_r2.regr_slope.regr_sxx.regr_sxy.regr_syy.row_number.sin.sinh.sqrt.stddev_pop.stddev_samp.substring.substring_regex.sum.tan.tanh.translate.translate_regex.treat.trim.trim_array.unnest.upper.value_of.var_pop.var_samp.width_bucket`.split(`.`),d=[`current_catalog`,`current_date`,`current_default_transform_group`,`current_path`,`current_role`,`current_schema`,`current_transform_group_for_type`,`current_user`,`session_user`,`system_time`,`system_user`,`current_time`,`localtime`,`current_timestamp`,`localtimestamp`],f=[`create table`,`insert into`,`primary key`,`foreign key`,`not null`,`alter table`,`add constraint`,`grouping sets`,`on overflow`,`character set`,`respect nulls`,`ignore nulls`,`nulls first`,`nulls last`,`depth first`,`breadth first`],p=u,m=[...l,...c].filter(e=>!u.includes(e)),h={scope:`variable`,match:/@[a-z0-9][a-z0-9_]*/},g={scope:`operator`,match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},_={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function v(e){return t.concat(/\b/,t.either(...e.map(e=>e.replace(/\s+/,`\\s+`))),/\b/)}let y={scope:`keyword`,match:v(f),relevance:0};function b(e,{exceptions:t,when:n}={}){let r=n;return t||=[],e.map(e=>e.match(/\|\d+$/)||t.includes(e)?e:r(e)?`${e}|0`:e)}return{name:`SQL`,case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:b(m,{when:e=>e.length<3}),literal:a,type:s,built_in:d},contains:[{scope:`type`,match:v(o)},y,_,h,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,g]}}function mC(e){return e?typeof e==`string`?e:e.source:null}function hC(e){return gC(`(?=`,e,`)`)}function gC(...e){return e.map(e=>mC(e)).join(``)}function _C(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function vC(...e){return`(`+(_C(e).capture?``:`?:`)+e.map(e=>mC(e)).join(`|`)+`)`}var yC=e=>gC(/\b/,e,/\w$/.test(e)?/\b/:/\B/),bC=[`Protocol`,`Type`].map(yC),xC=[`init`,`self`].map(yC),SC=[`Any`,`Self`],CC=[`actor`,`any`,`associatedtype`,`async`,`await`,/as\?/,/as!/,`as`,`borrowing`,`break`,`case`,`catch`,`class`,`consume`,`consuming`,`continue`,`convenience`,`copy`,`default`,`defer`,`deinit`,`didSet`,`distributed`,`do`,`dynamic`,`each`,`else`,`enum`,`extension`,`fallthrough`,/fileprivate\(set\)/,`fileprivate`,`final`,`for`,`func`,`get`,`guard`,`if`,`import`,`indirect`,`infix`,/init\?/,/init!/,`inout`,/internal\(set\)/,`internal`,`in`,`is`,`isolated`,`nonisolated`,`lazy`,`let`,`macro`,`mutating`,`nonmutating`,/open\(set\)/,`open`,`operator`,`optional`,`override`,`package`,`postfix`,`precedencegroup`,`prefix`,/private\(set\)/,`private`,`protocol`,/public\(set\)/,`public`,`repeat`,`required`,`rethrows`,`return`,`set`,`some`,`static`,`struct`,`subscript`,`super`,`switch`,`throws`,`throw`,/try\?/,/try!/,`try`,`typealias`,/unowned\(safe\)/,/unowned\(unsafe\)/,`unowned`,`var`,`weak`,`where`,`while`,`willSet`],wC=[`false`,`nil`,`true`],TC=[`assignment`,`associativity`,`higherThan`,`left`,`lowerThan`,`none`,`right`],EC=[`#colorLiteral`,`#column`,`#dsohandle`,`#else`,`#elseif`,`#endif`,`#error`,`#file`,`#fileID`,`#fileLiteral`,`#filePath`,`#function`,`#if`,`#imageLiteral`,`#keyPath`,`#line`,`#selector`,`#sourceLocation`,`#warning`],DC=`abs.all.any.assert.assertionFailure.debugPrint.dump.fatalError.getVaList.isKnownUniquelyReferenced.max.min.numericCast.pointwiseMax.pointwiseMin.precondition.preconditionFailure.print.readLine.repeatElement.sequence.stride.swap.swift_unboxFromSwiftValueWithType.transcode.type.unsafeBitCast.unsafeDowncast.withExtendedLifetime.withUnsafeMutablePointer.withUnsafePointer.withVaList.withoutActuallyEscaping.zip`.split(`.`),OC=vC(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),kC=vC(OC,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),AC=gC(OC,kC,`*`),jC=vC(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),MC=vC(jC,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),NC=gC(jC,MC,`*`),PC=gC(/[A-Z]/,MC,`*`),FC=[`attached`,`autoclosure`,gC(/convention\(/,vC(`swift`,`block`,`c`),/\)/),`discardableResult`,`dynamicCallable`,`dynamicMemberLookup`,`escaping`,`freestanding`,`frozen`,`GKInspectable`,`IBAction`,`IBDesignable`,`IBInspectable`,`IBOutlet`,`IBSegueAction`,`inlinable`,`main`,`nonobjc`,`NSApplicationMain`,`NSCopying`,`NSManaged`,gC(/objc\(/,NC,/\)/),`objc`,`objcMembers`,`propertyWrapper`,`requires_stored_property_inits`,`resultBuilder`,`Sendable`,`testable`,`UIApplicationMain`,`unchecked`,`unknown`,`usableFromInline`,`warn_unqualified_access`],IC=[`iOS`,`iOSApplicationExtension`,`macOS`,`macOSApplicationExtension`,`macCatalyst`,`macCatalystApplicationExtension`,`watchOS`,`watchOSApplicationExtension`,`tvOS`,`tvOSApplicationExtension`,`swift`];function LC(e){let t={match:/\s+/,relevance:0},n=e.COMMENT(`/\\*`,`\\*/`,{contains:[`self`]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,vC(...bC,...xC)],className:{2:`keyword`}},a={match:gC(/\./,vC(...CC)),relevance:0},o=CC.filter(e=>typeof e==`string`).concat([`_|0`]),s={variants:[{className:`keyword`,match:vC(...CC.filter(e=>typeof e!=`string`).concat(SC).map(yC),...xC)}]},c={$pattern:vC(/\b\w+/,/#\w+/),keyword:o.concat(EC),literal:wC},l=[i,a,s],u=[{match:gC(/\./,vC(...DC)),relevance:0},{className:`built_in`,match:gC(/\b/,vC(...DC),/(?=\()/)}],d={match:/->/,relevance:0},f=[d,{className:`operator`,relevance:0,variants:[{match:AC},{match:`\\.(\\.|${kC})+`}]}],p=`([0-9]_*)+`,m=`([0-9a-fA-F]_*)+`,h={className:`number`,relevance:0,variants:[{match:`\\b(${p})(\\.(${p}))?([eE][+-]?(${p}))?\\b`},{match:`\\b0x(${m})(\\.(${m}))?([pP][+-]?(${p}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(e=``)=>({className:`subst`,variants:[{match:gC(/\\/,e,/[0\\tnr"']/)},{match:gC(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),_=(e=``)=>({className:`subst`,match:gC(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),v=(e=``)=>({className:`subst`,label:`interpol`,begin:gC(/\\/,e,/\(/),end:/\)/}),y=(e=``)=>({begin:gC(e,/"""/),end:gC(/"""/,e),contains:[g(e),_(e),v(e)]}),b=(e=``)=>({begin:gC(e,/"/),end:gC(/"/,e),contains:[g(e),v(e)]}),x={className:`string`,variants:[y(),y(`#`),y(`##`),y(`###`),b(),b(`#`),b(`##`),b(`###`)]},S=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],C={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:S},w=e=>{let t=gC(e,/\//),n=gC(/\//,e);return{begin:t,end:n,contains:[...S,{scope:`comment`,begin:`#(?!.*${n})`,end:/$/}]}},T={scope:`regexp`,variants:[w(`###`),w(`##`),w(`#`),C]},E={match:gC(/`/,NC,/`/)},D=[E,{className:`variable`,match:/\$\d+/},{className:`variable`,match:`\\$${MC}+`}],O=[{match:/(@|#(un)?)available/,scope:`keyword`,starts:{contains:[{begin:/\(/,end:/\)/,keywords:IC,contains:[...f,h,x]}]}},{scope:`keyword`,match:gC(/@/,vC(...FC),hC(vC(/\(/,/\s+/)))},{scope:`meta`,match:gC(/@/,NC)}],k={match:hC(/\b[A-Z]/),relevance:0,contains:[{className:`type`,match:gC(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,MC,`+`)},{className:`type`,match:PC,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:gC(/\s+&\s+/,hC(PC)),relevance:0}]},A={begin:/</,end:/>/,keywords:c,contains:[...r,...l,...O,d,k]};k.contains.push(A);let j={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:[`self`,{match:gC(NC,/\s*:/),keywords:`_|0`,relevance:0},...r,T,...l,...u,...f,h,x,...D,...O,k]},M={begin:/</,end:/>/,keywords:`repeat each`,contains:[...r,k]},N={begin:/\(/,end:/\)/,keywords:c,contains:[{begin:vC(hC(gC(NC,/\s*:/)),hC(gC(NC,/\s+/,NC,/\s*:/))),end:/:/,relevance:0,contains:[{className:`keyword`,match:/\b_\b/},{className:`params`,match:NC}]},...r,...l,...f,h,x,...O,k,j],endsParent:!0,illegal:/["']/},P={match:[/(func|macro)/,/\s+/,vC(E.match,NC,AC)],className:{1:`keyword`,3:`title.function`},contains:[M,N,t],illegal:[/\[/,/%/]},ee={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:`keyword`},contains:[M,N,t],illegal:/\[|%/},F={match:[/operator/,/\s+/,AC],className:{1:`keyword`,3:`title`}},I={begin:[/precedencegroup/,/\s+/,PC],className:{1:`keyword`,3:`title`},contains:[k],keywords:[...TC,...wC],end:/}/},L={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:`keyword`,3:`keyword`,5:`title.function`}},te={match:[/class\b/,/\s+/,/var\b/],scope:{1:`keyword`,3:`keyword`}},ne={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,NC,/\s*/],beginScope:{1:`keyword`,3:`title.class`},keywords:c,contains:[M,...l,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:`title.class.inherited`,match:PC},...l],relevance:0}]};for(let e of x.variants){let t=e.contains.find(e=>e.label===`interpol`);t.keywords=c;let n=[...l,...u,...f,h,x,...D];t.contains=[...n,{begin:/\(/,end:/\)/,contains:[`self`,...n]}]}return{name:`Swift`,keywords:c,contains:[...r,P,ee,L,te,ne,F,I,{beginKeywords:`import`,end:/$/,contains:[...r],relevance:0},T,...l,...u,...f,h,x,...D,...O,k,j]}}var RC=`[A-Za-z$_][0-9A-Za-z$_]*`,zC=`as.in.of.if.for.while.finally.var.new.function.do.return.void.else.break.catch.instanceof.with.throw.case.default.try.switch.continue.typeof.delete.let.yield.const.class.debugger.async.await.static.import.from.export.extends.using`.split(`.`),BC=[`true`,`false`,`null`,`undefined`,`NaN`,`Infinity`],VC=`Object.Function.Boolean.Symbol.Math.Date.Number.BigInt.String.RegExp.Array.Float32Array.Float64Array.Int8Array.Uint8Array.Uint8ClampedArray.Int16Array.Int32Array.Uint16Array.Uint32Array.BigInt64Array.BigUint64Array.Set.Map.WeakSet.WeakMap.ArrayBuffer.SharedArrayBuffer.Atomics.DataView.JSON.Promise.Generator.GeneratorFunction.AsyncFunction.Reflect.Proxy.Intl.WebAssembly`.split(`.`),HC=[`Error`,`EvalError`,`InternalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],UC=[`setInterval`,`setTimeout`,`clearInterval`,`clearTimeout`,`require`,`exports`,`eval`,`isFinite`,`isNaN`,`parseFloat`,`parseInt`,`decodeURI`,`decodeURIComponent`,`encodeURI`,`encodeURIComponent`,`escape`,`unescape`],WC=[`arguments`,`this`,`super`,`console`,`window`,`document`,`localStorage`,`sessionStorage`,`module`,`global`],GC=[].concat(UC,VC,HC);function KC(e){let t=e.regex,n=(e,{after:t})=>{let n=`</`+e[0].slice(1);return e.input.indexOf(n,t)!==-1},r=RC,i={begin:`<>`,end:`</>`},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,t)=>{let r=e[0].length+e.index,i=e.input[r];if(i===`<`||i===`,`){t.ignoreMatch();return}i===`>`&&(n(e,{after:r})||t.ignoreMatch());let a,o=e.input.substring(r);if(a=o.match(/^\s*=/)){t.ignoreMatch();return}if((a=o.match(/^\s+extends\s+/))&&a.index===0){t.ignoreMatch();return}}},s={$pattern:RC,keyword:zC,literal:BC,built_in:GC,"variable.language":WC},c=`[0-9](_?[0-9])*`,l=`\\.(${c})`,u=`0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*`,d={className:`number`,variants:[{begin:`(\\b(${u})((${l})|\\.)?|(${l}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${l})\\b|\\.)?|(${l})\\b`},{begin:`\\b(0|[1-9](_?[0-9])*)n\\b`},{begin:`\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b`},{begin:`\\b0[bB][0-1](_?[0-1])*n?\\b`},{begin:`\\b0[oO][0-7](_?[0-7])*n?\\b`},{begin:`\\b0[0-7]+n?\\b`}],relevance:0},f={className:`subst`,begin:`\\$\\{`,end:`\\}`,keywords:s,contains:[]},p={begin:".?html`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`xml`}},m={begin:".?css`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`css`}},h={begin:".?gql`",end:``,starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:`graphql`}},g={className:`string`,begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},_={className:`comment`,variants:[e.COMMENT(/\/\*\*(?!\/)/,`\\*/`,{relevance:0,contains:[{begin:`(?=@[A-Za-z]+)`,relevance:0,contains:[{className:`doctag`,begin:`@[A-Za-z]+`},{className:`type`,begin:`\\{`,end:`\\}`,excludeEnd:!0,excludeBegin:!0,relevance:0},{className:`variable`,begin:`[A-Za-z$_][0-9A-Za-z$_]*(?=\\s*(-)|$)`,endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:s,contains:[`self`].concat(v)});let y=[].concat(_,f.contains),b=y.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:[`self`].concat(y)}]),x={className:`params`,begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b},S={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,`(`,t.concat(/\./,r),`)*`)],scope:{1:`keyword`,3:`title.class`,5:`keyword`,7:`title.class.inherited`}},{match:[/class/,/\s+/,r],scope:{1:`keyword`,3:`title.class`}}]},C={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:`title.class`,keywords:{_:[...VC,...HC]}},w={label:`use_strict`,className:`meta`,relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:`keyword`,3:`title.function`},label:`func.def`,contains:[x],illegal:/%/},E={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:`variable.constant`};function D(e){return t.concat(`(?!`,e.join(`|`),`)`)}let O={match:t.concat(/\b/,D([...UC,`super`,`import`].map(e=>`${e}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:`title.function`,relevance:0},k={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:`prototype`,className:`property`,relevance:0},A={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:`keyword`,3:`title.function`},contains:[{begin:/\(\)/},x]},j=`(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|`+e.UNDERSCORE_IDENT_RE+`)\\s*=>`,M={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(j)],keywords:`async`,className:{1:`keyword`,3:`title.function`},contains:[x]};return{name:`JavaScript`,aliases:[`js`,`jsx`,`mjs`,`cjs`],keywords:s,exports:{PARAMS_CONTAINS:b,CLASS_REFERENCE:C},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:`shebang`,binary:`node`,relevance:5}),w,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,h,g,_,{match:/\$\d+/},d,C,{scope:`attr`,match:r+t.lookahead(`:`),relevance:0},M,{begin:`(`+e.RE_STARTERS_RE+`|\\b(case|return|throw)\\b)\\s*`,keywords:`return throw case`,relevance:0,contains:[_,e.REGEXP_MODE,{className:`function`,begin:j,returnBegin:!0,end:`\\s*=>`,contains:[{className:`params`,variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:b}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:`xml`,contains:[{begin:o.begin,end:o.end,skip:!0,contains:[`self`]}]}]},T,{beginKeywords:`while if switch catch for`},{begin:`\\b(?!function)`+e.UNDERSCORE_IDENT_RE+`\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{`,returnBegin:!0,label:`func.def`,contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:`title.function`})]},{match:/\.\.\./,relevance:0},k,{match:`\\$[A-Za-z$_][0-9A-Za-z$_]*`,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:`title.function`},contains:[x]},O,E,S,A,{match:/\$[(.]/}]}}function qC(e){let t=e.regex,n=KC(e),r=RC,i=[`any`,`void`,`number`,`boolean`,`string`,`object`,`never`,`symbol`,`bigint`,`unknown`],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:`keyword`,3:`title.class`}},o={beginKeywords:`interface`,end:/\{/,excludeEnd:!0,keywords:{keyword:`interface extends`,built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:`meta`,relevance:10,begin:/^\s*['"]use strict['"]/},c={$pattern:RC,keyword:zC.concat([`type`,`interface`,`public`,`private`,`protected`,`implements`,`declare`,`abstract`,`readonly`,`enum`,`override`,`satisfies`]),literal:BC,built_in:GC.concat(i),"variable.language":WC},l={className:`meta`,begin:`@[A-Za-z$_][0-9A-Za-z$_]*`},u=(e,t,n)=>{let r=e.contains.findIndex(e=>e.label===t);if(r===-1)throw Error(`can not find mode to replace`);e.contains.splice(r,1,n)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(l);let d=n.contains.find(e=>e.scope===`attr`),f=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,f]),n.contains=n.contains.concat([l,a,o,f]),u(n,`shebang`,e.SHEBANG()),u(n,`use_strict`,s);let p=n.contains.find(e=>e.label===`func.def`);return p.relevance=0,Object.assign(n,{name:`TypeScript`,aliases:[`ts`,`tsx`,`mts`,`cts`]}),n}function JC(e){let t=e.regex,n={className:`string`,begin:/"(""|[^/n])"C\b/},r={className:`string`,begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:`literal`,variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},l={className:`number`,relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:`label`,begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:`doctag`,begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:`Visual Basic .NET`,aliases:[`vb`],case_insensitive:!0,classNameAliases:{label:`symbol`},keywords:{keyword:`addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield`,built_in:`addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort`,type:`boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort`,literal:`true false nothing`},illegal:`//|\\{|\\}|endif|gosub|variant|wend|^\\$ `,contains:[n,r,c,l,u,d,f,{className:`meta`,begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:`const disable else elseif enable end externalsource if region then`},contains:[f]}]}}function YC(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);return t.contains.push(`self`),{name:`WebAssembly`,keywords:{$pattern:/[\w.]+/,keyword:`anyfunc,block,br,br_if,br_table,call,call_indirect,data,drop,elem,else,end,export,func,global.get,global.set,local.get,local.set,local.tee,get_global,get_local,global,if,import,local,loop,memory,memory.grow,memory.size,module,mut,nop,offset,param,result,return,select,set_global,set_local,start,table,tee_local,then,type,unreachable`.split(`,`)},contains:[e.COMMENT(/;;/,/$/),t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:`keyword`,3:`operator`}},{className:`variable`,begin:/\$[\w_]+/},{match:/(\((?!;)|\))+/,className:`punctuation`,relevance:0},{begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:`keyword`,3:`title.function`}},e.QUOTE_STRING_MODE,{match:/(i32|i64|f32|f64)(?!\.)/,className:`type`},{className:`keyword`,match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/},{className:`number`,relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/}]}}function XC(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:`symbol`,begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:`keyword`,begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:`string`}),c=e.inherit(e.QUOTE_STRING_MODE,{className:`string`}),l={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:`attr`,begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:`string`,endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[i]},{begin:/'/,end:/'/,contains:[i]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:`HTML, XML`,aliases:[`html`,`xhtml`,`rss`,`atom`,`xjb`,`xsd`,`xsl`,`plist`,`wsf`,`svg`],case_insensitive:!0,unicodeRegex:!0,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,relevance:10,contains:[a,c,s,o,{begin:/\[/,end:/\]/,contains:[{className:`meta`,begin:/<![a-z]/,end:/>/,contains:[a,o,c,s]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},i,{className:`meta`,end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:`tag`,begin:/<style(?=\s|>)/,end:/>/,keywords:{name:`style`},contains:[l],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:[`css`,`xml`]}},{className:`tag`,begin:/<script(?=\s|>)/,end:/>/,keywords:{name:`script`},contains:[l],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:[`javascript`,`handlebars`,`xml`]}},{className:`tag`,begin:/<>|<\/>/},{className:`tag`,begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:`name`,begin:n,relevance:0,starts:l}]},{className:`tag`,begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:`name`,begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function ZC(e){let t=`true false yes no null`,n={className:`attr`,variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},r={className:`template-variable`,variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:`string`,relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:`char.escape`,relevance:0}]},a={className:`string`,relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,r]},o=e.inherit(a,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),s={className:`number`,begin:`\\b[0-9]{4}(-[0-9][0-9]){0,2}([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?(\\.[0-9]*)?([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?\\b`},c={end:`,`,endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},l={begin:/\{/,end:/\}/,contains:[c],illegal:`\\n`,relevance:0},u={begin:`\\[`,end:`\\]`,contains:[c],illegal:`\\n`,relevance:0},d=[n,{className:`meta`,begin:`^---\\s*$`,relevance:10},{className:`string`,begin:`[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*`},{begin:`<%[%=-]?`,end:`[%-]?%>`,subLanguage:`ruby`,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:`type`,begin:`!\\w+![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!<[\\w#;/?:@&=+$,.~*'()[\\]]+>`},{className:`type`,begin:`![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`type`,begin:`!![\\w#;/?:@&=+$,.~*'()[\\]]+`},{className:`meta`,begin:`&`+e.UNDERSCORE_IDENT_RE+`$`},{className:`meta`,begin:`\\*`+e.UNDERSCORE_IDENT_RE+`$`},{className:`bullet`,begin:`-(?=[ ]|$)`,relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},s,{className:`number`,begin:e.C_NUMBER_RE+`\\b`,relevance:0},l,u,i,a],f=[...d];return f.pop(),f.push(o),c.contains=f,{name:`YAML`,case_insensitive:!0,aliases:[`yml`],contains:d}}var QC={arduino:Yx,bash:Xx,c:Zx,cpp:Qx,csharp:$x,css:cS,diff:lS,go:uS,graphql:dS,ini:fS,java:vS,javascript:DS,json:OS,kotlin:NS,less:US,lua:WS,makefile:GS,markdown:KS,objectivec:qS,perl:JS,php:YS,"php-template":XS,plaintext:ZS,python:QS,"python-repl":$S,r:eC,ruby:tC,rust:nC,scss:dC,shell:fC,sql:pC,swift:LC,typescript:qC,vbnet:JC,wasm:YC,xml:XC,yaml:ZC},$C=l(o(((e,t)=>{function n(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw Error(`map is read-only`)}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw Error(`set is read-only`)}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let r=e[t],i=typeof r;(i===`object`||i===`function`)&&!Object.isFrozen(r)&&n(r)}),e}var r=class{constructor(e){e.data===void 0&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function i(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#x27;`)}function a(e,...t){let n=Object.create(null);for(let t in e)n[t]=e[t];return t.forEach(function(e){for(let t in e)n[t]=e[t]}),n}var o=`</span>`,s=e=>!!e.scope,c=(e,{prefix:t})=>{if(e.startsWith(`language:`))return e.replace(`language:`,`language-`);if(e.includes(`.`)){let n=e.split(`.`);return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${`_`.repeat(t+1)}`)].join(` `)}return`${t}${e}`},l=class{constructor(e,t){this.buffer=``,this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=i(e)}openNode(e){if(!s(e))return;let t=c(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){s(e)&&(this.buffer+=o)}value(){return this.buffer}span(e){this.buffer+=`<span class="${e}">`}},u=(e={})=>{let t={children:[]};return Object.assign(t,e),t},d=class e{constructor(){this.rootNode=u(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){let t=u({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return typeof t==`string`?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(t){typeof t!=`string`&&t.children&&(t.children.every(e=>typeof e==`string`)?t.children=[t.children.join(``)]:t.children.forEach(t=>{e._collapse(t)}))}},f=class extends d{constructor(e){super(),this.options=e}addText(e){e!==``&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){let n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function p(e){return e?typeof e==`string`?e:e.source:null}function m(e){return _(`(?=`,e,`)`)}function h(e){return _(`(?:`,e,`)*`)}function g(e){return _(`(?:`,e,`)?`)}function _(...e){return e.map(e=>p(e)).join(``)}function v(e){let t=e[e.length-1];return typeof t==`object`&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function y(...e){return`(`+(v(e).capture?``:`?:`)+e.map(e=>p(e)).join(`|`)+`)`}function b(e){return RegExp(e.toString()+`|`).exec(``).length-1}function x(e,t){let n=e&&e.exec(t);return n&&n.index===0}var S=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;let t=n,r=p(e),i=``;for(;r.length>0;){let e=S.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),e[0][0]===`\\`&&e[1]?i+=`\\`+String(Number(e[1])+t):(i+=e[0],e[0]===`(`&&n++)}return i}).map(e=>`(${e})`).join(t)}var w=/\b\B/,T=`[a-zA-Z]\\w*`,E=`[a-zA-Z_]\\w*`,D=`\\b\\d+(\\.\\d+)?`,O=`(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)`,k=`\\b(0b[01]+)`,A=`!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~`,j=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=_(t,/.*\b/,e.binary,/\b.*/)),a({scope:`meta`,begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{e.index!==0&&t.ignoreMatch()}},e)},M={begin:`\\\\[\\s\\S]`,relevance:0},N={scope:`string`,begin:`'`,end:`'`,illegal:`\\n`,contains:[M]},P={scope:`string`,begin:`"`,end:`"`,illegal:`\\n`,contains:[M]},ee={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},F=function(e,t,n={}){let r=a({scope:`comment`,begin:e,end:t,contains:[]},n);r.contains.push({scope:`doctag`,begin:`[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)`,end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=y(`I`,`a`,`is`,`so`,`us`,`to`,`at`,`if`,`in`,`it`,`on`,/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:_(/[ ]+/,`(`,i,/[.]?[:]?([.][ ]|[ ])/,`){3}`)}),r},I=F(`//`,`$`),L=F(`/\\*`,`\\*/`),te=F(`#`,`$`),ne=Object.freeze({__proto__:null,APOS_STRING_MODE:N,BACKSLASH_ESCAPE:M,BINARY_NUMBER_MODE:{scope:`number`,begin:k,relevance:0},BINARY_NUMBER_RE:k,COMMENT:F,C_BLOCK_COMMENT_MODE:L,C_LINE_COMMENT_MODE:I,C_NUMBER_MODE:{scope:`number`,begin:O,relevance:0},C_NUMBER_RE:O,END_SAME_AS_BEGIN:function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})},HASH_COMMENT_MODE:te,IDENT_RE:T,MATCH_NOTHING_RE:w,METHOD_GUARD:{begin:`\\.\\s*[a-zA-Z_]\\w*`,relevance:0},NUMBER_MODE:{scope:`number`,begin:D,relevance:0},NUMBER_RE:D,PHRASAL_WORDS_MODE:ee,QUOTE_STRING_MODE:P,REGEXP_MODE:{scope:`regexp`,begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[M,{begin:/\[/,end:/\]/,relevance:0,contains:[M]}]},RE_STARTERS_RE:A,SHEBANG:j,TITLE_MODE:{scope:`title`,begin:T,relevance:0},UNDERSCORE_IDENT_RE:E,UNDERSCORE_TITLE_MODE:{scope:`title`,begin:E,relevance:0}});function re(e,t){e.input[e.index-1]===`.`&&t.ignoreMatch()}function R(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function ie(e,t){t&&e.beginKeywords&&(e.begin=`\\b(`+e.beginKeywords.split(` `).join(`|`)+`)(?!\\.)(?=\\b|\\s)`,e.__beforeBegin=re,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function ae(e,t){Array.isArray(e.illegal)&&(e.illegal=y(...e.illegal))}function oe(e,t){if(e.match){if(e.begin||e.end)throw Error(`begin & end are not supported with match`);e.begin=e.match,delete e.match}}function se(e,t){e.relevance===void 0&&(e.relevance=1)}var ce=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw Error(`beforeMatch cannot be used with starts`);let n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=_(n.beforeMatch,m(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},le=[`of`,`and`,`for`,`in`,`not`,`or`,`if`,`then`,`parent`,`list`,`value`],ue=`keyword`;function de(e,t,n=ue){let r=Object.create(null);return typeof e==`string`?i(n,e.split(` `)):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,de(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){let n=t.split(`|`);r[n[0]]=[e,fe(n[0],n[1])]})}}function fe(e,t){return t?Number(t):+!pe(e)}function pe(e){return le.includes(e.toLowerCase())}var me={},he=e=>{console.error(e)},ge=(e,...t)=>{console.log(`WARN: ${e}`,...t)},_e=(e,t)=>{me[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),me[`${e}/${t}`]=!0)},ve=Error();function ye(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let e=1;e<=t.length;e++)o[e+r]=i[e],a[e+r]=!0,r+=b(t[e-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function be(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw he(`skip, excludeBegin, returnBegin not compatible with beginScope: {}`),ve;if(typeof e.beginScope!=`object`||e.beginScope===null)throw he(`beginScope must be object`),ve;ye(e,e.begin,{key:`beginScope`}),e.begin=C(e.begin,{joinWith:``})}}function xe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw he(`skip, excludeEnd, returnEnd not compatible with endScope: {}`),ve;if(typeof e.endScope!=`object`||e.endScope===null)throw he(`endScope must be object`),ve;ye(e,e.end,{key:`endScope`}),e.end=C(e.end,{joinWith:``})}}function Se(e){e.scope&&typeof e.scope==`object`&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function Ce(e){Se(e),typeof e.beginScope==`string`&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope==`string`&&(e.endScope={_wrap:e.endScope}),be(e),xe(e)}function z(e){function t(t,n){return new RegExp(p(t),`m`+(e.case_insensitive?`i`:``)+(e.unicodeRegex?`u`:``)+(n?`g`:``))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=b(e)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let e=this.regexes.map(e=>e[1]);this.matcherRe=t(C(e,{joinWith:`|`}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;let t=this.matcherRe.exec(e);if(!t)return null;let n=t.findIndex((e,t)=>t>0&&e!==void 0),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];let t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),t.type===`begin`&&this.count++}exec(e){let t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition()&&!(n&&n.index===this.lastIndex)){let t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function i(e){let t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:`begin`})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:`end`}),e.illegal&&t.addRule(e.illegal,{type:`illegal`}),t}function o(n,r){let a=n;if(n.isCompiled)return a;[R,oe,Ce,ce].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[ie,ae,se].forEach(e=>e(n,r)),n.isCompiled=!0;let s=null;return typeof n.keywords==`object`&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),s=n.keywords.$pattern,delete n.keywords.$pattern),s||=/\w+/,n.keywords&&=de(n.keywords,e.case_insensitive),a.keywordPatternRe=t(s,!0),r&&(n.begin||=/\B|\b/,a.beginRe=t(a.begin),!n.end&&!n.endsWithParent&&(n.end=/\B|\b/),n.end&&(a.endRe=t(a.end)),a.terminatorEnd=p(a.end)||``,n.endsWithParent&&r.terminatorEnd&&(a.terminatorEnd+=(n.end?`|`:``)+r.terminatorEnd)),n.illegal&&(a.illegalRe=t(n.illegal)),n.contains||=[],n.contains=[].concat(...n.contains.map(function(e){return Te(e===`self`?n:e)})),n.contains.forEach(function(e){o(e,a)}),n.starts&&o(n.starts,r),a.matcher=i(a),a}if(e.compilerExtensions||=[],e.contains&&e.contains.includes(`self`))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=a(e.classNameAliases||{}),o(e)}function we(e){return e?e.endsWithParent||we(e.starts):!1}function Te(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return a(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:we(e)?a(e,{starts:e.starts?a(e.starts):null}):Object.isFrozen(e)?a(e):e}var Ee=`11.11.1`,De=class extends Error{constructor(e,t){super(e),this.name=`HTMLInjectionError`,this.html=t}},Oe=i,ke=a,Ae=Symbol(`nomatch`),je=7,Me=function(e){let t=Object.create(null),i=Object.create(null),a=[],o=!0,s=`Could not find the language '{}', did you forget to load/include a language module?`,c={disableAutodetect:!0,name:`Plain text`,contains:[]},l={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:`hljs-`,cssSelector:`pre code`,languages:null,__emitter:f};function u(e){return l.noHighlightRe.test(e)}function d(e){let t=e.className+` `;t+=e.parentNode?e.parentNode.className:``;let n=l.languageDetectRe.exec(t);if(n){let t=N(n[1]);return t||(ge(s.replace(`{}`,n[1])),ge(`Falling back to no-highlight mode for this block.`,e)),t?n[1]:`no-highlight`}return t.split(/\s+/).find(e=>u(e)||N(e))}function p(e,t,n){let r=``,i=``;typeof t==`object`?(r=e,n=t.ignoreIllegals,i=t.language):(_e(`10.7.0`,`highlight(lang, code, ...args) has been deprecated.`),_e(`10.7.0`,`Please use highlight(code, options) instead.
67
67
  https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(n=!0);let a={code:r,language:i};te(`before:highlight`,a);let o=a.result?a.result:v(a.language,a.code,n);return o.code=a.code,te(`after:highlight`,o),o}function v(e,n,i,a){let c=Object.create(null);function u(e,t){return e.keywords[t]}function d(){if(!A.keywords){M.addText(P);return}let e=0;A.keywordPatternRe.lastIndex=0;let t=A.keywordPatternRe.exec(P),n=``;for(;t;){n+=P.substring(e,t.index);let r=D.case_insensitive?t[0].toLowerCase():t[0],i=u(A,r);if(i){let[e,a]=i;if(M.addText(n),n=``,c[r]=(c[r]||0)+1,c[r]<=je&&(ee+=a),e.startsWith(`_`))n+=t[0];else{let n=D.classNameAliases[e]||e;m(t[0],n)}}else n+=t[0];e=A.keywordPatternRe.lastIndex,t=A.keywordPatternRe.exec(P)}n+=P.substring(e),M.addText(n)}function f(){if(P===``)return;let e=null;if(typeof A.subLanguage==`string`){if(!t[A.subLanguage]){M.addText(P);return}e=v(A.subLanguage,P,!0,j[A.subLanguage]),j[A.subLanguage]=e._top}else e=S(P,A.subLanguage.length?A.subLanguage:null);A.relevance>0&&(ee+=e.relevance),M.__addSublanguage(e._emitter,e.language)}function p(){A.subLanguage==null?d():f(),P=``}function m(e,t){e!==``&&(M.startScope(t),M.addText(e),M.endScope())}function h(e,t){let n=1,r=t.length-1;for(;n<=r;){if(!e._emit[n]){n++;continue}let r=D.classNameAliases[e[n]]||e[n],i=t[n];r?m(i,r):(P=i,d(),P=``),n++}}function g(e,t){return e.scope&&typeof e.scope==`string`&&M.openNode(D.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(m(P,D.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),P=``):e.beginScope._multi&&(h(e.beginScope,t),P=``)),A=Object.create(e,{parent:{value:A}}),A}function _(e,t,n){let i=x(e.endRe,n);if(i){if(e[`on:end`]){let n=new r(e);e[`on:end`](t,n),n.isMatchIgnored&&(i=!1)}if(i){for(;e.endsParent&&e.parent;)e=e.parent;return e}}if(e.endsWithParent)return _(e.parent,t,n)}function y(e){return A.matcher.regexIndex===0?(P+=e[0],1):(L=!0,0)}function b(e){let t=e[0],n=e.rule,i=new r(n),a=[n.__beforeBegin,n[`on:begin`]];for(let n of a)if(n&&(n(e,i),i.isMatchIgnored))return y(t);return n.skip?P+=t:(n.excludeBegin&&(P+=t),p(),!n.returnBegin&&!n.excludeBegin&&(P=t)),g(n,e),n.returnBegin?0:t.length}function C(e){let t=e[0],r=n.substring(e.index),i=_(A,e,r);if(!i)return Ae;let a=A;A.endScope&&A.endScope._wrap?(p(),m(t,A.endScope._wrap)):A.endScope&&A.endScope._multi?(p(),h(A.endScope,e)):a.skip?P+=t:(a.returnEnd||a.excludeEnd||(P+=t),p(),a.excludeEnd&&(P=t));do A.scope&&M.closeNode(),!A.skip&&!A.subLanguage&&(ee+=A.relevance),A=A.parent;while(A!==i.parent);return i.starts&&g(i.starts,e),a.returnEnd?0:t.length}function w(){let e=[];for(let t=A;t!==D;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>M.openNode(e))}let T={};function E(t,r){let a=r&&r[0];if(P+=t,a==null)return p(),0;if(T.type===`begin`&&r.type===`end`&&T.index===r.index&&a===``){if(P+=n.slice(r.index,r.index+1),!o){let t=Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=T.rule,t}return 1}if(T=r,r.type===`begin`)return b(r);if(r.type===`illegal`&&!i){let e=Error(`Illegal lexeme "`+a+`" for mode "`+(A.scope||`<unnamed>`)+`"`);throw e.mode=A,e}else if(r.type===`end`){let e=C(r);if(e!==Ae)return e}if(r.type===`illegal`&&a===``)return P+=`
68
68
  `,1;if(I>1e5&&I>r.index*3)throw Error(`potential infinite loop, way more iterations than matches`);return P+=a,a.length}let D=N(e);if(!D)throw he(s.replace(`{}`,e)),Error(`Unknown language: "`+e+`"`);let O=z(D),k=``,A=a||O,j={},M=new l.__emitter(l);w();let P=``,ee=0,F=0,I=0,L=!1;try{if(D.__emitTokens)D.__emitTokens(n,M);else{for(A.matcher.considerAll();;){I++,L?L=!1:A.matcher.considerAll(),A.matcher.lastIndex=F;let e=A.matcher.exec(n);if(!e)break;let t=E(n.substring(F,e.index),e);F=e.index+t}E(n.substring(F))}return M.finalize(),k=M.toHTML(),{language:e,value:k,relevance:ee,illegal:!1,_emitter:M,_top:A}}catch(t){if(t.message&&t.message.includes(`Illegal`))return{language:e,value:Oe(n),illegal:!0,relevance:0,_illegalBy:{message:t.message,index:F,context:n.slice(F-100,F+100),mode:t.mode,resultSoFar:k},_emitter:M};if(o)return{language:e,value:Oe(n),illegal:!1,relevance:0,errorRaised:t,_emitter:M,_top:A};throw t}}function b(e){let t={value:Oe(e),illegal:!1,relevance:0,_top:c,_emitter:new l.__emitter(l)};return t._emitter.addText(e),t}function S(e,n){n=n||l.languages||Object.keys(t);let r=b(e),i=n.filter(N).filter(ee).map(t=>v(t,e,!1));i.unshift(r);let[a,o]=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(N(e.language).supersetOf===t.language)return 1;if(N(t.language).supersetOf===e.language)return-1}return 0}),s=a;return s.secondBest=o,s}function C(e,t,n){let r=t&&i[t]||n;e.classList.add(`hljs`),e.classList.add(`language-${r}`)}function w(e){let t=null,n=d(e);if(u(n))return;if(te(`before:highlightElement`,{el:e,language:n}),e.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);return}if(e.children.length>0&&(l.ignoreUnescapedHTML||(console.warn(`One of your code blocks includes unescaped HTML. This is a potentially serious security risk.`),console.warn(`https://github.com/highlightjs/highlight.js/wiki/security`),console.warn(`The element with unescaped HTML:`),console.warn(e)),l.throwUnescapedHTML))throw new De(`One of your code blocks includes unescaped HTML.`,e.innerHTML);t=e;let r=t.textContent,i=n?p(r,{language:n,ignoreIllegals:!0}):S(r);e.innerHTML=i.value,e.dataset.highlighted=`yes`,C(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),te(`after:highlightElement`,{el:e,result:i,text:r})}function T(e){l=ke(l,e)}let E=()=>{k(),_e(`10.6.0`,`initHighlighting() deprecated. Use highlightAll() now.`)};function D(){k(),_e(`10.6.0`,`initHighlightingOnLoad() deprecated. Use highlightAll() now.`)}let O=!1;function k(){function e(){k()}if(document.readyState===`loading`){O||window.addEventListener(`DOMContentLoaded`,e,!1),O=!0;return}document.querySelectorAll(l.cssSelector).forEach(w)}function A(n,r){let i=null;try{i=r(e)}catch(e){if(he(`Language definition for '{}' could not be registered.`.replace(`{}`,n)),o)he(e);else throw e;i=c}i.name||=n,t[n]=i,i.rawDefinition=r.bind(null,e),i.aliases&&P(i.aliases,{languageName:n})}function j(e){delete t[e];for(let t of Object.keys(i))i[t]===e&&delete i[t]}function M(){return Object.keys(t)}function N(e){return e=(e||``).toLowerCase(),t[e]||t[i[e]]}function P(e,{languageName:t}){typeof e==`string`&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function ee(e){let t=N(e);return t&&!t.disableAutodetect}function F(e){e[`before:highlightBlock`]&&!e[`before:highlightElement`]&&(e[`before:highlightElement`]=t=>{e[`before:highlightBlock`](Object.assign({block:t.el},t))}),e[`after:highlightBlock`]&&!e[`after:highlightElement`]&&(e[`after:highlightElement`]=t=>{e[`after:highlightBlock`](Object.assign({block:t.el},t))})}function I(e){F(e),a.push(e)}function L(e){let t=a.indexOf(e);t!==-1&&a.splice(t,1)}function te(e,t){let n=e;a.forEach(function(e){e[n]&&e[n](t)})}function re(e){return _e(`10.7.0`,`highlightBlock will be removed entirely in v12.0`),_e(`10.7.0`,`Please use highlightElement now.`),w(e)}Object.assign(e,{highlight:p,highlightAuto:S,highlightAll:k,highlightElement:w,highlightBlock:re,configure:T,initHighlighting:E,initHighlightingOnLoad:D,registerLanguage:A,unregisterLanguage:j,listLanguages:M,getLanguage:N,registerAliases:P,autoDetection:ee,inherit:ke,addPlugin:I,removePlugin:L}),e.debugMode=function(){o=!1},e.safeMode=function(){o=!0},e.versionString=Ee,e.regex={concat:_,lookahead:m,either:y,optional:g,anyNumberOfTimes:h};for(let e in ne)typeof ne[e]==`object`&&n(ne[e]);return Object.assign(e,ne),e},Ne=Me({});Ne.newInstance=()=>Me({}),t.exports=Ne,Ne.HighlightJS=Ne,Ne.default=Ne}))()).default,ew={},tw=`hljs-`;function nw(e){let t=$C.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(e,n,r){let i=r||ew,a=typeof i.prefix==`string`?i.prefix:tw;if(!t.getLanguage(e))throw Error("Unknown language: `"+e+"` is not registered");t.configure({__emitter:rw,classPrefix:a});let o=t.highlight(n,{ignoreIllegals:!0,language:e});if(o.errorRaised)throw Error("Could not highlight with `Highlight.js`",{cause:o.errorRaised});let s=o._emitter.root,c=s.data;return c.language=o.language,c.relevance=o.relevance,s}function r(e,r){let a=(r||ew).subset||i(),o=-1,s=0,c;for(;++o<a.length;){let i=a[o];if(!t.getLanguage(i))continue;let l=n(i,e,r);l.data&&l.data.relevance!==void 0&&l.data.relevance>s&&(s=l.data.relevance,c=l)}return c||{type:`root`,children:[],data:{language:void 0,relevance:s}}}function i(){return t.listLanguages()}function a(e,n){if(typeof e==`string`)t.registerLanguage(e,n);else{let n;for(n in e)Object.hasOwn(e,n)&&t.registerLanguage(n,e[n])}}function o(e,n){if(typeof e==`string`)t.registerAliases(typeof n==`string`?n:[...n],{languageName:e});else{let n;for(n in e)if(Object.hasOwn(e,n)){let r=e[n];t.registerAliases(typeof r==`string`?r:[...r],{languageName:n})}}}function s(e){return!!t.getLanguage(e)}}var rw=class{constructor(e){this.options=e,this.root={type:`root`,children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(e){if(e===``)return;let t=this.stack[this.stack.length-1],n=t.children[t.children.length-1];n&&n.type===`text`?n.value+=e:t.children.push({type:`text`,value:e})}startScope(e){this.openNode(String(e))}endScope(){this.closeNode()}__addSublanguage(e,t){let n=this.stack[this.stack.length-1],r=e.root.children;t?n.children.push({type:`element`,tagName:`span`,properties:{className:[t]},children:r}):n.children.push(...r)}openNode(e){let t=this,n=e.split(`.`).map(function(e,n){return n?e+`_`.repeat(n):t.options.classPrefix+e}),r=this.stack[this.stack.length-1],i={type:`element`,tagName:`span`,properties:{className:n},children:[]};r.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return``}},iw={};function aw(e){let t=e||iw,n=t.aliases,r=t.detect||!1,i=t.languages||QC,a=t.plainText,o=t.prefix,s=t.subset,c=`hljs`,l=nw(i);if(n&&l.registerAlias(n),o){let e=o.indexOf(`-`);c=e===-1?o:o.slice(0,e)}return function(e,t){bb(e,`element`,function(e,n,i){if(e.tagName!==`code`||!i||i.type!==`element`||i.tagName!==`pre`)return;let u=ow(e);if(u===!1||!u&&!r||u&&a&&a.includes(u))return;Array.isArray(e.properties.className)||(e.properties.className=[]),e.properties.className.includes(c)||e.properties.className.unshift(c);let d=Rx(e,{whitespace:`pre`}),f;try{f=u?l.highlight(u,d,{prefix:o}):l.highlightAuto(d,{prefix:o,subset:s})}catch(n){let r=n;if(u&&/Unknown language/.test(r.message)){t.message("Cannot highlight as `"+u+"`, it’s not registered",{ancestors:[i,e],cause:r,place:e.position,ruleId:`missing-language`,source:`rehype-highlight`});return}throw r}!u&&f.data&&f.data.language&&e.properties.className.push(`language-`+f.data.language),f.children.length>0&&(e.children=f.children)})}}function ow(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++n<t.length;){let e=String(t[n]);if(e===`no-highlight`||e===`nohighlight`)return!1;!r&&e.slice(0,5)===`lang-`&&(r=e.slice(5)),!r&&e.slice(0,9)===`language-`&&(r=e.slice(9))}return r}var sw=`a.blockquote.br.code.del.em.h1.h2.h3.h4.h5.h6.hr.li.ol.p.pre.span.strong.table.tbody.td.th.thead.tr.ul`.split(`.`);function cw({children:e,label:t}){let n=Mm(e);return n===void 0?(0,G.jsx)(`div`,{className:`message-markdown`,children:(0,G.jsx)(vx,{allowedElements:[...sw],rehypePlugins:[aw],skipHtml:!0,children:e})}):(0,G.jsx)(Lm,{className:`whitespace-pre`,label:`${t} formatted JSON`,value:n})}var lw=200,uw=`mt-0 max-h-72 whitespace-pre-wrap rounded-none border-0 text-[11px]`,dw={completed:`text-success`,failed:`text-destructive`,interrupted:`text-warning`,timeout:`text-warning`};function fw({label:e,value:t}){return(0,G.jsx)(Lm,{className:`mt-0 max-h-90 whitespace-pre-wrap rounded-none border-0 text-[11px]`,label:e,value:t})}function pw(e){return e===null||!Number.isFinite(e)?null:e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(1)} s`:`${(e/6e4).toFixed(1)} min`}function mw(e){return e.input===void 0||e.input===null?e.output??``:typeof e.input==`string`?e.input:Pm(e.input)}function hw(e){return mw(e).split(`
69
- `,1)[0]?.trim().slice(0,lw)??``}function gw({status:e}){return e?(0,G.jsxs)(`span`,{className:H(`flex shrink-0 items-center gap-1 text-[9px] uppercase tracking-[.08em]`,dw[e]??`text-subtle`),children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-current`}),e]}):null}function _w({invocation:e}){let t=[[`Call ID`,e.toolCallId],[`Started`,e.startedAt],[`Finished`,e.finishedAt],[`Timing`,e.timingSource]].filter(([,e])=>e!==null);return t.length===0?null:(0,G.jsx)(`dl`,{"aria-label":`${e.name} tool timing`,className:`flex flex-wrap gap-2 px-3.5 py-2`,children:t.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,G.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,G.jsx)(`dd`,{className:`m-0 font-mono text-[10px] text-muted-foreground`,children:t})]},e))})}function vw({children:e,title:t}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`m-0 px-3.5 pt-2 text-[9px] font-bold uppercase tracking-[.08em] text-subtle`,children:t}),e]})}function yw({invocation:e}){let t=pw(e.durationMs),n=hw(e),r=e.input!==void 0&&e.input!==null,i=e.output===null?void 0:Mm(e.output);return(0,G.jsxs)(ea,{className:`rounded-[10px] border bg-card px-3`,value:e.id,children:[(0,G.jsxs)(ta,{"aria-label":`${e.name} tool details`,className:`items-center gap-2 py-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(rn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:e.name}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] font-normal text-subtle`,children:n}),t?(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-subtle`,children:t}):null,(0,G.jsx)(gw,{status:e.status})]}),(0,G.jsxs)(na,{className:`-mx-3 border-t p-0`,children:[(0,G.jsx)(_w,{invocation:e}),r?(0,G.jsx)(vw,{title:`Input`,children:(0,G.jsx)(Lm,{className:uw,label:`${e.name} tool input`,value:e.input})}):null,e.output===null?null:(0,G.jsx)(vw,{title:`Output`,children:i===void 0?(0,G.jsx)(`pre`,{"aria-label":`${e.name} tool output`,className:H(`message-json`,uw),children:e.output}):(0,G.jsx)(Lm,{className:uw,label:`${e.name} tool output`,value:i})}),!r&&e.output===null?(0,G.jsxs)(`p`,{className:`m-0 px-3.5 py-2 text-[11px] italic text-muted-foreground`,children:[`This `,e.kind,` event carried no input or output.`]}):null]})]})}function bw({usage:e}){let t=[[`Input`,`inputTokens`,e.inputTokens],[`Output`,`outputTokens`,e.outputTokens],[`Cache read`,`cacheReadTokens`,e.cacheReadTokens],[`Cache write`,`cacheWriteTokens`,e.cacheWriteTokens],[`Cost`,`costUsd`,e.costUsd]].filter(([,t])=>Object.hasOwn(e,t));return t.length===0?null:(0,G.jsx)(`dl`,{"aria-label":`Usage`,className:`mt-4.5 flex flex-wrap gap-2`,children:t.map(([e,t,n])=>(0,G.jsxs)(`div`,{className:`flex gap-1.5 rounded-md bg-muted px-2 py-1`,children:[(0,G.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,G.jsx)(`dd`,{className:`m-0 text-[10px] text-muted-foreground`,children:n===null?`Not reported`:t===`costUsd`&&typeof n==`number`?`$${n.toFixed(4)}`:n??`Not reported`})]},t))})}function xw({author:e,turn:t}){let n=Object.keys(t.unknown).length>0,r=ym(t.tools);return(0,G.jsxs)(`article`,{"aria-label":`Turn ${t.id} from ${t.harness}`,className:`mx-auto mb-10.5 max-w-[850px]`,children:[(0,G.jsx)(Om,{from:`user`,children:(0,G.jsxs)(km,{className:`mb-8 ml-auto max-w-[min(680px,88%)] rounded-[22px_22px_5px_22px] border bg-popover px-5 py-4.5`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:`You`}),(0,G.jsx)(cw,{label:`User message`,children:t.user})]})}),(0,G.jsxs)(Om,{from:`assistant`,children:[(0,G.jsx)(Am,{...e?.avatar?{src:e.avatar}:{},children:e?e.label.slice(0,2).toUpperCase():`OH`}),(0,G.jsxs)(km,{className:`pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:[(0,G.jsx)(`span`,{children:e?.label??t.harness}),t.model?(0,G.jsx)(Ma,{variant:`secondary`,className:`font-medium normal-case tracking-normal`,children:t.model}):null]}),t.reasoning?(0,G.jsx)($i,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,G.jsxs)(ea,{className:`rounded-[10px] border border-dashed bg-card px-3`,value:`reasoning`,children:[(0,G.jsx)(ta,{className:`text-xs text-muted-foreground`,children:`Reasoning`}),(0,G.jsx)(na,{className:`whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground`,children:t.reasoning})]})}):null,r.length>0?(0,G.jsx)(`section`,{"aria-label":`Tool calls`,className:`my-3`,children:(0,G.jsx)($i,{className:`space-y-1`,type:`multiple`,children:r.map(e=>(0,G.jsx)(yw,{invocation:e},e.id))})}):null,t.assistant?(0,G.jsx)(cw,{label:`Assistant message`,children:t.assistant}):(0,G.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`No assistant text was captured for this run.`}),t.failureKind?(0,G.jsxs)(`p`,{"aria-label":`Failure: ${t.failureKind}`,className:`border-l-2 border-destructive pl-2.5 text-xs text-destructive`,role:`note`,children:[`Failure: `,t.failureKind]}):null,(0,G.jsx)(bw,{usage:t.usage}),n?(0,G.jsx)($i,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,G.jsxs)(ea,{className:`rounded-[10px] border bg-card px-3`,value:`unknown`,children:[(0,G.jsx)(ta,{className:`text-xs text-muted-foreground`,children:`Additional upstream data`}),(0,G.jsx)(na,{className:`-mx-3 border-t p-0`,children:(0,G.jsx)(fw,{label:`Additional upstream data detail`,value:t.unknown})})]})}):null]})]})]})}Object.freeze({status:`aborted`});function J(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Sw=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Cw=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},ww={};function Tw(e){return e&&Object.assign(ww,e),ww}function Ew(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Dw(e,t){return typeof t==`bigint`?t.toString():t}function Ow(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function kw(e){return e==null}function Aw(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function jw(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Mw=Symbol(`evaluating`);function Nw(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Mw)return r===void 0&&(r=Mw,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Pw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Fw(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Iw(e){return JSON.stringify(e)}var Lw=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Rw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var zw=Ow(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Bw(e){if(Rw(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Rw(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Vw(e){return Bw(e)?{...e}:Array.isArray(e)?[...e]:e}var Hw=new Set([`string`,`number`,`symbol`]);function Uw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ww(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Y(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Gw(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Kw={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qw(e,t){let n=e._zod.def;return Ww(e,Fw(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Pw(this,`shape`,e),e},checks:[]}))}function Jw(e,t){let n=e._zod.def;return Ww(e,Fw(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Pw(this,`shape`,r),r},checks:[]}))}function Yw(e,t){if(!Bw(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");return Ww(e,Fw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Pw(this,`shape`,n),n},checks:[]}))}function Xw(e,t){if(!Bw(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ww(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Pw(this,`shape`,n),n},checks:e._zod.def.checks})}function Zw(e,t){return Ww(e,Fw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Pw(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qw(e,t,n){return Ww(t,Fw(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Pw(this,`shape`,i),i},checks:[]}))}function $w(e,t,n){return Ww(t,Fw(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Pw(this,`shape`,i),i},checks:[]}))}function eT(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tT(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nT(e){return typeof e==`string`?e:e?.message}function rT(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nT(e.inst?._zod.def?.error?.(e))??nT(t?.error?.(e))??nT(n.customError?.(e))??nT(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function iT(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function aT(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var oT=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Dw,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},sT=J(`$ZodError`,oT),cT=J(`$ZodError`,oT,{Parent:Error});function lT(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function uT(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var dT=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Sw;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>rT(e,a,Tw())));throw Lw(t,i?.callee),t}return o.value},fT=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>rT(e,a,Tw())));throw Lw(t,i?.callee),t}return o.value},pT=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Sw;return a.issues.length?{success:!1,error:new(e??sT)(a.issues.map(e=>rT(e,i,Tw())))}:{success:!0,data:a.value}},mT=pT(cT),hT=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>rT(e,i,Tw())))}:{success:!0,data:a.value}},gT=hT(cT),_T=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dT(e)(t,n,i)},vT=e=>(t,n,r)=>dT(e)(t,n,r),yT=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fT(e)(t,n,i)},bT=e=>async(t,n,r)=>fT(e)(t,n,r),xT=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pT(e)(t,n,i)},ST=e=>(t,n,r)=>pT(e)(t,n,r),CT=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hT(e)(t,n,i)},wT=e=>async(t,n,r)=>hT(e)(t,n,r),TT=/^[cC][^\s-]{8,}$/,ET=/^[0-9a-z]+$/,DT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OT=/^[0-9a-vA-V]{20}$/,kT=/^[A-Za-z0-9]{27}$/,AT=/^[a-zA-Z0-9_-]{21}$/,jT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MT=/^([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})$/,NT=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,PT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,FT=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function IT(){return new RegExp(FT,`u`)}var LT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,RT=/^(([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}|:))$/,zT=/^((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])$/,BT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,HT=/^[A-Za-z0-9_-]*$/,UT=/^(?=.{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])?)*\.?$/,WT=/^\+(?:[0-9]){6,14}[0-9]$/,GT=`(?:(?:\\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])))`,KT=RegExp(`^${GT}$`);function qT(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function JT(e){return RegExp(`^${qT(e)}$`)}function YT(e){let t=qT({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${GT}T(?:${r})$`)}var XT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ZT=/^-?\d+$/,QT=/^-?\d+(?:\.\d+)?/,$T=/^(?:true|false)$/i,eE=/^[^A-Z]*$/,tE=/^[^a-z]*$/,nE=J(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),rE={number:`number`,bigint:`bigint`,object:`date`},iE=J(`$ZodCheckLessThan`,(e,t)=>{nE.init(e,t);let n=rE[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),aE=J(`$ZodCheckGreaterThan`,(e,t)=>{nE.init(e,t);let n=rE[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),oE=J(`$ZodCheckMultipleOf`,(e,t)=>{nE.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):jw(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),sE=J(`$ZodCheckNumberFormat`,(e,t)=>{nE.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Kw[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ZT)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),cE=J(`$ZodCheckMaxLength`,(e,t)=>{var n;nE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kw(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=iT(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),lE=J(`$ZodCheckMinLength`,(e,t)=>{var n;nE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kw(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=iT(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),uE=J(`$ZodCheckLengthEquals`,(e,t)=>{var n;nE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kw(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=iT(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),dE=J(`$ZodCheckStringFormat`,(e,t)=>{var n,r;nE.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),fE=J(`$ZodCheckRegex`,(e,t)=>{dE.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),pE=J(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=eE,dE.init(e,t)}),mE=J(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=tE,dE.init(e,t)}),hE=J(`$ZodCheckIncludes`,(e,t)=>{nE.init(e,t);let n=Uw(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),gE=J(`$ZodCheckStartsWith`,(e,t)=>{nE.init(e,t);let n=RegExp(`^${Uw(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),_E=J(`$ZodCheckEndsWith`,(e,t)=>{nE.init(e,t);let n=RegExp(`.*${Uw(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),vE=J(`$ZodCheckOverwrite`,(e,t)=>{nE.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),yE=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
69
+ `,1)[0]?.trim().slice(0,lw)??``}function gw({status:e}){return e?(0,G.jsxs)(`span`,{className:H(`flex shrink-0 items-center gap-1 text-[9px] uppercase tracking-[.08em]`,dw[e]??`text-subtle`),children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-current`}),e]}):null}function _w({invocation:e}){let t=[[`Call ID`,e.toolCallId],[`Started`,e.startedAt],[`Finished`,e.finishedAt],[`Timing`,e.timingSource]].filter(([,e])=>e!==null);return t.length===0?null:(0,G.jsx)(`dl`,{"aria-label":`${e.name} tool timing`,className:`flex flex-wrap gap-2 px-3.5 py-2`,children:t.map(([e,t])=>(0,G.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,G.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,G.jsx)(`dd`,{className:`m-0 font-mono text-[10px] text-muted-foreground`,children:t})]},e))})}function vw({children:e,title:t}){return(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{className:`m-0 px-3.5 pt-2 text-[9px] font-bold uppercase tracking-[.08em] text-subtle`,children:t}),e]})}function yw({invocation:e}){let t=pw(e.durationMs),n=hw(e),r=e.input!==void 0&&e.input!==null,i=e.output===null?void 0:Mm(e.output);return(0,G.jsxs)(ea,{className:`rounded-[10px] border bg-card px-3`,value:e.id,children:[(0,G.jsxs)(ta,{"aria-label":`${e.name} tool details`,className:`items-center gap-2 py-1.5 text-xs text-muted-foreground`,children:[(0,G.jsx)(rn,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}),(0,G.jsx)(`span`,{className:`shrink-0 font-medium text-foreground`,children:e.name}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[10px] font-normal text-subtle`,children:n}),t?(0,G.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-subtle`,children:t}):null,(0,G.jsx)(gw,{status:e.status})]}),(0,G.jsxs)(na,{className:`-mx-3 border-t p-0`,children:[(0,G.jsx)(_w,{invocation:e}),r?(0,G.jsx)(vw,{title:`Input`,children:(0,G.jsx)(Lm,{className:uw,label:`${e.name} tool input`,value:e.input})}):null,e.output===null?null:(0,G.jsx)(vw,{title:`Output`,children:i===void 0?(0,G.jsx)(`pre`,{"aria-label":`${e.name} tool output`,className:H(`message-json`,uw),children:e.output}):(0,G.jsx)(Lm,{className:uw,label:`${e.name} tool output`,value:i})}),!r&&e.output===null?(0,G.jsxs)(`p`,{className:`m-0 px-3.5 py-2 text-[11px] italic text-muted-foreground`,children:[`This `,e.kind,` event carried no input or output.`]}):null]})]})}function bw({usage:e}){let t=[[`Input`,`inputTokens`,e.inputTokens],[`Output`,`outputTokens`,e.outputTokens],[`Cache read`,`cacheReadTokens`,e.cacheReadTokens],[`Cache write`,`cacheWriteTokens`,e.cacheWriteTokens],[`Cost`,`costUsd`,e.costUsd]].filter(([,t])=>Object.hasOwn(e,t));return t.length===0?null:(0,G.jsx)(`dl`,{"aria-label":`Usage`,className:`mt-4.5 flex flex-wrap gap-2`,children:t.map(([e,t,n])=>(0,G.jsxs)(`div`,{className:`flex gap-1.5 rounded-md bg-muted px-2 py-1`,children:[(0,G.jsx)(`dt`,{className:`text-[9px] uppercase text-subtle`,children:e}),(0,G.jsx)(`dd`,{className:`m-0 text-[10px] text-muted-foreground`,children:n===null?`Not reported`:t===`costUsd`&&typeof n==`number`?`$${n.toFixed(4)}`:n??`Not reported`})]},t))})}function xw({author:e,turn:t}){let n=Object.keys(t.unknown).length>0,r=ym(t.tools);return(0,G.jsxs)(`article`,{"aria-label":`Turn ${t.id} from ${t.harness}`,className:`mx-auto mb-10.5 max-w-[850px]`,children:[(0,G.jsx)(Om,{from:`user`,children:(0,G.jsxs)(km,{className:`mb-8 ml-auto max-w-[min(680px,88%)] rounded-[22px_22px_5px_22px] border bg-popover px-5 py-4.5`,children:[(0,G.jsx)(`div`,{className:`text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:`You`}),(0,G.jsx)(cw,{label:`User message`,children:t.user})]})}),(0,G.jsxs)(Om,{from:`assistant`,children:[(0,G.jsx)(Am,{...e?.avatar?{src:e.avatar}:{},children:e?e.label.slice(0,2).toUpperCase():`OH`}),(0,G.jsxs)(km,{className:`pt-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[.08em] text-subtle`,children:[(0,G.jsx)(`span`,{children:e?.label??t.harness}),t.model?(0,G.jsx)(Ma,{variant:`secondary`,className:`font-medium normal-case tracking-normal`,children:t.model}):null]}),t.reasoning?(0,G.jsx)($i,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,G.jsxs)(ea,{className:`rounded-[10px] border border-dashed bg-card px-3`,value:`reasoning`,children:[(0,G.jsx)(ta,{className:`text-xs text-muted-foreground`,children:`Reasoning`}),(0,G.jsx)(na,{className:`whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground`,children:t.reasoning})]})}):null,r.length>0?(0,G.jsx)(`section`,{"aria-label":`Tool calls`,className:`my-3`,children:(0,G.jsx)($i,{className:`space-y-1`,type:`multiple`,children:r.map(e=>(0,G.jsx)(yw,{invocation:e},e.id))})}):null,t.assistant?(0,G.jsx)(cw,{label:`Assistant message`,children:t.assistant}):(0,G.jsx)(`p`,{className:`text-[13px] italic text-muted-foreground`,children:`No assistant text was captured for this run.`}),t.failureKind?(0,G.jsxs)(`p`,{"aria-label":`Failure: ${t.failureKind}`,className:`border-l-2 border-destructive pl-2.5 text-xs text-destructive`,role:`note`,children:[`Failure: `,t.failureKind]}):null,(0,G.jsx)(bw,{usage:t.usage}),n?(0,G.jsx)($i,{className:`mt-2.5`,collapsible:!0,type:`single`,children:(0,G.jsxs)(ea,{className:`rounded-[10px] border bg-card px-3`,value:`unknown`,children:[(0,G.jsx)(ta,{className:`text-xs text-muted-foreground`,children:`Additional upstream data`}),(0,G.jsx)(na,{className:`-mx-3 border-t p-0`,children:(0,G.jsx)(fw,{label:`Additional upstream data detail`,value:t.unknown})})]})}):null]})]})]})}Object.freeze({status:`aborted`});function J(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r);for(let e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Sw=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Cw=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}},ww={};function Tw(e){return e&&Object.assign(ww,e),ww}function Ew(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Dw(e,t){return typeof t==`bigint`?t.toString():t}function Ow(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function kw(e){return e==null}function Aw(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function jw(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=t.toString(),i=(r.split(`.`)[1]||``).length;if(i===0&&/\d?e-\d?/.test(r)){let e=r.match(/\d?e-(\d?)/);e?.[1]&&(i=Number.parseInt(e[1]))}let a=n>i?n:i;return Number.parseInt(e.toFixed(a).replace(`.`,``))%Number.parseInt(t.toFixed(a).replace(`.`,``))/10**a}var Mw=Symbol(`evaluating`);function Nw(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Mw)return r===void 0&&(r=Mw,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Pw(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Fw(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Iw(e){return JSON.stringify(e)}var Lw=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Rw(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var zw=Ow(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Bw(e){if(Rw(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Rw(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Vw(e){return Bw(e)?{...e}:Array.isArray(e)?[...e]:e}var Hw=new Set([`string`,`number`,`symbol`]);function Uw(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ww(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function Y(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Gw(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Kw={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function qw(e,t){let n=e._zod.def;return Ww(e,Fw(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Pw(this,`shape`,e),e},checks:[]}))}function Jw(e,t){let n=e._zod.def;return Ww(e,Fw(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Pw(this,`shape`,r),r},checks:[]}))}function Yw(e,t){if(!Bw(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0)throw Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");return Ww(e,Fw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Pw(this,`shape`,n),n},checks:[]}))}function Xw(e,t){if(!Bw(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ww(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return Pw(this,`shape`,n),n},checks:e._zod.def.checks})}function Zw(e,t){return Ww(e,Fw(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Pw(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qw(e,t,n){return Ww(t,Fw(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Pw(this,`shape`,i),i},checks:[]}))}function $w(e,t,n){return Ww(t,Fw(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Pw(this,`shape`,i),i},checks:[]}))}function eT(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function tT(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function nT(e){return typeof e==`string`?e:e?.message}function rT(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=nT(e.inst?._zod.def?.error?.(e))??nT(t?.error?.(e))??nT(n.customError?.(e))??nT(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function iT(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function aT(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var oT=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Dw,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},sT=J(`$ZodError`,oT),cT=J(`$ZodError`,oT,{Parent:Error});function lT(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function uT(e,t=e=>e.message){let n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`&&i.errors.length)i.errors.map(e=>r({issues:e}));else if(i.code===`invalid_key`)r({issues:i.issues});else if(i.code===`invalid_element`)r({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(e),n}var dT=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Sw;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>rT(e,a,Tw())));throw Lw(t,i?.callee),t}return o.value},fT=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>rT(e,a,Tw())));throw Lw(t,i?.callee),t}return o.value},pT=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Sw;return a.issues.length?{success:!1,error:new(e??sT)(a.issues.map(e=>rT(e,i,Tw())))}:{success:!0,data:a.value}},mT=pT(cT),hT=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>rT(e,i,Tw())))}:{success:!0,data:a.value}},gT=hT(cT),_T=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return dT(e)(t,n,i)},vT=e=>(t,n,r)=>dT(e)(t,n,r),yT=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return fT(e)(t,n,i)},bT=e=>async(t,n,r)=>fT(e)(t,n,r),xT=e=>(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return pT(e)(t,n,i)},ST=e=>(t,n,r)=>pT(e)(t,n,r),CT=e=>async(t,n,r)=>{let i=r?Object.assign(r,{direction:`backward`}):{direction:`backward`};return hT(e)(t,n,i)},wT=e=>async(t,n,r)=>hT(e)(t,n,r),TT=/^[cC][^\s-]{8,}$/,ET=/^[0-9a-z]+$/,DT=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,OT=/^[0-9a-vA-V]{20}$/,kT=/^[A-Za-z0-9]{27}$/,AT=/^[a-zA-Z0-9_-]{21}$/,jT=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,MT=/^([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})$/,NT=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,PT=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,FT=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function IT(){return new RegExp(FT,`u`)}var LT=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,RT=/^(([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}|:))$/,zT=/^((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])$/,BT=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,VT=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,HT=/^[A-Za-z0-9_-]*$/,UT=/^(?=.{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])?)*\.?$/,WT=/^\+(?:[0-9]){6,14}[0-9]$/,GT=`(?:(?:\\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])))`,KT=RegExp(`^${GT}$`);function qT(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function JT(e){return RegExp(`^${qT(e)}$`)}function YT(e){let t=qT({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${GT}T(?:${r})$`)}var XT=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ZT=/^-?\d+$/,QT=/^-?\d+(?:\.\d+)?/,$T=/^(?:true|false)$/i,eE=/^null$/i,tE=/^[^A-Z]*$/,nE=/^[^a-z]*$/,rE=J(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),iE={number:`number`,bigint:`bigint`,object:`date`},aE=J(`$ZodCheckLessThan`,(e,t)=>{rE.init(e,t);let n=iE[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),oE=J(`$ZodCheckGreaterThan`,(e,t)=>{rE.init(e,t);let n=iE[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),sE=J(`$ZodCheckMultipleOf`,(e,t)=>{rE.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):jw(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),cE=J(`$ZodCheckNumberFormat`,(e,t)=>{rE.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Kw[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ZT)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),lE=J(`$ZodCheckMaxLength`,(e,t)=>{var n;rE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kw(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=iT(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),uE=J(`$ZodCheckMinLength`,(e,t)=>{var n;rE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kw(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=iT(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),dE=J(`$ZodCheckLengthEquals`,(e,t)=>{var n;rE.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!kw(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=iT(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),fE=J(`$ZodCheckStringFormat`,(e,t)=>{var n,r;rE.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),pE=J(`$ZodCheckRegex`,(e,t)=>{fE.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),mE=J(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=tE,fE.init(e,t)}),hE=J(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=nE,fE.init(e,t)}),gE=J(`$ZodCheckIncludes`,(e,t)=>{rE.init(e,t);let n=Uw(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),_E=J(`$ZodCheckStartsWith`,(e,t)=>{rE.init(e,t);let n=RegExp(`^${Uw(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),vE=J(`$ZodCheckEndsWith`,(e,t)=>{rE.init(e,t);let n=RegExp(`.*${Uw(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),yE=J(`$ZodCheckOverwrite`,(e,t)=>{rE.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),bE=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
70
70
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
71
- `))}},bE={major:4,minor:1,patch:12},xE=J(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=bE;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=eT(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Sw;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=eT(e,t))});else{if(e.issues.length===t)continue;r||=eT(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(eT(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Sw;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Sw;return o.then(e=>t(e,r,a))}return t(o,r,a)}}e[`~standard`]={validate:t=>{try{let n=mT(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return gT(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),SE=J(`$ZodString`,(e,t)=>{xE.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??XT(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),CE=J(`$ZodStringFormat`,(e,t)=>{dE.init(e,t),SE.init(e,t)}),wE=J(`$ZodGUID`,(e,t)=>{t.pattern??=MT,CE.init(e,t)}),TE=J(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=NT(e)}else t.pattern??=NT();CE.init(e,t)}),EE=J(`$ZodEmail`,(e,t)=>{t.pattern??=PT,CE.init(e,t)}),DE=J(`$ZodURL`,(e,t)=>{CE.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:UT.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),OE=J(`$ZodEmoji`,(e,t)=>{t.pattern??=IT(),CE.init(e,t)}),kE=J(`$ZodNanoID`,(e,t)=>{t.pattern??=AT,CE.init(e,t)}),AE=J(`$ZodCUID`,(e,t)=>{t.pattern??=TT,CE.init(e,t)}),jE=J(`$ZodCUID2`,(e,t)=>{t.pattern??=ET,CE.init(e,t)}),ME=J(`$ZodULID`,(e,t)=>{t.pattern??=DT,CE.init(e,t)}),NE=J(`$ZodXID`,(e,t)=>{t.pattern??=OT,CE.init(e,t)}),PE=J(`$ZodKSUID`,(e,t)=>{t.pattern??=kT,CE.init(e,t)}),FE=J(`$ZodISODateTime`,(e,t)=>{t.pattern??=YT(t),CE.init(e,t)}),IE=J(`$ZodISODate`,(e,t)=>{t.pattern??=KT,CE.init(e,t)}),LE=J(`$ZodISOTime`,(e,t)=>{t.pattern??=JT(t),CE.init(e,t)}),RE=J(`$ZodISODuration`,(e,t)=>{t.pattern??=jT,CE.init(e,t)}),zE=J(`$ZodIPv4`,(e,t)=>{t.pattern??=LT,CE.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),BE=J(`$ZodIPv6`,(e,t)=>{t.pattern??=RT,CE.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv6`}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),VE=J(`$ZodCIDRv4`,(e,t)=>{t.pattern??=zT,CE.init(e,t)}),HE=J(`$ZodCIDRv6`,(e,t)=>{t.pattern??=BT,CE.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function UE(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var WE=J(`$ZodBase64`,(e,t)=>{t.pattern??=VT,CE.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{UE(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function GE(e){if(!HT.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return UE(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var KE=J(`$ZodBase64URL`,(e,t)=>{t.pattern??=HT,CE.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{GE(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),qE=J(`$ZodE164`,(e,t)=>{t.pattern??=WT,CE.init(e,t)});function JE(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var YE=J(`$ZodJWT`,(e,t)=>{CE.init(e,t),e._zod.check=n=>{JE(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),XE=J(`$ZodNumber`,(e,t)=>{xE.init(e,t),e._zod.pattern=e._zod.bag.pattern??QT,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ZE=J(`$ZodNumber`,(e,t)=>{sE.init(e,t),XE.init(e,t)}),QE=J(`$ZodBoolean`,(e,t)=>{xE.init(e,t),e._zod.pattern=$T,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),$E=J(`$ZodUnknown`,(e,t)=>{xE.init(e,t),e._zod.parse=e=>e}),eD=J(`$ZodNever`,(e,t)=>{xE.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function tD(e,t,n){e.issues.length&&t.issues.push(...tT(n,e.issues)),t.value[n]=e.value}var nD=J(`$ZodArray`,(e,t)=>{xE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>tD(t,n,e))):tD(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function rD(e,t,n,r){e.issues.length&&t.issues.push(...tT(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function iD(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Gw(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function aD(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type;for(let i of Object.keys(t)){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>rD(e,n,i,t))):rD(a,n,i,t)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var oD=J(`$ZodObject`,(e,t)=>{if(xE.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ow(()=>iD(t));Nw(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Rw,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e]._zod.run({value:s[e],issues:[]},o);n instanceof Promise?c.push(n.then(n=>rD(n,t,e,s))):rD(n,t,e,s)}return i?aD(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),sD=J(`$ZodObjectJIT`,(e,t)=>{oD.init(e,t);let n=e._zod.parse,r=Ow(()=>iD(t)),i=e=>{let t=new yE([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Iw(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let e of n.keys){let n=a[e],r=Iw(e);t.write(`const ${n} = ${i(e)};`),t.write(`
71
+ `))}},xE={major:4,minor:1,patch:12},SE=J(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=xE;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=eT(e),i;for(let a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Sw;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=eT(e,t))});else{if(e.issues.length===t)continue;r||=eT(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(eT(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Sw;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Sw;return o.then(e=>t(e,r,a))}return t(o,r,a)}}e[`~standard`]={validate:t=>{try{let n=mT(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return gT(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}}),CE=J(`$ZodString`,(e,t)=>{SE.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??XT(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),wE=J(`$ZodStringFormat`,(e,t)=>{fE.init(e,t),CE.init(e,t)}),TE=J(`$ZodGUID`,(e,t)=>{t.pattern??=MT,wE.init(e,t)}),EE=J(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=NT(e)}else t.pattern??=NT();wE.init(e,t)}),DE=J(`$ZodEmail`,(e,t)=>{t.pattern??=PT,wE.init(e,t)}),OE=J(`$ZodURL`,(e,t)=>{wE.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:UT.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),kE=J(`$ZodEmoji`,(e,t)=>{t.pattern??=IT(),wE.init(e,t)}),AE=J(`$ZodNanoID`,(e,t)=>{t.pattern??=AT,wE.init(e,t)}),jE=J(`$ZodCUID`,(e,t)=>{t.pattern??=TT,wE.init(e,t)}),ME=J(`$ZodCUID2`,(e,t)=>{t.pattern??=ET,wE.init(e,t)}),NE=J(`$ZodULID`,(e,t)=>{t.pattern??=DT,wE.init(e,t)}),PE=J(`$ZodXID`,(e,t)=>{t.pattern??=OT,wE.init(e,t)}),FE=J(`$ZodKSUID`,(e,t)=>{t.pattern??=kT,wE.init(e,t)}),IE=J(`$ZodISODateTime`,(e,t)=>{t.pattern??=YT(t),wE.init(e,t)}),LE=J(`$ZodISODate`,(e,t)=>{t.pattern??=KT,wE.init(e,t)}),RE=J(`$ZodISOTime`,(e,t)=>{t.pattern??=JT(t),wE.init(e,t)}),zE=J(`$ZodISODuration`,(e,t)=>{t.pattern??=jT,wE.init(e,t)}),BE=J(`$ZodIPv4`,(e,t)=>{t.pattern??=LT,wE.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv4`})}),VE=J(`$ZodIPv6`,(e,t)=>{t.pattern??=RT,wE.init(e,t),e._zod.onattach.push(e=>{let t=e._zod.bag;t.format=`ipv6`}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),HE=J(`$ZodCIDRv4`,(e,t)=>{t.pattern??=zT,wE.init(e,t)}),UE=J(`$ZodCIDRv6`,(e,t)=>{t.pattern??=BT,wE.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function WE(e){if(e===``)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var GE=J(`$ZodBase64`,(e,t)=>{t.pattern??=VT,wE.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64`}),e._zod.check=n=>{WE(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function KE(e){if(!HT.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return WE(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var qE=J(`$ZodBase64URL`,(e,t)=>{t.pattern??=HT,wE.init(e,t),e._zod.onattach.push(e=>{e._zod.bag.contentEncoding=`base64url`}),e._zod.check=n=>{KE(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),JE=J(`$ZodE164`,(e,t)=>{t.pattern??=WT,wE.init(e,t)});function YE(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var XE=J(`$ZodJWT`,(e,t)=>{wE.init(e,t),e._zod.check=n=>{YE(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ZE=J(`$ZodNumber`,(e,t)=>{SE.init(e,t),e._zod.pattern=e._zod.bag.pattern??QT,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),QE=J(`$ZodNumber`,(e,t)=>{cE.init(e,t),ZE.init(e,t)}),$E=J(`$ZodBoolean`,(e,t)=>{SE.init(e,t),e._zod.pattern=$T,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),eD=J(`$ZodNull`,(e,t)=>{SE.init(e,t),e._zod.pattern=eE,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),tD=J(`$ZodUnknown`,(e,t)=>{SE.init(e,t),e._zod.parse=e=>e}),nD=J(`$ZodNever`,(e,t)=>{SE.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function rD(e,t,n){e.issues.length&&t.issues.push(...tT(n,e.issues)),t.value[n]=e.value}var iD=J(`$ZodArray`,(e,t)=>{SE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>rD(t,n,e))):rD(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function aD(e,t,n,r){e.issues.length&&t.issues.push(...tT(n,e.issues)),e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}function oD(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Gw(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function sD(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type;for(let i of Object.keys(t)){if(s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>aD(e,n,i,t))):aD(a,n,i,t)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var cD=J(`$ZodObject`,(e,t)=>{if(SE.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ow(()=>oD(t));Nw(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Rw,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e]._zod.run({value:s[e],issues:[]},o);n instanceof Promise?c.push(n.then(n=>aD(n,t,e,s))):aD(n,t,e,s)}return i?sD(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),lD=J(`$ZodObjectJIT`,(e,t)=>{cD.init(e,t);let n=e._zod.parse,r=Ow(()=>oD(t)),i=e=>{let t=new bE([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Iw(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let e of n.keys){let n=a[e],r=Iw(e);t.write(`const ${n} = ${i(e)};`),t.write(`
72
72
  if (${n}.issues.length) {
73
73
  payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
74
74
  ...iss,
@@ -85,13 +85,13 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
85
85
  newResult[${r}] = ${n}.value;
86
86
  }
87
87
 
88
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Rw,s=!ww.jitless,c=s&&zw.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?aD([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function cD(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!eT(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>rT(e,r,Tw())))}),t)}var lD=J(`$ZodUnion`,(e,t)=>{xE.init(e,t),Nw(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Nw(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Nw(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Nw(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Aw(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>cD(t,i,e,a)):cD(s,i,e,a)}}),uD=J(`$ZodDiscriminatedUnion`,(e,t)=>{lD.init(e,t);let n=e._zod.parse;Nw(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ow(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Rw(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),dD=J(`$ZodIntersection`,(e,t)=>{xE.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>pD(e,t,n)):pD(e,i,a)}});function fD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Bw(e)&&Bw(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=fD(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=fD(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function pD(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),eT(e))return e;let r=fD(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var mD=J(`$ZodRecord`,(e,t)=>{xE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Bw(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...tT(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...tT(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>rT(e,r,Tw())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...tT(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...tT(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),hD=J(`$ZodEnum`,(e,t)=>{xE.init(e,t);let n=Ew(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Hw.has(typeof e)).map(e=>typeof e==`string`?Uw(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),gD=J(`$ZodLiteral`,(e,t)=>{if(xE.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Uw(e):e?Uw(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),_D=J(`$ZodTransform`,(e,t)=>{xE.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cw(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Sw;return n.value=i,n}});function vD(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var yD=J(`$ZodOptional`,(e,t)=>{xE.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Nw(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Nw(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Aw(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>vD(t,e.value)):vD(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),bD=J(`$ZodNullable`,(e,t)=>{xE.init(e,t),Nw(e._zod,`optin`,()=>t.innerType._zod.optin),Nw(e._zod,`optout`,()=>t.innerType._zod.optout),Nw(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Aw(e.source)}|null)$`):void 0}),Nw(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),xD=J(`$ZodDefault`,(e,t)=>{xE.init(e,t),e._zod.optin=`optional`,Nw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>SD(e,t)):SD(r,t)}});function SD(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var CD=J(`$ZodPrefault`,(e,t)=>{xE.init(e,t),e._zod.optin=`optional`,Nw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),wD=J(`$ZodNonOptional`,(e,t)=>{xE.init(e,t),Nw(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>TD(t,e)):TD(i,e)}});function TD(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var ED=J(`$ZodCatch`,(e,t)=>{xE.init(e,t),Nw(e._zod,`optin`,()=>t.innerType._zod.optin),Nw(e._zod,`optout`,()=>t.innerType._zod.optout),Nw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>rT(e,n,Tw()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>rT(e,n,Tw()))},input:e.value}),e.issues=[]),e)}}),DD=J(`$ZodPipe`,(e,t)=>{xE.init(e,t),Nw(e._zod,`values`,()=>t.in._zod.values),Nw(e._zod,`optin`,()=>t.in._zod.optin),Nw(e._zod,`optout`,()=>t.out._zod.optout),Nw(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>OD(e,t.in,n)):OD(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>OD(e,t.out,n)):OD(r,t.out,n)}});function OD(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var kD=J(`$ZodReadonly`,(e,t)=>{xE.init(e,t),Nw(e._zod,`propValues`,()=>t.innerType._zod.propValues),Nw(e._zod,`values`,()=>t.innerType._zod.values),Nw(e._zod,`optin`,()=>t.innerType._zod.optin),Nw(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(AD):AD(r)}});function AD(e){return e.value=Object.freeze(e.value),e}var jD=J(`$ZodCustom`,(e,t)=>{nE.init(e,t),xE.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>MD(t,n,r,e));MD(i,n,r,e)}});function MD(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(aT(e))}}var ND=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function PD(){return new ND}var FD=PD();function ID(e,t){return new e({type:`string`,...Y(t)})}function LD(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Y(t)})}function RD(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Y(t)})}function zD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Y(t)})}function BD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Y(t)})}function VD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Y(t)})}function HD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Y(t)})}function UD(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Y(t)})}function WD(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Y(t)})}function GD(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Y(t)})}function KD(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Y(t)})}function qD(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Y(t)})}function JD(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Y(t)})}function YD(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Y(t)})}function XD(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Y(t)})}function ZD(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Y(t)})}function QD(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Y(t)})}function $D(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Y(t)})}function eO(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Y(t)})}function tO(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Y(t)})}function nO(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Y(t)})}function rO(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Y(t)})}function iO(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Y(t)})}function aO(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Y(t)})}function oO(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Y(t)})}function sO(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Y(t)})}function cO(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Y(t)})}function lO(e,t){return new e({type:`number`,checks:[],...Y(t)})}function uO(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Y(t)})}function dO(e,t){return new e({type:`boolean`,...Y(t)})}function fO(e){return new e({type:`unknown`})}function pO(e,t){return new e({type:`never`,...Y(t)})}function mO(e,t){return new iE({check:`less_than`,...Y(t),value:e,inclusive:!1})}function hO(e,t){return new iE({check:`less_than`,...Y(t),value:e,inclusive:!0})}function gO(e,t){return new aE({check:`greater_than`,...Y(t),value:e,inclusive:!1})}function _O(e,t){return new aE({check:`greater_than`,...Y(t),value:e,inclusive:!0})}function vO(e,t){return new oE({check:`multiple_of`,...Y(t),value:e})}function yO(e,t){return new cE({check:`max_length`,...Y(t),maximum:e})}function bO(e,t){return new lE({check:`min_length`,...Y(t),minimum:e})}function xO(e,t){return new uE({check:`length_equals`,...Y(t),length:e})}function SO(e,t){return new fE({check:`string_format`,format:`regex`,...Y(t),pattern:e})}function CO(e){return new pE({check:`string_format`,format:`lowercase`,...Y(e)})}function wO(e){return new mE({check:`string_format`,format:`uppercase`,...Y(e)})}function TO(e,t){return new hE({check:`string_format`,format:`includes`,...Y(t),includes:e})}function EO(e,t){return new gE({check:`string_format`,format:`starts_with`,...Y(t),prefix:e})}function DO(e,t){return new _E({check:`string_format`,format:`ends_with`,...Y(t),suffix:e})}function OO(e){return new vE({check:`overwrite`,tx:e})}function kO(e){return OO(t=>t.normalize(e))}function AO(){return OO(e=>e.trim())}function jO(){return OO(e=>e.toLowerCase())}function MO(){return OO(e=>e.toUpperCase())}function NO(e,t,n){return new e({type:`array`,element:t,...Y(n)})}function PO(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Y(n)})}function FO(e){let t=IO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(aT(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(aT(r))}},e(n.value,n)));return t}function IO(e,t){let n=new nE({check:`custom`,...Y(t)});return n._zod.check=e,n}var LO=J(`ZodISODateTime`,(e,t)=>{FE.init(e,t),ck.init(e,t)});function RO(e){return aO(LO,e)}var zO=J(`ZodISODate`,(e,t)=>{IE.init(e,t),ck.init(e,t)});function BO(e){return oO(zO,e)}var VO=J(`ZodISOTime`,(e,t)=>{LE.init(e,t),ck.init(e,t)});function HO(e){return sO(VO,e)}var UO=J(`ZodISODuration`,(e,t)=>{RE.init(e,t),ck.init(e,t)});function WO(e){return cO(UO,e)}var GO=(e,t)=>{sT.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>uT(e,t)},flatten:{value:t=>lT(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Dw,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Dw,2)}},isEmpty:{get(){return e.issues.length===0}}})};J(`ZodError`,GO);var KO=J(`ZodError`,GO,{Parent:Error}),qO=dT(KO),JO=fT(KO),YO=pT(KO),XO=hT(KO),ZO=_T(KO),QO=vT(KO),$O=yT(KO),ek=bT(KO),tk=xT(KO),nk=ST(KO),rk=CT(KO),ik=wT(KO),ak=J(`ZodType`,(e,t)=>(xE.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Fw(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]})),e.clone=(t,n)=>Ww(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>qO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>YO(e,t,n),e.parseAsync=async(t,n)=>JO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>XO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>ZO(e,t,n),e.decode=(t,n)=>QO(e,t,n),e.encodeAsync=async(t,n)=>$O(e,t,n),e.decodeAsync=async(t,n)=>ek(e,t,n),e.safeEncode=(t,n)=>tk(e,t,n),e.safeDecode=(t,n)=>nk(e,t,n),e.safeEncodeAsync=async(t,n)=>rk(e,t,n),e.safeDecodeAsync=async(t,n)=>ik(e,t,n),e.refine=(t,n)=>e.check(vA(t,n)),e.superRefine=t=>e.check(yA(t)),e.overwrite=t=>e.check(OO(t)),e.optional=()=>nA(e),e.nullable=()=>iA(e),e.nullish=()=>nA(iA(e)),e.nonoptional=t=>uA(e,t),e.array=()=>Z(e),e.or=t=>Hk([e,t]),e.and=t=>Kk(e,t),e.transform=t=>mA(e,eA(t)),e.default=t=>oA(e,t),e.prefault=t=>cA(e,t),e.catch=t=>fA(e,t),e.pipe=t=>mA(e,t),e.readonly=()=>gA(e),e.describe=t=>{let n=e.clone();return FD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return FD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return FD.get(e);let n=e.clone();return FD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),ok=J(`_ZodString`,(e,t)=>{SE.init(e,t),ak.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(SO(...t)),e.includes=(...t)=>e.check(TO(...t)),e.startsWith=(...t)=>e.check(EO(...t)),e.endsWith=(...t)=>e.check(DO(...t)),e.min=(...t)=>e.check(bO(...t)),e.max=(...t)=>e.check(yO(...t)),e.length=(...t)=>e.check(xO(...t)),e.nonempty=(...t)=>e.check(bO(1,...t)),e.lowercase=t=>e.check(CO(t)),e.uppercase=t=>e.check(wO(t)),e.trim=()=>e.check(AO()),e.normalize=(...t)=>e.check(kO(...t)),e.toLowerCase=()=>e.check(jO()),e.toUpperCase=()=>e.check(MO())}),sk=J(`ZodString`,(e,t)=>{SE.init(e,t),ok.init(e,t),e.email=t=>e.check(LD(lk,t)),e.url=t=>e.check(UD(fk,t)),e.jwt=t=>e.check(iO(Dk,t)),e.emoji=t=>e.check(WD(pk,t)),e.guid=t=>e.check(RD(uk,t)),e.uuid=t=>e.check(zD(dk,t)),e.uuidv4=t=>e.check(BD(dk,t)),e.uuidv6=t=>e.check(VD(dk,t)),e.uuidv7=t=>e.check(HD(dk,t)),e.nanoid=t=>e.check(GD(mk,t)),e.guid=t=>e.check(RD(uk,t)),e.cuid=t=>e.check(KD(hk,t)),e.cuid2=t=>e.check(qD(gk,t)),e.ulid=t=>e.check(JD(_k,t)),e.base64=t=>e.check(tO(wk,t)),e.base64url=t=>e.check(nO(Tk,t)),e.xid=t=>e.check(YD(vk,t)),e.ksuid=t=>e.check(XD(yk,t)),e.ipv4=t=>e.check(ZD(bk,t)),e.ipv6=t=>e.check(QD(xk,t)),e.cidrv4=t=>e.check($D(Sk,t)),e.cidrv6=t=>e.check(eO(Ck,t)),e.e164=t=>e.check(rO(Ek,t)),e.datetime=t=>e.check(RO(t)),e.date=t=>e.check(BO(t)),e.time=t=>e.check(HO(t)),e.duration=t=>e.check(WO(t))});function X(e){return ID(sk,e)}var ck=J(`ZodStringFormat`,(e,t)=>{CE.init(e,t),ok.init(e,t)}),lk=J(`ZodEmail`,(e,t)=>{EE.init(e,t),ck.init(e,t)}),uk=J(`ZodGUID`,(e,t)=>{wE.init(e,t),ck.init(e,t)}),dk=J(`ZodUUID`,(e,t)=>{TE.init(e,t),ck.init(e,t)}),fk=J(`ZodURL`,(e,t)=>{DE.init(e,t),ck.init(e,t)}),pk=J(`ZodEmoji`,(e,t)=>{OE.init(e,t),ck.init(e,t)}),mk=J(`ZodNanoID`,(e,t)=>{kE.init(e,t),ck.init(e,t)}),hk=J(`ZodCUID`,(e,t)=>{AE.init(e,t),ck.init(e,t)}),gk=J(`ZodCUID2`,(e,t)=>{jE.init(e,t),ck.init(e,t)}),_k=J(`ZodULID`,(e,t)=>{ME.init(e,t),ck.init(e,t)}),vk=J(`ZodXID`,(e,t)=>{NE.init(e,t),ck.init(e,t)}),yk=J(`ZodKSUID`,(e,t)=>{PE.init(e,t),ck.init(e,t)}),bk=J(`ZodIPv4`,(e,t)=>{zE.init(e,t),ck.init(e,t)}),xk=J(`ZodIPv6`,(e,t)=>{BE.init(e,t),ck.init(e,t)}),Sk=J(`ZodCIDRv4`,(e,t)=>{VE.init(e,t),ck.init(e,t)}),Ck=J(`ZodCIDRv6`,(e,t)=>{HE.init(e,t),ck.init(e,t)}),wk=J(`ZodBase64`,(e,t)=>{WE.init(e,t),ck.init(e,t)}),Tk=J(`ZodBase64URL`,(e,t)=>{KE.init(e,t),ck.init(e,t)}),Ek=J(`ZodE164`,(e,t)=>{qE.init(e,t),ck.init(e,t)}),Dk=J(`ZodJWT`,(e,t)=>{YE.init(e,t),ck.init(e,t)}),Ok=J(`ZodNumber`,(e,t)=>{XE.init(e,t),ak.init(e,t),e.gt=(t,n)=>e.check(gO(t,n)),e.gte=(t,n)=>e.check(_O(t,n)),e.min=(t,n)=>e.check(_O(t,n)),e.lt=(t,n)=>e.check(mO(t,n)),e.lte=(t,n)=>e.check(hO(t,n)),e.max=(t,n)=>e.check(hO(t,n)),e.int=t=>e.check(jk(t)),e.safe=t=>e.check(jk(t)),e.positive=t=>e.check(gO(0,t)),e.nonnegative=t=>e.check(_O(0,t)),e.negative=t=>e.check(mO(0,t)),e.nonpositive=t=>e.check(hO(0,t)),e.multipleOf=(t,n)=>e.check(vO(t,n)),e.step=(t,n)=>e.check(vO(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function kk(e){return lO(Ok,e)}var Ak=J(`ZodNumberFormat`,(e,t)=>{ZE.init(e,t),Ok.init(e,t)});function jk(e){return uO(Ak,e)}var Mk=J(`ZodBoolean`,(e,t)=>{QE.init(e,t),ak.init(e,t)});function Nk(e){return dO(Mk,e)}var Pk=J(`ZodUnknown`,(e,t)=>{$E.init(e,t),ak.init(e,t)});function Fk(){return fO(Pk)}var Ik=J(`ZodNever`,(e,t)=>{eD.init(e,t),ak.init(e,t)});function Lk(e){return pO(Ik,e)}var Rk=J(`ZodArray`,(e,t)=>{nD.init(e,t),ak.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(bO(t,n)),e.nonempty=t=>e.check(bO(1,t)),e.max=(t,n)=>e.check(yO(t,n)),e.length=(t,n)=>e.check(xO(t,n)),e.unwrap=()=>e.element});function Z(e,t){return NO(Rk,e,t)}var zk=J(`ZodObject`,(e,t)=>{sD.init(e,t),ak.init(e,t),Nw(e,`shape`,()=>t.shape),e.keyof=()=>Xk(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Fk()}),e.loose=()=>e.clone({...e._zod.def,catchall:Fk()}),e.strict=()=>e.clone({...e._zod.def,catchall:Lk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Yw(e,t),e.safeExtend=t=>Xw(e,t),e.merge=t=>Zw(e,t),e.pick=t=>qw(e,t),e.omit=t=>Jw(e,t),e.partial=(...t)=>Qw(tA,e,t[0]),e.required=(...t)=>$w(lA,e,t[0])});function Bk(e,t){return new zk({type:`object`,shape:e??{},...Y(t)})}var Vk=J(`ZodUnion`,(e,t)=>{lD.init(e,t),ak.init(e,t),e.options=t.options});function Hk(e,t){return new Vk({type:`union`,options:e,...Y(t)})}var Uk=J(`ZodDiscriminatedUnion`,(e,t)=>{Vk.init(e,t),uD.init(e,t)});function Wk(e,t,n){return new Uk({type:`union`,options:t,discriminator:e,...Y(n)})}var Gk=J(`ZodIntersection`,(e,t)=>{dD.init(e,t),ak.init(e,t)});function Kk(e,t){return new Gk({type:`intersection`,left:e,right:t})}var qk=J(`ZodRecord`,(e,t)=>{mD.init(e,t),ak.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function Jk(e,t,n){return new qk({type:`record`,keyType:e,valueType:t,...Y(n)})}var Yk=J(`ZodEnum`,(e,t)=>{hD.init(e,t),ak.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Yk({...t,checks:[],...Y(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Yk({...t,checks:[],...Y(r),entries:i})}});function Xk(e,t){return new Yk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Y(t)})}var Zk=J(`ZodLiteral`,(e,t)=>{gD.init(e,t),ak.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Qk(e,t){return new Zk({type:`literal`,values:Array.isArray(e)?e:[e],...Y(t)})}var $k=J(`ZodTransform`,(e,t)=>{_D.init(e,t),ak.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cw(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(aT(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(aT(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function eA(e){return new $k({type:`transform`,transform:e})}var tA=J(`ZodOptional`,(e,t)=>{yD.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType});function nA(e){return new tA({type:`optional`,innerType:e})}var rA=J(`ZodNullable`,(e,t)=>{bD.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType});function iA(e){return new rA({type:`nullable`,innerType:e})}var aA=J(`ZodDefault`,(e,t)=>{xD.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function oA(e,t){return new aA({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Vw(t)}})}var sA=J(`ZodPrefault`,(e,t)=>{CD.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType});function cA(e,t){return new sA({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Vw(t)}})}var lA=J(`ZodNonOptional`,(e,t)=>{wD.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uA(e,t){return new lA({type:`nonoptional`,innerType:e,...Y(t)})}var dA=J(`ZodCatch`,(e,t)=>{ED.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function fA(e,t){return new dA({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var pA=J(`ZodPipe`,(e,t)=>{DD.init(e,t),ak.init(e,t),e.in=t.in,e.out=t.out});function mA(e,t){return new pA({type:`pipe`,in:e,out:t})}var hA=J(`ZodReadonly`,(e,t)=>{kD.init(e,t),ak.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gA(e){return new hA({type:`readonly`,innerType:e})}var _A=J(`ZodCustom`,(e,t)=>{jD.init(e,t),ak.init(e,t)});function vA(e,t={}){return PO(_A,e,t)}function yA(e){return FO(e)}var bA=_(),xA=kk().finite().nonnegative(),SA=kk().int().nonnegative(),CA=RO({offset:!0}),wA=X().min(1).nullable(),Q=e=>Bk(e).catchall(Fk()),TA={runs:`/api/v2/runs`,run:e=>`/api/v2/runs/${encodeURIComponent(e)}`,timeline:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline`,conversation:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/conversations/${encodeURIComponent(t)}`,artifact:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,events:`/api/v2/events`,projects:`/api/v2/projects`,project:e=>`/api/v2/projects/${encodeURIComponent(e)}`,channel:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel`,channelNext:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/next`,channelReply:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/reply`,channelSurface:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/surface`,attest:e=>`/api/v2/runs/${encodeURIComponent(e)}/attest`,stop:e=>`/api/v2/runs/${encodeURIComponent(e)}/stop`,shutdown:`/api/v2/shutdown`,unwatched:`/api/v2/unwatched`,host:`/api/v2/host`,status:e=>`/api/v2/runs/${encodeURIComponent(e)}/status`,results:e=>`/api/v2/runs/${encodeURIComponent(e)}/results`,goals:`/api/v2/goals`,runGoals:e=>`/api/v2/runs/${encodeURIComponent(e)}/goals`,transcript:e=>`/api/v2/runs/${encodeURIComponent(e)}/transcript`,telemetry:e=>`/api/v2/runs/${encodeURIComponent(e)}/telemetry`,agents:e=>`/api/v2/runs/${encodeURIComponent(e)}/agents`,nodeAgents:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/agents`,projectAgents:e=>`/api/v2/projects/${encodeURIComponent(e)}/agents`},EA={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,select:`select`,node:`node`,scope:`scope`,filter:`filter`,correlation:`correlation`,until:`until`,timeout:`timeout`,tick:`tick`},DA={run:`run`,node:`node`},OA={planner:`planner`,detailed:`detailed`},kA=Xk([`complete`,`partial`,`legacy`]),AA=Xk([`native`,`labelled`,`inferred`]),jA=Q({agent_model_ms:Nk(),judge_model_ms:Nk(),llmlint_model_ms:Nk(),tool_ms:Nk()}),MA=xA.nullable(),NA=SA.nullable(),PA=Q({agent_seconds:MA,judge_seconds:MA,llmlint_seconds:MA,gate_seconds:MA,publication_wait_seconds:MA,lock_wait_seconds:MA,setup_seconds:MA,scheduling_seconds:MA,wall_seconds:MA,agent_model_ms:NA,judge_model_ms:NA,llmlint_model_ms:NA,tool_ms:NA,idle_orchestration_ms:NA,unattributed_ms:NA,wall_ms:NA,fractions:Q({agent_model:MA,judge_model:MA,llmlint_model:MA,tool:MA,idle_orchestration:MA,lock_wait:MA,setup:MA,scheduling:MA})}),FA=X().regex(/^[A-Za-z0-9_-]+$/,`a member name: letters, digits, hyphens and underscores`),IA=Xk([`agent`,`judge`,`llmlint`]),LA=xA.nullable(),RA=Q({input_tokens:LA,output_tokens:LA,cache_read_tokens:LA,cache_write_tokens:LA,cost_usd:LA}),zA=Q({agent:RA,judge:RA,llmlint:RA,total:RA}),BA=Q({session_id:X().min(1),history_id:X().min(1).nullable().optional(),role:IA,agent_role:FA.optional(),turn_index:SA.nullable().optional(),started_at:CA.optional(),finished_at:CA.nullable().optional()}),VA=Jk(X(),Fk()),HA=Xk([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),UA=Xk([`agent`,`judge`,`llmlint`]),WA=Xk([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),GA=Q({side:UA.optional(),harness:X().optional(),variant:X().optional(),identity:X().optional(),cause:WA.optional(),raw_tail:X().optional(),reset_time:X().optional(),missing_session_id:X().optional(),wait_seconds:kk().nonnegative().optional(),failure_kind:X().optional(),structured_error:VA.optional(),judge_unrecorded:Nk().optional()}).extend({class:HA,detail:X().optional()}),KA=Q({node:X().min(1),status:X().min(1),outcome:X().min(1).optional(),branch:X().min(1).optional(),comparison_remote:X().min(1).optional(),comparison_base:X().min(1).optional(),checkpoint:X().min(1).optional(),commit:X().min(1).optional(),retry_lineage:VA.optional(),gate_attestation:VA.optional(),failure:GA.optional(),timing:PA.optional(),usage:zA.optional(),sessions:Z(BA),tool_commands:Jk(X(),SA).optional(),turns:SA,lint:SA,timing_quality:kA,linkage_quality:AA,timing_presence:jA}),qA=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:wA,last_progress_at:xA.optional(),timing:PA,nodes:Z(KA),providers:Z(VA).optional(),failure:GA.optional(),check_rollup:VA.optional(),usage:zA,timing_quality:kA,linkage_quality:AA,timing_presence:jA,sources:Z(X()),node_work_ms:Q({agent_model_ms:NA,judge_model_ms:NA,llmlint_model_ms:NA,tool_ms:NA,wall_ms:NA}),turns:SA,lint:SA,agent_count:SA.optional()}),JA=Q({schema_version:Hk([X(),kk()]).optional(),observed_at:X().optional(),identities:Z(VA)}),YA=Q({launch_id:X().min(1),launcher:Xk([`claude-code`,`codex`,`unknown`]),session_key:X().min(1).optional(),launcher_session_id:X().min(1).optional()}),XA=X().min(1),ZA=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:wA,last_progress_at:xA.optional(),timing_quality:kA,linkage_quality:AA,timing:PA,node_counts:Jk(X(),SA),launch:YA.optional(),project:X().min(1).optional(),project_name:X().min(1).optional(),liveness:XA.optional(),unread_surfaces:SA.optional()}),QA=Q({path:X().min(1),reason:X().min(1)}),$A=Q({api_version:Qk(2),telemetry_schema_version:Qk(22),observed_at:CA,runs:Z(ZA),next_cursor:X().min(1).optional(),unreadable:Z(QA).optional(),missing:Z(X().min(1)).optional(),provider_health:JA.optional()}),ej=Q({id:X().min(1),kind:Xk([`agent`,`human`]).optional(),persona:X().min(1).optional(),task:X().min(1),deps:Z(X().min(1)).optional(),max_turns:SA.positive().optional(),expects_no_diff:Nk().optional()}),tj=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X().min(1),checkpoint:X().min(1),completed_steps:Z(X()).optional(),pr:X().nullable().optional(),mode:Xk([`pause`,`retry`,`continue`]).optional(),attempts:SA.optional()}),nj=Q({branch:X().min(1),repo:X().min(1).optional(),identity:X().min(1).optional(),base_branch:X().min(1).optional(),pr:X().min(1).optional(),pr_base:X().min(1).optional()}),rj=Z(X()),ij=ej.extend({task:X().min(1).optional(),repo:X().min(1).optional(),steps:Z(ej).min(1).optional(),session:X().min(1).optional(),project_dir:X().min(1).optional(),base_branch:X().min(1).optional(),branch:X().min(1).optional(),title:X().min(1).optional(),verify_cmd:X().min(1).optional(),skip_verify:Nk().optional(),verify_via_ci:Nk().optional(),merge_policy:Xk([`auto`,`direct`,`none`]).optional(),workflow:Xk([`local`,`remote`]).optional(),repo_type:Xk([`single-owner`,`team`]).optional(),execution_checkout:X().min(1).optional(),stack_bases:Z(nj).optional(),resume:tj.optional(),sets:rj.optional()}).superRefine((e,t)=>{e.steps===void 0&&e.task===void 0&&t.addIssue({code:`custom`,path:[`task`],message:"a plan task without `steps` must carry its own `task` prose"})}),aj=Q({gate_log:X().optional(),worker_report:X().optional(),oneharness_session:X().optional()}),oj=Q({id:X().min(1),kind:X().min(1),persona:X().nullable(),status:X().min(1),telemetry:VA.optional(),artifacts:aj.optional()}),sj=Q({ref:X().min(1),task:X(),unblocks:Z(X()),unblocks_publication:Nk()}),cj=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X(),checkpoint:X().min(1),completed_steps:Z(X()),pr:X().nullable(),mode:X().optional()}),lj=Q({identity:X().min(1),target:X().min(1),style:X().min(1).optional(),version:X().min(1)}),uj=Q({kind:X().optional(),status:X().optional(),task:X().optional(),unblocks:Z(X()).optional(),blocked_by:Z(X()).optional(),human_actions:Z(sj).optional(),completed:Nk().optional(),exit_code:kk().int().nullable().optional(),verdicts:Z(Fk()).optional(),usage:VA.optional(),telemetry:VA.optional(),repo:X().optional(),branch:X().optional(),commit:X().optional(),base_branch:X().optional(),pr_base:X().optional(),synthetic_stack_base:X().nullable().optional(),stack_bases:Z(VA).optional(),repository_type:Xk([`single-owner`,`team`]).nullable().optional(),repo_type:Xk([`single-owner`,`team`]).nullable().optional(),publication_workflow:Xk([`local`,`remote`]).nullable().optional(),workflow:Xk([`local`,`remote`]).nullable().optional(),merge_policy:Xk([`auto`,`direct`,`none`]).nullable().optional(),outcome:X().optional(),ok:Nk().optional(),pr:X().nullable().optional(),release:lj.nullable().optional(),detail:X().optional(),follow_ups:X().nullable().optional(),steps:Z(oj).optional(),waiting_steps:Z(X()).optional(),resume:cj.nullable().optional(),error:X().nullable().optional(),retry_lineage:VA.optional(),deferred_cleanup:Z(X()).optional(),artifacts:aj.optional()}),dj=Q({ok:Nk().optional(),state:X().optional(),started_order:Z(X()).optional(),results:Jk(X(),uj).optional(),schema_version:SA.optional()}),fj=Xk([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`]),pj=Xk([`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`]),mj=Q({addressable:Nk(),member:X().min(1).optional(),reason:X().min(1).optional()}).superRefine((e,t)=>{e.addressable===(e.reason!==void 0)&&t.addIssue({code:`custom`,path:[`reason`],message:`a reason is carried exactly when there is no turn to address`})}),hj=Q({id:X().min(1),kind:X(),unblocks:Z(X().min(1))}),gj=Q({run_id:X().min(1),plan:Q({tasks:Z(ij),schema_version:SA.optional(),concurrency:SA.positive().optional(),name:X().min(1).optional(),goal:Q({id:X().min(1),text:X().min(1)}).optional()}),node_states:Jk(X(),fj),node_status:Jk(X(),pj),node_gated_by:Jk(X(),Z(X().min(1))),node_control:Jk(X(),mj),node_results:Jk(X(),uj),decisions:Z(hj),attestations:Z(X()),result:dj.nullable(),last_seq:SA,run_node_sets:rj.optional()}).superRefine((e,t)=>{let n=new Set(e.plan.tasks.map(e=>e.id)),r=new Set(Object.keys(e.node_status));(n.size!==e.plan.tasks.length||n.size!==r.size||[...n].some(e=>!r.has(e)))&&t.addIssue({code:`custom`,path:[`node_status`],message:`must contain exactly one entry for every plan task`}),Object.entries(e.node_gated_by).find(([e,t])=>!n.has(e)||t.some(e=>!n.has(e)))&&t.addIssue({code:`custom`,path:[`node_gated_by`],message:`must name only nodes in this graph's plan`}),Object.keys(e.node_control).find(t=>e.node_status[t]!==`running`)!==void 0&&t.addIssue({code:`custom`,path:[`node_control`],message:`must name only nodes the run has in flight`})}),_j=Q({cacheReadTokens:LA.optional(),cacheWriteTokens:LA.optional(),costUsd:LA.optional(),inputTokens:LA.optional(),outputTokens:LA.optional()}),vj=Q({index:SA,input:Fk().optional(),kind:X(),name:X().nullable().optional(),output:X().nullable().optional()}),yj=Q({judge:X(),kind:X(),decision:X(),reason:X()}),bj=Q({assistant:X().nullable(),durationMs:LA.optional(),failureKind:X().nullable(),finishedAt:CA.nullable().optional(),harness:X(),id:X(),judges:Z(yj).optional(),model:X().nullable(),modelMs:LA.optional(),reasoning:X().nullable(),startedAt:CA.nullable().optional(),status:X(),timestamp:CA,toolMs:LA.optional(),tools:Z(vj),unknown:VA,usage:_j,user:X()}),xj=Q({conversation:Q({canContinue:Nk(),harnesses:Z(X()),id:X().min(1),name:X(),project:X(),startedAt:CA,state:X(),turns:Z(bj)}),attribution:Q({runId:X().optional(),nodeId:X().optional(),stepId:X().optional(),launchId:X().optional(),launcher:Xk([`claude-code`,`codex`,`unknown`]).optional(),transportRole:IA,agentRole:FA.optional(),parentConversationId:X().optional(),persona:X().optional(),finishedAt:CA.nullable().optional(),inferred:Qk(!0).optional(),timing:PA.optional()})}),Sj=Q({node:X().optional(),conversations:Z(xj)}),Cj=Hk([Z(xj),Z(Sj).transform(e=>e.flatMap(e=>e.conversations))]),wj=Q({name:X(),state:X(),required:Nk(),url:X().url().optional()}),Tj=Q({ok:Nk(),output_tail:X(),artifact_id:X().min(1).optional()}),Ej=Q({verification:Q({pre_push_hook:Nk().optional(),required_checks:Z(X()).optional(),required_checks_status:X().optional(),expected_gate:Z(X()).optional(),checks:Z(wj).optional(),records:Z(Tj)}),publication:Q({pr_url:X().url().optional(),branch:X().optional(),branch_url:X().url().optional(),merged:Nk(),base_branch:X().optional(),commit:X().optional(),commit_url:X().url().optional()}).optional()}),Dj=Q({api_version:Qk(2),telemetry_schema_version:Qk(22),observed_at:CA,run:qA,graph:gj.nullable(),conversations:Cj,node_details:Jk(X(),Ej).optional().default({}),launch:YA.optional(),provider_health:JA.optional()}),Oj=Xk([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),kj=Xk([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`,`queued`]),Aj=Xk([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),jj=Q({kind:Oj,value:X().min(1)}),Mj=Q({delivered:Nk(),delivery:Xk([`live`,`deferred`]).optional(),reached:Xk([`queued`,`worker`,`supervisor`,`judged-with`,`carried`]).optional(),turn:Xk([`interrupted`,`turn-end`]).optional(),member:X().min(1).optional(),input_bytes:SA.optional(),reason:X().min(1).optional(),node_id:X().min(1).optional()}).superRefine((e,t)=>{e.delivered&&e.reason!==void 0&&t.addIssue({code:`custom`,path:[`reason`],message:`a delivered redirection carries no reason it did not land`}),e.delivery!==void 0&&e.delivered!==(e.delivery===`live`)&&t.addIssue({code:`custom`,path:[`delivery`],message:"`delivery` is `live` exactly when the running turn took the note"})}),Nj=Q({dep:X().min(1),identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),action:X().min(1).optional(),since:CA.optional(),waited_seconds:SA.optional(),last_answer:X().min(1).optional()}),Pj=Q({kind:X().min(1).optional(),message:X().min(1).optional(),source:X().min(1).optional(),blocking:Nk().optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a surface record carries at least one recorded fact`})}),Fj=Q({name:X().min(1).optional(),required:Nk().optional(),state:X().min(1).optional(),kind:X().min(1).optional(),base:X().min(1).optional(),awaited:Z(X().min(1)).optional(),grace_seconds:kk().nonnegative().optional(),warned:Nk().optional(),head:X().min(1).optional(),verdict:X().min(1).optional(),skipped:Z(X().min(1)).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a review record carries at least one recorded fact`})}),Ij=Q({identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),version:X().min(1).optional(),landing_commit:X().min(1).optional(),actor:X().min(1).optional(),superseded:Nk().optional(),form:X().min(1).optional(),outcome:X().min(1).optional(),elapsed_ms:SA.optional(),dep:X().min(1).optional(),delivery:X().min(1).optional(),awaiting:Z(Nj).min(1).optional(),versions:Z(Q({identity:X().min(1),target:X().min(1),version:X().min(1)})).min(1).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a release record carries at least one recorded fact`})}),Lj=Q({id:X().min(1),kind:X().min(1),at:CA,node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),author:X().min(1).optional(),redirection:Mj.optional(),release:Ij.optional(),surface:Pj.optional(),review:Fj.optional(),reference:jj.optional()}),Rj=Q({started_at:CA,ended_at:CA}),zj=Q({kind:X().min(1),blocking:Z(X().min(1)).min(1).optional(),ahead:Z(X().min(1)).min(1).optional(),limit:SA.optional(),reference:X().min(1).optional(),awaiting:Z(X().min(1)).min(1).optional()}),Bj=Q({id:X().min(1),kind:kj,label:X(),started_at:CA,ended_at:CA.nullable(),events:Z(Lj),parent_id:X().min(1).optional(),node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),count:SA.optional(),total_duration_ms:SA.optional(),intervals:Z(Rj).optional(),agent_role:FA.optional(),transport_role:IA.optional(),dispatch_id:X().min(1).optional(),reference:jj.optional(),detail:Q({ok:Nk().optional(),output_tail:X().optional(),artifact_id:X().optional()}).optional(),phase:Aj.optional(),reasons:Z(zj).min(1).optional()}).superRefine((e,t)=>{e.reasons!==void 0&&e.kind!==`queued`&&t.addIssue({code:`custom`,path:[`reasons`],message:`only a queued span carries the reasons a node was held`})}),Vj=Q({id:X().min(1),kind:Oj,content:X(),truncated:Nk()}),Hj=Q({api_version:Qk(2),timeline_schema_version:Qk(12),observed_at:CA,run_id:X().min(1),spans:Z(Bj)}),Uj=Q({error:Q({code:X(),message:X()})});Q({schema_version:Qk(1),launch_id:X().min(1),launcher:Xk([`claude-code`,`codex`]),launcher_session_id:X().min(1),started_at:CA,repository_identity:X().min(1)});var Wj=Xk([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),Gj=VA,Kj=Z(Bk({event_id:X().min(1),node:X().min(1),step:X().min(1).optional(),at:kk().finite(),kind:X(),name:X(),detail:X(),events:kk().int().nonnegative()}));function qj(e){let t=e.indexOf(`:`);if(t===-1)return!1;let n=e.slice(0,t),r=e.slice(t+1);return/^[a-z0-9][a-z0-9-]*$/u.test(n)&&r.length>0&&r.length<=128&&!r.startsWith(`.`)&&/^[A-Za-z0-9._-]+$/u.test(r)}var Jj=Q({project:X().min(1).nullable(),name:X().min(1).nullable(),last_write_at:xA.nullable(),runs:Z(ZA),agent_count:SA.optional()}),Yj=Q({api_version:Qk(2),telemetry_schema_version:Qk(22),observed_at:CA,projects:Z(Jj),unreadable:Z(QA).optional()}),Xj=Jj.extend({api_version:Qk(2),telemetry_schema_version:Qk(22),observed_at:CA}),Zj={api_version:Qk(2),telemetry_schema_version:Qk(22),observed_at:CA},Qj=Q({id:SA,kind:X().min(1),message:X(),source:X().min(1),blocking:Nk(),queued_at:xA,workstream:X().min(1).optional(),abandoned:Nk().optional()}),$j=Xk([`worker`,`supervisor`,`both`]),eM=Xk([`live`,`next`]),tM=Xk([`detach`,`drop`]),nM=Xk([`done`,`failed`]),rM=Q({sets:rj.optional()}),iM=Wk(`op`,[Bk({op:Qk(`add`),node:ij}).strict(),Bk({op:Qk(`drop`),id:X().min(1),dependents:tM,reason:X().min(1).optional()}).strict(),Bk({op:Qk(`reparent`),id:X().min(1),deps:Z(X().min(1))}).strict(),Bk({op:Qk(`retry`),id:X().min(1),node:ij}).strict(),Bk({op:Qk(`cancel`),id:X().min(1),reason:X().min(1).optional()}).strict(),Bk({op:Qk(`requeue`),id:X().min(1),amend:rM.optional()}).strict(),Bk({op:Qk(`set-node-sets`),id:X().min(1),sets:rj}).strict(),Bk({op:Qk(`set-run-node-sets`),sets:rj}).strict(),Bk({op:Qk(`attest`),ref:X().min(1)}).strict(),Bk({op:Qk(`complete`),reason:X().min(1)}).strict(),Bk({op:Qk(`amend`),id:X().min(1),text:X().min(1)}).strict(),Bk({op:Qk(`note`),id:X().min(1),addressee:$j,text:X().min(1),criterion:X().min(1).optional(),deliver:eM.optional(),persist:Nk().optional(),delivery_timeout_seconds:kk().int().positive().optional()}).strict(),Bk({op:Qk(`withdraw-note`),envelope:X().min(1),index:kk().int().nonnegative(),reason:X().min(1)}).strict(),Bk({op:Qk(`finding`),message:X().min(1),blocking:Nk().optional(),id:X().min(1).optional()}).strict(),Bk({op:Qk(`settle`),id:X().min(1),outcome:nM,evidence:X().min(1),landing:X().min(1).optional(),release:Bk({target:X().min(1),version:X().min(1)}).strict().optional()}).strict(),Bk({op:Qk(`rework`),id:X().min(1),reason:X().min(1),instruction:X().min(1),comments:Z(Bk({id:X(),url:X()}).strict()).optional(),title:X().optional(),replacement:X().optional()}).strict(),Bk({op:Qk(`retitle`),id:X().min(1),title:X().min(1),reason:X().min(1)}).strict(),Bk({op:Qk(`review`)}).strict(),Bk({op:Qk(`readjust`)}).strict(),Bk({op:Qk(`decline`),id:X().min(1),comments:Z(Bk({id:X(),url:X()}).strict()),reason:X().min(1)}).strict()]),aM=iM.options.map(e=>e.shape.op.value),oM=Bk({version:SA.optional(),author:X().min(1).optional(),completion:Nk().optional(),message:X().optional(),reason:X().optional(),commands:Z(iM).optional()}).strict().superRefine((e,t)=>{e.commands!==void 0&&e.commands.length>0&&e.version!==3&&t.addIssue({code:`custom`,path:[`version`],message:`an edit envelope requires version 3`})}),sM=Q({id:SA,reply:VA,at:xA,correlation:X().min(1).optional()}),cM=Q({id:SA,author:X().min(1).optional(),commands:Z(VA)}),lM=Q({op:X().min(1).optional(),outcome:X().min(1).optional(),reason:X().optional()}),uM=Q({id:SA,applied:Nk(),reason:X().optional(),results:Z(lM).optional()}),dM=Q({...Zj,run_id:X().min(1),surfaces:Z(Qj),waiting:Z(Qj),held:Qj.nullable(),replies:Z(sM),commands:Z(cM),outcomes:Z(uM)}),fM=Xk([`surface`,`running`,`finished`]),pM=Q({...Zj,run_id:X().min(1),status:fM,surface:Qj.nullable(),events:Z(VA)}),mM=Q({...Zj,run_id:X().min(1),receipt:Q({reply:SA,state:X().min(1),verdict:X().min(1).optional(),commands:X().min(1).optional()}),advice:Z(X())}),hM=Q({...Zj,run_id:X().min(1),surface:SA,state:X().min(1)}),gM=Q({...Zj,run_id:X().min(1),stopped:Nk(),owner:X().min(1),forced:Nk(),teardown:X().min(1)}),_M=Xk([`host`]);Xk([`host`]);var vM=Xk([`delivered`,`no-turn`,`failed`,`not-asked`]),yM=Xk([`graceful`,`killed`,`still-running`]),bM=Xk([`pushed`,`already-on-origin`,`no-remote`,`refused`]),xM=Q({...Zj,scope:_M,root:X(),grace_seconds:SA,forced:Nk(),complete:Nk(),runs:Z(Q({run_id:X().min(1),owner:X().min(1),forced_over_owner:Nk(),dispatches:Z(Q({node:X().min(1),pid:SA,interrupt:vM,detail:X(),ended:yM,waited_ms:SA})),teardown:X().min(1),branches:Z(Q({identity:X(),branch:X(),result:bM,remote:X().nullable(),commit:X().nullable(),detail:X()}))})),not_pushed:Z(Q({identity:X(),branch:X()})),not_pushed_unread:X().nullable(),rendered:X()}),SM=Q({...Zj,session_key:X().min(1).optional(),reported:Z(Q({run:X().min(1),standing:X().min(1),why_not_watched:X()})),unresolved:Z(X())}),CM=Q({...Zj,rendered:X(),unreadable:Z(QA).optional()}),wM=Q({...Zj,run_id:X().min(1),rendered:X()}),TM=Q({...Zj,run_id:X().min(1),liveness:XA,unread_surfaces:Q({count:SA,oldest_seconds:xA.nullable()}),node_status:Jk(X(),X().min(1)),summary:X(),rendered:X()}),EM=Q({...Zj,run_id:X().min(1),node:X().min(1).nullable().optional(),rendered:X()}),DM=Q({...Zj,run_id:X().min(1),telemetry:Q({schema_version:SA})}),OM={runId:`onepipeline.run_id`,project:`onepipeline.project`,scope:`onepipeline.scope`,node:`onepipeline.node`,step:`onepipeline.step`,attempt:`onepipeline.attempt`},kM=[`node`,`observer`,`pr-author`,`review-reply`],AM=Q({history_id:X().min(1),harness:X().min(1),variant:X().min(1).optional(),harness_id:X().min(1),started:CA}),jM=Q({history_session:X().min(1),name:X().min(1),history_dir:X().min(1),history_project:X().min(1),history_file:X().min(1),project:X().min(1),started:CA,labels:Jk(X(),X()),runs:Z(AM),run_id:X().min(1).optional()}),MM={...Zj,sessions:Z(jM),skipped:SA},NM=Q({...MM,run_id:X().min(1),node:X().min(1).optional()}),PM=Q({...MM,project:X().min(1)}),FM=e=>$A.parse(e),IM=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},LM=50,RM=class{#e;#t;#n;constructor(e,t={}){this.#e=new URL(e),this.#t=t.fetch??globalThis.fetch,this.#n=t.eventSource}async listRuns(e=!1,t,n=LM){let r=this.#r(TA.runs);return r.searchParams.set(EA.includeSettled,String(e)),r.searchParams.set(EA.limit,String(n)),t!==void 0&&r.searchParams.set(EA.cursor,t),this.#a(r,$A.parse)}async selectRuns(e){if(e.length===0)throw new IM(`Invalid selection`);for(let t of e)if(VM(t,`run ID`),t.includes(`,`))throw new IM(`Invalid run ID`);let t=this.#r(TA.runs);return t.searchParams.set(EA.select,e.join(`,`)),this.#a(t,$A.parse)}async getRun(e,t={}){VM(e,`run ID`);let n=this.#r(TA.run(e));return t.includeConversations!==void 0&&n.searchParams.set(EA.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(EA.filter,t.filter),this.#a(n,Dj.parse)}async getTimeline(e,t,n){VM(e,`run ID`);let r=this.#r(TA.timeline(e));return n!==void 0&&r.searchParams.set(EA.filter,n),t===void 0?r.searchParams.set(EA.scope,DA.run):(r.searchParams.set(EA.scope,DA.node),r.searchParams.set(EA.node,t)),this.#a(r,Hj.parse)}async getConversation(e,t){return VM(e,`run ID`),VM(t,`conversation ID`),this.#a(this.#r(TA.conversation(e,t)),xj.parse)}async getArtifact(e,t){return VM(e,`run ID`),VM(t,`artifact ID`),this.#a(this.#r(TA.artifact(e,t)),Vj.parse)}subscribe(e){e.runId!==void 0&&VM(e.runId,`run ID`),e.after!==void 0&&VM(e.after,`cursor`);let t=this.#r(TA.events);e.runId!==void 0&&t.searchParams.set(EA.runId,e.runId),e.after!==void 0&&t.searchParams.set(EA.after,e.after),e.filter!==void 0&&t.searchParams.set(EA.filter,e.filter);let n=this.#i(t);for(let t of Wj.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?$A.parse(i):Gj.parse(i);e.onEvent({id:r.lastEventId,event:t,data:a})}catch(t){e.onError?.(t)}});return n.onerror=t=>e.onError?.(t),{close:()=>n.close()}}async listProjects(){return this.#a(this.#r(TA.projects),Yj.parse)}async getProject(e){return VM(e,`project ID`),this.#a(this.#r(TA.project(e)),Xj.parse)}async getChannel(e){return VM(e,`run ID`),this.#a(this.#r(TA.channel(e)),dM.parse)}async claimNext(e,t){VM(e,`run ID`);let n=this.#r(TA.channelNext(e));return t!==void 0&&n.searchParams.set(EA.filter,t),this.#a(n,pM.parse,{method:`POST`})}async reply(e,t,n){VM(e,`run ID`);let r=this.#r(TA.channelReply(e));return n!==void 0&&r.searchParams.set(EA.correlation,n),this.#a(r,mM.parse,{method:`POST`,headers:{"content-type":`application/json`},body:t})}async surface(e,t){return VM(e,`run ID`),this.#a(this.#r(TA.channelSurface(e)),hM.parse,BM(`POST`,t))}async attest(e,t){return VM(e,`run ID`),this.#a(this.#r(TA.attest(e)),mM.parse,BM(`POST`,{reference:t}))}async stop(e,t=!1){return VM(e,`run ID`),this.#a(this.#r(TA.stop(e)),gM.parse,BM(`POST`,{force:t}))}async shutdown(e,t={}){return this.#a(this.#r(TA.shutdown),xM.parse,BM(`POST`,{scope:e,...zM(t)}))}async unwatched(){return this.#a(this.#r(TA.unwatched),SM.parse)}async host(){return this.#a(this.#r(TA.host),CM.parse)}async getStatus(e){return VM(e,`run ID`),this.#a(this.#r(TA.status(e)),TM.parse)}async getResults(e){return VM(e,`run ID`),this.#a(this.#r(TA.results(e)),wM.parse)}async getGoals(){return this.#a(this.#r(TA.goals),CM.parse)}async getRunGoals(e){return VM(e,`run ID`),this.#a(this.#r(TA.runGoals(e)),wM.parse)}async getTranscript(e,t){VM(e,`run ID`);let n=this.#r(TA.transcript(e));return t!==void 0&&n.searchParams.set(EA.node,t),this.#a(n,EM.parse)}async getTelemetryDocument(e){return VM(e,`run ID`),this.#a(this.#r(TA.telemetry(e)),DM.parse)}async getAgents(e){return VM(e,`run ID`),this.#a(this.#r(TA.agents(e)),NM.parse)}async getNodeAgents(e,t){return VM(e,`run ID`),VM(t,`node ID`),this.#a(this.#r(TA.nodeAgents(e,t)),NM.parse)}async getProjectAgents(e){return VM(e,`project ID`),this.#a(this.#r(TA.projectAgents(e)),PM.parse)}#r(e){return new URL(e,this.#e)}#i(e){return(this.#n??(e=>{if(typeof EventSource>`u`)throw new IM(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(e.toString())}async#a(e,t,n){let r;try{r=await this.#t(e,n)}catch(e){throw new IM(`Telemetry request failed`,void 0,void 0,{cause:e})}let i=await r.json().catch(e=>{throw new IM(`Telemetry server returned invalid JSON`,r.status,void 0,{cause:e})});if(!r.ok){let e=Uj.safeParse(i);throw new IM(e.success?e.data.error.message:`Telemetry request failed with status ${r.status}`,r.status,e.success?e.data.error.code:void 0)}try{return t(i)}catch(e){throw new IM(`Telemetry response failed contract validation`,r.status,void 0,{cause:e})}}};function zM(e){let{grace:t,force:n=!1}=e;if(t===void 0)return{force:n};if(!Number.isSafeInteger(t)||t<0)throw new IM(`Invalid grace: whole seconds, 0 or more`);return{grace:t,force:n}}function BM(e,t){return{method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}}function VM(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new IM(`Invalid ${t}`)}function HM({outcome:e,label:t}){if(e===void 0)return null;if(e.kind===`refused`){let n=e.error,r=n instanceof IM?n.code:void 0,i=n instanceof IM?n.status:void 0;return(0,G.jsxs)(sa,{"aria-label":`${t} refused`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsxs)(ca,{children:[e.title,i!==void 0&&` · ${i}`,r!==void 0&&` ${r}`]}),(0,G.jsx)(la,{children:(0,G.jsx)(`pre`,{className:`verb-text`,children:n.message})})]})}return(0,G.jsxs)(sa,{"aria-label":`${t} receipt`,children:[(0,G.jsx)(Et,{}),(0,G.jsx)(ca,{children:e.title}),(0,G.jsx)(la,{children:(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.payload,null,2)})})]})}async function UM(e,t){try{return{kind:`answered`,title:e,payload:await t()}}catch(t){return{kind:`refused`,title:e,error:t instanceof Error?t:Error(String(t))}}}function WM(e,t,n){let[r,i]=(0,U.useState)({}),a=(0,U.useRef)({key:e});(0,U.useEffect)(()=>{a.current.key=e},[e]),(0,U.useEffect)(()=>{if(e===void 0)return;let n=a.current.out;if(n?.key===e){n.again=!0;return}let r=()=>{let n={key:e,again:!1};a.current.out=n;let o=t=>{a.current.out===n&&(a.current.out=void 0),a.current.key===e&&(t(),n.again&&r())};t().then(t=>o(()=>i({key:e,value:t}))).catch(t=>o(()=>i(n=>({...n.key===e?n:{},key:e,error:GM(t)}))))};r()},[e,n]);let o=r.key===e?r:void 0;return{value:o?.value,error:o?.error,loading:e!==void 0&&o?.value===void 0&&o?.error===void 0}}function GM(e){return e instanceof Error?e:Error(String(e))}var KM=4e3;function qM({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let s=JM(e),c=WM(s===void 0?void 0:`${a}/${s}`,()=>t.getArtifact(a,s??``),0),[l,u]=(0,U.useState)(),d=l===s,f=c.value?.content;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:n}),s===void 0?(0,G.jsx)(`p`,{className:`detail-note`,children:r}):c.loading?(0,G.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):f===void 0?(0,G.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{children:d?f:f.slice(-4e3)}),f.length>KM&&(0,G.jsx)(Pa,{onClick:()=>u(d?void 0:s),size:`sm`,type:`button`,variant:`outline`,children:d?`Collapse ${i}`:`Expand ${i}`})]})]})}function JM(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}var YM=365.2425,XM=6048e5,ZM=864e5,QM=6e4,$M=36e5,eN=1e3,tN=525600,nN=43200,rN=1440,iN=3600*24;iN*7,iN*YM/12*3;var aN=Symbol.for(`constructDateFrom`);function oN(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&aN in e?e[aN](t):e instanceof Date?new e.constructor(t):new Date(t)}function sN(e,t){return oN(t||e,e)}var cN={};function lN(){return cN}function uN(e,t){let n=lN(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=sN(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function dN(e,t){return uN(e,{...t,weekStartsOn:1})}function fN(e,t){let n=sN(e,t?.in),r=n.getFullYear(),i=oN(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=dN(i),o=oN(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=dN(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function pN(e){let t=sN(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function mN(e,...t){let n=oN.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function hN(e,t){let n=sN(e,t?.in);return n.setHours(0,0,0,0),n}function gN(e,t,n){let[r,i]=mN(n?.in,e,t),a=hN(r),o=hN(i),s=+a-pN(a),c=+o-pN(o);return Math.round((s-c)/ZM)}function _N(e,t){let n=fN(e,t),r=oN(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),dN(r)}function vN(e,t){let n=sN(e)-+sN(t);return n<0?-1:n>0?1:n}function yN(e){return oN(e,Date.now())}function bN(e,t,n){let[r,i]=mN(n?.in,e,t);return+hN(r)==+hN(i)}function xN(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function SN(e){return!(!xN(e)&&typeof e!=`number`||isNaN(+sN(e)))}function CN(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function wN(e,t){let n=sN(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var TN={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},EN=(e,t,n)=>{let r,i=TN[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function DN(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ON={date:DN({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:DN({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:DN({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},kN={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},AN=(e,t,n,r)=>kN[e];function jN(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var MN={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:jN({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:jN({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:jN({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:jN({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:jN({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function NN(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?FN(s,e=>e.test(o)):PN(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function PN(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function FN(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function IN(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var LN={code:`en-US`,formatDistance:EN,formatLong:ON,formatRelative:AN,localize:MN,match:{ordinalNumber:IN({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:NN({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:NN({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:NN({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:NN({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:NN({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function RN(e,t){let n=sN(e,t?.in);return gN(n,wN(n))+1}function zN(e,t){let n=sN(e,t?.in),r=dN(n)-+_N(n);return Math.round(r/XM)+1}function BN(e,t){let n=sN(e,t?.in),r=n.getFullYear(),i=lN(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=oN(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=uN(o,t),c=oN(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=uN(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function VN(e,t){let n=lN(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=BN(e,t),a=oN(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),uN(a,t)}function HN(e,t){let n=sN(e,t?.in),r=uN(n,t)-+VN(n,t);return Math.round(r/XM)+1}function UN(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var WN={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return UN(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):UN(n+1,2)},d(e,t){return UN(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return UN(e.getHours()%12||12,t.length)},H(e,t){return UN(e.getHours(),t.length)},m(e,t){return UN(e.getMinutes(),t.length)},s(e,t){return UN(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return UN(Math.trunc(r*10**(n-3)),t.length)}},GN={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},KN={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return WN.y(e,t)},Y:function(e,t,n,r){let i=BN(e,r),a=i>0?i:1-i;return t===`YY`?UN(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):UN(a,t.length)},R:function(e,t){return UN(fN(e),t.length)},u:function(e,t){return UN(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return UN(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return UN(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return WN.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return UN(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=HN(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):UN(i,t.length)},I:function(e,t,n){let r=zN(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):UN(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):WN.d(e,t)},D:function(e,t,n){let r=RN(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):UN(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return UN(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return UN(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return UN(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?GN.noon:r===0?GN.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?GN.evening:r>=12?GN.afternoon:r>=4?GN.morning:GN.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return WN.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):WN.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):UN(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):UN(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):WN.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):WN.s(e,t)},S:function(e,t){return WN.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return JN(r);case`XXXX`:case`XX`:return YN(r);default:return YN(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return JN(r);case`xxxx`:case`xx`:return YN(r);default:return YN(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+qN(r,`:`);default:return`GMT`+YN(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+qN(r,`:`);default:return`GMT`+YN(r,`:`)}},t:function(e,t,n){return UN(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return UN(+e,t.length)}};function qN(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+UN(a,2)}function JN(e,t){return e%60==0?(e>0?`-`:`+`)+UN(Math.abs(e)/60,2):YN(e,t)}function YN(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=UN(Math.trunc(r/60),2),a=UN(r%60,2);return n+i+t+a}var XN=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},ZN=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},QN={p:ZN,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return XN(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,XN(r,t)).replace(`{{time}}`,ZN(i,t))}},$N=/^D+$/,eP=/^Y+$/,tP=[`D`,`DD`,`YY`,`YYYY`];function nP(e){return $N.test(e)}function rP(e){return eP.test(e)}function iP(e,t,n){let r=aP(e,t,n);if(console.warn(r),tP.includes(e))throw RangeError(r)}function aP(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var oP=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,sP=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,cP=/^'([^]*?)'?$/,lP=/''/g,uP=/[a-zA-Z]/;function dP(e,t,n){let r=lN(),i=n?.locale??r.locale??LN,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=sN(e,n?.in);if(!SN(s))throw RangeError(`Invalid time value`);let c=t.match(sP).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=QN[t];return n(e,i.formatLong)}return e}).join(``).match(oP).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:fP(e)};if(KN[t])return{isToken:!0,value:e};if(t.match(uP))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&rP(a)||!n?.useAdditionalDayOfYearTokens&&nP(a))&&iP(a,t,String(e));let o=KN[a[0]];return o(s,a,i.localize,l)}).join(``)}function fP(e){let t=e.match(cP);return t?t[1].replace(lP,`'`):e}function pP(e,t,n){let r=lN(),i=n?.locale??r.locale??LN,a=vN(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=mN(n?.in,...a>0?[t,e]:[e,t]),l=CN(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/QM,f=(u-(pN(c)-pN(s)))/QM,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/rN);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/nN);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/tN);return i.formatDistance(`xYears`,e,o)}}function mP(e,t){return pP(e,yN(e),t)}function hP(e){return Math.trunc(e*$M)}function gP(e,t,n){let[r,i]=mN(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function _P(e,t){return gP(oN(t?.in||e,e),yN(t?.in||e))}function vP(e,t){return bN(oN(t?.in||e,e),yN(t?.in||e))}function yP(e){let t=e/$M;return Math.trunc(t)}function bP(e){let t=e/QM;return Math.trunc(t)}function xP(e){let t=e/eN;return Math.trunc(t)}function SP(e){return Math.trunc(e*QM)}function CP(e,t){let n=()=>oN(t?.in,NaN),r=t?.additionalDigits??2,i=OP(e),a;if(i.date){let e=kP(i.date,r);a=AP(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=MP(i.time),isNaN(s)))return n();if(i.timezone){if(c=PP(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=sN(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return sN(o+s+c,t?.in)}var wP={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},TP=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,EP=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,DP=/^([+-])(\d{2})(?::?(\d{2}))?$/;function OP(e){let t={},n=e.split(wP.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],wP.timeZoneDelimiter.test(t.date)&&(t.date=e.split(wP.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=wP.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function kP(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function AP(e,t){if(t===null)return new Date(NaN);let n=e.match(TP);if(!n)return new Date(NaN);let r=!!n[4],i=jP(n[1]),a=jP(n[2])-1,o=jP(n[3]),s=jP(n[4]),c=jP(n[5])-1;if(r)return BP(t,s,c)?FP(t,s,c):new Date(NaN);{let e=new Date(0);return!RP(t,a,o)||!zP(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function jP(e){return e?parseInt(e):1}function MP(e){let t=e.match(EP);if(!t)return NaN;let n=NP(t[1]),r=NP(t[2]),i=NP(t[3]);return VP(n,r,i)?n*$M+r*QM+i*1e3:NaN}function NP(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function PP(e){if(e===`Z`)return 0;let t=e.match(DP);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return HP(r,i)?n*(r*$M+i*QM):NaN}function FP(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var IP=[31,null,31,30,31,30,31,31,30,31,30,31];function LP(e){return e%400==0||e%4==0&&e%100!=0}function RP(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(IP[t]||(LP(e)?29:28))}function zP(e,t){return t>=1&&t<=(LP(e)?366:365)}function BP(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function VP(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function HP(e,t){return t>=0&&t<=59}function UP(e){return e*eN}function WP(e){let t=Math.max(0,Math.round(e));if(t<UP(1))return`${t}ms`;let n=yP(t),r=bP(t-hP(n)),i=xP(t-hP(n)-SP(r));return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function GP(e){return WP(UP(e))}function KP(e){let t=CP(e);return SN(t)?t:void 0}function qP(e){let t=KP(e);return t===void 0?e:vP(t)?dP(t,`HH:mm:ss`):_P(t)?dP(t,`MMM d, HH:mm:ss`):dP(t,`MMM d yyyy, HH:mm:ss`)}function JP(e){let t=KP(e);return t===void 0?e:dP(t,`PPpp zzzz`)}function YP(e){return new Date(e).toISOString()}function XP(e){let t=KP(e);return t===void 0?e:mP(t,{addSuffix:!0})}function ZP({at:e,className:t,relative:n=!1}){let r=KP(e);return r===void 0?(0,G.jsx)(`span`,{className:t,children:e}):(0,G.jsx)(`time`,{className:t,dateTime:r.toISOString(),title:JP(e),children:n?XP(e):qP(e)})}var QP={node:`Node dispatch`,observer:`Observer`,"pr-author":`Change request author`,"review-reply":`Review reply author`};function $P(e){return kM.some(t=>t===e)}function eF(e){return $P(e)?QP[e]:e}function tF(e){return e.attempt===void 0?eF(e.scope):`${eF(e.scope)} · attempt ${e.attempt}`}function nF(e){let t=new Map;for(let n of e){let e=n.labels[OM.scope]??`unscoped`,r=n.labels[OM.attempt],i=`${e} ${r??``}`,a=t.get(i);a===void 0?t.set(i,{scope:e,attempt:r,sessions:[n]}):t.set(i,{...a,sessions:[...a.sessions,n]})}let n=e=>$P(e)?kM.indexOf(e):kM.length;return[...t.values()].sort((e,t)=>n(e.scope)-n(t.scope)||e.scope.localeCompare(t.scope)||Number(e.attempt??0)-Number(t.attempt??0))}function rF(e){let t=[],n=e.labels[OM.node];n!==void 0&&t.push([`node`,n]);let r=e.labels[OM.step];r!==void 0&&t.push([`step`,r]);for(let[n,r]of Object.entries(e.labels))n.startsWith(`onepipeline.`)||t.push([n,r]);return t}function iF(e){return`${e} ${e===1?`agent`:`agents`}`}function aF({client:e,title:t,agents:n,count:r,runId:i}){let a=n.value?.sessions??[],o=nF(a);return(0,G.jsxs)(`section`,{"aria-label":t,className:`channel-section agents-panel`,children:[(0,G.jsxs)(`h3`,{children:[t,r!==void 0&&(0,G.jsx)(Ma,{variant:`secondary`,children:iF(r)})]}),n.error&&(0,G.jsx)(HM,{label:t,outcome:{kind:`refused`,title:t,error:n.error}}),n.loading?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),`Loading agents…`]}):n.value===void 0?null:a.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`No agents launched.`}):(0,G.jsx)(`div`,{className:`channel-list agents-groups`,children:o.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{children:tF(t)}),(0,G.jsx)(`ul`,{"aria-label":tF(t),children:t.sessions.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(oF,{client:e,runId:t.run_id??i,session:t})},t.history_session))})]},tF(t)))}),n.value!==void 0&&n.value.skipped>0&&(0,G.jsxs)(`p`,{className:`channel-empty`,children:[n.value.skipped,` `,n.value.skipped===1?`line`:`lines`,` `,`of the pointer file could not be read.`]})]})}function oF({client:e,runId:t,session:n}){let[r,i]=(0,U.useState)();return(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(`strong`,{children:n.name}),rF(n).map(([e,t])=>(0,G.jsxs)(Ma,{variant:`outline`,children:[e,` `,t]},e)),(0,G.jsxs)(`span`,{className:`channel-age`,children:[`started `,(0,G.jsx)(ZP,{at:n.started,relative:!0})]})]}),(0,G.jsx)(`ul`,{"aria-label":`Harness runs of ${n.name}`,className:`agent-runs`,children:n.runs.map(n=>{let a=r===n.history_id;return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(Ma,{variant:`secondary`,children:n.harness_id}),(0,G.jsx)(`span`,{className:`channel-age`,children:(0,G.jsx)(ZP,{at:n.started})}),t===void 0?(0,G.jsx)(`span`,{className:`channel-age`,children:`This session names no run to open its transcript under.`}):(0,G.jsx)(Pa,{"aria-expanded":a,onClick:()=>i(a?void 0:n.history_id),size:`sm`,type:`button`,variant:`outline`,children:a?`Close transcript`:`Open transcript`})]}),a&&t!==void 0&&(0,G.jsx)(qM,{artifactId:n.history_id,client:e,heading:`Oneharness conversation`,missing:`This run named no conversation.`,noun:`conversation`,runId:t,unreadable:`The history store holds no readable copy of that conversation.`})]},n.history_id)})})]})})}function sF(e,t,n){return WM(t,()=>e.getAgents(t),n)}function cF(e,t,n,r){return WM(`${t}/${n}`,()=>e.getNodeAgents(t,n),r)}function lF(e,t,n){return WM(t,()=>e.getProjectAgents(t??``),n)}function uF({client:e,runId:t,count:n,invalidations:r}){return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`channel-view`,children:(0,G.jsx)(aF,{agents:sF(e,t,r),client:e,count:n,runId:t,title:`Agents`})})})}function dF({client:e,runId:t,nodeId:n,invalidations:r}){return(0,G.jsx)(aF,{agents:cF(e,t,n,r),client:e,runId:t,title:`Agents of ${n}`})}var fF={approve:`Approve`,reject:`Reject`,continue:`Continue`},pF=[`review`,`readjust`,`decline`,`withdraw-note`],mF=[`approve`,`reject`,`continue`,...aM.filter(e=>!pF.some(t=>t===e))];function hF(e){return mF.some(t=>t===e)}var gF={approve:[`message`,`reason`],reject:[`message`,`reason`],continue:[`message`],add:[`json`],drop:[`id`,`dependents`],reparent:[`id`,`deps`],retry:[`id`,`json`],rework:[`id`,`reason`,`instruction`,`comments`,`title`,`replacement`],retitle:[`id`,`title`,`reason`],cancel:[`id`,`reason`],requeue:[`id`,`json`],"set-node-sets":[`id`,`sets`],"set-run-node-sets":[`runSets`],attest:[`reference`],complete:[`reason`],amend:[`id`,`text`],note:[`id`,`addressee`,`text`,`criterion`,`deliver`,`persist`],finding:[`message`,`blocking`,`id`],settle:[`id`,`outcome`,`evidence`,`landing`]};function _F(e,t){let n=vF(e,t);if(`problem`in n)return n;let r=oM.safeParse(n.envelope);if(!r.success){let e=r.error.issues[0];return{problem:`${e?.path.join(`.`)||`envelope`}: ${e?.message??`not an envelope`}`}}return{envelope:r.data,bytes:JSON.stringify(r.data,null,2)}}function vF(e,t){let n=e=>{let n=t[e];return typeof n==`string`&&n.trim().length>0?n:void 0};switch(e){case`approve`:return{envelope:{completion:!0,...bF(`message`,n(`message`)),...bF(`reason`,n(`reason`))}};case`reject`:return{envelope:{completion:!1,...bF(`message`,n(`message`)),...bF(`reason`,n(`reason`))}};case`continue`:return{envelope:{message:n(`message`)??``}};default:{let r=yF(e,t,n);return`problem`in r?r:{envelope:{version:3,commands:[r.command]}}}}}function yF(e,t,n){let r=n(`id`);switch(e){case`add`:case`retry`:case`requeue`:{let t=n(`json`);if(t===void 0&&e!==`requeue`)return{problem:`node: a node mapping is required`};let i;if(t!==void 0)try{i=JSON.parse(t)}catch(t){return{problem:`${e===`requeue`?`amend`:`node`}: ${t instanceof Error?t.message:`not JSON`}`}}return e===`add`?{command:{op:e,node:i}}:e===`retry`?{command:{op:e,id:r,node:i}}:{command:{op:e,id:r,...bF(`amend`,i)}}}case`set-node-sets`:case`set-run-node-sets`:{let n=[...(e===`set-node-sets`?t.sets:t.runSets)??[]],i=n.findIndex(e=>e.trim().length===0);return i>=0?{problem:`sets.${i}: an override needs a PATH=VALUE`}:e===`set-node-sets`?{command:{op:e,id:r,sets:n}}:{command:{op:e,sets:n}}}case`drop`:return{command:{op:e,id:r,dependents:n(`dependents`)}};case`reparent`:return{command:{op:e,id:r,deps:(t.deps??``).split(`
89
- `).map(e=>e.trim()).filter(e=>e.length>0)}};case`rework`:{let t,i=n(`comments`);if(i!==void 0)try{t=JSON.parse(i)}catch(e){return{problem:`comments: ${e instanceof Error?e.message:`not JSON`}`}}return{command:{op:e,id:r,reason:n(`reason`),instruction:n(`instruction`),...bF(`comments`,t),...bF(`title`,n(`title`)),...bF(`replacement`,n(`replacement`))}}}case`retitle`:return{command:{op:e,id:r,title:n(`title`),reason:n(`reason`)}};case`cancel`:return{command:{op:e,id:r,...bF(`reason`,n(`reason`))}};case`attest`:return{command:{op:e,ref:n(`reference`)}};case`complete`:return{command:{op:e,reason:n(`reason`)}};case`amend`:return{command:{op:e,id:r,text:n(`text`)}};case`note`:return{command:{op:e,id:r,addressee:n(`addressee`),text:n(`text`),...bF(`criterion`,n(`criterion`)),...bF(`deliver`,n(`deliver`)===`live`?void 0:n(`deliver`)),...t.persist===!1?{persist:!1}:{}}};case`finding`:return{command:{op:e,message:n(`message`),...t.blocking===!0?{blocking:!0}:{},...bF(`id`,r)}};case`settle`:return{command:{op:e,id:r,outcome:n(`outcome`),evidence:n(`evidence`),...bF(`landing`,n(`landing`))}};default:return{problem:`op: ${String(e)} is not an op`}}}function bF(e,t){let n={};return t!==void 0&&(n[e]=t),n}function xF(e){let t=e.op;return typeof t==`string`?t:`?`}function SF({legend:e,sets:t,onChange:n,current:r}){let i=(0,U.useId)(),a=(e,r)=>n(t.map((t,n)=>n===e?r:t)),o=(e,r)=>{let i=[...t],[a]=i.splice(e,1);a!==void 0&&i.splice(r,0,a),n(i)};return(0,G.jsxs)(`fieldset`,{"aria-describedby":`${i}-hint`,className:`sets-editor`,children:[(0,G.jsx)(`legend`,{children:e}),(0,G.jsx)(`p`,{className:`sets-hint`,id:`${i}-hint`,children:`One PATH=VALUE a row, applied in order — the whole list is replaced, and an empty list clears it.`}),t.length===0?(0,G.jsx)(`p`,{className:`sets-empty`,children:`No overrides: sends an empty list.`}):(0,G.jsx)(`ol`,{className:`sets-list`,children:t.map((e,r)=>{let i=r+1;return(0,G.jsxs)(`li`,{className:`sets-row`,children:[(0,G.jsx)(Tc,{"aria-label":`Override ${i}`,className:`sets-entry`,onChange:e=>a(r,e.target.value),placeholder:`members.worker.agent.model=VALUE`,spellCheck:!1,value:e}),(0,G.jsx)(Pa,{"aria-label":`Move override ${i} up`,disabled:r===0,onClick:()=>o(r,r-1),size:`icon`,type:`button`,variant:`ghost`,children:(0,G.jsx)(vt,{})}),(0,G.jsx)(Pa,{"aria-label":`Move override ${i} down`,disabled:r===t.length-1,onClick:()=>o(r,r+1),size:`icon`,type:`button`,variant:`ghost`,children:(0,G.jsx)(gt,{})}),(0,G.jsx)(Pa,{"aria-label":`Remove override ${i}`,onClick:()=>n(t.filter((e,t)=>t!==r)),size:`icon`,type:`button`,variant:`ghost`,children:(0,G.jsx)(un,{})})]},r)})}),(0,G.jsxs)(`div`,{className:`composer-actions`,children:[(0,G.jsxs)(Pa,{onClick:()=>n([...t,``]),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(Yt,{size:14}),` Add override`]}),(0,G.jsxs)(Pa,{disabled:r===void 0,onClick:()=>{r!==void 0&&n([...r])},size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(Qt,{size:14}),` Load current list`]}),(0,G.jsx)(`span`,{className:`sets-current`,children:r===void 0?`No current list to load`:r.length===0?`Current list: none`:`Current list: ${r.join(` · `)}`})]})]})}function CF(e,t,n){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)();return{run:(0,U.useCallback)(async(...r)=>{i(!0);let a=await UM(typeof e==`string`?e:e(...r),()=>t(...r));return o(a),i(!1),a.kind===`answered`&&n?.(),a},[e,t,n]),pending:r,outcome:a}}function wF(e,t,n,r){let[i,a]=(0,U.useState)(`continue`),[o,s]=(0,U.useState)({}),[c,l]=(0,U.useState)(),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(``);return{shortcut:i,setShortcut:a,fields:o,setField:(0,U.useCallback)((e,t)=>s(n=>({...n,[e]:t})),[]),problem:c,compose:(0,U.useCallback)(()=>{let e=_F(i,{...n,...o});if(`problem`in e){l(e.problem);return}l(void 0),d(e.bytes)},[i,o,n]),envelope:u,setEnvelope:d,correlation:f,setCorrelation:p,send:CF(`Reply`,(0,U.useCallback)(()=>e.reply(t,u,f.trim()===``?void 0:f.trim()),[e,t,u,f]),r)}}var TF={message:`Message`,reason:`Reason`,instruction:`Instruction`,title:`Title`,replacement:`Replacement node id (optional)`,comments:`Review comments (JSON, optional)`,id:`Node id`,text:`Text`,addressee:`Addressee`,deliver:`Deliver`,persist:`Carry to the next dispatch if no turn takes it`,criterion:`Criterion (optional)`,dependents:`Dependents`,deps:`Dependencies, one per line`,reference:`Reference`,outcome:`Outcome`,evidence:`Evidence`,landing:`Landing (optional)`,blocking:`Blocking`,json:`Mapping (JSON)`,sets:`Node overrides`,runSets:`Run-wide overrides`},EF={addressee:$j.options,deliver:eM.options,dependents:tM.options,outcome:nM.options},DF=Object.fromEntries(Object.entries(EF).map(([e,t])=>[e,t[0]]));function OF({client:e,runId:t,onSent:n,overrides:r}){let i=(0,U.useId)(),{shortcut:a,setShortcut:o,fields:s,setField:c,problem:l,compose:u,envelope:d,setEnvelope:f,correlation:p,setCorrelation:m,send:h}=wF(e,t,DF,n);return(0,G.jsxs)(`section`,{"aria-labelledby":`${i}-heading`,className:`composer`,children:[(0,G.jsx)(`h3`,{id:`${i}-heading`,children:`Reply`}),(0,G.jsxs)(`div`,{className:`composer-shortcut`,children:[(0,G.jsx)(Oc,{htmlFor:`${i}-shortcut`,children:`Shortcut`}),(0,G.jsxs)(`select`,{className:`composer-select`,id:`${i}-shortcut`,onChange:e=>{let t=e.target.value;hF(t)&&o(t)},value:a,children:[(0,G.jsx)(`optgroup`,{label:`Verdict`,children:Object.entries(fF).map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))}),(0,G.jsx)(`optgroup`,{label:`Edit`,children:mF.filter(e=>!(e in fF)).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,G.jsx)(`div`,{className:`composer-fields`,children:gF[a].map(e=>{let t=`${i}-${e}`,n=EF[e];if(e===`sets`||e===`runSets`){let t=typeof s.id==`string`?s.id.trim():``;return(0,G.jsx)(SF,{current:e===`runSets`?r?.run:r?.nodes.get(t),legend:`${TF[e]}, in order`,onChange:t=>c(e,t),sets:s[e]??[]},e)}if(e===`persist`||e===`blocking`)return(0,G.jsxs)(`div`,{className:`composer-check`,children:[(0,G.jsx)(`input`,{checked:e===`persist`?s.persist!==!1:s.blocking===!0,id:t,onChange:t=>c(e,t.target.checked),type:`checkbox`}),(0,G.jsx)(Oc,{htmlFor:t,children:TF[e]})]},e);let a=s[e],o=typeof a==`string`?a:``;return(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:t,children:TF[e]}),n===void 0?e===`message`||e===`text`||e===`json`||e===`deps`||e===`evidence`?(0,G.jsx)(Tp,{id:t,onChange:t=>c(e,t.target.value),rows:e===`json`?5:2,value:o}):(0,G.jsx)(Tc,{id:t,onChange:t=>c(e,t.target.value),value:o}):(0,G.jsx)(`select`,{className:`composer-select`,id:t,onChange:t=>c(e,t.target.value),value:o||n[0],children:n.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]},e)})}),(0,G.jsxs)(`div`,{className:`composer-actions`,children:[(0,G.jsxs)(Pa,{onClick:u,size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(cn,{size:14}),` Compose envelope`]}),l!==void 0&&(0,G.jsx)(`p`,{"aria-label":`Envelope not composed`,className:`composer-problem`,role:`alert`,children:l})]}),(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:`${i}-envelope`,children:`Envelope (sent as typed)`}),(0,G.jsx)(Tp,{className:`composer-envelope`,id:`${i}-envelope`,onChange:e=>f(e.target.value),rows:8,spellCheck:!1,value:d})]}),(0,G.jsxs)(`div`,{className:`composer-field composer-correlation`,children:[(0,G.jsx)(Oc,{htmlFor:`${i}-correlation`,children:`Correlation (optional)`}),(0,G.jsx)(Tc,{id:`${i}-correlation`,onChange:e=>m(e.target.value),value:p})]}),(0,G.jsxs)(`div`,{className:`composer-actions`,children:[(0,G.jsxs)(Pa,{disabled:h.pending||d.trim()===``,onClick:()=>void h.run(),size:`sm`,type:`button`,children:[(0,G.jsx)(tn,{size:14}),` Send reply`]}),(0,G.jsx)(`span`,{"aria-live":`polite`,className:`run-list-status`,children:h.pending?`Sending…`:``})]}),(0,G.jsx)(HM,{label:`Reply`,outcome:h.outcome})]})}function kF({client:e,runId:t,filter:n,decisions:r,observedAt:i,invalidations:a,overrides:o}){let{queue:s,wrote:c}=AF(e,t,a),l=CF(`Next`,(0,U.useCallback)(()=>e.claimNext(t,n),[e,t,n]),c);return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`channel-view`,children:[(0,G.jsxs)(`section`,{"aria-labelledby":`channel-queue-heading`,className:`channel-section`,children:[(0,G.jsxs)(`div`,{className:`section-heading channel-heading`,children:[(0,G.jsxs)(`h3`,{id:`channel-queue-heading`,children:[(0,G.jsx)(Lt,{size:15}),` Channel queue`]}),(0,G.jsx)(Pa,{disabled:l.pending,onClick:()=>void l.run(),size:`sm`,type:`button`,children:`Next`})]}),s.error&&(0,G.jsx)(HM,{label:`Channel`,outcome:{kind:`refused`,title:`Channel`,error:s.error}}),s.value===void 0&&s.loading?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),`Loading channel…`]}):s.value?(0,G.jsx)(jF,{observedAt:i,queue:s.value}):null,(0,G.jsx)(HM,{label:`Next`,outcome:l.outcome})]}),(0,G.jsx)(PF,{client:e,decisions:r,onWrote:c,runId:t}),(0,G.jsx)(OF,{client:e,onSent:c,overrides:o,runId:t}),(0,G.jsx)(FF,{client:e,onRaised:c,runId:t})]})})}function AF(e,t,n){let[r,i]=(0,U.useState)(0);return{queue:WM(t,()=>e.getChannel(t),n+r),wrote:(0,U.useCallback)(()=>i(e=>e+1),[])}}function jF({queue:e,observedAt:t}){let n=new Set(e.waiting.map(e=>e.id)),r=e.held,i=r!==null&&r.abandoned!==!0?r:void 0,a=r!==null&&r.abandoned===!0?r:void 0,o=e.surfaces.filter(e=>!n.has(e.id)&&e.id!==r?.id);return(0,G.jsxs)(`div`,{className:`channel-queue`,children:[(0,G.jsx)(MF,{emptyText:`Nothing is waiting on an answer.`,observedAt:t,surfaces:i?[i]:[],title:`Pending`}),(0,G.jsx)(MF,{emptyText:`No unread surfaces.`,observedAt:t,surfaces:e.waiting,title:`Waiting`}),a&&(0,G.jsx)(MF,{emptyText:``,observedAt:t,surfaces:[a],title:`Abandoned`}),(0,G.jsx)(MF,{emptyText:`No surface has been answered yet.`,observedAt:t,surfaces:o,title:`Answered`}),(0,G.jsxs)(`section`,{"aria-label":`Replies`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Replies`}),e.replies.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`No reply written yet.`}):(0,G.jsx)(`ul`,{children:e.replies.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsxs)(Ma,{variant:`outline`,children:[`reply `,e.id]}),e.correlation!==void 0&&(0,G.jsxs)(Ma,{variant:`secondary`,children:[`answers `,e.correlation]}),(0,G.jsx)(ZP,{at:YP(e.at),relative:!0})]}),(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.reply,null,2)})]})})},e.id))})]}),(0,G.jsxs)(`section`,{"aria-label":`Queued commands`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Queued commands`}),e.commands.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`Nothing awaits the reconciler.`}):(0,G.jsx)(`ul`,{children:e.commands.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsx)(Ia,{children:(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsxs)(Ma,{variant:`outline`,children:[`envelope `,e.id]}),(0,G.jsx)(Ma,{variant:`secondary`,children:e.author??`planner`}),(0,G.jsx)(`span`,{children:e.commands.map(xF).join(`, `)})]})})})},e.id))})]}),(0,G.jsxs)(`section`,{"aria-label":`Command outcomes`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Command outcomes`}),e.outcomes.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`The reconciler has answered nothing yet.`}):(0,G.jsx)(`ul`,{children:e.outcomes.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsxs)(Ma,{variant:`outline`,children:[`envelope `,e.id]}),(0,G.jsx)(Ma,{variant:e.applied?`default`:`destructive`,children:e.applied?`applied`:`not applied`})]}),e.reason!==void 0&&(0,G.jsx)(`pre`,{className:`verb-text`,children:e.reason}),e.results!==void 0&&e.results.length>0&&(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.results,null,2)})]})})},e.id))})]})]})}function MF({title:e,surfaces:t,emptyText:n,observedAt:r}){return(0,G.jsxs)(`section`,{"aria-label":`${e} surfaces`,className:`channel-list`,children:[(0,G.jsxs)(`h4`,{children:[e,` `,(0,G.jsx)(Ma,{variant:`outline`,children:t.length})]}),t.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:n}):(0,G.jsx)(`ul`,{children:t.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(NF,{observedAt:r,surface:e})},e.id))})]})}function NF({surface:e,observedAt:t}){let n=Math.max(0,(Date.parse(t)-e.queued_at)/1e3);return(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(Ma,{children:e.kind}),(0,G.jsxs)(Ma,{variant:`secondary`,children:[`from `,e.source]}),e.blocking?(0,G.jsx)(Ma,{variant:`destructive`,children:`blocking`}):(0,G.jsx)(Ma,{variant:`outline`,children:`non-blocking`}),e.workstream!==void 0&&(0,G.jsxs)(Ma,{variant:`outline`,children:[`node `,e.workstream]}),(0,G.jsxs)(`span`,{className:`channel-age`,children:[`surface `,e.id,` · `,GP(n),` old`]})]}),(0,G.jsx)(`p`,{className:`channel-message`,children:e.message})]})})}function PF({client:e,runId:t,decisions:n,onWrote:r}){let i=IF(e,t,r);return(0,G.jsxs)(`section`,{"aria-labelledby":`attest-heading`,className:`channel-section`,children:[(0,G.jsxs)(`h3`,{id:`attest-heading`,children:[(0,G.jsx)(xt,{size:15}),` Ready human actions`]}),n.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`No decision point is holding the graph.`}):(0,G.jsx)(`ul`,{className:`attest-list`,children:n.map(e=>(0,G.jsxs)(`li`,{className:`attest-row`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(Ma,{variant:`outline`,children:e.kind}),` `,(0,G.jsx)(`span`,{className:`attest-reference`,children:e.id}),e.unblocks.length>0&&(0,G.jsxs)(`span`,{className:`channel-age`,children:[` `,`· unblocks `,e.unblocks.join(`, `)]})]}),(0,G.jsxs)(Pa,{disabled:i.pending,onClick:()=>void i.run(e.id),size:`sm`,type:`button`,variant:`outline`,children:[`Attest `,e.id]})]},e.id))}),(0,G.jsx)(HM,{label:`Attest`,outcome:i.outcome})]})}function FF({client:e,runId:t,onRaised:n}){let r=(0,U.useId)(),{kind:i,setKind:a,message:o,setMessage:s,raise:c}=LF(e,t,n);return(0,G.jsxs)(`section`,{"aria-labelledby":`${r}-heading`,className:`channel-section`,children:[(0,G.jsxs)(`h3`,{id:`${r}-heading`,children:[(0,G.jsx)(Ut,{size:15}),` Surface`]}),(0,G.jsxs)(`div`,{className:`composer-fields`,children:[(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:`${r}-kind`,children:`Kind`}),(0,G.jsx)(Tc,{id:`${r}-kind`,onChange:e=>a(e.target.value),placeholder:`finding`,value:i})]}),(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:`${r}-message`,children:`Message`}),(0,G.jsx)(Tp,{id:`${r}-message`,onChange:e=>s(e.target.value),rows:2,value:o})]})]}),(0,G.jsx)(`div`,{className:`composer-actions`,children:(0,G.jsx)(Pa,{disabled:c.pending||i.trim()===``,onClick:()=>void c.run(),size:`sm`,type:`button`,variant:`outline`,children:`Raise surface`})}),(0,G.jsx)(HM,{label:`Surface`,outcome:c.outcome})]})}function IF(e,t,n){return CF(e=>`Attest ${e}`,(0,U.useCallback)(n=>e.attest(t,n),[e,t]),n)}function LF(e,t,n){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``);return{kind:r,setKind:i,message:a,setMessage:o,raise:CF(`Surface`,(0,U.useCallback)(()=>e.surface(t,{kind:r,message:a}),[e,t,r,a]),(0,U.useCallback)(()=>{o(``),n()},[n]))}}var RF={status:`Status`,results:`Results`,goals:`Goals`,transcript:`Transcript`,telemetry:`Telemetry`,host:`Host`};function zF(e){return Object.hasOwn(RF,e)}function BF(e,t,n){let[r,i]=(0,U.useState)(`status`),[a,o]=(0,U.useState)();return{read:r,setRead:i,node:a,setNode:o,results:WM(r===`results`?t:void 0,()=>e.getResults(t),n),goals:WM(r===`goals`?t:void 0,()=>e.getRunGoals(t),n),transcript:WM(r===`transcript`?`${t}/${a??``}`:void 0,()=>e.getTranscript(t,a),n),telemetry:WM(r===`telemetry`?t:void 0,()=>e.getTelemetryDocument(t),n),host:WM(r===`host`?`host`:void 0,()=>e.host(),n)}}function VF({client:e,runId:t,nodes:n,status:r,invalidations:i}){let{read:a,setRead:o,node:s,setNode:c,results:l,goals:u,transcript:d,telemetry:f,host:p}=BF(e,t,i);return(0,G.jsxs)(bp,{className:`reads-view min-h-0 h-full gap-0`,onValueChange:e=>{zF(e)&&o(e)},value:a,children:[(0,G.jsx)(`div`,{className:`view-tabs reads-tabs`,children:(0,G.jsx)(Sp,{"aria-label":`Reads`,variant:`line`,children:Object.entries(RF).map(([e,t])=>(0,G.jsx)(Cp,{value:e,children:t},e))})}),(0,G.jsx)(wp,{className:`min-h-0`,value:a,children:(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`channel-view`,children:[a===`status`&&(0,G.jsx)(HF,{read:r,title:`Status`,children:r.value&&(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(Ma,{variant:`outline`,children:r.value.liveness}),(0,G.jsxs)(Ma,{variant:`secondary`,children:[r.value.unread_surfaces.count,` unread`,r.value.unread_surfaces.oldest_seconds!==null&&`, oldest ${r.value.unread_surfaces.oldest_seconds}s`]}),(0,G.jsx)(`span`,{className:`channel-age`,children:r.value.summary})]})}),a===`results`&&(0,G.jsx)(HF,{read:l,title:`Results`}),a===`goals`&&(0,G.jsx)(HF,{read:u,title:`Goals`}),a===`transcript`&&(0,G.jsx)(HF,{read:d,title:`Transcript`,children:(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(`label`,{className:`channel-age`,htmlFor:`transcript-node`,children:`Node`}),(0,G.jsxs)(`select`,{className:`composer-select`,id:`transcript-node`,onChange:e=>c(e.target.value===``?void 0:e.target.value),value:s??``,children:[(0,G.jsx)(`option`,{value:``,children:`Whole run`}),n.map(({id:e})=>(0,G.jsx)(`option`,{value:e,children:e},e))]})]})}),a===`telemetry`&&(0,G.jsxs)(`section`,{"aria-label":`Telemetry`,className:`channel-section`,children:[(0,G.jsx)(`h3`,{children:`Telemetry`}),f.error&&(0,G.jsx)(HM,{label:`Telemetry`,outcome:{kind:`refused`,title:`Telemetry`,error:f.error}}),f.loading?(0,G.jsx)(UF,{}):f.value?(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(f.value.telemetry,null,2)}):null]}),a===`host`&&(0,G.jsx)(HF,{read:p,title:`Host`})]})})})]})}function HF({title:e,read:t,children:n}){return(0,G.jsxs)(`section`,{"aria-label":e,className:`channel-section`,children:[(0,G.jsx)(`h3`,{children:e}),n,t.error&&(0,G.jsx)(HM,{label:e,outcome:{kind:`refused`,title:e,error:t.error}}),t.loading?(0,G.jsx)(UF,{}):t.value?(0,G.jsx)(`pre`,{className:`verb-text`,children:t.value.rendered}):null]})}function UF(){return(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),`Loading…`]})}function WF(e){return/\[[^\]]+\]/.exec(e)?.[0]}function GF({runId:e,control:t,ended:n}){let{stop:r,stopOpen:i,setStopOpen:a,forceOpen:o,setForceOpen:s,refusal:c}=KF(t),l=c===void 0?void 0:WF(c.message),u=r.outcome,d=r.pending,f=t.status.value?.liveness;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`run-actions`,children:[f!==void 0&&(0,G.jsx)(Ma,{"aria-label":`Liveness ${f}`,className:`run-actions-badge`,variant:`outline`,children:f}),!n&&(0,G.jsxs)(Pa,{"aria-label":`Stop`,disabled:d,onClick:()=>a(!0),size:`sm`,title:`Stop`,type:`button`,variant:`destructive`,children:[(0,G.jsx)(Jt,{size:14}),(0,G.jsx)(`span`,{className:`run-action-label`,children:`Stop`})]})]}),(0,G.jsx)(gc,{onOpenChange:a,open:i,children:(0,G.jsxs)(bc,{children:[(0,G.jsxs)(xc,{children:[(0,G.jsxs)(Cc,{children:[`Stop `,e,`?`]}),(0,G.jsx)(wc,{children:`The run is stopped as the acting session. A run another session owns is refused, naming its owner.`})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsx)(vc,{asChild:!0,children:(0,G.jsx)(Pa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,G.jsx)(Pa,{disabled:d,onClick:()=>void r.run(!1),type:`button`,variant:`destructive`,children:`Stop run`})]})]})}),(0,G.jsx)(gc,{onOpenChange:s,open:o,children:(0,G.jsxs)(bc,{children:[(0,G.jsxs)(xc,{children:[(0,G.jsxs)(Cc,{children:[`Force-stop `,e,l!==void 0&&`, overriding ${l}`,`?`]}),(0,G.jsxs)(wc,{children:[c?.message,` — `,`a forced stop is journalled forced with the owner it overrode.`]})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsx)(vc,{asChild:!0,children:(0,G.jsx)(Pa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,G.jsxs)(Pa,{disabled:d,onClick:()=>void r.run(!0),type:`button`,variant:`destructive`,children:[`Force stop`,l!==void 0&&`, overriding ${l}`]})]})]})}),u!==void 0&&(0,G.jsxs)(`div`,{className:`run-outcomes`,children:[(0,G.jsx)(HM,{label:`Stop`,outcome:u}),c!==void 0&&(0,G.jsx)(`div`,{className:`composer-actions`,children:(0,G.jsx)(Pa,{onClick:()=>s(!0),size:`sm`,type:`button`,variant:`destructive`,children:`Force stop…`})})]})]})}function KF(e){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(!1),a=CF(e=>e?`Forced stop`:`Stop`,(0,U.useCallback)(async t=>{try{return await e.stop(t)}finally{n(!1),i(!1)}},[e.stop]));return{stop:a,stopOpen:t,setStopOpen:n,forceOpen:r,setForceOpen:i,refusal:a.outcome?.kind===`refused`&&a.outcome.error instanceof IM&&a.outcome.error.code===`not_owner`?a.outcome.error:void 0}}var qF=1e4;function JF(e,t,n){let[r,i]=(0,U.useState)(0);return(0,U.useEffect)(()=>{if(t===void 0)return;let e=setInterval(()=>i(e=>e+1),qF);return()=>clearInterval(e)},[t]),{status:WM(t,()=>e.getStatus(t??``),n+r),stop:(0,U.useCallback)(n=>e.stop(t??``,n),[e,t])}}var YF=o(((e,t)=>{var n=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===`\0`)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,s=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?i:this._defaultEdgeLabelFn(e,t,n);var u=o(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n),o=this._edgeObjs[r];return o&&(e=o.v,t=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function a(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=n})),XF=o(((e,t)=>{t.exports=`2.2.4`})),ZF=o(((e,t)=>{t.exports={Graph:YF(),version:XF()}})),QF=o(((e,t)=>{var n=YF();t.exports={write:r,read:o};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function o(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}})),$F=o(((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}})),eI=o(((e,t)=>{t.exports=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}})),tI=o(((e,t)=>{var n=eI();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}})),nI=o(((e,t)=>{var n=tI();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),rI=o(((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}})),iI=o(((e,t)=>{var n=rI();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}})),aI=o(((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}})),oI=o(((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r})),sI=o(((e,t)=>{var n=oI();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),cI=o(((e,t)=>{t.exports=n;function n(e,t,n){Array.isArray(t)||(t=[t]);var a=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?r:i,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,a,c,s)}),s}function r(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),a(t(o[0]),e=>i.push([e,!1])))}}function i(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),a(t(o),e=>i.push(e)))}}function a(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}})),lI=o(((e,t)=>{var n=cI();t.exports=r;function r(e,t){return n(e,t,`post`)}})),uI=o(((e,t)=>{var n=cI();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),dI=o(((e,t)=>{var n=YF(),r=eI();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return i}})),fI=o(((e,t)=>{t.exports={components:$F(),dijkstra:tI(),dijkstraAll:nI(),findCycles:iI(),floydWarshall:aI(),isAcyclic:sI(),postorder:lI(),preorder:uI(),prim:dI(),tarjan:rI(),topsort:oI()}})),pI=o(((e,t)=>{var n=ZF();t.exports={Graph:n.Graph,json:QF(),alg:fI(),version:n.version}})),mI=o(((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n})),hI=o(((e,t)=>{var n=pI().Graph,r=mI();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}})),gI=o(((e,t)=>{var n=pI().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}})),_I=o(((e,t)=>{var n=hI(),r=gI().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}})),vI=o(((e,t)=>{var n=gI();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}})),yI=o(((e,t)=>{var{applyWithChunking:n}=gI();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}})),bI=o(((e,t)=>{var n=pI().Graph,r=yI().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}})),xI=o(((e,t)=>{var n=bI(),r=yI().slack,i=yI().longestPath,a=pI().alg.preorder,o=pI().alg.postorder,s=gI().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}})),SI=o(((e,t)=>{var n=yI().longestPath,r=bI(),i=xI();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}})),CI=o(((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}})),wI=o(((e,t)=>{var n=gI();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}})),TI=o(((e,t)=>{var n=gI();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}})),EI=o(((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}})),DI=o(((e,t)=>{var n=gI();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}})),OI=o(((e,t)=>{var n=gI().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}})),kI=o(((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}})),AI=o(((e,t)=>{var n=gI();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}})),jI=o(((e,t)=>{var n=gI();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}})),MI=o(((e,t)=>{var n=kI(),r=AI(),i=jI();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}})),NI=o(((e,t)=>{var n=pI().Graph,r=gI();t.exports=i;function i(e,t,r){let i=a(e),o=new n({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return e.nodes().forEach(n=>{let a=e.node(n),s=e.parent(n);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(o.setNode(n),o.setParent(n,s||i),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=o.edge(r,n),a=i===void 0?0:i.weight;o.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(a,`minRank`)&&o.setNode(n,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),o}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}})),PI=o(((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}})),FI=o(((e,t)=>{var n=DI(),r=OI(),i=MI(),a=NI(),o=PI(),s=pI().Graph,c=gI();t.exports=l;function l(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t&&t.disableOptimalOrderHeuristic)return;let p=1/0,m;for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2),s=c.buildLayerMatrix(e);let i=r(e,s);i<p&&(n=0,m=Object.assign({},s),p=i)}f(e,m)}function u(e,t,n){return t.map(function(t){return a(e,t,n)})}function d(e,t){let n=new s;e.forEach(function(e){let r=e.graph().root,a=i(e,r,n,t);a.vs.forEach((t,n)=>e.node(t).order=n),o(e,n,a.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}})),II=o(((e,t)=>{var n=pI().Graph,r=gI();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}})),LI=o(((e,t)=>{var n=gI(),r=II().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+n/2),i+=n+r})}})),RI=o(((e,t)=>{var n=_I(),r=vI(),i=SI(),a=gI().normalizeRanks,o=CI(),s=gI().removeEmptyRanks,c=wI(),l=TI(),u=EI(),d=FI(),f=LI(),p=gI(),m=pI().Graph;t.exports=h;function h(e,t){let n=t&&t.debugTiming?p.time:p.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r))})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>F(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>I(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>L(e)),t(` removeBorderNodes`,()=>ee(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},b=[`acyclicer`,`ranker`,`rankdir`,`align`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=ne(e.graph());return t.setGraph(Object.assign({},y,te(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=te(ne(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=ne(e.edge(n));t.setEdge(n,Object.assign({},w,te(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function ee(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function F(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function I(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function L(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function te(e,t){return p.mapValues(p.pick(e,t),Number)}function ne(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}})),zI=o(((e,t)=>{var n=gI(),r=pI().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}})),BI=o(((e,t)=>{t.exports=`1.1.5`})),VI=l(o(((e,t)=>{t.exports={graphlib:pI(),layout:RI(),debug:zI(),util:{time:gI().time,notime:gI().notime},version:BI()}}))(),1),HI=[`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`],UI=200,WI=72,GI=80,KI=32,qI=new Set(HI),JI={pending:`neutral`,running:`active`,waiting:`blocked`,blocked:`blocked`,skipped:`blocked`,done:`success`,"not-completed":`danger`,failed:`danger`,parked:`muted`,cancelled:`muted`,unknown:`neutral`},YI=(e,t)=>e<t?-1:+(e>t);function XI(e){let t=[...e.nodes].sort((e,t)=>YI(e.id,t.id)),n=[...e.edges].sort((e,t)=>YI(e.id,t.id)),r=new Map(t.map(e=>[e.id,e]));if(r.size!==t.length)throw Error(`DAG node IDs must be unique`);for(let e of t)if(!qI.has(e.state))throw Error(`DAG node ${e.id} has unsupported state ${e.state}`);let i=new Map(t.map(e=>[e.id,0])),a=new Map(t.map(e=>[e.id,[]])),o=new Set;for(let e of n){if(o.has(e.id))throw Error(`DAG edge IDs must be unique`);if(o.add(e.id),!r.has(e.source)||!r.has(e.target))throw Error(`DAG edge ${e.id} has a missing endpoint`);if(e.source===e.target)throw Error(`DAG edge ${e.id} is a self-edge`);i.set(e.target,(i.get(e.target)??0)+1),a.get(e.source)?.push(e.target)}let s=new Map,c=t.filter(e=>i.get(e.id)===0).map(e=>e.id),l=0;for(;c.length>0;){let e=c;c=[];for(let t of e){l+=1;let e=s.get(t)??0;for(let n of a.get(t)??[]){s.set(n,Math.max(s.get(n)??0,e+1));let t=(i.get(n)??0)-1;i.set(n,t),t===0&&c.push(n)}}c.sort()}if(l!==t.length)throw Error(`DAG contains a cycle`);let u=new VI.default.graphlib.Graph({multigraph:!0});u.setGraph({rankdir:`LR`,ranksep:GI,nodesep:KI,marginx:0,marginy:0}),u.setDefaultEdgeLabel(()=>({}));for(let e of t)u.setNode(e.id,{width:UI,height:WI});for(let e of n)u.setEdge(e.source,e.target,{},e.id);VI.default.layout(u);let d=new Map;for(let e of t){let t=s.get(e.id)??0,n=d.get(t)??[];n.push(e.id),d.set(t,n)}for(let e of d.values())e.sort((e,t)=>(u.node(e)?.y??0)-(u.node(t)?.y??0)||YI(e,t));let f=t.map(e=>{let t=s.get(e.id)??0,n=d.get(t)?.indexOf(e.id)??0;return{...e,x:t*280,y:n*104,width:UI,height:WI,style:JI[e.state]}}),p=new Map(f.map(e=>[e.id,e])),m=n.map(e=>{let t=p.get(e.source),n=p.get(e.target);if(!t||!n)throw Error(`DAG layout lost an edge endpoint`);let r={x:t.x+t.width,y:t.y+t.height/2},i={x:n.x,y:n.y+n.height/2},a=Math.round((r.x+i.x)/2);return{...e,points:[r,{x:a,y:r.y},{x:a,y:i.y},i]}});return{width:f.length===0?0:Math.max(...f.map(e=>e.x+e.width)),height:f.length===0?0:Math.max(...f.map(e=>e.y+e.height)),nodes:f,edges:m}}function ZI(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ZI(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var QI={value:()=>{}};function $I(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new eL(n)}function eL(e){this._=e}function tL(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}eL.prototype=$I.prototype={constructor:eL,on:function(e,t){var n=this._,r=tL(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=nL(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=rL(n[i],e.name,t);else if(t==null)for(i in n)n[i]=rL(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new eL(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function nL(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function rL(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=QI,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var iL={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function aL(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),iL.hasOwnProperty(t)?{space:iL[t],local:e}:e}function oL(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function sL(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function cL(e){var t=aL(e);return(t.local?sL:oL)(t)}function lL(){}function uL(e){return e==null?lL:function(){return this.querySelector(e)}}function dL(e){typeof e!=`function`&&(e=uL(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new $R(r,this._parents)}function fL(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function pL(){return[]}function mL(e){return e==null?pL:function(){return this.querySelectorAll(e)}}function hL(e){return function(){return fL(e.apply(this,arguments))}}function gL(e){e=typeof e==`function`?hL(e):mL(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new $R(r,i)}function _L(e){return function(){return this.matches(e)}}function vL(e){return function(t){return t.matches(e)}}var yL=Array.prototype.find;function bL(e){return function(){return yL.call(this.children,e)}}function xL(){return this.firstElementChild}function SL(e){return this.select(e==null?xL:bL(typeof e==`function`?e:vL(e)))}var CL=Array.prototype.filter;function wL(){return Array.from(this.children)}function TL(e){return function(){return CL.call(this.children,e)}}function EL(e){return this.selectAll(e==null?wL:TL(typeof e==`function`?e:vL(e)))}function DL(e){typeof e!=`function`&&(e=_L(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new $R(r,this._parents)}function OL(e){return Array(e.length)}function kL(){return new $R(this._enter||this._groups.map(OL),this._parents)}function AL(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}AL.prototype={constructor:AL,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function jL(e){return function(){return e}}function ML(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new AL(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function NL(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new AL(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function PL(e){return e.__data__}function FL(e,t){if(!arguments.length)return Array.from(this,PL);var n=t?NL:ML,r=this._parents,i=this._groups;typeof e!=`function`&&(e=jL(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=IL(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new $R(o,r),o._enter=s,o._exit=c,o}function IL(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function LL(){return new $R(this._exit||this._groups.map(OL),this._parents)}function RL(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function zL(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new $R(s,this._parents)}function BL(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function VL(e){e||=HL;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new $R(i,this._parents).order()}function HL(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function UL(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function WL(){return Array.from(this)}function GL(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function KL(){let e=0;for(let t of this)++e;return e}function qL(){return!this.node()}function JL(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function YL(e){return function(){this.removeAttribute(e)}}function XL(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ZL(e,t){return function(){this.setAttribute(e,t)}}function QL(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function $L(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function eR(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function tR(e,t){var n=aL(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?XL:YL:typeof t==`function`?n.local?eR:$L:n.local?QL:ZL)(n,t))}function nR(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rR(e){return function(){this.style.removeProperty(e)}}function iR(e,t,n){return function(){this.style.setProperty(e,t,n)}}function aR(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function oR(e,t,n){return arguments.length>1?this.each((t==null?rR:typeof t==`function`?aR:iR)(e,t,n??``)):sR(this.node(),e)}function sR(e,t){return e.style.getPropertyValue(t)||nR(e).getComputedStyle(e,null).getPropertyValue(t)}function cR(e){return function(){delete this[e]}}function lR(e,t){return function(){this[e]=t}}function uR(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function dR(e,t){return arguments.length>1?this.each((t==null?cR:typeof t==`function`?uR:lR)(e,t)):this.node()[e]}function fR(e){return e.trim().split(/^|\s+/)}function pR(e){return e.classList||new mR(e)}function mR(e){this._node=e,this._names=fR(e.getAttribute(`class`)||``)}mR.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function hR(e,t){for(var n=pR(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function gR(e,t){for(var n=pR(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function _R(e){return function(){hR(this,e)}}function vR(e){return function(){gR(this,e)}}function yR(e,t){return function(){(t.apply(this,arguments)?hR:gR)(this,e)}}function bR(e,t){var n=fR(e+``);if(arguments.length<2){for(var r=pR(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?yR:t?_R:vR)(n,t))}function xR(){this.textContent=``}function SR(e){return function(){this.textContent=e}}function CR(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function wR(e){return arguments.length?this.each(e==null?xR:(typeof e==`function`?CR:SR)(e)):this.node().textContent}function TR(){this.innerHTML=``}function ER(e){return function(){this.innerHTML=e}}function DR(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function OR(e){return arguments.length?this.each(e==null?TR:(typeof e==`function`?DR:ER)(e)):this.node().innerHTML}function kR(){this.nextSibling&&this.parentNode.appendChild(this)}function AR(){return this.each(kR)}function jR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function MR(){return this.each(jR)}function NR(e){var t=typeof e==`function`?e:cL(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function PR(){return null}function FR(e,t){var n=typeof e==`function`?e:cL(e),r=t==null?PR:typeof t==`function`?t:uL(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function IR(){var e=this.parentNode;e&&e.removeChild(this)}function LR(){return this.each(IR)}function RR(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zR(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function BR(e){return this.select(e?zR:RR)}function VR(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function HR(e){return function(t){e.call(this,t,this.__data__)}}function UR(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function WR(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function GR(e,t,n){return function(){var r=this.__on,i,a=HR(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function KR(e,t,n){var r=UR(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?GR:WR,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function qR(e,t,n){var r=nR(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function JR(e,t){return function(){return qR(this,e,t)}}function YR(e,t){return function(){return qR(this,e,t.apply(this,arguments))}}function XR(e,t){return this.each((typeof t==`function`?YR:JR)(e,t))}function*ZR(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var QR=[null];function $R(e,t){this._groups=e,this._parents=t}function ez(){return new $R([[document.documentElement]],QR)}function tz(){return this}$R.prototype=ez.prototype={constructor:$R,select:dL,selectAll:gL,selectChild:SL,selectChildren:EL,filter:DL,data:FL,enter:kL,exit:LL,join:RL,merge:zL,selection:tz,order:BL,sort:VL,call:UL,nodes:WL,node:GL,size:KL,empty:qL,each:JL,attr:tR,style:oR,property:dR,classed:bR,text:wR,html:OR,raise:AR,lower:MR,append:NR,insert:FR,remove:LR,clone:BR,datum:VR,on:KR,dispatch:XR,[Symbol.iterator]:ZR};function nz(e){return typeof e==`string`?new $R([[document.querySelector(e)]],[document.documentElement]):new $R([[e]],QR)}function rz(e){let t;for(;t=e.sourceEvent;)e=t;return e}function iz(e,t){if(e=rz(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var az={passive:!1},oz={capture:!0,passive:!1};function sz(e){e.stopImmediatePropagation()}function cz(e){e.preventDefault(),e.stopImmediatePropagation()}function lz(e){var t=e.document.documentElement,n=nz(e).on(`dragstart.drag`,cz,oz);`onselectstart`in t?n.on(`selectstart.drag`,cz,oz):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function uz(e,t){var n=e.document.documentElement,r=nz(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,cz,oz),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var dz=e=>()=>e;function fz(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}fz.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function pz(e){return!e.ctrlKey&&!e.button}function mz(){return this.parentNode}function hz(e,t){return t??{x:e.x,y:e.y}}function gz(){return navigator.maxTouchPoints||`ontouchstart`in this}function _z(){var e=pz,t=mz,n=hz,r=gz,i={},a=$I(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,az).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(nz(n.view).on(`mousemove.drag`,m,oz).on(`mouseup.drag`,h,oz),lz(n.view),sz(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(cz(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){nz(e.view).on(`mousemove.drag mouseup.drag`,null),uz(e.view,l),cz(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(sz(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(cz(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(sz(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=iz(l||r,t),p,m,h;if((h=n.call(e,new fz(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=iz(l||a,t),_=o;break}u.call(r,e,new fz(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:dz(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:dz(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:dz(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:dz(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function vz(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function yz(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function bz(){}var xz=.7,Sz=1/xz,Cz=`\\s*([+-]?\\d+)\\s*`,wz=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Tz=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,Ez=/^#([0-9a-f]{3,8})$/,Dz=RegExp(`^rgb\\(${Cz},${Cz},${Cz}\\)$`),Oz=RegExp(`^rgb\\(${Tz},${Tz},${Tz}\\)$`),kz=RegExp(`^rgba\\(${Cz},${Cz},${Cz},${wz}\\)$`),Az=RegExp(`^rgba\\(${Tz},${Tz},${Tz},${wz}\\)$`),jz=RegExp(`^hsl\\(${wz},${Tz},${Tz}\\)$`),Mz=RegExp(`^hsla\\(${wz},${Tz},${Tz},${wz}\\)$`),Nz={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};vz(bz,Rz,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Pz,formatHex:Pz,formatHex8:Fz,formatHsl:Iz,formatRgb:Lz,toString:Lz});function Pz(){return this.rgb().formatHex()}function Fz(){return this.rgb().formatHex8()}function Iz(){return Zz(this).formatHsl()}function Lz(){return this.rgb().formatRgb()}function Rz(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=Ez.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?zz(t):n===3?new Uz(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Bz(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Bz(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Dz.exec(e))?new Uz(t[1],t[2],t[3],1):(t=Oz.exec(e))?new Uz(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=kz.exec(e))?Bz(t[1],t[2],t[3],t[4]):(t=Az.exec(e))?Bz(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jz.exec(e))?Xz(t[1],t[2]/100,t[3]/100,1):(t=Mz.exec(e))?Xz(t[1],t[2]/100,t[3]/100,t[4]):Nz.hasOwnProperty(e)?zz(Nz[e]):e===`transparent`?new Uz(NaN,NaN,NaN,0):null}function zz(e){return new Uz(e>>16&255,e>>8&255,e&255,1)}function Bz(e,t,n,r){return r<=0&&(e=t=n=NaN),new Uz(e,t,n,r)}function Vz(e){return e instanceof bz||(e=Rz(e)),e?(e=e.rgb(),new Uz(e.r,e.g,e.b,e.opacity)):new Uz}function Hz(e,t,n,r){return arguments.length===1?Vz(e):new Uz(e,t,n,r??1)}function Uz(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}vz(Uz,Hz,yz(bz,{brighter(e){return e=e==null?Sz:Sz**+e,new Uz(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?xz:xz**+e,new Uz(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Uz(Jz(this.r),Jz(this.g),Jz(this.b),qz(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Wz,formatHex:Wz,formatHex8:Gz,formatRgb:Kz,toString:Kz}));function Wz(){return`#${Yz(this.r)}${Yz(this.g)}${Yz(this.b)}`}function Gz(){return`#${Yz(this.r)}${Yz(this.g)}${Yz(this.b)}${Yz((isNaN(this.opacity)?1:this.opacity)*255)}`}function Kz(){let e=qz(this.opacity);return`${e===1?`rgb(`:`rgba(`}${Jz(this.r)}, ${Jz(this.g)}, ${Jz(this.b)}${e===1?`)`:`, ${e})`}`}function qz(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jz(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Yz(e){return e=Jz(e),(e<16?`0`:``)+e.toString(16)}function Xz(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new $z(e,t,n,r)}function Zz(e){if(e instanceof $z)return new $z(e.h,e.s,e.l,e.opacity);if(e instanceof bz||(e=Rz(e)),!e)return new $z;if(e instanceof $z)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new $z(o,s,c,e.opacity)}function Qz(e,t,n,r){return arguments.length===1?Zz(e):new $z(e,t,n,r??1)}function $z(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}vz($z,Qz,yz(bz,{brighter(e){return e=e==null?Sz:Sz**+e,new $z(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?xz:xz**+e,new $z(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Uz(nB(e>=240?e-240:e+120,i,r),nB(e,i,r),nB(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new $z(eB(this.h),tB(this.s),tB(this.l),qz(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=qz(this.opacity);return`${e===1?`hsl(`:`hsla(`}${eB(this.h)}, ${tB(this.s)*100}%, ${tB(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function eB(e){return e=(e||0)%360,e<0?e+360:e}function tB(e){return Math.max(0,Math.min(1,e||0))}function nB(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var rB=e=>()=>e;function iB(e,t){return function(n){return e+n*t}}function aB(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function oB(e){return(e=+e)==1?sB:function(t,n){return n-t?aB(t,n,e):rB(isNaN(t)?n:t)}}function sB(e,t){var n=t-e;return n?iB(e,n):rB(isNaN(e)?t:e)}var cB=(function e(t){var n=oB(t);function r(e,t){var r=n((e=Hz(e)).r,(t=Hz(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=sB(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function lB(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function uB(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function dB(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=bB(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function fB(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function pB(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mB(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=bB(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var hB=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gB=new RegExp(hB.source,`g`);function _B(e){return function(){return e}}function vB(e){return function(t){return e(t)+``}}function yB(e,t){var n=hB.lastIndex=gB.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=hB.exec(e))&&(i=gB.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:pB(r,i)})),n=gB.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?vB(c[0].x):_B(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function bB(e,t){var n=typeof t,r;return t==null||n===`boolean`?rB(t):(n===`number`?pB:n===`string`?(r=Rz(t))?(t=r,cB):yB:t instanceof Rz?cB:t instanceof Date?fB:uB(t)?lB:Array.isArray(t)?dB:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?mB:pB)(e,t)}var xB=180/Math.PI,SB={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function CB(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*xB,skewX:Math.atan(c)*xB,scaleX:o,scaleY:s}}var wB;function TB(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?SB:CB(t.a,t.b,t.c,t.d,t.e,t.f)}function EB(e){return e==null||(wB||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),wB.setAttribute(`transform`,e),!(e=wB.transform.baseVal.consolidate()))?SB:(e=e.matrix,CB(e.a,e.b,e.c,e.d,e.e,e.f))}function DB(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:pB(e,i)},{i:c-2,x:pB(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:pB(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:pB(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:pB(e,n)},{i:s-2,x:pB(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var OB=DB(TB,`px, `,`px)`,`deg)`),kB=DB(EB,`, `,`)`,`)`),AB=1e-12;function jB(e){return((e=Math.exp(e))+1/e)/2}function MB(e){return((e=Math.exp(e))-1/e)/2}function NB(e){return((e=Math.exp(2*e))-1)/(e+1)}var PB=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<AB)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=jB(y),c=s/(n*g)*(i*NB(t*r+y)-MB(y));return[a+c*d,o+c*f,s*i/jB(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),FB=0,IB=0,LB=0,RB=1e3,zB,BB,VB=0,HB=0,UB=0,WB=typeof performance==`object`&&performance.now?performance:Date,GB=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function KB(){return HB||=(GB(qB),WB.now()+UB)}function qB(){HB=0}function JB(){this._call=this._time=this._next=null}JB.prototype=YB.prototype={constructor:JB,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?KB():+n)+(t==null?0:+t),!this._next&&BB!==this&&(BB?BB._next=this:zB=this,BB=this),this._call=e,this._time=n,eV()},stop:function(){this._call&&(this._call=null,this._time=1/0,eV())}};function YB(e,t,n){var r=new JB;return r.restart(e,t,n),r}function XB(){KB(),++FB;for(var e=zB,t;e;)(t=HB-e._time)>=0&&e._call.call(void 0,t),e=e._next;--FB}function ZB(){HB=(VB=WB.now())+UB,FB=IB=0;try{XB()}finally{FB=0,$B(),HB=0}}function QB(){var e=WB.now(),t=e-VB;t>RB&&(UB-=t,VB=e)}function $B(){for(var e,t=zB,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:zB=n);BB=e,eV(r)}function eV(e){FB||(IB&&=clearTimeout(IB),e-HB>24?(e<1/0&&(IB=setTimeout(ZB,e-WB.now()-UB)),LB&&=clearInterval(LB)):(LB||=(VB=WB.now(),setInterval(QB,RB)),FB=1,GB(ZB)))}function tV(e,t,n){var r=new JB;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var nV=$I(`start`,`end`,`cancel`,`interrupt`),rV=[];function iV(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;cV(e,n,{name:t,index:r,group:i,on:nV,tween:rV,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function aV(e,t){var n=sV(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function oV(e,t){var n=sV(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function sV(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function cV(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=YB(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return tV(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(tV(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function lV(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function uV(e){return this.each(function(){lV(this,e)})}function dV(e,t){var n,r;return function(){var i=oV(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function fV(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=oV(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function pV(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=sV(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?dV:fV)(n,e,t))}function mV(e,t,n){var r=e._id;return e.each(function(){var e=oV(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return sV(e,r).value[t]}}function hV(e,t){var n;return(typeof t==`number`?pB:t instanceof Rz?cB:(n=Rz(t))?(t=n,cB):yB)(e,t)}function gV(e){return function(){this.removeAttribute(e)}}function _V(e){return function(){this.removeAttributeNS(e.space,e.local)}}function vV(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function yV(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function bV(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function xV(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function SV(e,t){var n=aL(e),r=n===`transform`?kB:hV;return this.attrTween(e,typeof t==`function`?(n.local?xV:bV)(n,r,mV(this,`attr.`+e,t)):t==null?(n.local?_V:gV)(n):(n.local?yV:vV)(n,r,t))}function CV(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function wV(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function TV(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&wV(e,i)),n}return i._value=t,i}function EV(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&CV(e,i)),n}return i._value=t,i}function DV(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=aL(e);return this.tween(n,(r.local?TV:EV)(r,t))}function OV(e,t){return function(){aV(this,e).delay=+t.apply(this,arguments)}}function kV(e,t){return t=+t,function(){aV(this,e).delay=t}}function AV(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?OV:kV)(t,e)):sV(this.node(),t).delay}function jV(e,t){return function(){oV(this,e).duration=+t.apply(this,arguments)}}function MV(e,t){return t=+t,function(){oV(this,e).duration=t}}function NV(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?jV:MV)(t,e)):sV(this.node(),t).duration}function PV(e,t){if(typeof t!=`function`)throw Error();return function(){oV(this,e).ease=t}}function FV(e){var t=this._id;return arguments.length?this.each(PV(t,e)):sV(this.node(),t).ease}function IV(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();oV(this,e).ease=n}}function LV(e){if(typeof e!=`function`)throw Error();return this.each(IV(this._id,e))}function RV(e){typeof e!=`function`&&(e=_L(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new pH(r,this._parents,this._name,this._id)}function zV(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new pH(o,this._parents,this._name,this._id)}function BV(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function VV(e,t,n){var r,i,a=BV(t)?aV:oV;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function HV(e,t){var n=this._id;return arguments.length<2?sV(this.node(),n).on.on(e):this.each(VV(n,e,t))}function UV(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function WV(){return this.on(`end.remove`,UV(this._id))}function GV(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=uL(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,iV(l[f],t,n,f,l,sV(u,n)));return new pH(a,this._parents,t,n)}function KV(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=mL(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=sV(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&iV(p,t,n,h,f,m);a.push(f),o.push(u)}return new pH(a,o,t,n)}var qV=ez.prototype.constructor;function JV(){return new qV(this._groups,this._parents)}function YV(e,t){var n,r,i;return function(){var a=sR(this,e),o=(this.style.removeProperty(e),sR(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function XV(e){return function(){this.style.removeProperty(e)}}function ZV(e,t,n){var r,i=n+``,a;return function(){var o=sR(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function QV(e,t,n){var r,i,a;return function(){var o=sR(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),sR(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function $V(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=oV(this,e),l=c.on,u=c.value[a]==null?s||=XV(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function eH(e,t,n){var r=(e+=``)==`transform`?OB:hV;return t==null?this.styleTween(e,YV(e,r)).on(`end.style.`+e,XV(e)):typeof t==`function`?this.styleTween(e,QV(e,r,mV(this,`style.`+e,t))).each($V(this._id,e)):this.styleTween(e,ZV(e,r,t),n).on(`end.style.`+e,null)}function tH(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function nH(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&tH(e,a,n)),r}return a._value=t,a}function rH(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,nH(e,t,n??``))}function iH(e){return function(){this.textContent=e}}function aH(e){return function(){var t=e(this);this.textContent=t??``}}function oH(e){return this.tween(`text`,typeof e==`function`?aH(mV(this,`text`,e)):iH(e==null?``:e+``))}function sH(e){return function(t){this.textContent=e.call(this,t)}}function cH(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&sH(r)),t}return r._value=e,r}function lH(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,cH(e))}function uH(){for(var e=this._name,t=this._id,n=hH(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=sV(c,t);iV(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new pH(r,this._parents,e,n)}function dH(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=oV(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var fH=0;function pH(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function mH(e){return ez().transition(e)}function hH(){return++fH}var gH=ez.prototype;pH.prototype=mH.prototype={constructor:pH,select:GV,selectAll:KV,selectChild:gH.selectChild,selectChildren:gH.selectChildren,filter:RV,merge:zV,selection:JV,transition:uH,call:gH.call,nodes:gH.nodes,node:gH.node,size:gH.size,empty:gH.empty,each:gH.each,on:HV,attr:SV,attrTween:DV,style:eH,styleTween:rH,text:oH,textTween:lH,remove:WV,tween:pV,delay:AV,duration:NV,ease:FV,easeVarying:LV,end:dH,[Symbol.iterator]:gH[Symbol.iterator]};function _H(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var vH={time:null,delay:0,duration:250,ease:_H};function yH(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function bH(e){var t,n;e instanceof pH?(t=e._id,e=e._name):(t=hH(),(n=vH).time=KB(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&iV(c,e,t,l,o,n||yH(c,t));return new pH(r,this._parents,e,t)}ez.prototype.interrupt=uV,ez.prototype.transition=bH;var xH=e=>()=>e;function SH(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function CH(e,t,n){this.k=e,this.x=t,this.y=n}CH.prototype={constructor:CH,scale:function(e){return e===1?this:new CH(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new CH(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var wH=new CH(1,0,0);TH.prototype=CH.prototype;function TH(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wH;return e.__zoom}function EH(e){e.stopImmediatePropagation()}function DH(e){e.preventDefault(),e.stopImmediatePropagation()}function OH(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function kH(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function AH(){return this.__zoom||wH}function jH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function MH(){return navigator.maxTouchPoints||`ontouchstart`in this}function NH(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function PH(){var e=OH,t=kH,n=NH,r=jH,i=MH,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=PB,l=$I(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,AH).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,AH),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(wH.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new CH(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new CH(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new CH(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=nz(this.that).datum();l.call(e,this.that,new SH(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=iz(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],lV(this),s.start();DH(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=nz(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=iz(t,i),l=t.clientX,u=t.clientY;lz(t.view),EH(t),a.mouse=[c,this.__zoom.invert(c)],lV(this),a.start();function d(e){if(DH(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=iz(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),uz(e.view,a.moved),DH(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=iz(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);DH(r),s>0?nz(this).transition().duration(s).call(x,d,c,r):nz(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(EH(t),s=0;s<i;++s)c=r[s],l=iz(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),lV(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(DH(e),s=0;s<a;++s)c=i[s],l=iz(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(EH(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=iz(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=nz(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:xH(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:xH(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:xH(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:xH([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var FH={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},IH=[[-1/0,-1/0],[1/0,1/0]],LH=[`Enter`,` `,`Escape`],RH={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},zH;(function(e){e.Strict=`strict`,e.Loose=`loose`})(zH||={});var BH;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(BH||={});var VH;(function(e){e.Partial=`partial`,e.Full=`full`})(VH||={});var HH={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},UH;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(UH||={});var WH;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(WH||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var GH={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function KH(e){return e===null?null:e?`valid`:`invalid`}var qH=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,JH=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),YH=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),XH=(e,t=[0,0])=>{let{width:n,height:r}=AU(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},ZH=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:fU(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):YH(n)?n:t.nodeLookup.get(n.id)),uU(e,i?mU(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),QH=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=uU(n,mU(e)),r=!0)}),r?fU(n):{x:0,y:0,width:0,height:0}},$H=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=gU(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},eU=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function tU(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=AU(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function nU({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=DU(QH(tU(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function rU({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,FH.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&kU(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=kU(d)?oU(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,FH.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function iU({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=eU(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var aU=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),oU=(e={x:0,y:0},t,n)=>({x:aU(e.x,t[0][0],t[1][0]-(n?.width??0)),y:aU(e.y,t[0][1],t[1][1]-(n?.height??0))});function sU(e,t,n){let{width:r,height:i}=AU(n),{x:a,y:o}=n.internals.positionAbsolute;return oU(e,[[a,o],[a+r,o+i]],t)}var cU=(e,t,n)=>e<t?aU(Math.abs(e-t),1,t)/t:e>n?-aU(Math.abs(e-n),1,t)/t:0,lU=(e,t,n=15,r=40)=>[cU(e.x,r,t.width-r)*n,cU(e.y,r,t.height-r)*n],uU=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),dU=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),fU=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),pU=(e,t=[0,0])=>{let{x:n,y:r}=YH(e)?e.internals.positionAbsolute:XH(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},mU=(e,t=[0,0])=>{let{x:n,y:r}=YH(e)?e.internals.positionAbsolute:XH(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},hU=(e,t)=>fU(uU(dU(e),dU(t))),gU=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},_U=(e,t)=>gU(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),vU=e=>yU(e.width)&&yU(e.height)&&yU(e.x)&&yU(e.y),yU=e=>!isNaN(e)&&isFinite(e),bU=(e,t)=>(e,t)=>{},xU=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),SU=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?xU(s,o):s},CU=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function wU(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function TU(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=wU(e,n),i=wU(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=wU(e.top??e.y??0,n),i=wU(e.bottom??e.y??0,n),a=wU(e.left??e.x??0,t),o=wU(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function EU(e,t,n,r,i,a){let{x:o,y:s}=CU(e,[t,n,r]),{x:c,y:l}=CU({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var DU=(e,t,n,r,i,a)=>{let o=TU(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=aU(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=EU(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},OU=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function kU(e){return e!=null&&e!==`parent`}function AU(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function jU(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function MU(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function NU(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function PU(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function FU(e){return{...RH,...e||{}}}function IU(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=HU(e),s=SU({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?xU(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var LU=e=>({width:e.offsetWidth,height:e.offsetHeight}),RU=e=>e?.getRootNode?.()||window?.document,zU=[`INPUT`,`SELECT`,`TEXTAREA`];function BU(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?zU.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var VU=e=>`clientX`in e,HU=(e,t)=>{let n=VU(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},UU=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...LU(t)}})};function WU({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function GU(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function KU({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-GU(t-r,a),n];case $.Right:return[t+GU(r-t,a),n];case $.Top:return[t,n-GU(n-i,a)];case $.Bottom:return[t,n+GU(i-n,a)]}}function qU({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=KU({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=KU({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=WU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function JU({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function YU({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function XU({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=uU(mU(e),mU(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),_U({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},fU(a))>0}var ZU=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,QU=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),$U=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,FH.error006()),t;let r=n.getEdgeId||ZU,i;return i=qH(e)?{...e}:{...e,id:r(e)},QU(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function eW({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=JU({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var tW={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},nW=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},rW=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function iW({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=tW[t],c=tW[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=nW({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=JU({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function aW(e,t,n,r){let i=Math.min(rW(e,t)/2,rW(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function oW({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=iW({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=aW(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function sW(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function cW(e){let{sourceNode:t,targetNode:n}=e;if(!sW(t)||!sW(n))return null;let r=t.internals.handleBounds||lW(t.handles),i=n.internals.handleBounds||lW(n.handles),a=dW(r?.source??[],e.sourceHandle),o=dW(e.connectionMode===zH.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,FH.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=uW(t,a,s),u=uW(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function lW(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function uW(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??AU(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function dW(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function fW(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function pW(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=fW(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var mW=1e3,hW=10,gW={nodeOrigin:[0,0],nodeExtent:IH,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},_W={...gW,checkEquality:!0};function vW(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function yW(e,t,n){let r=vW(gW,n);for(let n of e.values())if(n.parentId)wW(n,e,t,r);else{let e=oU(XH(n,r.nodeOrigin),kU(n.extent)?n.extent:r.nodeExtent,AU(n));n.internals.positionAbsolute=e}}function bW(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function xW(e){return e===`manual`}function SW(e,t,n,r={}){let i=vW(_W,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!xW(i.zIndexMode)?mW:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=oU(XH(u,i.nodeOrigin),kU(u.extent)?u.extent:i.nodeExtent,AU(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:bW(u,e),z:TW(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&wW(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function CW(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function wW(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=vW(gW,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}CW(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*hW),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=EW(e,u,o,s,a&&!xW(c)?mW:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function TW(e,t,n){let r=yU(e.zIndex)?e.zIndex:0;return xW(n)?r:r+(e.selected?t:0)}function EW(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=AU(e),l=XH(e,n),u=kU(e.extent)?oU(l,e.extent,c):l,d=oU({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=sU(d,c,t));let f=TW(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function DW(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=hU(a.get(n.parentId)?.expandedRect??pU(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=AU(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function OW(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=LU(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=kU(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=sU(h,s,n))}else m&&(h=oU(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:UU(`source`,r.nodeElement,p,d,e.id),target:UU(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&wW(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:pU(g,i)}))}}if(f.length>0){let e=DW(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function kW({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function AW(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function jW(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;AW(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),AW(`target`,s,c,e,i,o),t.set(r.id,r)}}function MW(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:MW(n,t):!1}function NW(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function PW(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!MW(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function FW({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function IW({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=xU(a,t);return{x:o.x-a.x,y:o.y-a.y}}function LW({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=nz(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?dU(QH(s)):null,x=v&&l?IW({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:xU(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=rU({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=FW({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=lU(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=IU(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=PW(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=FW({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=_z().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=IU(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=HU(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=IU(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=HU(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=HU(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=FW({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!NW(t,`.${g}`,v))&&(!_||NW(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function RW(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())_U(i,pU(e))>0&&r.push(e);return r}var zW=250;function BW(e,t,n,r){let i=[],a=1/0,o=RW(e,n,t+zW);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=uW(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function VW(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...uW(o,c,c.position,!0)}:c}function HW(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function UW(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var WW=()=>!0;function GW(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=WW,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=RU(e.target),E=0,D,{x:O,y:k}=HU(e),A=HW(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=VW(i,A,r,c,t);if(!N)return;let P=HU(e,j),ee=!1,F=null,I=!1,L=null;function te(){if(!u||!j)return;let[e,t]=lU(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),R={inProgress:!0,isValid:null,from:uW(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:GH[ne.position],toNode:null,pointer:P};function ie(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=HU(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!ne){oe(e);return}let a=b();P=HU(e,j),D=BW(SU(P,a,!1,[1,1]),n,c,ne),ee||=(te(),!0);let s=KW(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,F=s.connection,I=UW(!!D,s.isValid);let u=c.get(i),f=u?uW(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?CU({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:GH[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),R=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&F&&I&&h?.(F);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,I=!1,F=null,L=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function KW(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=WW,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=HU(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=HW(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===zH.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=VW(t,e,a,u,n,!0)}return _}var qW={onPointerDown:GW,isValid:KW};function JW({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=nz(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&OU()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=PH().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:iz}}var YW=e=>({x:e.x,y:e.y,zoom:e.k}),XW=({x:e,y:t,zoom:n})=>wH.translate(e,t).scale(n),ZW=(e,t)=>e.target.closest(`.${t}`),QW=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),$W=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,eG=(e,t=0,n=$W,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},tG=e=>{let t=e.ctrlKey&&OU()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function nG({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(ZW(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=iz(u),t=d*2**tG(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===BH.Vertical?0:u.deltaX*f,m=i===BH.Horizontal?0:u.deltaY*f;!OU()&&u.shiftKey&&i!==BH.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=YW(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function rG({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=ZW(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function iG({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=YW(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function aG({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&QW(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,YW(a.transform))}}function oG({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&QW(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=YW(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function sG({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(ZW(d,`${l}-flow__node`)||ZW(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||ZW(d,s)&&m||ZW(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function cG({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=PH().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=nz(e).call(f);y({x:i.x,y:i.y,zoom:aU(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(tG);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bB:PB).transform(eG(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!yU(E)||E<0?0:E);let k=O?nG({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):rG({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=iG({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=aG({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=oG({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=sG({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=XW(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=XW(e);return await g(n,t),n}function x(e){if(p){let t=XW(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?TH(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bB:PB).scaleTo(eG(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?bB:PB).scaleBy(eG(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!yU(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var lG;(function(e){e.Line=`line`,e.Handle=`handle`})(lG||={});function uG({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function dG(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function fG(e,t){return Math.max(0,t-e)}function pG(e,t){return Math.max(0,e-t)}function mG(e,t,n){return Math.max(0,t-e,e-n)}function hG(e,t){return e?!t:t}function gG(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=mG(E,h,g),j=mG(D,_,v);if(o){let e=0,t=0;c&&w<0?e=fG(y+w+O,o[0][0]):!c&&w>0&&(e=pG(y+E+O,o[1][0])),l&&T<0?t=fG(b+T+k,o[0][1]):!l&&T>0&&(t=pG(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=pG(y+w,s[0][0]):!c&&w<0&&(e=fG(y+E,s[1][0])),l&&T>0?t=pG(b+T,s[0][1]):!l&&T<0&&(t=fG(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=mG(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?pG(b+k+E/C,o[1][1])*C:fG(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?fG(b+E/C,s[1][1])*C:pG(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=mG(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?pG(y+D*C+O,o[1][0])/C:fG(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?fG(y+D*C,s[1][0])/C:pG(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(hG(c,l)?-w:w)/C:w=(hG(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var _G={width:0,height:0,x:0,y:0},vG={..._G,pointerX:0,pointerY:0,aspectRatio:1};function yG(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function bG({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=nz(e),o={controlDirection:dG(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={..._G},h={...vG};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:dG(e)};let g,_=null,v=[],y,b,x,S=!1,C=_z().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=IU(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=kU(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=yG(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=IU(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=gG(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let ee=uG({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:ee};p?.(e,F)!==!1&&(S=!0,d?.(e,F),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var xG=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),SG=o(((e,t)=>{t.exports=xG()})),CG=o((e=>{var t=d(),n=SG();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),wG=l(o(((e,t)=>{t.exports=CG()}))(),1),TG=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},EG=e=>e?TG(e):TG,{useDebugValue:DG}=U.default,{useSyncExternalStoreWithSelector:OG}=wG.default,kG=e=>e;function AG(e,t=kG,n){let r=OG(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return DG(r),r}var jG=(e,t)=>{let n=EG(e),r=(e,r=t)=>AG(n,e,r);return Object.assign(r,n),r},MG=(e,t)=>e?jG(e,t):jG;function NG(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var PG=(0,U.createContext)(null),FG=PG.Provider,IG=FH.error001(`react`);function LG(e,t){let n=(0,U.useContext)(PG);if(n===null)throw Error(IG);return AG(n,e,t)}function RG(){let e=(0,U.useContext)(PG);if(e===null)throw Error(IG);return(0,U.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var zG={display:`none`},BG={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},VG=`react-flow__node-desc`,HG=`react-flow__edge-desc`,UG=`react-flow__aria-live`,WG=e=>e.ariaLiveMessage,GG=e=>e.ariaLabelConfig;function KG({rfId:e}){let t=LG(WG);return(0,G.jsx)(`div`,{id:`${UG}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:BG,children:t})}function qG({rfId:e,disableKeyboardA11y:t}){let n=LG(GG);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`${VG}-${e}`,style:zG,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,G.jsx)(`div`,{id:`${HG}-${e}`,style:zG,children:n[`edge.a11yDescription.default`]}),!t&&(0,G.jsx)(KG,{rfId:e})]})}var JG=(0,U.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,G.jsx)(`div`,{className:ZI([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));JG.displayName=`Panel`;var YG=`https://reactflow.dev?utm_source=attribution`;function XG({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,G.jsx)(JG,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${YG}`,children:(0,G.jsx)(`a`,{href:YG,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var ZG=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},QG=e=>e.id;function $G(e,t){return NG(e.selectedNodes.map(QG),t.selectedNodes.map(QG))&&NG(e.selectedEdges.map(QG),t.selectedEdges.map(QG))}function eK({onSelectionChange:e}){let t=RG(),{selectedNodes:n,selectedEdges:r}=LG(ZG,$G);return(0,U.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var tK=e=>!!e.onSelectionChangeHandlers;function nK({onSelectionChange:e}){let t=LG(tK);return e||t?(0,G.jsx)(eK,{onSelectionChange:e}):null}var rK=[0,0],iK={x:0,y:0,zoom:1},aK=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],oK=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),sK={translateExtent:IH,nodeOrigin:rK,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function cK(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=LG(oK,NG),l=RG();(0,U.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=sK,s()}),[]);let u=(0,U.useRef)(sK);return(0,U.useEffect)(()=>{for(let s of aK){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:FU(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},aK.map(t=>e[t])),null}function lK(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function uK(e){let[t,n]=(0,U.useState)(e===`system`?null:e);return(0,U.useEffect)(()=>{if(e!==`system`){n(e);return}let t=lK(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?lK()?.matches?`dark`:`light`:t}var dK=typeof document<`u`?document:null;function fK(e=null,t={target:dK,actInsideInputWithModifier:!0}){let[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(!1),a=(0,U.useRef)(new Set([])),[o,s]=(0,U.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
88
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Rw,s=!ww.jitless,c=s&&zw.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?sD([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function uD(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!eT(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>rT(e,r,Tw())))}),t)}var dD=J(`$ZodUnion`,(e,t)=>{SE.init(e,t),Nw(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Nw(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Nw(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Nw(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Aw(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>uD(t,i,e,a)):uD(s,i,e,a)}}),fD=J(`$ZodDiscriminatedUnion`,(e,t)=>{dD.init(e,t);let n=e._zod.parse;Nw(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ow(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Rw(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),pD=J(`$ZodIntersection`,(e,t)=>{SE.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>hD(e,t,n)):hD(e,i,a)}});function mD(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Bw(e)&&Bw(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=mD(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=mD(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hD(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),eT(e))return e;let r=mD(t.value,n.value);if(!r.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}var gD=J(`$ZodRecord`,(e,t)=>{SE.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Bw(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[];if(t.keyType._zod.values){let o=t.keyType._zod.values;n.value={};for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...tT(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...tT(e,o.issues)),n.value[e]=o.value)}let s;for(let e in i)o.has(e)||(s??=[],s.push(e));s&&s.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:s})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>rT(e,r,Tw())),input:o,path:[o],inst:e}),n.value[s.value]=s.value;continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...tT(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...tT(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),_D=J(`$ZodEnum`,(e,t)=>{SE.init(e,t);let n=Ew(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Hw.has(typeof e)).map(e=>typeof e==`string`?Uw(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),vD=J(`$ZodLiteral`,(e,t)=>{if(SE.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);e._zod.values=new Set(t.values),e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Uw(e):e?Uw(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(n,r)=>{let i=n.value;return e._zod.values.has(i)||n.issues.push({code:`invalid_value`,values:t.values,input:i,inst:e}),n}}),yD=J(`$ZodTransform`,(e,t)=>{SE.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cw(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Sw;return n.value=i,n}});function bD(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var xD=J(`$ZodOptional`,(e,t)=>{SE.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Nw(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Nw(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Aw(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>bD(t,e.value)):bD(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),SD=J(`$ZodNullable`,(e,t)=>{SE.init(e,t),Nw(e._zod,`optin`,()=>t.innerType._zod.optin),Nw(e._zod,`optout`,()=>t.innerType._zod.optout),Nw(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Aw(e.source)}|null)$`):void 0}),Nw(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),CD=J(`$ZodDefault`,(e,t)=>{SE.init(e,t),e._zod.optin=`optional`,Nw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wD(e,t)):wD(r,t)}});function wD(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var TD=J(`$ZodPrefault`,(e,t)=>{SE.init(e,t),e._zod.optin=`optional`,Nw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),ED=J(`$ZodNonOptional`,(e,t)=>{SE.init(e,t),Nw(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>DD(t,e)):DD(i,e)}});function DD(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var OD=J(`$ZodCatch`,(e,t)=>{SE.init(e,t),Nw(e._zod,`optin`,()=>t.innerType._zod.optin),Nw(e._zod,`optout`,()=>t.innerType._zod.optout),Nw(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>rT(e,n,Tw()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>rT(e,n,Tw()))},input:e.value}),e.issues=[]),e)}}),kD=J(`$ZodPipe`,(e,t)=>{SE.init(e,t),Nw(e._zod,`values`,()=>t.in._zod.values),Nw(e._zod,`optin`,()=>t.in._zod.optin),Nw(e._zod,`optout`,()=>t.out._zod.optout),Nw(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>AD(e,t.in,n)):AD(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>AD(e,t.out,n)):AD(r,t.out,n)}});function AD(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var jD=J(`$ZodReadonly`,(e,t)=>{SE.init(e,t),Nw(e._zod,`propValues`,()=>t.innerType._zod.propValues),Nw(e._zod,`values`,()=>t.innerType._zod.values),Nw(e._zod,`optin`,()=>t.innerType._zod.optin),Nw(e._zod,`optout`,()=>t.innerType._zod.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(MD):MD(r)}});function MD(e){return e.value=Object.freeze(e.value),e}var ND=J(`$ZodLazy`,(e,t)=>{SE.init(e,t),Nw(e._zod,`innerType`,()=>t.getter()),Nw(e._zod,`pattern`,()=>e._zod.innerType._zod.pattern),Nw(e._zod,`propValues`,()=>e._zod.innerType._zod.propValues),Nw(e._zod,`optin`,()=>e._zod.innerType._zod.optin??void 0),Nw(e._zod,`optout`,()=>e._zod.innerType._zod.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),PD=J(`$ZodCustom`,(e,t)=>{rE.init(e,t),SE.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>FD(t,n,r,e));FD(i,n,r,e)}});function FD(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(aT(e))}}var ID=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];if(this._map.set(e,n),n&&typeof n==`object`&&`id`in n){if(this._idmap.has(n.id))throw Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function LD(){return new ID}var RD=LD();function zD(e,t){return new e({type:`string`,...Y(t)})}function BD(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Y(t)})}function VD(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Y(t)})}function HD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Y(t)})}function UD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Y(t)})}function WD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Y(t)})}function GD(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Y(t)})}function KD(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Y(t)})}function qD(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Y(t)})}function JD(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Y(t)})}function YD(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Y(t)})}function XD(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Y(t)})}function ZD(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Y(t)})}function QD(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Y(t)})}function $D(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Y(t)})}function eO(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Y(t)})}function tO(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Y(t)})}function nO(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Y(t)})}function rO(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Y(t)})}function iO(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Y(t)})}function aO(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Y(t)})}function oO(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Y(t)})}function sO(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Y(t)})}function cO(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Y(t)})}function lO(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Y(t)})}function uO(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Y(t)})}function dO(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Y(t)})}function fO(e,t){return new e({type:`number`,checks:[],...Y(t)})}function pO(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Y(t)})}function mO(e,t){return new e({type:`boolean`,...Y(t)})}function hO(e,t){return new e({type:`null`,...Y(t)})}function gO(e){return new e({type:`unknown`})}function _O(e,t){return new e({type:`never`,...Y(t)})}function vO(e,t){return new aE({check:`less_than`,...Y(t),value:e,inclusive:!1})}function yO(e,t){return new aE({check:`less_than`,...Y(t),value:e,inclusive:!0})}function bO(e,t){return new oE({check:`greater_than`,...Y(t),value:e,inclusive:!1})}function xO(e,t){return new oE({check:`greater_than`,...Y(t),value:e,inclusive:!0})}function SO(e,t){return new sE({check:`multiple_of`,...Y(t),value:e})}function CO(e,t){return new lE({check:`max_length`,...Y(t),maximum:e})}function wO(e,t){return new uE({check:`min_length`,...Y(t),minimum:e})}function TO(e,t){return new dE({check:`length_equals`,...Y(t),length:e})}function EO(e,t){return new pE({check:`string_format`,format:`regex`,...Y(t),pattern:e})}function DO(e){return new mE({check:`string_format`,format:`lowercase`,...Y(e)})}function OO(e){return new hE({check:`string_format`,format:`uppercase`,...Y(e)})}function kO(e,t){return new gE({check:`string_format`,format:`includes`,...Y(t),includes:e})}function AO(e,t){return new _E({check:`string_format`,format:`starts_with`,...Y(t),prefix:e})}function jO(e,t){return new vE({check:`string_format`,format:`ends_with`,...Y(t),suffix:e})}function MO(e){return new yE({check:`overwrite`,tx:e})}function NO(e){return MO(t=>t.normalize(e))}function PO(){return MO(e=>e.trim())}function FO(){return MO(e=>e.toLowerCase())}function IO(){return MO(e=>e.toUpperCase())}function LO(e,t,n){return new e({type:`array`,element:t,...Y(n)})}function RO(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Y(n)})}function zO(e){let t=BO(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(aT(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push(aT(r))}},e(n.value,n)));return t}function BO(e,t){let n=new rE({check:`custom`,...Y(t)});return n._zod.check=e,n}var VO=J(`ZodISODateTime`,(e,t)=>{IE.init(e,t),fk.init(e,t)});function HO(e){return cO(VO,e)}var UO=J(`ZodISODate`,(e,t)=>{LE.init(e,t),fk.init(e,t)});function WO(e){return lO(UO,e)}var GO=J(`ZodISOTime`,(e,t)=>{RE.init(e,t),fk.init(e,t)});function KO(e){return uO(GO,e)}var qO=J(`ZodISODuration`,(e,t)=>{zE.init(e,t),fk.init(e,t)});function JO(e){return dO(qO,e)}var YO=(e,t)=>{sT.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>uT(e,t)},flatten:{value:t=>lT(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Dw,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Dw,2)}},isEmpty:{get(){return e.issues.length===0}}})};J(`ZodError`,YO);var XO=J(`ZodError`,YO,{Parent:Error}),ZO=dT(XO),QO=fT(XO),$O=pT(XO),ek=hT(XO),tk=_T(XO),nk=vT(XO),rk=yT(XO),ik=bT(XO),ak=xT(XO),ok=ST(XO),sk=CT(XO),ck=wT(XO),lk=J(`ZodType`,(e,t)=>(SE.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(Fw(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]})),e.clone=(t,n)=>Ww(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>ZO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>$O(e,t,n),e.parseAsync=async(t,n)=>QO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ek(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>tk(e,t,n),e.decode=(t,n)=>nk(e,t,n),e.encodeAsync=async(t,n)=>rk(e,t,n),e.decodeAsync=async(t,n)=>ik(e,t,n),e.safeEncode=(t,n)=>ak(e,t,n),e.safeDecode=(t,n)=>ok(e,t,n),e.safeEncodeAsync=async(t,n)=>sk(e,t,n),e.safeDecodeAsync=async(t,n)=>ck(e,t,n),e.refine=(t,n)=>e.check(EA(t,n)),e.superRefine=t=>e.check(DA(t)),e.overwrite=t=>e.check(MO(t)),e.optional=()=>cA(e),e.nullable=()=>uA(e),e.nullish=()=>cA(uA(e)),e.nonoptional=t=>gA(e,t),e.array=()=>Z(e),e.or=t=>Jk([e,t]),e.and=t=>Qk(e,t),e.transform=t=>bA(e,oA(t)),e.default=t=>fA(e,t),e.prefault=t=>mA(e,t),e.catch=t=>vA(e,t),e.pipe=t=>bA(e,t),e.readonly=()=>SA(e),e.describe=t=>{let n=e.clone();return RD.add(n,{description:t}),n},Object.defineProperty(e,"description",{get(){return RD.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return RD.get(e);let n=e.clone();return RD.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),uk=J(`_ZodString`,(e,t)=>{CE.init(e,t),lk.init(e,t);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(EO(...t)),e.includes=(...t)=>e.check(kO(...t)),e.startsWith=(...t)=>e.check(AO(...t)),e.endsWith=(...t)=>e.check(jO(...t)),e.min=(...t)=>e.check(wO(...t)),e.max=(...t)=>e.check(CO(...t)),e.length=(...t)=>e.check(TO(...t)),e.nonempty=(...t)=>e.check(wO(1,...t)),e.lowercase=t=>e.check(DO(t)),e.uppercase=t=>e.check(OO(t)),e.trim=()=>e.check(PO()),e.normalize=(...t)=>e.check(NO(...t)),e.toLowerCase=()=>e.check(FO()),e.toUpperCase=()=>e.check(IO())}),dk=J(`ZodString`,(e,t)=>{CE.init(e,t),uk.init(e,t),e.email=t=>e.check(BD(pk,t)),e.url=t=>e.check(KD(gk,t)),e.jwt=t=>e.check(sO(jk,t)),e.emoji=t=>e.check(qD(_k,t)),e.guid=t=>e.check(VD(mk,t)),e.uuid=t=>e.check(HD(hk,t)),e.uuidv4=t=>e.check(UD(hk,t)),e.uuidv6=t=>e.check(WD(hk,t)),e.uuidv7=t=>e.check(GD(hk,t)),e.nanoid=t=>e.check(JD(vk,t)),e.guid=t=>e.check(VD(mk,t)),e.cuid=t=>e.check(YD(yk,t)),e.cuid2=t=>e.check(XD(bk,t)),e.ulid=t=>e.check(ZD(xk,t)),e.base64=t=>e.check(iO(Ok,t)),e.base64url=t=>e.check(aO(kk,t)),e.xid=t=>e.check(QD(Sk,t)),e.ksuid=t=>e.check($D(Ck,t)),e.ipv4=t=>e.check(eO(wk,t)),e.ipv6=t=>e.check(tO(Tk,t)),e.cidrv4=t=>e.check(nO(Ek,t)),e.cidrv6=t=>e.check(rO(Dk,t)),e.e164=t=>e.check(oO(Ak,t)),e.datetime=t=>e.check(HO(t)),e.date=t=>e.check(WO(t)),e.time=t=>e.check(KO(t)),e.duration=t=>e.check(JO(t))});function X(e){return zD(dk,e)}var fk=J(`ZodStringFormat`,(e,t)=>{wE.init(e,t),uk.init(e,t)}),pk=J(`ZodEmail`,(e,t)=>{DE.init(e,t),fk.init(e,t)}),mk=J(`ZodGUID`,(e,t)=>{TE.init(e,t),fk.init(e,t)}),hk=J(`ZodUUID`,(e,t)=>{EE.init(e,t),fk.init(e,t)}),gk=J(`ZodURL`,(e,t)=>{OE.init(e,t),fk.init(e,t)}),_k=J(`ZodEmoji`,(e,t)=>{kE.init(e,t),fk.init(e,t)}),vk=J(`ZodNanoID`,(e,t)=>{AE.init(e,t),fk.init(e,t)}),yk=J(`ZodCUID`,(e,t)=>{jE.init(e,t),fk.init(e,t)}),bk=J(`ZodCUID2`,(e,t)=>{ME.init(e,t),fk.init(e,t)}),xk=J(`ZodULID`,(e,t)=>{NE.init(e,t),fk.init(e,t)}),Sk=J(`ZodXID`,(e,t)=>{PE.init(e,t),fk.init(e,t)}),Ck=J(`ZodKSUID`,(e,t)=>{FE.init(e,t),fk.init(e,t)}),wk=J(`ZodIPv4`,(e,t)=>{BE.init(e,t),fk.init(e,t)}),Tk=J(`ZodIPv6`,(e,t)=>{VE.init(e,t),fk.init(e,t)}),Ek=J(`ZodCIDRv4`,(e,t)=>{HE.init(e,t),fk.init(e,t)}),Dk=J(`ZodCIDRv6`,(e,t)=>{UE.init(e,t),fk.init(e,t)}),Ok=J(`ZodBase64`,(e,t)=>{GE.init(e,t),fk.init(e,t)}),kk=J(`ZodBase64URL`,(e,t)=>{qE.init(e,t),fk.init(e,t)}),Ak=J(`ZodE164`,(e,t)=>{JE.init(e,t),fk.init(e,t)}),jk=J(`ZodJWT`,(e,t)=>{XE.init(e,t),fk.init(e,t)}),Mk=J(`ZodNumber`,(e,t)=>{ZE.init(e,t),lk.init(e,t),e.gt=(t,n)=>e.check(bO(t,n)),e.gte=(t,n)=>e.check(xO(t,n)),e.min=(t,n)=>e.check(xO(t,n)),e.lt=(t,n)=>e.check(vO(t,n)),e.lte=(t,n)=>e.check(yO(t,n)),e.max=(t,n)=>e.check(yO(t,n)),e.int=t=>e.check(Fk(t)),e.safe=t=>e.check(Fk(t)),e.positive=t=>e.check(bO(0,t)),e.nonnegative=t=>e.check(xO(0,t)),e.negative=t=>e.check(vO(0,t)),e.nonpositive=t=>e.check(yO(0,t)),e.multipleOf=(t,n)=>e.check(SO(t,n)),e.step=(t,n)=>e.check(SO(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Nk(e){return fO(Mk,e)}var Pk=J(`ZodNumberFormat`,(e,t)=>{QE.init(e,t),Mk.init(e,t)});function Fk(e){return pO(Pk,e)}var Ik=J(`ZodBoolean`,(e,t)=>{$E.init(e,t),lk.init(e,t)});function Lk(e){return mO(Ik,e)}var Rk=J(`ZodNull`,(e,t)=>{eD.init(e,t),lk.init(e,t)});function zk(e){return hO(Rk,e)}var Bk=J(`ZodUnknown`,(e,t)=>{tD.init(e,t),lk.init(e,t)});function Vk(){return gO(Bk)}var Hk=J(`ZodNever`,(e,t)=>{nD.init(e,t),lk.init(e,t)});function Uk(e){return _O(Hk,e)}var Wk=J(`ZodArray`,(e,t)=>{iD.init(e,t),lk.init(e,t),e.element=t.element,e.min=(t,n)=>e.check(wO(t,n)),e.nonempty=t=>e.check(wO(1,t)),e.max=(t,n)=>e.check(CO(t,n)),e.length=(t,n)=>e.check(TO(t,n)),e.unwrap=()=>e.element});function Z(e,t){return LO(Wk,e,t)}var Gk=J(`ZodObject`,(e,t)=>{lD.init(e,t),lk.init(e,t),Nw(e,`shape`,()=>t.shape),e.keyof=()=>nA(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Vk()}),e.loose=()=>e.clone({...e._zod.def,catchall:Vk()}),e.strict=()=>e.clone({...e._zod.def,catchall:Uk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Yw(e,t),e.safeExtend=t=>Xw(e,t),e.merge=t=>Zw(e,t),e.pick=t=>qw(e,t),e.omit=t=>Jw(e,t),e.partial=(...t)=>Qw(sA,e,t[0]),e.required=(...t)=>$w(hA,e,t[0])});function Kk(e,t){return new Gk({type:`object`,shape:e??{},...Y(t)})}var qk=J(`ZodUnion`,(e,t)=>{dD.init(e,t),lk.init(e,t),e.options=t.options});function Jk(e,t){return new qk({type:`union`,options:e,...Y(t)})}var Yk=J(`ZodDiscriminatedUnion`,(e,t)=>{qk.init(e,t),fD.init(e,t)});function Xk(e,t,n){return new Yk({type:`union`,options:t,discriminator:e,...Y(n)})}var Zk=J(`ZodIntersection`,(e,t)=>{pD.init(e,t),lk.init(e,t)});function Qk(e,t){return new Zk({type:`intersection`,left:e,right:t})}var $k=J(`ZodRecord`,(e,t)=>{gD.init(e,t),lk.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function eA(e,t,n){return new $k({type:`record`,keyType:e,valueType:t,...Y(n)})}var tA=J(`ZodEnum`,(e,t)=>{_D.init(e,t),lk.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new tA({...t,checks:[],...Y(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new tA({...t,checks:[],...Y(r),entries:i})}});function nA(e,t){return new tA({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Y(t)})}var rA=J(`ZodLiteral`,(e,t)=>{vD.init(e,t),lk.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function iA(e,t){return new rA({type:`literal`,values:Array.isArray(e)?e:[e],...Y(t)})}var aA=J(`ZodTransform`,(e,t)=>{yD.init(e,t),lk.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Cw(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(aT(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(aT(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function oA(e){return new aA({type:`transform`,transform:e})}var sA=J(`ZodOptional`,(e,t)=>{xD.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType});function cA(e){return new sA({type:`optional`,innerType:e})}var lA=J(`ZodNullable`,(e,t)=>{SD.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType});function uA(e){return new lA({type:`nullable`,innerType:e})}var dA=J(`ZodDefault`,(e,t)=>{CD.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function fA(e,t){return new dA({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Vw(t)}})}var pA=J(`ZodPrefault`,(e,t)=>{TD.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType});function mA(e,t){return new pA({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Vw(t)}})}var hA=J(`ZodNonOptional`,(e,t)=>{ED.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType});function gA(e,t){return new hA({type:`nonoptional`,innerType:e,...Y(t)})}var _A=J(`ZodCatch`,(e,t)=>{OD.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function vA(e,t){return new _A({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var yA=J(`ZodPipe`,(e,t)=>{kD.init(e,t),lk.init(e,t),e.in=t.in,e.out=t.out});function bA(e,t){return new yA({type:`pipe`,in:e,out:t})}var xA=J(`ZodReadonly`,(e,t)=>{jD.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.innerType});function SA(e){return new xA({type:`readonly`,innerType:e})}var CA=J(`ZodLazy`,(e,t)=>{ND.init(e,t),lk.init(e,t),e.unwrap=()=>e._zod.def.getter()});function wA(e){return new CA({type:`lazy`,getter:e})}var TA=J(`ZodCustom`,(e,t)=>{PD.init(e,t),lk.init(e,t)});function EA(e,t={}){return RO(TA,e,t)}function DA(e){return zO(e)}function OA(e){let t=wA(()=>Jk([X(e),Nk(),Lk(),zk(),Z(t),eA(X(),t)]));return t}var kA=_(),AA=Nk().finite().nonnegative(),jA=Nk().int().nonnegative(),MA=HO({offset:!0}),NA=X().min(1).nullable(),Q=e=>Kk(e).catchall(Vk()),PA={runs:`/api/v2/runs`,run:e=>`/api/v2/runs/${encodeURIComponent(e)}`,timeline:e=>`/api/v2/runs/${encodeURIComponent(e)}/timeline`,conversation:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/conversations/${encodeURIComponent(t)}`,artifact:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,events:`/api/v2/events`,projects:`/api/v2/projects`,project:e=>`/api/v2/projects/${encodeURIComponent(e)}`,channel:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel`,channelNext:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/next`,channelReply:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/reply`,channelSurface:e=>`/api/v2/runs/${encodeURIComponent(e)}/channel/surface`,attest:e=>`/api/v2/runs/${encodeURIComponent(e)}/attest`,stop:e=>`/api/v2/runs/${encodeURIComponent(e)}/stop`,shutdown:`/api/v2/shutdown`,unwatched:`/api/v2/unwatched`,host:`/api/v2/host`,status:e=>`/api/v2/runs/${encodeURIComponent(e)}/status`,results:e=>`/api/v2/runs/${encodeURIComponent(e)}/results`,goals:`/api/v2/goals`,runGoals:e=>`/api/v2/runs/${encodeURIComponent(e)}/goals`,transcript:e=>`/api/v2/runs/${encodeURIComponent(e)}/transcript`,telemetry:e=>`/api/v2/runs/${encodeURIComponent(e)}/telemetry`,agents:e=>`/api/v2/runs/${encodeURIComponent(e)}/agents`,nodeAgents:(e,t)=>`/api/v2/runs/${encodeURIComponent(e)}/nodes/${encodeURIComponent(t)}/agents`,projectAgents:e=>`/api/v2/projects/${encodeURIComponent(e)}/agents`},FA={includeSettled:`include_settled`,includeConversations:`include_conversations`,runId:`run_id`,after:`after`,cursor:`cursor`,limit:`limit`,select:`select`,node:`node`,scope:`scope`,filter:`filter`,correlation:`correlation`,until:`until`,timeout:`timeout`,tick:`tick`},IA={run:`run`,node:`node`},LA={planner:`planner`,detailed:`detailed`},RA=nA([`complete`,`partial`,`legacy`]),zA=nA([`native`,`labelled`,`inferred`]),BA=Q({agent_model_ms:Lk(),judge_model_ms:Lk(),llmlint_model_ms:Lk(),tool_ms:Lk()}),VA=AA.nullable(),HA=jA.nullable(),UA=Q({agent_seconds:VA,judge_seconds:VA,llmlint_seconds:VA,gate_seconds:VA,publication_wait_seconds:VA,lock_wait_seconds:VA,setup_seconds:VA,scheduling_seconds:VA,wall_seconds:VA,agent_model_ms:HA,judge_model_ms:HA,llmlint_model_ms:HA,tool_ms:HA,idle_orchestration_ms:HA,unattributed_ms:HA,wall_ms:HA,fractions:Q({agent_model:VA,judge_model:VA,llmlint_model:VA,tool:VA,idle_orchestration:VA,lock_wait:VA,setup:VA,scheduling:VA})}),WA=X().regex(/^[A-Za-z0-9_-]+$/,`a member name: letters, digits, hyphens and underscores`),GA=nA([`agent`,`judge`,`llmlint`]),KA=AA.nullable(),qA=Q({input_tokens:KA,output_tokens:KA,cache_read_tokens:KA,cache_write_tokens:KA,cost_usd:KA}),JA=Q({agent:qA,judge:qA,llmlint:qA,total:qA}),YA=Q({session_id:X().min(1),history_id:X().min(1).nullable().optional(),role:GA,agent_role:WA.optional(),turn_index:jA.nullable().optional(),started_at:MA.optional(),finished_at:MA.nullable().optional()}),XA=eA(X(),Vk()),ZA=nA([`agent`,`gate`,`checks`,`publication`,`timeout`,`provider`,`configuration`,`unknown`]),QA=nA([`agent`,`judge`,`llmlint`]),$A=nA([`quota_at_launch`,`quota_mid_conversation`,`stale_session_resume`,`rate_limit`,`harness_exit`]),ej=Q({side:QA.optional(),harness:X().optional(),variant:X().optional(),identity:X().optional(),cause:$A.optional(),raw_tail:X().optional(),reset_time:X().optional(),missing_session_id:X().optional(),wait_seconds:Nk().nonnegative().optional(),failure_kind:X().optional(),structured_error:XA.optional(),judge_unrecorded:Lk().optional()}).extend({class:ZA,detail:X().optional()}),tj=Q({node:X().min(1),status:X().min(1),outcome:X().min(1).optional(),branch:X().min(1).optional(),comparison_remote:X().min(1).optional(),comparison_base:X().min(1).optional(),checkpoint:X().min(1).optional(),commit:X().min(1).optional(),retry_lineage:XA.optional(),gate_attestation:XA.optional(),failure:ej.optional(),timing:UA.optional(),usage:JA.optional(),sessions:Z(YA),tool_commands:eA(X(),jA).optional(),turns:jA,lint:jA,timing_quality:RA,linkage_quality:zA,timing_presence:BA}),nj=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:NA,last_progress_at:AA.optional(),timing:UA,nodes:Z(tj),providers:Z(XA).optional(),failure:ej.optional(),check_rollup:XA.optional(),usage:JA,timing_quality:RA,linkage_quality:zA,timing_presence:BA,sources:Z(X()),node_work_ms:Q({agent_model_ms:HA,judge_model_ms:HA,llmlint_model_ms:HA,tool_ms:HA,wall_ms:HA}),turns:jA,lint:jA,agent_count:jA.optional()}),rj=Q({schema_version:Jk([X(),Nk()]).optional(),observed_at:X().optional(),identities:Z(XA)}),ij=Q({launch_id:X().min(1),launcher:nA([`claude-code`,`codex`,`unknown`]),session_key:X().min(1).optional(),launcher_session_id:X().min(1).optional()}),aj=X().min(1),oj=Q({run_id:X().min(1),state:X().min(1),phase:X().min(1),last_event:NA,last_progress_at:AA.optional(),timing_quality:RA,linkage_quality:zA,timing:UA,node_counts:eA(X(),jA),launch:ij.optional(),project:X().min(1).optional(),project_name:X().min(1).optional(),liveness:aj.optional(),unread_surfaces:jA.optional()}),sj=Q({path:X().min(1),reason:X().min(1)}),cj=Q({api_version:iA(2),telemetry_schema_version:iA(23),observed_at:MA,runs:Z(oj),next_cursor:X().min(1).optional(),unreadable:Z(sj).optional(),missing:Z(X().min(1)).optional(),provider_health:rj.optional()}),lj=Q({id:X().min(1),kind:nA([`agent`,`human`]).optional(),persona:X().min(1).optional(),task:X().min(1),deps:Z(X().min(1)).optional(),max_turns:jA.positive().optional(),expects_no_diff:Lk().optional()}),uj=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X().min(1),checkpoint:X().min(1),completed_steps:Z(X()).optional(),pr:X().nullable().optional(),mode:nA([`pause`,`retry`,`continue`]).optional(),attempts:jA.optional()}),dj=Q({branch:X().min(1),repo:X().min(1).optional(),identity:X().min(1).optional(),base_branch:X().min(1).optional(),pr:X().min(1).optional(),pr_base:X().min(1).optional()}),fj=Z(X()),pj=lj.extend({task:X().min(1).optional(),repo:X().min(1).optional(),steps:Z(lj).min(1).optional(),session:X().min(1).optional(),project_dir:X().min(1).optional(),base_branch:X().min(1).optional(),branch:X().min(1).optional(),title:X().min(1).optional(),verify_cmd:X().min(1).optional(),skip_verify:Lk().optional(),verify_via_ci:Lk().optional(),merge_policy:nA([`auto`,`direct`,`none`]).optional(),workflow:nA([`local`,`remote`]).optional(),repo_type:nA([`single-owner`,`team`]).optional(),execution_checkout:X().min(1).optional(),stack_bases:Z(dj).optional(),resume:uj.optional(),sets:fj.optional()}).superRefine((e,t)=>{e.steps===void 0&&e.task===void 0&&t.addIssue({code:`custom`,path:[`task`],message:"a plan task without `steps` must carry its own `task` prose"})}),mj=Q({gate_log:X().optional(),worker_report:X().optional(),oneharness_session:X().optional()}),hj=Q({id:X().min(1),kind:X().min(1),persona:X().nullable(),status:X().min(1),telemetry:XA.optional(),artifacts:mj.optional()}),gj=Q({ref:X().min(1),task:X(),unblocks:Z(X()),unblocks_publication:Lk()}),_j=Q({branch:X().min(1),base_branch:X().min(1),pr_base:X(),checkpoint:X().min(1),completed_steps:Z(X()),pr:X().nullable(),mode:X().optional()}),vj=Q({identity:X().min(1),target:X().min(1),style:X().min(1).optional(),version:X().min(1)}),yj=Q({kind:X().optional(),status:X().optional(),task:X().optional(),unblocks:Z(X()).optional(),blocked_by:Z(X()).optional(),human_actions:Z(gj).optional(),completed:Lk().optional(),exit_code:Nk().int().nullable().optional(),verdicts:Z(Vk()).optional(),usage:XA.optional(),telemetry:XA.optional(),repo:X().optional(),branch:X().optional(),commit:X().optional(),base_branch:X().optional(),pr_base:X().optional(),synthetic_stack_base:X().nullable().optional(),stack_bases:Z(XA).optional(),repository_type:nA([`single-owner`,`team`]).nullable().optional(),repo_type:nA([`single-owner`,`team`]).nullable().optional(),publication_workflow:nA([`local`,`remote`]).nullable().optional(),workflow:nA([`local`,`remote`]).nullable().optional(),merge_policy:nA([`auto`,`direct`,`none`]).nullable().optional(),outcome:X().optional(),ok:Lk().optional(),pr:X().nullable().optional(),release:vj.nullable().optional(),detail:X().optional(),follow_ups:X().nullable().optional(),steps:Z(hj).optional(),waiting_steps:Z(X()).optional(),resume:_j.nullable().optional(),error:X().nullable().optional(),retry_lineage:XA.optional(),deferred_cleanup:Z(X()).optional(),artifacts:mj.optional()}),bj=Q({ok:Lk().optional(),state:X().optional(),started_order:Z(X()).optional(),results:eA(X(),yj).optional(),schema_version:jA.optional()}),xj=nA([`running`,`done`,`failed`,`waiting`,`parked`,`cancelled`]),Sj=nA([`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`]),Cj=Q({addressable:Lk(),member:X().min(1).optional(),reason:X().min(1).optional()}).superRefine((e,t)=>{e.addressable===(e.reason!==void 0)&&t.addIssue({code:`custom`,path:[`reason`],message:`a reason is carried exactly when there is no turn to address`})}),wj=Q({id:X().min(1),kind:X(),unblocks:Z(X().min(1))}),Tj=Q({run_id:X().min(1),plan:Q({tasks:Z(pj),schema_version:jA.optional(),concurrency:jA.positive().optional(),name:X().min(1).optional(),goal:Q({id:X().min(1),text:X().min(1)}).optional()}),node_states:eA(X(),xj),node_status:eA(X(),Sj),node_gated_by:eA(X(),Z(X().min(1))),node_control:eA(X(),Cj),node_results:eA(X(),yj),decisions:Z(wj),attestations:Z(X()),result:bj.nullable(),last_seq:jA,run_node_sets:fj.optional()}).superRefine((e,t)=>{let n=new Set(e.plan.tasks.map(e=>e.id)),r=new Set(Object.keys(e.node_status));(n.size!==e.plan.tasks.length||n.size!==r.size||[...n].some(e=>!r.has(e)))&&t.addIssue({code:`custom`,path:[`node_status`],message:`must contain exactly one entry for every plan task`}),Object.entries(e.node_gated_by).find(([e,t])=>!n.has(e)||t.some(e=>!n.has(e)))&&t.addIssue({code:`custom`,path:[`node_gated_by`],message:`must name only nodes in this graph's plan`}),Object.keys(e.node_control).find(t=>e.node_status[t]!==`running`)!==void 0&&t.addIssue({code:`custom`,path:[`node_control`],message:`must name only nodes the run has in flight`})}),Ej=Q({cacheReadTokens:KA.optional(),cacheWriteTokens:KA.optional(),costUsd:KA.optional(),inputTokens:KA.optional(),outputTokens:KA.optional()}),Dj=Q({index:jA,input:Vk().optional(),kind:X(),name:X().nullable().optional(),output:X().nullable().optional()}),Oj=Q({judge:X(),kind:X(),decision:X(),reason:X()}),kj=Q({assistant:X().nullable(),durationMs:KA.optional(),failureKind:X().nullable(),finishedAt:MA.nullable().optional(),harness:X(),id:X(),judges:Z(Oj).optional(),model:X().nullable(),modelMs:KA.optional(),reasoning:X().nullable(),startedAt:MA.nullable().optional(),status:X(),timestamp:MA,toolMs:KA.optional(),tools:Z(Dj),unknown:XA,usage:Ej,user:X()}),Aj=Q({conversation:Q({canContinue:Lk(),harnesses:Z(X()),id:X().min(1),name:X(),project:X(),startedAt:MA,state:X(),turns:Z(kj)}),attribution:Q({runId:X().optional(),nodeId:X().optional(),stepId:X().optional(),launchId:X().optional(),launcher:nA([`claude-code`,`codex`,`unknown`]).optional(),transportRole:GA,agentRole:WA.optional(),parentConversationId:X().optional(),persona:X().optional(),finishedAt:MA.nullable().optional(),inferred:iA(!0).optional(),timing:UA.optional()})}),jj=Q({node:X().optional(),conversations:Z(Aj)}),Mj=Jk([Z(Aj),Z(jj).transform(e=>e.flatMap(e=>e.conversations))]),Nj=Q({name:X(),state:X(),status:X().optional(),conclusion:X().optional(),started_at:MA.optional(),completed_at:MA.optional(),required:Lk(),url:X().url().optional()}),Pj=Q({ok:Lk(),output_tail:X(),artifact_id:X().min(1).optional()}),Fj=Q({verification:Q({pre_push_hook:Lk().optional(),required_checks:Z(X()).optional(),required_checks_status:X().optional(),expected_gate:Z(X()).optional(),checks:Z(Nj).optional(),records:Z(Pj)}),publication:Q({pr_url:X().url().optional(),branch:X().optional(),branch_url:X().url().optional(),merged:Lk(),base_branch:X().optional(),commit:X().optional(),commit_url:X().url().optional()}).optional()}),Ij=Q({api_version:iA(2),telemetry_schema_version:iA(23),observed_at:MA,run:nj,graph:Tj.nullable(),conversations:Mj,node_details:eA(X(),Fj).optional().default({}),launch:ij.optional(),provider_health:rj.optional()}),Lj=nA([`conversation`,`gate_log`,`worker_report`,`oneharness_session`,`pr`]),Rj=nA([`run`,`node`,`step`,`dispatch`,`verification`,`publication`,`pr-drafting`,`conflict-resolution`,`human-wait`,`rollup`,`queued`]),zj=nA([`starting`,`dispatching`,`deciding`,`surfacing`,`waiting`,`settled`,`finished`]),Bj=Q({kind:Lj,value:X().min(1)}),Vj=Q({delivered:Lk(),delivery:nA([`live`,`deferred`]).optional(),reached:nA([`queued`,`worker`,`supervisor`,`judged-with`,`carried`]).optional(),turn:nA([`interrupted`,`turn-end`]).optional(),member:X().min(1).optional(),input_bytes:jA.optional(),reason:X().min(1).optional(),node_id:X().min(1).optional()}).superRefine((e,t)=>{e.delivered&&e.reason!==void 0&&t.addIssue({code:`custom`,path:[`reason`],message:`a delivered redirection carries no reason it did not land`}),e.delivery!==void 0&&e.delivered!==(e.delivery===`live`)&&t.addIssue({code:`custom`,path:[`delivery`],message:"`delivery` is `live` exactly when the running turn took the note"})}),Hj=Q({dep:X().min(1),identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),action:X().min(1).optional(),since:MA.optional(),waited_seconds:jA.optional(),last_answer:X().min(1).optional()}),Uj=Q({kind:X().min(1).optional(),message:X().min(1).optional(),source:X().min(1).optional(),blocking:Lk().optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a surface record carries at least one recorded fact`})}),Wj=Q({name:X().min(1).optional(),required:Lk().optional(),state:X().min(1).optional(),kind:X().min(1).optional(),base:X().min(1).optional(),awaited:Z(X().min(1)).optional(),grace_seconds:Nk().nonnegative().optional(),warned:Lk().optional(),head:X().min(1).optional(),verdict:X().min(1).optional(),skipped:Z(X().min(1)).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a review record carries at least one recorded fact`})}),Gj=Q({identity:X().min(1).optional(),target:X().min(1).optional(),style:X().min(1).optional(),version:X().min(1).optional(),landing_commit:X().min(1).optional(),actor:X().min(1).optional(),superseded:Lk().optional(),form:X().min(1).optional(),outcome:X().min(1).optional(),elapsed_ms:jA.optional(),dep:X().min(1).optional(),delivery:X().min(1).optional(),awaiting:Z(Hj).min(1).optional(),versions:Z(Q({identity:X().min(1),target:X().min(1),version:X().min(1)})).min(1).optional()}).superRefine((e,t)=>{Object.values(e).every(e=>e===void 0)&&t.addIssue({code:`custom`,message:`a release record carries at least one recorded fact`})}),Kj=Q({id:X().min(1),label:X().min(1),order:jA,started_at:MA}),qj=Q({id:X().min(1),stream:X().min(1).optional(),seq:jA.optional(),journal_order:jA.optional(),record_id:X().min(1).optional(),persona:X().min(1).optional(),dispatch_id:X().min(1).optional(),dispatch_group:Kj.optional(),fields:eA(X().min(1),OA()).optional(),kind:X().min(1),at:MA,node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),author:X().min(1).optional(),redirection:Vj.optional(),release:Gj.optional(),surface:Uj.optional(),review:Wj.optional(),reference:Bj.optional()}),Jj=Q({started_at:MA,ended_at:MA}),Yj=Q({kind:X().min(1),blocking:Z(X().min(1)).min(1).optional(),ahead:Z(X().min(1)).min(1).optional(),limit:jA.optional(),reference:X().min(1).optional(),awaiting:Z(X().min(1)).min(1).optional()}),Xj=Q({id:X().min(1),kind:Rj,label:X(),started_at:MA,ended_at:MA.nullable(),events:Z(qj),parent_id:X().min(1).optional(),node_id:X().min(1).optional(),step_id:X().min(1).optional(),status:X().min(1).optional(),count:jA.optional(),total_duration_ms:jA.optional(),intervals:Z(Jj).optional(),harness_scope:X().min(1).optional(),dispatch_attempt:X().min(1).optional(),agent_role:WA.optional(),transport_role:GA.optional(),dispatch_id:X().min(1).optional(),dispatch_group:Kj.optional(),reference:Bj.optional(),detail:Q({ok:Lk().optional(),output_tail:X().optional(),artifact_id:X().optional()}).optional(),phase:zj.optional(),reasons:Z(Yj).min(1).optional()}).superRefine((e,t)=>{e.reasons!==void 0&&e.kind!==`queued`&&t.addIssue({code:`custom`,path:[`reasons`],message:`only a queued span carries the reasons a node was held`})}),Zj=Q({id:X().min(1),kind:Lj,content:X(),truncated:Lk()}),Qj=Q({api_version:iA(2),timeline_schema_version:iA(13),observed_at:MA,run_id:X().min(1),spans:Z(Xj)}),$j=Q({error:Q({code:X(),message:X()})});Q({schema_version:iA(1),launch_id:X().min(1),launcher:nA([`claude-code`,`codex`]),launcher_session_id:X().min(1),started_at:MA,repository_identity:X().min(1)});var eM=nA([`snapshot`,`run.changed`,`conversation.changed`,`activity.changed`,`run.removed`]),tM=XA,nM=Z(Kk({event_id:X().min(1),node:X().min(1),step:X().min(1).optional(),at:Nk().finite(),kind:X(),name:X(),detail:X(),events:Nk().int().nonnegative()}));function rM(e){let t=e.indexOf(`:`);if(t===-1)return!1;let n=e.slice(0,t),r=e.slice(t+1);return/^[a-z0-9][a-z0-9-]*$/u.test(n)&&r.length>0&&r.length<=128&&!r.startsWith(`.`)&&/^[A-Za-z0-9._-]+$/u.test(r)}var iM=Q({project:X().min(1).nullable(),name:X().min(1).nullable(),last_write_at:AA.nullable(),runs:Z(oj),agent_count:jA.optional()}),aM=Q({api_version:iA(2),telemetry_schema_version:iA(23),observed_at:MA,projects:Z(iM),unreadable:Z(sj).optional()}),oM=iM.extend({api_version:iA(2),telemetry_schema_version:iA(23),observed_at:MA}),sM={api_version:iA(2),telemetry_schema_version:iA(23),observed_at:MA},cM=Q({id:jA,correlation:X().min(1).optional(),kind:X().min(1),message:X(),source:X().min(1),blocking:Lk(),queued_at:AA,workstream:X().min(1).optional(),abandoned:Lk().optional()}),lM=nA([`worker`,`supervisor`,`both`]),uM=nA([`live`,`next`]),dM=nA([`detach`,`drop`]),fM=nA([`done`,`failed`]),pM=Q({sets:fj.optional()}),mM=Xk(`op`,[Kk({op:iA(`add`),node:pj}).strict(),Kk({op:iA(`drop`),id:X().min(1),dependents:dM,reason:X().min(1).optional()}).strict(),Kk({op:iA(`reparent`),id:X().min(1),deps:Z(X().min(1))}).strict(),Kk({op:iA(`retry`),id:X().min(1),node:pj}).strict(),Kk({op:iA(`cancel`),id:X().min(1),reason:X().min(1).optional()}).strict(),Kk({op:iA(`requeue`),id:X().min(1),amend:pM.optional()}).strict(),Kk({op:iA(`set-node-sets`),id:X().min(1),sets:fj}).strict(),Kk({op:iA(`set-run-node-sets`),sets:fj}).strict(),Kk({op:iA(`attest`),ref:X().min(1)}).strict(),Kk({op:iA(`complete`),reason:X().min(1)}).strict(),Kk({op:iA(`amend`),id:X().min(1),text:X().min(1)}).strict(),Kk({op:iA(`note`),id:X().min(1),addressee:lM,text:X().min(1),criterion:X().min(1).optional(),deliver:uM.optional(),persist:Lk().optional(),delivery_timeout_seconds:Nk().int().positive().optional()}).strict(),Kk({op:iA(`withdraw-note`),envelope:X().min(1),index:Nk().int().nonnegative(),reason:X().min(1)}).strict(),Kk({op:iA(`finding`),message:X().min(1),blocking:Lk().optional(),id:X().min(1).optional()}).strict(),Kk({op:iA(`settle`),id:X().min(1),outcome:fM,evidence:X().min(1),landing:X().min(1).optional(),release:Kk({target:X().min(1),version:X().min(1)}).strict().optional()}).strict(),Kk({op:iA(`rework`),id:X().min(1),reason:X().min(1),instruction:X().min(1),comments:Z(Kk({id:X(),url:X()}).strict()).optional(),title:X().optional(),replacement:X().optional()}).strict(),Kk({op:iA(`retitle`),id:X().min(1),title:X().min(1),reason:X().min(1)}).strict(),Kk({op:iA(`review`)}).strict(),Kk({op:iA(`readjust`)}).strict(),Kk({op:iA(`decline`),id:X().min(1),comments:Z(Kk({id:X(),url:X()}).strict()),reason:X().min(1)}).strict()]),hM=mM.options.map(e=>e.shape.op.value),gM=Kk({version:jA.optional(),author:X().min(1).optional(),completion:Lk().optional(),message:X().optional(),reason:X().optional(),commands:Z(mM).optional()}).strict().superRefine((e,t)=>{e.commands!==void 0&&e.commands.length>0&&e.version!==3&&t.addIssue({code:`custom`,path:[`version`],message:`an edit envelope requires version 3`})}),_M=Q({id:jA,reply:XA,at:AA,correlation:X().min(1).optional()}),vM=Q({id:jA,author:X().min(1).optional(),commands:Z(XA)}),yM=Q({op:X().min(1).optional(),outcome:X().min(1).optional(),reason:X().optional()}),bM=Q({id:jA,applied:Lk(),reason:X().optional(),results:Z(yM).optional()}),xM=Q({...sM,run_id:X().min(1),surfaces:Z(cM),waiting:Z(cM),held:cM.nullable(),replies:Z(_M),commands:Z(vM),outcomes:Z(bM)}),SM=nA([`surface`,`running`,`finished`]),CM=Q({...sM,run_id:X().min(1),status:SM,surface:cM.nullable(),events:Z(XA)}),wM=Q({...sM,run_id:X().min(1),receipt:Q({reply:jA,state:X().min(1),verdict:X().min(1).optional(),commands:X().min(1).optional()}),advice:Z(X())}),TM=Q({...sM,run_id:X().min(1),surface:jA,state:X().min(1)}),EM=Q({...sM,run_id:X().min(1),stopped:Lk(),owner:X().min(1),forced:Lk(),teardown:X().min(1)}),DM=nA([`host`]);nA([`host`]);var OM=nA([`delivered`,`no-turn`,`failed`,`not-asked`]),kM=nA([`graceful`,`killed`,`still-running`]),AM=nA([`pushed`,`already-on-origin`,`no-remote`,`refused`]),jM=Q({...sM,scope:DM,root:X(),grace_seconds:jA,forced:Lk(),complete:Lk(),runs:Z(Q({run_id:X().min(1),owner:X().min(1),forced_over_owner:Lk(),dispatches:Z(Q({node:X().min(1),pid:jA,interrupt:OM,detail:X(),ended:kM,waited_ms:jA})),teardown:X().min(1),branches:Z(Q({identity:X(),branch:X(),result:AM,remote:X().nullable(),commit:X().nullable(),detail:X()}))})),not_pushed:Z(Q({identity:X(),branch:X()})),not_pushed_unread:X().nullable(),rendered:X()}),MM=Q({...sM,session_key:X().min(1).optional(),reported:Z(Q({run:X().min(1),standing:X().min(1),why_not_watched:X()})),unresolved:Z(X())}),NM=Q({...sM,rendered:X(),unreadable:Z(sj).optional()}),PM=Q({...sM,run_id:X().min(1),rendered:X()}),FM=Q({...sM,run_id:X().min(1),liveness:aj,unread_surfaces:Q({count:jA,oldest_seconds:AA.nullable()}),node_status:eA(X(),X().min(1)),summary:X(),rendered:X()}),IM=Q({...sM,run_id:X().min(1),node:X().min(1).nullable().optional(),rendered:X()}),LM=Q({...sM,run_id:X().min(1),telemetry:Q({schema_version:jA})}),RM={runId:`onepipeline.run_id`,project:`onepipeline.project`,scope:`onepipeline.scope`,node:`onepipeline.node`,step:`onepipeline.step`,attempt:`onepipeline.attempt`},zM=[`node`,`observer`,`pr-author`,`review-reply`],BM=Q({history_id:X().min(1),harness:X().min(1),variant:X().min(1).optional(),harness_id:X().min(1),started:MA}),VM=Q({history_session:X().min(1),name:X().min(1),history_dir:X().min(1),history_project:X().min(1),history_file:X().min(1),project:X().min(1),started:MA,labels:eA(X(),X()),runs:Z(BM),run_id:X().min(1).optional()}),HM={...sM,sessions:Z(VM),skipped:jA},UM=Q({...HM,run_id:X().min(1),node:X().min(1).optional()}),WM=Q({...HM,project:X().min(1)}),GM=e=>cj.parse(e),KM=class extends Error{status;code;constructor(e,t,n,r){super(e,r),this.status=t,this.code=n,this.name=`TelemetryClientError`}},qM=50,JM=class{#e;#t;#n;constructor(e,t={}){this.#e=new URL(e),this.#t=t.fetch??globalThis.fetch,this.#n=t.eventSource}async listRuns(e=!1,t,n=qM){let r=this.#r(PA.runs);return r.searchParams.set(FA.includeSettled,String(e)),r.searchParams.set(FA.limit,String(n)),t!==void 0&&r.searchParams.set(FA.cursor,t),this.#a(r,cj.parse)}async selectRuns(e){if(e.length===0)throw new KM(`Invalid selection`);for(let t of e)if(ZM(t,`run ID`),t.includes(`,`))throw new KM(`Invalid run ID`);let t=this.#r(PA.runs);return t.searchParams.set(FA.select,e.join(`,`)),this.#a(t,cj.parse)}async getRun(e,t={}){ZM(e,`run ID`);let n=this.#r(PA.run(e));return t.includeConversations!==void 0&&n.searchParams.set(FA.includeConversations,String(t.includeConversations)),t.filter!==void 0&&n.searchParams.set(FA.filter,t.filter),this.#a(n,Ij.parse)}async getTimeline(e,t,n){ZM(e,`run ID`);let r=this.#r(PA.timeline(e));return n!==void 0&&r.searchParams.set(FA.filter,n),t===void 0?r.searchParams.set(FA.scope,IA.run):(r.searchParams.set(FA.scope,IA.node),r.searchParams.set(FA.node,t)),this.#a(r,Qj.parse)}async getConversation(e,t){return ZM(e,`run ID`),ZM(t,`conversation ID`),this.#a(this.#r(PA.conversation(e,t)),Aj.parse)}async getArtifact(e,t){return ZM(e,`run ID`),ZM(t,`artifact ID`),this.#a(this.#r(PA.artifact(e,t)),Zj.parse)}subscribe(e){e.runId!==void 0&&ZM(e.runId,`run ID`),e.after!==void 0&&ZM(e.after,`cursor`);let t=this.#r(PA.events);e.runId!==void 0&&t.searchParams.set(FA.runId,e.runId),e.after!==void 0&&t.searchParams.set(FA.after,e.after),e.filter!==void 0&&t.searchParams.set(FA.filter,e.filter);let n=this.#i(t);for(let t of eM.options)n.addEventListener(t,n=>{try{let r=n,i=JSON.parse(r.data),a=t===`snapshot`?cj.parse(i):tM.parse(i);e.onEvent({id:r.lastEventId,event:t,data:a})}catch(t){e.onError?.(t)}});return n.onerror=t=>e.onError?.(t),{close:()=>n.close()}}async listProjects(){return this.#a(this.#r(PA.projects),aM.parse)}async getProject(e){return ZM(e,`project ID`),this.#a(this.#r(PA.project(e)),oM.parse)}async getChannel(e){return ZM(e,`run ID`),this.#a(this.#r(PA.channel(e)),xM.parse)}async claimNext(e,t){ZM(e,`run ID`);let n=this.#r(PA.channelNext(e));return t!==void 0&&n.searchParams.set(FA.filter,t),this.#a(n,CM.parse,{method:`POST`})}async reply(e,t,n){ZM(e,`run ID`);let r=this.#r(PA.channelReply(e));return n!==void 0&&r.searchParams.set(FA.correlation,n),this.#a(r,wM.parse,{method:`POST`,headers:{"content-type":`application/json`},body:t})}async surface(e,t){return ZM(e,`run ID`),this.#a(this.#r(PA.channelSurface(e)),TM.parse,XM(`POST`,t))}async attest(e,t){return ZM(e,`run ID`),this.#a(this.#r(PA.attest(e)),wM.parse,XM(`POST`,{reference:t}))}async stop(e,t=!1){return ZM(e,`run ID`),this.#a(this.#r(PA.stop(e)),EM.parse,XM(`POST`,{force:t}))}async shutdown(e,t={}){return this.#a(this.#r(PA.shutdown),jM.parse,XM(`POST`,{scope:e,...YM(t)}))}async unwatched(){return this.#a(this.#r(PA.unwatched),MM.parse)}async host(){return this.#a(this.#r(PA.host),NM.parse)}async getStatus(e){return ZM(e,`run ID`),this.#a(this.#r(PA.status(e)),FM.parse)}async getResults(e){return ZM(e,`run ID`),this.#a(this.#r(PA.results(e)),PM.parse)}async getGoals(){return this.#a(this.#r(PA.goals),NM.parse)}async getRunGoals(e){return ZM(e,`run ID`),this.#a(this.#r(PA.runGoals(e)),PM.parse)}async getTranscript(e,t){ZM(e,`run ID`);let n=this.#r(PA.transcript(e));return t!==void 0&&n.searchParams.set(FA.node,t),this.#a(n,IM.parse)}async getTelemetryDocument(e){return ZM(e,`run ID`),this.#a(this.#r(PA.telemetry(e)),LM.parse)}async getAgents(e){return ZM(e,`run ID`),this.#a(this.#r(PA.agents(e)),UM.parse)}async getNodeAgents(e,t){return ZM(e,`run ID`),ZM(t,`node ID`),this.#a(this.#r(PA.nodeAgents(e,t)),UM.parse)}async getProjectAgents(e){return ZM(e,`project ID`),this.#a(this.#r(PA.projectAgents(e)),WM.parse)}#r(e){return new URL(e,this.#e)}#i(e){return(this.#n??(e=>{if(typeof EventSource>`u`)throw new KM(`EventSource is unavailable; provide an eventSource factory`);return new EventSource(e)}))(e.toString())}async#a(e,t,n){let r;try{r=await this.#t(e,n)}catch(e){throw new KM(`Telemetry request failed`,void 0,void 0,{cause:e})}let i=await r.json().catch(e=>{throw new KM(`Telemetry server returned invalid JSON`,r.status,void 0,{cause:e})});if(!r.ok){let e=$j.safeParse(i);throw new KM(e.success?e.data.error.message:`Telemetry request failed with status ${r.status}`,r.status,e.success?e.data.error.code:void 0)}try{return t(i)}catch(e){throw new KM(`Telemetry response failed contract validation`,r.status,void 0,{cause:e})}}};function YM(e){let{grace:t,force:n=!1}=e;if(t===void 0)return{force:n};if(!Number.isSafeInteger(t)||t<0)throw new KM(`Invalid grace: whole seconds, 0 or more`);return{grace:t,force:n}}function XM(e,t){return{method:e,headers:{"content-type":`application/json`},body:JSON.stringify(t)}}function ZM(e,t){let n=[...e].some(e=>e.charCodeAt(0)<32);if(e.length===0||n||/[/?#]/u.test(e))throw new KM(`Invalid ${t}`)}function QM({outcome:e,label:t}){if(e===void 0)return null;if(e.kind===`refused`){let n=e.error,r=n instanceof KM?n.code:void 0,i=n instanceof KM?n.status:void 0;return(0,G.jsxs)(sa,{"aria-label":`${t} refused`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsxs)(ca,{children:[e.title,i!==void 0&&` · ${i}`,r!==void 0&&` ${r}`]}),(0,G.jsx)(la,{children:(0,G.jsx)(`pre`,{className:`verb-text`,children:n.message})})]})}return(0,G.jsxs)(sa,{"aria-label":`${t} receipt`,children:[(0,G.jsx)(Et,{}),(0,G.jsx)(ca,{children:e.title}),(0,G.jsx)(la,{children:(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.payload,null,2)})})]})}async function $M(e,t){try{return{kind:`answered`,title:e,payload:await t()}}catch(t){return{kind:`refused`,title:e,error:t instanceof Error?t:Error(String(t))}}}function eN(e,t,n){let[r,i]=(0,U.useState)({}),a=(0,U.useRef)({key:e});(0,U.useEffect)(()=>{a.current.key=e},[e]),(0,U.useEffect)(()=>{if(e===void 0)return;let n=a.current.out;if(n?.key===e){n.again=!0;return}let r=()=>{let n={key:e,again:!1};a.current.out=n;let o=t=>{a.current.out===n&&(a.current.out=void 0),a.current.key===e&&(t(),n.again&&r())};t().then(t=>o(()=>i({key:e,value:t}))).catch(t=>o(()=>i(n=>({...n.key===e?n:{},key:e,error:tN(t)}))))};r()},[e,n]);let o=r.key===e?r:void 0;return{value:o?.value,error:o?.error,loading:e!==void 0&&o?.value===void 0&&o?.error===void 0}}function tN(e){return e instanceof Error?e:Error(String(e))}var nN=4e3;function rN({artifactId:e,client:t,heading:n,missing:r,noun:i,runId:a,unreadable:o}){let s=iN(e),c=eN(s===void 0?void 0:`${a}/${s}`,()=>t.getArtifact(a,s??``),0),[l,u]=(0,U.useState)(),d=l===s,f=c.value?.content;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:n}),s===void 0?(0,G.jsx)(`p`,{className:`detail-note`,children:r}):c.loading?(0,G.jsxs)(`p`,{"aria-live":`polite`,className:`detail-note`,children:[`Loading `,i,`…`]}):f===void 0?(0,G.jsx)(`p`,{"aria-live":`polite`,className:`detail-note`,children:o}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`pre`,{children:d?f:f.slice(-4e3)}),f.length>nN&&(0,G.jsx)(Pa,{onClick:()=>u(d?void 0:s),size:`sm`,type:`button`,variant:`outline`,children:d?`Collapse ${i}`:`Expand ${i}`})]})]})}function iN(e){if(!(e===void 0||/[/?#]/u.test(e)))return e}var aN=365.2425,oN=6048e5,sN=864e5,cN=6e4,lN=36e5,uN=1e3,dN=525600,fN=43200,pN=1440,mN=3600*24;mN*7,mN*aN/12*3;var hN=Symbol.for(`constructDateFrom`);function gN(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&hN in e?e[hN](t):e instanceof Date?new e.constructor(t):new Date(t)}function _N(e,t){return gN(t||e,e)}var vN={};function yN(){return vN}function bN(e,t){let n=yN(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=_N(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function xN(e,t){return bN(e,{...t,weekStartsOn:1})}function SN(e,t){let n=_N(e,t?.in),r=n.getFullYear(),i=gN(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=xN(i),o=gN(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=xN(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function CN(e){let t=_N(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function wN(e,...t){let n=gN.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function TN(e,t){let n=_N(e,t?.in);return n.setHours(0,0,0,0),n}function EN(e,t,n){let[r,i]=wN(n?.in,e,t),a=TN(r),o=TN(i),s=+a-CN(a),c=+o-CN(o);return Math.round((s-c)/sN)}function DN(e,t){let n=SN(e,t),r=gN(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),xN(r)}function ON(e,t){let n=_N(e)-+_N(t);return n<0?-1:n>0?1:n}function kN(e){return gN(e,Date.now())}function AN(e,t,n){let[r,i]=wN(n?.in,e,t);return+TN(r)==+TN(i)}function jN(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function MN(e){return!(!jN(e)&&typeof e!=`number`||isNaN(+_N(e)))}function NN(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function PN(e,t){let n=_N(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var FN={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},IN=(e,t,n)=>{let r,i=FN[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function LN(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var RN={date:LN({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:LN({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:LN({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},zN={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},BN=(e,t,n,r)=>zN[e];function VN(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var HN={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:VN({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:VN({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:VN({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:VN({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:VN({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function UN(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?GN(s,e=>e.test(o)):WN(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function WN(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function GN(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function KN(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var qN={code:`en-US`,formatDistance:IN,formatLong:RN,formatRelative:BN,localize:HN,match:{ordinalNumber:KN({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:UN({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:UN({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:UN({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:UN({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:UN({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function JN(e,t){let n=_N(e,t?.in);return EN(n,PN(n))+1}function YN(e,t){let n=_N(e,t?.in),r=xN(n)-+DN(n);return Math.round(r/oN)+1}function XN(e,t){let n=_N(e,t?.in),r=n.getFullYear(),i=yN(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=gN(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=bN(o,t),c=gN(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=bN(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function ZN(e,t){let n=yN(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=XN(e,t),a=gN(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),bN(a,t)}function QN(e,t){let n=_N(e,t?.in),r=bN(n,t)-+ZN(n,t);return Math.round(r/oN)+1}function $N(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var eP={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return $N(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):$N(n+1,2)},d(e,t){return $N(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return $N(e.getHours()%12||12,t.length)},H(e,t){return $N(e.getHours(),t.length)},m(e,t){return $N(e.getMinutes(),t.length)},s(e,t){return $N(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return $N(Math.trunc(r*10**(n-3)),t.length)}},tP={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},nP={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return eP.y(e,t)},Y:function(e,t,n,r){let i=XN(e,r),a=i>0?i:1-i;return t===`YY`?$N(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):$N(a,t.length)},R:function(e,t){return $N(SN(e),t.length)},u:function(e,t){return $N(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return $N(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return $N(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return eP.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return $N(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=QN(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):$N(i,t.length)},I:function(e,t,n){let r=YN(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):$N(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):eP.d(e,t)},D:function(e,t,n){let r=JN(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):$N(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return $N(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return $N(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return $N(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?tP.noon:r===0?tP.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?tP.evening:r>=12?tP.afternoon:r>=4?tP.morning:tP.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return eP.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):eP.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):$N(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):$N(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):eP.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):eP.s(e,t)},S:function(e,t){return eP.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return iP(r);case`XXXX`:case`XX`:return aP(r);default:return aP(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return iP(r);case`xxxx`:case`xx`:return aP(r);default:return aP(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+rP(r,`:`);default:return`GMT`+aP(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+rP(r,`:`);default:return`GMT`+aP(r,`:`)}},t:function(e,t,n){return $N(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return $N(+e,t.length)}};function rP(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+$N(a,2)}function iP(e,t){return e%60==0?(e>0?`-`:`+`)+$N(Math.abs(e)/60,2):aP(e,t)}function aP(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=$N(Math.trunc(r/60),2),a=$N(r%60,2);return n+i+t+a}var oP=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},sP=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},cP={p:sP,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return oP(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,oP(r,t)).replace(`{{time}}`,sP(i,t))}},lP=/^D+$/,uP=/^Y+$/,dP=[`D`,`DD`,`YY`,`YYYY`];function fP(e){return lP.test(e)}function pP(e){return uP.test(e)}function mP(e,t,n){let r=hP(e,t,n);if(console.warn(r),dP.includes(e))throw RangeError(r)}function hP(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var gP=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_P=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,vP=/^'([^]*?)'?$/,yP=/''/g,bP=/[a-zA-Z]/;function xP(e,t,n){let r=yN(),i=n?.locale??r.locale??qN,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=_N(e,n?.in);if(!MN(s))throw RangeError(`Invalid time value`);let c=t.match(_P).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=cP[t];return n(e,i.formatLong)}return e}).join(``).match(gP).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:SP(e)};if(nP[t])return{isToken:!0,value:e};if(t.match(bP))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&pP(a)||!n?.useAdditionalDayOfYearTokens&&fP(a))&&mP(a,t,String(e));let o=nP[a[0]];return o(s,a,i.localize,l)}).join(``)}function SP(e){let t=e.match(vP);return t?t[1].replace(yP,`'`):e}function CP(e,t,n){let r=yN(),i=n?.locale??r.locale??qN,a=ON(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=wN(n?.in,...a>0?[t,e]:[e,t]),l=NN(n?.roundingMethod??`round`),u=c.getTime()-s.getTime(),d=u/cN,f=(u-(CN(c)-CN(s)))/cN,p=n?.unit,m;if(m=p||(d<1?`second`:d<60?`minute`:d<1440?`hour`:f<43200?`day`:f<525600?`month`:`year`),m===`second`){let e=l(u/1e3);return i.formatDistance(`xSeconds`,e,o)}else if(m===`minute`){let e=l(d);return i.formatDistance(`xMinutes`,e,o)}else if(m===`hour`){let e=l(d/60);return i.formatDistance(`xHours`,e,o)}else if(m===`day`){let e=l(f/pN);return i.formatDistance(`xDays`,e,o)}else if(m===`month`){let e=l(f/fN);return e===12&&p!==`month`?i.formatDistance(`xYears`,1,o):i.formatDistance(`xMonths`,e,o)}else{let e=l(f/dN);return i.formatDistance(`xYears`,e,o)}}function wP(e,t){return CP(e,kN(e),t)}function TP(e){return Math.trunc(e*lN)}function EP(e,t,n){let[r,i]=wN(n?.in,e,t);return r.getFullYear()===i.getFullYear()}function DP(e,t){return EP(gN(t?.in||e,e),kN(t?.in||e))}function OP(e,t){return AN(gN(t?.in||e,e),kN(t?.in||e))}function kP(e){let t=e/lN;return Math.trunc(t)}function AP(e){let t=e/cN;return Math.trunc(t)}function jP(e){let t=e/uN;return Math.trunc(t)}function MP(e){return Math.trunc(e*cN)}function NP(e,t){let n=()=>gN(t?.in,NaN),r=t?.additionalDigits??2,i=RP(e),a;if(i.date){let e=zP(i.date,r);a=BP(e.restDateString,e.year)}if(!a||isNaN(+a))return n();let o=+a,s=0,c;if(i.time&&(s=HP(i.time),isNaN(s)))return n();if(i.timezone){if(c=WP(i.timezone),isNaN(c))return n()}else{let e=new Date(o+s),n=_N(0,t?.in);return n.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),n.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),n}return _N(o+s+c,t?.in)}var PP={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},FP=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,IP=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,LP=/^([+-])(\d{2})(?::?(\d{2}))?$/;function RP(e){let t={},n=e.split(PP.dateTimeDelimiter),r;if(n.length>2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],PP.timeZoneDelimiter.test(t.date)&&(t.date=e.split(PP.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){let e=PP.timezone.exec(r);e?(t.time=r.replace(e[1],``),t.timezone=e[1]):t.time=r}return t}function zP(e,t){let n=RegExp(`^(?:(\\d{4}|[+-]\\d{`+(4+t)+`})|(\\d{2}|[+-]\\d{`+(2+t)+`})$)`),r=e.match(n);if(!r)return{year:NaN,restDateString:``};let i=r[1]?parseInt(r[1]):null,a=r[2]?parseInt(r[2]):null;return{year:a===null?i:a*100,restDateString:e.slice((r[1]||r[2]).length)}}function BP(e,t){if(t===null)return new Date(NaN);let n=e.match(FP);if(!n)return new Date(NaN);let r=!!n[4],i=VP(n[1]),a=VP(n[2])-1,o=VP(n[3]),s=VP(n[4]),c=VP(n[5])-1;if(r)return XP(t,s,c)?GP(t,s,c):new Date(NaN);{let e=new Date(0);return!JP(t,a,o)||!YP(t,i)?new Date(NaN):(e.setUTCFullYear(t,a,Math.max(i,o)),e)}}function VP(e){return e?parseInt(e):1}function HP(e){let t=e.match(IP);if(!t)return NaN;let n=UP(t[1]),r=UP(t[2]),i=UP(t[3]);return ZP(n,r,i)?n*lN+r*cN+i*1e3:NaN}function UP(e){return e&&parseFloat(e.replace(`,`,`.`))||0}function WP(e){if(e===`Z`)return 0;let t=e.match(LP);if(!t)return 0;let n=t[1]===`+`?-1:1,r=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return QP(r,i)?n*(r*lN+i*cN):NaN}function GP(e,t,n){let r=new Date(0);r.setUTCFullYear(e,0,4);let i=r.getUTCDay()||7,a=(t-1)*7+n+1-i;return r.setUTCDate(r.getUTCDate()+a),r}var KP=[31,null,31,30,31,30,31,31,30,31,30,31];function qP(e){return e%400==0||e%4==0&&e%100!=0}function JP(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(KP[t]||(qP(e)?29:28))}function YP(e,t){return t>=1&&t<=(qP(e)?366:365)}function XP(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function ZP(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function QP(e,t){return t>=0&&t<=59}function $P(e){return e*uN}function eF(e){let t=Math.max(0,Math.round(e));if(t<$P(1))return`${t}ms`;let n=kP(t),r=AP(t-TP(n)),i=jP(t-TP(n)-MP(r));return n>0?`${n}h ${r}m ${i}s`:r>0?`${r}m ${i}s`:`${i}s`}function tF(e){return eF($P(e))}function nF(e){let t=NP(e);return MN(t)?t:void 0}function rF(e){let t=nF(e);return t===void 0?e:OP(t)?xP(t,`HH:mm:ss`):DP(t)?xP(t,`MMM d, HH:mm:ss`):xP(t,`MMM d yyyy, HH:mm:ss`)}function iF(e){let t=nF(e);return t===void 0?e:xP(t,`PPpp zzzz`)}function aF(e){return new Date(e).toISOString()}function oF(e){let t=nF(e);return t===void 0?e:wP(t,{addSuffix:!0})}function sF({at:e,className:t,relative:n=!1}){let r=nF(e);return r===void 0?(0,G.jsx)(`span`,{className:t,children:e}):(0,G.jsx)(`time`,{className:t,dateTime:r.toISOString(),title:iF(e),children:n?oF(e):rF(e)})}var cF={node:`Node dispatch`,observer:`Observer`,"pr-author":`Change request author`,"review-reply":`Review reply author`};function lF(e){return zM.some(t=>t===e)}function uF(e){return lF(e)?cF[e]:e}function dF(e){return e.attempt===void 0?uF(e.scope):`${uF(e.scope)} · attempt ${e.attempt}`}function fF(e){let t=new Map;for(let n of e){let e=n.labels[RM.scope]??`unscoped`,r=n.labels[RM.attempt],i=`${e} ${r??``}`,a=t.get(i);a===void 0?t.set(i,{scope:e,attempt:r,sessions:[n]}):t.set(i,{...a,sessions:[...a.sessions,n]})}let n=e=>lF(e)?zM.indexOf(e):zM.length;return[...t.values()].sort((e,t)=>n(e.scope)-n(t.scope)||e.scope.localeCompare(t.scope)||Number(e.attempt??0)-Number(t.attempt??0))}function pF(e){let t=[],n=e.labels[RM.node];n!==void 0&&t.push([`node`,n]);let r=e.labels[RM.step];r!==void 0&&t.push([`step`,r]);for(let[n,r]of Object.entries(e.labels))n.startsWith(`onepipeline.`)||t.push([n,r]);return t}function mF(e){return`${e} ${e===1?`agent`:`agents`}`}function hF({client:e,title:t,agents:n,count:r,runId:i}){let a=n.value?.sessions??[],o=fF(a);return(0,G.jsxs)(`section`,{"aria-label":t,className:`channel-section agents-panel`,children:[(0,G.jsxs)(`h3`,{children:[t,r!==void 0&&(0,G.jsx)(Ma,{variant:`secondary`,children:mF(r)})]}),n.error&&(0,G.jsx)(QM,{label:t,outcome:{kind:`refused`,title:t,error:n.error}}),n.loading?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),`Loading agents…`]}):n.value===void 0?null:a.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`No agents launched.`}):(0,G.jsx)(`div`,{className:`channel-list agents-groups`,children:o.map(t=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`h4`,{children:dF(t)}),(0,G.jsx)(`ul`,{"aria-label":dF(t),children:t.sessions.map(t=>(0,G.jsx)(`li`,{children:(0,G.jsx)(gF,{client:e,runId:t.run_id??i,session:t})},t.history_session))})]},dF(t)))}),n.value!==void 0&&n.value.skipped>0&&(0,G.jsxs)(`p`,{className:`channel-empty`,children:[n.value.skipped,` `,n.value.skipped===1?`line`:`lines`,` `,`of the pointer file could not be read.`]})]})}function gF({client:e,runId:t,session:n}){let[r,i]=(0,U.useState)();return(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(`strong`,{children:n.name}),pF(n).map(([e,t])=>(0,G.jsxs)(Ma,{variant:`outline`,children:[e,` `,t]},e)),(0,G.jsxs)(`span`,{className:`channel-age`,children:[`started `,(0,G.jsx)(sF,{at:n.started,relative:!0})]})]}),(0,G.jsx)(`ul`,{"aria-label":`Harness runs of ${n.name}`,className:`agent-runs`,children:n.runs.map(n=>{let a=r===n.history_id;return(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(Ma,{variant:`secondary`,children:n.harness_id}),(0,G.jsx)(`span`,{className:`channel-age`,children:(0,G.jsx)(sF,{at:n.started})}),t===void 0?(0,G.jsx)(`span`,{className:`channel-age`,children:`This session names no run to open its transcript under.`}):(0,G.jsx)(Pa,{"aria-expanded":a,onClick:()=>i(a?void 0:n.history_id),size:`sm`,type:`button`,variant:`outline`,children:a?`Close transcript`:`Open transcript`})]}),a&&t!==void 0&&(0,G.jsx)(rN,{artifactId:n.history_id,client:e,heading:`Oneharness conversation`,missing:`This run named no conversation.`,noun:`conversation`,runId:t,unreadable:`The history store holds no readable copy of that conversation.`})]},n.history_id)})})]})})}function _F(e,t,n){return eN(t,()=>e.getProjectAgents(t??``),n)}var vF={approve:`Approve`,reject:`Reject`,continue:`Continue`},yF=[`review`,`readjust`,`decline`,`withdraw-note`],bF=[`approve`,`reject`,`continue`,...hM.filter(e=>!yF.some(t=>t===e))];function xF(e){return bF.some(t=>t===e)}var SF={approve:[`message`,`reason`],reject:[`message`,`reason`],continue:[`message`],add:[`json`],drop:[`id`,`dependents`],reparent:[`id`,`deps`],retry:[`id`,`json`],rework:[`id`,`reason`,`instruction`,`comments`,`title`,`replacement`],retitle:[`id`,`title`,`reason`],cancel:[`id`,`reason`],requeue:[`id`,`json`],"set-node-sets":[`id`,`sets`],"set-run-node-sets":[`runSets`],attest:[`reference`],complete:[`reason`],amend:[`id`,`text`],note:[`id`,`addressee`,`text`,`criterion`,`deliver`,`persist`],finding:[`message`,`blocking`,`id`],settle:[`id`,`outcome`,`evidence`,`landing`]};function CF(e,t){let n=wF(e,t);if(`problem`in n)return n;let r=gM.safeParse(n.envelope);if(!r.success){let e=r.error.issues[0];return{problem:`${e?.path.join(`.`)||`envelope`}: ${e?.message??`not an envelope`}`}}return{envelope:r.data,bytes:JSON.stringify(r.data,null,2)}}function wF(e,t){let n=e=>{let n=t[e];return typeof n==`string`&&n.trim().length>0?n:void 0};switch(e){case`approve`:return{envelope:{completion:!0,...EF(`message`,n(`message`)),...EF(`reason`,n(`reason`))}};case`reject`:return{envelope:{completion:!1,...EF(`message`,n(`message`)),...EF(`reason`,n(`reason`))}};case`continue`:return{envelope:{message:n(`message`)??``}};default:{let r=TF(e,t,n);return`problem`in r?r:{envelope:{version:3,commands:[r.command]}}}}}function TF(e,t,n){let r=n(`id`);switch(e){case`add`:case`retry`:case`requeue`:{let t=n(`json`);if(t===void 0&&e!==`requeue`)return{problem:`node: a node mapping is required`};let i;if(t!==void 0)try{i=JSON.parse(t)}catch(t){return{problem:`${e===`requeue`?`amend`:`node`}: ${t instanceof Error?t.message:`not JSON`}`}}return e===`add`?{command:{op:e,node:i}}:e===`retry`?{command:{op:e,id:r,node:i}}:{command:{op:e,id:r,...EF(`amend`,i)}}}case`set-node-sets`:case`set-run-node-sets`:{let n=[...(e===`set-node-sets`?t.sets:t.runSets)??[]],i=n.findIndex(e=>e.trim().length===0);return i>=0?{problem:`sets.${i}: an override needs a PATH=VALUE`}:e===`set-node-sets`?{command:{op:e,id:r,sets:n}}:{command:{op:e,sets:n}}}case`drop`:return{command:{op:e,id:r,dependents:n(`dependents`)}};case`reparent`:return{command:{op:e,id:r,deps:(t.deps??``).split(`
89
+ `).map(e=>e.trim()).filter(e=>e.length>0)}};case`rework`:{let t,i=n(`comments`);if(i!==void 0)try{t=JSON.parse(i)}catch(e){return{problem:`comments: ${e instanceof Error?e.message:`not JSON`}`}}return{command:{op:e,id:r,reason:n(`reason`),instruction:n(`instruction`),...EF(`comments`,t),...EF(`title`,n(`title`)),...EF(`replacement`,n(`replacement`))}}}case`retitle`:return{command:{op:e,id:r,title:n(`title`),reason:n(`reason`)}};case`cancel`:return{command:{op:e,id:r,...EF(`reason`,n(`reason`))}};case`attest`:return{command:{op:e,ref:n(`reference`)}};case`complete`:return{command:{op:e,reason:n(`reason`)}};case`amend`:return{command:{op:e,id:r,text:n(`text`)}};case`note`:return{command:{op:e,id:r,addressee:n(`addressee`),text:n(`text`),...EF(`criterion`,n(`criterion`)),...EF(`deliver`,n(`deliver`)===`live`?void 0:n(`deliver`)),...t.persist===!1?{persist:!1}:{}}};case`finding`:return{command:{op:e,message:n(`message`),...t.blocking===!0?{blocking:!0}:{},...EF(`id`,r)}};case`settle`:return{command:{op:e,id:r,outcome:n(`outcome`),evidence:n(`evidence`),...EF(`landing`,n(`landing`))}};default:return{problem:`op: ${String(e)} is not an op`}}}function EF(e,t){let n={};return t!==void 0&&(n[e]=t),n}function DF(e){let t=e.op;return typeof t==`string`?t:`?`}function OF({legend:e,sets:t,onChange:n,current:r}){let i=(0,U.useId)(),a=(e,r)=>n(t.map((t,n)=>n===e?r:t)),o=(e,r)=>{let i=[...t],[a]=i.splice(e,1);a!==void 0&&i.splice(r,0,a),n(i)};return(0,G.jsxs)(`fieldset`,{"aria-describedby":`${i}-hint`,className:`sets-editor`,children:[(0,G.jsx)(`legend`,{children:e}),(0,G.jsx)(`p`,{className:`sets-hint`,id:`${i}-hint`,children:`One PATH=VALUE a row, applied in order — the whole list is replaced, and an empty list clears it.`}),t.length===0?(0,G.jsx)(`p`,{className:`sets-empty`,children:`No overrides: sends an empty list.`}):(0,G.jsx)(`ol`,{className:`sets-list`,children:t.map((e,r)=>{let i=r+1;return(0,G.jsxs)(`li`,{className:`sets-row`,children:[(0,G.jsx)(Tc,{"aria-label":`Override ${i}`,className:`sets-entry`,onChange:e=>a(r,e.target.value),placeholder:`members.worker.agent.model=VALUE`,spellCheck:!1,value:e}),(0,G.jsx)(Pa,{"aria-label":`Move override ${i} up`,disabled:r===0,onClick:()=>o(r,r-1),size:`icon`,type:`button`,variant:`ghost`,children:(0,G.jsx)(vt,{})}),(0,G.jsx)(Pa,{"aria-label":`Move override ${i} down`,disabled:r===t.length-1,onClick:()=>o(r,r+1),size:`icon`,type:`button`,variant:`ghost`,children:(0,G.jsx)(gt,{})}),(0,G.jsx)(Pa,{"aria-label":`Remove override ${i}`,onClick:()=>n(t.filter((e,t)=>t!==r)),size:`icon`,type:`button`,variant:`ghost`,children:(0,G.jsx)(un,{})})]},r)})}),(0,G.jsxs)(`div`,{className:`composer-actions`,children:[(0,G.jsxs)(Pa,{onClick:()=>n([...t,``]),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(Yt,{size:14}),` Add override`]}),(0,G.jsxs)(Pa,{disabled:r===void 0,onClick:()=>{r!==void 0&&n([...r])},size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(Qt,{size:14}),` Load current list`]}),(0,G.jsx)(`span`,{className:`sets-current`,children:r===void 0?`No current list to load`:r.length===0?`Current list: none`:`Current list: ${r.join(` · `)}`})]})]})}function kF(e,t,n){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)();return{run:(0,U.useCallback)(async(...r)=>{i(!0);let a=await $M(typeof e==`string`?e:e(...r),()=>t(...r));return o(a),i(!1),a.kind===`answered`&&n?.(),a},[e,t,n]),pending:r,outcome:a}}function AF(e,t,n,r){let[i,a]=(0,U.useState)(`continue`),[o,s]=(0,U.useState)({}),[c,l]=(0,U.useState)(),[u,d]=(0,U.useState)(``),[f,p]=(0,U.useState)(``);return{shortcut:i,setShortcut:a,fields:o,setField:(0,U.useCallback)((e,t)=>s(n=>({...n,[e]:t})),[]),problem:c,compose:(0,U.useCallback)(()=>{let e=CF(i,{...n,...o});if(`problem`in e){l(e.problem);return}l(void 0),d(e.bytes)},[i,o,n]),envelope:u,setEnvelope:d,correlation:f,setCorrelation:p,send:kF(`Reply`,(0,U.useCallback)(()=>e.reply(t,u,f.trim()===``?void 0:f.trim()),[e,t,u,f]),r)}}var jF={message:`Message`,reason:`Reason`,instruction:`Instruction`,title:`Title`,replacement:`Replacement node id (optional)`,comments:`Review comments (JSON, optional)`,id:`Node id`,text:`Text`,addressee:`Addressee`,deliver:`Deliver`,persist:`Carry to the next dispatch if no turn takes it`,criterion:`Criterion (optional)`,dependents:`Dependents`,deps:`Dependencies, one per line`,reference:`Reference`,outcome:`Outcome`,evidence:`Evidence`,landing:`Landing (optional)`,blocking:`Blocking`,json:`Mapping (JSON)`,sets:`Node overrides`,runSets:`Run-wide overrides`},MF={addressee:lM.options,deliver:uM.options,dependents:dM.options,outcome:fM.options},NF=Object.fromEntries(Object.entries(MF).map(([e,t])=>[e,t[0]]));function PF({client:e,runId:t,onSent:n,overrides:r}){let i=(0,U.useId)(),{shortcut:a,setShortcut:o,fields:s,setField:c,problem:l,compose:u,envelope:d,setEnvelope:f,correlation:p,setCorrelation:m,send:h}=AF(e,t,NF,n);return(0,G.jsxs)(`section`,{"aria-labelledby":`${i}-heading`,className:`composer`,children:[(0,G.jsx)(`h3`,{id:`${i}-heading`,children:`Reply`}),(0,G.jsxs)(`div`,{className:`composer-shortcut`,children:[(0,G.jsx)(Oc,{htmlFor:`${i}-shortcut`,children:`Shortcut`}),(0,G.jsxs)(`select`,{className:`composer-select`,id:`${i}-shortcut`,onChange:e=>{let t=e.target.value;xF(t)&&o(t)},value:a,children:[(0,G.jsx)(`optgroup`,{label:`Verdict`,children:Object.entries(vF).map(([e,t])=>(0,G.jsx)(`option`,{value:e,children:t},e))}),(0,G.jsx)(`optgroup`,{label:`Edit`,children:bF.filter(e=>!(e in vF)).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]})]}),(0,G.jsx)(`div`,{className:`composer-fields`,children:SF[a].map(e=>{let t=`${i}-${e}`,n=MF[e];if(e===`sets`||e===`runSets`){let t=typeof s.id==`string`?s.id.trim():``;return(0,G.jsx)(OF,{current:e===`runSets`?r?.run:r?.nodes.get(t),legend:`${jF[e]}, in order`,onChange:t=>c(e,t),sets:s[e]??[]},e)}if(e===`persist`||e===`blocking`)return(0,G.jsxs)(`div`,{className:`composer-check`,children:[(0,G.jsx)(`input`,{checked:e===`persist`?s.persist!==!1:s.blocking===!0,id:t,onChange:t=>c(e,t.target.checked),type:`checkbox`}),(0,G.jsx)(Oc,{htmlFor:t,children:jF[e]})]},e);let a=s[e],o=typeof a==`string`?a:``;return(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:t,children:jF[e]}),n===void 0?e===`message`||e===`text`||e===`json`||e===`deps`||e===`evidence`?(0,G.jsx)(Tp,{id:t,onChange:t=>c(e,t.target.value),rows:e===`json`?5:2,value:o}):(0,G.jsx)(Tc,{id:t,onChange:t=>c(e,t.target.value),value:o}):(0,G.jsx)(`select`,{className:`composer-select`,id:t,onChange:t=>c(e,t.target.value),value:o||n[0],children:n.map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]},e)})}),(0,G.jsxs)(`div`,{className:`composer-actions`,children:[(0,G.jsxs)(Pa,{onClick:u,size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(cn,{size:14}),` Compose envelope`]}),l!==void 0&&(0,G.jsx)(`p`,{"aria-label":`Envelope not composed`,className:`composer-problem`,role:`alert`,children:l})]}),(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:`${i}-envelope`,children:`Envelope (sent as typed)`}),(0,G.jsx)(Tp,{className:`composer-envelope`,id:`${i}-envelope`,onChange:e=>f(e.target.value),rows:8,spellCheck:!1,value:d})]}),(0,G.jsxs)(`div`,{className:`composer-field composer-correlation`,children:[(0,G.jsx)(Oc,{htmlFor:`${i}-correlation`,children:`Correlation (optional)`}),(0,G.jsx)(Tc,{id:`${i}-correlation`,onChange:e=>m(e.target.value),value:p})]}),(0,G.jsxs)(`div`,{className:`composer-actions`,children:[(0,G.jsxs)(Pa,{disabled:h.pending||d.trim()===``,onClick:()=>void h.run(),size:`sm`,type:`button`,children:[(0,G.jsx)(tn,{size:14}),` Send reply`]}),(0,G.jsx)(`span`,{"aria-live":`polite`,className:`run-list-status`,children:h.pending?`Sending…`:``})]}),(0,G.jsx)(QM,{label:`Reply`,outcome:h.outcome})]})}function FF(e){return(0,U.useMemo)(()=>{let t=new Set(e.surfaces.flatMap(e=>e.correlation?[e.correlation]:[]));return{exchanges:[...e.surfaces].reverse().map(t=>({surface:t,replies:e.replies.filter(e=>t.correlation!==void 0&&e.correlation===t.correlation)})),otherReplies:e.replies.filter(e=>!t.has(e.correlation??``))}},[e])}function IF({client:e,runId:t,filter:n,decisions:r,observedAt:i,invalidations:a,overrides:o}){let{queue:s,wrote:c}=LF(e,t,a),l=kF(`Next`,(0,U.useCallback)(()=>e.claimNext(t,n),[e,t,n]),c);return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`channel-view`,children:[(0,G.jsxs)(`section`,{"aria-labelledby":`channel-queue-heading`,className:`channel-section`,children:[(0,G.jsxs)(`div`,{className:`section-heading channel-heading`,children:[(0,G.jsxs)(`h3`,{id:`channel-queue-heading`,children:[(0,G.jsx)(Lt,{size:15}),` Channel queue`]}),(0,G.jsx)(Pa,{disabled:l.pending,onClick:()=>void l.run(),size:`sm`,type:`button`,children:`Next`})]}),s.error&&(0,G.jsx)(QM,{label:`Channel`,outcome:{kind:`refused`,title:`Channel`,error:s.error}}),s.value===void 0&&s.loading?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),`Loading channel…`]}):s.value?(0,G.jsx)(RF,{observedAt:i,queue:s.value}):null,(0,G.jsx)(QM,{label:`Next`,outcome:l.outcome})]}),(0,G.jsx)(HF,{client:e,decisions:r,onWrote:c,runId:t}),(0,G.jsx)(PF,{client:e,onSent:c,overrides:o,runId:t}),(0,G.jsx)(UF,{client:e,onRaised:c,runId:t})]})})}function LF(e,t,n){let[r,i]=(0,U.useState)(0);return{queue:eN(t,()=>e.getChannel(t),n+r),wrote:(0,U.useCallback)(()=>i(e=>e+1),[])}}function RF({queue:e,observedAt:t}){let{exchanges:n,otherReplies:r}=FF(e);return(0,G.jsxs)(`div`,{className:`channel-queue`,children:[(0,G.jsxs)(`section`,{"aria-label":`Surfaces`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Conversation`}),e.surfaces.length===0&&(0,G.jsx)(`p`,{className:`channel-empty`,children:`No surfaces yet.`}),(0,G.jsx)(`ul`,{children:n.map(({surface:e,replies:n})=>(0,G.jsxs)(`li`,{"aria-label":`Surface ${e.id}`,children:[(0,G.jsx)(VF,{observedAt:t,surface:e}),n.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`Waiting for reply`}):n.map(e=>(0,G.jsx)(BF,{reply:e},e.id))]},e.id))})]}),(0,G.jsxs)(`section`,{"aria-label":`Replies`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Other replies`}),r.map(e=>(0,G.jsx)(BF,{reply:e},e.id))]}),(0,G.jsxs)(`section`,{"aria-label":`Queued commands`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Queued commands`}),e.commands.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`Nothing awaits the reconciler.`}):(0,G.jsx)(`ul`,{children:e.commands.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsx)(Ia,{children:(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsxs)(Ma,{variant:`outline`,children:[`envelope `,e.id]}),(0,G.jsx)(Ma,{variant:`secondary`,children:e.author??`planner`}),(0,G.jsx)(`span`,{children:e.commands.map(DF).join(`, `)})]})})})},e.id))})]}),(0,G.jsxs)(`section`,{"aria-label":`Command outcomes`,className:`channel-list`,children:[(0,G.jsx)(`h4`,{children:`Command outcomes`}),e.outcomes.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`The reconciler has answered nothing yet.`}):(0,G.jsx)(`ul`,{children:e.outcomes.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`channel-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsxs)(Ma,{variant:`outline`,children:[`envelope `,e.id]}),(0,G.jsx)(Ma,{variant:e.applied?`default`:`destructive`,children:e.applied?`applied`:`not applied`})]}),e.reason!==void 0&&(0,G.jsx)(`pre`,{className:`verb-text`,children:e.reason}),e.results!==void 0&&e.results.length>0&&(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.results,null,2)})]})})},e.id))})]})]})}function zF({text:e,children:t,meta:n,label:r}){let i=e.split(/\r?\n/,1)[0];return(0,G.jsxs)(`details`,{"aria-label":r,className:`channel-message-details`,children:[(0,G.jsxs)(`summary`,{"aria-label":`${r}: ${i}`,children:[(0,G.jsx)(`span`,{className:`channel-message-meta`,children:n}),(0,G.jsxs)(`span`,{className:`channel-message-preview`,children:[i,`…`]})]}),(0,G.jsx)(`pre`,{className:`verb-text`,children:e}),t]})}function BF({reply:e}){let t=typeof e.reply.message==`string`?e.reply.message:`Reply without message`;return(0,G.jsx)(Fa,{className:`channel-card py-2`,children:(0,G.jsx)(Ia,{children:(0,G.jsx)(zF,{label:`Reply ${e.id} message`,text:t,meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(Ma,{variant:`outline`,children:[`reply `,e.id]}),(0,G.jsx)(sF,{at:aF(e.at),relative:!0})]}),children:(0,G.jsxs)(`details`,{"aria-label":`Raw envelope for reply ${e.id}`,children:[(0,G.jsx)(`summary`,{children:`Raw envelope`}),(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(e.reply,null,2)})]})})})})}function VF({surface:e,observedAt:t}){let n=Math.max(0,(Date.parse(t)-e.queued_at)/1e3);return(0,G.jsx)(Fa,{className:`channel-card py-2`,children:(0,G.jsx)(Ia,{children:(0,G.jsx)(zF,{label:`Surface ${e.id} message`,text:e.message,meta:(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(Ma,{children:e.kind}),(0,G.jsxs)(Ma,{variant:`secondary`,children:[`from `,e.source]}),e.blocking?(0,G.jsx)(Ma,{variant:`destructive`,children:`blocking`}):(0,G.jsx)(Ma,{variant:`outline`,children:`non-blocking`}),e.workstream!==void 0&&(0,G.jsxs)(Ma,{variant:`outline`,children:[`node `,e.workstream]}),(0,G.jsxs)(`span`,{className:`channel-age`,children:[`surface `,e.id,` · `,tF(n),` old`]})]})})})})}function HF({client:e,runId:t,decisions:n,onWrote:r}){let i=WF(e,t,r);return(0,G.jsxs)(`section`,{"aria-labelledby":`attest-heading`,className:`channel-section`,children:[(0,G.jsxs)(`h3`,{id:`attest-heading`,children:[(0,G.jsx)(xt,{size:15}),` Ready human actions`]}),n.length===0?(0,G.jsx)(`p`,{className:`channel-empty`,children:`No decision point is holding the graph.`}):(0,G.jsx)(`ul`,{className:`attest-list`,children:n.map(e=>(0,G.jsxs)(`li`,{className:`attest-row`,children:[(0,G.jsxs)(`span`,{children:[(0,G.jsx)(Ma,{variant:`outline`,children:e.kind}),` `,(0,G.jsx)(`span`,{className:`attest-reference`,children:e.id}),e.unblocks.length>0&&(0,G.jsxs)(`span`,{className:`channel-age`,children:[` `,`· unblocks `,e.unblocks.join(`, `)]})]}),(0,G.jsxs)(Pa,{disabled:i.pending,onClick:()=>void i.run(e.id),size:`sm`,type:`button`,variant:`outline`,children:[`Attest `,e.id]})]},e.id))}),(0,G.jsx)(QM,{label:`Attest`,outcome:i.outcome})]})}function UF({client:e,runId:t,onRaised:n}){let r=(0,U.useId)(),{kind:i,setKind:a,message:o,setMessage:s,raise:c}=GF(e,t,n);return(0,G.jsxs)(`section`,{"aria-labelledby":`${r}-heading`,className:`channel-section`,children:[(0,G.jsxs)(`h3`,{id:`${r}-heading`,children:[(0,G.jsx)(Ut,{size:15}),` Surface`]}),(0,G.jsxs)(`div`,{className:`composer-fields`,children:[(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:`${r}-kind`,children:`Kind`}),(0,G.jsx)(Tc,{id:`${r}-kind`,onChange:e=>a(e.target.value),placeholder:`finding`,value:i})]}),(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(Oc,{htmlFor:`${r}-message`,children:`Message`}),(0,G.jsx)(Tp,{id:`${r}-message`,onChange:e=>s(e.target.value),rows:2,value:o})]})]}),(0,G.jsx)(`div`,{className:`composer-actions`,children:(0,G.jsx)(Pa,{disabled:c.pending||i.trim()===``,onClick:()=>void c.run(),size:`sm`,type:`button`,variant:`outline`,children:`Raise surface`})}),(0,G.jsx)(QM,{label:`Surface`,outcome:c.outcome})]})}function WF(e,t,n){return kF(e=>`Attest ${e}`,(0,U.useCallback)(n=>e.attest(t,n),[e,t]),n)}function GF(e,t,n){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(``);return{kind:r,setKind:i,message:a,setMessage:o,raise:kF(`Surface`,(0,U.useCallback)(()=>e.surface(t,{kind:r,message:a}),[e,t,r,a]),(0,U.useCallback)(()=>{o(``),n()},[n]))}}var KF={status:`Status`,results:`Results`,goals:`Goals`,transcript:`Transcript`,telemetry:`Telemetry`,host:`Host`};function qF(e){return Object.hasOwn(KF,e)}function JF(e,t,n){let[r,i]=(0,U.useState)(`status`),[a,o]=(0,U.useState)();return{read:r,setRead:i,node:a,setNode:o,results:eN(r===`results`?t:void 0,()=>e.getResults(t),n),goals:eN(r===`goals`?t:void 0,()=>e.getRunGoals(t),n),transcript:eN(r===`transcript`?`${t}/${a??``}`:void 0,()=>e.getTranscript(t,a),n),telemetry:eN(r===`telemetry`?t:void 0,()=>e.getTelemetryDocument(t),n),host:eN(r===`host`?`host`:void 0,()=>e.host(),n)}}function YF({client:e,runId:t,nodes:n,status:r,invalidations:i}){let{read:a,setRead:o,node:s,setNode:c,results:l,goals:u,transcript:d,telemetry:f,host:p}=JF(e,t,i);return(0,G.jsxs)(bp,{className:`reads-view min-h-0 h-full gap-0`,onValueChange:e=>{qF(e)&&o(e)},value:a,children:[(0,G.jsx)(`div`,{className:`view-tabs reads-tabs`,children:(0,G.jsx)(Sp,{"aria-label":`Reads`,variant:`line`,children:Object.entries(KF).map(([e,t])=>(0,G.jsx)(Cp,{value:e,children:t},e))})}),(0,G.jsx)(wp,{className:`min-h-0`,value:a,children:(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`channel-view`,children:[a===`status`&&(0,G.jsx)(XF,{read:r,title:`Status`,children:r.value&&(0,G.jsxs)(`div`,{className:`channel-card-head`,children:[(0,G.jsx)(Ma,{variant:`outline`,children:r.value.liveness}),(0,G.jsxs)(Ma,{variant:`secondary`,children:[r.value.unread_surfaces.count,` unread`,r.value.unread_surfaces.oldest_seconds!==null&&`, oldest ${r.value.unread_surfaces.oldest_seconds}s`]}),(0,G.jsx)(`span`,{className:`channel-age`,children:r.value.summary})]})}),a===`results`&&(0,G.jsx)(XF,{read:l,title:`Results`}),a===`goals`&&(0,G.jsx)(XF,{read:u,title:`Goals`}),a===`transcript`&&(0,G.jsx)(XF,{read:d,title:`Transcript`,children:(0,G.jsxs)(`div`,{className:`composer-field`,children:[(0,G.jsx)(`label`,{className:`channel-age`,htmlFor:`transcript-node`,children:`Node`}),(0,G.jsxs)(`select`,{className:`composer-select`,id:`transcript-node`,onChange:e=>c(e.target.value===``?void 0:e.target.value),value:s??``,children:[(0,G.jsx)(`option`,{value:``,children:`Whole run`}),n.map(({id:e})=>(0,G.jsx)(`option`,{value:e,children:e},e))]})]})}),a===`telemetry`&&(0,G.jsxs)(`section`,{"aria-label":`Telemetry`,className:`channel-section`,children:[(0,G.jsx)(`h3`,{children:`Telemetry`}),f.error&&(0,G.jsx)(QM,{label:`Telemetry`,outcome:{kind:`refused`,title:`Telemetry`,error:f.error}}),f.loading?(0,G.jsx)(ZF,{}):f.value?(0,G.jsx)(`pre`,{className:`verb-text`,children:JSON.stringify(f.value.telemetry,null,2)}):null]}),a===`host`&&(0,G.jsx)(XF,{read:p,title:`Host`})]})})})]})}function XF({title:e,read:t,children:n}){return(0,G.jsxs)(`section`,{"aria-label":e,className:`channel-section`,children:[(0,G.jsx)(`h3`,{children:e}),n,t.error&&(0,G.jsx)(QM,{label:e,outcome:{kind:`refused`,title:e,error:t.error}}),t.loading?(0,G.jsx)(ZF,{}):t.value?(0,G.jsx)(`pre`,{className:`verb-text`,children:t.value.rendered}):null]})}function ZF(){return(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),`Loading…`]})}function QF(e){return/\[[^\]]+\]/.exec(e)?.[0]}function $F({runId:e,control:t,ended:n}){let{stop:r,stopOpen:i,setStopOpen:a,forceOpen:o,setForceOpen:s,refusal:c}=eI(t),l=c===void 0?void 0:QF(c.message),u=r.outcome,d=r.pending,f=t.status.value?.liveness;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`div`,{className:`run-actions`,children:[f!==void 0&&(0,G.jsx)(Ma,{"aria-label":`Liveness ${f}`,className:`run-actions-badge`,variant:`outline`,children:f}),!n&&(0,G.jsxs)(Pa,{"aria-label":`Stop`,disabled:d,onClick:()=>a(!0),size:`sm`,title:`Stop`,type:`button`,variant:`destructive`,children:[(0,G.jsx)(Jt,{size:14}),(0,G.jsx)(`span`,{className:`run-action-label`,children:`Stop`})]})]}),(0,G.jsx)(gc,{onOpenChange:a,open:i,children:(0,G.jsxs)(bc,{children:[(0,G.jsxs)(xc,{children:[(0,G.jsxs)(Cc,{children:[`Stop `,e,`?`]}),(0,G.jsx)(wc,{children:`The run is stopped as the acting session. A run another session owns is refused, naming its owner.`})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsx)(vc,{asChild:!0,children:(0,G.jsx)(Pa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,G.jsx)(Pa,{disabled:d,onClick:()=>void r.run(!1),type:`button`,variant:`destructive`,children:`Stop run`})]})]})}),(0,G.jsx)(gc,{onOpenChange:s,open:o,children:(0,G.jsxs)(bc,{children:[(0,G.jsxs)(xc,{children:[(0,G.jsxs)(Cc,{children:[`Force-stop `,e,l!==void 0&&`, overriding ${l}`,`?`]}),(0,G.jsxs)(wc,{children:[c?.message,` — `,`a forced stop is journalled forced with the owner it overrode.`]})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsx)(vc,{asChild:!0,children:(0,G.jsx)(Pa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,G.jsxs)(Pa,{disabled:d,onClick:()=>void r.run(!0),type:`button`,variant:`destructive`,children:[`Force stop`,l!==void 0&&`, overriding ${l}`]})]})]})}),u!==void 0&&(0,G.jsxs)(`div`,{className:`run-outcomes`,children:[(0,G.jsx)(QM,{label:`Stop`,outcome:u}),c!==void 0&&(0,G.jsx)(`div`,{className:`composer-actions`,children:(0,G.jsx)(Pa,{onClick:()=>s(!0),size:`sm`,type:`button`,variant:`destructive`,children:`Force stop…`})})]})]})}function eI(e){let[t,n]=(0,U.useState)(!1),[r,i]=(0,U.useState)(!1),a=kF(e=>e?`Forced stop`:`Stop`,(0,U.useCallback)(async t=>{try{return await e.stop(t)}finally{n(!1),i(!1)}},[e.stop]));return{stop:a,stopOpen:t,setStopOpen:n,forceOpen:r,setForceOpen:i,refusal:a.outcome?.kind===`refused`&&a.outcome.error instanceof KM&&a.outcome.error.code===`not_owner`?a.outcome.error:void 0}}var tI=1e4;function nI(e,t,n){let[r,i]=(0,U.useState)(0);return(0,U.useEffect)(()=>{if(t===void 0)return;let e=setInterval(()=>i(e=>e+1),tI);return()=>clearInterval(e)},[t]),{status:eN(t,()=>e.getStatus(t??``),n+r),stop:(0,U.useCallback)(n=>e.stop(t??``,n),[e,t])}}var rI=o(((e,t)=>{var n=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>void 0;_defaultEdgeLabelFn=()=>void 0;_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(e){e&&(this._isDirected=!Object.hasOwn(e,`directed`)||e.directed,this._isMultigraph=Object.hasOwn(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.hasOwn(e,`compound`)?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,typeof e!=`function`&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>Object.keys(e._in[t]).length===0)}sinks(){var e=this;return this.nodes().filter(t=>Object.keys(e._out[t]).length===0)}setNodes(e,t){var n=arguments,r=this;return e.forEach(function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.hasOwn(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(var n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){var t=this._children[e];if(t)return Object.keys(t)}else if(e===`\0`)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){let r=new Set(t);for(var n of this.successors(e))r.add(n);return Array.from(r.values())}}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,i(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,typeof e!=`function`&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return e.reduce(function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,i,s=!1,c=arguments[0];typeof c==`object`&&c&&`v`in c?(e=c.v,t=c.w,n=c.name,arguments.length===2&&(i=arguments[1],s=!0)):(e=c,t=arguments[1],n=arguments[3],arguments.length>2&&(i=arguments[2],s=!0)),e=``+e,t=``+t,n!==void 0&&(n=``+n);var l=a(this._isDirected,e,t,n);if(Object.hasOwn(this._edgeLabels,l))return s&&(this._edgeLabels[l]=i),this;if(n!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[l]=s?i:this._defaultEdgeLabelFn(e,t,n);var u=o(this._isDirected,e,t,n);return e=u.v,t=u.w,Object.freeze(u),this._edgeObjs[l]=u,r(this._preds[t],e),r(this._sucs[e],t),this._in[t][l]=u,this._out[e][l]=u,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(){let e=this.edge(...arguments);return typeof e==`object`?e:{label:e}}hasEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?s(this._isDirected,arguments[0]):a(this._isDirected,e,t,n),o=this._edgeObjs[r];return o&&(e=o.v,t=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],i(this._preds[t],e),i(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.v===t):r}}outEdges(e,t){var n=this._out[e];if(n){var r=Object.values(n);return t?r.filter(e=>e.w===t):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};function r(e,t){e[t]?e[t]++:e[t]=1}function i(e,t){--e[t]||delete e[t]}function a(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+``+a+``+(r===void 0?`\0`:r)}function o(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function s(e,t){return a(e,t.v,t.w,t.name)}t.exports=n})),iI=o(((e,t)=>{t.exports=`2.2.4`})),aI=o(((e,t)=>{t.exports={Graph:rI(),version:iI()}})),oI=o(((e,t)=>{var n=rI();t.exports={write:r,read:o};function r(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:i(e),edges:a(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function i(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function a(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function o(e){var t=new n(e.options).setGraph(e.value);return e.nodes.forEach(function(e){t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(function(e){t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}})),sI=o(((e,t)=>{t.exports=n;function n(e){var t={},n=[],r;function i(n){Object.hasOwn(t,n)||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}})),cI=o(((e,t)=>{t.exports=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var r=this._arr,i=r.length;return n[e]=i,r.push({key:e,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){var n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}}})),lI=o(((e,t)=>{var n=cI();t.exports=i;var r=()=>1;function i(e,t,n,i){return a(e,String(t),n||r,i||function(t){return e.outEdges(t)})}function a(e,t,r,i){var a={},o=new n,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var n=e===t?0:1/0;a[e]={distance:n},o.add(e,n)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}})),uI=o(((e,t)=>{var n=lI();t.exports=r;function r(e,t,r){return e.nodes().reduce(function(i,a){return i[a]=n(e,a,t,r),i},{})}})),dI=o(((e,t)=>{t.exports=n;function n(e){var t=0,n=[],r={},i=[];function a(o){var s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){Object.hasOwn(r,e)?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){var c=[],l;do l=n.pop(),r[l].onStack=!1,c.push(l);while(o!==l);i.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(r,e)||a(e)}),i}})),fI=o(((e,t)=>{var n=dI();t.exports=r;function r(e){return n(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}})),pI=o(((e,t)=>{t.exports=r;var n=()=>1;function r(e,t,r){return i(e,t||n,r||function(t){return e.outEdges(t)})}function i(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}})),mI=o(((e,t)=>{function n(e){var t={},n={},i=[];function a(o){if(Object.hasOwn(n,o))throw new r;Object.hasOwn(t,o)||(n[o]=!0,t[o]=!0,e.predecessors(o).forEach(a),delete n[o],i.push(o))}if(e.sinks().forEach(a),Object.keys(t).length!==e.nodeCount())throw new r;return i}var r=class extends Error{constructor(){super(...arguments)}};t.exports=n,n.CycleException=r})),hI=o(((e,t)=>{var n=mI();t.exports=r;function r(e){try{n(e)}catch(e){if(e instanceof n.CycleException)return!1;throw e}return!0}})),gI=o(((e,t)=>{t.exports=n;function n(e,t,n){Array.isArray(t)||(t=[t]);var a=e.isDirected()?t=>e.successors(t):t=>e.neighbors(t),o=n===`post`?r:i,s=[],c={};return t.forEach(t=>{if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);o(t,a,c,s)}),s}function r(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),a(t(o[0]),e=>i.push([e,!1])))}}function i(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),a(t(o),e=>i.push(e)))}}function a(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}})),_I=o(((e,t)=>{var n=gI();t.exports=r;function r(e,t){return n(e,t,`post`)}})),vI=o(((e,t)=>{var n=gI();t.exports=r;function r(e,t){return n(e,t,`pre`)}})),yI=o(((e,t)=>{var n=rI(),r=cI();t.exports=i;function i(e,t){var i=new n,a={},o=new r,s;function c(e){var n=e.v===s?e.w:e.v,r=o.priority(n);if(r!==void 0){var i=t(e);i<r&&(a[n]=s,o.decrease(n,i))}}if(e.nodeCount()===0)return i;e.nodes().forEach(function(e){o.add(e,1/0),i.setNode(e)}),o.decrease(e.nodes()[0],0);for(var l=!1;o.size()>0;){if(s=o.removeMin(),Object.hasOwn(a,s))i.setEdge(s,a[s]);else if(l)throw Error(`Input graph is not connected: `+e);else l=!0;e.nodeEdges(s).forEach(c)}return i}})),bI=o(((e,t)=>{t.exports={components:sI(),dijkstra:lI(),dijkstraAll:uI(),findCycles:fI(),floydWarshall:pI(),isAcyclic:hI(),postorder:_I(),preorder:vI(),prim:yI(),tarjan:dI(),topsort:mI()}})),xI=o(((e,t)=>{var n=aI();t.exports={Graph:n.Graph,json:oI(),alg:bI(),version:n.version}})),SI=o(((e,t)=>{var n=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return r(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&r(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,i)),n=n._prev;return`[`+e.join(`, `)+`]`}};function r(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){if(e!==`_next`&&e!==`_prev`)return t}t.exports=n})),CI=o(((e,t)=>{var n=xI().Graph,r=SI();t.exports=a;var i=()=>1;function a(e,t){if(e.nodeCount()<=1)return[];let n=c(e,t||i);return o(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w))}function o(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)s(e,t,n,o);for(;o=i.dequeue();)s(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i].dequeue(),o){r=r.concat(s(e,t,n,o,!0));break}}}return r}function s(e,t,n,r,i){let a=i?[]:void 0;return e.inEdges(r.v).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,l(t,n,s)}),e.outEdges(r.v).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,l(t,n,o)}),e.removeNode(r.v),a}function c(e,t){let i=new n,a=0,o=0;e.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let n=i.edge(e.v,e.w)||0,r=t(e),s=n+r;i.setEdge(e.v,e.w,s),o=Math.max(o,i.node(e.v).out+=r),a=Math.max(a,i.node(e.w).in+=r)});let s=u(o+a+3).map(()=>new r),c=a+1;return i.nodes().forEach(e=>{l(s,c,i.node(e))}),{graph:i,buckets:s,zeroIdx:c}}function l(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function u(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}})),wI=o(((e,t)=>{var n=xI().Graph;t.exports={addBorderNode:f,addDummyNode:r,applyWithChunking:h,asNonCompoundGraph:a,buildLayerMatrix:l,intersectRect:c,mapValues:w,maxRank:g,normalizeRanks:u,notime:y,partition:_,pick:C,predecessorWeights:s,range:S,removeEmptyRanks:d,simplify:i,successorWeights:o,time:v,uniqueId:x,zipObject:T};function r(e,t,n,r){for(var i=r;e.hasNode(i);)i=x(r);return n.dummy=t,e.setNode(i,n),i}function i(e){let t=new n().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function a(e){let t=new n({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function o(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function s(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return T(e.nodes(),t)}function c(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function l(e){let t=S(g(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i][r.order]=n)}),t}function u(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=h(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function d(e){let t=e.nodes().map(t=>e.node(t).rank),n=h(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function f(e,t,n,i){let a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=i),r(e,`border`,a,t)}function p(e,t=m){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var m=65535;function h(e,t){if(t.length>m){let n=p(t);return e.apply(null,n.map(t=>e.apply(null,t)))}else return e.apply(null,t)}function g(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return h(Math.max,t)}function _(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function v(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function y(e,t){return t()}var b=0;function x(e){return e+(``+ ++b)}function S(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function C(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function w(e,t){let n=t;return typeof t==`string`&&(n=e=>e[t]),Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function T(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}})),TI=o(((e,t)=>{var n=CI(),r=wI().uniqueId;t.exports={run:i,undo:o};function i(e){(e.graph().acyclicer===`greedy`?n(e,t(e)):a(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,r(`rev`))});function t(e){return t=>e.edge(t).weight}}function a(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function o(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}})),EI=o(((e,t)=>{var n=wI();t.exports={run:r,undo:a};function r(e){e.graph().dummyChains=[],e.edges().forEach(t=>i(e,t))}function i(e,t){let r=t.v,i=e.node(r).rank,a=t.w,o=e.node(a).rank,s=t.name,c=e.edge(t),l=c.labelRank;if(o===i+1)return;e.removeEdge(t);let u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:t,rank:i},u=n.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}function a(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}})),DI=o(((e,t)=>{var{applyWithChunking:n}=wI();t.exports={longestPath:r,slack:i};function r(e){var t={};function r(i){var a=e.node(i);if(Object.hasOwn(t,i))return a.rank;t[i]=!0;let o=e.outEdges(i).map(t=>t==null?1/0:r(t.w)-e.edge(t).minlen);var s=n(Math.min,o);return s===1/0&&(s=0),a.rank=s}e.sources().forEach(r)}function i(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}})),OI=o(((e,t)=>{var n=xI().Graph,r=DI().slack;t.exports=i;function i(e){var t=new n({directed:!1}),i=e.nodes()[0],c=e.nodeCount();t.setNode(i,{});for(var l,u;a(t,e)<c;)l=o(t,e),u=t.hasNode(l.v)?r(e,l):-r(e,l),s(t,e,u);return t}function a(e,t){function n(i){t.nodeEdges(i).forEach(a=>{var o=a.v,s=i===o?a.w:o;!e.hasNode(s)&&!r(t,a)&&(e.setNode(s,{}),e.setEdge(i,s,{}),n(s))})}return e.nodes().forEach(n),e.nodeCount()}function o(e,t){return t.edges().reduce((n,i)=>{let a=1/0;return e.hasNode(i.v)!==e.hasNode(i.w)&&(a=r(t,i)),a<n[0]?[a,i]:n},[1/0,null])[1]}function s(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}})),kI=o(((e,t)=>{var n=OI(),r=DI().slack,i=DI().longestPath,a=xI().alg.preorder,o=xI().alg.postorder,s=wI().simplify;t.exports=c,c.initLowLimValues=f,c.initCutValues=l,c.calcCutValue=d,c.leaveEdge=m,c.enterEdge=h,c.exchangeEdges=g;function c(e){e=s(e),i(e);var t=n(e);f(t),l(t,e);for(var r,a;r=m(t);)a=h(t,e,r),g(t,e,r,a)}function l(e,t){var n=o(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>u(e,t,n))}function u(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=d(e,t,n)}function d(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,t.nodeEdges(n).forEach(a=>{var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,v(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function f(e,t){arguments.length<2&&(t=e.nodes()[0]),p(e,{},1,t)}function p(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,e.neighbors(r).forEach(i=>{Object.hasOwn(t,i)||(n=p(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function m(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function h(e,t,n){var i=n.v,a=n.w;t.hasEdge(i,a)||(i=n.w,a=n.v);var o=e.node(i),s=e.node(a),c=o,l=!1;return o.lim>s.lim&&(c=s,l=!0),t.edges().filter(t=>l===y(e,e.node(t.v),c)&&l!==y(e,e.node(t.w),c)).reduce((e,n)=>r(t,n)<r(t,e)?n:e)}function g(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),f(e),l(e,t),_(e,t)}function _(e,t){var n=a(e,e.nodes().find(e=>!t.node(e).parent));n=n.slice(1),n.forEach(n=>{var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function v(e,t,n){return e.hasEdge(t,n)}function y(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}})),AI=o(((e,t)=>{var n=DI().longestPath,r=OI(),i=kI();t.exports=a;function a(e){var t=e.graph().ranker;if(t instanceof Function)return t(e);switch(e.graph().ranker){case`network-simplex`:c(e);break;case`tight-tree`:s(e);break;case`longest-path`:o(e);break;case`none`:break;default:c(e)}}var o=n;function s(e){n(e),r(e)}function c(e){i(e)}})),jI=o(((e,t)=>{t.exports=n;function n(e){let t=i(e);e.graph().dummyChains.forEach(n=>{let i=e.node(n),a=i.edgeObj,o=r(e,t,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;for(;n!==a.w;){if(i=e.node(n),d){for(;(u=s[l])!==c&&e.node(u).maxRank<i.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&e.node(u=s[l+1]).minRank<=i.rank;)l++;u=s[l]}e.setParent(n,u),n=e.successors(n)[0]}})}function r(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c,l;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function i(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children().forEach(r),t}})),MI=o(((e,t)=>{var n=wI();t.exports={run:r,cleanup:s};function r(e){let t=n.addDummyNode(e,`root`,{},`_root`),r=a(e),s=Object.values(r),c=n.applyWithChunking(Math.max,s)-1,l=2*c+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=l);let u=o(e)+1;e.children().forEach(n=>i(e,t,l,u,c,r,n)),e.graph().nodeRankFactor=l}function i(e,t,r,a,o,s,c){let l=e.children(c);if(!l.length){c!==t&&e.setEdge(t,c,{weight:0,minlen:r});return}let u=n.addBorderNode(e,`_bt`),d=n.addBorderNode(e,`_bb`),f=e.node(c);e.setParent(u,c),f.borderTop=u,e.setParent(d,c),f.borderBottom=d,l.forEach(n=>{i(e,t,r,a,o,s,n);let l=e.node(n),f=l.borderTop?l.borderTop:n,p=l.borderBottom?l.borderBottom:n,m=l.borderTop?a:2*a,h=f===p?o-s[c]+1:1;e.setEdge(u,f,{weight:m,minlen:h,nestingEdge:!0}),e.setEdge(p,d,{weight:m,minlen:h,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,u,{weight:0,minlen:o+s[c]})}function a(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children().forEach(e=>n(e,1)),t}function o(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function s(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}})),NI=o(((e,t)=>{var n=wI();t.exports=r;function r(e){function t(n){let r=e.children(n),a=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(a,`minRank`)){a.borderLeft=[],a.borderRight=[];for(let t=a.minRank,r=a.maxRank+1;t<r;++t)i(e,`borderLeft`,`_bl`,n,a,t),i(e,`borderRight`,`_br`,n,a,t)}}e.children().forEach(t)}function i(e,t,r,i,a,o){let s={width:0,height:0,rank:o,borderType:t},c=a[t][o-1],l=n.addDummyNode(e,`border`,s,r);a[t][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}})),PI=o(((e,t)=>{t.exports={adjust:n,undo:r};function n(e){let t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&i(e)}function r(e){let t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&o(e),(t===`lr`||t===`rl`)&&(c(e),i(e))}function i(e){e.nodes().forEach(t=>a(e.node(t))),e.edges().forEach(t=>a(e.edge(t)))}function a(e){let t=e.width;e.width=e.height,e.height=t}function o(e){e.nodes().forEach(t=>s(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(s),Object.hasOwn(n,`y`)&&s(n)})}function s(e){e.y=-e.y}function c(e){e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(l),Object.hasOwn(n,`x`)&&l(n)})}function l(e){let t=e.x;e.x=e.y,e.y=t}})),FI=o(((e,t)=>{var n=wI();t.exports=r;function r(e){let t={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=n.applyWithChunking(Math.max,i),o=n.range(a+1).map(()=>[]);function s(n){if(t[n])return;t[n]=!0;let r=e.node(n);o[r.rank].push(n),e.successors(n).forEach(s)}return r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(s),o}})),II=o(((e,t)=>{var n=wI().zipObject;t.exports=r;function r(e,t){let n=0;for(let r=1;r<t.length;++r)n+=i(e,t[r-1],t[r]);return n}function i(e,t,r){let i=n(r,r.map((e,t)=>t)),a=t.flatMap(t=>e.outEdges(t).map(t=>({pos:i[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos)),o=1;for(;o<r.length;)o<<=1;let s=2*o-1;--o;let c=Array(s).fill(0),l=0;return a.forEach(e=>{let t=e.pos+o;c[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n}),l}})),LI=o(((e,t)=>{t.exports=n;function n(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}else return{v:t}})}})),RI=o(((e,t)=>{var n=wI();t.exports=r;function r(e,t){let n={};return e.forEach((e,t)=>{let r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight)}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(n[e.w]))}),i(Object.values(n).filter(e=>!e.indegree))}function i(e){let t=[];function r(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&a(e,t)}}function i(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let n=e.pop();t.push(n),n.in.reverse().forEach(r(n)),n.out.forEach(i(n))}return t.filter(e=>!e.merged).map(e=>n.pick(e,[`vs`,`i`,`barycenter`,`weight`]))}function a(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}})),zI=o(((e,t)=>{var n=wI();t.exports=r;function r(e,t){let r=n.partition(e,e=>Object.hasOwn(e,`barycenter`)),o=r.lhs,s=r.rhs.sort((e,t)=>t.i-e.i),c=[],l=0,u=0,d=0;o.sort(a(!!t)),d=i(c,s,d),o.forEach(e=>{d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,u+=e.weight,d=i(c,s,d)});let f={vs:c.flat(!0)};return u&&(f.barycenter=l/u,f.weight=u),f}function i(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function a(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}})),BI=o(((e,t)=>{var n=LI(),r=RI(),i=zI();t.exports=a;function a(e,t,c,l){let u=e.children(t),d=e.node(t),f=d?d.borderLeft:void 0,p=d?d.borderRight:void 0,m={};f&&(u=u.filter(e=>e!==f&&e!==p));let h=n(e,u);h.forEach(t=>{if(e.children(t.v).length){let n=a(e,t.v,c,l);m[t.v]=n,Object.hasOwn(n,`barycenter`)&&s(t,n)}});let g=r(h,c);o(g,m);let _=i(g,l);if(f&&(_.vs=[f,_.vs,p].flat(!0),e.predecessors(f).length)){let t=e.node(e.predecessors(f)[0]),n=e.node(e.predecessors(p)[0]);Object.hasOwn(_,`barycenter`)||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+t.order+n.order)/(_.weight+2),_.weight+=2}return _}function o(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function s(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}})),VI=o(((e,t)=>{var n=xI().Graph,r=wI();t.exports=i;function i(e,t,r){let i=a(e),o=new n({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return e.nodes().forEach(n=>{let a=e.node(n),s=e.parent(n);(a.rank===t||a.minRank<=t&&t<=a.maxRank)&&(o.setNode(n),o.setParent(n,s||i),e[r](n).forEach(t=>{let r=t.v===n?t.w:t.v,i=o.edge(r,n),a=i===void 0?0:i.weight;o.setEdge(r,n,{weight:e.edge(t).weight+a})}),Object.hasOwn(a,`minRank`)&&o.setNode(n,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]}))}),o}function a(e){for(var t;e.hasNode(t=r.uniqueId(`_root`)););return t}})),HI=o(((e,t)=>{t.exports=n;function n(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}})),UI=o(((e,t)=>{var n=FI(),r=II(),i=BI(),a=VI(),o=HI(),s=xI().Graph,c=wI();t.exports=l;function l(e,t){if(t&&typeof t.customOrder==`function`){t.customOrder(e,l);return}let i=c.maxRank(e),a=u(e,c.range(1,i+1),`inEdges`),o=u(e,c.range(i-1,-1,-1),`outEdges`),s=n(e);if(f(e,s),t&&t.disableOptimalOrderHeuristic)return;let p=1/0,m;for(let t=0,n=0;n<4;++t,++n){d(t%2?a:o,t%4>=2),s=c.buildLayerMatrix(e);let i=r(e,s);i<p&&(n=0,m=Object.assign({},s),p=i)}f(e,m)}function u(e,t,n){return t.map(function(t){return a(e,t,n)})}function d(e,t){let n=new s;e.forEach(function(e){let r=e.graph().root,a=i(e,r,n,t);a.vs.forEach((t,n)=>e.node(t).order=n),o(e,n,a.vs)})}function f(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}})),WI=o(((e,t)=>{var n=xI().Graph,r=wI();t.exports={positionX:h,findType1Conflicts:i,findType2Conflicts:a,addConflict:s,hasConflict:c,verticalAlignment:l,horizontalCompaction:u,alignCoordinates:p,findSmallestWidthAlignment:f,balance:m};function i(e,t){let n={};function r(t,r){let i=0,a=0,c=t.length,l=r[r.length-1];return r.forEach((t,u)=>{let d=o(e,t),f=d?e.node(d).order:c;(d||t===l)&&(r.slice(a,u+1).forEach(t=>{e.predecessors(t).forEach(r=>{let a=e.node(r),o=a.order;(o<i||f<o)&&!(a.dummy&&e.node(t).dummy)&&s(n,r,t)})}),a=u+1,i=f)}),r}return t.length&&t.reduce(r),n}function a(e,t){let n={};function i(t,i,a,o,c){let l;r.range(i,a).forEach(r=>{l=t[r],e.node(l).dummy&&e.predecessors(l).forEach(t=>{let r=e.node(t);r.dummy&&(r.order<o||r.order>c)&&s(n,t,l)})})}function a(t,n){let r=-1,a,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);t.length&&(a=e.node(t[0]).order,i(n,o,c,r,a),o=c,r=a)}i(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(a),n}function o(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}function s(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function c(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function l(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s.length){s=s.sort((e,t)=>o[e]-o[t]);let r=(s.length-1)/2;for(let l=Math.floor(r),u=Math.ceil(r);l<=u;++l){let r=s[l];a[e]===e&&t<o[r]&&!c(n,e,r)&&(a[r]=e,a[e]=i[e]=i[r],t=o[r])}}})}),{root:i,align:a}}function u(e,t,n,r,i){let a={},o=d(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+o.edge(t)),0)}function u(t){let n=o.outEdges(t).reduce((e,t)=>Math.min(e,a[t.w]-o.edge(t)),1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),Object.keys(r).forEach(e=>a[e]=a[n[e]]),a}function d(e,t,r,i){let a=new n,o=e.graph(),s=g(o.nodesep,o.edgesep,i);return t.forEach(t=>{let n;t.forEach(t=>{let i=r[t];if(a.setNode(i),n){var o=r[n],c=a.edge(o,i);a.setEdge(o,i,Math.max(s(e,t,n),c||0))}n=t})}),a}function f(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=_(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function p(e,t){let n=Object.values(t),i=r.applyWithChunking(Math.min,n),a=r.applyWithChunking(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(o=>{let s=n+o,c=e[s];if(c===t)return;let l=Object.values(c),u=i-r.applyWithChunking(Math.min,l);o!==`l`&&(u=a-r.applyWithChunking(Math.max,l)),u&&(e[s]=r.mapValues(c,e=>e+u))})})}function m(e,t){return r.mapValues(e.ul,(n,r)=>{if(t)return e[t.toLowerCase()][r];{let t=Object.values(e).map(e=>e[r]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}function h(e){let t=r.buildLayerMatrix(e),n=Object.assign(i(e,t),a(e,t)),o={},s;return[`u`,`d`].forEach(i=>{s=i===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(s=s.map(e=>Object.values(e).reverse()));let a=(i===`u`?e.predecessors:e.successors).bind(e),c=l(e,s,n,a),d=u(e,s,c.root,c.align,t===`r`);t===`r`&&(d=r.mapValues(d,e=>-e)),o[i+t]=d})}),p(o,f(e,o)),m(o,e.graph().align)}function g(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2;break}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2;break}return l&&(c+=n?l:-l),l=0,c}}function _(e,t){return e.node(t).width}})),GI=o(((e,t)=>{var n=wI(),r=WI().positionX;t.exports=i;function i(e){e=n.asNonCompoundGraph(e),a(e),Object.entries(r(e)).forEach(([t,n])=>e.node(t).x=n)}function a(e){let t=n.buildLayerMatrix(e),r=e.graph().ranksep,i=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height;return t>r?t:r},0);t.forEach(t=>e.node(t).y=i+n/2),i+=n+r})}})),KI=o(((e,t)=>{var n=TI(),r=EI(),i=AI(),a=wI().normalizeRanks,o=jI(),s=wI().removeEmptyRanks,c=MI(),l=NI(),u=PI(),d=UI(),f=GI(),p=wI(),m=xI().Graph;t.exports=h;function h(e,t){let n=t&&t.debugTiming?p.time:p.notime;n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>E(e));n(` runLayout`,()=>g(r,n,t)),n(` updateInputGraph`,()=>_(e,r))})}function g(e,t,m){t(` makeSpaceForEdgeLabels`,()=>D(e)),t(` removeSelfEdges`,()=>F(e)),t(` acyclic`,()=>n.run(e)),t(` nestingGraph.run`,()=>c.run(e)),t(` rank`,()=>i(p.asNonCompoundGraph(e))),t(` injectEdgeLabelProxies`,()=>O(e)),t(` removeEmptyRanks`,()=>s(e)),t(` nestingGraph.cleanup`,()=>c.cleanup(e)),t(` normalizeRanks`,()=>a(e)),t(` assignRankMinMax`,()=>k(e)),t(` removeEdgeLabelProxies`,()=>A(e)),t(` normalize.run`,()=>r.run(e)),t(` parentDummyChains`,()=>o(e)),t(` addBorderSegments`,()=>l(e)),t(` order`,()=>d(e,m)),t(` insertSelfEdges`,()=>I(e)),t(` adjustCoordinateSystem`,()=>u.adjust(e)),t(` position`,()=>f(e)),t(` positionSelfEdges`,()=>L(e)),t(` removeBorderNodes`,()=>ee(e)),t(` normalize.undo`,()=>r.undo(e)),t(` fixupEdgeLabelCoords`,()=>N(e)),t(` undoCoordinateSystem`,()=>u.undo(e)),t(` translateGraph`,()=>j(e)),t(` assignNodeIntersects`,()=>M(e)),t(` reversePoints`,()=>P(e)),t(` acyclic.undo`,()=>n.undo(e))}function _(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var v=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],y={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},b=[`acyclicer`,`ranker`,`rankdir`,`align`],x=[`width`,`height`,`rank`],S={width:0,height:0},C=[`minlen`,`weight`,`width`,`height`,`labeloffset`],w={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},T=[`labelpos`];function E(e){let t=new m({multigraph:!0,compound:!0}),n=ne(e.graph());return t.setGraph(Object.assign({},y,te(n,v),p.pick(n,b))),e.nodes().forEach(n=>{let r=te(ne(e.node(n)),x);Object.keys(S).forEach(e=>{r[e]===void 0&&(r[e]=S[e])}),t.setNode(n,r),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let r=ne(e.edge(n));t.setEdge(n,Object.assign({},w,te(r,C),p.pick(r,T)))}),t}function D(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function O(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),r={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};p.addDummyNode(e,`edge-proxy`,r,`_ep`)}})}function k(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function A(e){e.nodes().forEach(t=>{let n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function j(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function M(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(p.intersectRect(r,a)),n.points.push(p.intersectRect(i,o))})}function N(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset;break}})}function P(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function ee(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function F(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function I(e){p.buildLayerMatrix(e).forEach(t=>{var n=0;t.forEach((t,r)=>{var i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{p.addDummyNode(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function L(e){e.nodes().forEach(t=>{var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function te(e,t){return p.mapValues(p.pick(e,t),Number)}function ne(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}})),qI=o(((e,t)=>{var n=wI(),r=xI().Graph;t.exports={debugOrdering:i};function i(e){let t=n.buildLayerMatrix(e),i=new r({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{i.setNode(t,{label:t}),i.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let n=`layer`+t;i.setNode(n,{rank:`same`}),e.reduce((e,t)=>(i.setEdge(e,t,{style:`invis`}),t))}),i}})),JI=o(((e,t)=>{t.exports=`1.1.5`})),YI=l(o(((e,t)=>{t.exports={graphlib:xI(),layout:KI(),debug:qI(),util:{time:wI().time,notime:wI().notime},version:JI()}}))(),1),XI=[`pending`,`running`,`waiting`,`blocked`,`skipped`,`done`,`not-completed`,`failed`,`parked`,`cancelled`,`unknown`],ZI=200,QI=72,$I=80,eL=32,tL=new Set(XI),nL={pending:`neutral`,running:`active`,waiting:`blocked`,blocked:`blocked`,skipped:`blocked`,done:`success`,"not-completed":`danger`,failed:`danger`,parked:`muted`,cancelled:`muted`,unknown:`neutral`},rL=(e,t)=>e<t?-1:+(e>t);function iL(e){let t=[...e.nodes].sort((e,t)=>rL(e.id,t.id)),n=[...e.edges].sort((e,t)=>rL(e.id,t.id)),r=new Map(t.map(e=>[e.id,e]));if(r.size!==t.length)throw Error(`DAG node IDs must be unique`);for(let e of t)if(!tL.has(e.state))throw Error(`DAG node ${e.id} has unsupported state ${e.state}`);let i=new Map(t.map(e=>[e.id,0])),a=new Map(t.map(e=>[e.id,[]])),o=new Set;for(let e of n){if(o.has(e.id))throw Error(`DAG edge IDs must be unique`);if(o.add(e.id),!r.has(e.source)||!r.has(e.target))throw Error(`DAG edge ${e.id} has a missing endpoint`);if(e.source===e.target)throw Error(`DAG edge ${e.id} is a self-edge`);i.set(e.target,(i.get(e.target)??0)+1),a.get(e.source)?.push(e.target)}let s=new Map,c=t.filter(e=>i.get(e.id)===0).map(e=>e.id),l=0;for(;c.length>0;){let e=c;c=[];for(let t of e){l+=1;let e=s.get(t)??0;for(let n of a.get(t)??[]){s.set(n,Math.max(s.get(n)??0,e+1));let t=(i.get(n)??0)-1;i.set(n,t),t===0&&c.push(n)}}c.sort()}if(l!==t.length)throw Error(`DAG contains a cycle`);let u=new YI.default.graphlib.Graph({multigraph:!0});u.setGraph({rankdir:`LR`,ranksep:$I,nodesep:eL,marginx:0,marginy:0}),u.setDefaultEdgeLabel(()=>({}));for(let e of t)u.setNode(e.id,{width:ZI,height:QI});for(let e of n)u.setEdge(e.source,e.target,{},e.id);YI.default.layout(u);let d=new Map;for(let e of t){let t=s.get(e.id)??0,n=d.get(t)??[];n.push(e.id),d.set(t,n)}for(let e of d.values())e.sort((e,t)=>(u.node(e)?.y??0)-(u.node(t)?.y??0)||rL(e,t));let f=t.map(e=>{let t=s.get(e.id)??0,n=d.get(t)?.indexOf(e.id)??0;return{...e,x:t*280,y:n*104,width:ZI,height:QI,style:nL[e.state]}}),p=new Map(f.map(e=>[e.id,e])),m=n.map(e=>{let t=p.get(e.source),n=p.get(e.target);if(!t||!n)throw Error(`DAG layout lost an edge endpoint`);let r={x:t.x+t.width,y:t.y+t.height/2},i={x:n.x,y:n.y+n.height/2},a=Math.round((r.x+i.x)/2);return{...e,points:[r,{x:a,y:r.y},{x:a,y:i.y},i]}});return{width:f.length===0?0:Math.max(...f.map(e=>e.x+e.width)),height:f.length===0?0:Math.max(...f.map(e=>e.y+e.height)),nodes:f,edges:m}}function aL(e){if(typeof e==`string`||typeof e==`number`)return``+e;let t=``;if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=aL(e[n]))!==``&&(t+=(t&&` `)+r);else for(let n in e)e[n]&&(t+=(t&&` `)+n);return t}var oL={value:()=>{}};function sL(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new cL(n)}function cL(e){this._=e}function lL(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}cL.prototype=sL.prototype={constructor:cL,on:function(e,t){var n=this._,r=lL(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=uL(n[i],e.name)))return i;return}if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=dL(n[i],e.name,t);else if(t==null)for(i in n)n[i]=dL(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new cL(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function uL(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function dL(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=oL,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var fL={svg:`http://www.w3.org/2000/svg`,xhtml:`http://www.w3.org/1999/xhtml`,xlink:`http://www.w3.org/1999/xlink`,xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`};function pL(e){var t=e+=``,n=t.indexOf(`:`);return n>=0&&(t=e.slice(0,n))!==`xmlns`&&(e=e.slice(n+1)),fL.hasOwnProperty(t)?{space:fL[t],local:e}:e}function mL(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===`http://www.w3.org/1999/xhtml`&&t.documentElement.namespaceURI===`http://www.w3.org/1999/xhtml`?t.createElement(e):t.createElementNS(n,e)}}function hL(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function gL(e){var t=pL(e);return(t.local?hL:mL)(t)}function _L(){}function vL(e){return e==null?_L:function(){return this.querySelector(e)}}function yL(e){typeof e!=`function`&&(e=vL(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=Array(o),c,l,u=0;u<o;++u)(c=a[u])&&(l=e.call(c,c.__data__,u,a))&&(`__data__`in c&&(l.__data__=c.__data__),s[u]=l);return new sz(r,this._parents)}function bL(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function xL(){return[]}function SL(e){return e==null?xL:function(){return this.querySelectorAll(e)}}function CL(e){return function(){return bL(e.apply(this,arguments))}}function wL(e){e=typeof e==`function`?CL(e):SL(e);for(var t=this._groups,n=t.length,r=[],i=[],a=0;a<n;++a)for(var o=t[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&(r.push(e.call(c,c.__data__,l,o)),i.push(c));return new sz(r,i)}function TL(e){return function(){return this.matches(e)}}function EL(e){return function(t){return t.matches(e)}}var DL=Array.prototype.find;function OL(e){return function(){return DL.call(this.children,e)}}function kL(){return this.firstElementChild}function AL(e){return this.select(e==null?kL:OL(typeof e==`function`?e:EL(e)))}var jL=Array.prototype.filter;function ML(){return Array.from(this.children)}function NL(e){return function(){return jL.call(this.children,e)}}function PL(e){return this.selectAll(e==null?ML:NL(typeof e==`function`?e:EL(e)))}function FL(e){typeof e!=`function`&&(e=TL(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new sz(r,this._parents)}function IL(e){return Array(e.length)}function LL(){return new sz(this._enter||this._groups.map(IL),this._parents)}function RL(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}RL.prototype={constructor:RL,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function zL(e){return function(){return e}}function BL(e,t,n,r,i,a){for(var o=0,s,c=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],r[o]=s):n[o]=new RL(e,a[o]);for(;o<c;++o)(s=t[o])&&(i[o]=s)}function VL(e,t,n,r,i,a,o){var s,c,l=new Map,u=t.length,d=a.length,f=Array(u),p;for(s=0;s<u;++s)(c=t[s])&&(f[s]=p=o.call(c,c.__data__,s,t)+``,l.has(p)?i[s]=c:l.set(p,c));for(s=0;s<d;++s)p=o.call(e,a[s],s,a)+``,(c=l.get(p))?(r[s]=c,c.__data__=a[s],l.delete(p)):n[s]=new RL(e,a[s]);for(s=0;s<u;++s)(c=t[s])&&l.get(f[s])===c&&(i[s]=c)}function HL(e){return e.__data__}function UL(e,t){if(!arguments.length)return Array.from(this,HL);var n=t?VL:BL,r=this._parents,i=this._groups;typeof e!=`function`&&(e=zL(e));for(var a=i.length,o=Array(a),s=Array(a),c=Array(a),l=0;l<a;++l){var u=r[l],d=i[l],f=d.length,p=WL(e.call(u,u&&u.__data__,l,r)),m=p.length,h=s[l]=Array(m),g=o[l]=Array(m);n(u,d,h,g,c[l]=Array(f),p,t);for(var _=0,v=0,y,b;_<m;++_)if(y=h[_]){for(_>=v&&(v=_+1);!(b=g[v])&&++v<m;);y._next=b||null}}return o=new sz(o,r),o._enter=s,o._exit=c,o}function WL(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function GL(){return new sz(this._exit||this._groups.map(IL),this._parents)}function KL(e,t,n){var r=this.enter(),i=this,a=this.exit();return typeof e==`function`?(r=e(r),r&&=r.selection()):r=r.append(e+``),t!=null&&(i=t(i),i&&=i.selection()),n==null?a.remove():n(a),r&&i?r.merge(i).order():i}function qL(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,a=r.length,o=Math.min(i,a),s=Array(i),c=0;c<o;++c)for(var l=n[c],u=r[c],d=l.length,f=s[c]=Array(d),p,m=0;m<d;++m)(p=l[m]||u[m])&&(f[m]=p);for(;c<i;++c)s[c]=n[c];return new sz(s,this._parents)}function JL(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,a=r[i],o;--i>=0;)(o=r[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function YL(e){e||=XL;function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}for(var n=this._groups,r=n.length,i=Array(r),a=0;a<r;++a){for(var o=n[a],s=o.length,c=i[a]=Array(s),l,u=0;u<s;++u)(l=o[u])&&(c[u]=l);c.sort(t)}return new sz(i,this._parents).order()}function XL(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ZL(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function QL(){return Array.from(this)}function $L(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length;i<a;++i){var o=r[i];if(o)return o}return null}function eR(){let e=0;for(let t of this)++e;return e}function tR(){return!this.node()}function nR(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function rR(e){return function(){this.removeAttribute(e)}}function iR(e){return function(){this.removeAttributeNS(e.space,e.local)}}function aR(e,t){return function(){this.setAttribute(e,t)}}function oR(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sR(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function cR(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function lR(e,t){var n=pL(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?iR:rR:typeof t==`function`?n.local?cR:sR:n.local?oR:aR)(n,t))}function uR(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function dR(e){return function(){this.style.removeProperty(e)}}function fR(e,t,n){return function(){this.style.setProperty(e,t,n)}}function pR(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function mR(e,t,n){return arguments.length>1?this.each((t==null?dR:typeof t==`function`?pR:fR)(e,t,n??``)):hR(this.node(),e)}function hR(e,t){return e.style.getPropertyValue(t)||uR(e).getComputedStyle(e,null).getPropertyValue(t)}function gR(e){return function(){delete this[e]}}function _R(e,t){return function(){this[e]=t}}function vR(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yR(e,t){return arguments.length>1?this.each((t==null?gR:typeof t==`function`?vR:_R)(e,t)):this.node()[e]}function bR(e){return e.trim().split(/^|\s+/)}function xR(e){return e.classList||new SR(e)}function SR(e){this._node=e,this._names=bR(e.getAttribute(`class`)||``)}SR.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute(`class`,this._names.join(` `)))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute(`class`,this._names.join(` `)))},contains:function(e){return this._names.indexOf(e)>=0}};function CR(e,t){for(var n=xR(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function wR(e,t){for(var n=xR(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function TR(e){return function(){CR(this,e)}}function ER(e){return function(){wR(this,e)}}function DR(e,t){return function(){(t.apply(this,arguments)?CR:wR)(this,e)}}function OR(e,t){var n=bR(e+``);if(arguments.length<2){for(var r=xR(this.node()),i=-1,a=n.length;++i<a;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t==`function`?DR:t?TR:ER)(n,t))}function kR(){this.textContent=``}function AR(e){return function(){this.textContent=e}}function jR(e){return function(){var t=e.apply(this,arguments);this.textContent=t??``}}function MR(e){return arguments.length?this.each(e==null?kR:(typeof e==`function`?jR:AR)(e)):this.node().textContent}function NR(){this.innerHTML=``}function PR(e){return function(){this.innerHTML=e}}function FR(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??``}}function IR(e){return arguments.length?this.each(e==null?NR:(typeof e==`function`?FR:PR)(e)):this.node().innerHTML}function LR(){this.nextSibling&&this.parentNode.appendChild(this)}function RR(){return this.each(LR)}function zR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function BR(){return this.each(zR)}function VR(e){var t=typeof e==`function`?e:gL(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function HR(){return null}function UR(e,t){var n=typeof e==`function`?e:gL(e),r=t==null?HR:typeof t==`function`?t:vL(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function WR(){var e=this.parentNode;e&&e.removeChild(this)}function GR(){return this.each(WR)}function KR(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function qR(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function JR(e){return this.select(e?qR:KR)}function YR(e){return arguments.length?this.property(`__data__`,e):this.node().__data__}function XR(e){return function(t){e.call(this,t,this.__data__)}}function ZR(e){return e.trim().split(/^|\s+/).map(function(e){var t=``,n=e.indexOf(`.`);return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}function QR(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,a;n<i;++n)a=t[n],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++r]=a;++r?t.length=r:delete this.__on}}}function $R(e,t,n){return function(){var r=this.__on,i,a=XR(t);if(r){for(var o=0,s=r.length;o<s;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=n),i.value=t;return}}this.addEventListener(e.type,a,n),i={type:e.type,name:e.name,value:t,listener:a,options:n},r?r.push(i):this.__on=[i]}}function ez(e,t,n){var r=ZR(e+``),i,a=r.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var c=0,l=s.length,u;c<l;++c)for(i=0,u=s[c];i<a;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(s=t?$R:QR,i=0;i<a;++i)this.each(s(r[i],t,n));return this}function tz(e,t,n){var r=uR(e),i=r.CustomEvent;typeof i==`function`?i=new i(t,n):(i=r.document.createEvent(`Event`),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function nz(e,t){return function(){return tz(this,e,t)}}function rz(e,t){return function(){return tz(this,e,t.apply(this,arguments))}}function iz(e,t){return this.each((typeof t==`function`?rz:nz)(e,t))}function*az(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,a=r.length,o;i<a;++i)(o=r[i])&&(yield o)}var oz=[null];function sz(e,t){this._groups=e,this._parents=t}function cz(){return new sz([[document.documentElement]],oz)}function lz(){return this}sz.prototype=cz.prototype={constructor:sz,select:yL,selectAll:wL,selectChild:AL,selectChildren:PL,filter:FL,data:UL,enter:LL,exit:GL,join:KL,merge:qL,selection:lz,order:JL,sort:YL,call:ZL,nodes:QL,node:$L,size:eR,empty:tR,each:nR,attr:lR,style:mR,property:yR,classed:OR,text:MR,html:IR,raise:RR,lower:BR,append:VR,insert:UR,remove:GR,clone:JR,datum:YR,on:ez,dispatch:iz,[Symbol.iterator]:az};function uz(e){return typeof e==`string`?new sz([[document.querySelector(e)]],[document.documentElement]):new sz([[e]],oz)}function dz(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fz(e,t){if(e=dz(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var pz={passive:!1},mz={capture:!0,passive:!1};function hz(e){e.stopImmediatePropagation()}function gz(e){e.preventDefault(),e.stopImmediatePropagation()}function _z(e){var t=e.document.documentElement,n=uz(e).on(`dragstart.drag`,gz,mz);`onselectstart`in t?n.on(`selectstart.drag`,gz,mz):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect=`none`)}function vz(e,t){var n=e.document.documentElement,r=uz(e).on(`dragstart.drag`,null);t&&(r.on(`click.drag`,gz,mz),setTimeout(function(){r.on(`click.drag`,null)},0)),`onselectstart`in n?r.on(`selectstart.drag`,null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var yz=e=>()=>e;function bz(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:a,x:o,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}bz.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function xz(e){return!e.ctrlKey&&!e.button}function Sz(){return this.parentNode}function Cz(e,t){return t??{x:e.x,y:e.y}}function wz(){return navigator.maxTouchPoints||`ontouchstart`in this}function Tz(){var e=xz,t=Sz,n=Cz,r=wz,i={},a=sL(`start`,`drag`,`end`),o=0,s,c,l,u,d=0;function f(e){e.on(`mousedown.drag`,p).filter(r).on(`touchstart.drag`,g).on(`touchmove.drag`,_,pz).on(`touchend.drag touchcancel.drag`,v).style(`touch-action`,`none`).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}function p(n,r){if(!(u||!e.call(this,n,r))){var i=y(this,t.call(this,n,r),n,r,`mouse`);i&&(uz(n.view).on(`mousemove.drag`,m,mz).on(`mouseup.drag`,h,mz),_z(n.view),hz(n),l=!1,s=n.clientX,c=n.clientY,i(`start`,n))}}function m(e){if(gz(e),!l){var t=e.clientX-s,n=e.clientY-c;l=t*t+n*n>d}i.mouse(`drag`,e)}function h(e){uz(e.view).on(`mousemove.drag mouseup.drag`,null),vz(e.view,l),gz(e),i.mouse(`end`,e)}function g(n,r){if(e.call(this,n,r)){var i=n.changedTouches,a=t.call(this,n,r),o=i.length,s,c;for(s=0;s<o;++s)(c=y(this,a,n,r,i[s].identifier,i[s]))&&(hz(n),c(`start`,n,i[s]))}}function _(e){var t=e.changedTouches,n=t.length,r,a;for(r=0;r<n;++r)(a=i[t[r].identifier])&&(gz(e),a(`drag`,e,t[r]))}function v(e){var t=e.changedTouches,n=t.length,r,a;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),r=0;r<n;++r)(a=i[t[r].identifier])&&(hz(e),a(`end`,e,t[r]))}function y(e,t,r,s,c,l){var u=a.copy(),d=fz(l||r,t),p,m,h;if((h=n.call(e,new bz(`beforestart`,{sourceEvent:r,target:f,identifier:c,active:o,x:d[0],y:d[1],dx:0,dy:0,dispatch:u}),s))!=null)return p=h.x-d[0]||0,m=h.y-d[1]||0,function n(r,a,l){var g=d,_;switch(r){case`start`:i[c]=n,_=o++;break;case`end`:delete i[c],--o;case`drag`:d=fz(l||a,t),_=o;break}u.call(r,e,new bz(r,{sourceEvent:a,subject:h,target:f,identifier:c,active:_,x:d[0]+p,y:d[1]+m,dx:d[0]-g[0],dy:d[1]-g[1],dispatch:u}),s)}}return f.filter=function(t){return arguments.length?(e=typeof t==`function`?t:yz(!!t),f):e},f.container=function(e){return arguments.length?(t=typeof e==`function`?e:yz(e),f):t},f.subject=function(e){return arguments.length?(n=typeof e==`function`?e:yz(e),f):n},f.touchable=function(e){return arguments.length?(r=typeof e==`function`?e:yz(!!e),f):r},f.on=function(){var e=a.on.apply(a,arguments);return e===a?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Ez(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Dz(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Oz(){}var kz=.7,Az=1/kz,jz=`\\s*([+-]?\\d+)\\s*`,Mz=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,Nz=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,Pz=/^#([0-9a-f]{3,8})$/,Fz=RegExp(`^rgb\\(${jz},${jz},${jz}\\)$`),Iz=RegExp(`^rgb\\(${Nz},${Nz},${Nz}\\)$`),Lz=RegExp(`^rgba\\(${jz},${jz},${jz},${Mz}\\)$`),Rz=RegExp(`^rgba\\(${Nz},${Nz},${Nz},${Mz}\\)$`),zz=RegExp(`^hsl\\(${Mz},${Nz},${Nz}\\)$`),Bz=RegExp(`^hsla\\(${Mz},${Nz},${Nz},${Mz}\\)$`),Vz={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ez(Oz,Kz,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Hz,formatHex:Hz,formatHex8:Uz,formatHsl:Wz,formatRgb:Gz,toString:Gz});function Hz(){return this.rgb().formatHex()}function Uz(){return this.rgb().formatHex8()}function Wz(){return aB(this).formatHsl()}function Gz(){return this.rgb().formatRgb()}function Kz(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=Pz.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?qz(t):n===3?new Zz(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jz(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jz(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Fz.exec(e))?new Zz(t[1],t[2],t[3],1):(t=Iz.exec(e))?new Zz(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Lz.exec(e))?Jz(t[1],t[2],t[3],t[4]):(t=Rz.exec(e))?Jz(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=zz.exec(e))?iB(t[1],t[2]/100,t[3]/100,1):(t=Bz.exec(e))?iB(t[1],t[2]/100,t[3]/100,t[4]):Vz.hasOwnProperty(e)?qz(Vz[e]):e===`transparent`?new Zz(NaN,NaN,NaN,0):null}function qz(e){return new Zz(e>>16&255,e>>8&255,e&255,1)}function Jz(e,t,n,r){return r<=0&&(e=t=n=NaN),new Zz(e,t,n,r)}function Yz(e){return e instanceof Oz||(e=Kz(e)),e?(e=e.rgb(),new Zz(e.r,e.g,e.b,e.opacity)):new Zz}function Xz(e,t,n,r){return arguments.length===1?Yz(e):new Zz(e,t,n,r??1)}function Zz(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Ez(Zz,Xz,Dz(Oz,{brighter(e){return e=e==null?Az:Az**+e,new Zz(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?kz:kz**+e,new Zz(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zz(nB(this.r),nB(this.g),nB(this.b),tB(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Qz,formatHex:Qz,formatHex8:$z,formatRgb:eB,toString:eB}));function Qz(){return`#${rB(this.r)}${rB(this.g)}${rB(this.b)}`}function $z(){return`#${rB(this.r)}${rB(this.g)}${rB(this.b)}${rB((isNaN(this.opacity)?1:this.opacity)*255)}`}function eB(){let e=tB(this.opacity);return`${e===1?`rgb(`:`rgba(`}${nB(this.r)}, ${nB(this.g)}, ${nB(this.b)}${e===1?`)`:`, ${e})`}`}function tB(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nB(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function rB(e){return e=nB(e),(e<16?`0`:``)+e.toString(16)}function iB(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new sB(e,t,n,r)}function aB(e){if(e instanceof sB)return new sB(e.h,e.s,e.l,e.opacity);if(e instanceof Oz||(e=Kz(e)),!e)return new sB;if(e instanceof sB)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new sB(o,s,c,e.opacity)}function oB(e,t,n,r){return arguments.length===1?aB(e):new sB(e,t,n,r??1)}function sB(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ez(sB,oB,Dz(Oz,{brighter(e){return e=e==null?Az:Az**+e,new sB(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?kz:kz**+e,new sB(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Zz(uB(e>=240?e-240:e+120,i,r),uB(e,i,r),uB(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new sB(cB(this.h),lB(this.s),lB(this.l),tB(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=tB(this.opacity);return`${e===1?`hsl(`:`hsla(`}${cB(this.h)}, ${lB(this.s)*100}%, ${lB(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function cB(e){return e=(e||0)%360,e<0?e+360:e}function lB(e){return Math.max(0,Math.min(1,e||0))}function uB(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var dB=e=>()=>e;function fB(e,t){return function(n){return e+n*t}}function pB(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function mB(e){return(e=+e)==1?hB:function(t,n){return n-t?pB(t,n,e):dB(isNaN(t)?n:t)}}function hB(e,t){var n=t-e;return n?fB(e,n):dB(isNaN(e)?t:e)}var gB=(function e(t){var n=mB(t);function r(e,t){var r=n((e=Xz(e)).r,(t=Xz(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=hB(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function _B(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function vB(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yB(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=OB(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function bB(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function xB(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function SB(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=OB(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var CB=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wB=new RegExp(CB.source,`g`);function TB(e){return function(){return e}}function EB(e){return function(t){return e(t)+``}}function DB(e,t){var n=CB.lastIndex=wB.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=CB.exec(e))&&(i=wB.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:xB(r,i)})),n=wB.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?EB(c[0].x):TB(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function OB(e,t){var n=typeof t,r;return t==null||n===`boolean`?dB(t):(n===`number`?xB:n===`string`?(r=Kz(t))?(t=r,gB):DB:t instanceof Kz?gB:t instanceof Date?bB:vB(t)?_B:Array.isArray(t)?yB:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?SB:xB)(e,t)}var kB=180/Math.PI,AB={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jB(e,t,n,r,i,a){var o,s,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,c/=s),e*r<t*n&&(e=-e,t=-t,c=-c,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*kB,skewX:Math.atan(c)*kB,scaleX:o,scaleY:s}}var MB;function NB(e){let t=new(typeof DOMMatrix==`function`?DOMMatrix:WebKitCSSMatrix)(e+``);return t.isIdentity?AB:jB(t.a,t.b,t.c,t.d,t.e,t.f)}function PB(e){return e==null||(MB||=document.createElementNS(`http://www.w3.org/2000/svg`,`g`),MB.setAttribute(`transform`,e),!(e=MB.transform.baseVal.consolidate()))?AB:(e=e.matrix,jB(e.a,e.b,e.c,e.d,e.e,e.f))}function FB(e,t,n,r){function i(e){return e.length?e.pop()+` `:``}function a(e,r,i,a,o,s){if(e!==i||r!==a){var c=o.push(`translate(`,null,t,null,n);s.push({i:c-4,x:xB(e,i)},{i:c-2,x:xB(r,a)})}else(i||a)&&o.push(`translate(`+i+t+a+n)}function o(e,t,n,a){e===t?t&&n.push(i(n)+`rotate(`+t+r):(e-t>180?t+=360:t-e>180&&(e+=360),a.push({i:n.push(i(n)+`rotate(`,null,r)-2,x:xB(e,t)}))}function s(e,t,n,a){e===t?t&&n.push(i(n)+`skewX(`+t+r):a.push({i:n.push(i(n)+`skewX(`,null,r)-2,x:xB(e,t)})}function c(e,t,n,r,a,o){if(e!==n||t!==r){var s=a.push(i(a)+`scale(`,null,`,`,null,`)`);o.push({i:s-4,x:xB(e,n)},{i:s-2,x:xB(t,r)})}else(n!==1||r!==1)&&a.push(i(a)+`scale(`+n+`,`+r+`)`)}return function(t,n){var r=[],i=[];return t=e(t),n=e(n),a(t.translateX,t.translateY,n.translateX,n.translateY,r,i),o(t.rotate,n.rotate,r,i),s(t.skewX,n.skewX,r,i),c(t.scaleX,t.scaleY,n.scaleX,n.scaleY,r,i),t=n=null,function(e){for(var t=-1,n=i.length,a;++t<n;)r[(a=i[t]).i]=a.x(e);return r.join(``)}}}var IB=FB(NB,`px, `,`px)`,`deg)`),LB=FB(PB,`, `,`)`,`)`),RB=1e-12;function zB(e){return((e=Math.exp(e))+1/e)/2}function BB(e){return((e=Math.exp(e))-1/e)/2}function VB(e){return((e=Math.exp(2*e))-1)/(e+1)}var HB=(function e(t,n,r){function i(e,i){var a=e[0],o=e[1],s=e[2],c=i[0],l=i[1],u=i[2],d=c-a,f=l-o,p=d*d+f*f,m,h;if(p<RB)h=Math.log(u/s)/t,m=function(e){return[a+e*d,o+e*f,s*Math.exp(t*e*h)]};else{var g=Math.sqrt(p),_=(u*u-s*s+r*p)/(2*s*n*g),v=(u*u-s*s-r*p)/(2*u*n*g),y=Math.log(Math.sqrt(_*_+1)-_);h=(Math.log(Math.sqrt(v*v+1)-v)-y)/t,m=function(e){var r=e*h,i=zB(y),c=s/(n*g)*(i*VB(t*r+y)-BB(y));return[a+c*d,o+c*f,s*i/zB(t*r+y)]}}return m.duration=h*1e3*t/Math.SQRT2,m}return i.rho=function(t){var n=Math.max(.001,+t),r=n*n;return e(n,r,r*r)},i})(Math.SQRT2,2,4),UB=0,WB=0,GB=0,KB=1e3,qB,JB,YB=0,XB=0,ZB=0,QB=typeof performance==`object`&&performance.now?performance:Date,$B=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function eV(){return XB||=($B(tV),QB.now()+ZB)}function tV(){XB=0}function nV(){this._call=this._time=this._next=null}nV.prototype=rV.prototype={constructor:nV,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?eV():+n)+(t==null?0:+t),!this._next&&JB!==this&&(JB?JB._next=this:qB=this,JB=this),this._call=e,this._time=n,cV()},stop:function(){this._call&&(this._call=null,this._time=1/0,cV())}};function rV(e,t,n){var r=new nV;return r.restart(e,t,n),r}function iV(){eV(),++UB;for(var e=qB,t;e;)(t=XB-e._time)>=0&&e._call.call(void 0,t),e=e._next;--UB}function aV(){XB=(YB=QB.now())+ZB,UB=WB=0;try{iV()}finally{UB=0,sV(),XB=0}}function oV(){var e=QB.now(),t=e-YB;t>KB&&(ZB-=t,YB=e)}function sV(){for(var e,t=qB,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:qB=n);JB=e,cV(r)}function cV(e){UB||(WB&&=clearTimeout(WB),e-XB>24?(e<1/0&&(WB=setTimeout(aV,e-QB.now()-ZB)),GB&&=clearInterval(GB)):(GB||=(YB=QB.now(),setInterval(oV,KB)),UB=1,$B(aV)))}function lV(e,t,n){var r=new nV;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var uV=sL(`start`,`end`,`cancel`,`interrupt`),dV=[];function fV(e,t,n,r,i,a){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;gV(e,n,{name:t,index:r,group:i,on:uV,tween:dV,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:0})}function pV(e,t){var n=hV(e,t);if(n.state>0)throw Error(`too late; already scheduled`);return n}function mV(e,t){var n=hV(e,t);if(n.state>3)throw Error(`too late; already running`);return n}function hV(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw Error(`transition not found`);return n}function gV(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=rV(a,0,n.time);function a(e){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=e&&o(e-n.delay)}function o(a){var l,u,d,f;if(n.state!==1)return c();for(l in r)if(f=r[l],f.name===n.name){if(f.state===3)return lV(o);f.state===4?(f.state=6,f.timer.stop(),f.on.call(`interrupt`,e,e.__data__,f.index,f.group),delete r[l]):+l<t&&(f.state=6,f.timer.stop(),f.on.call(`cancel`,e,e.__data__,f.index,f.group),delete r[l])}if(lV(function(){n.state===3&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(a))}),n.state=2,n.on.call(`start`,e,e.__data__,n.index,n.group),n.state===2){for(n.state=3,i=Array(d=n.tween.length),l=0,u=-1;l<d;++l)(f=n.tween[l].value.call(e,e.__data__,n.index,n.group))&&(i[++u]=f);i.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(c),n.state=5,1),a=-1,o=i.length;++a<o;)i[a].call(e,r);n.state===5&&(n.on.call(`end`,e,e.__data__,n.index,n.group),c())}function c(){for(var i in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}}function _V(e,t){var n=e.__transition,r,i,a=!0,o;if(n){for(o in t=t==null?null:t+``,n){if((r=n[o]).name!==t){a=!1;continue}i=r.state>2&&r.state<5,r.state=6,r.timer.stop(),r.on.call(i?`interrupt`:`cancel`,e,e.__data__,r.index,r.group),delete n[o]}a&&delete e.__transition}}function vV(e){return this.each(function(){_V(this,e)})}function yV(e,t){var n,r;return function(){var i=mV(this,e),a=i.tween;if(a!==n){r=n=a;for(var o=0,s=r.length;o<s;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function bV(e,t,n){var r,i;if(typeof n!=`function`)throw Error();return function(){var a=mV(this,e),o=a.tween;if(o!==r){i=(r=o).slice();for(var s={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=s;break}c===l&&i.push(s)}a.tween=i}}function xV(e,t){var n=this._id;if(e+=``,arguments.length<2){for(var r=hV(this.node(),n).tween,i=0,a=r.length,o;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?yV:bV)(n,e,t))}function SV(e,t,n){var r=e._id;return e.each(function(){var e=mV(this,r);(e.value||={})[t]=n.apply(this,arguments)}),function(e){return hV(e,r).value[t]}}function CV(e,t){var n;return(typeof t==`number`?xB:t instanceof Kz?gB:(n=Kz(t))?(t=n,gB):DB)(e,t)}function wV(e){return function(){this.removeAttribute(e)}}function TV(e){return function(){this.removeAttributeNS(e.space,e.local)}}function EV(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttribute(e);return o===i?null:o===r?a:a=t(r=o,n)}}function DV(e,t,n){var r,i=n+``,a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?a:a=t(r=o,n)}}function OV(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function kV(e,t,n){var r,i,a;return function(){var o,s=n(this),c;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=s+``,o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s)))}}function AV(e,t){var n=pL(e),r=n===`transform`?LB:CV;return this.attrTween(e,typeof t==`function`?(n.local?kV:OV)(n,r,SV(this,`attr.`+e,t)):t==null?(n.local?TV:wV)(n):(n.local?DV:EV)(n,r,t))}function jV(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function MV(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function NV(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&MV(e,i)),n}return i._value=t,i}function PV(e,t){var n,r;function i(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&jV(e,i)),n}return i._value=t,i}function FV(e,t){var n=`attr.`+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!=`function`)throw Error();var r=pL(e);return this.tween(n,(r.local?NV:PV)(r,t))}function IV(e,t){return function(){pV(this,e).delay=+t.apply(this,arguments)}}function LV(e,t){return t=+t,function(){pV(this,e).delay=t}}function RV(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?IV:LV)(t,e)):hV(this.node(),t).delay}function zV(e,t){return function(){mV(this,e).duration=+t.apply(this,arguments)}}function BV(e,t){return t=+t,function(){mV(this,e).duration=t}}function VV(e){var t=this._id;return arguments.length?this.each((typeof e==`function`?zV:BV)(t,e)):hV(this.node(),t).duration}function HV(e,t){if(typeof t!=`function`)throw Error();return function(){mV(this,e).ease=t}}function UV(e){var t=this._id;return arguments.length?this.each(HV(t,e)):hV(this.node(),t).ease}function WV(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!=`function`)throw Error();mV(this,e).ease=n}}function GV(e){if(typeof e!=`function`)throw Error();return this.each(WV(this._id,e))}function KV(e){typeof e!=`function`&&(e=TL(e));for(var t=this._groups,n=t.length,r=Array(n),i=0;i<n;++i)for(var a=t[i],o=a.length,s=r[i]=[],c,l=0;l<o;++l)(c=a[l])&&e.call(c,c.__data__,l,a)&&s.push(c);return new xH(r,this._parents,this._name,this._id)}function qV(e){if(e._id!==this._id)throw Error();for(var t=this._groups,n=e._groups,r=t.length,i=n.length,a=Math.min(r,i),o=Array(r),s=0;s<a;++s)for(var c=t[s],l=n[s],u=c.length,d=o[s]=Array(u),f,p=0;p<u;++p)(f=c[p]||l[p])&&(d[p]=f);for(;s<r;++s)o[s]=t[s];return new xH(o,this._parents,this._name,this._id)}function JV(e){return(e+``).trim().split(/^|\s+/).every(function(e){var t=e.indexOf(`.`);return t>=0&&(e=e.slice(0,t)),!e||e===`start`})}function YV(e,t,n){var r,i,a=JV(t)?pV:mV;return function(){var o=a(this,e),s=o.on;s!==r&&(i=(r=s).copy()).on(t,n),o.on=i}}function XV(e,t){var n=this._id;return arguments.length<2?hV(this.node(),n).on.on(e):this.each(YV(n,e,t))}function ZV(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function QV(){return this.on(`end.remove`,ZV(this._id))}function $V(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=vL(e));for(var r=this._groups,i=r.length,a=Array(i),o=0;o<i;++o)for(var s=r[o],c=s.length,l=a[o]=Array(c),u,d,f=0;f<c;++f)(u=s[f])&&(d=e.call(u,u.__data__,f,s))&&(`__data__`in u&&(d.__data__=u.__data__),l[f]=d,fV(l[f],t,n,f,l,hV(u,n)));return new xH(a,this._parents,t,n)}function eH(e){var t=this._name,n=this._id;typeof e!=`function`&&(e=SL(e));for(var r=this._groups,i=r.length,a=[],o=[],s=0;s<i;++s)for(var c=r[s],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),p,m=hV(u,n),h=0,g=f.length;h<g;++h)(p=f[h])&&fV(p,t,n,h,f,m);a.push(f),o.push(u)}return new xH(a,o,t,n)}var tH=cz.prototype.constructor;function nH(){return new tH(this._groups,this._parents)}function rH(e,t){var n,r,i;return function(){var a=hR(this,e),o=(this.style.removeProperty(e),hR(this,e));return a===o?null:a===n&&o===r?i:i=t(n=a,r=o)}}function iH(e){return function(){this.style.removeProperty(e)}}function aH(e,t,n){var r,i=n+``,a;return function(){var o=hR(this,e);return o===i?null:o===r?a:a=t(r=o,n)}}function oH(e,t,n){var r,i,a;return function(){var o=hR(this,e),s=n(this),c=s+``;return s??(c=s=(this.style.removeProperty(e),hR(this,e))),o===c?null:o===r&&c===i?a:(i=c,a=t(r=o,s))}}function sH(e,t){var n,r,i,a=`style.`+t,o=`end.`+a,s;return function(){var c=mV(this,e),l=c.on,u=c.value[a]==null?s||=iH(t):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(o,i=u),c.on=r}}function cH(e,t,n){var r=(e+=``)==`transform`?IB:CV;return t==null?this.styleTween(e,rH(e,r)).on(`end.style.`+e,iH(e)):typeof t==`function`?this.styleTween(e,oH(e,r,SV(this,`style.`+e,t))).each(sH(this._id,e)):this.styleTween(e,aH(e,r,t),n).on(`end.style.`+e,null)}function lH(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function uH(e,t,n){var r,i;function a(){var a=t.apply(this,arguments);return a!==i&&(r=(i=a)&&lH(e,a,n)),r}return a._value=t,a}function dH(e,t,n){var r=`style.`+(e+=``);if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!=`function`)throw Error();return this.tween(r,uH(e,t,n??``))}function fH(e){return function(){this.textContent=e}}function pH(e){return function(){var t=e(this);this.textContent=t??``}}function mH(e){return this.tween(`text`,typeof e==`function`?pH(SV(this,`text`,e)):fH(e==null?``:e+``))}function hH(e){return function(t){this.textContent=e.call(this,t)}}function gH(e){var t,n;function r(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&hH(r)),t}return r._value=e,r}function _H(e){var t=`text`;if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!=`function`)throw Error();return this.tween(t,gH(e))}function vH(){for(var e=this._name,t=this._id,n=CH(),r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)if(c=o[l]){var u=hV(c,t);fV(c,e,n,l,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new xH(r,this._parents,e,n)}function yH(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(a,o){var s={value:o},c={value:function(){--i===0&&a()}};n.each(function(){var n=mV(this,r),i=n.on;i!==e&&(t=(e=i).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(c)),n.on=t}),i===0&&a()})}var bH=0;function xH(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function SH(e){return cz().transition(e)}function CH(){return++bH}var wH=cz.prototype;xH.prototype=SH.prototype={constructor:xH,select:$V,selectAll:eH,selectChild:wH.selectChild,selectChildren:wH.selectChildren,filter:KV,merge:qV,selection:nH,transition:vH,call:wH.call,nodes:wH.nodes,node:wH.node,size:wH.size,empty:wH.empty,each:wH.each,on:XV,attr:AV,attrTween:FV,style:cH,styleTween:dH,text:mH,textTween:_H,remove:QV,tween:xV,delay:RV,duration:VV,ease:UV,easeVarying:GV,end:yH,[Symbol.iterator]:wH[Symbol.iterator]};function TH(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var EH={time:null,delay:0,duration:250,ease:TH};function DH(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw Error(`transition ${t} not found`);return n}function OH(e){var t,n;e instanceof xH?(t=e._id,e=e._name):(t=CH(),(n=EH).time=eV(),e=e==null?null:e+``);for(var r=this._groups,i=r.length,a=0;a<i;++a)for(var o=r[a],s=o.length,c,l=0;l<s;++l)(c=o[l])&&fV(c,e,t,l,o,n||DH(c,t));return new xH(r,this._parents,e,t)}cz.prototype.interrupt=vV,cz.prototype.transition=OH;var kH=e=>()=>e;function AH(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function jH(e,t,n){this.k=e,this.x=t,this.y=n}jH.prototype={constructor:jH,scale:function(e){return e===1?this:new jH(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new jH(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return`translate(`+this.x+`,`+this.y+`) scale(`+this.k+`)`}};var MH=new jH(1,0,0);NH.prototype=jH.prototype;function NH(e){for(;!e.__zoom;)if(!(e=e.parentNode))return MH;return e.__zoom}function PH(e){e.stopImmediatePropagation()}function FH(e){e.preventDefault(),e.stopImmediatePropagation()}function IH(e){return(!e.ctrlKey||e.type===`wheel`)&&!e.button}function LH(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute(`viewBox`)?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function RH(){return this.__zoom||MH}function zH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function BH(){return navigator.maxTouchPoints||`ontouchstart`in this}function VH(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function HH(){var e=IH,t=LH,n=VH,r=zH,i=BH,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,c=HB,l=sL(`start`,`zoom`,`end`),u,d,f,p=500,m=150,h=0,g=10;function _(e){e.property(`__zoom`,RH).on(`wheel.zoom`,w,{passive:!1}).on(`mousedown.zoom`,T).on(`dblclick.zoom`,E).filter(i).on(`touchstart.zoom`,D).on(`touchmove.zoom`,O).on(`touchend.zoom touchcancel.zoom`,k).style(`-webkit-tap-highlight-color`,`rgba(0,0,0,0)`)}_.transform=function(e,t,n,r){var i=e.selection?e.selection():e;i.property(`__zoom`,RH),e===i?i.interrupt().each(function(){S(this,arguments).event(r).start().zoom(null,typeof t==`function`?t.apply(this,arguments):t).end()}):x(e,t,n,r)},_.scaleBy=function(e,t,n,r){_.scaleTo(e,function(){return this.__zoom.k*(typeof t==`function`?t.apply(this,arguments):t)},n,r)},_.scaleTo=function(e,r,i,a){_.transform(e,function(){var e=t.apply(this,arguments),a=this.__zoom,s=i==null?b(e):typeof i==`function`?i.apply(this,arguments):i,c=a.invert(s),l=typeof r==`function`?r.apply(this,arguments):r;return n(y(v(a,l),s,c),e,o)},i,a)},_.translateBy=function(e,r,i,a){_.transform(e,function(){return n(this.__zoom.translate(typeof r==`function`?r.apply(this,arguments):r,typeof i==`function`?i.apply(this,arguments):i),t.apply(this,arguments),o)},null,a)},_.translateTo=function(e,r,i,a,s){_.transform(e,function(){var e=t.apply(this,arguments),s=this.__zoom,c=a==null?b(e):typeof a==`function`?a.apply(this,arguments):a;return n(MH.translate(c[0],c[1]).scale(s.k).translate(typeof r==`function`?-r.apply(this,arguments):-r,typeof i==`function`?-i.apply(this,arguments):-i),e,o)},a,s)};function v(e,t){return t=Math.max(a[0],Math.min(a[1],t)),t===e.k?e:new jH(t,e.x,e.y)}function y(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new jH(e.k,r,i)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(e,n,r,i){e.on(`start.zoom`,function(){S(this,arguments).event(i).start()}).on(`interrupt.zoom end.zoom`,function(){S(this,arguments).event(i).end()}).tween(`zoom`,function(){var e=this,a=arguments,o=S(e,a).event(i),s=t.apply(e,a),l=r==null?b(s):typeof r==`function`?r.apply(e,a):r,u=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),d=e.__zoom,f=typeof n==`function`?n.apply(e,a):n,p=c(d.invert(l).concat(u/d.k),f.invert(l).concat(u/f.k));return function(e){if(e===1)e=f;else{var t=p(e),n=u/t[2];e=new jH(n,l[0]-t[0]*n,l[1]-t[1]*n)}o.zoom(null,e)}})}function S(e,t,n){return!n&&e.__zooming||new C(e,t)}function C(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=t.apply(e,n),this.taps=0}C.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit(`start`)),this},zoom:function(e,t){return this.mouse&&e!==`mouse`&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&e!==`touch`&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&e!==`touch`&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit(`zoom`),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit(`end`)),this},emit:function(e){var t=uz(this.that).datum();l.call(e,this.that,new AH(e,{sourceEvent:this.sourceEvent,target:_,type:e,transform:this.that.__zoom,dispatch:l}),t)}};function w(t,...i){if(!e.apply(this,arguments))return;var s=S(this,i).event(t),c=this.__zoom,l=Math.max(a[0],Math.min(a[1],c.k*2**r.apply(this,arguments))),u=fz(t);if(s.wheel)(s.mouse[0][0]!==u[0]||s.mouse[0][1]!==u[1])&&(s.mouse[1]=c.invert(s.mouse[0]=u)),clearTimeout(s.wheel);else if(c.k===l)return;else s.mouse=[u,c.invert(u)],_V(this),s.start();FH(t),s.wheel=setTimeout(d,m),s.zoom(`mouse`,n(y(v(c,l),s.mouse[0],s.mouse[1]),s.extent,o));function d(){s.wheel=null,s.end()}}function T(t,...r){if(f||!e.apply(this,arguments))return;var i=t.currentTarget,a=S(this,r,!0).event(t),s=uz(t.view).on(`mousemove.zoom`,d,!0).on(`mouseup.zoom`,p,!0),c=fz(t,i),l=t.clientX,u=t.clientY;_z(t.view),PH(t),a.mouse=[c,this.__zoom.invert(c)],_V(this),a.start();function d(e){if(FH(e),!a.moved){var t=e.clientX-l,r=e.clientY-u;a.moved=t*t+r*r>h}a.event(e).zoom(`mouse`,n(y(a.that.__zoom,a.mouse[0]=fz(e,i),a.mouse[1]),a.extent,o))}function p(e){s.on(`mousemove.zoom mouseup.zoom`,null),vz(e.view,a.moved),FH(e),a.event(e).end()}}function E(r,...i){if(e.apply(this,arguments)){var a=this.__zoom,c=fz(r.changedTouches?r.changedTouches[0]:r,this),l=a.invert(c),u=a.k*(r.shiftKey?.5:2),d=n(y(v(a,u),c,l),t.apply(this,i),o);FH(r),s>0?uz(this).transition().duration(s).call(x,d,c,r):uz(this).call(_.transform,d,c,r)}}function D(t,...n){if(e.apply(this,arguments)){var r=t.touches,i=r.length,a=S(this,n,t.changedTouches.length===i).event(t),o,s,c,l;for(PH(t),s=0;s<i;++s)c=r[s],l=fz(c,this),l=[l,this.__zoom.invert(l),c.identifier],a.touch0?!a.touch1&&a.touch0[2]!==l[2]&&(a.touch1=l,a.taps=0):(a.touch0=l,o=!0,a.taps=1+!!u);u&&=clearTimeout(u),o&&(a.taps<2&&(d=l[0],u=setTimeout(function(){u=null},p)),_V(this),a.start())}}function O(e,...t){if(this.__zooming){var r=S(this,t).event(e),i=e.changedTouches,a=i.length,s,c,l,u;for(FH(e),s=0;s<a;++s)c=i[s],l=fz(c,this),r.touch0&&r.touch0[2]===c.identifier?r.touch0[0]=l:r.touch1&&r.touch1[2]===c.identifier&&(r.touch1[0]=l);if(c=r.that.__zoom,r.touch1){var d=r.touch0[0],f=r.touch0[1],p=r.touch1[0],m=r.touch1[1],h=(h=p[0]-d[0])*h+(h=p[1]-d[1])*h,g=(g=m[0]-f[0])*g+(g=m[1]-f[1])*g;c=v(c,Math.sqrt(h/g)),l=[(d[0]+p[0])/2,(d[1]+p[1])/2],u=[(f[0]+m[0])/2,(f[1]+m[1])/2]}else if(r.touch0)l=r.touch0[0],u=r.touch0[1];else return;r.zoom(`touch`,n(y(c,l,u),r.extent,o))}}function k(e,...t){if(this.__zooming){var n=S(this,t).event(e),r=e.changedTouches,i=r.length,a,o;for(PH(e),f&&clearTimeout(f),f=setTimeout(function(){f=null},p),a=0;a<i;++a)o=r[a],n.touch0&&n.touch0[2]===o.identifier?delete n.touch0:n.touch1&&n.touch1[2]===o.identifier&&delete n.touch1;if(n.touch1&&!n.touch0&&(n.touch0=n.touch1,delete n.touch1),n.touch0)n.touch0[1]=this.__zoom.invert(n.touch0[0]);else if(n.end(),n.taps===2&&(o=fz(o,this),Math.hypot(d[0]-o[0],d[1]-o[1])<g)){var s=uz(this).on(`dblclick.zoom`);s&&s.apply(this,arguments)}}}return _.wheelDelta=function(e){return arguments.length?(r=typeof e==`function`?e:kH(+e),_):r},_.filter=function(t){return arguments.length?(e=typeof t==`function`?t:kH(!!t),_):e},_.touchable=function(e){return arguments.length?(i=typeof e==`function`?e:kH(!!e),_):i},_.extent=function(e){return arguments.length?(t=typeof e==`function`?e:kH([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),_):t},_.scaleExtent=function(e){return arguments.length?(a[0]=+e[0],a[1]=+e[1],_):[a[0],a[1]]},_.translateExtent=function(e){return arguments.length?(o[0][0]=+e[0][0],o[1][0]=+e[1][0],o[0][1]=+e[0][1],o[1][1]=+e[1][1],_):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},_.constrain=function(e){return arguments.length?(n=e,_):n},_.duration=function(e){return arguments.length?(s=+e,_):s},_.interpolate=function(e){return arguments.length?(c=e,_):c},_.on=function(){var e=l.on.apply(l,arguments);return e===l?_:e},_.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,_):Math.sqrt(h)},_.tapDistance=function(e){return arguments.length?(g=+e,_):g},_}var UH={error001:(e=`react`)=>`Seems like you have not used ${e===`svelte`?`SvelteFlowProvider`:`ReactFlowProvider`} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>`It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.`,error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>`The parent container needs a width and a height to render the graph.`,error005:()=>`Only child nodes can use a parent extent.`,error006:()=>`Can't create edge. An edge needs a source and a target.`,error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e===`source`?n:r}", edge id: ${t}.`,error010:()=>`Handle: No node id found. Make sure to only use a Handle inside a custom Node.`,error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e=`react`)=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>`useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.`,error015:()=>`It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.`,error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},WH=[[-1/0,-1/0],[1/0,1/0]],GH=[`Enter`,` `,`Escape`],KH={"node.a11yDescription.default":`Press enter or space to select a node. Press delete to remove it and escape to cancel.`,"node.a11yDescription.keyboardDisabled":`Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.`,"node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":`Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.`,"controls.ariaLabel":`Control Panel`,"controls.zoomIn.ariaLabel":`Zoom In`,"controls.zoomOut.ariaLabel":`Zoom Out`,"controls.fitView.ariaLabel":`Fit View`,"controls.interactive.ariaLabel":`Toggle Interactivity`,"minimap.ariaLabel":`Mini Map`,"handle.ariaLabel":`Handle`},qH;(function(e){e.Strict=`strict`,e.Loose=`loose`})(qH||={});var JH;(function(e){e.Free=`free`,e.Vertical=`vertical`,e.Horizontal=`horizontal`})(JH||={});var YH;(function(e){e.Partial=`partial`,e.Full=`full`})(YH||={});var XH={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},ZH;(function(e){e.Bezier=`default`,e.Straight=`straight`,e.Step=`step`,e.SmoothStep=`smoothstep`,e.SimpleBezier=`simplebezier`})(ZH||={});var QH;(function(e){e.Arrow=`arrow`,e.ArrowClosed=`arrowclosed`})(QH||={});var $;(function(e){e.Left=`left`,e.Top=`top`,e.Right=`right`,e.Bottom=`bottom`})($||={});var $H={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function eU(e){return e===null?null:e?`valid`:`invalid`}var tU=e=>!!e&&typeof e==`object`&&`id`in e&&`source`in e&&`target`in e,nU=e=>!!e&&typeof e==`object`&&`id`in e&&`position`in e&&!(`source`in e)&&!(`target`in e),rU=e=>!!e&&typeof e==`object`&&`id`in e&&`internals`in e&&!(`source`in e)&&!(`target`in e),iU=(e,t=[0,0])=>{let{width:n,height:r}=RU(e),i=e.origin??t,a=n*i[0],o=r*i[1];return{x:e.position.x-a,y:e.position.y-o}},aU=(e,t={nodeOrigin:[0,0]})=>e.length===0?{x:0,y:0,width:0,height:0}:bU(e.reduce((e,n)=>{let r=typeof n==`string`,i=!t.nodeLookup&&!r?n:void 0;return t.nodeLookup&&(i=r?t.nodeLookup.get(n):rU(n)?n:t.nodeLookup.get(n.id)),vU(e,i?SU(i,t.nodeOrigin):{x:0,y:0,x2:0,y2:0})},{x:1/0,y:1/0,x2:-1/0,y2:-1/0})),oU=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(e=>{(t.filter===void 0||t.filter(e))&&(n=vU(n,SU(e)),r=!0)}),r?bU(n):{x:0,y:0,width:0,height:0}},sU=(e,t,[n,r,i]=[0,0,1],a=!1,o=!1)=>{let s=(t.x-n)/i,c=(t.y-r)/i,l=t.width/i,u=t.height/i,d=[];for(let t of e.values()){let{measured:e,selectable:n=!0,hidden:r=!1}=t;if(o&&!n||r)continue;let i=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:p,y:m}=t.internals.positionAbsolute,h=wU(s,c,l,u,p,m,i,f),g=i*f,_=a&&h>0;(!t.internals.handleBounds||_||h>=g||t.dragging)&&d.push(t)}return d},cU=(e,t)=>{let n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))};function lU(e,t){let n=new Map,r=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let i;if(t?.includeHiddenNodes){let{width:t,height:n}=RU(e);i=t>0&&n>0}else i=!!(e.measured.width&&e.measured.height&&!e.hidden);i&&(!r||r.has(e.id))&&n.set(e.id,e)}),n}async function uU({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:a},o){if(e.size===0)return!0;let s=FU(oU(lU(e,o)),t,n,o?.minZoom??i,o?.maxZoom??a,o?.padding??.1);return await r.setViewport(s,{duration:o?.duration,ease:o?.ease,interpolate:o?.interpolate}),!0}function dU({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){let o=n.get(e),s=o.parentId?n.get(o.parentId):void 0,{x:c,y:l}=s?s.internals.positionAbsolute:{x:0,y:0},u=o.origin??r,d=o.extent||i;if(o.extent===`parent`&&!o.expandParent)if(!s)a?.(`005`,UH.error005());else{let e=s.measured.width,t=s.measured.height;e&&t&&(d=[[c,l],[c+e,l+t]])}else s&&LU(o.extent)&&(d=[[o.extent[0][0]+c,o.extent[0][1]+l],[o.extent[1][0]+c,o.extent[1][1]+l]]);let f=LU(d)?mU(t,d,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&a?.(`015`,UH.error015()),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-l+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function fU({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){let a=new Set(e.map(e=>e.id)),o=[];for(let e of n){if(e.deletable===!1)continue;let t=a.has(e.id),n=!t&&e.parentId&&o.find(t=>t.id===e.parentId);(t||n)&&o.push(e)}let s=new Set(t.map(e=>e.id)),c=r.filter(e=>e.deletable!==!1),l=cU(o,c);for(let e of c)s.has(e.id)&&!l.find(t=>t.id===e.id)&&l.push(e);if(!i)return{edges:l,nodes:o};let u=await i({nodes:o,edges:l});return typeof u==`boolean`?u?{edges:l,nodes:o}:{edges:[],nodes:[]}:u}var pU=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),mU=(e={x:0,y:0},t,n)=>({x:pU(e.x,t[0][0],t[1][0]-(n?.width??0)),y:pU(e.y,t[0][1],t[1][1]-(n?.height??0))});function hU(e,t,n){let{width:r,height:i}=RU(n),{x:a,y:o}=n.internals.positionAbsolute;return mU(e,[[a,o],[a+r,o+i]],t)}var gU=(e,t,n)=>e<t?pU(Math.abs(e-t),1,t)/t:e>n?-pU(Math.abs(e-n),1,t)/t:0,_U=(e,t,n=15,r=40)=>[gU(e.x,r,t.width-r)*n,gU(e.y,r,t.height-r)*n],vU=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),yU=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),bU=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),xU=(e,t=[0,0])=>{let{x:n,y:r}=rU(e)?e.internals.positionAbsolute:iU(e,t);return{x:n,y:r,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},SU=(e,t=[0,0])=>{let{x:n,y:r}=rU(e)?e.internals.positionAbsolute:iU(e,t);return{x:n,y:r,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:r+(e.measured?.height??e.height??e.initialHeight??0)}},CU=(e,t)=>bU(vU(yU(e),yU(t))),wU=(e,t,n,r,i,a,o,s)=>{let c=Math.max(0,Math.min(e+n,i+o)-Math.max(e,i)),l=Math.max(0,Math.min(t+r,a+s)-Math.max(t,a));return Math.ceil(c*l)},TU=(e,t)=>wU(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),EU=e=>DU(e.width)&&DU(e.height)&&DU(e.x)&&DU(e.y),DU=e=>!isNaN(e)&&isFinite(e),OU=(e,t)=>(e,t)=>{},kU=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),AU=({x:e,y:t},[n,r,i],a=!1,o=[1,1])=>{let s={x:(e-n)/i,y:(t-r)/i};return a?kU(s,o):s},jU=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function MU(e,t){if(typeof e==`number`)return Math.floor((t-t/(1+e))*.5);if(typeof e==`string`&&e.endsWith(`px`)){let t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if(typeof e==`string`&&e.endsWith(`%`)){let n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function NU(e,t,n){if(typeof e==`string`||typeof e==`number`){let r=MU(e,n),i=MU(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e==`object`){let r=MU(e.top??e.y??0,n),i=MU(e.bottom??e.y??0,n),a=MU(e.left??e.x??0,t),o=MU(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:a,x:a+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function PU(e,t,n,r,i,a){let{x:o,y:s}=jU(e,[t,n,r]),{x:c,y:l}=jU({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,d=a-l;return{left:Math.floor(o),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}var FU=(e,t,n,r,i,a)=>{let o=NU(a,t,n),s=(t-o.x)/e.width,c=(n-o.y)/e.height,l=pU(Math.min(s,c),r,i),u=e.x+e.width/2,d=e.y+e.height/2,f=t/2-u*l,p=n/2-d*l,m=PU(e,f,p,l,t,n),h={left:Math.min(m.left-o.left,0),top:Math.min(m.top-o.top,0),right:Math.min(m.right-o.right,0),bottom:Math.min(m.bottom-o.bottom,0)};return{x:f-h.left+h.right,y:p-h.top+h.bottom,zoom:l}},IU=()=>typeof navigator<`u`&&navigator?.userAgent?.indexOf(`Mac`)>=0;function LU(e){return e!=null&&e!==`parent`}function RU(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function zU(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function BU(e,t={width:0,height:0},n,r,i){let a={...e},o=r.get(n);if(o){let e=o.origin||i;a.x+=o.internals.positionAbsolute.x-(t.width??0)*e[0],a.y+=o.internals.positionAbsolute.y-(t.height??0)*e[1]}return a}function VU(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function HU(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function UU(e){return{...KH,...e||{}}}function WU(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){let{x:a,y:o}=XU(e),s=AU({x:a-(i?.left??0),y:o-(i?.top??0)},r),{x:c,y:l}=n?kU(s,t):s;return{xSnapped:c,ySnapped:l,...s}}var GU=e=>({width:e.offsetWidth,height:e.offsetHeight}),KU=e=>e?.getRootNode?.()||window?.document,qU=[`INPUT`,`SELECT`,`TEXTAREA`];function JU(e){let t=e.composedPath?.()?.[0]||e.target;return t?.nodeType===1?qU.includes(t.nodeName)||t.hasAttribute(`contenteditable`)||!!t.closest(`.nokey`):!1}var YU=e=>`clientX`in e,XU=(e,t)=>{let n=YU(e),r=n?e.clientX:e.touches?.[0].clientX,i=n?e.clientY:e.touches?.[0].clientY;return{x:r-(t?.left??0),y:i-(t?.top??0)}},ZU=(e,t,n,r,i)=>{let a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(t=>{let a=t.getBoundingClientRect();return{id:t.getAttribute(`data-handleid`),type:e,nodeId:i,position:t.getAttribute(`data-handlepos`),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...GU(t)}})};function QU({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){let c=e*.125+i*.375+o*.375+n*.125,l=t*.125+a*.375+s*.375+r*.125;return[c,l,Math.abs(c-e),Math.abs(l-t)]}function $U(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function eW({pos:e,x1:t,y1:n,x2:r,y2:i,c:a}){switch(e){case $.Left:return[t-$U(t-r,a),n];case $.Right:return[t+$U(r-t,a),n];case $.Top:return[t,n-$U(n-i,a)];case $.Bottom:return[t,n+$U(i-n,a)]}}function tW({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,curvature:o=.25}){let[s,c]=eW({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[l,u]=eW({pos:a,x1:r,y1:i,x2:e,y2:t,c:o}),[d,f,p,m]=QU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${s},${c} ${l},${u} ${r},${i}`,d,f,p,m]}function nW({sourceX:e,sourceY:t,targetX:n,targetY:r}){let i=Math.abs(n-e)/2,a=n<e?n+i:n-i,o=Math.abs(r-t)/2;return[a,r<t?r+o:r-o,i,o]}function rW({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:a=`basic`}){return a===`manual`?r:(i&&n?r+1e3:r)+Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0)}function iW({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){let a=vU(SU(e),SU(t));return a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1),TU({x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]},bU(a))>0}var aW=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||``}-${n}${r||``}`,oW=(e,t)=>t.some(t=>t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle)),sW=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.(`006`,UH.error006()),t;let r=n.getEdgeId||aW,i;return i=tU(e)?{...e}:{...e,id:r(e)},oW(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function cW({sourceX:e,sourceY:t,targetX:n,targetY:r}){let[i,a,o,s]=nW({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,a,o,s]}var lW={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},uW=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},dW=(e,t)=>Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2);function fW({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:r=$.Top,center:i,offset:a,stepPosition:o}){let s=lW[t],c=lW[r],l={x:e.x+s.x*a,y:e.y+s.y*a},u={x:n.x+c.x*a,y:n.y+c.y*a},d=uW({source:l,sourcePosition:t,target:u}),f=d.x===0?`y`:`x`,p=d[f],m=[],h,g,_={x:0,y:0},v={x:0,y:0},[,,y,b]=nW({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*c[f]===-1){f===`x`?(h=i.x??l.x+(u.x-l.x)*o,g=i.y??(l.y+u.y)/2):(h=i.x??(l.x+u.x)/2,g=i.y??l.y+(u.y-l.y)*o);let e=[{x:h,y:l.y},{x:h,y:u.y}],t=[{x:l.x,y:g},{x:u.x,y:g}];m=s[f]===p?f===`x`?e:t:f===`x`?t:e}else{let i=[{x:l.x,y:u.y}],o=[{x:u.x,y:l.y}];if(m=f===`x`?s.x===p?o:i:s.y===p?i:o,t===r){let t=Math.abs(e[f]-n[f]);if(t<=a){let r=Math.min(a-1,a-t);s[f]===p?_[f]=(l[f]>e[f]?-1:1)*r:v[f]=(u[f]>n[f]?-1:1)*r}}if(t!==r){let e=f===`x`?`y`:`x`,t=s[f]===c[e],n=l[e]>u[e],r=l[e]<u[e];(s[f]===1&&(!t&&n||t&&r)||s[f]!==1&&(!t&&r||t&&n))&&(m=f===`x`?i:o)}let d={x:l.x+_.x,y:l.y+_.y},y={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(y.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(y.y-m[0].y))?(h=(d.x+y.x)/2,g=m[0].y):(h=m[0].x,g=(d.y+y.y)/2)}let x={x:l.x+_.x,y:l.y+_.y},S={x:u.x+v.x,y:u.y+v.y};return[[e,...x.x!==m[0].x||x.y!==m[0].y?[x]:[],...m,...S.x!==m[m.length-1].x||S.y!==m[m.length-1].y?[S]:[],n],h,g,y,b]}function pW(e,t,n,r){let i=Math.min(dW(e,t)/2,dW(t,n)/2,r),{x:a,y:o}=t;if(e.x===a&&a===n.x||e.y===o&&o===n.y)return`L${a} ${o}`;if(e.y===o){let t=e.x<n.x?-1:1,r=e.y<n.y?1:-1;return`L ${a+i*t},${o}Q ${a},${o} ${a},${o+i*r}`}let s=e.x<n.x?1:-1;return`L ${a},${o+i*(e.y<n.y?-1:1)}Q ${a},${o} ${a+i*s},${o}`}function mW({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top,borderRadius:o=5,centerX:s,centerY:c,offset:l=20,stepPosition:u=.5}){let[d,f,p,m,h]=fW({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:a,center:{x:s,y:c},offset:l,stepPosition:u}),g=`M${d[0].x} ${d[0].y}`;for(let e=1;e<d.length-1;e++)g+=pW(d[e-1],d[e],d[e+1],o);return g+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[g,f,p,m,h]}function hW(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function gW(e){let{sourceNode:t,targetNode:n}=e;if(!hW(t)||!hW(n))return null;let r=t.internals.handleBounds||_W(t.handles),i=n.internals.handleBounds||_W(n.handles),a=yW(r?.source??[],e.sourceHandle),o=yW(e.connectionMode===qH.Strict?i?.target??[]:(i?.target??[]).concat(i?.source??[]),e.targetHandle);if(!a||!o)return e.onError?.(`008`,UH.error008(a?`target`:`source`,{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;let s=a?.position||$.Bottom,c=o?.position||$.Top,l=vW(t,a,s),u=vW(n,o,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:c}}function _W(e){if(!e)return null;let t=[],n=[];for(let r of e)r.width=r.width??1,r.height=r.height??1,r.type===`source`?t.push(r):r.type===`target`&&n.push(r);return{source:t,target:n}}function vW(e,t,n=$.Left,r=!1){let i=(t?.x??0)+e.internals.positionAbsolute.x,a=(t?.y??0)+e.internals.positionAbsolute.y,{width:o,height:s}=t??RU(e);if(r)return{x:i+o/2,y:a+s/2};switch(t?.position??n){case $.Top:return{x:i+o/2,y:a};case $.Right:return{x:i+o,y:a+s/2};case $.Bottom:return{x:i+o/2,y:a+s};case $.Left:return{x:i,y:a+s/2}}}function yW(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function bW(e,t){return e?typeof e==`string`?e:`${t?`${t}__`:``}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join(`&`)}`:``}function xW(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){let a=new Set;return e.reduce((e,o)=>([o.markerStart||r,o.markerEnd||i].forEach(r=>{if(r&&typeof r==`object`){let i=bW(r,t);a.has(i)||(e.push({id:i,color:r.color||n,...r}),a.add(i))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}var SW=1e3,CW=10,wW={nodeOrigin:[0,0],nodeExtent:WH,elevateNodesOnSelect:!0,zIndexMode:`basic`,defaults:{}},TW={...wW,checkEquality:!0};function EW(e,t){let n={...e};for(let e in t)t[e]!==void 0&&(n[e]=t[e]);return n}function DW(e,t,n){let r=EW(wW,n);for(let n of e.values())if(n.parentId)MW(n,e,t,r);else{let e=mU(iU(n,r.nodeOrigin),LU(n.extent)?n.extent:r.nodeExtent,RU(n));n.internals.positionAbsolute=e}}function OW(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;let n=[],r=[];for(let t of e.handles){let i={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};t.type===`source`?n.push(i):t.type===`target`&&r.push(i)}return{source:n,target:r}}function kW(e){return e===`manual`}function AW(e,t,n,r={}){let i=EW(TW,r),a={i:0},o=new Map(t),s=i?.elevateNodesOnSelect&&!kW(i.zIndexMode)?SW:0,c=e.length>0,l=!1;t.clear(),n.clear();for(let u of e){let e=o.get(u.id);if(i.checkEquality&&u===e?.internals.userNode)t.set(u.id,e);else{let n=mU(iU(u,i.nodeOrigin),LU(u.extent)?u.extent:i.nodeExtent,RU(u));e={...i.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:n,handleBounds:OW(u,e),z:NW(u,s,i.zIndexMode),userNode:u}},t.set(u.id,e)}(e.measured===void 0||e.measured.width===void 0||e.measured.height===void 0)&&!e.hidden&&(c=!1),u.parentId&&MW(e,t,n,r,a),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function jW(e,t){if(!e.parentId)return;let n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function MW(e,t,n,r,i){let{elevateNodesOnSelect:a,nodeOrigin:o,nodeExtent:s,zIndexMode:c}=EW(wW,r),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}jW(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c===`auto`&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*CW),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);let{x:d,y:f,z:p}=PW(e,u,o,s,a&&!kW(c)?SW:0,c),{positionAbsolute:m}=e.internals,h=d!==m.x||f!==m.y;(h||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:h?{x:d,y:f}:m,z:p}})}function NW(e,t,n){let r=DU(e.zIndex)?e.zIndex:0;return kW(n)?r:r+(e.selected?t:0)}function PW(e,t,n,r,i,a){let{x:o,y:s}=t.internals.positionAbsolute,c=RU(e),l=iU(e,n),u=LU(e.extent)?mU(l,e.extent,c):l,d=mU({x:o+u.x,y:s+u.y},r,c);e.extent===`parent`&&(d=hU(d,c,t));let f=NW(e,i,a),p=t.internals.z??0;return{x:d.x,y:d.y,z:p>=f?p+1:f}}function FW(e,t,n,r=[0,0]){let i=[],a=new Map;for(let n of e){let e=t.get(n.parentId);if(!e)continue;let r=CU(a.get(n.parentId)?.expandedRect??xU(e),n.rect);a.set(n.parentId,{expandedRect:r,parent:e})}return a.size>0&&a.forEach(({expandedRect:t,parent:a},o)=>{let s=a.internals.positionAbsolute,c=RU(a),l=a.origin??r,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(c.width,Math.round(t.width)),p=Math.max(c.height,Math.round(t.height)),m=(f-c.width)*l[0],h=(p-c.height)*l[1];(u>0||d>0||m||h)&&(i.push({id:o,type:`position`,position:{x:a.position.x-u+m,y:a.position.y-d+h}}),n.get(o)?.forEach(t=>{e.some(e=>e.id===t.id)||i.push({id:t.id,type:`position`,position:{x:t.position.x+u,y:t.position.y+d}})})),(c.width<t.width||c.height<t.height||u||d)&&i.push({id:o,type:`dimensions`,setAttributes:!0,dimensions:{width:f+(u?l[0]*u-m:0),height:p+(d?l[1]*d-h:0)}})}),i}function IW(e,t,n,r,i,a,o){let s=r?.querySelector(`.xyflow__viewport`),c=!1;if(!s)return{changes:[],updatedInternals:c};let l=[],u=window.getComputedStyle(s),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(let r of e.values()){let e=t.get(r.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),c=!0;continue}let s=GU(r.nodeElement),u=e.measured.width!==s.width||e.measured.height!==s.height;if(s.width&&s.height&&(u||!e.internals.handleBounds||r.force)){let p=r.nodeElement.getBoundingClientRect(),m=LU(e.extent)?e.extent:a,{positionAbsolute:h}=e.internals;if(e.parentId&&e.extent===`parent`){let n=t.get(e.parentId);n&&(h=hU(h,s,n))}else m&&(h=mU(h,m,s));let g={...e,measured:s,internals:{...e.internals,positionAbsolute:h,handleBounds:{source:ZU(`source`,r.nodeElement,p,d,e.id),target:ZU(`target`,r.nodeElement,p,d,e.id)}}};t.set(e.id,g),e.parentId&&MW(g,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,u&&(l.push({id:e.id,type:`dimensions`,dimensions:s}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:xU(g,i)}))}}if(f.length>0){let e=FW(f,t,n,i);l.push(...e)}return{changes:l,updatedInternals:c}}async function LW({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:a}){if(!t||!e.x&&!e.y)return!1;let o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,a]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function RW(e,t,n,r,i,a){let o=i,s=r.get(o)||new Map;r.set(o,s.set(n,t)),o=`${i}-${e}`;let c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),a){o=`${i}-${e}-${a}`;let s=r.get(o)||new Map;r.set(o,s.set(n,t))}}function zW(e,t,n){e.clear(),t.clear();for(let r of n){let{source:n,target:i,sourceHandle:a=null,targetHandle:o=null}=r,s={edgeId:r.id,source:n,target:i,sourceHandle:a,targetHandle:o},c=`${n}-${a}--${i}-${o}`;RW(`source`,s,`${i}-${o}--${n}-${a}`,e,n,a),RW(`target`,s,c,e,i,o),t.set(r.id,r)}}function BW(e,t){if(!e.parentId)return!1;let n=t.get(e.parentId);return n?n.selected?!0:BW(n,t):!1}function VW(e,t,n){let r=e;do{if(r?.matches?.(t))return!0;if(r===n)return!1;r=r?.parentElement}while(r);return!1}function HW(e,t,n,r){let i=new Map;for(let[a,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!BW(o,e))&&(o.draggable||t&&o.draggable===void 0)){let t=e.get(a);t&&i.set(a,{id:a,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return i}function UW({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){let i=[];for(let[e,a]of t){let t=n.get(e)?.internals.userNode;t&&i.push({...t,position:a.position,dragging:r})}if(!e)return[i[0],i];let a=n.get(e)?.internals.userNode;return[a?{...a,position:t.get(e)?.position||a.position,dragging:r}:i[0],i]}function WW({dragItems:e,snapGrid:t,x:n,y:r}){let i=e.values().next().value;if(!i)return null;let a={x:n-i.distance.x,y:r-i.distance.y},o=kU(a,t);return{x:o.x-a.x,y:o.y-a.y}}function GW({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let a={x:null,y:null},o=0,s=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,p=!1,m=!1,h=null;function g({noDragClassName:g,handleSelector:_,domNode:v,isSelectable:y,nodeId:b,nodeClickDistance:x=0}){f=uz(v);function S({x:e,y:n}){let{nodeLookup:i,nodeExtent:o,snapGrid:c,snapToGrid:l,nodeOrigin:u,onNodeDrag:d,onSelectionDrag:f,onError:p,updateNodePositions:g}=t();a={x:e,y:n};let _=!1,v=s.size>1,y=v&&o?yU(oU(s)):null,x=v&&l?WW({dragItems:s,snapGrid:c,x:e,y:n}):null;for(let[t,r]of s){if(!i.has(t))continue;let a={x:e-r.distance.x,y:n-r.distance.y};l&&(a=x?{x:Math.round(a.x+x.x),y:Math.round(a.y+x.y)}:kU(a,c));let s=null;if(v&&o&&!r.extent&&y){let{positionAbsolute:e}=r.internals,t=e.x-y.x+o[0][0],n=e.x+r.measured.width-y.x2+o[1][0],i=e.y-y.y+o[0][1],a=e.y+r.measured.height-y.y2+o[1][1];s=[[t,i],[n,a]]}let{position:d,positionAbsolute:f}=dU({nodeId:t,nextPosition:a,nodeLookup:i,nodeExtent:s||o,nodeOrigin:u,onError:p});_=_||r.position.x!==d.x||r.position.y!==d.y,r.position=d,r.internals.positionAbsolute=f}if(m||=_,_&&(g(s,!0),h&&(r||d||!b&&f))){let[e,t]=UW({nodeId:b,dragItems:s,nodeLookup:i});r?.(h,s,e,t),d?.(h,e,t),b||f?.(h,t)}}async function C(){if(!u)return;let{transform:e,panBy:n,autoPanSpeed:r,autoPanOnNodeDrag:i}=t();if(!i){c=!1,cancelAnimationFrame(o);return}let[s,d]=_U(l,u,r);(s!==0||d!==0)&&(a.x=(a.x??0)-s/e[2],a.y=(a.y??0)-d/e[2],await n({x:s,y:d})&&S(a)),o=requestAnimationFrame(C)}function w(r){let{nodeLookup:i,multiSelectionActive:o,nodesDraggable:c,transform:l,snapGrid:f,snapToGrid:p,selectNodesOnDrag:m,onNodeDragStart:h,onSelectionDragStart:g,unselectNodesAndEdges:_}=t();d=!0,(!m||!y)&&!o&&b&&(i.get(b)?.selected||_()),y&&m&&b&&e?.(b);let v=WU(r.sourceEvent,{transform:l,snapGrid:f,snapToGrid:p,containerBounds:u});if(a=v,s=HW(i,c,v,b),s.size>0&&(n||h||!b&&g)){let[e,t]=UW({nodeId:b,dragItems:s,nodeLookup:i});n?.(r.sourceEvent,s,e,t),h?.(r.sourceEvent,e,t),b||g?.(r.sourceEvent,t)}}let T=Tz().clickDistance(x).on(`start`,e=>{let{domNode:n,nodeDragThreshold:r,transform:i,snapGrid:o,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,p=!1,m=!1,h=e.sourceEvent,r===0&&w(e),a=WU(e.sourceEvent,{transform:i,snapGrid:o,snapToGrid:s,containerBounds:u}),l=XU(e.sourceEvent,u)}).on(`drag`,e=>{let{autoPanOnNodeDrag:n,transform:r,snapGrid:i,snapToGrid:o,nodeDragThreshold:f,nodeLookup:m}=t(),g=WU(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:o,containerBounds:u});if(h=e.sourceEvent,(e.sourceEvent.type===`touchmove`&&e.sourceEvent.touches.length>1||b&&!m.has(b))&&(p=!0),!p){if(!c&&n&&d&&(c=!0,C()),!d){let t=XU(e.sourceEvent,u),n=t.x-l.x,r=t.y-l.y;Math.sqrt(n*n+r*r)>f&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&s&&d&&(l=XU(e.sourceEvent,u),S(g))}}).on(`end`,e=>{if(!d||p){p&&s.size>0&&t().updateNodePositions(s,!1);return}if(c=!1,d=!1,cancelAnimationFrame(o),s.size>0){let{nodeLookup:n,updateNodePositions:r,onNodeDragStop:a,onSelectionDragStop:o}=t();if(m&&=(r(s,!1),!1),i||a||!b&&o){let[t,r]=UW({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});i?.(e.sourceEvent,s,t,r),a?.(e.sourceEvent,t,r),b||o?.(e.sourceEvent,r)}}}).filter(e=>{let t=e.target;return!e.button&&(!g||!VW(t,`.${g}`,v))&&(!_||VW(t,_,v))});f.call(T)}function _(){f?.on(`.drag`,null)}return{update:g,destroy:_}}function KW(e,t,n){let r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(let e of t.values())TU(i,xU(e))>0&&r.push(e);return r}var qW=250;function JW(e,t,n,r){let i=[],a=1/0,o=KW(e,n,t+qW);for(let n of o){let o=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(let s of o){if(r.nodeId===s.nodeId&&r.type===s.type&&r.id===s.id)continue;let{x:o,y:c}=vW(n,s,s.position,!0),l=Math.sqrt((o-e.x)**2+(c-e.y)**2);l>t||(l<a?(i=[{...s,x:o,y:c}],a=l):l===a&&i.push({...s,x:o,y:c}))}}if(!i.length)return null;if(i.length>1){let e=r.type===`source`?`target`:`source`;return i.find(t=>t.type===e)??i[0]}return i[0]}function YW(e,t,n,r,i,a=!1){let o=r.get(e);if(!o)return null;let s=i===`strict`?o.internals.handleBounds?.[t]:[...o.internals.handleBounds?.source??[],...o.internals.handleBounds?.target??[]],c=(n?s?.find(e=>e.id===n):s?.[0])??null;return c&&a?{...c,...vW(o,c,c.position,!0)}:c}function XW(e,t){return e||(t?.classList.contains(`target`)?`target`:t?.classList.contains(`source`)?`source`:null)}function ZW(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}var QW=()=>!0;function $W(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:o,domNode:s,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:p,onConnectStart:m,onConnect:h,onConnectEnd:g,isValidConnection:_=QW,onReconnectEnd:v,updateConnection:y,getTransform:b,getFromHandle:x,autoPanSpeed:S,dragThreshold:C=1,handleDomNode:w}){let T=KU(e.target),E=0,D,{x:O,y:k}=XU(e),A=XW(a,w),j=s?.getBoundingClientRect(),M=!1;if(!j||!A)return;let N=YW(i,A,r,c,t);if(!N)return;let P=XU(e,j),ee=!1,F=null,I=!1,L=null;function te(){if(!u||!j)return;let[e,t]=_U(P,j,S);f({x:e,y:t}),E=requestAnimationFrame(te)}let ne={...N,nodeId:i,type:A,position:N.position},re=c.get(i),R={inProgress:!0,isValid:null,from:vW(re,ne,$.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:re,to:P,toHandle:null,toPosition:$H[ne.position],toNode:null,pointer:P};function ie(){M=!0,y(R),m?.(e,{nodeId:i,handleId:r,handleType:A})}C===0&&ie();function ae(e){if(!M){let{x:t,y:n}=XU(e),r=t-O,i=n-k;if(!(r*r+i*i>C*C))return;ie()}if(!x()||!ne){oe(e);return}let a=b();P=XU(e,j),D=JW(AU(P,a,!1,[1,1]),n,c,ne),ee||=(te(),!0);let s=eG(e,{handle:D,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?`target`:`source`,isValidConnection:_,doc:T,lib:l,flowId:d,nodeLookup:c});L=s.handleDomNode,F=s.connection,I=ZW(!!D,s.isValid);let u=c.get(i),f=u?vW(u,ne,$.Left,!0):R.from,p={...R,from:f,isValid:I,to:s.toHandle&&I?jU({x:s.toHandle.x,y:s.toHandle.y},a):P,toHandle:s.toHandle,toPosition:I&&s.toHandle?s.toHandle.position:$H[ne.position],toNode:s.toHandle?c.get(s.toHandle.nodeId):null,pointer:P};y(p),R=p}function oe(e){if(!(`touches`in e&&e.touches.length>0)){if(M){(D||L)&&F&&I&&h?.(F);let{inProgress:t,...n}=R,r={...n,toPosition:R.toHandle?R.toPosition:null};g?.(e,r),a&&v?.(e,r)}p(),cancelAnimationFrame(E),ee=!1,I=!1,F=null,L=null,T.removeEventListener(`mousemove`,ae),T.removeEventListener(`mouseup`,oe),T.removeEventListener(`touchmove`,ae),T.removeEventListener(`touchend`,oe)}}T.addEventListener(`mousemove`,ae),T.addEventListener(`mouseup`,oe),T.addEventListener(`touchmove`,ae),T.addEventListener(`touchend`,oe)}function eG(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:a,doc:o,lib:s,flowId:c,isValidConnection:l=QW,nodeLookup:u}){let d=a===`target`,f=t?o.querySelector(`.${s}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:p,y:m}=XU(e),h=o.elementFromPoint(p,m),g=h?.classList.contains(`${s}-flow__handle`)?h:f,_={handleDomNode:g,isValid:!1,connection:null,toHandle:null};if(g){let e=XW(void 0,g),t=g.getAttribute(`data-nodeid`),a=g.getAttribute(`data-handleid`),o=g.classList.contains(`connectable`),s=g.classList.contains(`connectableend`);if(!t||!e)return _;let c={source:d?t:r,sourceHandle:d?a:i,target:d?r:t,targetHandle:d?i:a};_.connection=c,_.isValid=o&&s&&(n===qH.Strict?d&&e===`source`||!d&&e===`target`:t!==r||a!==i)&&l(c),_.toHandle=YW(t,e,a,u,n,!0)}return _}var tG={onPointerDown:$W,isValid:eG};function nG({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){let i=uz(e);function a({translateExtent:e,width:a,height:o,zoomStep:s=1,pannable:c=!0,zoomable:l=!0,inversePan:u=!1}){let d=e=>{if(e.sourceEvent.type!==`wheel`||!t)return;let r=n(),i=e.sourceEvent.ctrlKey&&IU()?10:1,a=-e.sourceEvent.deltaY*(e.sourceEvent.deltaMode===1?.05:e.sourceEvent.deltaMode?1:.002)*s,o=r[2]*2**(a*i);t.scaleTo(o)},f=[0,0],p=HH().on(`start`,e=>{(e.sourceEvent.type===`mousedown`||e.sourceEvent.type===`touchstart`)&&(f=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on(`zoom`,c?i=>{let s=n();if(i.sourceEvent.type!==`mousemove`&&i.sourceEvent.type!==`touchmove`||!t)return;let c=[i.sourceEvent.clientX??i.sourceEvent.touches[0].clientX,i.sourceEvent.clientY??i.sourceEvent.touches[0].clientY],l=[c[0]-f[0],c[1]-f[1]];f=c;let d=r()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),p={x:s[0]-l[0]*d,y:s[1]-l[1]*d},m=[[0,0],[a,o]];t.setViewportConstrained({x:p.x,y:p.y,zoom:s[2]},m,e)}:null).on(`zoom.wheel`,l?d:null);i.call(p,{})}function o(){i.on(`zoom`,null)}return{update:a,destroy:o,pointer:fz}}var rG=e=>({x:e.x,y:e.y,zoom:e.k}),iG=({x:e,y:t,zoom:n})=>MH.translate(e,t).scale(n),aG=(e,t)=>e.target.closest(`.${t}`),oG=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),sG=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,cG=(e,t=0,n=sG,r=()=>{})=>{let i=typeof t==`number`&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on(`end`,r):e},lG=e=>{let t=e.ctrlKey&&IU()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function uG({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:o,onPanZoomStart:s,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(aG(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();let d=n.property(`__zoom`).k||1;if(u.ctrlKey&&o){let e=fz(u),t=d*2**lG(u);r.scaleTo(n,t,e,u);return}let f=u.deltaMode===1?20:1,p=i===JH.Vertical?0:u.deltaX*f,m=i===JH.Horizontal?0:u.deltaY*f;!IU()&&u.shiftKey&&i!==JH.Vertical&&(p=u.deltaY*f,m=0),r.translateBy(n,-(p/d)*a,-(m/d)*a,{internal:!0});let h=rG(n.property(`__zoom`));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,h):(e.isPanScrolling=!0,s?.(u,h)),e.panScrollTimeout=setTimeout(()=>{l?.(u,h),e.isPanScrolling=!1},150)}}function dG({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){let a=r.type===`wheel`,o=!t&&a&&!r.ctrlKey,s=aG(r,e);if(r.ctrlKey&&a&&s&&r.preventDefault(),o||s)return null;r.preventDefault(),n.call(this,r,i)}}function fG({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{if(r.sourceEvent?.internal)return;let i=rG(r.transform);e.mouseButton=r.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=i,r.sourceEvent?.type===`mousedown`&&t(!0),n&&n?.(r.sourceEvent,i)}}function pG({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return a=>{e.usedRightMouseButton=!!(n&&oG(t,e.mouseButton??0)),a.sourceEvent?.sync||r([a.transform.x,a.transform.y,a.transform.k]),i&&!a.sourceEvent?.internal&&i?.(a.sourceEvent,rG(a.transform))}}function mG({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:a}){return o=>{if(!o.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,a&&oG(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&a(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){let t=rG(o.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i?.(o.sourceEvent,t)},n?150:0)}}}function hG({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:a,userSelectionActive:o,noWheelClassName:s,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{let f=e||t,p=n&&d.ctrlKey,m=d.type===`wheel`;if(d.button===1&&d.type===`mousedown`&&(aG(d,`${l}-flow__node`)||aG(d,`${l}-flow__edge`)))return!0;if(!r&&!f&&!i&&!a&&!n||o||u&&!m||aG(d,s)&&m||aG(d,c)&&(!m||i&&m&&!e)||!n&&d.ctrlKey&&m)return!1;if(!n&&d.type===`touchstart`&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!i&&!p&&m||!r&&(d.type===`mousedown`||d.type===`touchstart`)||Array.isArray(r)&&!r.includes(d.button)&&d.type===`mousedown`)return!1;let h=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||m)&&h}}function gG({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:o,onPanZoomEnd:s,onDraggingChange:c}){let l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<`u`?new ResizeObserver(e=>{let t=e[0];t&&(d=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null)?.observe(e);let f=HH().extent(()=>d).scaleExtent([t,n]).translateExtent(r),p=uz(e).call(f);y({x:i.x,y:i.y,zoom:pU(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);let m=p.on(`wheel.zoom`),h=p.on(`dblclick.zoom`);f.wheelDelta(lG);async function g(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?OB:HB).transform(cG(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function _({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:r,panOnScroll:i,panOnDrag:u,panOnScrollMode:d,panOnScrollSpeed:g,preventScrolling:_,zoomOnPinch:y,zoomOnScroll:b,zoomOnDoubleClick:x,zoomActivationKeyPressed:S,lib:C,onTransformChange:w,connectionInProgress:T,paneClickDistance:E,selectionOnDrag:D}){r&&!l.isZoomingOrPanning&&v();let O=i&&!S&&!r;f.clickDistance(D?1/0:!DU(E)||E<0?0:E);let k=O?uG({zoomPanValues:l,noWheelClassName:e,d3Selection:p,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:g,zoomOnPinch:y,onPanZoomStart:o,onPanZoom:a,onPanZoomEnd:s}):dG({noWheelClassName:e,preventScrolling:_,d3ZoomHandler:m});p.on(`wheel.zoom`,k,{passive:!1});let A=fG({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:o});f.on(`start`,A);let j=pG({zoomPanValues:l,panOnDrag:u,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:w});f.on(`zoom`,j);let M=mG({zoomPanValues:l,panOnDrag:u,panOnScroll:i,onPaneContextMenu:n,onPanZoomEnd:s,onDraggingChange:c});f.on(`end`,M);let N=hG({zoomActivationKeyPressed:S,panOnDrag:u,zoomOnScroll:b,panOnScroll:i,zoomOnDoubleClick:x,zoomOnPinch:y,userSelectionActive:r,noPanClassName:t,noWheelClassName:e,lib:C,connectionInProgress:T});f.filter(N),x?p.on(`dblclick.zoom`,h):p.on(`dblclick.zoom`,null)}function v(){f.on(`zoom`,null)}async function y(e,t,n){let r=iG(e),i=f?.constrain()(r,t,n);return i&&await g(i),i}async function b(e,t){let n=iG(e);return await g(n,t),n}function x(e){if(p){let t=iG(e),n=p.property(`__zoom`);(n.k!==e.zoom||n.x!==e.x||n.y!==e.y)&&f?.transform(p,t,null,{sync:!0})}}function S(){let e=p?NH(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}}async function C(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?OB:HB).scaleTo(cG(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}async function w(e,t){return p?new Promise(n=>{f?.interpolate(t?.interpolate===`linear`?OB:HB).scaleBy(cG(p,t?.duration,t?.ease,()=>n(!0)),e)}):!1}function T(e){f?.scaleExtent(e)}function E(e){f?.translateExtent(e)}function D(e){let t=!DU(e)||e<0?0:e;f?.clickDistance(t)}return{update:_,destroy:v,setViewport:b,setViewportConstrained:y,getViewport:S,scaleTo:C,scaleBy:w,setScaleExtent:T,setTranslateExtent:E,syncViewport:x,setClickDistance:D}}var _G;(function(e){e.Line=`line`,e.Handle=`handle`})(_G||={});function vG({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:a}){let o=e-t,s=n-r,c=[o>0?1:o<0?-1:0,s>0?1:s<0?-1:0];return o&&i&&(c[0]*=-1),s&&a&&(c[1]*=-1),c}function yG(e){return{isHorizontal:e.includes(`right`)||e.includes(`left`),isVertical:e.includes(`bottom`)||e.includes(`top`),affectsX:e.includes(`left`),affectsY:e.includes(`top`)}}function bG(e,t){return Math.max(0,t-e)}function xG(e,t){return Math.max(0,e-t)}function SG(e,t,n){return Math.max(0,t-e,e-n)}function CG(e,t){return e?!t:t}function wG(e,t,n,r,i,a,o,s){let{affectsX:c,affectsY:l}=t,{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:p,ySnapped:m}=n,{minWidth:h,maxWidth:g,minHeight:_,maxHeight:v}=r,{x:y,y:b,width:x,height:S,aspectRatio:C}=e,w=Math.floor(u?p-e.pointerX:0),T=Math.floor(d?m-e.pointerY:0),E=x+(c?-w:w),D=S+(l?-T:T),O=-a[0]*x,k=-a[1]*S,A=SG(E,h,g),j=SG(D,_,v);if(o){let e=0,t=0;c&&w<0?e=bG(y+w+O,o[0][0]):!c&&w>0&&(e=xG(y+E+O,o[1][0])),l&&T<0?t=bG(b+T+k,o[0][1]):!l&&T>0&&(t=xG(b+D+k,o[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(s){let e=0,t=0;c&&w>0?e=xG(y+w,s[0][0]):!c&&w<0&&(e=bG(y+E,s[1][0])),l&&T>0?t=xG(b+T,s[0][1]):!l&&T<0&&(t=bG(b+D,s[1][1])),A=Math.max(A,e),j=Math.max(j,t)}if(i){if(u){let e=SG(E/C,_,v)*C;if(A=Math.max(A,e),o){let e=0;e=!c&&!l||c&&!l&&f?xG(b+k+E/C,o[1][1])*C:bG(b+k+(c?w:-w)/C,o[0][1])*C,A=Math.max(A,e)}if(s){let e=0;e=!c&&!l||c&&!l&&f?bG(b+E/C,s[1][1])*C:xG(b+(c?w:-w)/C,s[0][1])*C,A=Math.max(A,e)}}if(d){let e=SG(D*C,h,g)/C;if(j=Math.max(j,e),o){let e=0;e=!c&&!l||l&&!c&&f?xG(y+D*C+O,o[1][0])/C:bG(y+(l?T:-T)*C+O,o[0][0])/C,j=Math.max(j,e)}if(s){let e=0;e=!c&&!l||l&&!c&&f?bG(y+D*C,s[1][0])/C:xG(y+(l?T:-T)*C,s[0][0])/C,j=Math.max(j,e)}}}T+=T<0?j:-j,w+=w<0?A:-A,i&&(f?E>D*C?T=(CG(c,l)?-w:w)/C:w=(CG(c,l)?-T:T)*C:u?(T=w/C,l=c):(w=T*C,c=l));let M=c?y+w:y,N=l?b+T:b;return{width:x+(c?-w:w),height:S+(l?-T:T),x:a[0]*w*(c?-1:1)+M,y:a[1]*T*(l?-1:1)+N}}var TG={width:0,height:0,x:0,y:0},EG={...TG,pointerX:0,pointerY:0,aspectRatio:1};function DG(e,t,n){let r=t.position.x+e.position.x,i=t.position.y+e.position.y,a=e.measured.width??0,o=e.measured.height??0,s=n[0]*a,c=n[1]*o;return[[r-s,i-c],[r+a-s,i+o-c]]}function OG({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){let a=uz(e),o={controlDirection:yG(`bottom-right`),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function s({controlPosition:e,boundaries:s,keepAspectRatio:c,resizeDirection:l,onResizeStart:u,onResize:d,onResizeEnd:f,shouldResize:p}){let m={...TG},h={...EG};o={boundaries:s,resizeDirection:l,keepAspectRatio:c,controlDirection:yG(e)};let g,_=null,v=[],y,b,x,S=!1,C=Tz().on(`start`,e=>{let{nodeLookup:r,transform:i,snapGrid:a,snapToGrid:o,nodeOrigin:s,paneDomNode:c}=n();if(g=r.get(t),!g)return;_=c?.getBoundingClientRect()??null;let{xSnapped:l,ySnapped:d}=WU(e.sourceEvent,{transform:i,snapGrid:a,snapToGrid:o,containerBounds:_});m={width:g.measured.width??0,height:g.measured.height??0,x:g.position.x??0,y:g.position.y??0},h={...m,pointerX:l,pointerY:d,aspectRatio:m.width/m.height},y=void 0,b=LU(g.extent)?g.extent:void 0,g.parentId&&(g.extent===`parent`||g.expandParent)&&(y=r.get(g.parentId)),y&&g.extent===`parent`&&(b=[[0,0],[y.measured.width,y.measured.height]]),v=[],x=void 0;for(let[e,n]of r)if(n.parentId===t&&(v.push({id:e,position:{...n.position},extent:n.extent}),n.extent===`parent`||n.expandParent)){let e=DG(n,g,n.origin??s);x=x?[[Math.min(e[0][0],x[0][0]),Math.min(e[0][1],x[0][1])],[Math.max(e[1][0],x[1][0]),Math.max(e[1][1],x[1][1])]]:e}u?.(e,{...m})}).on(`drag`,e=>{let{transform:t,snapGrid:i,snapToGrid:a,nodeOrigin:s}=n(),c=WU(e.sourceEvent,{transform:t,snapGrid:i,snapToGrid:a,containerBounds:_}),l=[];if(!g)return;let{x:u,y:f,width:C,height:w}=m,T={},E=g.origin??s,{width:D,height:O,x:k,y:A}=wG(h,o.controlDirection,c,o.boundaries,o.keepAspectRatio,E,b,x),j=D!==C,M=O!==w,N=k!==u&&j,P=A!==f&&M;if(!N&&!P&&!j&&!M)return;if((N||P||E[0]===1||E[1]===1)&&(T.x=N?k:m.x,T.y=P?A:m.y,m.x=T.x,m.y=T.y,v.length>0)){let e=k-u,t=A-f;for(let n of v)n.position={x:n.position.x-e+E[0]*(D-C),y:n.position.y-t+E[1]*(O-w)},l.push(n)}if((j||M)&&(T.width=j&&(!o.resizeDirection||o.resizeDirection===`horizontal`)?D:m.width,T.height=M&&(!o.resizeDirection||o.resizeDirection===`vertical`)?O:m.height,m.width=T.width,m.height=T.height),y&&g.expandParent){let e=E[0]*(T.width??0);T.x&&T.x<e&&(m.x=e,h.x-=T.x-e);let t=E[1]*(T.height??0);T.y&&T.y<t&&(m.y=t,h.y-=T.y-t)}let ee=vG({width:m.width,prevWidth:C,height:m.height,prevHeight:w,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),F={...m,direction:ee};p?.(e,F)!==!1&&(S=!0,d?.(e,F),r(T,l))}).on(`end`,e=>{S&&=(f?.(e,{...m}),i?.({...m}),!1)});a.call(C)}function c(){a.on(`.drag`,null)}return{update:s,destroy:c}}var kG=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),AG=o(((e,t)=>{t.exports=kG()})),jG=o((e=>{var t=d(),n=AG();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),MG=l(o(((e,t)=>{t.exports=jG()}))(),1),NG=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},PG=e=>e?NG(e):NG,{useDebugValue:FG}=U.default,{useSyncExternalStoreWithSelector:IG}=MG.default,LG=e=>e;function RG(e,t=LG,n){let r=IG(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return FG(r),r}var zG=(e,t)=>{let n=PG(e),r=(e,r=t)=>RG(n,e,r);return Object.assign(r,n),r},BG=(e,t)=>e?zG(e,t):zG;function VG(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}var HG=(0,U.createContext)(null),UG=HG.Provider,WG=UH.error001(`react`);function GG(e,t){let n=(0,U.useContext)(HG);if(n===null)throw Error(WG);return RG(n,e,t)}function KG(){let e=(0,U.useContext)(HG);if(e===null)throw Error(WG);return(0,U.useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}var qG={display:`none`},JG={position:`absolute`,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0px, 0px, 0px, 0px)`,clipPath:`inset(100%)`},YG=`react-flow__node-desc`,XG=`react-flow__edge-desc`,ZG=`react-flow__aria-live`,QG=e=>e.ariaLiveMessage,$G=e=>e.ariaLabelConfig;function eK({rfId:e}){let t=GG(QG);return(0,G.jsx)(`div`,{id:`${ZG}-${e}`,"aria-live":`assertive`,"aria-atomic":`true`,style:JG,children:t})}function tK({rfId:e,disableKeyboardA11y:t}){let n=GG($G);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{id:`${YG}-${e}`,style:qG,children:t?n[`node.a11yDescription.default`]:n[`node.a11yDescription.keyboardDisabled`]}),(0,G.jsx)(`div`,{id:`${XG}-${e}`,style:qG,children:n[`edge.a11yDescription.default`]}),!t&&(0,G.jsx)(eK,{rfId:e})]})}var nK=(0,U.forwardRef)(({position:e=`top-left`,children:t,className:n,style:r,...i},a)=>(0,G.jsx)(`div`,{className:aL([`react-flow__panel`,n,...`${e}`.split(`-`)]),style:r,ref:a,...i,children:t}));nK.displayName=`Panel`;var rK=`https://reactflow.dev?utm_source=attribution`;function iK({proOptions:e,position:t=`bottom-right`}){return e?.hideAttribution?null:(0,G.jsx)(nK,{position:t,className:`react-flow__attribution`,"data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${rK}`,children:(0,G.jsx)(`a`,{href:rK,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`React Flow attribution`,children:`React Flow`})})}var aK=e=>{let t=[],n=[];for(let[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(let[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},oK=e=>e.id;function sK(e,t){return VG(e.selectedNodes.map(oK),t.selectedNodes.map(oK))&&VG(e.selectedEdges.map(oK),t.selectedEdges.map(oK))}function cK({onSelectionChange:e}){let t=KG(),{selectedNodes:n,selectedEdges:r}=GG(aK,sK);return(0,U.useEffect)(()=>{let i={nodes:n,edges:r};e?.(i),t.getState().onSelectionChangeHandlers.forEach(e=>e(i))},[n,r,e]),null}var lK=e=>!!e.onSelectionChangeHandlers;function uK({onSelectionChange:e}){let t=GG(lK);return e||t?(0,G.jsx)(cK,{onSelectionChange:e}):null}var dK=[0,0],fK={x:0,y:0,zoom:1},pK=[...`nodes.edges.defaultNodes.defaultEdges.onConnect.onConnectStart.onConnectEnd.onClickConnectStart.onClickConnectEnd.nodesDraggable.autoPanOnNodeFocus.nodesConnectable.nodesFocusable.edgesFocusable.edgesReconnectable.elevateNodesOnSelect.elevateEdgesOnSelect.minZoom.maxZoom.nodeExtent.onNodesChange.onEdgesChange.elementsSelectable.connectionMode.snapGrid.snapToGrid.translateExtent.connectOnClick.defaultEdgeOptions.fitView.fitViewOptions.onNodesDelete.onEdgesDelete.onDelete.onNodeDrag.onNodeDragStart.onNodeDragStop.onSelectionDrag.onSelectionDragStart.onSelectionDragStop.onMoveStart.onMove.onMoveEnd.noPanClassName.nodeOrigin.autoPanOnConnect.autoPanOnNodeDrag.onError.connectionRadius.isValidConnection.selectNodesOnDrag.nodeDragThreshold.connectionDragThreshold.onBeforeDelete.debug.autoPanSpeed.ariaLabelConfig.zIndexMode`.split(`.`),`rfId`],mK=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),hK={translateExtent:WH,nodeOrigin:dK,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:`nopan`,rfId:`1`};function gK(e){let{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:o,reset:s,setDefaultNodesAndEdges:c}=GG(mK,VG),l=KG();(0,U.useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=hK,s()}),[]);let u=(0,U.useRef)(hK);return(0,U.useEffect)(()=>{for(let s of pK){let c=e[s];c!==u.current[s]&&e[s]!==void 0&&(s===`nodes`?t(c):s===`edges`?n(c):s===`minZoom`?r(c):s===`maxZoom`?i(c):s===`translateExtent`?a(c):s===`nodeExtent`?o(c):s===`ariaLabelConfig`?l.setState({ariaLabelConfig:UU(c)}):s===`fitView`?l.setState({fitViewQueued:c}):s===`fitViewOptions`?l.setState({fitViewOptions:c}):l.setState({[s]:c}))}u.current=e},pK.map(t=>e[t])),null}function _K(){return typeof window>`u`||!window.matchMedia?null:window.matchMedia(`(prefers-color-scheme: dark)`)}function vK(e){let[t,n]=(0,U.useState)(e===`system`?null:e);return(0,U.useEffect)(()=>{if(e!==`system`){n(e);return}let t=_K(),r=()=>n(t?.matches?`dark`:`light`);return r(),t?.addEventListener(`change`,r),()=>{t?.removeEventListener(`change`,r)}},[e]),t===null?_K()?.matches?`dark`:`light`:t}var yK=typeof document<`u`?document:null;function bK(e=null,t={target:yK,actInsideInputWithModifier:!0}){let[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(!1),a=(0,U.useRef)(new Set([])),[o,s]=(0,U.useMemo)(()=>{if(e!==null){let t=(Array.isArray(e)?e:[e]).filter(e=>typeof e==`string`).map(e=>e.replace(`+`,`
90
90
  `).replace(`
91
91
 
92
92
  `,`
93
93
  +`).split(`
94
- `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,U.useEffect)(()=>{let n=t?.target??dK,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&BU(e))return!1;let n=mK(e.code,s);if(a.current.add(e[n]),pK(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=mK(e.code,s);pK(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function pK(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function mK(e,t){return t.includes(e)?`code`:`key`}var hK=()=>{let e=RG();return(0,U.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=DU(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return SU(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=CU(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function gK(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)_K(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function _K(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function vK(e,t){return gK(e,t)}function yK(e,t){return gK(e,t)}function bK(e,t){return{id:e,type:`select`,selected:t}}function xK(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(bK(a.id,e)))}return r}function SK({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function CK(e){return{id:e.id,type:`remove`}}var wK=bU(`React Flow`,`https://reactflow.dev/`);function TK(e,t,n={}){return $U(e,t,{...n,onError:n.onError??wK})}var EK=e=>JH(e),DK=e=>qH(e);function OK(e){return(0,U.forwardRef)(e)}var kK=typeof window<`u`?U.useLayoutEffect:U.useEffect;function AK(e){let[t,n]=(0,U.useState)(BigInt(0)),[r]=(0,U.useState)(()=>jK(()=>n(e=>e+BigInt(1))));return kK(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function jK(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var MK=(0,U.createContext)(null);function NK({children:e}){let t=RG(),n=AK((0,U.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=SK({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=AK((0,U.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(SK({items:s,lookup:o}))},[])),i=(0,U.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,G.jsx)(MK.Provider,{value:i,children:e})}function PK(){let e=(0,U.useContext)(MK);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var FK=e=>!!e.panZoom;function IK(){let e=hK(),t=RG(),n=PK(),r=LG(FK),i=(0,U.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=EK(e)?e:n.get(e.id),a=i.parentId?MU(i.position,i.measured,i.parentId,n,r):i.position;return pU({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&EK(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&DK(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await iU({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(CK);o?.(f),c(e)}if(m){let e=d.map(CK);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=vU(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=pU(s?r:a),l=_U(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=vU(e)?e:a(e);if(!r)return!1;let i=_U(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return ZH(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??PU();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,U.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var LK=e=>e.selected,RK=typeof window<`u`?window:void 0;function zK({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=RG(),{deleteElements:r}=IK(),i=fK(e,{actInsideInputWithModifier:!1}),a=fK(t,{target:RK});(0,U.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(LK),edges:e.filter(LK)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,U.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function BK(e){let t=RG();(0,U.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=LU(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,FH.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var VK={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},HK=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function UK({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=BH.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=RG(),S=(0,U.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=LG(HK,NG),E=fK(f),D=(0,U.useRef)();BK(S);let O=(0,U.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,U.useEffect)(()=>{if(S.current){D.current=cG({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,U.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,G.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:VK,children:m})}var WK=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function GK(){let{userSelectionActive:e,userSelectionRect:t}=LG(WK,NG);return e&&t?(0,G.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var KK=(e,t)=>n=>{n.target===t.current&&e?.(n)},qK=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function JK({isSelecting:e,selectionKeyPressed:t,selectionMode:n=VH.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,U.useRef)(0),_=RG(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=LG(qK,NG),C=y&&(e||v),w=(0,U.useRef)(null),T=(0,U.useRef)(),E=(0,U.useRef)(new Set),D=(0,U.useRef)(new Set),O=(0,U.useRef)(!1),k=(0,U.useRef)(!1),A=(0,U.useRef)({x:0,y:0}),j=(0,U.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,ee=e=>{k.current&&=(e.stopPropagation(),!1)},F=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=HU(n.nativeEvent,T.current),l=SU({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=CU(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set($H(a,m,i,n===VH.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}NU(h,E.current)||c(xK(a,E.current,!0)),NU(g,D.current)||l(xK(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=lU(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,U.useEffect)(()=>()=>te(),[]),(0,G.jsxs)(`div`,{className:ZI([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:KK(M,w),onContextMenu:KK(N,w),onWheel:KK(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=HU(e.nativeEvent,T.current);A.current={x:o,y:c};let l=CU({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),te())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),te()}:void 0,onPointerDownCapture:C?F:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:w,style:VK,children:[h,(0,G.jsx)(GK,{})]})}function YK({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,FH.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function XK({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=RG(),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t)return u.current=LW({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{YK({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,U.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var ZK=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function QK(){let e=RG();return(0,U.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=ZK(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=xU(t,i));let{position:a,positionAbsolute:s}=rU({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var $K=(0,U.createContext)(null),eq=$K.Provider;$K.Consumer;var tq=()=>(0,U.useContext)($K),nq=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),rq=(0,U.createContext)(null);function iq({children:e}){let t=LG(nq,NG);return(0,G.jsx)(rq.Provider,{value:t,children:e})}function aq(){let e=(0,U.useContext)(rq);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var oq={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},sq=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return oq;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===zH.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function cq({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=RG(),_=tq(),{connectOnClick:v,noPanClassName:y,rfId:b}=aq(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=LG(sq(_,m,e),NG);_||g.getState().onError?.(`010`,FH.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(TK(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=VU(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();qW.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,G.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:ZI([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=RU(t.target),h=n||c,{connection:v,isValid:y}=qW.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var lq=(0,U.memo)(OK(cq));function uq({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,G.jsxs)(G.Fragment,{children:[e?.label,(0,G.jsx)(lq,{type:`source`,position:n,isConnectable:t})]})}function dq({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(lq,{type:`target`,position:n,isConnectable:t}),e?.label,(0,G.jsx)(lq,{type:`source`,position:r,isConnectable:t})]})}function fq(){return null}function pq({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(lq,{type:`target`,position:n,isConnectable:t}),e?.label]})}var mq={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},hq={input:uq,default:dq,output:pq,group:fq};function gq(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var _q=e=>{let{width:t,height:n,x:r,y:i}=QH(e.nodeLookup,{filter:e=>!!e.selected});return{width:yU(t)?t:null,height:yU(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function vq({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=RG(),{width:i,height:a,transformString:o,userSelectionActive:s}=LG(_q,NG),c=QK(),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(XK({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,G.jsx)(`div`,{className:ZI([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,G.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(mq,e.key)&&(e.preventDefault(),c({direction:mq[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var yq=typeof window<`u`?window:void 0,bq=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function xq({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:ee,isControlledViewport:F}){let{nodesSelectionActive:I,userSelectionActive:L}=LG(bq,NG),te=fK(l,{target:yq}),ne=fK(h,{target:yq}),re=ne||w,R=ne||b,ie=u&&re!==!0,ae=te||L||ie;return zK({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,G.jsx)(UK,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&re,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:ee,isControlledViewport:F,paneClickDistance:s,selectionOnDrag:ie,children:(0,G.jsxs)(JK,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:ie,children:[e,I&&(0,G.jsx)(vq,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}xq.displayName=`FlowRenderer`;var Sq=(0,U.memo)(xq),Cq=e=>t=>e?$H(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function wq(e){return LG((0,U.useCallback)(Cq(e),[e]),NG)}var Tq=e=>e.updateNodeInternals;function Eq(){let e=LG(Tq),[t]=(0,U.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,U.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Dq({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=RG(),a=(0,U.useRef)(null),o=(0,U.useRef)(null),s=(0,U.useRef)(e.sourcePosition),c=(0,U.useRef)(e.targetPosition),l=(0,U.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,U.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,U.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,U.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Oq({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=LG(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},NG),S=y.type||`default`,C=g?.[S]||hq[S];C===void 0&&(v?.(`003`,FH.error003(S)),S=`default`,C=g?.default||hq.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=RG(),k=jU(y),A=Dq({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=XK({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=QK();if(y.hidden)return null;let N=AU(y),P=gq(y),ee=T||w||t||n||r||i,F=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&YK({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(BU(t.nativeEvent)||m)){if(LH.includes(t.key)&&T){let n=t.key===`Escape`;YK({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(mq,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:mq[t.key],factor:t.shiftKey?4:1})}}},ie=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&($H(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,G.jsx)(`div`,{className:ZI([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:I,onMouseLeave:L,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?ie:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${VG}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,G.jsx)(eq,{value:e,children:(0,G.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var kq=(0,U.memo)(Oq),Aq=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function jq(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=LG(Aq,NG),a=wq(e.onlyRenderVisibleElements),o=Eq();return(0,G.jsx)(`div`,{className:`react-flow__nodes`,style:VK,children:a.map(a=>(0,G.jsx)(kq,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}jq.displayName=`NodeRenderer`;var Mq=(0,U.memo)(jq);function Nq(e){return LG((0,U.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&XU({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),NG)}var Pq=({color:e=`none`,strokeWidth:t=1})=>(0,G.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),Fq=({color:e=`none`,strokeWidth:t=1})=>(0,G.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),Iq={[WH.Arrow]:Pq,[WH.ArrowClosed]:Fq};function Lq(e){let t=RG();return(0,U.useMemo)(()=>Object.prototype.hasOwnProperty.call(Iq,e)?Iq[e]:(t.getState().onError?.(`009`,FH.error009(e)),null),[e])}var Rq=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Lq(t);return c?(0,G.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,G.jsx)(c,{color:n,strokeWidth:o})}):null},zq=({defaultColor:e,rfId:t})=>{let n=LG(e=>e.edges),r=LG(e=>e.defaultEdgeOptions),i=(0,U.useMemo)(()=>pW(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,G.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,G.jsx)(`defs`,{children:i.map(e=>(0,G.jsx)(Rq,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};zq.displayName=`MarkerDefinitions`;var Bq=(0,U.memo)(zq);function Vq({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,U.useState)({x:1,y:0,width:0,height:0}),p=ZI([`react-flow__edge-textwrapper`,l]),m=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,G.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,G.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,G.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Vq.displayName=`EdgeText`;var Hq=(0,U.memo)(Vq);function Uq({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`path`,{...u,d:e,fill:`none`,className:ZI([`react-flow__edge-path`,u.className])}),l?(0,G.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&yU(t)&&yU(n)?(0,G.jsx)(Hq,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Wq({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function Gq({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=Wq({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Wq({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=WU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function Kq(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=Gq({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,G.jsx)(Uq,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var qq=Kq({isInternal:!1}),Jq=Kq({isInternal:!0});qq.displayName=`SimpleBezierEdge`,Jq.displayName=`SimpleBezierEdgeInternal`;function Yq(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=oW({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,G.jsx)(Uq,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var Xq=Yq({isInternal:!1}),Zq=Yq({isInternal:!0});Xq.displayName=`SmoothStepEdge`,Zq.displayName=`SmoothStepEdgeInternal`;function Qq(e){return(0,U.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,G.jsx)(Xq,{...n,id:r,pathOptions:(0,U.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var $q=Qq({isInternal:!1}),eJ=Qq({isInternal:!0});$q.displayName=`StepEdge`,eJ.displayName=`StepEdgeInternal`;function tJ(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=eW({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,G.jsx)(Uq,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var nJ=tJ({isInternal:!1}),rJ=tJ({isInternal:!0});nJ.displayName=`StraightEdge`,rJ.displayName=`StraightEdgeInternal`;function iJ(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=qU({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,G.jsx)(Uq,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var aJ=iJ({isInternal:!1}),oJ=iJ({isInternal:!0});aJ.displayName=`BezierEdge`,oJ.displayName=`BezierEdgeInternal`;var sJ={default:oJ,straight:rJ,step:eJ,smoothstep:Zq,simplebezier:Jq},cJ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},lJ=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,uJ=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,dJ=`react-flow__edgeupdater`;function fJ({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,G.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:ZI([dJ,`${dJ}-${s}`]),cx:lJ(t,r,e),cy:uJ(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function pJ({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=RG(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;qW.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,G.jsxs)(G.Fragment,{children:[(e===!0||e===`source`)&&(0,G.jsx)(fJ,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,G.jsx)(fJ,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function mJ({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=LG(t=>t.edgeLookup.get(e)),b=LG(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||sJ[x];S===void 0&&(_?.(`011`,FH.error011(x)),x=`default`,S=h?.default||sJ.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,U.useRef)(null),[D,O]=(0,U.useState)(!1),[k,A]=(0,U.useState)(!1),j=RG(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L}=LG((0,U.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return cJ;let i=cW({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=YU({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||cJ,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),NG),te=(0,U.useMemo)(()=>y.markerStart?`url('#${fW(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,U.useMemo)(()=>y.markerEnd?`url('#${fW(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||F===null)return null;let re=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},R=a?e=>{a(e,{...y})}:void 0,ie=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,G.jsx)(`svg`,{style:{zIndex:M},children:(0,G.jsxs)(`g`,{className:ZI([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:re,onDoubleClick:R,onContextMenu:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&LH.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${HG}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,G.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,G.jsx)(pJ,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var hJ=(0,U.memo)(mJ),gJ=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function _J({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=LG(gJ,NG),b=Nq(t);return(0,G.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,G.jsx)(Bq,{defaultColor:e,rfId:n}),b.map(e=>(0,G.jsx)(hJ,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}_J.displayName=`EdgeRenderer`;var vJ=(0,U.memo)(_J),yJ=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function bJ({children:e}){let t=RG(),n=(0,U.useRef)(null),[r]=(0,U.useState)(()=>t.getState().transform);return kK(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=yJ(r)))};return r(),t.subscribe(r)},[t]),(0,G.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:yJ(r)},children:e})}function xJ(e){let t=IK(),n=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var SJ=e=>e.panZoom?.syncViewport;function CJ(e){let t=LG(SJ),n=RG();return(0,U.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function wJ(e){return e.connection.inProgress?{...e.connection,to:SU(e.connection.to,e.transform)}:{...e.connection}}function TJ(e){return e?t=>e(wJ(t)):wJ}function EJ(e){return LG(TJ(e),NG)}var DJ=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function OJ({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=LG(DJ,NG);return a&&i&&c?(0,G.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,G.jsx)(`g`,{className:ZI([`react-flow__connection`,KH(s)]),children:(0,G.jsx)(kJ,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var kJ=({style:e,type:t=UH.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=EJ();if(!i)return;if(n)return(0,G.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:KH(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case UH.Bezier:[m]=qU(h);break;case UH.SimpleBezier:[m]=Gq(h);break;case UH.Step:[m]=oW({...h,borderRadius:0});break;case UH.SmoothStep:[m]=oW(h);break;default:[m]=eW(h)}return(0,G.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};kJ.displayName=`ConnectionLine`;var AJ={};function jJ(e=AJ){(0,U.useRef)(e),RG(),(0,U.useEffect)(()=>{},[e])}function MJ(){RG(),(0,U.useRef)(!1),(0,U.useEffect)(()=>{},[])}function NJ({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:z,onViewportChange:we,nodesDraggable:Te}){return jJ(e),jJ(t),MJ(),xJ(n),CJ(z),(0,G.jsx)(Sq,{onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:we,isControlledViewport:!!z,children:(0,G.jsxs)(bJ,{children:[(0,G.jsx)(vJ,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:T,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:M,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,G.jsx)(OJ,{style:h,type:m,component:g,containerStyle:_}),(0,G.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,G.jsx)(Mq,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:T,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Te}),(0,G.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}NJ.displayName=`GraphView`;var PJ=(0,U.memo)(NJ),FJ=bU(`React Flow`,`https://reactflow.dev/`),IJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??IH;jW(h,g,_);let{nodesInitialized:x}=SW(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=DU(QH(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:IH,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:zH.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...HH},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:FJ,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:RH,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},LJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>MG((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await nU({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...IJ({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=SW(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();jW(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=OW(e,n,r,i,a,o,l);d&&(yW(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=uW(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=DW(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(vK(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(yK(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>bK(e,!0)));return}i(xK(r,new Set([...e]),!0)),a(xK(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>bK(e,!0)));return}a(xK(n,new Set([...e]))),i(xK(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(bK(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(bK(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,bK(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,bK(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(SW(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return kW({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...HH}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...IJ()})}},Object.is);function RJ({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,U.useState)(()=>LJ({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,G.jsx)(FG,{value:m,children:(0,G.jsx)(NK,{children:(0,G.jsx)(iq,{children:p})})})}function zJ({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,U.useContext)(PG)?(0,G.jsx)(G.Fragment,{children:e}):(0,G.jsx)(RJ,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var BJ={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function VJ({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:F,connectionMode:I,connectionLineType:L=UH.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=VH.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=OU()?`Meta`:`Control`,zoomActivationKeyCode:le=OU()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=rK,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=iK,minZoom:Ce=.5,maxZoom:z=2,translateExtent:we=IH,preventScrolling:Te=!0,nodeExtent:Ee,defaultMarkerColor:De=`#b1b1b7`,zoomOnScroll:Oe=!0,zoomOnPinch:ke=!0,panOnScroll:Ae=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Me=BH.Free,zoomOnDoubleClick:Ne=!0,panOnDrag:Pe=!0,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be=1,nodeClickDistance:Ve=0,children:V,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe=10,onNodesChange:Ze,onEdgesChange:Qe,noDragClassName:$e=`nodrag`,noWheelClassName:et=`nowheel`,noPanClassName:tt=`nopan`,fitView:nt,fitViewOptions:rt,connectOnClick:it,attributionPosition:at,proOptions:H,defaultEdgeOptions:ot,elevateNodesOnSelect:st=!0,elevateEdgesOnSelect:ct=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanOnSelection:ft=!0,autoPanSpeed:pt,connectionRadius:mt,isValidConnection:W,onError:ht,style:gt,id:_t,nodeDragThreshold:vt,connectionDragThreshold:yt,viewport:bt,onViewportChange:xt,width:St,height:Ct,colorMode:wt=`light`,debug:Tt,onScroll:Et,ariaLabelConfig:Dt,zIndexMode:Ot=`basic`,...kt},At){let jt=_t||`1`,Mt=uK(wt),Nt=(0,U.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Et?.(e)},[Et]);return(0,G.jsx)(`div`,{"data-testid":`rf__wrapper`,...kt,onScroll:Nt,style:{...gt,...BJ},ref:At,className:ZI([`react-flow`,i,Mt]),id:_t,role:`application`,children:(0,G.jsxs)(zJ,{nodes:e,edges:t,width:St,height:Ct,fitView:nt,fitViewOptions:rt,minZoom:Ce,maxZoom:z,nodeOrigin:ve,nodeExtent:Ee,zIndexMode:Ot,children:[(0,G.jsx)(cK,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:Ce,maxZoom:z,nodeExtent:Ee,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:ue,snapGrid:de,connectionMode:I,translateExtent:we,connectOnClick:it,defaultEdgeOptions:ot,fitView:nt,fitViewOptions:rt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:tt,nodeOrigin:ve,rfId:jt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:ht,connectionRadius:mt,isValidConnection:W,selectNodesOnDrag:pe,nodeDragThreshold:vt,connectionDragThreshold:yt,onBeforeDelete:F,debug:Tt,ariaLabelConfig:Dt,zIndexMode:Ot}),(0,G.jsx)(PJ,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ie,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:R,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:we,minZoom:Ce,maxZoom:z,preventScrolling:Te,zoomOnScroll:Oe,zoomOnPinch:ke,zoomOnDoubleClick:Ne,panOnScroll:Ae,panOnScrollSpeed:je,panOnScrollMode:Me,panOnDrag:Pe,autoPanOnSelection:ft,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be,nodeClickDistance:Ve,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe,defaultMarkerColor:De,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:jt,disableKeyboardA11y:lt,nodeExtent:Ee,viewport:bt,onViewportChange:xt,nodesDraggable:me}),(0,G.jsx)(nK,{onSelectionChange:k}),V,(0,G.jsx)(XG,{proOptions:H,position:at}),(0,G.jsx)(qG,{rfId:jt,disableKeyboardA11y:lt})]})})}var HJ=OK(VJ);FH.error014();function UJ({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,G.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ZI([`react-flow__background-pattern`,n,r])})}function WJ({radius:e,className:t}){return(0,G.jsx)(`circle`,{cx:e,cy:e,r:e,className:ZI([`react-flow__background-pattern`,`dots`,t])})}var GJ;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})(GJ||={});var KJ={[GJ.Dots]:1,[GJ.Lines]:1,[GJ.Cross]:6},qJ=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function JJ({id:e,variant:t=GJ.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,U.useRef)(null),{transform:f,patternId:p}=LG(qJ,NG),m=r||KJ[t],h=t===GJ.Dots,g=t===GJ.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,G.jsxs)(`svg`,{className:ZI([`react-flow__background`,l]),style:{...c,...VK,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,G.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,G.jsx)(WJ,{radius:y/2,className:u}):(0,G.jsx)(UJ,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,G.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}JJ.displayName=`Background`;var YJ=(0,U.memo)(JJ);function XJ(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,G.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function ZJ(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,G.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function QJ(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,G.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function $J(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,G.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function eY(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,G.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function tY({children:e,className:t,...n}){return(0,G.jsx)(`button`,{type:`button`,className:ZI([`react-flow__controls-button`,t]),...n,children:e})}var nY=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function rY({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=RG(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=LG(nY,NG),{zoomIn:y,zoomOut:b,fitView:x}=IK();return(0,G.jsxs)(JG,{className:ZI([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(tY,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,G.jsx)(XJ,{})}),(0,G.jsx)(tY,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,G.jsx)(ZJ,{})})]}),n&&(0,G.jsx)(tY,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,G.jsx)(QJ,{})}),r&&(0,G.jsx)(tY,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,G.jsx)(eY,{}):(0,G.jsx)($J,{})}),u]})}rY.displayName=`Controls`;var iY=(0,U.memo)(rY);function aY({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,G.jsx)(`rect`,{className:ZI([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var oY=(0,U.memo)(aY),sY=e=>e.nodes.map(e=>e.id),cY=e=>e instanceof Function?e:()=>e;function lY({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=oY,onClick:o}){let s=LG(sY,NG),c=cY(t),l=cY(e),u=cY(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,G.jsx)(G.Fragment,{children:s.map(e=>(0,G.jsx)(dY,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function uY({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=LG(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=AU(r);return{node:r,x:i,y:a,width:o,height:s}},NG);return!l||l.hidden||!jU(l)?null:(0,G.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var dY=(0,U.memo)(uY),fY=(0,U.memo)(lY),pY=200,mY=150,hY=e=>!e.hidden,gY=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?hU(QH(e.nodeLookup,{filter:hY}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},_Y=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,vY=(e,t)=>_Y(e.viewBB,t.viewBB)&&_Y(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,yY=`react-flow__minimap-desc`;function bY({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=RG(),S=(0,U.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=LG(gY,vY),j=e?.width??pY,M=e?.height??mY,N=C.width/j,P=C.height/M,ee=Math.max(N,P),F=ee*j,I=ee*M,L=b*ee,te=C.x-(F-C.width)/2-L,ne=C.y-(I-C.height)/2-L,re=F+L*2,R=I+L*2,ie=`${yY}-${T}`,ae=(0,U.useRef)(0),oe=(0,U.useRef)();ae.current=ee,(0,U.useEffect)(()=>{if(S.current&&E)return oe.current=JW({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,U.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,U.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,G.jsx)(JG,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ee:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:ZI([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,G.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${re} ${R}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ie,ref:S,onClick:se,children:[le&&(0,G.jsx)(`title`,{id:ie,children:le}),(0,G.jsx)(fY,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,G.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-L},${ne-L}h${re+L*2}v${R+L*2}h${-re-L*2}z
95
- M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}bY.displayName=`MiniMap`,(0,U.memo)(bY);var xY=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,SY={[lG.Line]:`right`,[lG.Handle]:`bottom-right`};function CY({nodeId:e,position:t,variant:n=lG.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=tq(),y=typeof e==`string`?e:v,b=RG(),x=(0,U.useRef)(null),S=n===lG.Handle,C=LG((0,U.useCallback)(xY(S&&p),[S,p]),NG),w=(0,U.useRef)(null),T=t??SY[n];return(0,U.useEffect)(()=>{if(!(!x.current||!y))return w.current||=bG({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=DW([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...MU({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,G.jsx)(`div`,{className:ZI([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,U.memo)(CY);function wY(e){return e.graph??void 0}function TY(e){return{run:e.run_node_sets??[],nodes:new Map(e.plan.tasks.map(e=>[e.id,e.sets??[]]))}}function EY(e){let t=wY(e);if(!t)return[];let n=new Map(e.run.nodes.map(e=>[e.node,e]));return t.plan.tasks.flatMap(r=>{let i=FY(r,`kind`)===`human`?`human`:IY(r)?`lifecycle`:`agent`,a=t.node_results[r.id]??t.result?.results?.[r.id],o=t.node_status[r.id];return o===void 0?[]:[{id:r.id,label:FY(r,`name`)??r.id,status:o,kind:i,task:r,telemetry:n.get(r.id),result:a,detail:e.node_details[r.id],control:t.node_control[r.id],failure:n.get(r.id)?.failure,blockers:[...t.node_gated_by[r.id]??[],...a?.blocked_by??[]]}]})}function DY(e){switch(e?.launcher){case`claude-code`:return`Claude`;case`codex`:return`Codex`;default:return`Unattributed`}}function OY(e){let t=DY(e);return e?.session_key===void 0?e===void 0?`Unattributed`:`${t} launch · ${LY(e.launch_id)}`:`${t} session · ${LY(e.session_key)}`}function kY(e){if(e.blockers.length>0&&jY.has(e.status))return`blocked by ${e.blockers.join(`, `)}`;if(MY.has(e.status))return AY(e)??`${e.status}, with no reason recorded`}function AY(e){return(e.failure?.detail||e.result?.detail||e.result?.error||e.telemetry?.outcome||e.result?.outcome)?.trim()||void 0}var jY=new Set([`blocked`,`skipped`,`waiting`]),MY=new Set([`failed`,`not-completed`,`cancelled`]);function NY(e){let t=HI,n=t=>(e[t]??0)>0;return[...t.filter(n),...Object.keys(e).filter(e=>!t.includes(e)).sort().filter(n)].map(t=>`${e[t]} ${t}`).join(` · `)}function PY(e){return MY.has(e)||e===`blocked`||e===`skipped`}function FY(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function IY(e){return`repo`in e||`steps`in e}function LY(e){return e.length>12?`${e.slice(0,8)}…`:e}function RY({data:e}){let t=e.style===`success`?St:e.style===`danger`||e.style===`muted`?un:e.style===`active`?Dt:At;return(0,G.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:H(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,G.jsx)(lq,{type:`target`,position:$.Left}),(0,G.jsxs)(`div`,{className:`node-heading`,children:[(0,G.jsx)(Ma,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,G.jsx)(t,{className:H(e.style===`active`&&`spin`),size:17})]}),(0,G.jsx)(`strong`,{children:e.label}),(0,G.jsx)(`span`,{className:`node-status`,children:e.state}),e.reason!==void 0&&(0,G.jsx)(`span`,{className:`node-reason`,title:e.reason,children:e.reason}),(0,G.jsx)(lq,{type:`source`,position:$.Right})]})}function zY({data:e,id:t,markerEnd:n,style:r}){return(0,G.jsx)(Uq,{id:t,path:BY(e?.points??[]),markerEnd:n,style:r})}function BY(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var VY={dagNode:RY},HY={routed:zY};function UY({nodes:e,selectedNodeId:t,onSelectNode:n}){let r=(0,U.useMemo)(()=>{let t=new Map;for(let n of e)PY(n.status)&&t.set(n.id,kY(n));return t},[e]),{nodes:i,edges:a}=(0,U.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),i=XI({nodes:e.map(e=>({id:e.id,label:e.label,kind:e.kind,state:e.status})),edges:e.flatMap(e=>(e.task.deps??[]).filter(e=>n.has(e)).map(t=>({id:`${t}->${e.id}`,source:t,target:e.id})))});return{nodes:i.nodes.map(e=>({id:e.id,type:`dagNode`,position:{x:e.x,y:e.y},data:{label:e.label,kind:e.kind,state:e.state,style:e.style,selected:e.id===t,...r.get(e.id)===void 0?{}:{reason:r.get(e.id)}},width:e.width,height:e.height})),edges:i.edges.map(t=>({id:t.id,source:t.source,target:t.target,type:`routed`,data:{points:t.points},animated:e.find(({id:e})=>e===t.target)?.status===`running`}))}},[e,r,t]);return(0,G.jsxs)(`div`,{className:`graph-wrap`,children:[(0,G.jsxs)(HJ,{nodes:i,edges:a,colorMode:`dark`,nodeTypes:VY,edgeTypes:HY,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,onNodeClick:(e,t)=>n(t.id),"aria-label":`DAG execution graph`,children:[(0,G.jsx)(YJ,{color:`var(--border)`,gap:22}),(0,G.jsx)(iY,{showInteractive:!1})]}),(0,G.jsx)(`ol`,{className:`accessible-node-list`,"aria-label":`DAG nodes`,children:e.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.label,`: `,e.status,r.get(e.id)===void 0?``:` — ${r.get(e.id)}`]})},e.id))})]})}function WY({className:e,state:t}){let n=GY(t);return(0,G.jsxs)(Ma,{className:H(`gap-1.5 tracking-[.03em] uppercase`,n&&qY[n],e),variant:`outline`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function GY(e){return $Y[e]}var KY=e=>{let t=GY(e);return H(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:JY[t])},qY={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},JY={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},YY=`success`,XY=`destructive`,ZY=`warning`,QY={blocked:ZY,cancelled:XY,done:YY,failed:XY,"not-completed":XY,parked:void 0,pending:void 0,running:`info`,skipped:ZY,unknown:void 0,waiting:void 0},$Y={...QY,complete:QY.done,settled:QY.done,active:QY.running},eX={graph:`graph`,overall:`overall`,channel:`channel`,reads:`reads`,agents:`agents`};function tX(e){return e!==null&&Object.hasOwn(eX,e)}var nX={projects:`projects`,runs:`runs`};function rX(e){return e!==null&&Object.hasOwn(nX,e)}var iX=`none`,aX={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:OA.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:OA.detailed}};function oX(e){return e!==null&&Object.hasOwn(aX,e)}var sX={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,pr:`PR`,checks:`Checks`,agents:`Agents`};function cX(e){return e!==null&&Object.hasOwn(sX,e)}function lX(e){let t=[...e].some(e=>e.charCodeAt(0)<32);return e.length>0&&e.length<=512&&!t&&!/[/?#]/u.test(e)}function uX(e,t){let n=e.get(t);return n!==null&&lX(n)?n:void 0}function dX(){let e=(0,U.useSyncExternalStore)(fX,pX,pX),t=new URLSearchParams(e),n=t.get(`list`),r=rX(n)?n:`projects`,i=t.get(`project`),a=i!==null&&(i===`none`||qj(i))?i:void 0,o=uX(t,`run`),s=uX(t,`node`),c=uX(t,`event`),l=t.get(`view`),u=t.get(`tab`),d=t.get(`detail`),f=oX(d)?d:`activity`,p=cX(u)?u:`timeline`,m=tX(l)?l:s===void 0?`overall`:`graph`,h=(0,U.useCallback)(e=>{let t=new URLSearchParams(window.location.search);e(t),window.history.pushState(null,``,`${window.location.pathname}?${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{list:r,projectKey:a,runId:o,nodeId:s,itemId:c,view:m,detail:f,nodeTab:p,selectList:e=>h(t=>{e===`projects`?t.delete(`list`):t.set(`list`,e),t.delete(`project`)}),selectProject:e=>h(t=>{e===void 0?t.delete(`project`):t.set(`project`,e),t.delete(`list`),t.delete(`run`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectRun:e=>h(t=>{t.set(`run`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>h(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>h(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>h(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectDetail:e=>h(t=>{e===`activity`?t.delete(`detail`):t.set(`detail`,e)}),selectNodeTab:e=>h(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)}),selectView:e=>h(t=>{t.set(`view`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)})}}function fX(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function pX(){return window.location.search}var mX=`(no project)`;function hX(e){return e.project===null?mX:e.name??e.project}function gX(e){return e.project===null?e.name??void 0:e.name===null?void 0:e.project}function _X(e){return e.project??`none`}function vX(e,t){return e.find(e=>_X(e)===t)}function yX(e){let t=new Map;for(let n of e)t.set(n.state,(t.get(n.state)??0)+1);return[...t].map(([e,t])=>`${t} ${e}`).join(` · `)}function bX(e){return`${e.length} ${e.length===1?`run`:`runs`}`}function xX(e){if(e.agent_count!==void 0)return`${e.agent_count} ${e.agent_count===1?`agent`:`agents`}`}function SX({groups:e,selectedKey:t,onSelect:n}){return(0,G.jsx)(`ul`,{"aria-label":`Project rows`,className:`run-list project-rows`,children:e.map(e=>{let r=_X(e),i=t===r;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{"aria-current":i?`page`:void 0,className:`run-link`,"data-active":i,onClick:()=>n(r),type:`button`,children:[(0,G.jsxs)(`span`,{className:`run-link-main`,children:[(0,G.jsx)(Nt,{"aria-hidden":`true`,size:13}),(0,G.jsx)(`span`,{children:hX(e)})]}),(0,G.jsx)(wt,{"aria-hidden":`true`,size:14}),gX(e)!==void 0&&(0,G.jsx)(`span`,{className:`run-link-counts`,title:gX(e),children:gX(e)}),(0,G.jsx)(`span`,{className:`run-link-counts`,children:[bX(e.runs),yX(e.runs),xX(e)].filter(Boolean).join(` · `)}),(0,G.jsx)(`span`,{className:`run-link-tag`,children:e.last_write_at===null?`never written`:(0,G.jsx)(ZP,{at:YP(e.last_write_at),relative:!0})})]})},r)})})}var CX={projects:`Projects`,runs:`Runs`};function wX({list:e,onSelectList:t,projects:n,selectedProjectKey:r,onSelectProject:i,runs:a,selectedRunId:o,liveRunIds:s,onSelect:c,hasMore:l,loadingMore:u,onLoadMore:d,hostActions:f}){return(0,G.jsx)(`nav`,{"aria-label":e===`runs`?`DAG runs`:`Projects`,className:`run-nav`,onScrollCapture:e=>{let t=e.target;l&&t.scrollHeight-t.scrollTop<=t.clientHeight+80&&d()},children:(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,G.jsxs)(`div`,{className:`brand`,children:[(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,G.jsx)(ht,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,G.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,G.jsx)(bf,{className:`my-[22px]`}),f,(0,G.jsxs)(`fieldset`,{className:`detail-switch list-switch`,children:[(0,G.jsx)(`legend`,{className:`sr-only`,children:`Which list`}),Object.values(nX).map(n=>(0,G.jsx)(Pa,{"aria-pressed":e===n,onClick:()=>t(n),size:`sm`,type:`button`,variant:e===n?`default`:`outline`,children:CX[n]},n))]}),e===`projects`?n===void 0?(0,G.jsx)(`p`,{"aria-live":`polite`,className:`run-list-status`,children:`Loading projects…`}):(0,G.jsx)(SX,{groups:n,onSelect:i,selectedKey:r}):(0,G.jsx)(`div`,{className:`run-list`,children:a.map(e=>{let t=o===e.run_id,n=s.has(e.run_id),r=NY(e.node_counts);return(0,G.jsxs)(`button`,{"aria-current":t?`page`:void 0,className:`run-link`,"data-active":t,onClick:()=>c(e.run_id),type:`button`,children:[(0,G.jsxs)(`span`,{className:`run-link-main`,children:[n?(0,G.jsxs)(fm,{children:[(0,G.jsx)(pm,{asChild:!0,children:(0,G.jsx)(`span`,{"aria-label":`Live`,className:H(`run-dot`,KY(e.state)),"data-live":`true`,role:`img`})}),(0,G.jsx)(mm,{children:`Live`})]}):(0,G.jsx)(`span`,{"aria-label":`Historical`,className:H(`run-dot`,KY(e.state)),role:`img`}),(0,G.jsx)(`span`,{children:e.run_id})]}),(0,G.jsx)(wt,{"aria-hidden":`true`,size:14}),(0,G.jsx)(`span`,{className:`run-link-counts`,title:r,children:[e.state,r].filter(Boolean).join(` · `)}),(0,G.jsxs)(`span`,{className:`run-link-tag`,children:[(0,G.jsx)(bt,{"aria-hidden":`true`,size:11}),OY(e.launch)]})]},e.run_id)})}),e===`runs`&&l&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{className:`sr-only`,onClick:()=>void d(),type:`button`,children:`Load more runs`}),(0,G.jsx)(`p`,{"aria-live":`polite`,className:`run-list-status`,children:u?`Loading more runs…`:``})]})]})})})}function TX({groups:e,error:t,onSelect:n}){return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`section`,{"aria-labelledby":`projects-heading`,className:`projects-landing`,children:[(0,G.jsx)(`h2`,{id:`projects-heading`,children:`Projects`}),(0,G.jsx)(`p`,{className:`projects-lede`,children:`Every project with a run under this root, newest activity first.`}),t&&(0,G.jsx)(OX,{error:t,what:`The project list`}),e===void 0?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),(0,G.jsx)(xf,{className:`h-2 w-32`}),`Loading projects…`]}):e.length===0?(0,G.jsxs)(`div`,{className:`empty-state`,children:[(0,G.jsx)(Nt,{size:34}),(0,G.jsx)(`h2`,{children:`No DAG runs found`}),(0,G.jsx)(`p`,{children:`Start an orchestrated run to see its project appear here.`})]}):(0,G.jsx)(`ul`,{"aria-label":`Projects`,className:`project-cards`,children:e.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`project-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`button`,{className:`project-card-open`,onClick:()=>n(_X(e)),type:`button`,children:[(0,G.jsx)(`span`,{className:`project-card-name`,children:hX(e)}),(0,G.jsx)(wt,{"aria-hidden":`true`,size:14})]}),gX(e)!==void 0&&(0,G.jsx)(`p`,{className:`project-card-id`,children:gX(e)}),(0,G.jsxs)(`p`,{className:`project-card-facts`,children:[bX(e.runs),e.runs.length>0&&` · ${yX(e.runs)}`,xX(e)!==void 0&&` · ${xX(e)}`]}),(0,G.jsx)(`p`,{className:`project-card-facts`,children:e.last_write_at===null?`never written`:(0,G.jsxs)(G.Fragment,{children:[`Last activity`,` `,(0,G.jsx)(ZP,{at:YP(e.last_write_at),relative:!0})]})})]})})},_X(e)))})]})})}function EX({projectKey:e,group:t,error:n,loading:r,agents:i,onSelectRun:a}){return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`section`,{"aria-labelledby":`project-heading`,className:`projects-landing`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Project`}),(0,G.jsx)(`h2`,{id:`project-heading`,children:t===void 0?e:hX(t)}),t!==void 0&&gX(t)!==void 0&&(0,G.jsx)(`p`,{className:`project-card-id`,children:gX(t)}),t&&(0,G.jsxs)(`p`,{className:`projects-lede`,children:[bX(t.runs),t.runs.length>0&&` · ${yX(t.runs)}`,xX(t)!==void 0&&` · ${xX(t)}`,t.last_write_at!==null&&(0,G.jsxs)(G.Fragment,{children:[` · last activity `,(0,G.jsx)(ZP,{at:YP(t.last_write_at),relative:!0})]})]}),n&&(0,G.jsx)(OX,{error:n,what:`This project`}),r?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),(0,G.jsx)(xf,{className:`h-2 w-32`}),`Loading project…`]}):t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ul`,{"aria-label":`Runs of ${hX(t)}`,className:`project-runs`,children:t.runs.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(DX,{onSelect:a,run:e})},e.run_id))}),i]}):null]})})}function DX({run:e,onSelect:t}){let n=NY(e.node_counts);return(0,G.jsxs)(`button`,{"aria-label":`Open ${e.run_id}`,className:`project-run`,onClick:()=>t(e.run_id),type:`button`,children:[(0,G.jsx)(`span`,{className:`project-run-id`,children:e.run_id}),(0,G.jsxs)(`span`,{className:`project-run-facts`,children:[(0,G.jsx)(WY,{state:e.state}),e.liveness!==void 0&&(0,G.jsx)(Ma,{variant:`outline`,children:e.liveness}),e.unread_surfaces!==void 0&&e.unread_surfaces>0&&(0,G.jsxs)(Ma,{variant:`secondary`,children:[e.unread_surfaces,` unread`,` `,e.unread_surfaces===1?`surface`:`surfaces`]})]}),(0,G.jsxs)(`span`,{className:`project-run-facts project-run-detail`,children:[n&&(0,G.jsx)(`span`,{children:n}),(0,G.jsx)(`span`,{children:e.last_progress_at===void 0?`never written`:(0,G.jsxs)(G.Fragment,{children:[`Last write`,` `,(0,G.jsx)(ZP,{at:YP(e.last_progress_at*1e3),relative:!0})]})})]})]})}function OX({error:e,what:t}){return(0,G.jsxs)(sa,{className:`mb-4`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsxs)(ca,{children:[t,` could not be read`]}),(0,G.jsx)(la,{children:e.message})]})}function kX(e,t,n){let{value:r,error:i}=WM(n?`projects`:void 0,()=>e.listProjects(),t);return{list:r,error:i}}function AX(e,t,n){let{value:r,error:i,loading:a}=WM(t,()=>t===`none`?e.listProjects().then(e=>{let t=vX(e.projects,iX);if(t===void 0)throw Error(`no runs without a project`);return t}):e.getProject(t??``),n);return{group:r,error:i,loading:a}}function jX(e,t,n,r,i=!0){let[a,o]=(0,U.useState)(),[s,c]=(0,U.useState)(),[l,u]=(0,U.useState)(!0),[d,f]=(0,U.useState)(),[p,m]=(0,U.useState)([]),[h,g]=(0,U.useState)(),[_,v]=(0,U.useState)(),[y,b]=(0,U.useState)(0),[x,S]=(0,U.useState)(!1),C=a===void 0?void 0:a.runs.some(({run_id:e})=>e===t)?t:t!==void 0||i?a.runs.at(0)?.run_id:void 0,[w,T]=(0,U.useState)(0),E=n===void 0?void 0:n.nodeId??`run`,D=(0,U.useRef)(C);(0,U.useEffect)(()=>{D.current=C},[C]);let O=(0,U.useRef)(void 0),k=(0,U.useRef)(void 0),A=(0,U.useRef)(!1),j=(0,U.useCallback)(()=>{g(void 0),v(void 0)},[]),M=(0,U.useCallback)(async()=>{o(await e.listRuns(!0))},[e]),N=(0,U.useRef)(void 0),P=(0,U.useCallback)(async()=>{let t=a?.next_cursor;if(!(t===void 0||N.current===t)){N.current=t,S(!0);try{let n=await e.listRuns(!0,t);o(e=>e===void 0?n:{...n,runs:[...e.runs,...n.runs.filter(({run_id:t})=>!e.runs.some(e=>e.run_id===t))]}),j()}catch(e){g(FX(e))}finally{N.current=void 0,S(!1)}}},[e,a,j]),ee=(0,U.useCallback)(async t=>{let n=await e.selectRuns([t]);o(e=>{if(e===void 0)return e;if(n.missing?.includes(t)===!0)return{...e,runs:e.runs.filter(e=>e.run_id!==t)};let r=n.runs.find(e=>e.run_id===t);return r===void 0?e:{...e,runs:e.runs.some(e=>e.run_id===t)?e.runs.map(e=>e.run_id===t?r:e):[r,...e.runs]}})},[e]),F=(0,U.useCallback)(async()=>{try{await M(),j()}catch(e){g(FX(e))}finally{u(!1)}},[M,j]),I=(0,U.useCallback)(async()=>{await F(),b(e=>e+1)},[F]);(0,U.useEffect)(()=>{if(C===void 0){c(void 0),k.current=void 0;return}let t=e=>e.runId===C&&e.timelineScope===E&&e.filter===r,i=NX(C,E,r);O.current=i,c(e=>{if(e!==void 0&&t(e))return e;let n=e?.runId===C&&e.filter===r&&e.detail!==void 0?e.detail:void 0;return{runId:C,filter:r,timelineScope:E,...n===void 0?{}:{detail:n}}});let a=e=>{c(n=>n!==void 0&&t(n)?e(n):n)},o=e=>{O.current===i&&e()},s=k.current;if(s?.key===i){s.again=!0;return}let l=()=>{k.current={key:i,again:!1};let t=()=>{let e=k.current;if(e?.key===i){if(e.again){l();return}k.current=void 0}},s=e.getRun(C,{includeConversations:!1,filter:r}).then(e=>{a(t=>({...t,detail:e})),o(j)}).catch(MX).catch(e=>{o(()=>g(FX(e)))}),c=n===void 0?Promise.resolve():e.getTimeline(C,n.nodeId,r).then(e=>a(t=>({...t,timeline:e,timelineError:void 0}))).catch(MX).catch(e=>a(t=>({...t,timelineError:FX(e)})));Promise.all([s,c]).then(t,t)};l()},[e,C,y,n?.nodeId,E,r]),(0,U.useEffect)(()=>{F();let t=e.subscribe({onEvent:e=>{if(f(new Date().toISOString()),v(void 0),e.event===`snapshot`){o(FM(e.data)),A.current&&(b(e=>e+1),T(e=>e+1)),A.current=!0;return}let t=PX(e);t!==void 0&&(T(e=>e+1),ee(t).catch(e=>g(FX(e))),t===D.current&&b(e=>e+1))},onError:e=>{v(FX(e))}});return()=>t.close()},[e,ee,F]),(0,U.useEffect)(()=>{if(C===void 0){m([]);return}let t=e.subscribe({runId:C,filter:r,onEvent:e=>{if(f(new Date().toISOString()),v(void 0),e.event!==`snapshot`){if(e.event===`activity.changed`){let t=e.data.activity;m(Kj.parse(t))}(e.event===`conversation.changed`||e.event===`activity.changed`||e.event===`run.changed`)&&b(e=>e+1)}},onError:e=>v(FX(e))});return()=>t.close()},[e,C,r]);let L=s!==void 0&&s.runId===C&&s.filter===r?s:void 0;return(0,U.useMemo)(()=>({list:a,runId:C,detail:L?.detail,timeline:L?.timeline,timelineError:L?.timelineError,loading:l,lastUpdated:d,activity:p,error:h??_,refresh:I,loadMore:P,hasMore:a?.next_cursor!==void 0,loadingMore:x,invalidations:w}),[a,C,L,l,d,p,h,_,I,P,x,w])}function MX(e){if(!(e instanceof IM&&e.code===`run_not_found`))throw e}function NX(e,t,n){return[e,t??``,n??``].join(`\0`)}function PX(e){let t=`run_id`in e.data?e.data.run_id:void 0;return typeof t==`string`&&t.length>0?t:void 0}function FX(e){return e instanceof Error?e:typeof Event<`u`&&e instanceof Event?Error(`Live telemetry stream disconnected`):Error(String(e))}var IX={minutes:60,seconds:1},LX=e=>Object.hasOwn(IX,e),RX=600%IX.minutes==0?{amount:String(600/IX.minutes),unit:`minutes`}:{amount:`600`,unit:`seconds`};function zX(e){let t=e.amount.trim();if(!/^\d+$/u.test(t))return;let n=Number(t)*IX[e.unit];return Number.isSafeInteger(n)?n:void 0}function BX(e){if(e===0)return`no grace`;let t=Math.floor(e/60),n=e%60,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return t===0?r(n,`second`):n===0?r(t,`minute`):`${r(t,`minute`)} ${r(n,`second`)}`}function VX(e){return e.map(e=>({runId:e.run_id,owner:OY(e.launch)}))}function HX(e,t){return t instanceof IM&&t.status!==void 0&&t.code!==void 0?{phase:`refused`,sent:e,error:t}:{phase:`lost`,sent:e,error:t instanceof Error?t:Error(String(t))}}var UX={dispatchStopped:`dispatch-stopped`,hostShutdown:`host-shutdown`};function WX(e,t,n){let r=new Set(e.runs.map(({runId:e})=>e)),i=Object.values(UX);return n.flatMap(e=>{if(!r.has(e.run_id))return[];let n=e.last_event;if(n===null||!i.includes(n))return[];let a=t.get(e.run_id);return a!==void 0&&a.last_event===n&&a.last_progress_at===e.last_progress_at?[]:[{runId:e.run_id,recorded:n===UX.hostShutdown?UX.hostShutdown:UX.dispatchStopped}]})}function GX(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e)}var KX=`Each live dispatch is asked to stop and commit, and given the grace to end itself; whatever is still standing then is torn down, and every branch the run's records name is pushed to its origin. Nothing is sent until you confirm.`;function qX({open:e,onOpenChange:t,runs:n,blocked:r,unreadable:i=0,onConfirm:a}){let o=(0,U.useId)(),[s,c]=(0,U.useState)(RX),[l,u]=(0,U.useState)(!1),d=zX(s),f=n!==void 0&&r===void 0,p=()=>{c(RX),u(!1),t(!1)};return(0,G.jsx)(gc,{onOpenChange:e=>e?t(!0):p(),open:e,children:(0,G.jsxs)(bc,{className:`shutdown-dialog`,children:[(0,G.jsxs)(xc,{children:[(0,G.jsx)(Cc,{children:`Shut down the entire host?`}),(0,G.jsx)(wc,{children:KX})]}),(0,G.jsxs)(`div`,{className:`shutdown-dialog-body`,children:[r===void 0?n===void 0?(0,G.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:`Reading which runs this acts on…`}):(0,G.jsx)(YX,{caption:`It acts on all ${JX(n.length)} on this host, over their owners — each is interrupted, torn down and pushed:`,label:`Runs on this host`,runs:n,warning:!0}):(0,G.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:r}),i>0&&(0,G.jsxs)(`p`,{className:`shutdown-scope-note`,children:[i===1?`1 run root on this host could not be read`:`${i} run roots on this host could not be read`,`: the engine cannot read them either, so this shutdown signals nothing in them and pushes none of their branches.`]}),(0,G.jsxs)(`fieldset`,{className:`shutdown-grace`,children:[(0,G.jsx)(`legend`,{children:`Grace`}),(0,G.jsxs)(`div`,{className:`shutdown-grace-row`,children:[(0,G.jsx)(Oc,{className:`sr-only`,htmlFor:`${o}-grace`,children:`Grace`}),(0,G.jsx)(Tc,{"aria-describedby":`${o}-grace-help`,"aria-invalid":d===void 0,id:`${o}-grace`,inputMode:`numeric`,min:0,onChange:e=>c({...s,amount:e.target.value}),step:1,type:`number`,value:s.amount}),(0,G.jsx)(Oc,{className:`sr-only`,htmlFor:`${o}-unit`,children:`Grace unit`}),(0,G.jsx)(`select`,{className:`composer-select`,id:`${o}-unit`,onChange:e=>{let t=e.target.value;LX(t)&&c({...s,unit:t})},value:s.unit,children:Object.keys(IX).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]}),(0,G.jsx)(`p`,{className:`channel-age`,id:`${o}-grace-help`,children:d===void 0?`The grace is a whole number of minutes or seconds, 0 or more.`:`How long each live dispatch has to end itself once asked: ${BX(d)}. The engine's default is ${BX(zX(RX)??0)}.`})]}),(0,G.jsxs)(`div`,{className:`composer-check shutdown-force`,children:[(0,G.jsx)(`input`,{checked:l,id:`${o}-force`,onChange:e=>u(e.target.checked),type:`checkbox`}),(0,G.jsx)(Oc,{htmlFor:`${o}-force`,children:`Force: skip the interrupt and the wait and go straight to the teardown — whatever a worker had not committed is lost.`})]})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsx)(vc,{asChild:!0,children:(0,G.jsx)(Pa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,G.jsx)(Pa,{disabled:!f||d===void 0,onClick:()=>{d!==void 0&&(a(d,l),p())},type:`button`,variant:`destructive`,children:`Shut down the host`})]})]})})}var JX=e=>e===1?`1 run`:`${e} runs`;function YX({caption:e,label:t,runs:n,warning:r=!1}){return(0,G.jsxs)(`div`,{className:`shutdown-runs`,"data-warning":r,children:[(0,G.jsx)(`p`,{className:`shutdown-scope-note`,children:e}),(0,G.jsx)(`ul`,{"aria-label":t,children:n.map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`shutdown-run-id`,children:e.runId}),` — owned by `,e.owner]},e.runId))})]})}function XX(e,t,n){let[r,i]=(0,U.useState)(),a=ZX(r!==void 0,e,t,n);return{open:r,setOpen:i,opener:e=>()=>i(e),runs:a.rows===void 0||r===void 0?void 0:VX(a.rows),blocked:a.blocked,unreadable:e?.unreadable?.length??0}}function ZX(e,t,n,r){let i=(0,U.useRef)(new Set),a=t?.next_cursor;return(0,U.useEffect)(()=>{if(!e){i.current.clear();return}a===void 0||r||i.current.has(a)||(i.current.add(a),n())},[e,a,r,n]),t===void 0?{blocked:`Reading the runs listing this view holds…`}:a===void 0?{rows:t.runs}:!r&&i.current.has(a)?{blocked:`The rest of the runs listing could not be read (${t.runs.length} runs read), so the runs this acts on cannot all be named. Close this and try again.`}:{blocked:`Reading the rest of the runs listing so every run this acts on can be named (${t.runs.length} read so far)…`}}function QX(e,t){let[n,r]=(0,U.useState)({phase:`idle`}),i=(0,U.useRef)(!1);return{state:n,confirm:(0,U.useCallback)((n,a,o)=>{if(i.current)return;i.current=!0;let s={scope:e,runs:n,grace:a,force:o,sentAt:Date.now()};r({phase:`sending`,sent:s}),t({grace:a,force:o}).then(e=>r({phase:`answered`,sent:s,report:e}),e=>r(HX(s,e))).finally(()=>{i.current=!1})},[e,t]),dismiss:(0,U.useCallback)(()=>{i.current||r({phase:`idle`})},[])}}var $X=[`host`];function eZ(e){return{host:QX(`host`,(0,U.useCallback)(t=>e.shutdown(`host`,t),[e]))}}function tZ({list:e,loadMore:t,loadingMore:n,shutdowns:r}){let{open:i,setOpen:a,opener:o,runs:s,blocked:c,unreadable:l}=XX(e,t,n),u=r.host.state.phase===`sending`;return(0,G.jsxs)(`fieldset`,{"aria-label":`Shut down runs on this host`,className:`host-shutdown`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`This host`}),(0,G.jsx)(`div`,{className:`host-shutdown-actions`,children:(0,G.jsxs)(Pa,{disabled:u,onClick:o(`host`),size:`sm`,type:`button`,variant:`destructive`,children:[(0,G.jsx)(Xt,{size:14}),` Shut down the entire host`]})}),$X.map(e=>(0,G.jsx)(qX,{blocked:c,onConfirm:(e,t)=>s!==void 0&&r.host.confirm(s,e,t),onOpenChange:t=>a(t?e:void 0),open:i===e,runs:i===e?s:void 0,unreadable:l},e))]})}var nZ=1e3;function rZ(e,t){let[n,r]=(0,U.useState)(()=>Date.now());(0,U.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),nZ);return()=>clearInterval(e)},[]);let i=WX(e,(0,U.useRef)(new Map(t.filter(t=>e.runs.some(({runId:e})=>e===t.run_id)).map(e=>[e.run_id,e]))).current,t);return{now:n,progress:i,done:i.filter(({recorded:e})=>e===UX.hostShutdown).length,deadline:e.sentAt+e.grace*1e3,asks:!e.force&&e.grace>0}}function iZ({label:e,state:t,rows:n,onDismiss:r}){return t.phase===`idle`?null:(0,G.jsxs)(`section`,{"aria-label":e,className:`shutdown-status`,children:[t.phase===`sending`?(0,G.jsx)(oZ,{rows:n,sent:t.sent}):t.phase===`lost`?(0,G.jsxs)(sa,{"aria-label":`${e} lost`,variant:`destructive`,children:[(0,G.jsx)(on,{}),(0,G.jsx)(ca,{children:`Shutdown lost: no answer came back`}),(0,G.jsxs)(la,{children:[(0,G.jsxs)(`p`,{children:[`The request sent at `,GX(t.sent.sentAt),` ended without an answer (`,t.error.message,`). The engine may still be carrying out the shutdown — check the runs before sending another.`]}),(0,G.jsx)(aZ,{sent:t.sent})]})]}):t.phase===`refused`?(0,G.jsxs)(sa,{"aria-label":`${e} refused`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsxs)(ca,{children:[`Shutdown refused · `,t.error.status,` `,t.error.code]}),(0,G.jsxs)(la,{children:[(0,G.jsx)(`pre`,{className:`verb-text`,children:t.error.message}),(0,G.jsx)(`p`,{children:`Nothing was signalled and nothing was pushed.`})]})]}):(0,G.jsx)(cZ,{label:e,report:t.report}),t.phase!==`sending`&&(0,G.jsx)(`div`,{className:`composer-actions`,children:(0,G.jsx)(Pa,{onClick:r,size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`})})]})}function aZ({sent:e}){return(0,G.jsxs)(`p`,{className:`channel-age`,children:[`Sent `,GX(e.sentAt),` · scope `,e.scope,` · grace`,` `,BX(e.grace),e.force?` · forced`:``,` · `,e.runs.length,` `,e.runs.length===1?`run`:`runs`,` in scope`]})}function oZ({sent:e,rows:t}){let{now:n,progress:r,done:i,deadline:a,asks:o}=rZ(e,t);return(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`shutdown-inflight`,role:`status`,children:[(0,G.jsxs)(`p`,{className:`shutdown-inflight-head`,children:[(0,G.jsx)(Bt,{"aria-hidden":`true`,className:`animate-spin`,size:14}),(0,G.jsx)(`strong`,{children:`Shutdown in progress`}),` — still waiting for the engine's answer, `,WP(Math.max(0,n-e.sentAt)),` after it was sent.`]}),(0,G.jsx)(aZ,{sent:e}),(0,G.jsx)(`p`,{children:o?n<a?`Waiting out the ${BX(e.grace)} grace until ${GX(a)} (${WP(a-n)} left) for each live dispatch to end itself; runs are worked through one after another, each with its own grace.`:`The first grace ran out at ${GX(a)}; the engine is tearing down what is still standing and pushing branches, run by run.`:`Forced: nothing is asked or waited for; the engine is tearing the runs down and pushing their branches.`}),(0,G.jsxs)(`p`,{children:[i,` of `,e.runs.length,` `,e.runs.length===1?`run has`:`runs have`,` recorded their shutdown.`]}),r.length>0&&(0,G.jsx)(`ul`,{"aria-label":`Recorded so far`,children:r.map(({runId:e,recorded:t})=>(0,G.jsxs)(`li`,{children:[e,`:`,` `,t===UX.hostShutdown?`put down — host-shutdown recorded after its teardown and pushes`:`its dispatches are stopping — dispatch-stopped recorded`]},e))})]})}function sZ(e){let t=e.remote===null?``:` to ${e.remote}`,n=e.commit===null?``:` at ${e.commit}`;switch(e.result){case`pushed`:return`pushed${t}${n}`;case`already-on-origin`:return`already on its origin${t}${n}; nothing was pushed`;case`no-remote`:return`not pushed: this identity has no origin${n}`;case`refused`:return`could not be preserved${n}`}}function cZ({label:e,report:t}){return(0,G.jsxs)(sa,{"aria-label":`${e} report`,variant:t.complete?`default`:`destructive`,children:[t.complete?(0,G.jsx)(Et,{}):(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:t.complete?`Shutdown complete`:`Shutdown incomplete`}),(0,G.jsxs)(la,{className:`shutdown-report`,children:[!t.complete&&(0,G.jsx)(`p`,{children:`Not everything went as asked: a dispatch was killed at the deadline or is still running, a teardown was not clean, or a branch could not be preserved. Read the runs below.`}),(0,G.jsxs)(`p`,{className:`channel-age`,children:[`Scope `,t.scope,` · grace `,BX(t.grace_seconds),t.forced?` · forced`:``,` · runs root `,t.root]}),t.runs.length===0?(0,G.jsx)(`p`,{children:`No run was selected: nothing was signalled.`}):t.runs.map(e=>(0,G.jsxs)(`section`,{"aria-label":`Shutdown of ${e.run_id}`,className:`shutdown-report-run`,children:[(0,G.jsxs)(`h4`,{children:[e.run_id,` · owner `,e.owner,e.forced_over_owner&&` — another session's run, acted on over its owner`]}),e.dispatches.length===0?(0,G.jsx)(`p`,{children:`No live dispatch to interrupt.`}):(0,G.jsx)(`ul`,{"aria-label":`Dispatches of ${e.run_id}`,children:e.dispatches.map(e=>(0,G.jsxs)(`li`,{children:[e.node,` (pid `,e.pid,`): interrupt`,` `,e.interrupt,`; ended `,e.ended,` after`,` `,WP(e.waited_ms),(0,G.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.node}-${e.pid}`))}),(0,G.jsxs)(`p`,{children:[`Teardown: `,e.teardown]}),e.branches.length===0?(0,G.jsx)(`p`,{children:`No branch this run's records name.`}):(0,G.jsx)(`ul`,{"aria-label":`Branches of ${e.run_id}`,children:e.branches.map(e=>(0,G.jsxs)(`li`,{children:[e.identity,`@`,e.branch,`: `,sZ(e),(0,G.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.identity}@${e.branch}`))})]},e.run_id)),t.not_pushed_unread===null?t.not_pushed.length===0?(0,G.jsx)(`p`,{children:`Other unpublished branches on this host: none.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`Other unpublished branches on this host, which this shutdown did not push (`,t.not_pushed.length,`):`]}),(0,G.jsx)(`ul`,{"aria-label":`Branches not pushed`,children:t.not_pushed.map(({identity:e,branch:t})=>(0,G.jsxs)(`li`,{children:[e,`@`,t]},`${e}@${t}`))})]}):(0,G.jsxs)(`p`,{children:[`Other unpublished branches on this host: not read —`,` `,t.not_pushed_unread,`. This is not a count of zero: there may be work on this host nothing outside it carries.`]}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`The engine's own report`}),(0,G.jsx)(`pre`,{className:`verb-text`,children:t.rendered})]})]})]})}function lZ({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?Wt:Ht;return(0,G.jsxs)(Ma,{"aria-label":`${t}: ${n}`,className:H(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,G.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}function uZ(e){return e.charAt(0).toUpperCase()+e.slice(1)}var dZ=[[`recovery`,[`retry`,`retried`,`requeued`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`refused`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`,`note`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`,`held`,`unheld`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`,`judge`]],[`publication`,[`pr`,`publication`,`published`,`release`,`merge`,`merged`,`change`,`drafting`,`landing`,`landed`]],[`repository`,[`edit`,`fetch`,`push`,`branch`,`branches`,`commit`]],[`session`,[`turn`,`member`,`session`,`heartbeat`,`conversation`]],[`lifecycle`,[`run`,`graph`,`node`,`round`,`step`,`edge`,`setup`,`cleanup`,`driver`,`cross`,`upstream`]]],fZ={"change-retitled":`publication`,"title-unverified":`verification`,"node-restack-started":`repository`,"node-restacked":`repository`,"review-comments-read":`publication`,"review-reply-posted":`publication`,"review-reply-not-drafted":`publication`,"node-absorbed":`publication`,"node-readjusted":`repository`,"completion-requested":`lifecycle`,"command-accepted":`planning`,"body-not-drafted":`publication`,"criterion-checked":`verification`,"pool-maintenance":`lifecycle`,"dispatch-stopped":`lifecycle`,"host-shutdown":`lifecycle`,"scratch-removed":`lifecycle`,"scratch-retained":`lifecycle`,"home-status":`lifecycle`};function pZ(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function mZ(e){let t=fZ[e];if(t!==void 0)return t;let n=pZ(e);return dZ.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}var hZ={recovery:Qt,failure:an,human:sn,planning:kt,contention:It,verification:nn,publication:Ft,repository:Pt,session:Gt,lifecycle:Kt,activity:Ot};function gZ({category:e,className:t=`size-3`}){let n=hZ[e];return(0,G.jsx)(n,{"aria-hidden":`true`,className:t})}function _Z(e){return e===`human-step`?`human step`:e}function vZ(e){return e.style===`human-step`}function yZ(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function bZ(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function xZ(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`next`?`Deferred — onto the node's next dispatch`:e}function SZ(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function CZ({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:_Z(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,bZ(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,xZ(e.delivery)]].filter(([,e])=>e!==void 0);return(0,G.jsxs)(G.Fragment,{children:[t.length>0&&(0,G.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e}),(0,G.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,G.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,G.jsxs)(`li`,{children:[vZ(e)?(0,G.jsxs)(sa,{children:[(0,G.jsx)(sn,{}),(0,G.jsxs)(ca,{children:[`Waiting on a person · `,SZ(e)]}),(0,G.jsx)(la,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,G.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,SZ(e)]}),(0,G.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:yZ(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,G.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function wZ({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,G.jsx)(G.Fragment,{children:`Not recorded`});let n=t.identity!==e.task.repo;return(0,G.jsx)(G.Fragment,{children:[t.target,t.style===void 0?void 0:_Z(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function TZ(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:WP(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`,...e.status?{status:e.status}:{}}}function EZ({row:e}){let t=TZ(e);return(0,G.jsxs)(`header`,{className:`detail-title`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ma,{className:`mb-1`,variant:`outline`,children:t.kind}),(0,G.jsx)(`h2`,{children:t.label}),(0,G.jsxs)(`p`,{className:`detail-when`,children:[(0,G.jsx)(ZP,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,G.jsx)(Ma,{variant:`secondary`,children:t.status})]})}function DZ(e){let t=TZ(e);return[t.kind,t.label,qP(t.startedAt),uZ(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function OZ({row:e}){return(0,G.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":DZ(e),children:(0,G.jsx)(gZ,{category:e.category})})}var kZ=`data-timeline-reading`;function AZ(e){let t=e.closest(`[${kZ}]`)??e.closest(`button`)?.querySelector(`[${kZ}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(kZ)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var jZ={rows:[],total:0},MZ={queued:`Queued`,dispatch:`Dispatch`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},NZ=`idle`,PZ=new Set([...Object.keys(MZ),NZ]),FZ=`member:`;function IZ(e){return PZ.has(e)?`${FZ}${e}`:e}var LZ=Object.entries(MZ).map(([e,t])=>({id:e,label:t}));function RZ(e){let t=e?.spans??[],n=[];for(let e of t){let t=e.agent_role;t!==void 0&&!n.includes(t)&&n.push(t)}let r=t.some(e=>sQ(e)===`dispatch`),[i,...a]=LZ;return[...i===void 0?[]:[i],...n.map(e=>({id:IZ(e),label:e})),...a.filter(({id:e})=>r||e!==`dispatch`)]}var zZ={run:null,node:null,step:null,dispatch:`dispatch`,verification:`verification`,publication:`publication`,"pr-drafting":`dispatch`,"conflict-resolution":`publication`,"human-wait":`human-wait`,queued:`queued`,rollup:`lock-waits`};function BZ(e){return e===`agent`}function VZ(e,t){return e===void 0?t===void 0?MZ.dispatch:HZ(t):wQ(t)&&t!==e?`${e} · ${t}`:e}function HZ(e){return e===`llmlint`?`Lint`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}var UZ={"lock-wait":`Lock waits`};function WZ(e,t=LZ){let n=[...e].sort((e,t)=>e.start-t.start),r=n.at(0)?.start??0,i=Math.max(r+1,...n.map(e=>e.end??e.start)),a=new Set([n.at(0),n.reduce((e,t)=>e===void 0||(t.end??t.start)>(e.end??e.start)?t:e,void 0)].filter(e=>e!==void 0).map(({id:e})=>e)),o=(i-r)*.02,s=[];for(let e of n){let n=Math.max(e.end??e.start,e.start+o),r=s.findLast(t=>{let r=Math.max(t.end??t.start,t.start+o);return e.start<=r&&t.start<=n});r===void 0||a.has(e.id)?s.push(e):KZ(e,t)<KZ(r,t)?a.has(r.id)?s.push(e):s[s.indexOf(r)]=e:GZ(e,r,o)||s.push(e)}return s}function GZ(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function KZ(e,t){let n=e.laneId??``,r=t.findIndex(({id:e})=>e===n);return r<0?t.length:r}function qZ(e,t,n){let r=[...e.map(({at:e})=>e),...t.flatMap(e=>[e.start,e.end??e.start])],i=Math.min(...r),a=(Math.max(...r)-i)*.02,o=[];for(let t of[...e].sort((e,t)=>e.at-t.at)){let e=o.findLast(e=>t.at-e.at<=a);e===void 0?o.push(t):t.id===n&&(o[o.indexOf(e)]=t)}return o}function JZ(e,t){let n=$Z(e,t).rows,r=ZZ(n),i=ZZ(n,!1).flatMap(e=>{let t=QZ(e);if(t===null)return[];let n=Date.parse(e.startedAt),r=e.endedAt===null?null:Date.parse(e.endedAt),i=e.rowKind===`span`&&e.span.total_duration_ms!==void 0?n+e.span.total_duration_ms:r;return[{id:e.id,label:e.displayLabel,laneId:t,payload:e,start:n,end:i,duration:i===null?null:i-n,status:e.status}]}),a=r.flatMap(e=>e.rowKind===`event`?[{id:e.id,label:e.displayLabel,at:Date.parse(e.startedAt),payload:e,status:e.status,icon:(0,U.createElement)(OZ,{row:e})}]:[]),o=Math.max(...i.map(e=>e.end??e.start),...a.map(e=>e.at));return{items:i.map(e=>e.end===null?{...e,end:o,duration:o-e.start}:e),markers:a,lanes:RZ(e),rows:r,tree:n}}function YZ(e,t){let n=new Set,r=[],i=e=>{for(let a of e){if(a.rowKind===`group`){let e=t.has(a.id),n=a.children,o=n.at(0),s=n.at(-1);o!==void 0&&i([o]),r.push({entryKind:`collapse`,group:a,hidden:Math.max(n.length-2,0),expanded:e}),e&&i(n.slice(1,-1)),s!==void 0&&s!==o&&i([s]);continue}n.has(a.id)||(n.add(a.id),r.push({entryKind:`row`,row:a})),i(a.children)}};return i(e),r}function XZ(e,t){return`${e} more ${t} events`}function ZZ(e,t=!0){let n=new Set,r=[],i=e=>{for(let a of e)n.has(a.id)||(n.add(a.id),r.push(a)),(t||a.rowKind!==`group`)&&i(a.children)};return i(e),r}function QZ(e){return e.rowKind===`event`?null:e.role===void 0?zZ[e.rowKind===`span`?e.span.kind:e.kind]??null:IZ(e.role)}function $Z(e,t){if(e===void 0)return jZ;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=EQ(e.spans,new Set,t);return n.length===0?jZ:{rows:_Q(n),total:n.length}}let r=new Set(n.map(({id:e})=>e)),i=new Map,a=[];for(let e of n){let t=e.parent_id!==void 0&&r.has(e.parent_id)?e.parent_id:void 0;t===void 0?a.push(e):i.set(t,[...i.get(t)??[],e])}let o=a.find(({kind:e})=>e===`node`),s=_Q(CQ(SQ([...o===void 0?[]:iQ(o,i),...a.filter(e=>e!==o).map(e=>aQ(e,i)),...EQ(e.spans,r,t)].sort(OQ))));return{span:o,rows:s,total:DQ(s)}}function eQ(e){return aQ(e,new Map)}function tQ(e){return gQ(e)}function nQ(e,t){return rQ(e,t).at(-1)}function rQ(e,t){for(let n of e){if(n.id===t)return[n];let e=rQ(n.children,t);if(e.length>0)return[n,...e]}return[]}function iQ(e,t){return[...(t.get(e.id)??[]).map(e=>aQ(e,t)),...e.events.map(gQ)].sort(OQ)}function aQ(e,t){let n=oQ(e),r=e.kind===`dispatch`?e.transport_role:void 0;return{rowKind:`span`,span:e,id:e.id,kind:e.kind,...n===void 0?{}:{role:n},...r===void 0?{}:{transport:r},label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??kQ(e.started_at,e.ended_at),children:_Q(iQ(e,t)),displayLabel:xQ(e,n,r),displayKind:vQ(e,n,r),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function oQ(e){return e.kind===`dispatch`?e.agent_role:void 0}function sQ(e){return e.agent_role===void 0?zZ[e.kind===`rollup`?e.label:e.kind]??null:IZ(e.agent_role)}function cQ(e,t=[]){let n=t.find(({id:t})=>t===e);return n===void 0?MZ[e]??(e.startsWith(FZ)?e.slice(7):e):n.label}function lQ(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var uQ=`Redirection`;function dQ(e){if(e.surface===void 0)return;let t=[e.surface.kind,e.surface.message].filter(e=>e!==void 0);return t.length===0?void 0:t.join(`: `)}var fQ=`Surface`,pQ=`Blocking surface`;function mQ(e){return e.kind.startsWith(`edit-`)?e.author:void 0}function hQ(e,t){let n=mQ(t);return n===void 0?e:`${e} · by ${n}`}function gQ(e){let t=lQ(e),n=dQ(e),r=t===void 0?e.surface===void 0?`Event`:e.surface.blocking===!0?pQ:fQ:uQ;return{rowKind:`event`,event:e,id:e.id,kind:e.kind,label:e.step_id??``,startedAt:e.at,endedAt:null,status:e.status,durationMs:null,children:[],displayLabel:hQ(t??n??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),e),displayKind:r,category:mZ(e.kind)}}function _Q(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;let i=n;for(;i+1<e.length&&TQ(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<4||o===void 0?t.push(...a):t.push({rowKind:`group`,count:a.length,id:`group-${r.id}`,kind:r.kind,label:`${a.length} × ${r.kind}`,startedAt:r.startedAt,endedAt:o.endedAt,status:void 0,durationMs:kQ(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind}),n=i}return t}function vQ(e,t,n){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return UZ[e.label]??e.label;if(e.kind===`dispatch`)return VZ(t,n);let r=zZ[e.kind];return r===null?e.kind:cQ(r)}function yQ(e){let t=e=>(e??[]).join(`, `);switch(e.kind){case`concurrency`:return e.ahead===void 0?`behind the work already running`:`behind ${t(e.ahead)}`;case`dependencies`:return`waiting on ${t(e.blocking)}`;case`decision`:return`held by decision ${e.reference??`nobody named`}`;case`release`:return`awaiting the release of ${t(e.awaiting)}`;default:return`held by ${e.kind}`}}function bQ(e){return e.map(yQ).join(` and `)}function xQ(e,t,n){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;if(e.kind===`queued`)return`Queued ${bQ(e.reasons??[])}`.trim();let r=vQ(e,t,n);return e.kind===`rollup`?`${r}: ${e.count??0} recorded`:!e.label||e.label===r?r:e.kind===`dispatch`?`${r} (${e.label})`:`${r}: ${e.label}`}function SQ(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=SQ(e.children);return!BZ(e.transport)||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function CQ(e){let t=[],n=-1,r=0,i=(e,t)=>({...e,dispatch:t,children:e.children.map(e=>i(e,t))});for(let a of e){if(BZ(a.transport)){r+=1,n=t.length,t.push(i(a,{id:a.id,label:`Dispatch ${r}`}));continue}let e=n<0?void 0:t[n];if(wQ(a.transport)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function wQ(e){return e===`judge`||e===`llmlint`}function TQ(e,t){return t!==void 0&&e.rowKind!==`group`&&t.rowKind===e.rowKind&&e.kind===t.kind}function EQ(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(gQ)}function DQ(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+DQ(t.children),0)}function OQ(e,t){return e.startedAt.localeCompare(t.startedAt)}function kQ(e,t){if(t===null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?null:r-n}function AQ(e,t,n,r){let[i,a]=(0,U.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,U.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,U.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var jQ=32;function MQ(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function NQ(e,t){let n=(0,U.useRef)(null),r=(0,U.useRef)(!0),i=(0,U.useRef)({key:e,count:t}),a=(0,U.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=jQ)},[]),o=(0,U.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=MQ(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,U.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var PQ=25;function FQ({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:$Q(r),a=i?.kind===`conversation`?i.value:void 0,o=AQ(e,t,a,r===void 0?void 0:JQ(r));return(0,G.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:NQ(a,YQ(r,o)),children:r===void 0?(0,G.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,G.jsx)(zt,{size:30}),(0,G.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(EZ,{row:r}),(0,G.jsx)(bf,{className:`my-4`}),(0,G.jsx)(IQ,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function IQ({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=XQ(n);if(o!==void 0)return(0,G.jsx)(UQ,{redirection:o,row:n});let s=ZQ(n);if(s!==void 0)return(0,G.jsx)(CZ,{release:s});let c=QQ(n);return c===void 0?i?.kind===`conversation`?(0,G.jsx)(RQ,{row:n,transcript:a}):t$(n)?(0,G.jsx)(zQ,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&JM(i.value)!==void 0?(0,G.jsx)(BQ,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&JM(i.value)!==void 0?(0,G.jsx)(VQ,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):n$(n,i)&&r!==void 0?(0,G.jsx)(HQ,{node:r,reference:i}):(0,G.jsx)(KQ,{reference:i,row:n}):(0,G.jsx)(GQ,{row:n,surface:c})}function LQ({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,G.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function RQ({row:e,transcript:t}){let[n,r]=(0,U.useState)(PQ),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?i.filter(({id:t})=>t===e.event.id):i,o=Tm(a.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,G.jsx)(xf,{className:`h-2 w-40`}),(0,G.jsx)(xf,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,G.jsxs)(sa,{variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Transcript unavailable`}),(0,G.jsx)(la,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:s,attribution:c}=t.conversation,l=r$(c.agentRole,c.transportRole);return(0,G.jsx)(Fa,{className:`gap-0 py-3`,children:(0,G.jsxs)(Ia,{className:`px-3`,children:[(0,G.jsxs)(`header`,{className:`transcript-header`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,l,c.persona?` · ${c.persona}`:``]}),(0,G.jsx)(`h4`,{children:s.name})]}),(0,G.jsx)(Dm,{state:s.state})]}),(0,G.jsx)(bf,{className:`my-2.5`}),(0,G.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,G.jsx)(wm,{cursor:o.cursor,onSelectTurn:o.scrollTo,turns:[...a]})}),a.length===0?(0,G.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{ref:o.containerRef,children:a.slice(0,n).map(e=>(0,G.jsxs)(`div`,{ref:t=>o.register(e.id,t),children:[(0,G.jsx)(xw,{author:{label:l},turn:e}),(0,G.jsx)(LQ,{turn:e})]},e.id))}),a.length>n&&(0,G.jsxs)(Pa,{onClick:()=>r(n+PQ),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,a.length,` turns`]})]})]})})}function zQ({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,G.jsx)(`dl`,{className:`facts`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Result`}),(0,G.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,G.jsx)(`pre`,{children:i.output_tail})]}),(0,G.jsx)(qM,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,G.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function BQ({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qM,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,G.jsx)(KQ,{reference:n,row:r})]})}function VQ({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(qM,{artifactId:e,client:t,heading:`Oneharness conversation`,missing:`This record named no conversation.`,noun:`conversation`,runId:i,unreadable:`The history store holds no readable copy of that conversation.`}),(0,G.jsx)(KQ,{reference:n,row:r})]})}function HQ({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,G.jsx)(qQ,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,G.jsx)(`p`,{className:`detail-link`,children:(0,G.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,G.jsx)(Mt,{size:13})]})}):r?.branch_url?(0,G.jsx)(`p`,{className:`detail-link`,children:(0,G.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,G.jsx)(Mt,{size:13})]})}):!r?.pr_url&&(0,G.jsx)(qQ,{fallback:`No publication was recorded.`,reference:t}),(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,G.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,G.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e.name}),(0,G.jsx)(`dd`,{children:e.url?(0,G.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function UQ({redirection:e,row:t}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Delivery`}),(0,G.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),e.turn!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Turn`}),(0,G.jsx)(`dd`,{children:e.turn===`turn-end`?`Left to end — the note reached it as it ended`:`Interrupted — its replacement opened on the note`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Redirected at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(ZP,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Member`}),(0,G.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Note`}),(0,G.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]}),(0,G.jsx)(WQ,{row:t})]}),e.reason!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,G.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function WQ({row:e}){let t=e.rowKind===`event`?mQ(e.event):void 0;return t===void 0?null:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Author`}),(0,G.jsx)(`dd`,{children:t})]})}function GQ({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==void 0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Recorded at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(ZP,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e}),(0,G.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,G.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function KQ({row:e,reference:t}){let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0,i=(e.rowKind===`span`?e.span.reasons:void 0)??[];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Recorded at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(ZP,{at:e.startedAt,relative:!0})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Ended`}),(0,G.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,G.jsx)(ZP,{at:e.endedAt,relative:!0})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Status`}),(0,G.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Duration`}),(0,G.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:WP(e.durationMs)})]}),r!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Aggregated`}),(0,G.jsx)(`dd`,{children:r})]}),i.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Waiting on`}),(0,G.jsx)(`dd`,{children:i.map(yQ).join(` and `)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Step`}),(0,G.jsx)(`dd`,{children:e$(n)??`None`})]}),(0,G.jsx)(WQ,{row:e})]}),(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,G.jsx)(qQ,{fallback:`This item points at no recorded artifact.`,reference:t})]})}function qQ({reference:e,fallback:t}){return e===void 0?(0,G.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,G.jsx)(`p`,{className:`detail-link`,children:(0,G.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,G.jsx)(Mt,{size:13})]})}):(0,G.jsxs)(`p`,{className:`detail-note`,children:[(0,G.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,G.jsx)(`code`,{children:e.value})]})}function JQ(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function YQ(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function XQ(e){return e.rowKind===`event`?e.event.redirection:void 0}function ZQ(e){return e.rowKind===`event`?e.event.release:void 0}function QQ(e){return e.rowKind===`event`?e.event.surface:void 0}function $Q(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function e$(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function t$(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function n$(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function r$(e,t){return VZ(e,t)}function i$({client:e,runId:t,node:n,timeline:r,timelineError:i,selectedItemId:a,onSelectItem:o,onBack:s,selectedTab:c,onSelectTab:l,agents:u}){let d=(0,U.useMemo)(()=>$Z(r,n.id),[r,n.id]);(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(a===void 0?s():o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o,a]);let f=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,G.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,G.jsxs)(`header`,{className:`node-view-head`,children:[(0,G.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,G.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,G.jsx)(`li`,{children:(0,G.jsxs)(Pa,{onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(_t,{size:14}),` Graph`]})}),(0,G.jsx)(`li`,{"aria-current":`page`,children:(0,G.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,G.jsxs)(`div`,{className:`node-view-facts`,children:[(0,G.jsx)(WY,{className:`node-view-state`,state:n.status}),(0,G.jsx)(lZ,{control:n.control}),(0,G.jsxs)(`span`,{className:`node-view-meta`,children:[n.kind,` node · `,n.telemetry?.turns??0,` turns ·`,` `,n.telemetry?.lint??0,` lint turns`]}),f!==void 0&&(0,G.jsxs)(`a`,{className:`node-view-pr`,href:f,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,G.jsx)(Mt,{size:12})]})]})]}),(0,G.jsx)(p$,{node:n}),(0,G.jsxs)(bp,{className:`node-tabs`,onValueChange:e=>{cX(e)&&l(e)},value:c,children:[(0,G.jsx)(Sp,{"aria-label":`Node details`,variant:`line`,children:Object.entries(sX).map(([e,t])=>(0,G.jsx)(Cp,{value:e,children:t},e))}),(0,G.jsxs)(wp,{className:`node-tab-panel`,value:`task`,children:[(0,G.jsx)(`pre`,{children:u$(n.task)}),(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Outcome`}),(0,G.jsx)(`dd`,{children:m$(n.result?.detail)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Graph overrides`}),(0,G.jsx)(`dd`,{children:(n.task.sets??[]).length===0?`None`:(0,G.jsx)(`ol`,{"aria-label":`Graph overrides`,className:`sets-served`,children:n.task.sets?.map((e,t)=>(0,G.jsx)(`li`,{children:(0,G.jsx)(`code`,{children:e})},t))})})]})]})]}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`criteria`,children:(0,G.jsx)(`pre`,{children:d$(n.task)})}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`dependencies`,children:(0,G.jsx)(`dl`,{className:`facts`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Dependencies`}),(0,G.jsx)(`dd`,{children:n.task.deps?.join(`, `)||`None`})]})})}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`pr`,children:(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Publication`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(f$,{node:n})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Release`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(wZ,{node:n})})]})]})}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`checks`,children:(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Verification coverage`}),(0,G.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Observed checks`}),(0,G.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:n.detail?.verification.checks?.map((e,t)=>(0,G.jsxs)(`span`,{children:[t>0&&` · `,e.url?(0,G.jsxs)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:[e.name,`: `,e.state]}):`${e.name}: ${e.state}`]},e.name))})]})]})}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`agents`,children:c===`agents`&&u}),(0,G.jsx)(wp,{className:`node-timeline-panel`,value:`timeline`,children:i===void 0?r===void 0?(0,G.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):d.rows.length===0?(0,G.jsxs)(Fa,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,G.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,G.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,G.jsx)(a$,{client:e,node:n,onSelectItem:o,runId:t,selectedItemId:a,timeline:r}):(0,G.jsxs)(sa,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Timeline unavailable`}),(0,G.jsx)(la,{children:i.message})]})})]})]})}function a$({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,U.useMemo)(()=>JZ(a,t.id),[a,t.id]),[s,c]=(0,U.useState)(()=>new Set),l=(0,U.useMemo)(()=>{if(i!==void 0)return rQ(o.tree,i).find(e=>e.rowKind===`group`)?.id},[o.tree,i]),u=(0,U.useMemo)(()=>l===void 0?s:new Set([...s,l]),[s,l]),d=(0,U.useMemo)(()=>YZ(o.tree,u),[o.tree,u]),f=Tm((0,U.useMemo)(()=>d.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[d])),[p,m]=(0,U.useState)(!1),h=(0,U.useMemo)(()=>WZ(o.items,o.lanes),[o.items,o.lanes]),g=(0,U.useMemo)(()=>qZ(o.markers,o.items,i),[o.items,o.markers,i]),_=(0,U.useMemo)(()=>o$(o.items),[o.items]),v=f.cursor===void 0?void 0:Math.min(Math.max(f.cursor,_[0]),_[1]),y=i===void 0?void 0:nQ(o.rows,i),b=e=>{n(e),f.scrollTo(e)};return(0,U.useEffect)(()=>{i!==void 0&&f.scrollTo(i)},[i,f]),(0,G.jsxs)(`div`,{className:`node-execution`,"data-expanded":p,children:[(0,G.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,G.jsx)(Cn,{axis:{origin:_[0]},cursor:v,expanded:p,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:p?o.items:h,lanes:o.lanes,markers:g,onExpandedChange:m,onSelect:e=>b(e.id),selectedId:i})}),(0,G.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:f.containerRef,children:s$(d).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,G.jsx)(l$,{onOpen:b,register:f.register,row:e.row,selected:e.row.id===i},e.row.id):(0,G.jsx)(c$,{entry:e,onToggle:()=>c(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.id}`));return e.dispatch===void 0?(0,G.jsx)(U.Fragment,{children:t},e.id):(0,G.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,G.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})}),y!==void 0&&(0,G.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,G.jsx)(Pa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,G.jsx)(un,{})}),(0,G.jsx)(FQ,{client:e,node:t,row:y,runId:r})]})]})}function o$(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function s$(e){let t=[];for(let n of e){let e=n.entryKind===`row`?n.row:n.group,r=t.at(-1);e.dispatch!==void 0&&r?.dispatch!==void 0&&r.dispatch.id===e.dispatch.id?r.entries.push(n):t.push({id:e.id,dispatch:e.dispatch,entries:[n]})}return t}function c$({entry:e,onToggle:t}){let n=XZ(e.hidden,e.group.kind);return(0,G.jsx)(`p`,{className:`transcript-collapsed`,children:(0,G.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function l$({row:e,selected:t,register:n,onOpen:r}){return(0,G.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-selected":t,ref:t=>n(e.id,t),children:(0,G.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,G.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,G.jsx)(gZ,{category:e.category}),e.displayKind]}),(0,G.jsx)(`strong`,{children:e.displayLabel}),(0,G.jsxs)(`span`,{className:`transcript-facts`,children:[(0,G.jsx)(ZP,{at:e.startedAt}),e.durationMs!==null&&` · ${WP(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function u$(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
94
+ `));return[t,t.reduce((e,t)=>e.concat(...t),[])]}return[[],[]]},[e]);return(0,U.useEffect)(()=>{let n=t?.target??yK,c=t?.actInsideInputWithModifier??!0;if(e!==null){let e=e=>{if(i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!i.current||i.current&&!c)&&JU(e))return!1;let n=SK(e.code,s);if(a.current.add(e[n]),xK(o,a.current,!1)){let n=e.composedPath?.()?.[0]||e.target,a=n?.nodeName===`BUTTON`||n?.nodeName===`A`;t.preventDefault!==!1&&(i.current||!a)&&e.preventDefault(),r(!0)}},l=e=>{let t=SK(e.code,s);xK(o,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),e.key===`Meta`&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return n?.addEventListener(`keydown`,e),n?.addEventListener(`keyup`,l),window.addEventListener(`blur`,u),window.addEventListener(`contextmenu`,u),()=>{n?.removeEventListener(`keydown`,e),n?.removeEventListener(`keyup`,l),window.removeEventListener(`blur`,u),window.removeEventListener(`contextmenu`,u)}}},[e,r]),n}function xK(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function SK(e,t){return t.includes(e)?`code`:`key`}var CK=()=>{let e=KG();return(0,U.useMemo)(()=>({zoomIn:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{let{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{let{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{let{transform:[r,i,a],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{let[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{let{width:r,height:i,minZoom:a,maxZoom:o,panZoom:s}=e.getState(),c=FU(t,r,i,a,o,n?.padding??.1);return s?(await s.setViewport(c,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{let{transform:r,snapGrid:i,snapToGrid:a,domNode:o}=e.getState();if(!o)return t;let{x:s,y:c}=o.getBoundingClientRect(),l={x:t.x-s,y:t.y-c},u=n.snapGrid??i;return AU(l,r,n.snapToGrid??a,u)},flowToScreenPosition:t=>{let{transform:n,domNode:r}=e.getState();if(!r)return t;let{x:i,y:a}=r.getBoundingClientRect(),o=jU(t,n);return{x:o.x+i,y:o.y+a}}}),[])};function wK(e,t){let n=[],r=new Map,i=[];for(let t of e)if(t.type===`add`){i.push(t);continue}else if(t.type===`remove`||t.type===`replace`)r.set(t.id,[t]);else{let e=r.get(t.id);e?e.push(t):r.set(t.id,[t])}for(let e of t){let t=r.get(e.id);if(!t){n.push(e);continue}if(t[0].type===`remove`)continue;if(t[0].type===`replace`){n.push({...t[0].item});continue}let i={...e};for(let e of t)TK(e,i);n.push(i)}return i.length&&i.forEach(e=>{e.index===void 0?n.push({...e.item}):n.splice(e.index,0,{...e.item})}),n}function TK(e,t){switch(e.type){case`select`:t.selected=e.selected;break;case`position`:e.position!==void 0&&(t.position=e.position),e.dragging!==void 0&&(t.dragging=e.dragging);break;case`dimensions`:e.dimensions!==void 0&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes===`width`)&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes===`height`)&&(t.height=e.dimensions.height))),typeof e.resizing==`boolean`&&(t.resizing=e.resizing);break}}function EK(e,t){return wK(e,t)}function DK(e,t){return wK(e,t)}function OK(e,t){return{id:e,type:`select`,selected:t}}function kK(e,t=new Set,n=!1){let r=[];for(let[i,a]of e){let e=t.has(i);!(a.selected===void 0&&!e)&&a.selected!==e&&(n&&(a.selected=e),r.push(OK(a.id,e)))}return r}function AK({items:e=[],lookup:t}){let n=[],r=new Map(e.map(e=>[e.id,e]));for(let[r,i]of e.entries()){let e=t.get(i.id),a=e?.internals?.userNode??e;a!==void 0&&a!==i&&n.push({id:i.id,item:i,type:`replace`}),a===void 0&&n.push({item:i,type:`add`,index:r})}for(let[e]of t)r.get(e)===void 0&&n.push({id:e,type:`remove`});return n}function jK(e){return{id:e.id,type:`remove`}}var MK=OU(`React Flow`,`https://reactflow.dev/`);function NK(e,t,n={}){return sW(e,t,{...n,onError:n.onError??MK})}var PK=e=>nU(e),FK=e=>tU(e);function IK(e){return(0,U.forwardRef)(e)}var LK=typeof window<`u`?U.useLayoutEffect:U.useEffect;function RK(e){let[t,n]=(0,U.useState)(BigInt(0)),[r]=(0,U.useState)(()=>zK(()=>n(e=>e+BigInt(1))));return LK(()=>{let t=r.get();t.length&&(e(t),r.reset())},[t]),r}function zK(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}var BK=(0,U.createContext)(null);function VK({children:e}){let t=KG(),n=RK((0,U.useCallback)(e=>{let{nodes:n=[],setNodes:r,hasDefaultNodes:i,onNodesChange:a,nodeLookup:o,fitViewQueued:s,onNodesChangeMiddlewareMap:c}=t.getState(),l=n;for(let t of e)l=typeof t==`function`?t(l):t;let u=AK({items:l,lookup:o});for(let e of c.values())u=e(u);i&&r(l),u.length>0?a?.(u):s&&window.requestAnimationFrame(()=>{let{fitViewQueued:e,nodes:n,setNodes:r}=t.getState();e&&r(n)})},[])),r=RK((0,U.useCallback)(e=>{let{edges:n=[],setEdges:r,hasDefaultEdges:i,onEdgesChange:a,edgeLookup:o}=t.getState(),s=n;for(let t of e)s=typeof t==`function`?t(s):t;i?r(s):a&&a(AK({items:s,lookup:o}))},[])),i=(0,U.useMemo)(()=>({nodeQueue:n,edgeQueue:r}),[]);return(0,G.jsx)(BK.Provider,{value:i,children:e})}function HK(){let e=(0,U.useContext)(BK);if(!e)throw Error(`useBatchContext must be used within a BatchProvider`);return e}var UK=e=>!!e.panZoom;function WK(){let e=CK(),t=KG(),n=HK(),r=GG(UK),i=(0,U.useMemo)(()=>{let e=e=>t.getState().nodeLookup.get(e),r=e=>{n.nodeQueue.push(e)},i=e=>{n.edgeQueue.push(e)},a=e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState(),i=PK(e)?e:n.get(e.id),a=i.parentId?BU(i.position,i.measured,i.parentId,n,r):i.position;return xU({...i,position:a,width:i.measured?.width??i.width,height:i.measured?.height??i.height})},o=(e,t,n={replace:!1})=>{r(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&PK(e)?e:{...r,...e}}return r}))},s=(e,t,n={replace:!1})=>{i(r=>r.map(r=>{if(r.id===e){let e=typeof t==`function`?t(r):t;return n.replace&&FK(e)?e:{...r,...e}}return r}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{let{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:r,setEdges:i,addNodes:e=>{let t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{let t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{let{nodes:e=[],edges:n=[],transform:r}=t.getState(),[i,a,o]=r;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:i,y:a,zoom:o}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{let{nodes:r,edges:i,onNodesDelete:a,onEdgesDelete:o,triggerNodeChanges:s,triggerEdgeChanges:c,onDelete:l,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await fU({nodesToRemove:e,edgesToRemove:n,nodes:r,edges:i,onBeforeDelete:u}),p=f.length>0,m=d.length>0;if(p){let e=f.map(jK);o?.(f),c(e)}if(m){let e=d.map(jK);a?.(d),s(e)}return(m||p)&&l?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,r)=>{let i=EU(e),o=i?e:a(e),s=r!==void 0;return o?(r||t.getState().nodes).filter(r=>{let a=t.getState().nodeLookup.get(r.id);if(a&&!i&&(r.id===e.id||!a.internals.positionAbsolute))return!1;let c=xU(s?r:a),l=TU(c,o);return n&&l>0||l>=c.width*c.height||l>=o.width*o.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{let r=EU(e)?e:a(e);if(!r)return!1;let i=TU(r,t);return n&&i>0||i>=t.width*t.height||i>=r.width*r.height},updateNode:o,updateNodeData:(e,t,n={replace:!1})=>{o(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{let r=typeof t==`function`?t(e):t;return n.replace?{...e,data:r}:{...e,data:{...e.data,...r}}},n)},getNodesBounds:e=>{let{nodeLookup:n,nodeOrigin:r}=t.getState();return aU(e,{nodeLookup:n,nodeOrigin:r})},getHandleConnections:({type:e,id:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}-${e}${n?`-${n}`:``}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:r})=>Array.from(t.getState().connectionLookup.get(`${r}${e?n?`-${e}-${n}`:`-${e}`:``}`)?.values()??[]),fitView:async e=>{let r=t.getState().fitViewResolver??HU();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:r}),n.nodeQueue.push(e=>[...e]),r.promise}}},[]);return(0,U.useMemo)(()=>({...i,...e,viewportInitialized:r}),[r])}var GK=e=>e.selected,KK=typeof window<`u`?window:void 0;function qK({deleteKeyCode:e,multiSelectionKeyCode:t}){let n=KG(),{deleteElements:r}=WK(),i=bK(e,{actInsideInputWithModifier:!1}),a=bK(t,{target:KK});(0,U.useEffect)(()=>{if(i){let{edges:e,nodes:t}=n.getState();r({nodes:t.filter(GK),edges:e.filter(GK)}),n.setState({nodesSelectionActive:!1})}},[i]),(0,U.useEffect)(()=>{n.setState({multiSelectionActive:a})},[a])}function JK(e){let t=KG();(0,U.useEffect)(()=>{let n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;let n=GU(e.current);(n.height===0||n.width===0)&&t.getState().onError?.(`004`,UH.error004()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener(`resize`,n);let t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener(`resize`,n),t&&e.current&&t.unobserve(e.current)}}},[])}var YK={position:`absolute`,width:`100%`,height:`100%`,top:0,left:0},XK=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ZK({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=JH.Free,zoomOnDoubleClick:o=!0,panOnDrag:s=!0,defaultViewport:c,translateExtent:l,minZoom:u,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:p=!0,children:m,noWheelClassName:h,noPanClassName:g,onViewportChange:_,isControlledViewport:v,paneClickDistance:y,selectionOnDrag:b}){let x=KG(),S=(0,U.useRef)(null),{userSelectionActive:C,lib:w,connectionInProgress:T}=GG(XK,VG),E=bK(f),D=(0,U.useRef)();JK(S);let O=(0,U.useCallback)(e=>{_?.({x:e[0],y:e[1],zoom:e[2]}),v||x.setState({transform:e})},[_,v]);return(0,U.useEffect)(()=>{if(S.current){D.current=gG({domNode:S.current,minZoom:u,maxZoom:d,translateExtent:l,viewport:c,onDraggingChange:e=>x.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{let{onViewportChangeStart:n,onMoveStart:r}=x.getState();r?.(e,t),n?.(t)},onPanZoom:(e,t)=>{let{onViewportChange:n,onMove:r}=x.getState();r?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{let{onViewportChangeEnd:n,onMoveEnd:r}=x.getState();r?.(e,t),n?.(t)}});let{x:e,y:t,zoom:n}=D.current.getViewport();return x.setState({panZoom:D.current,transform:[e,t,n],domNode:S.current.closest(`.react-flow`)}),()=>{D.current?.destroy()}}},[]),(0,U.useEffect)(()=>{D.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:o,panOnDrag:s,zoomActivationKeyPressed:E,preventScrolling:p,noPanClassName:g,userSelectionActive:C,noWheelClassName:h,lib:w,onTransformChange:O,connectionInProgress:T,selectionOnDrag:b,paneClickDistance:y})},[e,t,n,r,i,a,o,s,E,p,g,C,h,w,O,T,b,y]),(0,G.jsx)(`div`,{className:`react-flow__renderer`,ref:S,style:YK,children:m})}var QK=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function $K(){let{userSelectionActive:e,userSelectionRect:t}=GG(QK,VG);return e&&t?(0,G.jsx)(`div`,{className:`react-flow__selection react-flow__container`,style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}var eq=(e,t)=>n=>{n.target===t.current&&e?.(n)},tq=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function nq({isSelecting:e,selectionKeyPressed:t,selectionMode:n=YH.Full,panOnDrag:r,autoPanOnSelection:i,paneClickDistance:a,selectionOnDrag:o,onSelectionStart:s,onSelectionEnd:c,onPaneClick:l,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:m,children:h}){let g=(0,U.useRef)(0),_=KG(),{userSelectionActive:v,elementsSelectable:y,dragging:b,panBy:x,autoPanSpeed:S}=GG(tq,VG),C=y&&(e||v),w=(0,U.useRef)(null),T=(0,U.useRef)(),E=(0,U.useRef)(new Set),D=(0,U.useRef)(new Set),O=(0,U.useRef)(!1),k=(0,U.useRef)(!1),A=(0,U.useRef)({x:0,y:0}),j=(0,U.useRef)(!1),M=e=>{if(k.current||O.current||_.getState().connection.inProgress){k.current=!1,O.current=!1;return}l?.(e),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},N=e=>{if(Array.isArray(r)&&r?.includes(2)){e.preventDefault();return}u?.(e)},P=d?e=>d(e):void 0,ee=e=>{k.current&&=(e.stopPropagation(),!1)},F=n=>{let{domNode:r,transform:i}=_.getState();if(T.current=r?.getBoundingClientRect(),!T.current)return;let a=n.target===w.current;if(!a&&n.target.closest(`.nokey`)||!e||!(o&&a||t)||n.button!==0||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),k.current=!1;let{x:s,y:c}=XU(n.nativeEvent,T.current),l=AU({x:s,y:c},i);_.setState({userSelectionRect:{width:0,height:0,startX:l.x,startY:l.y,x:s,y:c}}),a||(n.stopPropagation(),n.preventDefault())};function I(e,t){let{userSelectionRect:r}=_.getState();if(!r)return;let{transform:i,nodeLookup:a,edgeLookup:o,connectionLookup:s,triggerNodeChanges:c,triggerEdgeChanges:l,defaultEdgeOptions:u}=_.getState(),d={x:r.startX,y:r.startY},{x:f,y:p}=jU(d,i),m={startX:d.x,startY:d.y,x:e<f?e:f,y:t<p?t:p,width:Math.abs(e-f),height:Math.abs(t-p)},h=E.current,g=D.current;E.current=new Set(sU(a,m,i,n===YH.Partial,!0).map(e=>e.id)),D.current=new Set;let v=u?.selectable??!0;for(let e of E.current){let t=s.get(e);if(t)for(let{edgeId:e}of t.values()){let t=o.get(e);t&&(t.selectable??v)&&D.current.add(e)}}VU(h,E.current)||c(kK(a,E.current,!0)),VU(g,D.current)||l(kK(o,D.current)),_.setState({userSelectionRect:m,userSelectionActive:!0,nodesSelectionActive:!1})}function L(){if(!i||!T.current)return;let[e,t]=_U(A.current,T.current,S);x({x:e,y:t}).then(e=>{if(!k.current||!e){g.current=requestAnimationFrame(L);return}let{x:t,y:n}=A.current;I(t,n),g.current=requestAnimationFrame(L)})}let te=()=>{cancelAnimationFrame(g.current),g.current=0,j.current=!1};return(0,U.useEffect)(()=>()=>te(),[]),(0,G.jsxs)(`div`,{className:aL([`react-flow__pane`,{draggable:r===!0||Array.isArray(r)&&r.includes(0),dragging:b,selection:e}]),onClick:C?void 0:eq(M,w),onContextMenu:eq(N,w),onWheel:eq(P,w),onPointerEnter:C?void 0:f,onPointerMove:C?e=>{let{userSelectionRect:n,transform:r,resetSelectedElements:i}=_.getState();if(!T.current||!n)return;let{x:o,y:c}=XU(e.nativeEvent,T.current);A.current={x:o,y:c};let l=jU({x:n.startX,y:n.startY},r);if(!k.current){let n=t?0:a;if(Math.hypot(o-l.x,c-l.y)<=n)return;i(),s?.(e)}k.current=!0,j.current||=(L(),!0),I(o,c)}:p,onPointerUp:e=>{if(!C){e.target===w.current&&_.getState().connection.inProgress&&(O.current=!0);return}e.button===0&&(e.target?.releasePointerCapture?.(e.pointerId),!v&&e.target===w.current&&_.getState().userSelectionRect&&M?.(e),_.setState({userSelectionActive:!1,userSelectionRect:null}),k.current&&(c?.(e),_.setState({nodesSelectionActive:E.current.size>0})),te())},onPointerCancel:C?e=>{e.target?.releasePointerCapture?.(e.pointerId),te()}:void 0,onPointerDownCapture:C?F:void 0,onClickCapture:C?ee:void 0,onPointerLeave:m,ref:w,style:YK,children:[h,(0,G.jsx)($K,{})]})}function rq({id:e,store:t,unselect:n=!1,nodeRef:r}){let{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeLookup:s,onError:c}=t.getState(),l=s.get(e);if(!l){c?.(`012`,UH.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):i([e])}function iq({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:o}){let s=KG(),[c,l]=(0,U.useState)(!1),u=(0,U.useRef)();return(0,U.useEffect)(()=>{if(!t)return u.current=GW({getStoreItems:()=>s.getState(),onNodeMouseDown:t=>{rq({id:t,store:s,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,s,e]),(0,U.useEffect)(()=>{t||!e.current||!u.current||u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:o})},[n,r,t,a,e,i,o]),c}var aq=e=>t=>t.selected&&(t.draggable||e&&t.draggable===void 0);function oq(){let e=KG();return(0,U.useCallback)(t=>{let{nodeExtent:n,snapToGrid:r,snapGrid:i,nodesDraggable:a,onError:o,updateNodePositions:s,nodeLookup:c,nodeOrigin:l}=e.getState(),u=new Map,d=aq(a),f=r?i[0]:5,p=r?i[1]:5,m=t.direction.x*f*t.factor,h=t.direction.y*p*t.factor;for(let[,e]of c){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+m,y:e.internals.positionAbsolute.y+h};r&&(t=kU(t,i));let{position:a,positionAbsolute:s}=dU({nodeId:e.id,nextPosition:t,nodeLookup:c,nodeExtent:n,nodeOrigin:l,onError:o});e.position=a,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}var sq=(0,U.createContext)(null),cq=sq.Provider;sq.Consumer;var lq=()=>(0,U.useContext)(sq),uq=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),dq=(0,U.createContext)(null);function fq({children:e}){let t=GG(uq,VG);return(0,G.jsx)(dq.Provider,{value:t,children:e})}function pq(){let e=(0,U.useContext)(dq);if(!e)throw Error(`useHandleConfig must be used within a HandleConfigProvider`);return e}var mq={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},hq=(e,t,n)=>r=>{let{connectionClickStartHandle:i,connectionMode:a,connection:o}=r,{fromHandle:s,toHandle:c,isValid:l}=o;if(!s&&!i)return mq;let u=c?.nodeId===e&&c?.id===t&&c?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:i?.nodeId===e&&i?.id===t&&i?.type===n,isPossibleEndHandle:a===qH.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!i,valid:u&&l}};function gq({type:e=`source`,position:t=$.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:c,className:l,onMouseDown:u,onTouchStart:d,...f},p){let m=o||null,h=e===`target`,g=KG(),_=lq(),{connectOnClick:v,noPanClassName:y,rfId:b}=pq(),{connectingFrom:x,connectingTo:S,clickConnecting:C,isPossibleEndHandle:w,connectionInProcess:T,clickConnectionInProcess:E,valid:D}=GG(hq(_,m,e),VG);_||g.getState().onError?.(`010`,UH.error010());let O=e=>{let{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:r}=g.getState(),i={...t,...e};if(r){let{edges:e,setEdges:t,onError:n}=g.getState();t(NK(i,e,{onError:n}))}n?.(i),s?.(i)},k=e=>{if(!_)return;let t=YU(e.nativeEvent);if(i&&(t&&e.button===0||!t)){let t=g.getState();tG.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:h,handleId:m,nodeId:_,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:O,isValidConnection:n||((...e)=>g.getState().isValidConnection?.(...e)??!0),getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?u?.(e):d?.(e)};return(0,G.jsx)(`div`,{"data-handleid":m,"data-nodeid":_,"data-handlepos":t,"data-id":`${b}-${_}-${m}-${e}`,className:aL([`react-flow__handle`,`react-flow__handle-${t}`,`nodrag`,y,l,{source:!h,target:h,connectable:r,connectablestart:i,connectableend:a,clickconnecting:C,connectingfrom:x,connectingto:S,valid:D,connectionindicator:r&&(!T||w)&&(T||E?a:i)}]),onMouseDown:k,onTouchStart:k,onClick:v?t=>{let{onClickConnectStart:r,onClickConnectEnd:a,connectionClickStartHandle:o,connectionMode:s,isValidConnection:c,lib:l,rfId:u,nodeLookup:d,connection:f}=g.getState();if(!_||!o&&!i)return;if(!o){r?.(t.nativeEvent,{nodeId:_,handleId:m,handleType:e}),g.setState({connectionClickStartHandle:{nodeId:_,type:e,id:m}});return}let p=KU(t.target),h=n||c,{connection:v,isValid:y}=tG.isValid(t.nativeEvent,{handle:{nodeId:_,id:m,type:e},connectionMode:s,fromNodeId:o.nodeId,fromHandleId:o.id||null,fromType:o.type,isValidConnection:h,flowId:u,doc:p,lib:l,nodeLookup:d});y&&v&&O(v);let b=structuredClone(f);delete b.inProgress,b.toPosition=b.toHandle?b.toHandle.position:null,a?.(t,b),g.setState({connectionClickStartHandle:null})}:void 0,ref:p,...f,children:c})}var _q=(0,U.memo)(IK(gq));function vq({data:e,isConnectable:t,sourcePosition:n=$.Bottom}){return(0,G.jsxs)(G.Fragment,{children:[e?.label,(0,G.jsx)(_q,{type:`source`,position:n,isConnectable:t})]})}function yq({data:e,isConnectable:t,targetPosition:n=$.Top,sourcePosition:r=$.Bottom}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_q,{type:`target`,position:n,isConnectable:t}),e?.label,(0,G.jsx)(_q,{type:`source`,position:r,isConnectable:t})]})}function bq(){return null}function xq({data:e,isConnectable:t,targetPosition:n=$.Top}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(_q,{type:`target`,position:n,isConnectable:t}),e?.label]})}var Sq={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Cq={input:vq,default:yq,output:xq,group:bq};function wq(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}var Tq=e=>{let{width:t,height:n,x:r,y:i}=oU(e.nodeLookup,{filter:e=>!!e.selected});return{width:DU(t)?t:null,height:DU(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function Eq({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){let r=KG(),{width:i,height:a,transformString:o,userSelectionActive:s}=GG(Tq,VG),c=oq(),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{n||l.current?.focus({preventScroll:!0})},[n]);let u=!s&&i!==null&&a!==null;if(iq({nodeRef:l,disabled:!u}),!u)return null;let d=e?t=>{e(t,r.getState().nodes.filter(e=>e.selected))}:void 0;return(0,G.jsx)(`div`,{className:aL([`react-flow__nodesselection`,`react-flow__container`,t]),style:{transform:o},children:(0,G.jsx)(`div`,{ref:l,className:`react-flow__nodesselection-rect`,onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(Sq,e.key)&&(e.preventDefault(),c({direction:Sq[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}var Dq=typeof window<`u`?window:void 0,Oq=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function kq({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,paneClickDistance:s,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:u,selectionMode:d,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:m,panActivationKeyCode:h,zoomActivationKeyCode:g,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:b,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:w,autoPanOnSelection:T,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,preventScrolling:A,onSelectionContextMenu:j,noWheelClassName:M,noPanClassName:N,disableKeyboardA11y:P,onViewportChange:ee,isControlledViewport:F}){let{nodesSelectionActive:I,userSelectionActive:L}=GG(Oq,VG),te=bK(l,{target:Dq}),ne=bK(h,{target:Dq}),re=ne||w,R=ne||b,ie=u&&re!==!0,ae=te||L||ie;return qK({deleteKeyCode:c,multiSelectionKeyCode:m}),(0,G.jsx)(ZK,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:v,zoomOnPinch:y,panOnScroll:R,panOnScrollSpeed:x,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!te&&re,defaultViewport:E,translateExtent:D,minZoom:O,maxZoom:k,zoomActivationKeyCode:g,preventScrolling:A,noWheelClassName:M,noPanClassName:N,onViewportChange:ee,isControlledViewport:F,paneClickDistance:s,selectionOnDrag:ie,children:(0,G.jsxs)(nq,{onSelectionStart:f,onSelectionEnd:p,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:re,autoPanOnSelection:T,isSelecting:!!ae,selectionMode:d,selectionKeyPressed:te,paneClickDistance:s,selectionOnDrag:ie,children:[e,I&&(0,G.jsx)(Eq,{onSelectionContextMenu:j,noPanClassName:N,disableKeyboardA11y:P})]})})}kq.displayName=`FlowRenderer`;var Aq=(0,U.memo)(kq),jq=e=>t=>e?sU(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys());function Mq(e){return GG((0,U.useCallback)(jq(e),[e]),VG)}var Nq=e=>e.updateNodeInternals;function Pq(){let e=GG(Nq),[t]=(0,U.useState)(()=>typeof ResizeObserver>`u`?null:new ResizeObserver(t=>{let n=new Map;t.forEach(e=>{let t=e.target.getAttribute(`data-id`);n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,U.useEffect)(()=>()=>{t?.disconnect()},[t]),t}function Fq({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){let i=KG(),a=(0,U.useRef)(null),o=(0,U.useRef)(null),s=(0,U.useRef)(e.sourcePosition),c=(0,U.useRef)(e.targetPosition),l=(0,U.useRef)(t),u=n&&!!e.internals.handleBounds;return(0,U.useEffect)(()=>{a.current&&!e.hidden&&(!u||o.current!==a.current)&&(o.current&&r?.unobserve(o.current),r?.observe(a.current),o.current=a.current)},[u,e.hidden]),(0,U.useEffect)(()=>()=>{o.current&&=(r?.unobserve(o.current),null)},[]),(0,U.useEffect)(()=>{if(a.current){let n=l.current!==t,r=s.current!==e.sourcePosition,o=c.current!==e.targetPosition;(n||r||o)&&(l.current=t,s.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function Iq({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:o,nodesDraggable:s,elementsSelectable:c,nodesConnectable:l,nodesFocusable:u,resizeObserver:d,noDragClassName:f,noPanClassName:p,disableKeyboardA11y:m,rfId:h,nodeTypes:g,nodeClickDistance:_,onError:v}){let{node:y,internals:b,isParent:x}=GG(t=>{let n=t.nodeLookup.get(e),r=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:r}},VG),S=y.type||`default`,C=g?.[S]||Cq[S];C===void 0&&(v?.(`003`,UH.error003(S)),S=`default`,C=g?.default||Cq.default);let w=!!(y.draggable||s&&y.draggable===void 0),T=!!(y.selectable||c&&y.selectable===void 0),E=!!(y.connectable||l&&y.connectable===void 0),D=!!(y.focusable||u&&y.focusable===void 0),O=KG(),k=zU(y),A=Fq({node:y,nodeType:S,hasDimensions:k,resizeObserver:d}),j=iq({nodeRef:A,disabled:y.hidden||!w,noDragClassName:f,handleSelector:y.dragHandle,nodeId:e,isSelectable:T,nodeClickDistance:_}),M=oq();if(y.hidden)return null;let N=RU(y),P=wq(y),ee=T||w||t||n||r||i,F=n?e=>n(e,{...b.userNode}):void 0,I=r?e=>r(e,{...b.userNode}):void 0,L=i?e=>i(e,{...b.userNode}):void 0,te=a?e=>a(e,{...b.userNode}):void 0,ne=o?e=>o(e,{...b.userNode}):void 0,re=n=>{let{selectNodesOnDrag:r,nodeDragThreshold:i}=O.getState();T&&(!r||!w||i>0)&&rq({id:e,store:O,nodeRef:A}),t&&t(n,{...b.userNode})},R=t=>{if(!(JU(t.nativeEvent)||m)){if(GH.includes(t.key)&&T){let n=t.key===`Escape`;rq({id:e,store:O,unselect:n,nodeRef:A})}else if(w&&y.selected&&Object.prototype.hasOwnProperty.call(Sq,t.key)){t.preventDefault();let{ariaLabelConfig:e}=O.getState();O.setState({ariaLiveMessage:e[`node.a11yDescription.ariaLiveMessage`]({direction:t.key.replace(`Arrow`,``).toLowerCase(),x:~~b.positionAbsolute.x,y:~~b.positionAbsolute.y})}),M({direction:Sq[t.key],factor:t.shiftKey?4:1})}}},ie=()=>{if(m||!A.current?.matches(`:focus-visible`))return;let{transform:t,width:n,height:r,autoPanOnNodeFocus:i,setCenter:a}=O.getState();i&&(sU(new Map([[e,y]]),{x:0,y:0,width:n,height:r},t,!0).length>0||a(y.position.x+N.width/2,y.position.y+N.height/2,{zoom:t[2]}))};return(0,G.jsx)(`div`,{className:aL([`react-flow__node`,`react-flow__node-${S}`,{[p]:w},y.className,{selected:y.selected,selectable:T,parent:x,draggable:w,dragging:j}]),ref:A,style:{zIndex:b.z,transform:`translate(${b.positionAbsolute.x}px,${b.positionAbsolute.y}px)`,pointerEvents:ee?`all`:`none`,visibility:k?`visible`:`hidden`,...y.style,...P},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:F,onMouseMove:I,onMouseLeave:L,onContextMenu:te,onClick:re,onDoubleClick:ne,onKeyDown:D?R:void 0,tabIndex:D?0:void 0,onFocus:D?ie:void 0,role:y.ariaRole??(D?`group`:void 0),"aria-roledescription":`node`,"aria-describedby":m?void 0:`${YG}-${h}`,"aria-label":y.ariaLabel,...y.domAttributes,children:(0,G.jsx)(cq,{value:e,children:(0,G.jsx)(C,{id:e,data:y.data,type:S,positionAbsoluteX:b.positionAbsolute.x,positionAbsoluteY:b.positionAbsolute.y,selected:y.selected??!1,selectable:T,draggable:w,deletable:y.deletable??!0,isConnectable:E,sourcePosition:y.sourcePosition,targetPosition:y.targetPosition,dragging:j,dragHandle:y.dragHandle,zIndex:b.z,parentId:y.parentId,...N})})})}var Lq=(0,U.memo)(Iq),Rq=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function zq(e){let{nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,onError:i}=GG(Rq,VG),a=Mq(e.onlyRenderVisibleElements),o=Pq();return(0,G.jsx)(`div`,{className:`react-flow__nodes`,style:YK,children:a.map(a=>(0,G.jsx)(Lq,{id:a,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:o,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:r,nodeClickDistance:e.nodeClickDistance,onError:i},a))})}zq.displayName=`NodeRenderer`;var Bq=(0,U.memo)(zq);function Vq(e){return GG((0,U.useCallback)(t=>{if(!e)return t.edges.map(e=>e.id);let n=[];if(t.width&&t.height)for(let e of t.edges){let r=t.nodeLookup.get(e.source),i=t.nodeLookup.get(e.target);r&&i&&iW({sourceNode:r,targetNode:i,width:t.width,height:t.height,transform:t.transform})&&n.push(e.id)}return n},[e]),VG)}var Hq=({color:e=`none`,strokeWidth:t=1})=>(0,G.jsx)(`polyline`,{className:`arrow`,style:{strokeWidth:t,...e&&{stroke:e}},strokeLinecap:`round`,fill:`none`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4`}),Uq=({color:e=`none`,strokeWidth:t=1})=>(0,G.jsx)(`polyline`,{className:`arrowclosed`,style:{strokeWidth:t,...e&&{stroke:e,fill:e}},strokeLinecap:`round`,strokeLinejoin:`round`,points:`-5,-4 0,0 -5,4 -5,-4`}),Wq={[QH.Arrow]:Hq,[QH.ArrowClosed]:Uq};function Gq(e){let t=KG();return(0,U.useMemo)(()=>Object.prototype.hasOwnProperty.call(Wq,e)?Wq[e]:(t.getState().onError?.(`009`,UH.error009(e)),null),[e])}var Kq=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:a=`strokeWidth`,strokeWidth:o,orient:s=`auto-start-reverse`})=>{let c=Gq(t);return c?(0,G.jsx)(`marker`,{className:`react-flow__arrowhead`,id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:`-10 -10 20 20`,markerUnits:a,orient:s,refX:`0`,refY:`0`,children:(0,G.jsx)(c,{color:n,strokeWidth:o})}):null},qq=({defaultColor:e,rfId:t})=>{let n=GG(e=>e.edges),r=GG(e=>e.defaultEdgeOptions),i=(0,U.useMemo)(()=>xW(n,{id:t,defaultColor:e,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd}),[n,r,t,e]);return i.length?(0,G.jsx)(`svg`,{className:`react-flow__marker`,"aria-hidden":`true`,children:(0,G.jsx)(`defs`,{children:i.map(e=>(0,G.jsx)(Kq,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};qq.displayName=`MarkerDefinitions`;var Jq=(0,U.memo)(qq);function Yq({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:a,labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:c,className:l,...u}){let[d,f]=(0,U.useState)({x:1,y:0,width:0,height:0}),p=aL([`react-flow__edge-textwrapper`,l]),m=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(m.current){let e=m.current.getBBox();f({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,G.jsxs)(`g`,{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:p,visibility:d.width?`visible`:`hidden`,...u,children:[i&&(0,G.jsx)(`rect`,{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:`react-flow__edge-textbg`,style:a,rx:s,ry:s}),(0,G.jsx)(`text`,{className:`react-flow__edge-text`,y:d.height/2,dy:`0.3em`,ref:m,style:r,children:n}),c]}):null}Yq.displayName=`EdgeText`;var Xq=(0,U.memo)(Yq);function Zq({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c,interactionWidth:l=20,...u}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`path`,{...u,d:e,fill:`none`,className:aL([`react-flow__edge-path`,u.className])}),l?(0,G.jsx)(`path`,{d:e,fill:`none`,strokeOpacity:0,strokeWidth:l,className:`react-flow__edge-interaction`}):null,r&&DU(t)&&DU(n)?(0,G.jsx)(Xq,{x:t,y:n,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:s,labelBgBorderRadius:c}):null]})}function Qq({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$.Left||e===$.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function $q({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:r,targetY:i,targetPosition:a=$.Top}){let[o,s]=Qq({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,l]=Qq({pos:a,x1:r,y1:i,x2:e,y2:t}),[u,d,f,p]=QU({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:c,targetControlY:l});return[`M${e},${t} C${o},${s} ${c},${l} ${r},${i}`,u,d,f,p]}function eJ(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})=>{let[v,y,b]=$q({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s});return(0,G.jsx)(Zq,{id:e.isInternal?void 0:t,path:v,labelX:y,labelY:b,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:_})})}var tJ=eJ({isInternal:!1}),nJ=eJ({isInternal:!0});tJ.displayName=`SimpleBezierEdge`,nJ.displayName=`SimpleBezierEdgeInternal`;function rJ(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,sourcePosition:p=$.Bottom,targetPosition:m=$.Top,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=mW({sourceX:n,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:_?.borderRadius,offset:_?.offset,stepPosition:_?.stepPosition});return(0,G.jsx)(Zq,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:v})})}var iJ=rJ({isInternal:!1}),aJ=rJ({isInternal:!0});iJ.displayName=`SmoothStepEdge`,aJ.displayName=`SmoothStepEdgeInternal`;function oJ(e){return(0,U.memo)(({id:t,...n})=>{let r=e.isInternal?void 0:t;return(0,G.jsx)(iJ,{...n,id:r,pathOptions:(0,U.useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}var sJ=oJ({isInternal:!1}),cJ=oJ({isInternal:!0});sJ.displayName=`StepEdge`,cJ.displayName=`StepEdgeInternal`;function lJ(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})=>{let[g,_,v]=cW({sourceX:n,sourceY:r,targetX:i,targetY:a});return(0,G.jsx)(Zq,{id:e.isInternal?void 0:t,path:g,labelX:_,labelY:v,label:o,labelStyle:s,labelShowBg:c,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,style:f,markerEnd:p,markerStart:m,interactionWidth:h})})}var uJ=lJ({isInternal:!1}),dJ=lJ({isInternal:!0});uJ.displayName=`StraightEdge`,dJ.displayName=`StraightEdgeInternal`;function fJ(e){return(0,U.memo)(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o=$.Bottom,targetPosition:s=$.Top,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,pathOptions:_,interactionWidth:v})=>{let[y,b,x]=tW({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:a,targetPosition:s,curvature:_?.curvature});return(0,G.jsx)(Zq,{id:e.isInternal?void 0:t,path:y,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:p,style:m,markerEnd:h,markerStart:g,interactionWidth:v})})}var pJ=fJ({isInternal:!1}),mJ=fJ({isInternal:!0});pJ.displayName=`BezierEdge`,mJ.displayName=`BezierEdgeInternal`;var hJ={default:mJ,straight:dJ,step:cJ,smoothstep:aJ,simplebezier:nJ},gJ={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},_J=(e,t,n)=>n===$.Left?e-t:n===$.Right?e+t:e,vJ=(e,t,n)=>n===$.Top?e-t:n===$.Bottom?e+t:e,yJ=`react-flow__edgeupdater`;function bJ({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s}){return(0,G.jsx)(`circle`,{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:aL([yJ,`${yJ}-${s}`]),cx:_J(t,r,e),cy:vJ(n,r,e),r,stroke:`transparent`,fill:`transparent`})}function xJ({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:a,targetY:o,sourcePosition:s,targetPosition:c,onReconnect:l,onReconnectStart:u,onReconnectEnd:d,setReconnecting:f,setUpdateHover:p}){let m=KG(),h=(e,t)=>{if(e.button!==0)return;let{autoPanOnConnect:r,domNode:i,connectionMode:a,connectionRadius:o,lib:s,onConnectStart:c,cancelConnection:p,nodeLookup:h,rfId:g,panBy:_,updateConnection:v}=m.getState(),y=t.type===`target`;tG.onPointerDown(e.nativeEvent,{autoPanOnConnect:r,connectionMode:a,connectionRadius:o,domNode:i,handleId:t.id,nodeId:t.nodeId,nodeLookup:h,isTarget:y,edgeUpdaterType:t.type,lib:s,flowId:g,cancelConnection:p,panBy:_,isValidConnection:(...e)=>m.getState().isValidConnection?.(...e)??!0,onConnect:e=>l?.(n,e),onConnectStart:(r,i)=>{f(!0),u?.(e,n,t.type),c?.(r,i)},onConnectEnd:(...e)=>m.getState().onConnectEnd?.(...e),onReconnectEnd:(e,r)=>{f(!1),d?.(e,n,t.type,r)},updateConnection:v,getTransform:()=>m.getState().transform,getFromHandle:()=>m.getState().connection.fromHandle,dragThreshold:m.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},g=e=>h(e,{nodeId:n.target,id:n.targetHandle??null,type:`target`}),_=e=>h(e,{nodeId:n.source,id:n.sourceHandle??null,type:`source`}),v=()=>p(!0),y=()=>p(!1);return(0,G.jsxs)(G.Fragment,{children:[(e===!0||e===`source`)&&(0,G.jsx)(bJ,{position:s,centerX:r,centerY:i,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:y,type:`source`}),(e===!0||e===`target`)&&(0,G.jsx)(bJ,{position:c,centerX:a,centerY:o,radius:t,onMouseDown:_,onMouseEnter:v,onMouseOut:y,type:`target`})]})}function SJ({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,rfId:m,edgeTypes:h,noPanClassName:g,onError:_,disableKeyboardA11y:v}){let y=GG(t=>t.edgeLookup.get(e)),b=GG(e=>e.defaultEdgeOptions);y=b?{...b,...y}:y;let x=y.type||`default`,S=h?.[x]||hJ[x];S===void 0&&(_?.(`011`,UH.error011(x)),x=`default`,S=h?.default||hJ.default);let C=!!(y.focusable||t&&y.focusable===void 0),w=d!==void 0&&(y.reconnectable||n&&y.reconnectable===void 0),T=!!(y.selectable||r&&y.selectable===void 0),E=(0,U.useRef)(null),[D,O]=(0,U.useState)(!1),[k,A]=(0,U.useState)(!1),j=KG(),{zIndex:M=y.zIndex,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L}=GG((0,U.useCallback)(t=>{let n=t.nodeLookup.get(y.source),r=t.nodeLookup.get(y.target);if(!n||!r)return gJ;let i=gW({id:e,sourceNode:n,targetNode:r,sourceHandle:y.sourceHandle||null,targetHandle:y.targetHandle||null,connectionMode:t.connectionMode,onError:_}),a=rW({selected:y.selected,zIndex:y.zIndex,sourceNode:n,targetNode:r,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...i||gJ,zIndex:a}},[y.source,y.target,y.sourceHandle,y.targetHandle,y.selected,y.zIndex]),VG),te=(0,U.useMemo)(()=>y.markerStart?`url('#${bW(y.markerStart,m)}')`:void 0,[y.markerStart,m]),ne=(0,U.useMemo)(()=>y.markerEnd?`url('#${bW(y.markerEnd,m)}')`:void 0,[y.markerEnd,m]);if(y.hidden||N===null||P===null||ee===null||F===null)return null;let re=t=>{let{addSelectedEdges:n,unselectNodesAndEdges:r,multiSelectionActive:a}=j.getState();T&&(j.setState({nodesSelectionActive:!1}),y.selected&&a?(r({nodes:[],edges:[y]}),E.current?.blur()):n([e])),i&&i(t,y)},R=a?e=>{a(e,{...y})}:void 0,ie=o?e=>{o(e,{...y})}:void 0,ae=s?e=>{s(e,{...y})}:void 0,oe=c?e=>{c(e,{...y})}:void 0,se=l?e=>{l(e,{...y})}:void 0;return(0,G.jsx)(`svg`,{style:{zIndex:M},children:(0,G.jsxs)(`g`,{className:aL([`react-flow__edge`,`react-flow__edge-${x}`,y.className,g,{selected:y.selected,animated:y.animated,inactive:!T&&!i,updating:D,selectable:T}]),onClick:re,onDoubleClick:R,onContextMenu:ie,onMouseEnter:ae,onMouseMove:oe,onMouseLeave:se,onKeyDown:C?t=>{if(!v&&GH.includes(t.key)&&T){let{unselectNodesAndEdges:n,addSelectedEdges:r}=j.getState();t.key===`Escape`?(E.current?.blur(),n({edges:[y]})):r([e])}}:void 0,tabIndex:C?0:void 0,role:y.ariaRole??(C?`group`:`img`),"aria-roledescription":`edge`,"data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":y.ariaLabel===null?void 0:y.ariaLabel||`Edge from ${y.source} to ${y.target}`,"aria-describedby":C?`${XG}-${m}`:void 0,ref:E,...y.domAttributes,children:[!k&&(0,G.jsx)(S,{id:e,source:y.source,target:y.target,type:y.type,selected:y.selected,animated:y.animated,selectable:T,deletable:y.deletable??!0,label:y.label,labelStyle:y.labelStyle,labelShowBg:y.labelShowBg,labelBgStyle:y.labelBgStyle,labelBgPadding:y.labelBgPadding,labelBgBorderRadius:y.labelBgBorderRadius,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,data:y.data,style:y.style,sourceHandleId:y.sourceHandle,targetHandleId:y.targetHandle,markerStart:te,markerEnd:ne,pathOptions:`pathOptions`in y?y.pathOptions:void 0,interactionWidth:y.interactionWidth}),w&&(0,G.jsx)(xJ,{edge:y,isReconnectable:w,reconnectRadius:u,onReconnect:d,onReconnectStart:f,onReconnectEnd:p,sourceX:N,sourceY:P,targetX:ee,targetY:F,sourcePosition:I,targetPosition:L,setUpdateHover:O,setReconnecting:A})]})})}var CJ=(0,U.memo)(SJ),wJ=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function TJ({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:u,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,disableKeyboardA11y:h}){let{edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,onError:y}=GG(wJ,VG),b=Vq(t);return(0,G.jsxs)(`div`,{className:`react-flow__edges`,children:[(0,G.jsx)(Jq,{defaultColor:e,rfId:n}),b.map(e=>(0,G.jsx)(CJ,{id:e,edgesFocusable:g,edgesReconnectable:_,elementsSelectable:v,noPanClassName:i,onReconnect:a,onContextMenu:o,onMouseEnter:s,onMouseMove:c,onMouseLeave:l,onClick:u,reconnectRadius:d,onDoubleClick:f,onReconnectStart:p,onReconnectEnd:m,rfId:n,onError:y,edgeTypes:r,disableKeyboardA11y:h},e))]})}TJ.displayName=`EdgeRenderer`;var EJ=(0,U.memo)(TJ),DJ=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function OJ({children:e}){let t=KG(),n=(0,U.useRef)(null),[r]=(0,U.useState)(()=>t.getState().transform);return LK(()=>{let e=null,r=()=>{let r=t.getState().transform;e&&r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]||(e=r,n.current&&(n.current.style.transform=DJ(r)))};return r(),t.subscribe(r)},[t]),(0,G.jsx)(`div`,{ref:n,className:`react-flow__viewport xyflow__viewport react-flow__container`,style:{transform:DJ(r)},children:e})}function kJ(e){let t=WK(),n=(0,U.useRef)(!1);(0,U.useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}var AJ=e=>e.panZoom?.syncViewport;function jJ(e){let t=GG(AJ),n=KG();return(0,U.useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function MJ(e){return e.connection.inProgress?{...e.connection,to:AU(e.connection.to,e.transform)}:{...e.connection}}function NJ(e){return e?t=>e(MJ(t)):MJ}function PJ(e){return GG(NJ(e),VG)}var FJ=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function IJ({containerStyle:e,style:t,type:n,component:r}){let{nodesConnectable:i,width:a,height:o,isValid:s,inProgress:c}=GG(FJ,VG);return a&&i&&c?(0,G.jsx)(`svg`,{style:e,width:a,height:o,className:`react-flow__connectionline react-flow__container`,children:(0,G.jsx)(`g`,{className:aL([`react-flow__connection`,eU(s)]),children:(0,G.jsx)(LJ,{style:t,type:n,CustomComponent:r,isValid:s})})}):null}var LJ=({style:e,type:t=ZH.Bezier,CustomComponent:n,isValid:r})=>{let{inProgress:i,from:a,fromNode:o,fromHandle:s,fromPosition:c,to:l,toNode:u,toHandle:d,toPosition:f,pointer:p}=PJ();if(!i)return;if(n)return(0,G.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:s,fromX:a.x,fromY:a.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:eU(r),toNode:u,toHandle:d,pointer:p});let m=``,h={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case ZH.Bezier:[m]=tW(h);break;case ZH.SimpleBezier:[m]=$q(h);break;case ZH.Step:[m]=mW({...h,borderRadius:0});break;case ZH.SmoothStep:[m]=mW(h);break;default:[m]=cW(h)}return(0,G.jsx)(`path`,{d:m,fill:`none`,className:`react-flow__connection-path`,style:e})};LJ.displayName=`ConnectionLine`;var RJ={};function zJ(e=RJ){(0,U.useRef)(e),KG(),(0,U.useEffect)(()=>{},[e])}function BJ(){KG(),(0,U.useRef)(!1),(0,U.useEffect)(()=>{},[])}function VJ({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:a,onEdgeDoubleClick:o,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:p,connectionLineType:m,connectionLineStyle:h,connectionLineComponent:g,connectionLineContainerStyle:_,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:w,onlyRenderVisibleElements:T,elementsSelectable:E,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,preventScrolling:j,defaultMarkerColor:M,zoomOnScroll:N,zoomOnPinch:P,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,zoomOnDoubleClick:L,panOnDrag:te,autoPanOnSelection:ne,onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneScroll:oe,onPaneContextMenu:se,paneClickDistance:ce,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,viewport:z,onViewportChange:we,nodesDraggable:Te}){return zJ(e),zJ(t),BJ(),kJ(n),jJ(z),(0,G.jsx)(Aq,{onPaneClick:re,onPaneMouseEnter:R,onPaneMouseMove:ie,onPaneMouseLeave:ae,onPaneContextMenu:se,onPaneScroll:oe,paneClickDistance:ce,deleteKeyCode:w,selectionKeyCode:v,selectionOnDrag:y,selectionMode:b,onSelectionStart:f,onSelectionEnd:p,multiSelectionKeyCode:x,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:P,zoomOnDoubleClick:L,panOnScroll:ee,panOnScrollSpeed:F,panOnScrollMode:I,panOnDrag:te,autoPanOnSelection:ne,defaultViewport:D,translateExtent:O,minZoom:k,maxZoom:A,onSelectionContextMenu:d,preventScrolling:j,noDragClassName:ve,noWheelClassName:ye,noPanClassName:be,disableKeyboardA11y:xe,onViewportChange:we,isControlledViewport:!!z,children:(0,G.jsxs)(OJ,{children:[(0,G.jsx)(EJ,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:he,onReconnectStart:ge,onReconnectEnd:_e,onlyRenderVisibleElements:T,onEdgeContextMenu:ue,onEdgeMouseEnter:de,onEdgeMouseMove:fe,onEdgeMouseLeave:pe,reconnectRadius:me,defaultMarkerColor:M,noPanClassName:be,disableKeyboardA11y:xe,rfId:Ce}),(0,G.jsx)(IJ,{style:h,type:m,component:g,containerStyle:_}),(0,G.jsx)(`div`,{className:`react-flow__edgelabel-renderer`}),(0,G.jsx)(Bq,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:s,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:u,nodeClickDistance:le,onlyRenderVisibleElements:T,noPanClassName:be,noDragClassName:ve,disableKeyboardA11y:xe,nodeExtent:Se,rfId:Ce,nodesDraggable:Te}),(0,G.jsx)(`div`,{className:`react-flow__viewport-portal`})]})})}VJ.displayName=`GraphView`;var HJ=(0,U.memo)(VJ),UJ=OU(`React Flow`,`https://reactflow.dev/`),WJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c=.5,maxZoom:l=2,nodeOrigin:u,nodeExtent:d,zIndexMode:f=`basic`}={})=>{let p=new Map,m=new Map,h=new Map,g=new Map,_=r??t??[],v=n??e??[],y=u??[0,0],b=d??WH;zW(h,g,_);let{nodesInitialized:x}=AW(v,p,m,{nodeOrigin:y,nodeExtent:b,zIndexMode:f}),S=[0,0,1];if(o&&i&&a){let{x:e,y:t,zoom:n}=FU(oU(p,{filter:e=>!!((e.width||e.initialWidth)&&(e.height||e.initialHeight))}),i,a,c,l,s?.padding??.1);S=[e,t,n]}return{rfId:`1`,width:i??0,height:a??0,transform:S,nodes:v,nodesInitialized:x,nodeLookup:p,parentLookup:m,edges:_,edgeLookup:g,connectionLookup:h,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:WH,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:qH.Strict,domNode:null,paneDragging:!1,noPanClassName:`nopan`,nodeOrigin:y,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:s,fitViewResolver:null,connection:{...XH},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:``,autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:UJ,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:`react`,debug:!1,ariaLabelConfig:KH,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},GJ=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f})=>BG((p,m)=>{async function h(){let{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:r,width:i,height:a,minZoom:o,maxZoom:s}=m();t&&(await uU({nodes:e,width:i,height:a,panZoom:t,minZoom:o,maxZoom:s},n),r?.resolve(!0),p({fitViewResolver:null}))}return{...WJ({nodes:e,edges:t,width:i,height:a,fitView:o,fitViewOptions:s,minZoom:c,maxZoom:l,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:e=>{let{nodeLookup:t,parentLookup:n,nodeOrigin:r,elevateNodesOnSelect:i,fitViewQueued:a,zIndexMode:o,nodesSelectionActive:s}=m(),{nodesInitialized:c,hasSelectedNodes:l}=AW(e,t,n,{nodeOrigin:r,nodeExtent:d,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:o}),u=s&&l;a&&c?(h(),p({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):p({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{let{connectionLookup:t,edgeLookup:n}=m();zW(t,n,e),p({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){let{setNodes:t}=m();t(e),p({hasDefaultNodes:!0})}if(t){let{setEdges:e}=m();e(t),p({hasDefaultEdges:!0})}},updateNodeInternals:e=>{let{triggerNodeChanges:t,nodeLookup:n,parentLookup:r,domNode:i,nodeOrigin:a,nodeExtent:o,debug:s,fitViewQueued:c,zIndexMode:l}=m(),{changes:u,updatedInternals:d}=IW(e,n,r,i,a,o,l);d&&(DW(n,r,{nodeOrigin:a,nodeExtent:o,zIndexMode:l}),c?(h(),p({fitViewQueued:!1,fitViewOptions:void 0})):p({}),u?.length>0&&(s&&console.log(`React Flow: trigger node changes`,u),t?.(u)))},updateNodePositions:(e,t=!1)=>{let n=[],r=[],{nodeLookup:i,triggerNodeChanges:a,connection:o,updateConnection:s,onNodesChangeMiddlewareMap:c}=m();for(let[a,c]of e){let e=i.get(a),l=!!(e?.expandParent&&e?.parentId&&c?.position),u={id:a,type:`position`,position:l?{x:Math.max(0,c.position.x),y:Math.max(0,c.position.y)}:c.position,dragging:t};if(e&&o.inProgress&&o.fromNode.id===e.id){let t=vW(e,o.fromHandle,$.Left,!0);s({...o,from:t})}l&&e.parentId&&n.push({id:a,parentId:e.parentId,rect:{...c.internals.positionAbsolute,width:c.measured.width??0,height:c.measured.height??0}}),r.push(u)}if(n.length>0){let{parentLookup:e,nodeOrigin:t}=m(),a=FW(n,i,e,t);r.push(...a)}for(let e of c.values())r=e(r);a(r)},triggerNodeChanges:e=>{let{onNodesChange:t,setNodes:n,nodes:r,hasDefaultNodes:i,debug:a}=m();e?.length&&(i&&n(EK(e,r)),a&&console.log(`React Flow: trigger node changes`,e),t?.(e))},triggerEdgeChanges:e=>{let{onEdgesChange:t,setEdges:n,edges:r,hasDefaultEdges:i,debug:a}=m();e?.length&&(i&&n(DK(e,r)),a&&console.log(`React Flow: trigger edge changes`,e),t?.(e))},addSelectedNodes:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){i(e.map(e=>OK(e,!0)));return}i(kK(r,new Set([...e]),!0)),a(kK(n))},addSelectedEdges:e=>{let{multiSelectionActive:t,edgeLookup:n,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=m();if(t){a(e.map(e=>OK(e,!0)));return}a(kK(n,new Set([...e]))),i(kK(r,new Set,!0))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{let{edges:n,nodes:r,nodeLookup:i,triggerNodeChanges:a,triggerEdgeChanges:o}=m(),s=e||r,c=t||n,l=[];for(let e of s){if(!e.selected)continue;let t=i.get(e.id);t&&(t.selected=!1),l.push(OK(e.id,!1))}let u=[];for(let e of c)e.selected&&u.push(OK(e.id,!1));a(l),o(u)},setMinZoom:e=>{let{panZoom:t,maxZoom:n}=m();t?.setScaleExtent([e,n]),p({minZoom:e})},setMaxZoom:e=>{let{panZoom:t,minZoom:n}=m();t?.setScaleExtent([n,e]),p({maxZoom:e})},setTranslateExtent:e=>{m().panZoom?.setTranslateExtent(e),p({translateExtent:e})},resetSelectedElements:()=>{let{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:r,elementsSelectable:i}=m();if(!i)return;let a=t.reduce((e,t)=>t.selected?[...e,OK(t.id,!1)]:e,[]),o=e.reduce((e,t)=>t.selected?[...e,OK(t.id,!1)]:e,[]);n(a),r(o)},setNodeExtent:e=>{let{nodes:t,nodeLookup:n,parentLookup:r,nodeOrigin:i,elevateNodesOnSelect:a,nodeExtent:o,zIndexMode:s}=m();e[0][0]===o[0][0]&&e[0][1]===o[0][1]&&e[1][0]===o[1][0]&&e[1][1]===o[1][1]||(AW(t,n,r,{nodeOrigin:i,nodeExtent:e,elevateNodesOnSelect:a,checkEquality:!1,zIndexMode:s}),p({nodeExtent:e}))},panBy:e=>{let{transform:t,width:n,height:r,panZoom:i,translateExtent:a}=m();return LW({delta:e,panZoom:i,transform:t,translateExtent:a,width:n,height:r})},setCenter:async(e,t,n)=>{let{width:r,height:i,maxZoom:a,panZoom:o}=m();if(!o)return!1;let s=n?.zoom===void 0?a:n.zoom;return await o.setViewport({x:r/2-e*s,y:i/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{p({connection:{...XH}})},updateConnection:e=>{p({connection:e})},reset:()=>p({...WJ()})}},Object.is);function KJ({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:a,initialMinZoom:o,initialMaxZoom:s,initialFitViewOptions:c,fitView:l,nodeOrigin:u,nodeExtent:d,zIndexMode:f,children:p}){let[m]=(0,U.useState)(()=>GJ({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:a,fitView:l,minZoom:o,maxZoom:s,fitViewOptions:c,nodeOrigin:u,nodeExtent:d,zIndexMode:f}));return(0,G.jsx)(UG,{value:m,children:(0,G.jsx)(VK,{children:(0,G.jsx)(fq,{children:p})})})}function qJ({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:a,height:o,fitView:s,fitViewOptions:c,minZoom:l,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p}){return(0,U.useContext)(HG)?(0,G.jsx)(G.Fragment,{children:e}):(0,G.jsx)(KJ,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:o,fitView:s,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:e})}var JJ={width:`100%`,height:`100%`,overflow:`hidden`,position:`relative`,zIndex:0};function YJ({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:a,edgeTypes:o,onNodeClick:s,onEdgeClick:c,onInit:l,onMove:u,onMoveStart:d,onMoveEnd:f,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onSelectionChange:k,onSelectionDragStart:A,onSelectionDrag:j,onSelectionDragStop:M,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onBeforeDelete:F,connectionMode:I,connectionLineType:L=ZH.Bezier,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,deleteKeyCode:R=`Backspace`,selectionKeyCode:ie=`Shift`,selectionOnDrag:ae=!1,selectionMode:oe=YH.Full,panActivationKeyCode:se=`Space`,multiSelectionKeyCode:ce=IU()?`Meta`:`Control`,zoomActivationKeyCode:le=IU()?`Meta`:`Control`,snapToGrid:ue,snapGrid:de,onlyRenderVisibleElements:fe=!1,selectNodesOnDrag:pe,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,nodeOrigin:ve=dK,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe=!0,defaultViewport:Se=fK,minZoom:Ce=.5,maxZoom:z=2,translateExtent:we=WH,preventScrolling:Te=!0,nodeExtent:Ee,defaultMarkerColor:De=`#b1b1b7`,zoomOnScroll:Oe=!0,zoomOnPinch:ke=!0,panOnScroll:Ae=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Me=JH.Free,zoomOnDoubleClick:Ne=!0,panOnDrag:Pe=!0,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be=1,nodeClickDistance:Ve=0,children:V,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe=10,onNodesChange:Ze,onEdgesChange:Qe,noDragClassName:$e=`nodrag`,noWheelClassName:et=`nowheel`,noPanClassName:tt=`nopan`,fitView:nt,fitViewOptions:rt,connectOnClick:it,attributionPosition:at,proOptions:H,defaultEdgeOptions:ot,elevateNodesOnSelect:st=!0,elevateEdgesOnSelect:ct=!1,disableKeyboardA11y:lt=!1,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanOnSelection:ft=!0,autoPanSpeed:pt,connectionRadius:mt,isValidConnection:W,onError:ht,style:gt,id:_t,nodeDragThreshold:vt,connectionDragThreshold:yt,viewport:bt,onViewportChange:xt,width:St,height:Ct,colorMode:wt=`light`,debug:Tt,onScroll:Et,ariaLabelConfig:Dt,zIndexMode:Ot=`basic`,...kt},At){let jt=_t||`1`,Mt=vK(wt),Nt=(0,U.useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:`instant`}),Et?.(e)},[Et]);return(0,G.jsx)(`div`,{"data-testid":`rf__wrapper`,...kt,onScroll:Nt,style:{...gt,...JJ},ref:At,className:aL([`react-flow`,i,Mt]),id:_t,role:`application`,children:(0,G.jsxs)(qJ,{nodes:e,edges:t,width:St,height:Ct,fitView:nt,fitViewOptions:rt,minZoom:Ce,maxZoom:z,nodeOrigin:ve,nodeExtent:Ee,zIndexMode:Ot,children:[(0,G.jsx)(gK,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:p,onConnectStart:m,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:_,nodesDraggable:me,autoPanOnNodeFocus:he,nodesConnectable:ge,nodesFocusable:_e,edgesFocusable:ye,edgesReconnectable:be,elementsSelectable:xe,elevateNodesOnSelect:st,elevateEdgesOnSelect:ct,minZoom:Ce,maxZoom:z,nodeExtent:Ee,onNodesChange:Ze,onEdgesChange:Qe,snapToGrid:ue,snapGrid:de,connectionMode:I,translateExtent:we,connectOnClick:it,defaultEdgeOptions:ot,fitView:nt,fitViewOptions:rt,onNodesDelete:E,onEdgesDelete:D,onDelete:O,onNodeDragStart:C,onNodeDrag:w,onNodeDragStop:T,onSelectionDrag:j,onSelectionDragStart:A,onSelectionDragStop:M,onMove:u,onMoveStart:d,onMoveEnd:f,noPanClassName:tt,nodeOrigin:ve,rfId:jt,autoPanOnConnect:ut,autoPanOnNodeDrag:dt,autoPanSpeed:pt,onError:ht,connectionRadius:mt,isValidConnection:W,selectNodesOnDrag:pe,nodeDragThreshold:vt,connectionDragThreshold:yt,onBeforeDelete:F,debug:Tt,ariaLabelConfig:Dt,zIndexMode:Ot}),(0,G.jsx)(HJ,{onInit:l,onNodeClick:s,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:y,onNodeMouseLeave:b,onNodeContextMenu:x,onNodeDoubleClick:S,nodeTypes:a,edgeTypes:o,connectionLineType:L,connectionLineStyle:te,connectionLineComponent:ne,connectionLineContainerStyle:re,selectionKeyCode:ie,selectionOnDrag:ae,selectionMode:oe,deleteKeyCode:R,multiSelectionKeyCode:ce,panActivationKeyCode:se,zoomActivationKeyCode:le,onlyRenderVisibleElements:fe,defaultViewport:Se,translateExtent:we,minZoom:Ce,maxZoom:z,preventScrolling:Te,zoomOnScroll:Oe,zoomOnPinch:ke,zoomOnDoubleClick:Ne,panOnScroll:Ae,panOnScrollSpeed:je,panOnScrollMode:Me,panOnDrag:Pe,autoPanOnSelection:ft,onPaneClick:B,onPaneMouseEnter:Fe,onPaneMouseMove:Ie,onPaneMouseLeave:Le,onPaneScroll:Re,onPaneContextMenu:ze,paneClickDistance:Be,nodeClickDistance:Ve,onSelectionContextMenu:N,onSelectionStart:P,onSelectionEnd:ee,onReconnect:He,onReconnectStart:Ue,onReconnectEnd:We,onEdgeContextMenu:Ge,onEdgeDoubleClick:Ke,onEdgeMouseEnter:qe,onEdgeMouseMove:Je,onEdgeMouseLeave:Ye,reconnectRadius:Xe,defaultMarkerColor:De,noDragClassName:$e,noWheelClassName:et,noPanClassName:tt,rfId:jt,disableKeyboardA11y:lt,nodeExtent:Ee,viewport:bt,onViewportChange:xt,nodesDraggable:me}),(0,G.jsx)(uK,{onSelectionChange:k}),V,(0,G.jsx)(iK,{proOptions:H,position:at}),(0,G.jsx)(tK,{rfId:jt,disableKeyboardA11y:lt})]})})}var XJ=IK(YJ);UH.error014();function ZJ({dimensions:e,lineWidth:t,variant:n,className:r}){return(0,G.jsx)(`path`,{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:aL([`react-flow__background-pattern`,n,r])})}function QJ({radius:e,className:t}){return(0,G.jsx)(`circle`,{cx:e,cy:e,r:e,className:aL([`react-flow__background-pattern`,`dots`,t])})}var $J;(function(e){e.Lines=`lines`,e.Dots=`dots`,e.Cross=`cross`})($J||={});var eY={[$J.Dots]:1,[$J.Lines]:1,[$J.Cross]:6},tY=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function nY({id:e,variant:t=$J.Dots,gap:n=20,size:r,lineWidth:i=1,offset:a=0,color:o,bgColor:s,style:c,className:l,patternClassName:u}){let d=(0,U.useRef)(null),{transform:f,patternId:p}=GG(tY,VG),m=r||eY[t],h=t===$J.Dots,g=t===$J.Cross,_=Array.isArray(n)?n:[n,n],v=[_[0]*f[2]||1,_[1]*f[2]||1],y=m*f[2],b=Array.isArray(a)?a:[a,a],x=g?[y,y]:v,S=[b[0]*f[2]||1+x[0]/2,b[1]*f[2]||1+x[1]/2],C=`${p}${e||``}`;return(0,G.jsxs)(`svg`,{className:aL([`react-flow__background`,l]),style:{...c,...YK,"--xy-background-color-props":s,"--xy-background-pattern-color-props":o},ref:d,"data-testid":`rf__background`,children:[(0,G.jsx)(`pattern`,{id:C,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:`userSpaceOnUse`,patternTransform:`translate(-${S[0]},-${S[1]})`,children:h?(0,G.jsx)(QJ,{radius:y/2,className:u}):(0,G.jsx)(ZJ,{dimensions:x,lineWidth:i,variant:t,className:u})}),(0,G.jsx)(`rect`,{x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`url(#${C})`})]})}nY.displayName=`Background`;var rY=(0,U.memo)(nY);function iY(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 32`,children:(0,G.jsx)(`path`,{d:`M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z`})})}function aY(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 5`,children:(0,G.jsx)(`path`,{d:`M0 0h32v4.2H0z`})})}function oY(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 32 30`,children:(0,G.jsx)(`path`,{d:`M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z`})})}function sY(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,G.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z`})})}function cY(){return(0,G.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 25 32`,children:(0,G.jsx)(`path`,{d:`M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z`})})}function lY({children:e,className:t,...n}){return(0,G.jsx)(`button`,{type:`button`,className:aL([`react-flow__controls-button`,t]),...n,children:e})}var uY=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function dY({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:c,className:l,children:u,position:d=`bottom-left`,orientation:f=`vertical`,"aria-label":p}){let m=KG(),{isInteractive:h,minZoomReached:g,maxZoomReached:_,ariaLabelConfig:v}=GG(uY,VG),{zoomIn:y,zoomOut:b,fitView:x}=WK();return(0,G.jsxs)(nK,{className:aL([`react-flow__controls`,f===`horizontal`?`horizontal`:`vertical`,l]),position:d,style:e,"data-testid":`rf__controls`,"aria-label":p??v[`controls.ariaLabel`],children:[t&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(lY,{onClick:()=>{y(),a?.()},className:`react-flow__controls-zoomin`,title:v[`controls.zoomIn.ariaLabel`],"aria-label":v[`controls.zoomIn.ariaLabel`],disabled:_,children:(0,G.jsx)(iY,{})}),(0,G.jsx)(lY,{onClick:()=>{b(),o?.()},className:`react-flow__controls-zoomout`,title:v[`controls.zoomOut.ariaLabel`],"aria-label":v[`controls.zoomOut.ariaLabel`],disabled:g,children:(0,G.jsx)(aY,{})})]}),n&&(0,G.jsx)(lY,{className:`react-flow__controls-fitview`,onClick:()=>{x(i),s?.()},title:v[`controls.fitView.ariaLabel`],"aria-label":v[`controls.fitView.ariaLabel`],children:(0,G.jsx)(oY,{})}),r&&(0,G.jsx)(lY,{className:`react-flow__controls-interactive`,onClick:()=>{m.setState({nodesDraggable:!h,nodesConnectable:!h,elementsSelectable:!h}),c?.(!h)},title:v[`controls.interactive.ariaLabel`],"aria-label":v[`controls.interactive.ariaLabel`],children:h?(0,G.jsx)(cY,{}):(0,G.jsx)(sY,{})}),u]})}dY.displayName=`Controls`;var fY=(0,U.memo)(dY);function pY({id:e,x:t,y:n,width:r,height:i,style:a,color:o,strokeColor:s,strokeWidth:c,className:l,borderRadius:u,shapeRendering:d,selected:f,onClick:p}){let{background:m,backgroundColor:h}=a||{},g=o||m||h;return(0,G.jsx)(`rect`,{className:aL([`react-flow__minimap-node`,{selected:f},l]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:g,stroke:s,strokeWidth:c},shapeRendering:d,onClick:p?t=>p(t,e):void 0})}var mY=(0,U.memo)(pY),hY=e=>e.nodes.map(e=>e.id),gY=e=>e instanceof Function?e:()=>e;function _Y({nodeStrokeColor:e,nodeColor:t,nodeClassName:n=``,nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=mY,onClick:o}){let s=GG(hY,VG),c=gY(t),l=gY(e),u=gY(n),d=typeof window>`u`||window.chrome?`crispEdges`:`geometricPrecision`;return(0,G.jsx)(G.Fragment,{children:s.map(e=>(0,G.jsx)(yY,{id:e,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:o,shapeRendering:d},e))})}function vY({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:o,NodeComponent:s,onClick:c}){let{node:l,x:u,y:d,width:f,height:p}=GG(t=>{let n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};let r=n.internals.userNode,{x:i,y:a}=n.internals.positionAbsolute,{width:o,height:s}=RU(r);return{node:r,x:i,y:a,width:o,height:s}},VG);return!l||l.hidden||!zU(l)?null:(0,G.jsx)(s,{x:u,y:d,width:f,height:p,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:i,strokeColor:n(l),strokeWidth:a,shapeRendering:o,onClick:c,id:l.id})}var yY=(0,U.memo)(vY),bY=(0,U.memo)(_Y),xY=200,SY=150,CY=e=>!e.hidden,wY=e=>{let t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?CU(oU(e.nodeLookup,{filter:CY}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},TY=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,EY=(e,t)=>TY(e.viewBB,t.viewBB)&&TY(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig,DY=`react-flow__minimap-desc`;function OY({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i=``,nodeBorderRadius:a=5,nodeStrokeWidth:o,nodeComponent:s,bgColor:c,maskColor:l,maskStrokeColor:u,maskStrokeWidth:d,position:f=`bottom-right`,onClick:p,onNodeClick:m,pannable:h=!1,zoomable:g=!1,ariaLabel:_,inversePan:v,zoomStep:y=1,offsetScale:b=5}){let x=KG(),S=(0,U.useRef)(null),{boundingRect:C,viewBB:w,rfId:T,panZoom:E,translateExtent:D,flowWidth:O,flowHeight:k,ariaLabelConfig:A}=GG(wY,EY),j=e?.width??xY,M=e?.height??SY,N=C.width/j,P=C.height/M,ee=Math.max(N,P),F=ee*j,I=ee*M,L=b*ee,te=C.x-(F-C.width)/2-L,ne=C.y-(I-C.height)/2-L,re=F+L*2,R=I+L*2,ie=`${DY}-${T}`,ae=(0,U.useRef)(0),oe=(0,U.useRef)();ae.current=ee,(0,U.useEffect)(()=>{if(S.current&&E)return oe.current=nG({domNode:S.current,panZoom:E,getTransform:()=>x.getState().transform,getViewScale:()=>ae.current}),()=>{oe.current?.destroy()}},[E]),(0,U.useEffect)(()=>{oe.current?.update({translateExtent:D,width:O,height:k,inversePan:v,pannable:h,zoomStep:y,zoomable:g})},[h,g,v,y,D,O,k]);let se=p?e=>{let[t,n]=oe.current?.pointer(e)||[0,0];p(e,{x:t,y:n})}:void 0,ce=m?(0,U.useCallback)((e,t)=>{let n=x.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,le=_??A[`minimap.ariaLabel`];return(0,G.jsx)(nK,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c==`string`?c:void 0,"--xy-minimap-mask-background-color-props":typeof l==`string`?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof u==`string`?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof d==`number`?d*ee:void 0,"--xy-minimap-node-background-color-props":typeof r==`string`?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n==`string`?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o==`number`?o:void 0},className:aL([`react-flow__minimap`,t]),"data-testid":`rf__minimap`,children:(0,G.jsxs)(`svg`,{width:j,height:M,viewBox:`${te} ${ne} ${re} ${R}`,className:`react-flow__minimap-svg`,role:`img`,"aria-labelledby":ie,ref:S,onClick:se,children:[le&&(0,G.jsx)(`title`,{id:ie,children:le}),(0,G.jsx)(bY,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),(0,G.jsx)(`path`,{className:`react-flow__minimap-mask`,d:`M${te-L},${ne-L}h${re+L*2}v${R+L*2}h${-re-L*2}z
95
+ M${w.x},${w.y}h${w.width}v${w.height}h${-w.width}z`,fillRule:`evenodd`,pointerEvents:`none`})]})})}OY.displayName=`MiniMap`,(0,U.memo)(OY);var kY=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,AY={[_G.Line]:`right`,[_G.Handle]:`bottom-right`};function jY({nodeId:e,position:t,variant:n=_G.Handle,className:r,style:i=void 0,children:a,color:o,minWidth:s=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:p=!0,shouldResize:m,onResizeStart:h,onResize:g,onResizeEnd:_}){let v=lq(),y=typeof e==`string`?e:v,b=KG(),x=(0,U.useRef)(null),S=n===_G.Handle,C=GG((0,U.useCallback)(kY(S&&p),[S,p]),VG),w=(0,U.useRef)(null),T=t??AY[n];return(0,U.useEffect)(()=>{if(!(!x.current||!y))return w.current||=OG({domNode:x.current,nodeId:y,getStoreItems:()=>{let{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,domNode:a}=b.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:r,nodeOrigin:i,paneDomNode:a}},onChange:(e,t)=>{let{triggerNodeChanges:n,nodeLookup:r,parentLookup:i,nodeOrigin:a}=b.getState(),o=[],s={x:e.x,y:e.y},c=r.get(y);if(c&&c.expandParent&&c.parentId){let t=c.origin??a,n=e.width??c.measured.width??0,l=e.height??c.measured.height??0,u=FW([{id:c.id,parentId:c.parentId,rect:{width:n,height:l,...BU({x:e.x??c.position.x,y:e.y??c.position.y},{width:n,height:l},c.parentId,r,t)}}],r,i,a);o.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*l,e.y):void 0}if(s.x!==void 0&&s.y!==void 0){let e={id:y,type:`position`,position:{...s}};o.push(e)}if(e.width!==void 0&&e.height!==void 0){let t={id:y,type:`dimensions`,resizing:!0,setAttributes:f?f===`horizontal`?`width`:`height`:!0,dimensions:{width:e.width,height:e.height}};o.push(t)}for(let e of t){let t={...e,type:`position`};o.push(t)}n(o)},onEnd:({width:e,height:t})=>{let n={id:y,type:`dimensions`,resizing:!1,dimensions:{width:e,height:t}};b.getState().triggerNodeChanges([n])}}),w.current.update({controlPosition:T,boundaries:{minWidth:s,minHeight:c,maxWidth:l,maxHeight:u},keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:_,shouldResize:m}),()=>{w.current?.destroy()}},[T,s,c,l,u,d,h,g,_,m]),(0,G.jsx)(`div`,{className:aL([`react-flow__resize-control`,`nodrag`,...T.split(`-`),n,r]),ref:x,style:{...i,scale:C,...o&&{[S?`backgroundColor`:`borderColor`]:o}},children:a})}(0,U.memo)(jY);function MY(e){return e.graph??void 0}function NY(e){return{run:e.run_node_sets??[],nodes:new Map(e.plan.tasks.map(e=>[e.id,e.sets??[]]))}}function PY(e){let t=MY(e);if(!t)return[];let n=new Map(e.run.nodes.map(e=>[e.node,e]));return t.plan.tasks.flatMap(r=>{let i=UY(r,`kind`)===`human`?`human`:WY(r)?`lifecycle`:`agent`,a=t.node_results[r.id]??t.result?.results?.[r.id],o=t.node_status[r.id];return o===void 0?[]:[{id:r.id,label:UY(r,`name`)??r.id,status:o,kind:i,task:r,telemetry:n.get(r.id),result:a,detail:e.node_details[r.id],control:t.node_control[r.id],failure:n.get(r.id)?.failure,blockers:[...t.node_gated_by[r.id]??[],...a?.blocked_by??[]]}]})}function FY(e){switch(e?.launcher){case`claude-code`:return`Claude`;case`codex`:return`Codex`;default:return`Unattributed`}}function IY(e){let t=FY(e);return e?.session_key===void 0?e===void 0?`Unattributed`:`${t} launch · ${GY(e.launch_id)}`:`${t} session · ${GY(e.session_key)}`}function LY(e){if(e.blockers.length>0&&zY.has(e.status))return`blocked by ${e.blockers.join(`, `)}`;if(BY.has(e.status))return RY(e)??`${e.status}, with no reason recorded`}function RY(e){return(e.failure?.detail||e.result?.detail||e.result?.error||e.telemetry?.outcome||e.result?.outcome)?.trim()||void 0}var zY=new Set([`blocked`,`skipped`,`waiting`]),BY=new Set([`failed`,`not-completed`,`cancelled`]);function VY(e){let t=XI,n=t=>(e[t]??0)>0;return[...t.filter(n),...Object.keys(e).filter(e=>!t.includes(e)).sort().filter(n)].map(t=>`${e[t]} ${t}`).join(` · `)}function HY(e){return BY.has(e)||e===`blocked`||e===`skipped`}function UY(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:void 0}function WY(e){return`repo`in e||`steps`in e}function GY(e){return e.length>12?`${e.slice(0,8)}…`:e}function KY({data:e}){let t=e.style===`success`?St:e.style===`danger`||e.style===`muted`?un:e.style===`active`?Dt:At;return(0,G.jsxs)(`article`,{"aria-label":`${e.label}: ${e.state}`,className:H(`dag-node`,`state-${e.state}`,`token-${e.style}`),"data-selected":e.selected,children:[(0,G.jsx)(_q,{type:`target`,position:$.Left}),(0,G.jsxs)(`div`,{className:`node-heading`,children:[(0,G.jsx)(Ma,{className:`px-1.5 py-0 text-[9px] tracking-[.1em] uppercase`,variant:`outline`,children:e.kind}),(0,G.jsx)(t,{className:H(e.style===`active`&&`spin`),size:17})]}),(0,G.jsx)(`strong`,{children:e.label}),(0,G.jsx)(`span`,{className:`node-status`,children:e.state}),e.reason!==void 0&&(0,G.jsx)(`span`,{className:`node-reason`,title:e.reason,children:e.reason}),(0,G.jsx)(_q,{type:`source`,position:$.Right})]})}function qY({data:e,id:t,markerEnd:n,style:r}){return(0,G.jsx)(Zq,{id:t,path:JY(e?.points??[]),markerEnd:n,style:r})}function JY(e){let[t,...n]=e;return t?`M ${t.x} ${t.y} ${n.map(e=>`L ${e.x} ${e.y}`).join(` `)}`:``}var YY={dagNode:KY},XY={routed:qY};function ZY({nodes:e,selectedNodeId:t,onSelectNode:n}){let r=(0,U.useMemo)(()=>{let t=new Map;for(let n of e)HY(n.status)&&t.set(n.id,LY(n));return t},[e]),{nodes:i,edges:a}=(0,U.useMemo)(()=>{let n=new Set(e.map(e=>e.id)),i=iL({nodes:e.map(e=>({id:e.id,label:e.label,kind:e.kind,state:e.status})),edges:e.flatMap(e=>(e.task.deps??[]).filter(e=>n.has(e)).map(t=>({id:`${t}->${e.id}`,source:t,target:e.id})))});return{nodes:i.nodes.map(e=>({id:e.id,type:`dagNode`,position:{x:e.x,y:e.y},data:{label:e.label,kind:e.kind,state:e.state,style:e.style,selected:e.id===t,...r.get(e.id)===void 0?{}:{reason:r.get(e.id)}},width:e.width,height:e.height})),edges:i.edges.map(t=>({id:t.id,source:t.source,target:t.target,type:`routed`,data:{points:t.points},animated:e.find(({id:e})=>e===t.target)?.status===`running`}))}},[e,r,t]);return(0,G.jsxs)(`div`,{className:`graph-wrap`,children:[(0,G.jsxs)(XJ,{nodes:i,edges:a,colorMode:`dark`,nodeTypes:YY,edgeTypes:XY,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,fitView:!0,minZoom:.05,onNodeClick:(e,t)=>n(t.id),"aria-label":`DAG execution graph`,children:[(0,G.jsx)(rY,{color:`var(--border)`,gap:22}),(0,G.jsx)(fY,{showInteractive:!1})]}),(0,G.jsx)(`ol`,{className:`accessible-node-list`,"aria-label":`DAG nodes`,children:e.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{type:`button`,onClick:()=>n(e.id),children:[e.label,`: `,e.status,r.get(e.id)===void 0?``:` — ${r.get(e.id)}`]})},e.id))})]})}function QY({className:e,state:t}){let n=$Y(t);return(0,G.jsxs)(Ma,{className:H(`gap-1.5 tracking-[.03em] uppercase`,n&&tX[n],e),variant:`outline`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,className:H(`size-1.5 rounded-full bg-current`,t===`running`&&`animate-pulse`)}),t]})}function $Y(e){return sX[e]}var eX=e=>{let t=$Y(e);return H(`size-2 shrink-0 rounded-full bg-current`,t===void 0?`text-muted-foreground`:nX[t])},tX={success:`border-success bg-success-surface text-success`,destructive:`border-destructive bg-destructive-surface text-destructive`,warning:`border-warning bg-warning-surface text-warning`,info:`border-info bg-info-surface text-info`},nX={success:`text-success`,destructive:`text-destructive`,warning:`text-warning`,info:`text-info`},rX=`success`,iX=`destructive`,aX=`warning`,oX={blocked:aX,cancelled:iX,done:rX,failed:iX,"not-completed":iX,parked:void 0,pending:void 0,running:`info`,skipped:aX,unknown:void 0,waiting:void 0},sX={...oX,complete:oX.done,settled:oX.done,active:oX.running},cX={graph:`graph`,overall:`overall`,channel:`channel`,reads:`reads`};function lX(e){return e!==null&&Object.hasOwn(cX,e)}var uX={projects:`projects`,runs:`runs`};function dX(e){return e!==null&&Object.hasOwn(uX,e)}var fX=`none`,pX={decisions:{label:`Decisions`,description:`Decision points and settlements only`,profile:LA.planner},activity:{label:`Detailed activity`,description:`Every record all three producers put on the stream`,profile:LA.detailed}};function mX(e){return e!==null&&Object.hasOwn(pX,e)}var hX={timeline:`Timeline`,task:`Task`,criteria:`Acceptance criteria`,dependencies:`Dependencies`,remote:`Remote`};function gX(e){return e!==null&&Object.hasOwn(hX,e)}function _X(e){let t=[...e].some(e=>e.charCodeAt(0)<32);return e.length>0&&e.length<=512&&!t&&!/[/?#]/u.test(e)}function vX(e,t){let n=e.get(t);return n!==null&&_X(n)?n:void 0}function yX(){let e=(0,U.useSyncExternalStore)(bX,xX,xX),t=new URLSearchParams(e),n=t.get(`list`),r=dX(n)?n:`projects`,i=t.get(`project`),a=i!==null&&(i===`none`||rM(i))?i:void 0,o=vX(t,`run`),s=vX(t,`node`),c=vX(t,`event`),l=t.get(`view`),u=t.get(`tab`),d=t.get(`detail`),f=mX(d)?d:`activity`,p=u===`pr`||u===`checks`?`remote`:gX(u)?u:`timeline`,m=lX(l)?l:s===void 0?`overall`:`graph`,h=(0,U.useCallback)(e=>{let t=new URLSearchParams(window.location.search);e(t),window.history.pushState(null,``,`${window.location.pathname}?${t}`),window.dispatchEvent(new PopStateEvent(`popstate`))},[]);return{list:r,projectKey:a,runId:o,nodeId:s,itemId:c,view:m,detail:f,nodeTab:p,selectList:e=>h(t=>{e===`projects`?t.delete(`list`):t.set(`list`,e),t.delete(`project`)}),selectProject:e=>h(t=>{e===void 0?t.delete(`project`):t.set(`project`,e),t.delete(`list`),t.delete(`run`),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectRun:e=>h(t=>{t.set(`run`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)}),selectNode:e=>h(t=>{e?t.set(`node`,e):t.delete(`node`),t.delete(`event`),t.delete(`tab`),t.set(`view`,`graph`)}),selectItem:e=>h(t=>{e?t.set(`event`,e):t.delete(`event`)}),showOverall:()=>h(e=>{e.set(`view`,`overall`),e.delete(`node`),e.delete(`event`),e.delete(`tab`)}),selectDetail:e=>h(t=>{e===`activity`?t.delete(`detail`):t.set(`detail`,e)}),selectNodeTab:e=>h(t=>{e===`timeline`?t.delete(`tab`):t.set(`tab`,e),e!==`timeline`&&t.delete(`event`)}),selectView:e=>h(t=>{t.set(`view`,e),t.delete(`node`),t.delete(`event`),t.delete(`tab`)})}}function bX(e){return window.addEventListener(`popstate`,e),()=>window.removeEventListener(`popstate`,e)}function xX(){return window.location.search}var SX=`(no project)`;function CX(e){return e.project===null?SX:e.name??e.project}function wX(e){return e.project===null?e.name??void 0:e.name===null?void 0:e.project}function TX(e){return e.project??`none`}function EX(e,t){return e.find(e=>TX(e)===t)}function DX(e){let t=new Map;for(let n of e)t.set(n.state,(t.get(n.state)??0)+1);return[...t].map(([e,t])=>`${t} ${e}`).join(` · `)}function OX(e){return`${e.length} ${e.length===1?`run`:`runs`}`}function kX(e){if(e.agent_count!==void 0)return`${e.agent_count} ${e.agent_count===1?`agent`:`agents`}`}function AX({groups:e,selectedKey:t,onSelect:n}){return(0,G.jsx)(`ul`,{"aria-label":`Project rows`,className:`run-list project-rows`,children:e.map(e=>{let r=TX(e),i=t===r;return(0,G.jsx)(`li`,{children:(0,G.jsxs)(`button`,{"aria-current":i?`page`:void 0,className:`run-link`,"data-active":i,onClick:()=>n(r),type:`button`,children:[(0,G.jsxs)(`span`,{className:`run-link-main`,children:[(0,G.jsx)(Nt,{"aria-hidden":`true`,size:13}),(0,G.jsx)(`span`,{children:CX(e)})]}),(0,G.jsx)(wt,{"aria-hidden":`true`,size:14}),wX(e)!==void 0&&(0,G.jsx)(`span`,{className:`run-link-counts`,title:wX(e),children:wX(e)}),(0,G.jsx)(`span`,{className:`run-link-counts`,children:[OX(e.runs),DX(e.runs),kX(e)].filter(Boolean).join(` · `)}),(0,G.jsx)(`span`,{className:`run-link-tag`,children:e.last_write_at===null?`never written`:(0,G.jsx)(sF,{at:aF(e.last_write_at),relative:!0})})]})},r)})})}var jX={projects:`Projects`,runs:`Runs`};function MX({list:e,onSelectList:t,projects:n,selectedProjectKey:r,onSelectProject:i,runs:a,selectedRunId:o,liveRunIds:s,onSelect:c,hasMore:l,loadingMore:u,onLoadMore:d,hostActions:f}){return(0,G.jsx)(`nav`,{"aria-label":e===`runs`?`DAG runs`:`Projects`,className:`run-nav`,onScrollCapture:e=>{let t=e.target;l&&t.scrollHeight-t.scrollTop<=t.clientHeight+80&&d()},children:(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`px-[18px] py-6 max-sm:px-2`,children:[(0,G.jsxs)(`div`,{className:`brand`,children:[(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`brand-mark`,children:(0,G.jsx)(ht,{size:20})}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Local orchestration`}),(0,G.jsx)(`h1`,{children:`DAG Observatory`})]})]}),(0,G.jsx)(bf,{className:`my-[22px]`}),f,(0,G.jsxs)(`fieldset`,{className:`detail-switch list-switch`,children:[(0,G.jsx)(`legend`,{className:`sr-only`,children:`Which list`}),Object.values(uX).map(n=>(0,G.jsx)(Pa,{"aria-pressed":e===n,onClick:()=>t(n),size:`sm`,type:`button`,variant:e===n?`default`:`outline`,children:jX[n]},n))]}),e===`projects`?n===void 0?(0,G.jsx)(`p`,{"aria-live":`polite`,className:`run-list-status`,children:`Loading projects…`}):(0,G.jsx)(AX,{groups:n,onSelect:i,selectedKey:r}):(0,G.jsx)(`div`,{className:`run-list`,children:a.map(e=>{let t=o===e.run_id,n=s.has(e.run_id),r=VY(e.node_counts);return(0,G.jsxs)(`button`,{"aria-current":t?`page`:void 0,className:`run-link`,"data-active":t,onClick:()=>c(e.run_id),type:`button`,children:[(0,G.jsxs)(`span`,{className:`run-link-main`,children:[n?(0,G.jsxs)(fm,{children:[(0,G.jsx)(pm,{asChild:!0,children:(0,G.jsx)(`span`,{"aria-label":`Live`,className:H(`run-dot`,eX(e.state)),"data-live":`true`,role:`img`})}),(0,G.jsx)(mm,{children:`Live`})]}):(0,G.jsx)(`span`,{"aria-label":`Historical`,className:H(`run-dot`,eX(e.state)),role:`img`}),(0,G.jsx)(`span`,{children:e.run_id})]}),(0,G.jsx)(wt,{"aria-hidden":`true`,size:14}),(0,G.jsx)(`span`,{className:`run-link-counts`,title:r,children:[e.state,r].filter(Boolean).join(` · `)}),(0,G.jsxs)(`span`,{className:`run-link-tag`,children:[(0,G.jsx)(bt,{"aria-hidden":`true`,size:11}),IY(e.launch)]})]},e.run_id)})}),e===`runs`&&l&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`button`,{className:`sr-only`,onClick:()=>void d(),type:`button`,children:`Load more runs`}),(0,G.jsx)(`p`,{"aria-live":`polite`,className:`run-list-status`,children:u?`Loading more runs…`:``})]})]})})})}function NX({groups:e,error:t,onSelect:n}){return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`section`,{"aria-labelledby":`projects-heading`,className:`projects-landing`,children:[(0,G.jsx)(`h2`,{id:`projects-heading`,children:`Projects`}),(0,G.jsx)(`p`,{className:`projects-lede`,children:`Every project with a run under this root, newest activity first.`}),t&&(0,G.jsx)(IX,{error:t,what:`The project list`}),e===void 0?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),(0,G.jsx)(xf,{className:`h-2 w-32`}),`Loading projects…`]}):e.length===0?(0,G.jsxs)(`div`,{className:`empty-state`,children:[(0,G.jsx)(Nt,{size:34}),(0,G.jsx)(`h2`,{children:`No DAG runs found`}),(0,G.jsx)(`p`,{children:`Start an orchestrated run to see its project appear here.`})]}):(0,G.jsx)(`ul`,{"aria-label":`Projects`,className:`project-cards`,children:e.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(Fa,{className:`project-card`,children:(0,G.jsxs)(Ia,{children:[(0,G.jsxs)(`button`,{className:`project-card-open`,onClick:()=>n(TX(e)),type:`button`,children:[(0,G.jsx)(`span`,{className:`project-card-name`,children:CX(e)}),(0,G.jsx)(wt,{"aria-hidden":`true`,size:14})]}),wX(e)!==void 0&&(0,G.jsx)(`p`,{className:`project-card-id`,children:wX(e)}),(0,G.jsxs)(`p`,{className:`project-card-facts`,children:[OX(e.runs),e.runs.length>0&&` · ${DX(e.runs)}`,kX(e)!==void 0&&` · ${kX(e)}`]}),(0,G.jsx)(`p`,{className:`project-card-facts`,children:e.last_write_at===null?`never written`:(0,G.jsxs)(G.Fragment,{children:[`Last activity`,` `,(0,G.jsx)(sF,{at:aF(e.last_write_at),relative:!0})]})})]})})},TX(e)))})]})})}function PX({projectKey:e,group:t,error:n,loading:r,agents:i,onSelectRun:a}){return(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`section`,{"aria-labelledby":`project-heading`,className:`projects-landing`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Project`}),(0,G.jsx)(`h2`,{id:`project-heading`,children:t===void 0?e:CX(t)}),t!==void 0&&wX(t)!==void 0&&(0,G.jsx)(`p`,{className:`project-card-id`,children:wX(t)}),t&&(0,G.jsxs)(`p`,{className:`projects-lede`,children:[OX(t.runs),t.runs.length>0&&` · ${DX(t.runs)}`,kX(t)!==void 0&&` · ${kX(t)}`,t.last_write_at!==null&&(0,G.jsxs)(G.Fragment,{children:[` · last activity `,(0,G.jsx)(sF,{at:aF(t.last_write_at),relative:!0})]})]}),n&&(0,G.jsx)(IX,{error:n,what:`This project`}),r?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),(0,G.jsx)(xf,{className:`h-2 w-32`}),`Loading project…`]}):t?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`ul`,{"aria-label":`Runs of ${CX(t)}`,className:`project-runs`,children:t.runs.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(FX,{onSelect:a,run:e})},e.run_id))}),i]}):null]})})}function FX({run:e,onSelect:t}){let n=VY(e.node_counts);return(0,G.jsxs)(`button`,{"aria-label":`Open ${e.run_id}`,className:`project-run`,onClick:()=>t(e.run_id),type:`button`,children:[(0,G.jsx)(`span`,{className:`project-run-id`,children:e.run_id}),(0,G.jsxs)(`span`,{className:`project-run-facts`,children:[(0,G.jsx)(QY,{state:e.state}),e.liveness!==void 0&&(0,G.jsx)(Ma,{variant:`outline`,children:e.liveness}),e.unread_surfaces!==void 0&&e.unread_surfaces>0&&(0,G.jsxs)(Ma,{variant:`secondary`,children:[e.unread_surfaces,` unread`,` `,e.unread_surfaces===1?`surface`:`surfaces`]})]}),(0,G.jsxs)(`span`,{className:`project-run-facts project-run-detail`,children:[n&&(0,G.jsx)(`span`,{children:n}),(0,G.jsx)(`span`,{children:e.last_progress_at===void 0?`never written`:(0,G.jsxs)(G.Fragment,{children:[`Last write`,` `,(0,G.jsx)(sF,{at:aF(e.last_progress_at*1e3),relative:!0})]})})]})]})}function IX({error:e,what:t}){return(0,G.jsxs)(sa,{className:`mb-4`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsxs)(ca,{children:[t,` could not be read`]}),(0,G.jsx)(la,{children:e.message})]})}function LX(e,t,n){let{value:r,error:i}=eN(n?`projects`:void 0,()=>e.listProjects(),t);return{list:r,error:i}}function RX(e,t,n){let{value:r,error:i,loading:a}=eN(t,()=>t===`none`?e.listProjects().then(e=>{let t=EX(e.projects,fX);if(t===void 0)throw Error(`no runs without a project`);return t}):e.getProject(t??``),n);return{group:r,error:i,loading:a}}function zX(e,t,n,r,i=!0){let[a,o]=(0,U.useState)(),[s,c]=(0,U.useState)(),[l,u]=(0,U.useState)(!0),[d,f]=(0,U.useState)(),[p,m]=(0,U.useState)([]),[h,g]=(0,U.useState)(),[_,v]=(0,U.useState)(),[y,b]=(0,U.useState)(0),[x,S]=(0,U.useState)(!1),C=a===void 0?void 0:a.runs.some(({run_id:e})=>e===t)?t:t!==void 0||i?a.runs.at(0)?.run_id:void 0,[w,T]=(0,U.useState)(0),E=n===void 0?void 0:n.nodeId??`run`,D=(0,U.useRef)(C);(0,U.useEffect)(()=>{D.current=C},[C]);let O=(0,U.useRef)(void 0),k=(0,U.useRef)(void 0),A=(0,U.useRef)(!1),j=(0,U.useRef)(0),M=(0,U.useCallback)(()=>{g(void 0),v(void 0)},[]),N=(0,U.useCallback)(async()=>{let t=j.current,n=await e.listRuns(!0);t===j.current&&o(n)},[e]),P=(0,U.useRef)(void 0),ee=(0,U.useCallback)(async()=>{let t=a?.next_cursor;if(!(t===void 0||P.current===t)){P.current=t,S(!0);try{let n=await e.listRuns(!0,t);o(e=>e===void 0?n:{...n,runs:[...e.runs,...n.runs.filter(({run_id:t})=>!e.runs.some(e=>e.run_id===t))]}),M()}catch(e){g(UX(e))}finally{P.current=void 0,S(!1)}}},[e,a,M]),F=(0,U.useCallback)(async t=>{let n=await e.selectRuns([t]);o(e=>{if(e===void 0)return e;if(n.missing?.includes(t)===!0)return{...e,runs:e.runs.filter(e=>e.run_id!==t)};let r=n.runs.find(e=>e.run_id===t);return r===void 0?e:{...e,runs:e.runs.some(e=>e.run_id===t)?e.runs.map(e=>e.run_id===t?r:e):[r,...e.runs]}})},[e]),I=(0,U.useCallback)(async()=>{try{await N(),M()}catch(e){g(UX(e))}finally{u(!1)}},[N,M]),L=(0,U.useCallback)(async()=>{await I(),b(e=>e+1)},[I]);(0,U.useEffect)(()=>{if(C===void 0){c(void 0),k.current=void 0;return}let t=e=>e.runId===C&&e.timelineScope===E&&e.filter===r,i=VX(C,E,r);O.current=i,c(e=>{if(e!==void 0&&t(e))return e;let n=e?.runId===C&&e.filter===r&&e.detail!==void 0?e.detail:void 0;return{runId:C,filter:r,timelineScope:E,...n===void 0?{}:{detail:n}}});let a=e=>{c(n=>n!==void 0&&t(n)?e(n):n)},o=e=>{O.current===i&&e()},s=k.current;if(s?.key===i){s.again=!0;return}let l=()=>{k.current={key:i,again:!1};let t=()=>{let e=k.current;if(e?.key===i){if(e.again){l();return}k.current=void 0}},s=e.getRun(C,{includeConversations:!1,filter:r}).then(e=>{a(t=>({...t,detail:e})),o(M)}).catch(BX).catch(e=>{o(()=>g(UX(e)))}),c=n===void 0?Promise.resolve():e.getTimeline(C,n.nodeId,r).then(e=>a(t=>({...t,timeline:e,timelineError:void 0}))).catch(BX).catch(e=>a(t=>({...t,timelineError:UX(e)})));Promise.all([s,c]).then(t,t)};l()},[e,C,y,n?.nodeId,E,r]),(0,U.useEffect)(()=>{I();let t=e.subscribe({onEvent:e=>{if(j.current+=1,f(new Date().toISOString()),v(void 0),e.event===`snapshot`){o(GM(e.data)),A.current&&(b(e=>e+1),T(e=>e+1)),A.current=!0;return}let t=HX(e);t!==void 0&&(T(e=>e+1),F(t).catch(e=>g(UX(e))),t===D.current&&b(e=>e+1))},onError:e=>{v(UX(e))}});return()=>t.close()},[e,F,I]),(0,U.useEffect)(()=>{if(C===void 0){m([]);return}let t=e.subscribe({runId:C,filter:r,onEvent:e=>{if(f(new Date().toISOString()),v(void 0),e.event!==`snapshot`){if(e.event===`activity.changed`){let t=e.data.activity;m(nM.parse(t))}(e.event===`conversation.changed`||e.event===`activity.changed`||e.event===`run.changed`)&&b(e=>e+1)}},onError:e=>v(UX(e))});return()=>t.close()},[e,C,r]);let te=s!==void 0&&s.runId===C&&s.filter===r?s:void 0;return(0,U.useMemo)(()=>({list:a,runId:C,detail:te?.detail,timeline:te?.timeline,timelineError:te?.timelineError,loading:l,lastUpdated:d,activity:p,error:h??_,refresh:L,loadMore:ee,hasMore:a?.next_cursor!==void 0,loadingMore:x,invalidations:w}),[a,C,te,l,d,p,h,_,L,ee,x,w])}function BX(e){if(!(e instanceof KM&&e.code===`run_not_found`))throw e}function VX(e,t,n){return[e,t??``,n??``].join(`\0`)}function HX(e){let t=`run_id`in e.data?e.data.run_id:void 0;return typeof t==`string`&&t.length>0?t:void 0}function UX(e){return e instanceof Error?e:typeof Event<`u`&&e instanceof Event?Error(`Live telemetry stream disconnected`):Error(String(e))}var WX={minutes:60,seconds:1},GX=e=>Object.hasOwn(WX,e),KX=600%WX.minutes==0?{amount:String(600/WX.minutes),unit:`minutes`}:{amount:`600`,unit:`seconds`};function qX(e){let t=e.amount.trim();if(!/^\d+$/u.test(t))return;let n=Number(t)*WX[e.unit];return Number.isSafeInteger(n)?n:void 0}function JX(e){if(e===0)return`no grace`;let t=Math.floor(e/60),n=e%60,r=(e,t)=>`${e} ${t}${e===1?``:`s`}`;return t===0?r(n,`second`):n===0?r(t,`minute`):`${r(t,`minute`)} ${r(n,`second`)}`}function YX(e){return e.map(e=>({runId:e.run_id,owner:IY(e.launch)}))}function XX(e,t){return t instanceof KM&&t.status!==void 0&&t.code!==void 0?{phase:`refused`,sent:e,error:t}:{phase:`lost`,sent:e,error:t instanceof Error?t:Error(String(t))}}var ZX={dispatchStopped:`dispatch-stopped`,hostShutdown:`host-shutdown`};function QX(e,t,n){let r=new Set(e.runs.map(({runId:e})=>e)),i=Object.values(ZX);return n.flatMap(e=>{if(!r.has(e.run_id))return[];let n=e.last_event;if(n===null||!i.includes(n))return[];let a=t.get(e.run_id);return a!==void 0&&a.last_event===n&&a.last_progress_at===e.last_progress_at?[]:[{runId:e.run_id,recorded:n===ZX.hostShutdown?ZX.hostShutdown:ZX.dispatchStopped}]})}function $X(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}).format(e)}var eZ=`Each live dispatch is asked to stop and commit, and given the grace to end itself; whatever is still standing then is torn down, and every branch the run's records name is pushed to its origin. Nothing is sent until you confirm.`;function tZ({open:e,onOpenChange:t,runs:n,blocked:r,unreadable:i=0,onConfirm:a}){let o=(0,U.useId)(),[s,c]=(0,U.useState)(KX),[l,u]=(0,U.useState)(!1),d=qX(s),f=n!==void 0&&r===void 0,p=()=>{c(KX),u(!1),t(!1)};return(0,G.jsx)(gc,{onOpenChange:e=>e?t(!0):p(),open:e,children:(0,G.jsxs)(bc,{className:`shutdown-dialog`,children:[(0,G.jsxs)(xc,{children:[(0,G.jsx)(Cc,{children:`Shut down the entire host?`}),(0,G.jsx)(wc,{children:eZ})]}),(0,G.jsxs)(`div`,{className:`shutdown-dialog-body`,children:[r===void 0?n===void 0?(0,G.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:`Reading which runs this acts on…`}):(0,G.jsx)(rZ,{caption:`It acts on all ${nZ(n.length)} on this host, over their owners — each is interrupted, torn down and pushed:`,label:`Runs on this host`,runs:n,warning:!0}):(0,G.jsx)(`p`,{className:`shutdown-blocked`,role:`status`,children:r}),i>0&&(0,G.jsxs)(`p`,{className:`shutdown-scope-note`,children:[i===1?`1 run root on this host could not be read`:`${i} run roots on this host could not be read`,`: the engine cannot read them either, so this shutdown signals nothing in them and pushes none of their branches.`]}),(0,G.jsxs)(`fieldset`,{className:`shutdown-grace`,children:[(0,G.jsx)(`legend`,{children:`Grace`}),(0,G.jsxs)(`div`,{className:`shutdown-grace-row`,children:[(0,G.jsx)(Oc,{className:`sr-only`,htmlFor:`${o}-grace`,children:`Grace`}),(0,G.jsx)(Tc,{"aria-describedby":`${o}-grace-help`,"aria-invalid":d===void 0,id:`${o}-grace`,inputMode:`numeric`,min:0,onChange:e=>c({...s,amount:e.target.value}),step:1,type:`number`,value:s.amount}),(0,G.jsx)(Oc,{className:`sr-only`,htmlFor:`${o}-unit`,children:`Grace unit`}),(0,G.jsx)(`select`,{className:`composer-select`,id:`${o}-unit`,onChange:e=>{let t=e.target.value;GX(t)&&c({...s,unit:t})},value:s.unit,children:Object.keys(WX).map(e=>(0,G.jsx)(`option`,{value:e,children:e},e))})]}),(0,G.jsx)(`p`,{className:`channel-age`,id:`${o}-grace-help`,children:d===void 0?`The grace is a whole number of minutes or seconds, 0 or more.`:`How long each live dispatch has to end itself once asked: ${JX(d)}. The engine's default is ${JX(qX(KX)??0)}.`})]}),(0,G.jsxs)(`div`,{className:`composer-check shutdown-force`,children:[(0,G.jsx)(`input`,{checked:l,id:`${o}-force`,onChange:e=>u(e.target.checked),type:`checkbox`}),(0,G.jsx)(Oc,{htmlFor:`${o}-force`,children:`Force: skip the interrupt and the wait and go straight to the teardown — whatever a worker had not committed is lost.`})]})]}),(0,G.jsxs)(Sc,{children:[(0,G.jsx)(vc,{asChild:!0,children:(0,G.jsx)(Pa,{type:`button`,variant:`outline`,children:`Cancel`})}),(0,G.jsx)(Pa,{disabled:!f||d===void 0,onClick:()=>{d!==void 0&&(a(d,l),p())},type:`button`,variant:`destructive`,children:`Shut down the host`})]})]})})}var nZ=e=>e===1?`1 run`:`${e} runs`;function rZ({caption:e,label:t,runs:n,warning:r=!1}){return(0,G.jsxs)(`div`,{className:`shutdown-runs`,"data-warning":r,children:[(0,G.jsx)(`p`,{className:`shutdown-scope-note`,children:e}),(0,G.jsx)(`ul`,{"aria-label":t,children:n.map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsx)(`span`,{className:`shutdown-run-id`,children:e.runId}),` — owned by `,e.owner]},e.runId))})]})}function iZ(e,t,n){let[r,i]=(0,U.useState)(),a=aZ(r!==void 0,e,t,n);return{open:r,setOpen:i,opener:e=>()=>i(e),runs:a.rows===void 0||r===void 0?void 0:YX(a.rows),blocked:a.blocked,unreadable:e?.unreadable?.length??0}}function aZ(e,t,n,r){let i=(0,U.useRef)(new Set),a=t?.next_cursor;return(0,U.useEffect)(()=>{if(!e){i.current.clear();return}a===void 0||r||i.current.has(a)||(i.current.add(a),n())},[e,a,r,n]),t===void 0?{blocked:`Reading the runs listing this view holds…`}:a===void 0?{rows:t.runs}:!r&&i.current.has(a)?{blocked:`The rest of the runs listing could not be read (${t.runs.length} runs read), so the runs this acts on cannot all be named. Close this and try again.`}:{blocked:`Reading the rest of the runs listing so every run this acts on can be named (${t.runs.length} read so far)…`}}function oZ(e,t){let[n,r]=(0,U.useState)({phase:`idle`}),i=(0,U.useRef)(!1);return{state:n,confirm:(0,U.useCallback)((n,a,o)=>{if(i.current)return;i.current=!0;let s={scope:e,runs:n,grace:a,force:o,sentAt:Date.now()};r({phase:`sending`,sent:s}),t({grace:a,force:o}).then(e=>r({phase:`answered`,sent:s,report:e}),e=>r(XX(s,e))).finally(()=>{i.current=!1})},[e,t]),dismiss:(0,U.useCallback)(()=>{i.current||r({phase:`idle`})},[])}}var sZ=[`host`];function cZ(e){return{host:oZ(`host`,(0,U.useCallback)(t=>e.shutdown(`host`,t),[e]))}}function lZ({list:e,loadMore:t,loadingMore:n,shutdowns:r}){let{open:i,setOpen:a,opener:o,runs:s,blocked:c,unreadable:l}=iZ(e,t,n),u=r.host.state.phase===`sending`;return(0,G.jsxs)(`fieldset`,{"aria-label":`Shut down runs on this host`,className:`host-shutdown`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`This host`}),(0,G.jsx)(`div`,{className:`host-shutdown-actions`,children:(0,G.jsxs)(Pa,{disabled:u,onClick:o(`host`),size:`sm`,type:`button`,variant:`destructive`,children:[(0,G.jsx)(Xt,{size:14}),` Shut down the entire host`]})}),sZ.map(e=>(0,G.jsx)(tZ,{blocked:c,onConfirm:(e,t)=>s!==void 0&&r.host.confirm(s,e,t),onOpenChange:t=>a(t?e:void 0),open:i===e,runs:i===e?s:void 0,unreadable:l},e))]})}var uZ=1e3;function dZ(e,t){let[n,r]=(0,U.useState)(()=>Date.now());(0,U.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),uZ);return()=>clearInterval(e)},[]);let i=QX(e,(0,U.useRef)(new Map(t.filter(t=>e.runs.some(({runId:e})=>e===t.run_id)).map(e=>[e.run_id,e]))).current,t);return{now:n,progress:i,done:i.filter(({recorded:e})=>e===ZX.hostShutdown).length,deadline:e.sentAt+e.grace*1e3,asks:!e.force&&e.grace>0}}function fZ({label:e,state:t,rows:n,onDismiss:r}){return t.phase===`idle`?null:(0,G.jsxs)(`section`,{"aria-label":e,className:`shutdown-status`,children:[t.phase===`sending`?(0,G.jsx)(mZ,{rows:n,sent:t.sent}):t.phase===`lost`?(0,G.jsxs)(sa,{"aria-label":`${e} lost`,variant:`destructive`,children:[(0,G.jsx)(on,{}),(0,G.jsx)(ca,{children:`Shutdown lost: no answer came back`}),(0,G.jsxs)(la,{children:[(0,G.jsxs)(`p`,{children:[`The request sent at `,$X(t.sent.sentAt),` ended without an answer (`,t.error.message,`). The engine may still be carrying out the shutdown — check the runs before sending another.`]}),(0,G.jsx)(pZ,{sent:t.sent})]})]}):t.phase===`refused`?(0,G.jsxs)(sa,{"aria-label":`${e} refused`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsxs)(ca,{children:[`Shutdown refused · `,t.error.status,` `,t.error.code]}),(0,G.jsxs)(la,{children:[(0,G.jsx)(`pre`,{className:`verb-text`,children:t.error.message}),(0,G.jsx)(`p`,{children:`Nothing was signalled and nothing was pushed.`})]})]}):(0,G.jsx)(gZ,{label:e,report:t.report}),t.phase!==`sending`&&(0,G.jsx)(`div`,{className:`composer-actions`,children:(0,G.jsx)(Pa,{onClick:r,size:`sm`,type:`button`,variant:`outline`,children:`Dismiss`})})]})}function pZ({sent:e}){return(0,G.jsxs)(`p`,{className:`channel-age`,children:[`Sent `,$X(e.sentAt),` · scope `,e.scope,` · grace`,` `,JX(e.grace),e.force?` · forced`:``,` · `,e.runs.length,` `,e.runs.length===1?`run`:`runs`,` in scope`]})}function mZ({sent:e,rows:t}){let{now:n,progress:r,done:i,deadline:a,asks:o}=dZ(e,t);return(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`shutdown-inflight`,role:`status`,children:[(0,G.jsxs)(`p`,{className:`shutdown-inflight-head`,children:[(0,G.jsx)(Bt,{"aria-hidden":`true`,className:`animate-spin`,size:14}),(0,G.jsx)(`strong`,{children:`Shutdown in progress`}),` — still waiting for the engine's answer, `,eF(Math.max(0,n-e.sentAt)),` after it was sent.`]}),(0,G.jsx)(pZ,{sent:e}),(0,G.jsx)(`p`,{children:o?n<a?`Waiting out the ${JX(e.grace)} grace until ${$X(a)} (${eF(a-n)} left) for each live dispatch to end itself; runs are worked through one after another, each with its own grace.`:`The first grace ran out at ${$X(a)}; the engine is tearing down what is still standing and pushing branches, run by run.`:`Forced: nothing is asked or waited for; the engine is tearing the runs down and pushing their branches.`}),(0,G.jsxs)(`p`,{children:[i,` of `,e.runs.length,` `,e.runs.length===1?`run has`:`runs have`,` recorded their shutdown.`]}),r.length>0&&(0,G.jsx)(`ul`,{"aria-label":`Recorded so far`,children:r.map(({runId:e,recorded:t})=>(0,G.jsxs)(`li`,{children:[e,`:`,` `,t===ZX.hostShutdown?`put down — host-shutdown recorded after its teardown and pushes`:`its dispatches are stopping — dispatch-stopped recorded`]},e))})]})}function hZ(e){let t=e.remote===null?``:` to ${e.remote}`,n=e.commit===null?``:` at ${e.commit}`;switch(e.result){case`pushed`:return`pushed${t}${n}`;case`already-on-origin`:return`already on its origin${t}${n}; nothing was pushed`;case`no-remote`:return`not pushed: this identity has no origin${n}`;case`refused`:return`could not be preserved${n}`}}function gZ({label:e,report:t}){return(0,G.jsxs)(sa,{"aria-label":`${e} report`,variant:t.complete?`default`:`destructive`,children:[t.complete?(0,G.jsx)(Et,{}):(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:t.complete?`Shutdown complete`:`Shutdown incomplete`}),(0,G.jsxs)(la,{className:`shutdown-report`,children:[!t.complete&&(0,G.jsx)(`p`,{children:`Not everything went as asked: a dispatch was killed at the deadline or is still running, a teardown was not clean, or a branch could not be preserved. Read the runs below.`}),(0,G.jsxs)(`p`,{className:`channel-age`,children:[`Scope `,t.scope,` · grace `,JX(t.grace_seconds),t.forced?` · forced`:``,` · runs root `,t.root]}),t.runs.length===0?(0,G.jsx)(`p`,{children:`No run was selected: nothing was signalled.`}):t.runs.map(e=>(0,G.jsxs)(`section`,{"aria-label":`Shutdown of ${e.run_id}`,className:`shutdown-report-run`,children:[(0,G.jsxs)(`h4`,{children:[e.run_id,` · owner `,e.owner,e.forced_over_owner&&` — another session's run, acted on over its owner`]}),e.dispatches.length===0?(0,G.jsx)(`p`,{children:`No live dispatch to interrupt.`}):(0,G.jsx)(`ul`,{"aria-label":`Dispatches of ${e.run_id}`,children:e.dispatches.map(e=>(0,G.jsxs)(`li`,{children:[e.node,` (pid `,e.pid,`): interrupt`,` `,e.interrupt,`; ended `,e.ended,` after`,` `,eF(e.waited_ms),(0,G.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.node}-${e.pid}`))}),(0,G.jsxs)(`p`,{children:[`Teardown: `,e.teardown]}),e.branches.length===0?(0,G.jsx)(`p`,{children:`No branch this run's records name.`}):(0,G.jsx)(`ul`,{"aria-label":`Branches of ${e.run_id}`,children:e.branches.map(e=>(0,G.jsxs)(`li`,{children:[e.identity,`@`,e.branch,`: `,hZ(e),(0,G.jsxs)(`span`,{className:`channel-age`,children:[` — `,e.detail]})]},`${e.identity}@${e.branch}`))})]},e.run_id)),t.not_pushed_unread===null?t.not_pushed.length===0?(0,G.jsx)(`p`,{children:`Other unpublished branches on this host: none.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`p`,{children:[`Other unpublished branches on this host, which this shutdown did not push (`,t.not_pushed.length,`):`]}),(0,G.jsx)(`ul`,{"aria-label":`Branches not pushed`,children:t.not_pushed.map(({identity:e,branch:t})=>(0,G.jsxs)(`li`,{children:[e,`@`,t]},`${e}@${t}`))})]}):(0,G.jsxs)(`p`,{children:[`Other unpublished branches on this host: not read —`,` `,t.not_pushed_unread,`. This is not a count of zero: there may be work on this host nothing outside it carries.`]}),(0,G.jsxs)(`details`,{children:[(0,G.jsx)(`summary`,{children:`The engine's own report`}),(0,G.jsx)(`pre`,{className:`verb-text`,children:t.rendered})]})]})]})}function _Z({control:e}){if(e===void 0)return null;let t=e.addressable?`Turn reachable`:`No turn to reach`,n=e.addressable?`a planner's note can be delivered into the ${e.member??`member`} turn in flight`:e.reason,r=e.addressable?Wt:Ht;return(0,G.jsxs)(Ma,{"aria-label":`${t}: ${n}`,className:H(`node-view-control gap-1.5`,e.addressable?`border-info bg-info-surface text-info`:`border-warning bg-warning-surface text-warning`),title:n,variant:`outline`,children:[(0,G.jsx)(r,{"aria-hidden":`true`,size:12}),t]})}function vZ(e){return e.charAt(0).toUpperCase()+e.slice(1)}var yZ=[[`recovery`,[`retry`,`retried`,`requeued`,`fallback`,`resolution`,`interrupted`,`cron`]],[`failure`,[`failed`,`died`,`rejected`,`refused`,`exceeded`,`conflict`]],[`human`,[`human`]],[`planning`,[`planner`,`decision`,`note`]],[`contention`,[`lock`,`concurrent`,`quiet`,`wait`,`held`,`unheld`]],[`verification`,[`verification`,`gate`,`check`,`checks`,`coverage`,`judge`]],[`publication`,[`pr`,`publication`,`published`,`release`,`merge`,`merged`,`change`,`drafting`,`landing`,`landed`]],[`repository`,[`edit`,`fetch`,`push`,`branch`,`branches`,`commit`]],[`session`,[`turn`,`member`,`session`,`heartbeat`,`conversation`]],[`lifecycle`,[`run`,`graph`,`node`,`round`,`step`,`edge`,`setup`,`cleanup`,`driver`,`cross`,`upstream`]]],bZ={"change-retitled":`publication`,"title-unverified":`verification`,"node-restack-started":`repository`,"node-restacked":`repository`,"review-comments-read":`publication`,"review-reply-posted":`publication`,"review-reply-not-drafted":`publication`,"node-absorbed":`publication`,"node-readjusted":`repository`,"completion-requested":`lifecycle`,"command-accepted":`planning`,"body-not-drafted":`publication`,"criterion-checked":`verification`,"pool-maintenance":`lifecycle`,"dispatch-stopped":`lifecycle`,"host-shutdown":`lifecycle`,"scratch-removed":`lifecycle`,"scratch-retained":`lifecycle`,"home-status":`lifecycle`};function xZ(e){return e.toLowerCase().split(`-`).filter(e=>e.length>0)}function SZ(e){let t=bZ[e];if(t!==void 0)return t;let n=xZ(e);return yZ.find(([,e])=>e.some(e=>n.includes(e)))?.[0]??`activity`}var CZ={recovery:Qt,failure:an,human:sn,planning:kt,contention:It,verification:nn,publication:Ft,repository:Pt,session:Gt,lifecycle:Kt,activity:Ot};function wZ({category:e,className:t=`size-3`}){let n=CZ[e];return(0,G.jsx)(n,{"aria-hidden":`true`,className:t})}function TZ(e){return e===`human-step`?`human step`:e}function EZ(e){return e.style===`human-step`}function DZ(e){switch(e){case`not-released`:return`not released yet`;case`awaiting-human-step`:return`waiting for the human step`;case`not-answered`:return`the registry did not answer`;case`not-landed`:return`released, but not carrying this work yet`;default:return e}}function OZ(e){if(e!==void 0)return e?`yes — a later acknowledgement replaced this one`:`no`}function kZ(e){if(e!==void 0)return e===`live`?`Live — into the turn that was already running`:e===`next`?`Deferred — onto the node's next dispatch`:e}function AZ(e){return[e.identity,e.target].filter(Boolean).join(` · `)||e.dep}function jZ({release:e}){let t=[[`Dependency`,e.dep],[`Identity`,e.identity],[`Release target`,e.target],[`Style`,e.style===void 0?void 0:TZ(e.style)],[`Version`,e.version],[`Probe outcome`,e.outcome],[`Probed through`,e.form],[`Probe took`,e.elapsed_ms===void 0?void 0:`${e.elapsed_ms} ms`],[`Acknowledged by`,e.actor],[`Superseded`,OZ(e.superseded)],[`Landed as`,e.landing_commit],[`Adopted`,kZ(e.delivery)]].filter(([,e])=>e!==void 0);return(0,G.jsxs)(G.Fragment,{children:[t.length>0&&(0,G.jsx)(`dl`,{className:`facts`,children:t.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e}),(0,G.jsx)(`dd`,{children:t})]},e))}),e.awaiting!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Held on`}),(0,G.jsx)(`ul`,{className:`release-awaiting`,children:e.awaiting.map(e=>(0,G.jsxs)(`li`,{children:[EZ(e)?(0,G.jsxs)(sa,{children:[(0,G.jsx)(sn,{}),(0,G.jsxs)(ca,{children:[`Waiting on a person · `,AZ(e)]}),(0,G.jsx)(la,{children:e.action??`The release is a human step and the run recorded no action for it.`})]}):(0,G.jsxs)(`p`,{className:`detail-note`,children:[`Waiting on an automated release · `,AZ(e)]}),(0,G.jsx)(`p`,{className:`detail-note`,children:[e.last_answer===void 0?void 0:DZ(e.last_answer),e.waited_seconds===void 0?void 0:`waited ${e.waited_seconds}s`].filter(e=>e!==void 0).join(` · `)})]},`${e.dep}·${e.identity??``}·${e.target??``}`))})]}),e.versions!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Versions adopted`}),(0,G.jsx)(`ul`,{className:`release-awaiting`,children:e.versions.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsxs)(`p`,{className:`detail-note`,children:[e.identity,` · `,e.target,` · `,e.version]})},`${e.identity}·${e.target}`))})]})]})}function MZ({node:e}){let t=e.result?.release??void 0;if(t===void 0)return(0,G.jsx)(G.Fragment,{children:`Not recorded`});let n=t.identity!==e.task.repo;return(0,G.jsx)(G.Fragment,{children:[t.target,t.style===void 0?void 0:TZ(t.style),t.version,n?t.identity:void 0].filter(e=>e!==void 0).join(` · `)})}function NZ(e){return{kind:e.displayKind,label:e.displayLabel,startedAt:e.startedAt,...e.durationMs===null?{}:{duration:eF(e.durationMs)},running:e.endedAt===null&&e.rowKind===`span`&&e.status===`running`,...e.status?{status:e.status}:{}}}function PZ({row:e}){let t=NZ(e);return(0,G.jsxs)(`header`,{className:`detail-title`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(Ma,{className:`mb-1`,variant:`outline`,children:t.kind}),(0,G.jsx)(`h2`,{children:t.label}),(0,G.jsxs)(`p`,{className:`detail-when`,children:[(0,G.jsx)(sF,{at:t.startedAt}),t.duration!==void 0&&` · ${t.duration}`,t.running&&` · still running`]})]}),t.status!==void 0&&(0,G.jsx)(Ma,{variant:`secondary`,children:t.status})]})}function FZ(e){let t=NZ(e);return[t.kind,t.label,rF(t.startedAt),vZ(e.category),t.status].filter(e=>e!==void 0&&e.length>0).join(` · `)}function IZ({row:e}){return(0,G.jsx)(`span`,{className:`timeline-marker-reading`,"data-timeline-reading":FZ(e),children:(0,G.jsx)(wZ,{category:e.category})})}var LZ=`data-timeline-reading`;function RZ(e){let t=e.closest(`[${LZ}]`)??e.closest(`button`)?.querySelector(`[${LZ}]`);if(!(t instanceof HTMLElement))return;let n=t.getAttribute(LZ)?.trim();return n===void 0||n.length===0?void 0:{element:t,detail:n}}var zZ={rows:[],total:0},BZ={queued:`Queued`,dispatch:`Dispatch`,verification:`Verification`,publication:`Publication`,"lock-waits":`Lock waits`,"human-wait":`Human wait`},VZ=`idle`,HZ=new Set([...Object.keys(BZ),VZ]),UZ=`member:`;function WZ(e){return HZ.has(e)?`${UZ}${e}`:e}var GZ=Object.entries(BZ).map(([e,t])=>({id:e,label:t}));function KZ(e){let t=e?.spans??[],n=[];for(let e of t){let t=e.agent_role??e.harness_scope;t!==void 0&&!n.includes(t)&&n.push(t)}let r=t.some(e=>hQ(e)===`dispatch`),[i,...a]=GZ;return[...i===void 0?[]:[i],...n.map(e=>({id:WZ(e),label:e})),...a.filter(({id:e})=>r||e!==`dispatch`)]}var qZ={run:null,node:null,step:null,dispatch:`dispatch`,verification:`verification`,publication:`publication`,"pr-drafting":`dispatch`,"conflict-resolution":`publication`,"human-wait":`human-wait`,queued:`queued`,rollup:`lock-waits`};function JZ(e){return e===`agent`}function YZ(e,t){return e===void 0?t===void 0?BZ.dispatch:XZ(t):NQ(t)&&t!==e?`${e} · ${t}`:e}function XZ(e){return e===`llmlint`?`Lint`:`${e[0]?.toUpperCase()??``}${e.slice(1)}`}var ZZ={"lock-wait":`Lock waits`};function QZ(e,t=GZ){let n=[...e].sort((e,t)=>e.start-t.start),r=n.at(0)?.start??0,i=Math.max(r+1,...n.map(e=>e.end??e.start)),a=new Set([n.at(0),n.reduce((e,t)=>e===void 0||(t.end??t.start)>(e.end??e.start)?t:e,void 0)].filter(e=>e!==void 0).map(({id:e})=>e)),o=(i-r)*.02,s=[];for(let e of n){let n=Math.max(e.end??e.start,e.start+o),r=s.findLast(t=>{let r=Math.max(t.end??t.start,t.start+o);return e.start<=r&&t.start<=n});r===void 0||a.has(e.id)?s.push(e):eQ(e,t)<eQ(r,t)?a.has(r.id)?s.push(e):s[s.indexOf(r)]=e:$Z(e,r,o)||s.push(e)}return s.sort((e,n)=>eQ(n,t)-eQ(e,t)||(e.end??e.start)-e.start-((n.end??n.start)-n.start))}function $Z(e,t,n){return Math.abs(e.start-t.start)<=n&&Math.abs((e.end??e.start)-(t.end??t.start))<=n}function eQ(e,t){let n=e.laneId??``,r=t.findIndex(({id:e})=>e===n);return r<0?t.length:r}function tQ(e,t,n){let r=[...e.map(({at:e})=>e),...t.flatMap(e=>[e.start,e.end??e.start])],i=Math.min(...r),a=(Math.max(...r)-i)*.02,o=[];for(let t of[...e].sort((e,t)=>e.at-t.at)){let e=o.findLast(e=>t.at-e.at<=a);e===void 0?o.push(t):t.id===n&&(o[o.indexOf(e)]=t)}return o}function nQ(e,t){let n=sQ(e,t).rows,r=aQ(n),i=aQ(n,!1).flatMap(e=>{let t=oQ(e);if(t===null)return[];let n=Date.parse(e.startedAt),r=e.endedAt===null?null:Date.parse(e.endedAt),i=e.rowKind===`span`&&e.span.total_duration_ms!==void 0?n+e.span.total_duration_ms:r;return[{id:e.id,label:e.displayLabel,laneId:t,payload:e,start:n,end:i,duration:i===null?null:i-n,status:e.status}]}),a=r.flatMap(e=>e.rowKind===`event`?[{id:e.id,label:e.displayLabel,at:Date.parse(e.startedAt),payload:e,status:e.status,icon:(0,U.createElement)(IZ,{row:e})}]:[]),o=Math.max(...i.map(e=>e.end??e.start),...a.map(e=>e.at));return{items:i.map(e=>e.end===null?{...e,end:o,duration:o-e.start}:e),markers:a,lanes:KZ(e),rows:r,tree:n}}function rQ(e,t){let n=new Set,r=[],i=e=>{for(let a of e){if(a.rowKind===`group`){let e=t.has(a.id),n=a.children,o=n.at(0),s=n.at(-1);o!==void 0&&i([o]),r.push({entryKind:`collapse`,group:a,hidden:Math.max(n.length-2,0),expanded:e}),e&&i(n.slice(1,-1)),s!==void 0&&s!==o&&i([s]);continue}n.has(a.id)||(n.add(a.id),r.push({entryKind:`row`,row:a})),i(a.children)}};return i(e),r}function iQ(e,t){return`${e} more ${t} events`}function aQ(e,t=!0){let n=new Set,r=[],i=e=>{for(let a of e)n.has(a.id)||(n.add(a.id),r.push(a)),(t||a.rowKind!==`group`)&&i(a.children)};return i(e),r}function oQ(e){return e.rowKind===`event`?null:e.role===void 0?qZ[e.rowKind===`span`?e.span.kind:e.kind]??null:WZ(e.role)}function sQ(e,t){if(e===void 0)return zZ;let n=e.spans.filter(e=>e.node_id===t);if(n.length===0){let n=FQ(e.spans,new Set,t);return n.length===0?zZ:{rows:TQ(n),total:n.length}}let r=new Set(n.map(({id:e})=>e)),i=new Map,a=[];for(let e of n){let t=e.parent_id!==void 0&&r.has(e.parent_id)?e.parent_id:void 0;t===void 0?a.push(e):i.set(t,[...i.get(t)??[],e])}let o=a.find(({kind:e})=>e===`node`),s=[...o===void 0?[]:fQ(o,i),...a.filter(e=>e!==o).map(e=>pQ(e,i)),...FQ(e.spans,r,t)].sort(LQ),c=n.some(e=>e.dispatch_group!==void 0||e.events.some(e=>e.dispatch_group!==void 0))?MQ(s):TQ(jQ(AQ(s)));return{span:o,rows:c,total:IQ(c)}}function cQ(e){return pQ(e,new Map)}function lQ(e){return wQ(e)}function uQ(e,t){return dQ(e,t).at(-1)}function dQ(e,t){let n=(e,r)=>{for(let i of e){if(r?i.rowKind===`event`&&i.event.id===t:i.id===t)return[i];let e=n(i.children,r);if(e.length>0)return[i,...e]}return[]},r=n(e,!1);return r.length>0?r:n(e,!0)}function fQ(e,t){return[...(t.get(e.id)??[]).map(e=>pQ(e,t)),...e.events.map(wQ)].sort(LQ)}function pQ(e,t){let n=mQ(e),r=e.kind===`dispatch`?e.transport_role:void 0;return{rowKind:`span`,span:e,id:e.id,kind:e.kind,...n===void 0?{}:{role:n},...r===void 0?{}:{transport:r},label:e.label,startedAt:e.started_at,endedAt:e.ended_at,status:e.status,durationMs:e.total_duration_ms??RQ(e.started_at,e.ended_at),children:TQ(fQ(e,t)),displayLabel:kQ(e,n,r),displayKind:EQ(e,n,r),...e.kind===`dispatch`&&e.label?{sessionName:e.label}:{}}}function mQ(e){return e.kind===`dispatch`?e.agent_role??e.harness_scope:void 0}function hQ(e){return e.agent_role===void 0?e.harness_scope===void 0?qZ[e.kind===`rollup`?e.label:e.kind]??null:WZ(e.harness_scope):WZ(e.agent_role)}function gQ(e,t=[]){let n=t.find(({id:t})=>t===e);return n===void 0?BZ[e]??(e.startsWith(UZ)?e.slice(7):e):n.label}function _Q(e){if(e.redirection!==void 0)return e.redirection.delivered?`Redirected into the running turn`:`Redirection deferred to the next dispatch`}var vQ=`Redirection`;function yQ(e){if(e.surface===void 0)return;let t=[e.surface.kind,e.surface.message].filter(e=>e!==void 0);return t.length===0?void 0:t.join(`: `)}var bQ=`Surface`,xQ=`Blocking surface`;function SQ(e){return e.kind.startsWith(`edit-`)?e.author:void 0}function CQ(e,t){let n=SQ(t);return n===void 0?e:`${e} · by ${n}`}function wQ(e){let t=_Q(e),n=yQ(e),r=t===void 0?e.surface===void 0?`Event`:e.surface.blocking===!0?xQ:bQ:vQ;return{rowKind:`event`,event:e,id:e.record_id??e.id,kind:e.kind,label:e.step_id??``,startedAt:e.at,endedAt:null,status:e.status,durationMs:null,children:[],displayLabel:CQ(t??n??(e.kind===`retry-requested`?`Retry requested`:e.step_id??e.kind),e),displayKind:r,category:SZ(e.kind)}}function TQ(e){let t=[];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===void 0)continue;let i=n;for(;i+1<e.length&&PQ(r,e[i+1]);)i+=1;let a=e.slice(n,i+1),o=a.at(-1);a.length<4||o===void 0?t.push(...a):t.push({rowKind:`group`,count:a.length,id:`group-${r.id}`,kind:r.kind,label:`${a.length} × ${r.kind}`,startedAt:r.startedAt,endedAt:o.endedAt,status:void 0,durationMs:RQ(r.startedAt,o.endedAt),children:a,displayLabel:`${a.length} grouped ${r.displayKind.toLowerCase()} activities`,displayKind:r.displayKind,...r.role===void 0?{}:{role:r.role},...r.transport===void 0?{}:{transport:r.transport},...r.dispatch!==void 0&&a.every(e=>e.dispatch?.id===r.dispatch?.id)?{dispatch:r.dispatch}:{}}),n=i}return t}function EQ(e,t,n){if(e.kind===`step`)return`Lifecycle`;if(e.kind===`rollup`)return ZZ[e.label]??e.label;if(e.kind===`dispatch`)return YZ(t,n);let r=qZ[e.kind];return r===null?e.kind:gQ(r)}function DQ(e){let t=e=>(e??[]).join(`, `);switch(e.kind){case`concurrency`:return e.ahead===void 0?`behind the work already running`:`behind ${t(e.ahead)}`;case`dependencies`:return`waiting on ${t(e.blocking)}`;case`decision`:return`held by decision ${e.reference??`nobody named`}`;case`release`:return`awaiting the release of ${t(e.awaiting)}`;default:return`held by ${e.kind}`}}function OQ(e){return e.map(DQ).join(` and `)}function kQ(e,t,n){if(e.kind===`step`)return e.label?`Lifecycle: ${e.label}`:`Lifecycle step`;if(e.kind===`queued`)return`Queued ${OQ(e.reasons??[])}`.trim();let r=EQ(e,t,n);return e.kind===`rollup`?`${r}: ${e.count??0} recorded`:!e.label||e.label===r?r:e.kind===`dispatch`?`${r} (${e.label})`:`${r}: ${e.label}`}function AQ(e){let t=0;return e.map(e=>{e.rowKind===`event`&&e.event.kind===`retry-requested`&&(t+=1);let n=AQ(e.children);return!JZ(e.transport)||t===0?{...e,children:n}:{...e,children:n,displayLabel:`${e.displayLabel} · retry ${t}`}})}function jQ(e){let t=[],n=-1,r=0,i=(e,t)=>({...e,dispatch:t,children:e.children.map(e=>i(e,t))});for(let a of e){if(JZ(a.transport)){r+=1,n=t.length,t.push(i(a,{id:a.id,label:`Dispatch ${r}`}));continue}let e=n<0?void 0:t[n];if(NQ(a.transport)&&e?.dispatch!==void 0){t[n]={...e,children:[...e.children,i(a,e.dispatch)]};continue}t.push(a)}return t}function MQ(e){let t=new Map,n=[];for(let r of aQ(e).filter(e=>e.rowKind!==`group`)){let e=r.rowKind===`event`?r.event.dispatch_group:r.span.dispatch_group,i={...r,children:[]};if(e===void 0){n.push(i);continue}let a=t.get(e.id)??{metadata:e,members:[]};a.members.push({...i,dispatch:{id:e.id,label:e.label}}),t.set(e.id,a)}let r=e=>[...TQ(e.filter(e=>e.rowKind===`span`&&e.kind===`dispatch`).sort(LQ)),...TQ(e.filter(e=>e.rowKind!==`span`||e.kind!==`dispatch`).sort(LQ))];return[...n.map(e=>({at:e.startedAt,order:e.rowKind===`event`?(e.event.journal_order??0)*3:0,rows:[e]})),...[...t.values()].map(({metadata:e,members:t})=>({at:e.started_at,order:e.order,rows:r(t)}))].sort((e,t)=>Date.parse(e.at)-Date.parse(t.at)||e.order-t.order).flatMap(({rows:e})=>e)}function NQ(e){return e===`judge`||e===`llmlint`}function PQ(e,t){return t!==void 0&&e.rowKind!==`group`&&t.rowKind===e.rowKind&&e.kind===t.kind&&e.role===t.role&&e.transport===t.transport}function FQ(e,t,n){return e.filter(({id:e})=>!t.has(e)).flatMap(({events:e})=>e.filter(e=>e.node_id===n)).map(wQ)}function IQ(e){return e.reduce((e,t)=>e+(t.rowKind===`group`?0:1)+IQ(t.children),0)}function LQ(e,t){let n=Date.parse(e.startedAt)-Date.parse(t.startedAt);return n===0?e.rowKind===`event`&&t.rowKind===`event`?(e.event.journal_order??0)-(t.event.journal_order??0):0:n}function RQ(e,t){if(t===null)return null;let n=Date.parse(e),r=Date.parse(t);return Number.isNaN(n)||Number.isNaN(r)?null:r-n}function zQ(e,t,n,r){let[i,a]=(0,U.useState)(),o=t===void 0||n===void 0?void 0:JSON.stringify([t,n]);(0,U.useEffect)(()=>{if(o===void 0||t===void 0||n===void 0)return;let r=!0;return e.getConversation(t,n).then(e=>{r&&a({key:o,conversation:e})}).catch(e=>{if(!r)return;let t=e instanceof Error?e:Error(String(e));a(e=>e?.key===o&&e.conversation!==void 0?e:{key:o,error:t})}),()=>{r=!1}},[e,t,n,o,r]);let s=i?.key===o?i:void 0;return(0,U.useMemo)(()=>({conversation:s?.conversation,error:s?.error,loading:o!==void 0&&s===void 0}),[s,o])}var BQ=32;function VQ(e){return e===null?null:e.closest(`[data-slot="scroll-area-viewport"]`)??e.parentElement}function HQ(e,t){let n=(0,U.useRef)(null),r=(0,U.useRef)(!0),i=(0,U.useRef)({key:e,count:t}),a=(0,U.useCallback)(()=>{let e=n.current;e!==null&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=BQ)},[]),o=(0,U.useCallback)(e=>{n.current?.removeEventListener(`scroll`,a),n.current=VQ(e),n.current?.addEventListener(`scroll`,a,{passive:!0}),a()},[a]);return(0,U.useLayoutEffect)(()=>{let a=i.current;i.current={key:e,count:t};let o=a.key===e&&a.count>0&&t>a.count,s=n.current;!o||s===null||!r.current||(s.scrollTop=s.scrollHeight)},[e,t]),o}var UQ=25;function WQ({client:e,runId:t,node:n,row:r}){let i=r===void 0?void 0:c$(r),a=i?.kind===`conversation`?i.value:void 0,o=zQ(e,t,a,r===void 0?void 0:r$(r));return(0,G.jsx)(`section`,{"aria-label":`Timeline item detail`,className:`timeline-detail`,children:(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsx)(`div`,{className:`p-[22px] max-sm:p-3`,ref:HQ(a,i$(r,o)),children:r===void 0?(0,G.jsxs)(`div`,{className:`detail-placeholder`,children:[(0,G.jsx)(zt,{size:30}),(0,G.jsx)(`p`,{children:`Select an item in the timeline to read what it recorded.`})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(PZ,{row:r}),(0,G.jsx)(bf,{className:`my-4`}),(0,G.jsx)(GQ,{client:e,runId:t,node:n,reference:i,row:r,transcript:o})]})})})})}function GQ({client:e,runId:t,row:n,node:r,reference:i,transcript:a}){let o=a$(n);if(o!==void 0)return(0,G.jsx)(QQ,{redirection:o,row:n});let s=o$(n);if(s!==void 0)return(0,G.jsx)(jZ,{release:s});let c=s$(n);return c===void 0?i?.kind===`conversation`?(0,G.jsxs)(G.Fragment,{children:[n.rowKind===`event`&&(0,G.jsx)(t$,{row:n,reference:i}),(0,G.jsx)(qQ,{row:n,transcript:a})]}):u$(n)?(0,G.jsx)(JQ,{client:e,runId:t,reference:i,row:n}):i?.kind===`worker_report`&&iN(i.value)!==void 0?(0,G.jsx)(YQ,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):i?.kind===`oneharness_session`&&iN(i.value)!==void 0?(0,G.jsx)(XQ,{artifactId:i.value,client:e,reference:i,row:n,runId:t}):d$(n,i)&&r!==void 0?(0,G.jsx)(ZQ,{node:r,reference:i}):(0,G.jsx)(t$,{reference:i,row:n}):(0,G.jsx)(e$,{row:n,surface:c})}function KQ({turn:e}){return e.judges===void 0||e.judges.length===0?null:(0,G.jsx)(`ul`,{"aria-label":`Judges on turn ${e.id}`,className:`judge-decisions`,children:e.judges.map(e=>(0,G.jsxs)(`li`,{children:[(0,G.jsxs)(`span`,{className:`judge-decision-who`,children:[e.judge,` (`,e.kind,`)`]}),` `,e.decision,` — `,e.reason]},e.judge))})}function qQ({row:e,transcript:t}){let[n,r]=(0,U.useState)(UQ),i=t.conversation?.conversation.turns??[],a=e.rowKind===`event`?i.filter(({id:t})=>t===e.event.id):i,o=Tm(a.map(e=>({id:e.id,time:Date.parse(e.timestamp)})));if(t.loading)return(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-inline`,children:[(0,G.jsx)(xf,{className:`h-2 w-40`}),(0,G.jsx)(xf,{className:`h-2 w-24`}),`Loading transcript…`]});if(t.conversation===void 0)return(0,G.jsxs)(sa,{variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Transcript unavailable`}),(0,G.jsx)(la,{children:t.error?.message??`The server recorded no transcript.`})]});let{conversation:s,attribution:c}=t.conversation,l=f$(c.agentRole,c.transportRole);return(0,G.jsx)(Fa,{className:`gap-0 py-3`,children:(0,G.jsxs)(Ia,{className:`px-3`,children:[(0,G.jsxs)(`header`,{className:`transcript-header`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`p`,{className:`eyebrow`,children:[e.dispatch===void 0?``:`${e.dispatch.label} · `,l,c.persona?` · ${c.persona}`:``]}),(0,G.jsx)(`h4`,{children:s.name})]}),(0,G.jsx)(Dm,{state:s.state})]}),(0,G.jsx)(bf,{className:`my-2.5`}),(0,G.jsx)(`div`,{className:`conversation-timeline-sticky`,children:(0,G.jsx)(wm,{cursor:o.cursor,onSelectTurn:o.scrollTo,turns:[...a]})}),a.length===0?(0,G.jsx)(`p`,{className:`detail-note`,children:`This turn is no longer part of the recorded transcript.`}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`div`,{ref:o.containerRef,children:a.slice(0,n).map(e=>(0,G.jsxs)(`div`,{ref:t=>o.register(e.id,t),children:[(0,G.jsx)(xw,{author:{label:l},turn:e}),(0,G.jsx)(KQ,{turn:e})]},e.id))}),a.length>n&&(0,G.jsxs)(Pa,{onClick:()=>r(n+UQ),size:`sm`,type:`button`,variant:`outline`,children:[`Show more of `,a.length,` turns`]})]})]})})}function JQ({row:e,client:t,runId:n,reference:r}){let i=e.rowKind===`span`?e.span.detail:void 0,a=i?.artifact_id??(r?.kind===`gate_log`?r.value:void 0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Verification record`}),(0,G.jsx)(`dl`,{className:`facts`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Result`}),(0,G.jsx)(`dd`,{children:i?.ok===void 0?e.status??`in progress`:i.ok?`passed`:`failed`})]})}),i?.output_tail&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Output`}),(0,G.jsx)(`pre`,{children:i.output_tail})]}),(0,G.jsx)(rN,{artifactId:a,client:t,heading:`Full log`,missing:`No readable log was recorded.`,noun:`log`,runId:n,unreadable:`No readable log was recorded.`}),(0,G.jsxs)(`p`,{className:`detail-note`,children:[`Verification `,e.status??`in progress`,`.`]})]})}function YQ({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rN,{artifactId:e,client:t,heading:`Worker report`,missing:`This settlement recorded no report.`,noun:`report`,runId:i,unreadable:`This run kept no readable copy of that report.`}),(0,G.jsx)(t$,{reference:n,row:r})]})}function XQ({artifactId:e,client:t,reference:n,row:r,runId:i}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(rN,{artifactId:e,client:t,heading:`Oneharness conversation`,missing:`This record named no conversation.`,noun:`conversation`,runId:i,unreadable:`The history store holds no readable copy of that conversation.`}),(0,G.jsx)(t$,{reference:n,row:r})]})}function ZQ({node:e,reference:t}){let n=e.detail?.verification.checks??[],r=e.detail?.publication;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Publication`}),r?.pr_url&&(0,G.jsx)(n$,{fallback:``,reference:{kind:`pr`,value:r.pr_url}}),r?.merged&&r.commit_url?(0,G.jsx)(`p`,{className:`detail-link`,children:(0,G.jsxs)(`a`,{href:r.commit_url,rel:`noreferrer`,target:`_blank`,children:[`Merged commit `,r.commit?.slice(0,8),` `,(0,G.jsx)(Mt,{size:13})]})}):r?.branch_url?(0,G.jsx)(`p`,{className:`detail-link`,children:(0,G.jsxs)(`a`,{href:r.branch_url,rel:`noreferrer`,target:`_blank`,children:[`Branch `,r.branch,` `,(0,G.jsx)(Mt,{size:13})]})}):!r?.pr_url&&(0,G.jsx)(n$,{fallback:`No publication was recorded.`,reference:t}),(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Observed checks`}),n.length===0?(0,G.jsx)(`p`,{className:`detail-note`,children:`No checks were observed on this node.`}):(0,G.jsx)(`dl`,{className:`facts`,children:n.map(e=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e.name}),(0,G.jsx)(`dd`,{children:e.url?(0,G.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.state}):e.state})]},e.name))})]})}function QQ({redirection:e,row:t}){return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Delivery`}),(0,G.jsx)(`dd`,{children:e.delivered?`Live — into the turn that was already running`:`Deferred — onto the node's next dispatch`})]}),e.turn!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Turn`}),(0,G.jsx)(`dd`,{children:e.turn===`turn-end`?`Left to end — the note reached it as it ended`:`Interrupted — its replacement opened on the note`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Redirected at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(sF,{at:t.startedAt,relative:!0})})]}),e.member!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Member`}),(0,G.jsx)(`dd`,{children:e.member})]}),e.input_bytes!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Note`}),(0,G.jsxs)(`dd`,{children:[e.input_bytes,` bytes offered`]})]}),(0,G.jsx)($Q,{row:t})]}),e.reason!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Why it was not delivered`}),(0,G.jsx)(`p`,{className:`detail-note`,children:e.reason})]})]})}function $Q({row:e}){let t=e.rowKind===`event`?SQ(e.event):void 0;return t===void 0?null:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Author`}),(0,G.jsx)(`dd`,{children:t})]})}function e$({surface:e,row:t}){let n=[[`Kind`,e.kind],[`Raised by`,e.source],[`Blocking`,e.blocking===void 0?void 0:e.blocking?`yes — dependents wait on the answer`:`no — nothing waits on it`]].filter(([,e])=>e!==void 0);return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Recorded at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(sF,{at:t.startedAt,relative:!0})})]}),n.map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e}),(0,G.jsx)(`dd`,{children:t})]},e))]}),e.message!==void 0&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Message`}),(0,G.jsx)(`p`,{className:`detail-note`,children:e.message})]})]})}function t$({row:e,reference:t}){if(e.rowKind===`event`)return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Recorded at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(sF,{at:e.startedAt,relative:!0})})]}),Object.entries(e.event.fields??{}).map(([e,t])=>(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e}),(0,G.jsx)(`dd`,{children:typeof t==`string`?t:JSON.stringify(t)})]},e))]}),t!==void 0&&(0,G.jsx)(n$,{reference:t,fallback:`No recorded artifact.`})]});let n=e.rowKind===`group`?void 0:e,r=e.rowKind===`span`&&e.span.count!==void 0?`${e.span.count} records`:void 0,i=(e.rowKind===`span`?e.span.reasons:void 0)??[];return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Recorded at`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(sF,{at:e.startedAt,relative:!0})})]}),e.rowKind===`span`&&(e.endedAt!==null||e.status===`running`)&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Ended`}),(0,G.jsx)(`dd`,{children:e.endedAt===null?`Still running`:(0,G.jsx)(sF,{at:e.endedAt,relative:!0})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Status`}),(0,G.jsx)(`dd`,{children:e.status??`Not recorded`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Duration`}),(0,G.jsx)(`dd`,{children:e.durationMs===null?`Not recorded`:eF(e.durationMs)})]}),r!==void 0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Aggregated`}),(0,G.jsx)(`dd`,{children:r})]}),i.length>0&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Waiting on`}),(0,G.jsx)(`dd`,{children:i.map(DQ).join(` and `)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Step`}),(0,G.jsx)(`dd`,{children:l$(n)??`None`})]}),(0,G.jsx)($Q,{row:e})]}),(0,G.jsx)(`h3`,{className:`detail-heading`,children:`Reference`}),(0,G.jsx)(n$,{fallback:`This item points at no recorded artifact.`,reference:t})]})}function n$({reference:e,fallback:t}){return e===void 0?(0,G.jsx)(`p`,{className:`detail-note`,children:t}):e.value.startsWith(`http`)?(0,G.jsx)(`p`,{className:`detail-link`,children:(0,G.jsxs)(`a`,{href:e.value,rel:`noreferrer`,target:`_blank`,children:[e.value,` `,(0,G.jsx)(Mt,{size:13})]})}):(0,G.jsxs)(`p`,{className:`detail-note`,children:[(0,G.jsx)(`span`,{className:`detail-reference-kind`,children:e.kind}),(0,G.jsx)(`code`,{children:e.value})]})}function r$(e){if(e.rowKind!==`span`)return e.id;let t=e.span.events.at(-1);return[e.span.id,e.span.status??``,e.span.ended_at??``,e.span.events.length,t?.id??``,t?.at??``,t?.status??``].join(`|`)}function i$(e,t){return t.conversation===void 0?0:e?.rowKind===`event`?1:t.conversation.conversation.turns.length}function a$(e){return e.rowKind===`event`?e.event.redirection:void 0}function o$(e){return e.rowKind===`event`?e.event.release:void 0}function s$(e){return e.rowKind===`event`?e.event.surface:void 0}function c$(e){if(e.rowKind===`span`)return e.span.reference;if(e.rowKind===`event`)return e.event.reference}function l$(e){if(e?.rowKind===`span`)return e.span.step_id;if(e?.rowKind===`event`)return e.event.step_id}function u$(e){return e.kind===`verification`||e.kind.startsWith(`verification-`)}function d$(e,t){return t?.kind===`pr`||e.kind===`publication`||e.kind.startsWith(`pr-`)||e.kind.startsWith(`publication-`)}function f$(e,t){return YZ(e,t)}function p$({client:e,runId:t,node:n,timeline:r,timelineError:i,selectedItemId:a,onSelectItem:o,onBack:s,selectedTab:c,onSelectTab:l}){let u=(0,U.useMemo)(()=>sQ(r,n.id),[r,n.id]);(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(a===void 0?s():o())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o,a]);let d=n.detail?.publication===void 0?n.result?.pr??void 0:n.detail.publication.pr_url;return(0,G.jsxs)(`section`,{"aria-label":`Timeline for ${n.label}`,className:`node-view`,children:[(0,G.jsxs)(`header`,{className:`node-view-head`,children:[(0,G.jsx)(`nav`,{"aria-label":`Breadcrumb`,children:(0,G.jsxs)(`ol`,{className:`breadcrumb`,children:[(0,G.jsx)(`li`,{children:(0,G.jsxs)(Pa,{onClick:s,size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(_t,{size:14}),` Graph`]})}),(0,G.jsx)(`li`,{"aria-current":`page`,children:(0,G.jsx)(`span`,{className:`breadcrumb-node`,children:n.label})})]})}),(0,G.jsxs)(`div`,{className:`node-view-facts`,children:[(0,G.jsx)(QY,{className:`node-view-state`,state:n.status}),(0,G.jsx)(_Z,{control:n.control}),(0,G.jsxs)(`span`,{className:`node-view-meta`,children:[n.kind,` node · `,n.telemetry?.turns??0,` turns ·`,` `,n.telemetry?.lint??0,` lint turns`]}),d!==void 0&&(0,G.jsxs)(`a`,{className:`node-view-pr`,href:d,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,G.jsx)(Mt,{size:12})]})]})]}),(0,G.jsx)(S$,{node:n}),(0,G.jsxs)(bp,{className:`node-tabs`,onValueChange:e=>{gX(e)&&l(e)},value:c,children:[(0,G.jsx)(Sp,{"aria-label":`Node details`,variant:`line`,children:Object.entries(hX).map(([e,t])=>(0,G.jsx)(Cp,{value:e,children:t},e))}),(0,G.jsxs)(wp,{className:`node-tab-panel`,value:`task`,children:[(0,G.jsx)(`pre`,{children:y$(n.task)}),(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Outcome`}),(0,G.jsx)(`dd`,{children:C$(n.result?.detail)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Graph overrides`}),(0,G.jsx)(`dd`,{children:(n.task.sets??[]).length===0?`None`:(0,G.jsx)(`ol`,{"aria-label":`Graph overrides`,className:`sets-served`,children:n.task.sets?.map((e,t)=>(0,G.jsx)(`li`,{children:(0,G.jsx)(`code`,{children:e})},t))})})]})]})]}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`criteria`,children:(0,G.jsx)(`pre`,{children:b$(n.task)})}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`dependencies`,children:(0,G.jsx)(`dl`,{className:`facts`,children:(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Dependencies`}),(0,G.jsx)(`dd`,{children:n.task.deps?.join(`, `)||`None`})]})})}),(0,G.jsx)(wp,{className:`node-tab-panel`,value:`remote`,children:(0,G.jsxs)(`dl`,{className:`facts`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Publication`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(x$,{node:n})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Branch`}),(0,G.jsx)(`dd`,{children:n.detail?.publication?.branch??`Not recorded`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Merge`}),(0,G.jsx)(`dd`,{children:n.detail?.publication?n.detail.publication.merged?`Merged`:`Not merged`:`Not recorded`})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Release`}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(MZ,{node:n})})]}),(0,G.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,G.jsx)(`dt`,{children:`Verification coverage`}),(0,G.jsxs)(`dd`,{children:[`Hook:`,` `,n.detail?.verification.pre_push_hook?`present`:`not recorded`,` · `,`Required checks:`,` `,n.detail?.verification.required_checks?.join(`, `)||`none configured`]})]}),(0,G.jsxs)(`div`,{className:`remote-check-facts`,children:[(0,G.jsx)(`dt`,{children:`Observed checks`}),(0,G.jsx)(`dd`,{children:(n.detail?.verification.checks??[]).length===0?`No checks observed`:(0,G.jsxs)(`table`,{"aria-label":`Remote checks`,className:`remote-checks`,children:[(0,G.jsx)(`thead`,{children:(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{children:`Name`}),(0,G.jsx)(`th`,{children:`Status`}),(0,G.jsx)(`th`,{children:`Conclusion`}),(0,G.jsx)(`th`,{children:`Required`})]})}),(0,G.jsx)(`tbody`,{children:n.detail?.verification.checks?.map(e=>(0,G.jsxs)(`tr`,{children:[(0,G.jsx)(`th`,{scope:`row`,children:e.url?(0,G.jsx)(`a`,{href:e.url,rel:`noreferrer`,target:`_blank`,children:e.name}):e.name}),(0,G.jsx)(`td`,{children:e.status??`Not recorded`}),(0,G.jsx)(`td`,{children:e.conclusion??`—`}),(0,G.jsx)(`td`,{children:e.required?`Required`:`Optional`})]},e.name))})]})})]})]})}),(0,G.jsx)(wp,{className:`node-timeline-panel`,value:`timeline`,children:i===void 0?r===void 0?(0,G.jsx)(`div`,{"aria-live":`polite`,className:`loading-state`,children:`Loading the recorded timeline…`}):u.rows.length===0?(0,G.jsxs)(Fa,{className:`m-5 items-center gap-2 p-8 text-muted-foreground`,children:[(0,G.jsx)(`p`,{className:`m-0`,children:`This node has no recorded timeline yet.`}),(0,G.jsx)(`p`,{className:`m-0 text-[11px]`,children:`Spans and events appear here as the run records them.`})]}):(0,G.jsx)(m$,{client:e,node:n,onSelectItem:o,runId:t,selectedItemId:a,timeline:r}):(0,G.jsxs)(sa,{className:`m-5 w-auto`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Timeline unavailable`}),(0,G.jsx)(la,{children:i.message})]})})]})]})}function m$({client:e,node:t,onSelectItem:n,runId:r,selectedItemId:i,timeline:a}){let o=(0,U.useMemo)(()=>nQ(a,t.id),[a,t.id]),[s,c]=(0,U.useState)(()=>new Set),l=(0,U.useMemo)(()=>{if(i!==void 0)return dQ(o.tree,i).find(e=>e.rowKind===`group`)?.id},[o.tree,i]),u=(0,U.useMemo)(()=>l===void 0?s:new Set([...s,l]),[s,l]),d=(0,U.useMemo)(()=>rQ(o.tree,u),[o.tree,u]),f=Tm((0,U.useMemo)(()=>d.flatMap(e=>e.entryKind===`row`?[{id:e.row.id,time:Date.parse(e.row.startedAt)}]:[]),[d])),[p,m]=(0,U.useState)(!1),h=(0,U.useMemo)(()=>QZ(o.items,o.lanes),[o.items,o.lanes]),g=(0,U.useMemo)(()=>tQ(o.markers,o.items,i),[o.items,o.markers,i]),_=(0,U.useMemo)(()=>h$([...o.items,...o.markers.map(({at:e})=>({start:e}))]),[o.items,o.markers]),v=f.cursor===void 0?void 0:Math.min(Math.max(f.cursor,_[0]),_[1]),y=i===void 0?void 0:uQ(o.rows,i),b=e=>{n(e),f.scrollTo(e)},{scrollTo:x}=f;return(0,U.useEffect)(()=>{i!==void 0&&x(i)},[i,x]),(0,G.jsxs)(`div`,{className:`node-execution`,"data-expanded":p,children:[(0,G.jsx)(`section`,{"aria-label":`Node timeline`,className:`node-timeline-sticky`,"data-testid":`node-timeline`,children:(0,G.jsx)(Cn,{axis:{origin:_[0]},cursor:v,expanded:p,getFailureExcerpt:e=>e.payload.rowKind===`span`?e.payload.span.detail?.output_tail:void 0,items:p?o.items:h,lanes:o.lanes,markers:g,onExpandedChange:m,onSelect:e=>b(e.id),selectedId:i})}),(0,G.jsx)(`section`,{"aria-label":`Node transcript`,className:`node-transcript`,ref:f.containerRef,children:g$(d).map(e=>{let t=e.entries.map(e=>e.entryKind===`row`?(0,G.jsx)(v$,{onOpen:b,register:f.register,row:e.row,selected:e.row.id===i},e.row.id):(0,G.jsx)(_$,{entry:e,onToggle:()=>c(t=>{let n=new Set(t);return n.has(e.group.id)?n.delete(e.group.id):n.add(e.group.id),n})},`collapse-${e.group.id}`));return e.dispatch===void 0?(0,G.jsx)(U.Fragment,{children:t},e.id):(0,G.jsxs)(`section`,{"aria-label":e.dispatch.label,className:`transcript-dispatch`,children:[(0,G.jsx)(`h3`,{children:e.dispatch.label}),t]},e.id)})}),y!==void 0&&(0,G.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,G.jsx)(Pa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>n(),size:`icon`,variant:`ghost`,children:(0,G.jsx)(un,{})}),(0,G.jsx)(WQ,{client:e,node:t,row:y,runId:r})]})]})}function h$(e){let t=e.map(({start:e})=>e),n=e.map(e=>e.end??e.start);if(t.length===0)return[0,1];let r=Math.min(...t),i=Math.max(...n);return[r,i>r?i:r+1]}function g$(e){let t=[];for(let n of e){let e=n.entryKind===`row`?n.row:n.group,r=t.at(-1);e.dispatch!==void 0&&r?.dispatch!==void 0&&r.dispatch.id===e.dispatch.id?r.entries.push(n):t.push({id:e.id,dispatch:e.dispatch,entries:[n]})}return t}function _$({entry:e,onToggle:t}){let n=iQ(e.hidden,e.group.kind);return(0,G.jsx)(`p`,{className:`transcript-collapsed`,children:(0,G.jsxs)(`button`,{"aria-expanded":e.expanded,onClick:t,type:`button`,children:[(0,G.jsx)(`span`,{"aria-hidden":`true`,children:`…`}),e.expanded?`Collapse ${n}`:`Show ${n}`]})})}function v$({row:e,selected:t,register:n,onOpen:r}){return(0,G.jsx)(`article`,{"aria-label":e.displayLabel,className:`transcript-item`,"data-dispatch-group":e.dispatch?.label,"data-selected":t,ref:t=>n(e.id,t),children:(0,G.jsxs)(`button`,{"aria-label":`Open ${e.displayLabel}`,onClick:()=>r(e.id),type:`button`,children:[(0,G.jsxs)(`span`,{className:`eyebrow`,children:[e.rowKind===`event`&&(0,G.jsx)(wZ,{category:e.category}),e.displayKind]}),(0,G.jsx)(`strong`,{children:e.displayLabel}),(0,G.jsxs)(`span`,{className:`transcript-facts`,children:[(0,G.jsx)(sF,{at:e.startedAt}),e.durationMs!==null&&` · ${eF(e.durationMs)}`,` · ${e.status??`recorded`}`,e.sessionName!==void 0&&` · ${e.sessionName}`]})]})})}function y$(e){if(e.task!==void 0)return e.task;let t=e.steps??[];return t.length===0?`No task prose recorded.`:t.map(e=>`## ${e.id}\n\n${e.task}`).join(`
96
96
 
97
- `)}function d$(e){let t=u$(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function f$({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,G.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,G.jsx)(Mt,{size:12})]}):(0,G.jsx)(G.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,`Pull request`],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,`Pull request`],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,G.jsx)(G.Fragment,{children:`Not recorded`}):(0,G.jsx)(G.Fragment,{children:n.map(([e,t],n)=>(0,G.jsxs)(`span`,{children:[n>0&&` · `,(0,G.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,G.jsx)(Mt,{size:12})]})]},e))})}function p$({node:e}){if(!PY(e.status))return null;let t=e.status===`blocked`||e.status===`skipped`,n=AY(e),r=e.result?.error||void 0,i=e.result?.exit_code;return(0,G.jsxs)(sa,{className:H(`m-5 w-auto`,t&&`border-warning bg-warning-surface text-warning`),variant:t?`default`:`destructive`,children:[t?(0,G.jsx)(qt,{}):(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:t?`This node is ${e.status}`:`This node ${e.status===`cancelled`?`was cancelled`:e.status===`not-completed`?`did not complete`:`failed`}${e.failure?`: ${e.failure.class}`:``}`}),(0,G.jsx)(la,{children:(0,G.jsxs)(`dl`,{className:`facts`,children:[t&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e.status===`skipped`?`Unmet`:`Blocked by`}),(0,G.jsx)(`dd`,{children:e.blockers.length>0?e.blockers.join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),!t&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Detail`}),(0,G.jsx)(`dd`,{children:n??`No reason was recorded for this outcome.`})]}),r!==void 0&&r!==n&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Error`}),(0,G.jsx)(`dd`,{children:r})]}),typeof i==`number`&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Exit code`}),(0,G.jsx)(`dd`,{children:i})]})]})})]})}function m$(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}var h$=`idle-`,g$=`row:run`,_$=e=>`row:node:${e}`,v$={id:NZ,label:`Idle`};function y$(e){return[...RZ(e),v$]}var b$=.005;function x$(e,t){let n=e?.spans??[],r=S$(e),i=y$(e),a=[C$({id:g$,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0),lanes:i}),...t.map(e=>C$({id:_$(e.id),kind:`node`,label:e.label,nodeId:e.id,range:r,spans:n.filter(t=>t.node_id===e.id),lanes:i}))],o=a.flatMap(e=>e.items.filter(e=>e.payload.kind===`work`));return{range:r,live:n.some(e=>e.ended_at===null),rows:a,line:{items:[...D$(r,o,void 0),...WZ(o,i)],markers:qZ(a.flatMap(e=>[...e.markers]),o),lanes:i}}}function S$(e){let t=e?.spans??[],n=t.map(e=>Date.parse(e.started_at));if(n.length===0)return[0,1];let r=Math.min(...n),i=Math.max(...t.map(e=>e.ended_at===null?Date.parse(e.started_at):Date.parse(e.ended_at))),a=Date.parse(e?.observed_at??``),o=t.some(e=>e.ended_at===null)&&Number.isFinite(a)?Math.max(i,a):i;return[r,o>r?o:r+1]}function C$({id:e,kind:t,label:n,nodeId:r,range:i,spans:a,lanes:o}){let s=a.flatMap(t=>{let a=sQ(t);if(a===null)return[];let s=Date.parse(t.started_at),c=w$(t,a,s,i),l=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${cQ(a,o)}${T$(t)}`,laneId:a,start:s,end:c,duration:c-s,status:t.status,payload:{id:t.id,kind:`work`,label:`${n} · ${cQ(a,o)}`,rowId:e,...r===void 0?{}:{nodeId:r},...l===void 0?{}:{conversationId:l},startedAt:t.started_at,endedAt:t.ended_at,durationMs:c-s}}]}),c=D$(i,s,{rowId:e,nodeId:r}),l=E$(s).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:o.filter(({id:e})=>[...s,...c].some(t=>t.laneId===e)),items:[...c,...s],line:[...c,...WZ(s,o)],markers:a.flatMap(t=>t.events.map(t=>({id:t.id,label:`${n} · ${t.step_id??t.kind}`,at:Date.parse(t.at),status:t.status,payload:{id:t.id,kind:`record`,label:t.kind,rowId:e,...r===void 0?{}:{nodeId:r},startedAt:t.at,endedAt:null,durationMs:0}}))),workedMs:l,idleMs:c.reduce((e,t)=>e+t.payload.durationMs,0)}}function w$(e,t,n,r){return t===`lock-waits`&&e.total_duration_ms!==void 0?n+e.total_duration_ms:e.ended_at===null?r[1]:Date.parse(e.ended_at)}function T$(e){return e.count!==void 0&&e.count>1?` · ${e.count} recorded`:``}function E$(e){let t=e.map(e=>[e.start,Math.max(e.end??e.start,e.start)]).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t)).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function D$(e,t,n){let r=E$(t),i=[],a=e[0];for(let[e,t]of r)e>a&&i.push([a,e]),a=Math.max(a,t);a<e[1]&&i.push([a,e[1]]);let o=Math.max(1,e[1]-e[0]);return i.filter(([e,t],n)=>n===0||n===i.length-1||(t-e)/o>=b$).map(([e,t],r)=>{let i=`${h$}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${WP(t-e)}`,...n===void 0?{}:{rowId:n.rowId},...n?.nodeId===void 0?{}:{nodeId:n.nodeId},startedAt:new Date(e).toISOString(),endedAt:new Date(t).toISOString(),durationMs:t-e};return{id:i,label:a.label,laneId:NZ,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function O$({client:e,detail:t,nodes:n,timeline:r,timelineError:i,onSelectNode:a,selectedItemId:o,onSelectItem:s}){let c=t.run.run_id,l=(0,U.useMemo)(()=>x$(r,n),[r,n]),u=(r?.spans??[]).filter(e=>e.node_id===void 0),d=u.find(e=>e.id===o),f=u.flatMap(e=>e.events).find(e=>e.id===o),p=d===void 0?f===void 0?void 0:tQ(f):eQ(d);return(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o!==void 0&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o]),(0,G.jsxs)(`div`,{className:`overall-view`,children:[(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,G.jsxs)(`section`,{className:`overall-hero`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,G.jsx)(`h2`,{children:c}),t.graph?.plan.goal?.text&&(0,G.jsx)(`p`,{className:`run-goal`,children:t.graph.plan.goal.text}),(0,G.jsxs)(`p`,{children:[t.run.phase,` ·`,` `,t.run.last_event?`last event ${t.run.last_event}`:`no events recorded yet`]})]}),(0,G.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,G.jsx)(j$,{icon:(0,G.jsx)(ht,{}),label:`Status`,value:t.run.state}),(0,G.jsx)(j$,{icon:(0,G.jsx)(Rt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,G.jsx)(j$,{icon:(0,G.jsx)(At,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:GP(t.run.timing.wall_seconds)}),(0,G.jsx)(j$,{icon:(0,G.jsx)(jt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,G.jsx)(Fa,{className:`gap-0 py-[15px]`,children:(0,G.jsxs)(Ia,{className:`px-[15px]`,children:[(0,G.jsxs)(`div`,{className:`section-heading`,children:[(0,G.jsx)(ht,{size:16}),(0,G.jsx)(`h3`,{children:`Graph timeline`})]}),i===void 0?r===void 0?(0,G.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):r.spans.length===0?(0,G.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,G.jsx)(k$,{graph:l,onOpenNode:a,onOpenItem:s,selectedItemId:o}):(0,G.jsxs)(sa,{variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Timeline unavailable`}),(0,G.jsx)(la,{children:i.message})]})]})})]})}),p!==void 0&&(0,G.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,G.jsx)(Pa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>s(),size:`icon`,variant:`ghost`,children:(0,G.jsx)(un,{})}),(0,G.jsx)(FQ,{client:e,row:p,runId:c})]})]})}function k$({graph:e,onOpenNode:t,onOpenItem:n,selectedItemId:r}){let[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(new Set),u=i??e.range,d=e=>{e.kind===`record`&&e.nodeId===void 0?n(e.id):e.nodeId===void 0?e.conversationId!==void 0&&n(e.id):t(e.nodeId)},f=e.line.lanes.filter(({id:t})=>e.line.items.some(e=>e.laneId===t));return(0,G.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":o,children:[(0,G.jsx)(Cn,{axis:{origin:e.range[0]},expanded:!1,items:e.line.items,label:`Graph timeline`,lanes:f,markers:e.line.markers,onExpandedChange:s,onRangeChange:a,onSelect:e=>d(e.payload),range:u,selectedId:r}),o&&(0,G.jsx)(`ol`,{className:`graph-rows`,children:e.rows.map(n=>(0,G.jsx)(A$,{onOpen:d,onOpenNode:t,onExpandedChange:e=>l(t=>{let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r}),expanded:c.has(n.id),origin:e.range[0],range:u,onRangeChange:a,row:n,selectedItemId:r},n.id))})]})}function A$({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId;return(0,G.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,G.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,G.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,G.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,G.jsxs)(`span`,{className:`graph-row-facts`,children:[WP(e.workedMs),` recorded · `,WP(e.idleMs),` `,`idle`]})]}),(0,G.jsx)(Cn,{axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function j$({icon:e,label:t,value:n}){return(0,G.jsxs)(Fa,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{children:t}),(0,G.jsx)(`strong`,{children:n})]})]})}var M$=6,N$=8,P$=`[aria-describedby^="timeline-detail-"]`,F$=e=>{if(!(e instanceof Element))return;let t=AZ(e);if(t!==void 0)return t;let n=e.closest(P$);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},I$=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function L$(){let e=(0,U.useRef)(null),[t,n]=(0,U.useState)(),[r,i]=(0,U.useState)(),a=t??r,o=(0,U.useCallback)(()=>{n(void 0),i(void 0)},[]);(0,U.useEffect)(()=>{let e=e=>n(t=>I$(t,F$(e.target))),t=e=>i(t=>I$(t,F$(e.target))),r=e=>i(t=>I$(t,F$(e.relatedTarget))),a=()=>n(void 0);return document.addEventListener(`pointerover`,e),document.addEventListener(`pointerleave`,a),document.addEventListener(`focusin`,t),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`pointerover`,e),document.removeEventListener(`pointerleave`,a),document.removeEventListener(`focusin`,t),document.removeEventListener(`focusout`,r)}},[]);let s=(0,U.useCallback)(()=>{let t=e.current;if(t===null||a===void 0)return;if(!a.element.isConnected)return o();let n=a.element.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.innerWidth-r.width-N$,s=Math.min(Math.max(n.left,N$),Math.max(N$,i)),c=n.bottom+M$,l=n.top-r.height-M$,u=Math.max(N$,window.innerHeight-r.height-N$),d=c+r.height<=window.innerHeight-N$?c:l,f=Math.min(Math.max(d,N$),u);t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(f)}px`,t.style.visibility=`visible`},[a,o]);return(0,U.useLayoutEffect)(s,[s]),(0,U.useEffect)(()=>{if(a!==void 0)return window.addEventListener(`scroll`,s,!0),window.addEventListener(`resize`,s),()=>{window.removeEventListener(`scroll`,s,!0),window.removeEventListener(`resize`,s)}},[a,s]),a===void 0?null:(0,jr.createPortal)((0,G.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:e,style:{visibility:`hidden`},children:a.detail},a.detail),document.body)}var R$=new RM(window.location.origin,{fetch:window.fetch.bind(window)}),z$=Object.entries(aX);function B$({client:e=R$}){let t=dX(),n=(0,U.useMemo)(()=>t.view===`overall`?{}:t.nodeId===void 0?void 0:{nodeId:t.nodeId},[t.view,t.nodeId]),r=aX[t.detail].profile,i=jX(e,t.runId,n,r,t.list===`runs`),a=i.list?.runs??[],o=i.runId,s=i.activity.at(-1),c=i.detail,l=(0,U.useMemo)(()=>c?EY(c):[],[c]),u=kX(e,i.invalidations,t.list===`projects`),d=AX(e,o===void 0?t.projectKey:void 0,i.invalidations),f=t.projectKey===void 0?void 0:d.group??vX(u.list?.projects??[],t.projectKey),p=lF(e,o===void 0?f?.project??void 0:void 0,i.invalidations),m=JF(e,o,i.invalidations),h=eZ(e),g=c===void 0?void 0:wY(c),_=l.find(({id:e})=>e===t.nodeId),v=(0,U.useMemo)(()=>new Set((i.list?.runs??[]).filter(({state:e})=>![`complete`,`failed`,`cancelled`].includes(e)).map(({run_id:e})=>e)),[i.list]);return(0,U.useEffect)(()=>{if(o&&t.runId&&t.runId!==o){let e=new URLSearchParams(window.location.search);e.set(`run`,o),e.delete(`node`),e.delete(`event`),e.set(`view`,t.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[t.runId,o,t.view]),(0,G.jsxs)(dm,{children:[(0,G.jsx)(L$,{}),(0,G.jsxs)(`div`,{className:`app-shell`,children:[(0,G.jsx)(wX,{list:t.list,onSelectList:t.selectList,projects:u.list?.projects,selectedProjectKey:t.projectKey,onSelectProject:t.selectProject,runs:a,selectedRunId:o,liveRunIds:v,hasMore:i.hasMore,loadingMore:i.loadingMore,onLoadMore:i.loadMore,onSelect:t.selectRun,hostActions:(0,G.jsx)(tZ,{list:i.list,loadMore:i.loadMore,loadingMore:i.loadingMore,shutdowns:h})}),(0,G.jsxs)(`main`,{className:`workspace`,children:[(0,G.jsxs)(`section`,{"aria-label":o?`Run header`:`Workspace header`,className:`topbar${o?` run-topbar`:``}`,children:[(0,G.jsxs)(`div`,{className:`topbar-title`,children:[t.projectKey!==void 0&&o&&(0,G.jsxs)(Pa,{"aria-label":`Back to ${f?hX(f):`the project`}`,className:`topbar-back`,onClick:()=>t.selectProject(t.projectKey),size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(_t,{size:14}),f?hX(f):`Project`]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,G.jsx)(`h2`,{children:o??(t.projectKey===void 0?t.list===`projects`?`Projects`:`No DAG selected`:(f&&hX(f))??t.projectKey)})]})]}),(0,G.jsxs)(`div`,{className:`topbar-actions`,children:[o!==void 0&&(0,G.jsx)(GF,{control:m,runId:o,ended:c!==void 0&&(c.run.state===`settled`||c.run.state.startsWith(`ended-`))}),(0,G.jsxs)(`span`,{className:`connection`,children:[(0,G.jsx)(en,{size:15}),i.lastUpdated===void 0?`Waiting for first update`:(0,G.jsxs)(G.Fragment,{children:[`Last updated`,` `,(0,G.jsx)(ZP,{at:i.lastUpdated,relative:!0})]})]}),s!==void 0&&(0,G.jsxs)(`button`,{className:`last-activity connection`,type:`button`,title:`${s.node}: ${[s.name,s.detail].filter(Boolean).join(` `)||s.kind}`,onClick:()=>{t.selectNode(s.node),t.selectItem(s.event_id)},children:[s.node,`:`,` `,[s.name,s.detail].filter(Boolean).join(` `)||s.kind]}),(0,G.jsxs)(Pa,{onClick:()=>void i.refresh(),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(Zt,{size:14}),` Refresh`]})]})]}),i.error&&(0,G.jsxs)(sa,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Live telemetry issue`}),(0,G.jsx)(la,{children:i.error.message})]}),(0,G.jsx)(iZ,{label:`Shutdown of the entire host`,onDismiss:h.host.dismiss,rows:a,state:h.host.state}),o===void 0&&t.projectKey!==void 0?(0,G.jsx)(EX,{agents:f?.project==null?void 0:(0,G.jsx)(aF,{agents:p,client:e,count:f.agent_count,title:`Agents of ${hX(f)}`}),error:d.error,group:f,loading:d.loading&&f===void 0,onSelectRun:t.selectRun,projectKey:t.projectKey}):o===void 0&&t.list===`projects`&&!i.loading?(0,G.jsx)(TX,{error:u.error,groups:u.list?.projects,onSelect:t.selectProject}):(0,G.jsxs)(bp,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?t.showOverall():e===`graph`?t.selectNode(void 0):tX(e)?t.selectView(e):void 0,value:t.view,children:[(0,G.jsxs)(`div`,{className:`view-tabs`,children:[(0,G.jsxs)(Sp,{"aria-label":`DAG views`,variant:`line`,children:[(0,G.jsxs)(Cp,{value:`graph`,children:[(0,G.jsx)(ln,{size:15}),` Graph`]}),(0,G.jsxs)(Cp,{value:`overall`,children:[(0,G.jsx)($t,{size:15}),` Overall`]}),(0,G.jsxs)(Cp,{value:`channel`,children:[(0,G.jsx)(Lt,{size:15}),` Channel`]}),(0,G.jsxs)(Cp,{value:`reads`,children:[(0,G.jsx)(yt,{size:15}),` Reads`]}),(0,G.jsxs)(Cp,{value:`agents`,children:[(0,G.jsx)(bt,{size:15}),` Agents`]})]}),(0,G.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,G.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),z$.map(([e,{label:n,description:r}])=>(0,G.jsx)(Pa,{"aria-pressed":t.detail===e,onClick:()=>t.selectDetail(e),size:`sm`,title:r,type:`button`,variant:t.detail===e?`default`:`outline`,children:n},e))]})]}),(0,G.jsx)(wp,{className:`min-h-0`,value:t.view,children:!c&&(i.loading||o!==void 0)?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),(0,G.jsx)(xf,{className:`h-2 w-32`}),`Loading execution history…`]}):c&&o?t.view===`channel`?(0,G.jsx)(kF,{client:e,decisions:g?.decisions??[],filter:r,invalidations:i.invalidations,observedAt:c.observed_at,overrides:g&&TY(g),runId:o}):t.view===`reads`?(0,G.jsx)(VF,{client:e,invalidations:i.invalidations,nodes:l,runId:o,status:m.status}):t.view===`agents`?(0,G.jsx)(uF,{client:e,count:c.run.agent_count,invalidations:i.invalidations,runId:o}):t.view===`overall`?(0,G.jsx)(O$,{client:e,detail:c,nodes:l,timeline:i.timeline,timelineError:i.timelineError,onSelectNode:t.selectNode,onSelectItem:t.selectItem,selectedItemId:t.itemId}):_?(0,G.jsx)(i$,{agents:(0,G.jsx)(dF,{client:e,invalidations:i.invalidations,nodeId:_.id,runId:o}),client:e,node:_,onBack:()=>t.selectNode(void 0),onSelectItem:t.selectItem,runId:o,selectedItemId:t.itemId,selectedTab:t.nodeTab,onSelectTab:t.selectNodeTab,timeline:i.timeline,timelineError:i.timelineError}):(0,G.jsx)(UY,{nodes:l,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,G.jsxs)(`div`,{className:`empty-state`,children:[(0,G.jsx)(ln,{size:34}),(0,G.jsx)(`h2`,{children:`No DAG runs found`}),(0,G.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})]})]})]})}var V$=class extends U.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,G.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,G.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,G.jsx)(`p`,{children:this.state.error.message}),(0,G.jsx)(Pa,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},H$=document.getElementById(`root`);if(!H$)throw Error(`DAG UI root element is missing`);(0,bA.createRoot)(H$).render((0,G.jsx)(U.StrictMode,{children:(0,G.jsx)(V$,{children:(0,G.jsx)(B$,{})})}));
97
+ `)}function b$(e){let t=y$(e),n=/(?:^|\n)##[ \t]*acceptance[ \t]+criteria[ \t]*\r?\n([\s\S]*?)(?=\r?\n##[ \t]|$)/i.exec(t)?.[1]?.trim();return n===void 0||n.length===0?`No acceptance criteria recorded in this node's task.`:n}function x$({node:e}){let t=e.detail?.publication;if(t===void 0)return typeof e.result?.pr==`string`&&e.result.pr?(0,G.jsxs)(`a`,{className:`node-view-pr`,href:e.result.pr,rel:`noreferrer`,target:`_blank`,children:[`Pull request `,(0,G.jsx)(Mt,{size:12})]}):(0,G.jsx)(G.Fragment,{children:`Not recorded`});let n=(t.merged?[[t.pr_url,`Pull request`],[t.commit_url,`Commit ${t.commit?.slice(0,8)??``}`]]:[[t.pr_url,`Pull request`],[t.branch_url,t.branch??`Branch`]]).filter(([e])=>e);return n.length===0?(0,G.jsx)(G.Fragment,{children:`Not recorded`}):(0,G.jsx)(G.Fragment,{children:n.map(([e,t],n)=>(0,G.jsxs)(`span`,{children:[n>0&&` · `,(0,G.jsxs)(`a`,{className:`node-view-pr`,href:e,rel:`noreferrer`,target:`_blank`,children:[t,` `,(0,G.jsx)(Mt,{size:12})]})]},e))})}function S$({node:e}){if(!HY(e.status))return null;let t=e.status===`blocked`||e.status===`skipped`,n=RY(e),r=e.result?.error||void 0,i=e.result?.exit_code;return(0,G.jsxs)(sa,{className:H(`m-5 w-auto`,t&&`border-warning bg-warning-surface text-warning`),variant:t?`default`:`destructive`,children:[t?(0,G.jsx)(qt,{}):(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:t?`This node is ${e.status}`:`This node ${e.status===`cancelled`?`was cancelled`:e.status===`not-completed`?`did not complete`:`failed`}${e.failure?`: ${e.failure.class}`:``}`}),(0,G.jsx)(la,{children:(0,G.jsxs)(`dl`,{className:`facts`,children:[t&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:e.status===`skipped`?`Unmet`:`Blocked by`}),(0,G.jsx)(`dd`,{children:e.blockers.length>0?e.blockers.join(`, `):`Nothing recorded; the run has not written what holds it.`})]}),!t&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Detail`}),(0,G.jsx)(`dd`,{children:n??`No reason was recorded for this outcome.`})]}),r!==void 0&&r!==n&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Error`}),(0,G.jsx)(`dd`,{children:r})]}),typeof i==`number`&&(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`dt`,{children:`Exit code`}),(0,G.jsx)(`dd`,{children:i})]})]})})]})}function C$(e){return e==null||e===``?`Not recorded`:typeof e==`string`?e:JSON.stringify(e,null,2)}var w$=`idle-`,T$=`row:run`,E$=e=>`row:node:${e}`,D$={id:VZ,label:`Idle`};function O$(e){return[...KZ(e),D$]}var k$=.005;function A$(e,t){let n=e?.spans??[],r=j$(e),i=O$(e),a=[M$({id:T$,kind:`run`,label:`Run-level`,range:r,spans:n.filter(e=>e.node_id===void 0),lanes:i}),...t.map(e=>M$({id:E$(e.id),kind:`node`,label:e.label,nodeId:e.id,range:r,spans:n.filter(t=>t.node_id===e.id),lanes:i}))],o=a.flatMap(e=>e.items.filter(e=>e.payload.kind===`work`)),s=o.filter(e=>e.payload.countsAsWork!==!1);return{range:r,live:n.some(e=>e.ended_at===null),rows:a,line:{items:[...I$(r,s,void 0),...QZ(o,i)],markers:[...tQ(a.flatMap(e=>e.markers.filter(e=>e.at<=r[1])),s),...a.flatMap(e=>e.markers.filter(e=>e.at>r[1]))],lanes:i}}}function j$(e){let t=e?.spans??[],n=t.map(e=>Date.parse(e.started_at));if(n.length===0)return[0,1];let r=Math.min(...n),i=t.find(e=>e.kind===`run`);if(i?.ended_at!==void 0&&i.ended_at!==null){let e=Date.parse(i.ended_at);return[r,e>r?e:r+1]}let a=Math.max(...t.map(e=>e.ended_at===null?Date.parse(e.started_at):Date.parse(e.ended_at))),o=Date.parse(e?.observed_at??``),s=t.some(e=>e.ended_at===null)&&Number.isFinite(o)?Math.max(a,o):a;return[r,s>r?s:r+1]}function M$({id:e,kind:t,label:n,nodeId:r,range:i,spans:a,lanes:o}){let s=a.flatMap(t=>{let a=hQ(t);if(a===null)return[];let s=Math.max(Date.parse(t.started_at),i[0]);if(s>i[1])return[];let c=Math.min(N$(t,a,s,i),i[1]),l=t.reference?.kind===`conversation`?t.reference.value:void 0;return[{id:t.id,label:`${n} · ${gQ(a,o)}${P$(t)}`,laneId:a,start:s,end:c,duration:c-s,status:t.status,payload:{id:t.id,kind:`work`,...t.harness_scope===void 0?{}:{countsAsWork:!1},label:`${n} · ${gQ(a,o)}`,rowId:e,...r===void 0?{}:{nodeId:r},...l===void 0?{}:{conversationId:l},startedAt:t.started_at,endedAt:t.ended_at,durationMs:c-s}}]}),c=new Set(a.filter(e=>e.harness_scope!==void 0).map(e=>e.id)),l=s.filter(e=>!c.has(e.id)),u=I$(i,l,{rowId:e,nodeId:r}),d=F$(l).reduce((e,[t,n])=>e+(n-t),0);return{id:e,kind:t,label:n,...r===void 0?{}:{nodeId:r},lanes:o.filter(({id:e})=>[...s,...u].some(t=>t.laneId===e)),items:[...u,...s],line:[...u,...QZ(s,o)],markers:a.flatMap(t=>t.events.map(t=>({id:t.record_id??t.id,label:`${n} · ${t.step_id??t.kind}`,at:Date.parse(t.at),status:t.status,payload:{id:t.record_id??t.id,kind:`record`,label:t.kind,rowId:e,...r===void 0?{}:{nodeId:r},startedAt:t.at,endedAt:null,durationMs:0}}))),workedMs:d,idleMs:u.reduce((e,t)=>e+t.payload.durationMs,0)}}function N$(e,t,n,r){return t===`lock-waits`&&e.total_duration_ms!==void 0?n+e.total_duration_ms:e.ended_at===null?r[1]:Date.parse(e.ended_at)}function P$(e){return e.count!==void 0&&e.count>1?` · ${e.count} recorded`:``}function F$(e){let t=e.map(e=>[e.start,Math.max(e.end??e.start,e.start)]).filter(([e,t])=>Number.isFinite(e)&&Number.isFinite(t)).sort((e,t)=>e[0]-t[0]),n=[];for(let[e,r]of t){let t=n.at(-1);t!==void 0&&e<=t[1]?t[1]=Math.max(t[1],r):n.push([e,r])}return n}function I$(e,t,n){let r=F$(t),i=[],a=e[0];for(let[e,t]of r)e>a&&i.push([a,e]),a=Math.max(a,t);a<e[1]&&i.push([a,e[1]]);let o=Math.max(1,e[1]-e[0]);return i.filter(([e,t],n)=>n===0||n===i.length-1||(t-e)/o>=k$).map(([e,t],r)=>{let i=`${w$}${n?.rowId??`graph`}-${r}`,a={id:i,kind:`idle`,label:`Idle · ${eF(t-e)}`,...n===void 0?{}:{rowId:n.rowId},...n?.nodeId===void 0?{}:{nodeId:n.nodeId},startedAt:new Date(e).toISOString(),endedAt:new Date(t).toISOString(),durationMs:t-e};return{id:i,label:a.label,laneId:VZ,start:e,end:t,duration:t-e,status:`idle`,payload:a}})}function L$({client:e,detail:t,nodes:n,timeline:r,timelineError:i,onSelectNode:a,selectedItemId:o,onSelectItem:s}){let c=t.run.run_id,l=(0,U.useMemo)(()=>A$(r,n),[r,n]),u=(r?.spans??[]).filter(e=>e.node_id===void 0),d=u.find(e=>e.id===o),f=u.flatMap(e=>e.events).find(e=>(e.record_id??e.id)===o)??u.flatMap(e=>e.events).find(e=>e.id===o),p=d===void 0?f===void 0?void 0:lQ(f):cQ(d);return(0,U.useEffect)(()=>{let e=e=>{e.key===`Escape`&&o!==void 0&&s()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[s,o]),(0,G.jsxs)(`div`,{className:`overall-view`,children:[(0,G.jsx)(sf,{className:`h-full`,children:(0,G.jsxs)(`div`,{className:`p-[34px] max-sm:p-3`,children:[(0,G.jsxs)(`section`,{className:`overall-hero`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Whole DAG`}),(0,G.jsx)(`h2`,{children:c}),t.graph?.plan.goal?.text&&(0,G.jsx)(`p`,{className:`run-goal`,children:t.graph.plan.goal.text}),(0,G.jsxs)(`p`,{children:[t.run.phase,` ·`,` `,t.run.last_event?`last event ${t.run.last_event}`:`no events recorded yet`]})]}),(0,G.jsxs)(`section`,{"aria-label":`Run metrics`,className:`metric-grid`,children:[(0,G.jsx)(B$,{icon:(0,G.jsx)(ht,{}),label:`Status`,value:t.run.state}),(0,G.jsx)(B$,{icon:(0,G.jsx)(Rt,{}),label:`Nodes`,value:String(t.run.nodes.length)}),(0,G.jsx)(B$,{icon:(0,G.jsx)(At,{}),label:`Wall time`,value:t.run.timing.wall_seconds===null?`not measured`:tF(t.run.timing.wall_seconds)}),(0,G.jsx)(B$,{icon:(0,G.jsx)(jt,{}),label:`Turns`,value:String(t.run.turns)})]}),(0,G.jsx)(Fa,{className:`gap-0 py-[15px]`,children:(0,G.jsxs)(Ia,{className:`px-[15px]`,children:[(0,G.jsxs)(`div`,{className:`section-heading`,children:[(0,G.jsx)(ht,{size:16}),(0,G.jsx)(`h3`,{children:`Graph timeline`})]}),i===void 0?r===void 0?(0,G.jsx)(`p`,{"aria-live":`polite`,className:`m-0 text-[11px] text-muted-foreground`,children:`Loading the run's timeline…`}):r.spans.length===0?(0,G.jsx)(`p`,{className:`m-0 text-[11px] text-muted-foreground`,children:`This run has recorded no timeline yet.`}):(0,G.jsx)(R$,{graph:l,onOpenNode:a,onOpenItem:s,selectedItemId:o}):(0,G.jsxs)(sa,{variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Timeline unavailable`}),(0,G.jsx)(la,{children:i.message})]})]})})]})}),p!==void 0&&(0,G.jsxs)(`aside`,{"aria-label":`Item detail panel`,className:`detail-drawer`,children:[(0,G.jsx)(Pa,{"aria-label":`Close detail`,className:`drawer-close`,onClick:()=>s(),size:`icon`,variant:`ghost`,children:(0,G.jsx)(un,{})}),(0,G.jsx)(WQ,{client:e,row:p,runId:c})]})]})}function R$({graph:e,onOpenNode:t,onOpenItem:n,selectedItemId:r}){let[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(new Set),u=i??e.range,d=e=>{e.kind===`record`&&e.nodeId===void 0||e.nodeId===void 0?n(e.id):t(e.nodeId)},f=e.line.lanes.filter(({id:t})=>e.line.items.some(e=>e.laneId===t));return(0,G.jsxs)(`div`,{className:`graph-timeline`,"data-rows-open":o,children:[(0,G.jsx)(Cn,{axis:{origin:e.range[0]},expanded:!1,items:e.line.items,label:`Graph timeline`,lanes:f,markers:e.line.markers,onExpandedChange:s,onRangeChange:a,onSelect:e=>d(e.payload),range:u,selectedId:r}),e.line.markers.some(t=>t.at>e.range[1])&&(0,G.jsxs)(`section`,{"aria-label":`Records after execution`,className:`p-3 border-t`,children:[(0,G.jsx)(`h3`,{className:`eyebrow`,children:`After execution ended`}),e.line.markers.filter(t=>t.at>e.range[1]).map(e=>(0,G.jsxs)(Pa,{onClick:()=>d(e.payload),variant:`outline`,size:`sm`,children:[e.payload.label,` ·`,` `,(0,G.jsx)(sF,{at:e.payload.startedAt})]},e.id))]}),o&&(0,G.jsx)(`ol`,{className:`graph-rows`,children:e.rows.map(n=>(0,G.jsx)(z$,{onOpen:d,onOpenNode:t,onExpandedChange:e=>l(t=>{let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r}),expanded:c.has(n.id),origin:e.range[0],range:u,onRangeChange:a,row:n,selectedItemId:r},n.id))})]})}function z$({row:e,range:t,origin:n,expanded:r,onExpandedChange:i,onRangeChange:a,onOpen:o,onOpenNode:s,selectedItemId:c}){let l=e.nodeId;return(0,G.jsxs)(`li`,{className:`graph-row`,"data-row-kind":e.kind,children:[(0,G.jsxs)(`header`,{className:`graph-row-head`,children:[l===void 0?(0,G.jsx)(`span`,{className:`graph-row-name`,children:e.label}):(0,G.jsx)(`button`,{className:`graph-row-name`,onClick:()=>s(l),type:`button`,children:e.label}),(0,G.jsxs)(`span`,{className:`graph-row-facts`,children:[eF(e.workedMs),` recorded · `,eF(e.idleMs),` `,`idle`]})]}),(0,G.jsx)(Cn,{axis:{origin:n},expanded:r,items:r?e.items:e.line,label:`${e.label} timeline`,lanes:e.lanes,markers:e.markers,onExpandedChange:i,onRangeChange:a,onSelect:e=>o(e.payload),range:t,selectedId:c})]})}function B$({icon:e,label:t,value:n}){return(0,G.jsxs)(Fa,{"aria-label":t,className:`metric flex-row items-center gap-3 p-4`,role:`group`,children:[e,(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{children:t}),(0,G.jsx)(`strong`,{children:n})]})]})}var V$=6,H$=8,U$=`[aria-describedby^="timeline-detail-"]`,W$=e=>{if(!(e instanceof Element))return;let t=RZ(e);if(t!==void 0)return t;let n=e.closest(U$);if(!(n instanceof HTMLElement))return;let r=document.getElementById(n.getAttribute(`aria-describedby`)??``)?.textContent?.trim();return r?{element:n,detail:r}:void 0},G$=(e,t)=>t!==void 0&&e?.element===t.element&&e.detail===t.detail?e:t;function K$(){let e=(0,U.useRef)(null),[t,n]=(0,U.useState)(),[r,i]=(0,U.useState)(),a=t??r,o=(0,U.useCallback)(()=>{n(void 0),i(void 0)},[]);(0,U.useEffect)(()=>{let e=e=>n(t=>G$(t,W$(e.target))),t=e=>i(t=>G$(t,W$(e.target))),r=e=>i(t=>G$(t,W$(e.relatedTarget))),a=()=>n(void 0);return document.addEventListener(`pointerover`,e),document.addEventListener(`pointerleave`,a),document.addEventListener(`focusin`,t),document.addEventListener(`focusout`,r),()=>{document.removeEventListener(`pointerover`,e),document.removeEventListener(`pointerleave`,a),document.removeEventListener(`focusin`,t),document.removeEventListener(`focusout`,r)}},[]);let s=(0,U.useCallback)(()=>{let t=e.current;if(t===null||a===void 0)return;if(!a.element.isConnected)return o();let n=a.element.getBoundingClientRect(),r=t.getBoundingClientRect(),i=window.innerWidth-r.width-H$,s=Math.min(Math.max(n.left,H$),Math.max(H$,i)),c=n.bottom+V$,l=n.top-r.height-V$,u=Math.max(H$,window.innerHeight-r.height-H$),d=c+r.height<=window.innerHeight-H$?c:l,f=Math.min(Math.max(d,H$),u);t.style.left=`${Math.round(s)}px`,t.style.top=`${Math.round(f)}px`,t.style.visibility=`visible`},[a,o]);return(0,U.useLayoutEffect)(s,[s]),(0,U.useEffect)(()=>{if(a!==void 0)return window.addEventListener(`scroll`,s,!0),window.addEventListener(`resize`,s),()=>{window.removeEventListener(`scroll`,s,!0),window.removeEventListener(`resize`,s)}},[a,s]),a===void 0?null:(0,jr.createPortal)((0,G.jsx)(`div`,{"aria-hidden":`true`,className:`timeline-popover`,"data-testid":`timeline-popover`,ref:e,style:{visibility:`hidden`},children:a.detail},a.detail),document.body)}var q$=new JM(window.location.origin,{fetch:window.fetch.bind(window)}),J$=Object.entries(pX);function Y$({client:e=q$}){let t=yX(),n=(0,U.useMemo)(()=>t.view===`overall`?{}:t.nodeId===void 0?void 0:{nodeId:t.nodeId},[t.view,t.nodeId]),r=pX[t.detail].profile,i=zX(e,t.runId,n,r,t.list===`runs`),a=i.list?.runs??[],o=i.runId,s=i.activity.at(-1),c=i.detail,l=(0,U.useMemo)(()=>c?PY(c):[],[c]),u=LX(e,i.invalidations,t.list===`projects`),d=RX(e,o===void 0?t.projectKey:void 0,i.invalidations),f=t.projectKey===void 0?void 0:d.group??EX(u.list?.projects??[],t.projectKey),p=_F(e,o===void 0?f?.project??void 0:void 0,i.invalidations),m=nI(e,o,i.invalidations),h=cZ(e),g=c===void 0?void 0:MY(c),_=l.find(({id:e})=>e===t.nodeId),v=(0,U.useMemo)(()=>new Set((i.list?.runs??[]).filter(({state:e})=>![`complete`,`failed`,`cancelled`].includes(e)).map(({run_id:e})=>e)),[i.list]);return(0,U.useEffect)(()=>{if(o&&t.runId&&t.runId!==o){let e=new URLSearchParams(window.location.search);e.set(`run`,o),e.delete(`node`),e.delete(`event`),e.set(`view`,t.view),window.history.replaceState(null,``,`${window.location.pathname}?${e}`),window.dispatchEvent(new PopStateEvent(`popstate`))}},[t.runId,o,t.view]),(0,G.jsxs)(dm,{children:[(0,G.jsx)(K$,{}),(0,G.jsxs)(`div`,{className:`app-shell`,children:[(0,G.jsx)(MX,{list:t.list,onSelectList:t.selectList,projects:u.list?.projects,selectedProjectKey:t.projectKey,onSelectProject:t.selectProject,runs:a,selectedRunId:o,liveRunIds:v,hasMore:i.hasMore,loadingMore:i.loadingMore,onLoadMore:i.loadMore,onSelect:t.selectRun,hostActions:(0,G.jsx)(lZ,{list:i.list,loadMore:i.loadMore,loadingMore:i.loadingMore,shutdowns:h})}),(0,G.jsxs)(`main`,{className:`workspace`,children:[(0,G.jsxs)(`section`,{"aria-label":o?`Run header`:`Workspace header`,className:`topbar${o?` run-topbar`:``}`,children:[(0,G.jsxs)(`div`,{className:`topbar-title`,children:[t.projectKey!==void 0&&o&&(0,G.jsxs)(Pa,{"aria-label":`Back to ${f?CX(f):`the project`}`,className:`topbar-back`,onClick:()=>t.selectProject(t.projectKey),size:`sm`,type:`button`,variant:`ghost`,children:[(0,G.jsx)(_t,{size:14}),f?CX(f):`Project`]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Execution telemetry`}),(0,G.jsx)(`h2`,{children:o??(t.projectKey===void 0?t.list===`projects`?`Projects`:`No DAG selected`:(f&&CX(f))??t.projectKey)})]})]}),(0,G.jsxs)(`div`,{className:`topbar-actions`,children:[o!==void 0&&(0,G.jsx)($F,{control:m,runId:o,ended:c!==void 0&&(c.run.state===`settled`||c.run.state.startsWith(`ended-`))}),(0,G.jsxs)(`span`,{className:`connection`,children:[(0,G.jsx)(en,{size:15}),i.lastUpdated===void 0?`Waiting for first update`:(0,G.jsxs)(G.Fragment,{children:[`Last updated`,` `,(0,G.jsx)(sF,{at:i.lastUpdated,relative:!0})]})]}),s!==void 0&&(0,G.jsxs)(`button`,{className:`last-activity connection`,type:`button`,title:`${s.node}: ${[s.name,s.detail].filter(Boolean).join(` `)||s.kind}`,onClick:()=>{t.selectNode(s.node),t.selectItem(s.event_id)},children:[s.node,`:`,` `,[s.name,s.detail].filter(Boolean).join(` `)||s.kind]}),(0,G.jsxs)(Pa,{onClick:()=>void i.refresh(),size:`sm`,type:`button`,variant:`outline`,children:[(0,G.jsx)(Zt,{size:14}),` Refresh`]})]})]}),i.error&&(0,G.jsxs)(sa,{className:`rounded-none border-x-0 border-t-0`,variant:`destructive`,children:[(0,G.jsx)(an,{}),(0,G.jsx)(ca,{children:`Live telemetry issue`}),(0,G.jsx)(la,{children:i.error.message})]}),(0,G.jsx)(fZ,{label:`Shutdown of the entire host`,onDismiss:h.host.dismiss,rows:a,state:h.host.state}),o===void 0&&t.projectKey!==void 0?(0,G.jsx)(PX,{agents:f?.project==null?void 0:(0,G.jsx)(hF,{agents:p,client:e,count:f.agent_count,title:`Agents of ${CX(f)}`}),error:d.error,group:f,loading:d.loading&&f===void 0,onSelectRun:t.selectRun,projectKey:t.projectKey}):o===void 0&&t.list===`projects`&&!i.loading?(0,G.jsx)(NX,{error:u.error,groups:u.list?.projects,onSelect:t.selectProject}):(0,G.jsxs)(bp,{className:`min-h-0 flex-1 gap-0`,onValueChange:e=>e===`overall`?t.showOverall():e===`graph`?t.selectNode(void 0):lX(e)?t.selectView(e):void 0,value:t.view,children:[(0,G.jsxs)(`div`,{className:`view-tabs`,children:[(0,G.jsxs)(Sp,{"aria-label":`DAG views`,variant:`line`,children:[(0,G.jsxs)(Cp,{value:`graph`,children:[(0,G.jsx)(ln,{size:15}),` Graph`]}),(0,G.jsxs)(Cp,{value:`overall`,children:[(0,G.jsx)($t,{size:15}),` Overall`]}),(0,G.jsxs)(Cp,{value:`channel`,children:[(0,G.jsx)(Lt,{size:15}),` Channel`]}),(0,G.jsxs)(Cp,{value:`reads`,children:[(0,G.jsx)(yt,{size:15}),` Reads`]})]}),(0,G.jsxs)(`fieldset`,{className:`detail-switch`,children:[(0,G.jsx)(`legend`,{className:`sr-only`,children:`Level of detail`}),J$.map(([e,{label:n,description:r}])=>(0,G.jsx)(Pa,{"aria-pressed":t.detail===e,onClick:()=>t.selectDetail(e),size:`sm`,title:r,type:`button`,variant:t.detail===e?`default`:`outline`,children:n},e))]})]}),(0,G.jsx)(wp,{className:`min-h-0`,value:t.view,children:!c&&(i.loading||o!==void 0)?(0,G.jsxs)(`div`,{"aria-live":`polite`,className:`loading-state`,children:[(0,G.jsx)(xf,{className:`h-2 w-48`}),(0,G.jsx)(xf,{className:`h-2 w-32`}),`Loading execution history…`]}):c&&o?t.view===`channel`?(0,G.jsx)(IF,{client:e,decisions:g?.decisions??[],filter:r,invalidations:i.invalidations,observedAt:c.observed_at,overrides:g&&NY(g),runId:o}):t.view===`reads`?(0,G.jsx)(YF,{client:e,invalidations:i.invalidations,nodes:l,runId:o,status:m.status}):t.view===`overall`?(0,G.jsx)(L$,{client:e,detail:c,nodes:l,timeline:i.timeline,timelineError:i.timelineError,onSelectNode:t.selectNode,onSelectItem:t.selectItem,selectedItemId:t.itemId}):_?(0,G.jsx)(p$,{client:e,node:_,onBack:()=>t.selectNode(void 0),onSelectItem:t.selectItem,runId:o,selectedItemId:t.itemId,selectedTab:t.nodeTab,onSelectTab:t.selectNodeTab,timeline:i.timeline,timelineError:i.timelineError}):(0,G.jsx)(ZY,{nodes:l,selectedNodeId:t.nodeId,onSelectNode:t.selectNode}):(0,G.jsxs)(`div`,{className:`empty-state`,children:[(0,G.jsx)(ln,{size:34}),(0,G.jsx)(`h2`,{children:`No DAG runs found`}),(0,G.jsx)(`p`,{children:`Start an orchestrated run to see it appear here.`})]})})]})]})]})]})}var X$=class extends U.Component{state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`DAG UI render failed`,e,t.componentStack)}render(){return this.state.error?(0,G.jsxs)(`main`,{className:`fatal-error`,role:`alert`,children:[(0,G.jsx)(`p`,{className:`eyebrow`,children:`Rendering error`}),(0,G.jsx)(`h1`,{children:`The DAG view could not be displayed.`}),(0,G.jsx)(`p`,{children:this.state.error.message}),(0,G.jsx)(Pa,{onClick:()=>(this.props.onReload??(()=>window.location.reload()))(),type:`button`,variant:`secondary`,children:`Reload`})]}):this.props.children}},Z$=document.getElementById(`root`);if(!Z$)throw Error(`DAG UI root element is missing`);(0,kA.createRoot)(Z$).render((0,G.jsx)(U.StrictMode,{children:(0,G.jsx)(X$,{children:(0,G.jsx)(Y$,{})})}));