diff --git a/SYSTEM_PROMPT.md b/SYSTEM_PROMPT.md index 1bb04219..c56912f9 100644 --- a/SYSTEM_PROMPT.md +++ b/SYSTEM_PROMPT.md @@ -1,9 +1,8 @@ /,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var s={};s["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},s.cdata=/^$/i;var a={"included-cdata":{pattern://i,inside:s}};a["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var c={};c[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:a},e.languages.insertBefore("markup","cdata",c)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}gl.displayName="css";gl.aliases=[];function gl(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}bv.displayName="diff";bv.aliases=[];function bv(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var s=n[r],a=[];/^\w+$/.test(r)||a.push(/\w+/.exec(r)[0]),r==="diff"&&a.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+s+`].*(?:\r +`)),y+=p.move(f),g(),y}function r(a,c,l){let u=a.value||"",h=1;for(t||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(u);)h++;const p="$".repeat(h);/[^ \r\n]/.test(u)&&(/^[ \r\n]/.test(u)&&/[ \r\n]$/.test(u)||/^\$|\$$/.test(u))&&(u=" "+u+" ");let f=-1;for(;++f]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}}au.displayName="c";au.aliases=[];function au(e){e.register(Di),e.languages.c=e.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),e.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),e.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},e.languages.c.string],char:e.languages.c.char,comment:e.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:e.languages.c}}}}),e.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete e.languages.c.boolean}yd.displayName="cpp";yd.aliases=[];function yd(e){e.register(au),(function(t){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,r=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,function(){return n.source});t.languages.cpp=t.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,function(){return n.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),t.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,function(){return r})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),t.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t.languages.cpp}}}}),t.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),t.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:t.languages.extend("cpp",{})}}),t.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},t.languages.cpp["base-clause"])})(e)}gv.displayName="arduino";gv.aliases=["ino"];function gv(e){e.register(yd),e.languages.arduino=e.languages.extend("cpp",{keyword:/\b(?:String|array|bool|boolean|break|byte|case|catch|continue|default|do|double|else|finally|for|function|goto|if|in|instanceof|int|integer|long|loop|new|null|return|setup|string|switch|throw|try|void|while|word)\b/,constant:/\b(?:ANALOG_MESSAGE|DEFAULT|DIGITAL_MESSAGE|EXTERNAL|FIRMATA_STRING|HIGH|INPUT|INPUT_PULLUP|INTERNAL|INTERNAL1V1|INTERNAL2V56|LED_BUILTIN|LOW|OUTPUT|REPORT_ANALOG|REPORT_DIGITAL|SET_PIN_MODE|SYSEX_START|SYSTEM_RESET)\b/,builtin:/\b(?:Audio|BSSID|Bridge|Client|Console|EEPROM|Esplora|EsploraTFT|Ethernet|EthernetClient|EthernetServer|EthernetUDP|File|FileIO|FileSystem|Firmata|GPRS|GSM|GSMBand|GSMClient|GSMModem|GSMPIN|GSMScanner|GSMServer|GSMVoiceCall|GSM_SMS|HttpClient|IPAddress|IRread|Keyboard|KeyboardController|LiquidCrystal|LiquidCrystal_I2C|Mailbox|Mouse|MouseController|PImage|Process|RSSI|RobotControl|RobotMotor|SD|SPI|SSID|Scheduler|Serial|Server|Servo|SoftwareSerial|Stepper|Stream|TFT|Task|USBHost|WiFi|WiFiClient|WiFiServer|WiFiUDP|Wire|YunClient|YunServer|abs|addParameter|analogRead|analogReadResolution|analogReference|analogWrite|analogWriteResolution|answerCall|attach|attachGPRS|attachInterrupt|attached|autoscroll|available|background|beep|begin|beginPacket|beginSD|beginSMS|beginSpeaker|beginTFT|beginTransmission|beginWrite|bit|bitClear|bitRead|bitSet|bitWrite|blink|blinkVersion|buffer|changePIN|checkPIN|checkPUK|checkReg|circle|cityNameRead|cityNameWrite|clear|clearScreen|click|close|compassRead|config|connect|connected|constrain|cos|countryNameRead|countryNameWrite|createChar|cursor|debugPrint|delay|delayMicroseconds|detach|detachInterrupt|digitalRead|digitalWrite|disconnect|display|displayLogos|drawBMP|drawCompass|encryptionType|end|endPacket|endSMS|endTransmission|endWrite|exists|exitValue|fill|find|findUntil|flush|gatewayIP|get|getAsynchronously|getBand|getButton|getCurrentCarrier|getIMEI|getKey|getModifiers|getOemKey|getPINUsed|getResult|getSignalStrength|getSocket|getVoiceCallStatus|getXChange|getYChange|hangCall|height|highByte|home|image|interrupts|isActionDone|isDirectory|isListening|isPIN|isPressed|isValid|keyPressed|keyReleased|keyboardRead|knobRead|leftToRight|line|lineFollowConfig|listen|listenOnLocalhost|loadImage|localIP|lowByte|macAddress|maintain|map|max|messageAvailable|micros|millis|min|mkdir|motorsStop|motorsWrite|mouseDragged|mouseMoved|mousePressed|mouseReleased|move|noAutoscroll|noBlink|noBuffer|noCursor|noDisplay|noFill|noInterrupts|noListenOnLocalhost|noStroke|noTone|onReceive|onRequest|open|openNextFile|overflow|parseCommand|parseFloat|parseInt|parsePacket|pauseMode|peek|pinMode|playFile|playMelody|point|pointTo|position|pow|prepare|press|print|printFirmwareVersion|printVersion|println|process|processInput|pulseIn|put|random|randomSeed|read|readAccelerometer|readBlue|readButton|readBytes|readBytesUntil|readGreen|readJoystickButton|readJoystickSwitch|readJoystickX|readJoystickY|readLightSensor|readMessage|readMicrophone|readNetworks|readRed|readSlider|readString|readStringUntil|readTemperature|ready|rect|release|releaseAll|remoteIP|remoteNumber|remotePort|remove|requestFrom|retrieveCallingNumber|rewindDirectory|rightToLeft|rmdir|robotNameRead|robotNameWrite|run|runAsynchronously|runShellCommand|runShellCommandAsynchronously|running|scanNetworks|scrollDisplayLeft|scrollDisplayRight|seek|sendAnalog|sendDigitalPortPair|sendDigitalPorts|sendString|sendSysex|serialEvent|setBand|setBitOrder|setClockDivider|setCursor|setDNS|setDataMode|setFirmwareVersion|setMode|setPINUsed|setSpeed|setTextSize|setTimeout|shiftIn|shiftOut|shutdown|sin|size|sqrt|startLoop|step|stop|stroke|subnetMask|switchPIN|tan|tempoWrite|text|tone|transfer|tuneWrite|turn|updateIR|userNameRead|userNameWrite|voiceCall|waitContinue|width|write|writeBlue|writeGreen|writeJSON|writeMessage|writeMicroseconds|writeRGB|writeRed|yield)\b/}),e.languages.ino=e.languages.arduino}vv.displayName="bash";vv.aliases=["sh","shell"];function vv(e){(function(t){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",r={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},s={bash:r,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:s},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:r}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:s},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:s.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:s.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},r.inside=t.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],c=s.variable[1].inside,l=0;l>/g,function(W,G){return"(?:"+O[+G]+")"})}function r(L,O,W){return RegExp(n(L,O),"")}function s(L,O){for(var W=0;W>/g,function(){return"(?:"+L+")"});return L.replace(/<>/g,"[^\\s\\S]")}var a={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function c(L){return"\\b(?:"+L.trim().replace(/ /g,"|")+")\\b"}var l=c(a.typeDeclaration),u=RegExp(c(a.type+" "+a.typeDeclaration+" "+a.contextual+" "+a.other)),h=c(a.typeDeclaration+" "+a.contextual+" "+a.other),p=c(a.type+" "+a.typeDeclaration+" "+a.other),f=s(/<(?:[^<>;=+\-*/%&|^]|<>)*>/.source,2),g=s(/\((?:[^()]|<>)*\)/.source,2),y=/@?\b[A-Za-z_]\w*\b/.source,C=n(/<<0>>(?:\s*<<1>>)?/.source,[y,f]),w=n(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[h,C]),b=/\[\s*(?:,\s*)*\]/.source,_=n(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[w,b]),x=n(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[f,g,b]),S=n(/\(<<0>>+(?:,<<0>>+)+\)/.source,[x]),E=n(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[S,w,b]),T={keyword:u,punctuation:/[<>()?,.:[\]]/},A=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,D=/"(?:\\.|[^\\"\r\n])*"/.source,M=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:r(/(^|[^$\\])<<0>>/.source,[M]),lookbehind:!0,greedy:!0},{pattern:r(/(^|[^@$\\])<<0>>/.source,[D]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:r(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[w]),lookbehind:!0,inside:T},{pattern:r(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[y,E]),lookbehind:!0,inside:T},{pattern:r(/(\busing\s+)<<0>>(?=\s*=)/.source,[y]),lookbehind:!0},{pattern:r(/(\b<<0>>\s+)<<1>>/.source,[l,C]),lookbehind:!0,inside:T},{pattern:r(/(\bcatch\s*\(\s*)<<0>>/.source,[w]),lookbehind:!0,inside:T},{pattern:r(/(\bwhere\s+)<<0>>/.source,[y]),lookbehind:!0},{pattern:r(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[_]),lookbehind:!0,inside:T},{pattern:r(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[E,p,y]),inside:T}],keyword:u,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:r(/([(,]\s*)<<0>>(?=\s*:)/.source,[y]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:r(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[y]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:r(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[g]),lookbehind:!0,alias:"class-name",inside:T},"return-type":{pattern:r(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[E,w]),inside:T,alias:"class-name"},"constructor-invocation":{pattern:r(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[E]),lookbehind:!0,inside:T,alias:"class-name"},"generic-method":{pattern:r(/<<0>>\s*<<1>>(?=\s*\()/.source,[y,f]),inside:{function:r(/^<<0>>/.source,[y]),generic:{pattern:RegExp(f),alias:"class-name",inside:T}}},"type-list":{pattern:r(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[l,C,y,E,u.source,g,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:r(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[C,g]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:u,"class-name":{pattern:RegExp(E),greedy:!0,inside:T},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var R=D+"|"+A,z=n(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[R]),H=s(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[z]),2),$=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,U=n(/<<0>>(?:\s*\(<<1>>*\))?/.source,[w,H]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:r(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[$,U]),lookbehind:!0,greedy:!0,inside:{target:{pattern:r(/^<<0>>(?=\s*:)/.source,[$]),alias:"keyword"},"attribute-arguments":{pattern:r(/\(<<0>>*\)/.source,[H]),inside:t.languages.csharp},"class-name":{pattern:RegExp(w),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var q=/:[^}\r\n]+/.source,K=s(n(/[^"'/()]|<<0>>|\(<>*\)/.source,[z]),2),Y=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[K,q]),Q=s(n(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<>*\)/.source,[R]),2),ee=n(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[Q,q]);function B(L,O){return{interpolation:{pattern:r(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[L]),lookbehind:!0,inside:{"format-string":{pattern:r(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[O,q]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:r(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[Y]),lookbehind:!0,greedy:!0,inside:B(Y,K)},{pattern:r(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[ee]),lookbehind:!0,greedy:!0,inside:B(ee,Q)}],char:{pattern:RegExp(A),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(e)}ou.displayName="markup";ou.aliases=["atom","html","mathml","rss","ssml","svg","xml"];function ou(e){e.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},e.languages.markup.tag.inside["attr-value"].inside.entity=e.languages.markup.entity,e.languages.markup.doctype.inside["internal-subset"].inside=e.languages.markup,e.hooks.add("wrap",function(t){t.type==="entity"&&(t.attributes.title=t.content.value.replace(/&/,"&"))}),Object.defineProperty(e.languages.markup.tag,"addInlined",{value:function(n,r){var s={};s["language-"+r]={pattern:/(^$)/i,lookbehind:!0,inside:e.languages[r]},s.cdata=/^$/i;var a={"included-cdata":{pattern://i,inside:s}};a["language-"+r]={pattern:/[\s\S]+/,inside:e.languages[r]};var c={};c[n]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:a},e.languages.insertBefore("markup","cdata",c)}}),Object.defineProperty(e.languages.markup.tag,"addAttribute",{value:function(t,n){e.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+t+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:e.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),e.languages.html=e.languages.markup,e.languages.mathml=e.languages.markup,e.languages.svg=e.languages.markup,e.languages.xml=e.languages.extend("markup",{}),e.languages.ssml=e.languages.xml,e.languages.atom=e.languages.xml,e.languages.rss=e.languages.xml}gl.displayName="css";gl.aliases=[];function gl(e){(function(t){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var r=t.languages.markup;r&&(r.tag.addInlined("style","css"),r.tag.addAttribute("style","css"))})(e)}bv.displayName="diff";bv.aliases=[];function bv(e){(function(t){t.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach(function(r){var s=n[r],a=[];/^\w+$/.test(r)||a.push(/\w+/.exec(r)[0]),r==="diff"&&a.push("bold"),t.languages.diff[r]={pattern:RegExp("^(?:["+s+`].*(?:\r ?| -|(?![\\s\\S])))+`,"m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}_v.displayName="go";_v.aliases=[];function _v(e){e.register(Di),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}xv.displayName="ini";xv.aliases=[];function xv(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}Sv.displayName="java";Sv.aliases=[];function Sv(e){e.register(Di),(function(t){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,s={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[s,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:s.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:s.inside}],keyword:n,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":s,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:s.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:s.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}wv.displayName="regex";wv.aliases=[];function wv(e){(function(t){var n={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,s={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},a={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},c="(?:[^\\\\-]|"+r.source+")",l=RegExp(c+"-"+c),u={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:l,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":n,"char-set":a,escape:r}},"special-escape":n,"char-set":s,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":u}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Cv.displayName="json";Cv.aliases=["webmanifest"];function Cv(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Ev.displayName="kotlin";Ev.aliases=["kt","kts"];function Ev(e){e.register(Di),(function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}kv.displayName="less";kv.aliases=[];function kv(e){e.register(gl),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}Av.displayName="lua";Av.aliases=[];function Av(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}Tv.displayName="makefile";Tv.aliases=[];function Tv(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}Nv.displayName="yaml";Nv.aliases=["yml"];function Nv(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(u,h){h=(h||"").replace(/m/g,"")+"m";var p=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return u});return RegExp(p,h)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return"(?:"+a+"|"+c+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(c),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}Mv.displayName="markdown";Mv.aliases=["md"];function Mv(e){e.register(ou),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(l){return l=l.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+c+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+c+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(u){l!==u&&(t.languages.markdown[l].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function u(h){if(!(!h||typeof h=="string"))for(var p=0,f=h.length;p]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}Rv.displayName="perl";Rv.aliases=[];function Rv(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,n+/\s*/.source+n].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}bd.displayName="markup-templating";bd.aliases=[];function bd(e){e.register(ou),(function(t){function n(r,s){return"___"+r.toUpperCase()+s+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,s,a,c){if(r.language===s){var l=r.tokenStack=[];r.code=r.code.replace(a,function(u){if(typeof c=="function"&&!c(u))return u;for(var h=l.length,p;r.code.indexOf(p=n(s,h))!==-1;)++h;return l[h]=u,p}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,s){if(r.language!==s||!r.tokenStack)return;r.grammar=t.languages[s];var a=0,c=Object.keys(r.tokenStack);function l(u){for(var h=0;h=c.length);h++){var p=u[h];if(typeof p=="string"||p.content&&typeof p.content=="string"){var f=c[a],g=r.tokenStack[f],y=typeof p=="string"?p:p.content,C=n(s,f),w=y.indexOf(C);if(w>-1){++a;var _=y.substring(0,w),b=new t.Token(s,t.tokenize(g,r.grammar),"language-"+s,g),x=y.substring(w+C.length),S=[];_&&S.push.apply(S,l([_])),S.push(b),x&&S.push.apply(S,l([x])),typeof p=="string"?u.splice.apply(u,[h,1].concat(S)):p.content=S}}else p.content&&l(p.content)}return u}l(r.tokens)}}})})(e)}jv.displayName="php";jv.aliases=[];function jv(e){e.register(bd),(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],s=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,a=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,c=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:s,operator:a,punctuation:c};var l={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},u=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:l}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:l}}];t.languages.insertBefore("php","variable",{string:u,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:u,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:s,operator:a,punctuation:c}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(h){if(/<\?/.test(h.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(h,"php",p)}}),t.hooks.add("after-tokenize",function(h){t.languages["markup-templating"].tokenizePlaceholders(h,"php")})})(e)}Lv.displayName="python";Lv.aliases=["py"];function Lv(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}Ov.displayName="r";Ov.aliases=[];function Ov(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}Bv.displayName="ruby";Bv.aliases=["rb"];function Bv(e){e.register(Di),(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",s=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+s),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+s+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(e)}zv.displayName="rust";zv.aliases=[];function zv(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}Iv.displayName="sass";Iv.aliases=[];function Iv(e){e.register(gl),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}Hv.displayName="scss";Hv.aliases=[];function Hv(e){e.register(gl),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}Fv.displayName="sql";Fv.aliases=[];function Fv(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}Pv.displayName="swift";Pv.aliases=[];function Pv(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=e.languages.swift})}$v.displayName="typescript";$v.aliases=["ts"];function $v(e){e.register(yd),(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}_d.displayName="basic";_d.aliases=[];function _d(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}Uv.displayName="vbnet";Uv.aliases=[];function Uv(e){e.register(_d),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}const Jz=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],a_={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function i8(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=48&&t<=57}function eI(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function tI(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function o_(e){return tI(e)||i8(e)}const nI=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function rI(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,s=[];let a=0,c=-1,l="",u,h;n.position&&("start"in n.position||"indent"in n.position?(h=n.position.indent,u=n.position.start):u=n.position);let p=(u?u.line:0)||1,f=(u?u.column:0)||1,g=C(),y;for(a--;++a<=e.length;)if(y===10&&(f=(h?h[c]:0)||1),y=e.charCodeAt(a),y===38){const b=e.charCodeAt(a+1);if(b===9||b===10||b===12||b===32||b===38||b===60||Number.isNaN(b)||r&&b===r){l+=String.fromCharCode(y),f++;continue}const x=a+1;let S=x,E=x,T;if(b===35){E=++S;const $=e.charCodeAt(E);$===88||$===120?(T="hexadecimal",E=++S):T="decimal"}else T="named";let A="",D="",M="";const R=T==="named"?o_:T==="decimal"?i8:eI;for(E--;++E<=e.length;){const $=e.charCodeAt(E);if(!R($))break;M+=String.fromCharCode($),T==="named"&&Jz.includes(M)&&(A=M,D=jc(M))}let z=e.charCodeAt(E)===59;if(z){E++;const $=T==="named"?jc(M):!1;$&&(A=M,D=$)}let H=1+E-x,q="";if(!(!z&&n.nonTerminated===!1))if(!M)T!=="named"&&w(4,H);else if(T==="named"){if(z&&!D)w(5,1);else if(A!==M&&(E=S+A.length,H=1+E-S,z=!1),!z){const $=A?1:3;if(n.attribute){const U=e.charCodeAt(E);U===61?(w($,H),D=""):o_(U)?D="":w($,H)}else w($,H)}q=D}else{z||w(2,H);let $=Number.parseInt(M,T==="hexadecimal"?16:10);if(iI($))w(7,H),q="�";else if($ in a_)w(6,H),q=a_[$];else{let U="";sI($)&&w(6,H),$>65535&&($-=65536,U+=String.fromCharCode($>>>10|55296),$=56320|$&1023),q=U+String.fromCharCode($)}}if(q){_(),g=C(),a=E-1,f+=E-x+1,s.push(q);const $=C();$.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,q,{start:g,end:$},e.slice(x-1,E)),g=$}else M=e.slice(x-1,E),l+=M,f+=M.length,a=E-1}else y===10&&(p++,c++,f=0),Number.isNaN(y)?_():(l+=String.fromCharCode(y),f++);return s.join("");function C(){return{line:p,column:f,offset:a+((u?u.offset:0)||0)}}function w(b,x){let S;n.warning&&(S=C(),S.column+=x,S.offset+=x,n.warning.call(n.warningContext||void 0,nI[b],S,b))}function _(){l&&(s.push(l),n.text&&n.text.call(n.textContext||void 0,l,{start:g,end:C()}),l="")}}function iI(e){return e>=55296&&e<=57343||e>1114111}function sI(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var aI=0,F0={},Hn={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++aI}),e.__id},clone:function e(t,n){n=n||{};var r,s;switch(Hn.util.type(t)){case"Object":if(s=Hn.util.objId(t),n[s])return n[s];r={},n[s]=r;for(var a in t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case"Array":return s=Hn.util.objId(t),n[s]?n[s]:(r=[],n[s]=r,t.forEach(function(c,l){r[l]=e(c,n)}),r);default:return t}}},languages:{plain:F0,plaintext:F0,text:F0,txt:F0,extend:function(e,t){var n=Hn.util.clone(Hn.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Hn.languages;var s=r[e],a={};for(var c in s)if(s.hasOwnProperty(c)){if(c==t)for(var l in n)n.hasOwnProperty(l)&&(a[l]=n[l]);n.hasOwnProperty(c)||(a[c]=s[c])}var u=r[e];return r[e]=a,Hn.languages.DFS(Hn.languages,function(h,p){p===u&&h!=e&&(this[h]=a)}),a},DFS:function e(t,n,r,s){s=s||{};var a=Hn.util.objId;for(var c in t)if(t.hasOwnProperty(c)){n.call(t,c,t[c],r||c);var l=t[c],u=Hn.util.type(l);u==="Object"&&!s[a(l)]?(s[a(l)]=!0,e(l,n,null,s)):u==="Array"&&!s[a(l)]&&(s[a(l)]=!0,e(l,n,c,s))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Hn.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Hn.tokenize(r.code,r.grammar),Hn.hooks.run("after-tokenize",r),Ac.stringify(Hn.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var s=new oI;return fh(s,s.head,e),s8(e,s,t,s.head,0),cI(s)},hooks:{all:{},add:function(e,t){var n=Hn.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Hn.hooks.all[e];if(!(!n||!n.length))for(var r=0,s;s=n[r++];)s(t)}},Token:Ac};function Ac(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function l_(e,t,n,r){e.lastIndex=t;var s=e.exec(n);if(s&&r&&s[1]){var a=s[1].length;s.index+=a,s[0]=s[0].slice(a)}return s}function s8(e,t,n,r,s,a){for(var c in n)if(!(!n.hasOwnProperty(c)||!n[c])){var l=n[c];l=Array.isArray(l)?l:[l];for(var u=0;u=a.reach);b+=_.value.length,_=_.next){var x=_.value;if(t.length>e.length)return;if(!(x instanceof Ac)){var S=1,E;if(g){if(E=l_(w,b,e,f),!E||E.index>=e.length)break;var M=E.index,T=E.index+E[0].length,A=b;for(A+=_.value.length;M>=A;)_=_.next,A+=_.value.length;if(A-=_.value.length,b=A,_.value instanceof Ac)continue;for(var D=_;D!==t.tail&&(Aa.reach&&(a.reach=q);var $=_.prev;z&&($=fh(t,$,z),b+=z.length),lI(t,$,S);var U=new Ac(c,p?Hn.tokenize(R,p):R,y,R);if(_=fh(t,$,U),H&&fh(t,_,H),S>1){var K={cause:c+","+u,reach:q};s8(e,t,n,_.prev,b,K),a&&K.reach>a.reach&&(a.reach=K.reach)}}}}}}function oI(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function fh(e,t,n){var r=t.next,s={value:n,prev:t,next:r};return t.next=s,r.prev=s,e.length++,s}function lI(e,t,n){for(var r=t.next,s=0;sn)return e;try{return Xe.highlight(e,t).children.map(l8)}catch{return e}}const vI=1e5;function yI({code:e,lang:t}){const[n,r]=P.useState(!1),s=()=>{var a;(a=navigator.clipboard)==null||a.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return m.jsxs("div",{className:"md-code",children:[m.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:s,children:n?m.jsx(Zr,{size:13}):m.jsx(Tg,{size:13})}),m.jsx("pre",{children:m.jsx("code",{children:c8(e,t,vI)})})]})}function bI(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function _I(e){const t=/]*?)\/?>/gi,n=[];let r=0,s=!1;for(const a of e.matchAll(t)){const c=bI(a[1]??"");c.path&&(s=!0,a.index>r&&n.push({type:"text",value:e.slice(r,a.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:c},type:"fileMention"}),r=a.index+a[0].length)}return s?(ru8(e)}function c_({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,s=t&&Number.parseInt(t,10)||void 0,a=s!=null?`${r}:${s}`:r;return m.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[m.jsx(wx,{size:12}),m.jsx("span",{className:"file-chip-label",children:a})]})}const SI=/(```[\s\S]*?(?:```|$)|~~~[\s\S]*?(?:~~~|$)|`[^`\n]*`)/g,h8={singleDollarTextMath:!1};function d8(e){return!e.includes("\\(")&&!e.includes("\\[")?e:e.split(SI).map((t,n)=>n%2===1?t:t.replace(/\\\[([\s\S]+?)\\\]/g,(r,s)=>`$$${s}$$`).replace(/\\\(([\s\S]+?)\\\)/g,(r,s)=>`$$${s}$$`)).join("")}function wI(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const f8={code:({node:e,className:t,children:n,...r})=>{const s=t??"",a=/language-(\w+)/.exec(s),c=String(n??"").replace(/\n$/,"");if(!(a!=null||c.includes(` -`)))return m.jsx("code",{className:s,...r,children:n});const u=a?Wm(a[1]):null;return m.jsx(yI,{code:c,lang:u})},pre:({children:e})=>m.jsx(m.Fragment,{children:e})},zc=P.memo(function({text:t,onOpenFile:n}){const r={"file-mention":s=>m.jsx(c_,{path:s.path,lines:s.lines,onOpenFile:n}),a:({node:s,href:a,children:c,...l})=>a&&wI(a)&&n?m.jsx(c_,{path:decodeURI(a),onOpenFile:n}):m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...l,children:c}),...f8};return m.jsx("div",{className:"md",children:m.jsx(C7,{remarkPlugins:[t8,[n8,h8],xI],rehypePlugins:[MS],components:r,children:d8(t)})})});function CI({synthesized:e,agentLabel:t,onView:n,onApprove:r,onReject:s,onRevise:a}){const[c,l]=P.useState(!1),u=P.useRef(null),[h,p]=P.useState(!1),[f,g]=P.useState(""),y=P.useRef(null);P.useEffect(()=>{if(!c)return;const w=_=>{u.current&&!u.current.contains(_.target)&&l(!1)};return window.addEventListener("pointerdown",w),()=>window.removeEventListener("pointerdown",w)},[c]),P.useEffect(()=>{var w;h&&((w=y.current)==null||w.focus())},[h]);const C=()=>{a(f.trim()||"no specific feedback — use your judgment"),g(""),p(!1)};return m.jsxs("div",{className:"plan-strip",children:[m.jsxs("div",{className:"plan-strip-info",children:[m.jsx(Ax,{size:14,className:"plan-strip-icon"}),m.jsx("span",{className:"plan-strip-title",children:e?`${t} is ready to proceed`:`${t} proposed a plan`}),m.jsx("button",{className:"plan-strip-open",onClick:n,children:"Open plan"})]}),h?m.jsxs(m.Fragment,{children:[m.jsx("textarea",{ref:y,className:"plan-strip-revise-input",placeholder:"What should change? (optional)",rows:2,value:f,onChange:w=>g(w.target.value),onKeyDown:w=>{w.key==="Escape"?(w.preventDefault(),g(""),p(!1)):w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),C())}}),m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:()=>{g(""),p(!1)},children:"Back"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("button",{className:"btn-primary plan-strip-primary",onClick:C,children:["Revise",m.jsx(_x,{size:13})]})]})]}):m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:s,children:"Reject"}),m.jsx("button",{className:"btn-ghost",onClick:()=>p(!0),children:"Revise…"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("div",{className:"plan-strip-approve",ref:u,children:[m.jsx("button",{className:"btn-primary plan-strip-primary",onClick:()=>r("auto"),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-primary plan-strip-primary plan-strip-caret","aria-label":"More approval options",onClick:()=>l(w=>!w),children:m.jsx(Pa,{size:13})}),c&&m.jsx("div",{className:"plan-strip-menu",children:m.jsx("button",{onClick:()=>{l(!1),r("bypass")},children:"Accept and bypass all"})})]})]})]})}function p8({onSaved:e}){const[t,n]=P.useState(""),[r,s]=P.useState(!1),[a,c]=P.useState(null);async function l(u){if(u.preventDefault(),!(r||!t.trim())){s(!0),c(null);try{e(await DT(t.trim())),n("")}catch(h){c(h instanceof Error?h.message:String(h))}finally{s(!1)}}}return m.jsxs("form",{className:"onb-token-form",onSubmit:l,children:[m.jsx("input",{type:"password",value:t,onChange:u=>n(u.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),m.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),m.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),a&&m.jsx("div",{className:"error",children:a})]})}function EI(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"ray_job":return"Ray";case"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function kI({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),m.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),m.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),m.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),m.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),m.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),m.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-.573.534-.375-.677-1.405-2.416-1.94-2.751-.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function AI({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[m.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),m.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),m.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),m.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),m.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),m.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),m.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),m.jsxs("defs",{children:[m.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),m.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function TI({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:m.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function NI({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#028CF0","aria-hidden":"true",children:m.jsx("path",{d:"M16.153 12.826c-.63-.183-1.03.15-1.378.846-.58 1.13-1.643 1.644-2.888 1.594-1.245-.05-2.257-.63-2.788-1.776-.233-.498-.498-.664-1.046-.68-.93-.017-1.643.016-2.174 1.062-.631 1.261-2.258 1.693-3.619 1.261a3.234 3.234 0 0 1-2.257-3.22 3.198 3.198 0 0 1 2.29-3.02 3.276 3.276 0 0 1 3.702 1.327c.216.315.216.863.597.93.648.1 1.328.033 1.992.033.299 0 .316-.266.399-.465.58-1.295 1.61-1.959 2.987-1.975 1.361-.017 2.39.647 2.955 1.892.215.465.48.598.946.548.166-.017.332.016.498 0 .464-.083 1.062.282 1.344-.448.282-.73-.382-.913-.68-1.245-.847-.946-1.81-1.793-2.673-2.706-.415-.465-.763-.614-1.41-.415-1.876.614-3.619-.431-4.15-2.357-.448-1.676.714-3.535 2.44-3.917a3.293 3.293 0 0 1 3.95 2.457c.017.05.017.083.033.133.117.564.117 1.145-.132 1.626-.283.531-.133.83.249 1.195a152.61 152.61 0 0 1 3.286 3.27c.299.299.498.349.913.2 1.51-.565 2.97-.1 3.884 1.161a3.266 3.266 0 0 1-.067 3.801c-.896 1.195-2.357 1.643-3.834 1.079-.381-.15-.58-.1-.846.182a163.619 163.619 0 0 1-3.403 3.386c-.299.3-.415.532-.232.98a3.198 3.198 0 0 1-1.278 3.917A3.298 3.298 0 0 1 9.646 23c-1.062-1.062-1.228-2.688-.415-4.033a3.196 3.196 0 0 1 3.835-1.294c.498.182.78.083 1.145-.283 1.012-1.045 2.058-2.058 3.087-3.103.266-.266.68-.449.432-1.03-.233-.547-.631-.414-1.03-.431zM11.97 4.942c.913.016 1.643-.714 1.66-1.627v-.05a1.646 1.646 0 0 0-1.76-1.56 1.63 1.63 0 0 0-1.543 1.527 1.638 1.638 0 0 0 1.577 1.71zm.033 5.41a1.658 1.658 0 0 0-1.676 1.61v.084a1.73 1.73 0 0 0 1.643 1.66c.847.016 1.643-.78 1.677-1.627a1.648 1.648 0 0 0-1.577-1.71c-.017-.016-.05-.016-.067-.016zm7.088 1.694c.016.896.747 1.61 1.626 1.643a1.723 1.723 0 0 0 1.66-1.726 1.666 1.666 0 0 0-1.66-1.61 1.623 1.623 0 0 0-1.643 1.577c.017.05.017.083.017.116zM3.24 10.353a1.692 1.692 0 0 0-1.66 1.626c-.017.847.863 1.727 1.693 1.71a1.687 1.687 0 0 0 1.626-1.743 1.615 1.615 0 0 0-1.643-1.593Zm8.68 12c.98.033 1.71-.647 1.727-1.593a1.646 1.646 0 0 0-1.51-1.793 1.646 1.646 0 0 0-1.793 1.51v.233a1.609 1.609 0 0 0 1.543 1.66c0-.017.017-.017.033-.017z"})})}function MI({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100","aria-hidden":"true",children:[m.jsx("rect",{width:"100",height:"100",rx:"8",fill:"#9a2036"}),m.jsx("path",{d:"M15.375 16.782v63.843a4 4 0 0 0 4 4h63.843c3.564 0 5.348-4.309 2.829-6.828L22.203 13.953c-2.52-2.52-6.828-.735-6.828 2.829",fill:"#fff"})]})}function qv({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function m8({kind:e,size:t=16}){switch(e){case"modal_job":return m.jsx(AI,{size:t});case"hf_job":return m.jsx(kI,{size:t});case"k8s_job":return m.jsx(TI,{size:t});case"ssh_job":return m.jsx(hm,{size:t});case"slurm_job":return m.jsx(Fk,{size:t});case"ray_job":return m.jsx(NI,{size:t});case"openresearch_job":return m.jsx(MI,{size:t});case"local_job":return m.jsx(yA,{size:t});default:return m.jsx(hm,{size:t})}}function g8({backend:e}){const t=Qh(e),n=Fx(e);return t?m.jsxs("span",{className:"backend-badge",children:[m.jsx(m8,{kind:t}),m.jsx("span",{className:"backend-name",children:EI(t)}),n&&m.jsx("span",{className:"backend-detail mono",children:n})]}):m.jsx("span",{className:"backend-badge muted",children:"—"})}function v8({value:e,max:t,label:n,caption:r,fillColor:s}){const a=t>0?Math.min(100,Math.round(e/t*100)):0;return m.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,children:[m.jsx("div",{className:"progress-track",children:m.jsx("div",{className:"progress-fill",style:{width:`${a}%`,background:s}})}),(n!==void 0||r!==void 0)&&m.jsxs("div",{className:"progress-caption",children:[m.jsx("span",{children:n??`${a}%`}),r]})]})}const u_={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function DI(e){return u_[e]??u_.idle}function RI(e){return e.charAt(0).toUpperCase()+e.slice(1)}function tl({status:e,label:t}){const n=DI(e);return m.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[m.jsx("span",{className:"dot"}),t??RI(e)]})}function Up(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function jI({h:e}){return e.authMethod?m.jsx(m.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):m.jsx(m.Fragment,{children:"—"})}function LI(){const[e,t]=P.useState(null),[n,r]=P.useState("claude-code"),[s,a]=P.useState(!1),c=u=>{a(!0),Og(u).then(t).catch(()=>{}).finally(()=>a(!1))};P.useEffect(()=>c(!1),[]);const l=e==null?void 0:e.find(u=>u.id===n);return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Harnesses"}),m.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),m.jsx("div",{className:"harness-tabs",children:(e??[]).map(u=>m.jsxs("button",{className:u.id===n?"active":"",onClick:()=>r(u.id),children:[u.name,m.jsx("span",{className:`harness-dot ${Up(u).cls}`})]},u.id))}),e?l?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("span",{className:`badge ${Up(l).cls}`,children:Up(l).label}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>c(!0),disabled:s,children:[m.jsx(wh,{size:12,className:s?"spin":""})," Refresh"]})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Binary"}),m.jsx("span",{className:"v",children:l.binPath??"not found on PATH"}),m.jsx("span",{className:"k",children:"Version"}),m.jsx("span",{className:"v",children:l.version??"—"}),m.jsx("span",{className:"k",children:"Auth"}),m.jsx("span",{className:"v",children:m.jsx(jI,{h:l})}),l.account&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:l.id==="opencode"?"Providers":"Account"}),m.jsx("span",{className:"v",children:l.account})]}),l.org&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Org"}),m.jsx("span",{className:"v",children:l.org})]}),l.plan&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Plan"}),m.jsx("span",{className:"v",children:l.plan})]}),m.jsx("span",{className:"k",children:"Agent models"}),m.jsx("span",{className:"v",children:l.models.length>0?`${l.models.length} available — ${l.models.slice(0,4).map(u=>Ch(u)).join(", ")}${l.models.length>4?", …":""}`:"none"})]}),!l.agentReady&&l.agentNote&&m.jsx("p",{className:"settings-note",children:l.agentNote})]}):null:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function OI({s:e}){if(!e.configured)return m.jsx("span",{className:"badge",children:"Not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?m.jsx("span",{className:"badge ok",children:"Connected"}):m.jsx("span",{className:"badge err",children:"No job-create permission"}):m.jsx("span",{className:"badge err",children:"Cluster unreachable"}):m.jsx("span",{className:"badge err",children:"kubectl not found"})}function BI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(""),[u,h]=P.useState(!1),[p,f]=P.useState(null),g=w=>{t(w),a(w.context??""),l(w.namespace)};P.useEffect(()=>{lT().then(g).catch(w=>r(w instanceof Error?w.message:String(w)))},[]);const y=e!==null&&s===(e.context??"")&&c.trim()===e.namespace;async function C(w){if(w.preventDefault(),!u){h(!0),f(null);try{g(await cT({context:s,namespace:c.trim()}))}catch(_){f(_ instanceof Error?_.message:String(_))}finally{h(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",m.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Cluster"}),m.jsx("span",{className:"v",children:m.jsx(OI,{s:e})})]}),e.preflight.error&&m.jsx("p",{className:"settings-note",children:e.preflight.error}),m.jsxs("form",{className:"form settings-form",onSubmit:C,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Context",m.jsxs("select",{value:s,onChange:w=>a(w.target.value),children:[m.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(w=>m.jsx("option",{value:w,children:w},w))]})]}),m.jsxs("label",{children:["Namespace",m.jsx("input",{className:"mono",type:"text",value:c,onChange:w=>l(w.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),p&&m.jsx("div",{className:"error",children:p}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:u||y,children:u?"Saving…":"Save"})})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("div",{className:"settings-card-head",children:m.jsx("h3",{children:"Run manifest"})}),m.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",m.jsx("code",{children:".orx/k8s.yaml"}),", or ",m.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",m.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",m.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",m.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",m.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const zI={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function II({s:e}){return e.ready?m.jsx("span",{className:"badge ok",children:"Connected"}):!e.tokenConfigured&&!e.modalImportable?m.jsx("span",{className:"badge",children:"Not set up"}):e.modalImportable?e.tokenConfigured?m.jsx("span",{className:"badge",children:"Unknown"}):m.jsx("span",{className:"badge err",children:"No token"}):m.jsx("span",{className:"badge err",children:e.envProvisioned?"Env broken":"Env not built"})}function HI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(!1),[c,l]=P.useState(null);P.useEffect(()=>{uT().then(t).catch(h=>r(h instanceof Error?h.message:String(h)))},[]);async function u(){if(!s){a(!0),l(null);try{t(await hT())}catch(h){l(h instanceof Error?h.message:String(h))}finally{a(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",m.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(II,{s:e})}),m.jsx("span",{className:"k",children:"Environment"}),m.jsx("span",{className:"v",children:e.modalImportable?"Ready":e.envProvisioned?"Provisioned (modal import failing)":"Not built yet"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.tokenSource?zI[e.tokenSource]:"Not configured"})]}),!e.tokenConfigured&&m.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",m.jsx("code",{children:"modal token new"}),", or add"," ",m.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",m.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&m.jsx("p",{className:"settings-note",children:e.error}),c&&m.jsx("div",{className:"error",children:c}),!e.modalImportable&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn primary",onClick:()=>void u(),disabled:s,children:s?"Setting up… (~30–60s)":"Set up environment"})})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function FI({test:e}){if(e===void 0)return m.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return m.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?m.jsx("span",{className:"badge ok",children:"Ready"}):m.jsx("span",{className:"badge err",children:"No git"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"Unreachable"});return m.jsxs(m.Fragment,{children:[t,m.jsx("span",{className:"ssh-tested-at",children:Ua(e.testedAt)})]})}function PI(){const[e,t]=P.useState(null),[n,r]=P.useState({});P.useEffect(()=>{vT().then(t).catch(()=>t([]))},[]);async function s(a){r(c=>({...c,[a]:"testing"}));try{const c=await yT(a);r(l=>({...l,[a]:c}))}catch(c){r(l=>({...l,[a]:{reachable:!1,gitFound:!1,error:c instanceof Error?c.message:String(c),testedAt:Date.now()}}))}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",m.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",m.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",m.jsx("code",{children:"git"})," and ",m.jsx("code",{children:"bash"}),"."]}),e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?m.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):m.jsxs("table",{className:"flavor-table ssh-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Host"}),m.jsx("th",{children:"Address"}),m.jsx("th",{children:"Identity"}),m.jsx("th",{children:"Status"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:e.map(a=>m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:a.host}),m.jsxs("td",{className:"mono muted",children:[[a.user,a.hostname??"—"].filter(Boolean).join("@"),a.port?`:${a.port}`:""]}),m.jsx("td",{className:"mono muted",children:a.identityFile??"—"}),m.jsx("td",{children:m.jsx(FI,{test:n[a.host]??a.lastTest})}),m.jsx("td",{children:m.jsx("button",{className:"btn sm",onClick:()=>void s(a.host),disabled:n[a.host]==="testing",children:"Test"})})]},a.host))})]})]})}function $I({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?m.jsx("span",{className:"badge ok",children:"Ready"}):m.jsx("span",{className:"badge err",children:"No git"}):m.jsx("span",{className:"badge err",children:"No Slurm CLI"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"Unreachable"})}function UI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(""),[u,h]=P.useState(""),[p,f]=P.useState(""),[g,y]=P.useState(!1),[C,w]=P.useState(null),[_,b]=P.useState(null),x=_!==null&&_!=="testing"?_:null,S=D=>{t(D),a(D.host??""),l(D.partition??""),h(D.account??""),f(D.timeLimit??"")};P.useEffect(()=>{bT().then(S).catch(D=>r(D instanceof Error?D.message:String(D)))},[]);const E=e!==null&&s===(e.host??"")&&c.trim()===(e.partition??"")&&u.trim()===(e.account??"")&&p.trim()===(e.timeLimit??"");async function T(D){if(D.preventDefault(),!g){y(!0),w(null);try{S(await _T({host:s,partition:c.trim(),account:u.trim(),timeLimit:p.trim()}))}catch(M){w(M instanceof Error?M.message:String(M))}finally{y(!1)}}}async function A(D){b("testing");try{b(await xT(D))}catch(M){b({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:M instanceof Error?M.message:String(M)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",m.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[(x==null?void 0:x.error)&&m.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&m.jsxs("p",{className:"settings-note",children:["Partitions: ",m.jsx("code",{children:x.partitions.join(", ")})]}),m.jsxs("form",{className:"form settings-form",onSubmit:T,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Login node",m.jsxs("select",{value:s,onChange:D=>{a(D.target.value),b(null)},children:[m.jsx("option",{value:"",children:"not set (pass --host per launch)"}),s&&!e.hosts.some(D=>D.host===s)&&m.jsxs("option",{value:s,children:[s," (not in ~/.ssh/config)"]}),e.hosts.map(D=>m.jsx("option",{value:D.host,children:D.host},D.host))]})]}),m.jsxs("label",{children:["Partition",m.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:c,onChange:D=>l(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(D=>m.jsx("option",{value:D},D))})]})]}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Account",m.jsx("input",{className:"mono",type:"text",value:u,onChange:D=>h(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),m.jsxs("label",{children:["Time limit",m.jsx("input",{className:"mono",type:"text",value:p,onChange:D=>f(D.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),C&&m.jsx("div",{className:"error",children:C}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:g||E,children:g?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void A(s),disabled:!s||_==="testing",title:s?void 0:"Pick a login node first",children:"Test connection"}),m.jsx($I,{test:_})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}function qI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null),[p,f]=P.useState(null),g=p!==null&&p!=="testing"?p:null,y=b=>{t(b),a(b.address??"")};P.useEffect(()=>{ST().then(y).catch(b=>r(b instanceof Error?b.message:String(b)))},[]);const C=e!==null&&s===(e.address??"");async function w(b){if(b.preventDefault(),!c){l(!0),h(null);try{y(await wT({address:s}))}catch(x){h(x instanceof Error?x.message:String(x))}finally{l(!1)}}}async function _(){f("testing");try{f(await CT(s.trim()||void 0))}catch(b){f({reachable:!1,address:s.trim()||"(unknown)",rayVersion:null,error:b instanceof Error?b.message:String(b)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on a Ray cluster with ",m.jsx("code",{children:"--backend ray [--flavor gpu:1]"}),". orx submits via the Ray Jobs API (Dashboard URL). Address resolution: this setting, then ",m.jsx("code",{children:"ASTROAI_RAY_JOBS_ADDRESS"})," /"," ",m.jsx("code",{children:"RAY_DASHBOARD_URL"}),", then ",m.jsx("code",{children:"http://127.0.0.1:8265"}),". Optional flavor maps to entrypoint CPUs/GPUs/memory (e.g."," ",m.jsx("code",{children:"cpu:2"}),", ",m.jsx("code",{children:"gpu:1,mem:8GiB"}),")."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["Effective: ",m.jsx("code",{children:e.resolvedAddress})," (",e.source,")"]}),(g==null?void 0:g.error)&&m.jsx("p",{className:"settings-note",children:g.error}),(g==null?void 0:g.reachable)&&g.rayVersion&&m.jsxs("p",{className:"settings-note",children:["Ray version: ",m.jsx("code",{children:g.rayVersion})]}),m.jsxs("form",{className:"form settings-form",onSubmit:w,children:[m.jsxs("label",{children:["Jobs / Dashboard URL",m.jsx("input",{className:"mono",type:"text",value:s,onChange:b=>{a(b.target.value),f(null)},placeholder:"http://127.0.0.1:8265",autoComplete:"off",spellCheck:!1})]}),u&&m.jsx("div",{className:"error",children:u}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:c||C,children:c?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void _(),disabled:p==="testing",children:"Test connection"}),m.jsx(GI,{test:p})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading Ray settings…"]})]})}function GI({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"badge",children:"Testing…"}):e.reachable?m.jsx("span",{className:"badge ok",children:"Reachable"}):m.jsx("span",{className:"badge warn",children:"Unreachable"})}function VI(){const[e,t]=P.useState(null),[n,r]=P.useState(null);return P.useEffect(()=>{kT().then(t).catch(s=>r(s instanceof Error?s.message:String(s)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments as detached, supervised processes on the machine running orx with"," ",m.jsx("code",{children:"--backend local"})," — handy when you're already on a GPU box and using this dashboard over port forwarding. Runs share CPU/RAM/GPU with the dashboard itself, so prefer a remote backend for anything heavy."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Hostname"}),m.jsx("span",{className:"v mono",children:e.hostname}),m.jsx("span",{className:"k",children:"System"}),m.jsxs("span",{className:"v",children:[e.os,"/",e.arch,e.chip?` — ${e.chip}`:""]}),m.jsx("span",{className:"k",children:"CPU"}),m.jsx("span",{className:"v",children:e.cpuCount>0?`${e.cpuCount} cores`:"—"}),m.jsx("span",{className:"k",children:"RAM"}),m.jsx("span",{className:"v",children:e.memBytes!==null?Ma(e.memBytes):"—"}),m.jsx("span",{className:"k",children:"GPUs"}),m.jsx("span",{className:"v",children:e.gpus.length===0?"none detected (nvidia-smi)":e.gpus.map(s=>`${s.name}${s.memMib!==null?` — ${Ma(s.memMib*1024*1024)}`:""}`).join(", ")})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting hardware…"]})]})}function WI(){const[e,t]=P.useState(null),[n,r]=P.useState(null);return P.useEffect(()=>{AT().then(t).catch(s=>r(s instanceof Error?s.message:String(s)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on an ephemeral OpenResearch box billed to your org with"," ",m.jsx("code",{children:"--backend openresearch --flavor "})," (h100_sxm, cpu5c, …; browse with ",m.jsx("code",{children:"orx compute"}),"). The box is provisioned for the run and deleted when it ends. Needs ",m.jsx("code",{children:"orx login"})," and a registered SSH key."]}),n?m.jsx("div",{className:"error",children:n}):e?e.loggedIn?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx("span",{className:"badge ok",children:"Signed in"})}),m.jsx("span",{className:"k",children:"Orgs"}),m.jsx("span",{className:"v",children:e.orgs.length>0?e.orgs.join(", "):"—"}),m.jsx("span",{className:"k",children:"SSH key"}),m.jsx("span",{className:"v",children:e.sshKeyStatus==="matched"?m.jsx("span",{className:"badge ok",children:"On this computer"}):e.sshKeyStatus==="no_local_match"?m.jsx("span",{className:"badge warn",children:"Not on this computer"}):e.sshKeyStatus==="none_registered"?m.jsx("span",{className:"badge err",children:"None registered"}):m.jsx("span",{className:"badge",children:"Unknown"})})]}),e.sshKeyStatus==="none_registered"&&(e.sshKeyPath?m.jsxs("p",{className:"settings-note",children:["Add one with ",m.jsxs("code",{children:["orx ssh-key add ",e.sshKeyPath]}),"."]}):m.jsxs("p",{className:"settings-note",children:["No key on this computer yet — create one with"," ",m.jsx("code",{children:"ssh-keygen -t ed25519"}),", then add it with"," ",m.jsx("code",{children:"orx ssh-key add"}),"."]})),e.sshKeyStatus==="no_local_match"&&(e.sshKeyPath?m.jsxs("p",{className:"settings-note",children:["Register this computer with ",m.jsxs("code",{children:["orx ssh-key add ",e.sshKeyPath]}),", or load a registered key with ",m.jsx("code",{children:"ssh-add"}),"."]}):m.jsxs("p",{className:"settings-note",children:["No key on this computer to register — load a registered key with"," ",m.jsx("code",{children:"ssh-add"}),", or create one with"," ",m.jsx("code",{children:"ssh-keygen -t ed25519"}),"."]})),e.error&&m.jsx("p",{className:"settings-note",children:e.error})]}):m.jsxs("p",{className:"settings-note",children:["Not signed in. Run ",m.jsx("code",{children:"orx login"})," in a terminal to connect your OpenResearch account."]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking credentials…"]})]})}const h_={local:"This machine",hf:"HF Jobs",modal:"Modal",k8s:"Kubernetes",ssh:"SSH",slurm:"Slurm",ray:"Ray",openresearch:"OpenResearch"},YI={local:"local_job",hf:"hf_job",modal:"modal_job",k8s:"k8s_job",ssh:"ssh_job",slurm:"slurm_job",ray:"ray_job",openresearch:"openresearch_job"},XI=["hf","modal","slurm","ray","openresearch"],d_=["hf","modal","openresearch"],f_={hf:["cpu-basic","t4-small","a10g-small","a10g-large","a100-large","h100","h200"],modal:["cpu","t4","l4","a10g","a100","a100-80gb","l40s","h100","h100:2"],slurm:["gpu","h100:1","h100:2","a100:4"],ray:["cpu","cpu:2","gpu","gpu:1","gpu:1,cpu:4","gpu:1,mem:8GiB"],openresearch:["h100_sxm","h100_sxm:2","cpu5c","cpu5g","cpu5m"]};function KI({t:e,isDefault:t}){return e.id==="local"?m.jsx("span",{className:"badge ok",children:"Ready"}):e.unverified?m.jsx("span",{className:"badge",children:"Unknown"}):!e.configured&&t?m.jsx("span",{className:"badge warn",children:"Not configured"}):e.configured?m.jsx("span",{className:"badge ok",children:"Configured"}):m.jsx("span",{className:"badge",children:"Not set up"})}function ZI({target:e,flavor:t,onSaved:n}){var f;const[r,s]=P.useState(t??""),[a,c]=P.useState(!1),[l,u]=P.useState(null);P.useEffect(()=>s(t??""),[t]);async function h(g){if(g.preventDefault(),!a){c(!0),u(null);try{n(await Ox({backend:e,flavor:r.trim()||null}))}catch(y){u(y instanceof Error?y.message:String(y))}finally{c(!1)}}}const p=r.trim()===(t??"");return m.jsxs("form",{className:"form settings-form compute-flavor-form",onSubmit:h,children:[m.jsxs("label",{children:["Default flavor",m.jsx("input",{className:"mono",type:"text",list:`flavors-${e}`,value:r,onChange:g=>s(g.target.value),placeholder:d_.includes(e)?`e.g. ${((f=f_[e])==null?void 0:f[1])??""}`:"none (CPU-only)",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:`flavors-${e}`,children:(f_[e]??[]).map(g=>m.jsx("option",{value:g},g))})]}),l&&m.jsx("div",{className:"error",children:l}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn sm",disabled:a||p,children:a?"Saving…":"Save flavor"}),d_.includes(e)&&!t&&m.jsxs("span",{className:"muted compute-flavor-hint",children:["This backend requires a flavor — without a default one, each launch must pass"," ",m.jsx("code",{children:"--flavor"}),"."]})]})]})}function QI({target:e,isDefault:t,defaultFlavor:n,open:r,onToggle:s,onSettings:a,onError:c}){const[l,u]=P.useState(!1),[h,p]=P.useState(!1);r&&!l&&u(!0);async function f(g){if(!h){p(!0);try{a(await Ox({backend:g}))}catch(y){c(y instanceof Error?y.message:String(y))}finally{p(!1)}}}return m.jsxs("div",{className:`compute-row${r?" open":""}`,children:[m.jsxs("div",{className:"compute-row-head",onClick:s,children:[m.jsx("span",{className:"compute-row-logo",children:m.jsx(m8,{kind:YI[e.id],size:18})}),m.jsx("span",{className:"compute-row-name",children:h_[e.id]}),m.jsx("span",{className:"compute-row-summary",children:e.summary}),m.jsx(KI,{t:e,isDefault:t}),t?m.jsx("span",{className:"badge compute-default-pill",children:"Default"}):m.jsx("button",{type:"button",className:"btn sm compute-make-default",onClick:g=>{g.stopPropagation(),f(e.id)},disabled:h,children:"Make default"}),m.jsx("button",{type:"button",className:"compute-chevron-btn","aria-expanded":r,"aria-label":`${r?"Collapse":"Expand"} ${h_[e.id]}`,onClick:g=>{g.stopPropagation(),s()},children:m.jsx(Pa,{size:16,className:"compute-chevron"})})]}),l&&m.jsxs("div",{className:"compute-row-body",hidden:!r,children:[t&&m.jsxs("p",{className:"settings-note compute-default-note",children:["The agent launches runs here unless you tell it otherwise, and so does"," ",m.jsx("code",{children:"orx exp run"})," with no ",m.jsx("code",{children:"--backend"})," flag."," ",m.jsx("button",{type:"button",className:"btn sm",onClick:()=>void f(null),disabled:h,children:"Clear default"})]}),t&&!e.configured&&m.jsx("p",{className:"settings-note",children:"This target is the default but isn't configured — launches will fail until it's set up below."}),t&&XI.includes(e.id)&&m.jsx(ZI,{target:e.id,flavor:n,onSaved:a}),e.id==="local"&&m.jsx(VI,{}),e.id==="hf"&&m.jsx(rH,{}),e.id==="modal"&&m.jsx(HI,{}),e.id==="k8s"&&m.jsx(BI,{}),e.id==="ssh"&&m.jsx(PI,{}),e.id==="slurm"&&m.jsx(UI,{}),e.id==="ray"&&m.jsx(qI,{}),e.id==="openresearch"&&m.jsx(WI,{})]})]})}function JI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(null),[c,l]=P.useState(null),u=P.useRef(0);P.useEffect(()=>{const f=++u.current;ET().then(g=>{f===u.current&&(t(g),r(null))}).catch(g=>{if(f!==u.current)return;const y=g instanceof Error?g.message:String(g);t(C=>(C===null?r(y):l(y),C))})},[s]);const h=f=>{u.current++,t(f),l(null)},p=e?e.targets:null;return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Compute"}),m.jsxs("p",{className:"settings-sub",children:["Where ",m.jsx("code",{children:"orx exp run"})," executes. Pick a default target; the agent uses it when a launch doesn't name a backend (",m.jsx("code",{children:"--backend "})," always wins)."]}),n?m.jsx("div",{className:"error",children:n}):p?m.jsxs(m.Fragment,{children:[c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"compute-list",children:p.map(f=>m.jsx(QI,{target:f,isDefault:(e==null?void 0:e.defaultBackend)===f.id,defaultFlavor:(e==null?void 0:e.defaultFlavor)??null,open:s===f.id,onToggle:()=>a(g=>g===f.id?null:f.id),onSettings:h,onError:l},f.id))}),m.jsxs("p",{className:"compute-footnote",children:[m.jsx(gA,{size:14,"aria-hidden":"true"}),m.jsx("span",{children:"The default target and flavor are included in the research agent's instructions — it launches runs there unless you name another backend. No other compute settings are shared with it."})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking compute targets…"]})]})}const eH={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function tH({settings:e}){return e.configured?e.valid?m.jsx("span",{className:"badge ok",children:"Connected"}):m.jsx("span",{className:"badge err",children:"Invalid token"}):m.jsx("span",{className:"badge",children:"Not configured"})}function nH({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?m.jsx("span",{className:"badge ok",children:"Jobs: write OK"}):e.jobsWrite===!1?m.jsx("span",{className:"badge err",children:"No job.write permission"}):m.jsx("span",{className:"badge",children:"Jobs permission unknown"})}function rH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null),p=P.useRef(!1);P.useEffect(()=>{aT().then(g=>{p.current||t(g)}).catch(g=>{p.current||r(g instanceof Error?g.message:String(g))})},[]);async function f(g){if(g.preventDefault(),!(!s.trim()||c)){l(!0),h(null);try{const y=await oT(s.trim());p.current=!0,t(y),r(null),a("")}catch(y){h(y instanceof Error?y.message:String(y))}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",m.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(tH,{settings:e})}),m.jsx("span",{className:"k",children:"Account"}),m.jsx("span",{className:"v",children:e.username??"—"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.maskedToken??"—"}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:e.source?eH[e.source]:"Not configured"}),m.jsx("span",{className:"k",children:"Jobs"}),m.jsxs("span",{className:"v",children:[m.jsx(nH,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&m.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&m.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",m.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",m.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading status…"]}),m.jsxs("form",{className:"form settings-form",onSubmit:f,children:[m.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",m.jsx("input",{type:"password",value:s,onChange:g=>a(g.target.value),placeholder:"hf_…",autoComplete:"off"})]}),u&&m.jsx("div",{className:"error",children:u}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:!s.trim()||c,children:c?"Validating…":"Save"})})]})]})}const y8=/^hf_[A-Za-z0-9]{10,}$/;function b8(){return m.jsx("tr",{children:m.jsx("td",{colSpan:3,children:m.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",m.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const p_=["HF_TOKEN","WANDB_API_KEY"];function iH({name:e,entry:t,onVars:n,onError:r}){const[s,a]=P.useState(""),[c,l]=P.useState(!1),u=f=>r(`${e}: ${f instanceof Error?f.message:String(f)}`);async function h(){if(!(!s.trim()||c)){l(!0);try{n(await Lx(e,s.trim())),a("")}catch(f){u(f)}finally{l(!1)}}}async function p(){if(!c){l(!0);try{n(await fT(e))}catch(f){u(f)}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:e}),m.jsx("td",{className:"mono muted",children:t?m.jsxs(m.Fragment,{children:[t.maskedValue,t.inProcessEnv&&m.jsx("span",{className:"badge",children:"Overridden by env"})]}):m.jsx("input",{className:"mono",type:"password",value:s,onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),h()),f.key==="Escape"&&!c&&a("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:c})}),m.jsx("td",{children:t?m.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void p(),disabled:c,children:m.jsx(Rg,{size:13})}):s.trim()&&m.jsx("button",{className:"btn sm",onClick:()=>void h(),disabled:c,children:c?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&y8.test(s.trim())&&m.jsx(b8,{})]})}function sH({onVars:e,onError:t,onDone:n}){const[r,s]=P.useState(""),[a,c]=P.useState(""),[l,u]=P.useState(!1);async function h(){if(!(!r.trim()||!a.trim()||l)){u(!0);try{e(await Lx(r.trim(),a.trim())),n()}catch(f){t(`${r.trim()}: ${f instanceof Error?f.message:String(f)}`)}finally{u(!1)}}}const p=f=>{f.key==="Enter"&&(f.preventDefault(),h()),f.key==="Escape"&&!l&&n()};return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{children:m.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:f=>s(f.target.value),onKeyDown:p,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:l})}),m.jsx("td",{children:m.jsx("input",{className:"mono",type:"password",value:a,onChange:f=>c(f.target.value),onKeyDown:p,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:l})}),m.jsxs("td",{children:[m.jsx("button",{className:"btn sm",onClick:()=>void h(),disabled:l||!r.trim()||!a.trim(),children:l?"Saving…":"Save"}),m.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:l,children:m.jsx(Ko,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&y8.test(a.trim())&&m.jsx(b8,{})]})}function aH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(!1),[c,l]=P.useState(null);P.useEffect(()=>{dT().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);const u=f=>{t(f),l(null)},h=e===null?[]:e.map(f=>f.key).filter(f=>!p_.includes(f)),p=[...p_,...h];return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Environment variables"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>a(!0),disabled:s||e===null,children:[m.jsx(Dg,{size:12})," Add variable"]})]}),m.jsxs("p",{className:"settings-sub",children:["Stored in ",m.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",m.jsx("code",{children:"HF_TOKEN"})," and ",m.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?m.jsx("div",{className:"error",children:n}):e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsx("table",{className:"env-table",children:m.jsxs("tbody",{children:[p.map(f=>m.jsx(iH,{name:f,entry:e.find(g=>g.key===f),onVars:u,onError:l},f)),s&&m.jsx(sH,{onVars:u,onError:l,onDone:()=>a(!1)})]})}),c&&m.jsx("div",{className:"error",children:c})]})}function oH(){const[e,t]=P.useState(null),[n,r]=P.useState(""),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null);P.useEffect(()=>{zx().then(g=>{t(g),r(g.userName??""),a(g.userEmail??"")}).catch(()=>{})},[]);const p=e!==null&&n.trim()===(e.userName??"")&&s.trim()===(e.userEmail??"");async function f(g){if(g.preventDefault(),!(c||p)){l(!0),h(null);try{const y=await MT({userName:n.trim(),userEmail:s.trim()});t(y),r(y.userName??""),a(y.userEmail??"")}catch(y){h(y instanceof Error?y.message:String(y))}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Git"}),m.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("form",{className:"form",onSubmit:f,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["user.name",m.jsx("input",{type:"text",value:n,onChange:g=>r(g.target.value),autoComplete:"off"})]}),m.jsxs("label",{children:["user.email",m.jsx("input",{type:"text",value:s,onChange:g=>a(g.target.value),autoComplete:"off"})]})]}),u&&m.jsx("div",{className:"error",children:u}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:c||p||!n.trim()&&!s.trim(),children:c?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"GitHub access"}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"git"}),m.jsx("span",{className:"v",children:e.gitVersion??"not found"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",m.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),m.jsx(p8,{onSaved:t})]}),e.githubTokenSource==="stored"&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn",onClick:()=>{RT().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const lH={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function cH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null),[p,f]=P.useState({kind:"idle"}),[g,y]=P.useState(null),C=()=>pT().then(E=>{t(E),a(T=>T||E.current)}).catch(E=>r(E instanceof Error?E.message:String(E)));P.useEffect(()=>{C()},[]),P.useEffect(()=>WT(E=>{E.type==="progress"?f(T=>{const A=T.kind==="moving"?T.total:0;return{kind:"moving",phase:E.phase,copied:E.copiedBytes,total:E.totalBytes||A}}):E.type==="done"?(f({kind:"done",oldPathLeft:E.oldPathLeft}),h(null),a(""),C()):E.type==="error"&&f({kind:"error",message:E.error})}),[]);const w=(e==null?void 0:e.source)==="env",_=s.trim(),b=e!==null&&_===e.current;async function x(){if(!(c||!_)){l(!0),y(null),h(null);try{h(await mT(_))}catch(E){y(E instanceof Error?E.message:String(E))}finally{l(!1)}}}async function S(E){if(E.preventDefault(),!(p.kind==="moving"||!_||b)&&(y(null),!!window.confirm(`Move all orx data to: -${_} +|(?![\\s\\S])))+`,"m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(r)[0]}}}}),Object.defineProperty(t.languages.diff,"PREFIXES",{value:n})})(e)}_v.displayName="go";_v.aliases=[];function _v(e){e.register(Di),e.languages.go=e.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),e.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete e.languages.go["class-name"]}xv.displayName="ini";xv.aliases=[];function xv(e){e.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}}Sv.displayName="java";Sv.aliases=[];function Sv(e){e.register(Di),(function(t){var n=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,r=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,s={pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[s,{pattern:RegExp(/(^|[^\w.])/.source+r+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:s.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+r+/[A-Z]\w*\b/.source),lookbehind:!0,inside:s.inside}],keyword:n,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":s,keyword:n,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+r+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:s.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+r+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:s.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(//g,function(){return n.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(e)}wv.displayName="regex";wv.aliases=[];function wv(e){(function(t){var n={pattern:/\\[\\(){}[\]^$+*?|.]/,alias:"escape"},r=/\\(?:x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]+\}|0[0-7]{0,2}|[123][0-7]{2}|c[a-zA-Z]|.)/,s={pattern:/\.|\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},a={pattern:/\\[wsd]|\\p\{[^{}]+\}/i,alias:"class-name"},c="(?:[^\\\\-]|"+r.source+")",l=RegExp(c+"-"+c),u={pattern:/(<|')[^<>']+(?=[>']$)/,lookbehind:!0,alias:"variable"};t.languages.regex={"char-class":{pattern:/((?:^|[^\\])(?:\\\\)*)\[(?:[^\\\]]|\\[\s\S])*\]/,lookbehind:!0,inside:{"char-class-negation":{pattern:/(^\[)\^/,lookbehind:!0,alias:"operator"},"char-class-punctuation":{pattern:/^\[|\]$/,alias:"punctuation"},range:{pattern:l,inside:{escape:r,"range-punctuation":{pattern:/-/,alias:"operator"}}},"special-escape":n,"char-set":a,escape:r}},"special-escape":n,"char-set":s,backreference:[{pattern:/\\(?![123][0-7]{2})[1-9]/,alias:"keyword"},{pattern:/\\k<[^<>']+>/,alias:"keyword",inside:{"group-name":u}}],anchor:{pattern:/[$^]|\\[ABbGZz]/,alias:"function"},escape:r,group:[{pattern:/\((?:\?(?:<[^<>']+>|'[^<>']+'|[>:]||&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),e.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,e.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:e.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:e.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:e.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:e.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:e.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),e.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:e.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),e.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),e.languages.markup&&(e.languages.markup.tag.addInlined("script","javascript"),e.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),e.languages.js=e.languages.javascript}Cv.displayName="json";Cv.aliases=["webmanifest"];function Cv(e){e.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},e.languages.webmanifest=e.languages.json}Ev.displayName="kotlin";Ev.aliases=["kt","kts"];function Ev(e){e.register(Di),(function(t){t.languages.kotlin=t.languages.extend("clike",{keyword:{pattern:/(^|[^.])\b(?:abstract|actual|annotation|as|break|by|catch|class|companion|const|constructor|continue|crossinline|data|do|dynamic|else|enum|expect|external|final|finally|for|fun|get|if|import|in|infix|init|inline|inner|interface|internal|is|lateinit|noinline|null|object|open|operator|out|override|package|private|protected|public|reified|return|sealed|set|super|suspend|tailrec|this|throw|to|try|typealias|val|var|vararg|when|where|while)\b/,lookbehind:!0},function:[{pattern:/(?:`[^\r\n`]+`|\b\w+)(?=\s*\()/,greedy:!0},{pattern:/(\.)(?:`[^\r\n`]+`|\w+)(?=\s*\{)/,lookbehind:!0,greedy:!0}],number:/\b(?:0[xX][\da-fA-F]+(?:_[\da-fA-F]+)*|0[bB][01]+(?:_[01]+)*|\d+(?:_\d+)*(?:\.\d+(?:_\d+)*)?(?:[eE][+-]?\d+(?:_\d+)*)?[fFL]?)\b/,operator:/\+[+=]?|-[-=>]?|==?=?|!(?:!|==?)?|[\/*%<>]=?|[?:]:?|\.\.|&&|\|\||\b(?:and|inv|or|shl|shr|ushr|xor)\b/}),delete t.languages.kotlin["class-name"];var n={"interpolation-punctuation":{pattern:/^\$\{?|\}$/,alias:"punctuation"},expression:{pattern:/[\s\S]+/,inside:t.languages.kotlin}};t.languages.insertBefore("kotlin","string",{"string-literal":[{pattern:/"""(?:[^$]|\$(?:(?!\{)|\{[^{}]*\}))*?"""/,alias:"multiline",inside:{interpolation:{pattern:/\$(?:[a-z_]\w*|\{[^{}]*\})/i,inside:n},string:/[\s\S]+/}},{pattern:/"(?:[^"\\\r\n$]|\\.|\$(?:(?!\{)|\{[^{}]*\}))*"/,alias:"singleline",inside:{interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$(?:[a-z_]\w*|\{[^{}]*\})/i,lookbehind:!0,inside:n},string:/[\s\S]+/}}],char:{pattern:/'(?:[^'\\\r\n]|\\(?:.|u[a-fA-F0-9]{0,4}))'/,greedy:!0}}),delete t.languages.kotlin.string,t.languages.insertBefore("kotlin","keyword",{annotation:{pattern:/\B@(?:\w+:)?(?:[A-Z]\w*|\[[^\]]+\])/,alias:"builtin"}}),t.languages.insertBefore("kotlin","function",{label:{pattern:/\b\w+@|@\w+\b/,alias:"symbol"}}),t.languages.kt=t.languages.kotlin,t.languages.kts=t.languages.kotlin})(e)}kv.displayName="less";kv.aliases=[];function kv(e){e.register(gl),e.languages.less=e.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),e.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}})}Av.displayName="lua";Av.aliases=[];function Av(e){e.languages.lua={comment:/^#!.+|--(?:\[(=*)\[[\s\S]*?\]\1\]|.*)/m,string:{pattern:/(["'])(?:(?!\1)[^\\\r\n]|\\z(?:\r\n|\s)|\\(?:\r\n|[^z]))*\1|\[(=*)\[[\s\S]*?\]\2\]/,greedy:!0},number:/\b0x[a-f\d]+(?:\.[a-f\d]*)?(?:p[+-]?\d+)?\b|\b\d+(?:\.\B|(?:\.\d*)?(?:e[+-]?\d+)?\b)|\B\.\d+(?:e[+-]?\d+)?\b/i,keyword:/\b(?:and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,function:/(?!\d)\w+(?=\s*(?:[({]))/,operator:[/[-+*%^&|#]|\/\/?|<[<=]?|>[>=]?|[=~]=?/,{pattern:/(^|[^.])\.\.(?!\.)/,lookbehind:!0}],punctuation:/[\[\](){},;]|\.+|:+/}}Tv.displayName="makefile";Tv.aliases=[];function Tv(e){e.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/}}Nv.displayName="yaml";Nv.aliases=["yml"];function Nv(e){(function(t){var n=/[*&][^\s[\]{},]+/,r=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,s="(?:"+r.source+"(?:[ ]+"+n.source+")?|"+n.source+"(?:[ ]+"+r.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),c=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function l(u,h){h=(h||"").replace(/m/g,"")+"m";var p=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return u});return RegExp(p,h)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,function(){return s})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,function(){return s}).replace(/<>/g,function(){return"(?:"+a+"|"+c+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:l(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:l(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:l(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:l(c),lookbehind:!0,greedy:!0},number:{pattern:l(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:r,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(e)}Mv.displayName="markdown";Mv.aliases=["md"];function Mv(e){e.register(ou),(function(t){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function r(l){return l=l.replace(//g,function(){return n}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+l+")")}var s=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return s}),c=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+c+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+c+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(s),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+c+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(s),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:r(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:r(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:r(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:r(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(l){["url","bold","italic","strike","code-snippet"].forEach(function(u){l!==u&&(t.languages.markdown[l].inside.content.inside[u]=t.languages.markdown[u])})}),t.hooks.add("after-tokenize",function(l){if(l.language!=="markdown"&&l.language!=="md")return;function u(h){if(!(!h||typeof h=="string"))for(var p=0,f=h.length;p]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete e.languages.objectivec["class-name"],e.languages.objc=e.languages.objectivec}Rv.displayName="perl";Rv.aliases=[];function Rv(e){(function(t){var n=/(?:\((?:[^()\\]|\\[\s\S])*\)|\{(?:[^{}\\]|\\[\s\S])*\}|\[(?:[^[\]\\]|\\[\s\S])*\]|<(?:[^<>\\]|\\[\s\S])*>)/.source;t.languages.perl={comment:[{pattern:/(^\s*)=\w[\s\S]*?=cut.*/m,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],string:[{pattern:RegExp(/\b(?:q|qq|qw|qx)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"),greedy:!0},{pattern:/("|`)(?:(?!\1)[^\\]|\\[\s\S])*\1/,greedy:!0},{pattern:/'(?:[^'\\\r\n]|\\.)*'/,greedy:!0}],regex:[{pattern:RegExp(/\b(?:m|qr)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/([a-zA-Z0-9])(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,n].join("|")+")"+/[msixpodualngc]*/.source),greedy:!0},{pattern:RegExp(/(^|[^-])\b(?:s|tr|y)(?![a-zA-Z0-9])\s*/.source+"(?:"+[/([^a-zA-Z0-9\s{(\[<])(?:(?!\2)[^\\]|\\[\s\S])*\2(?:(?!\2)[^\\]|\\[\s\S])*\2/.source,/([a-zA-Z0-9])(?:(?!\3)[^\\]|\\[\s\S])*\3(?:(?!\3)[^\\]|\\[\s\S])*\3/.source,n+/\s*/.source+n].join("|")+")"+/[msixpodualngcer]*/.source),lookbehind:!0,greedy:!0},{pattern:/\/(?:[^\/\\\r\n]|\\.)*\/[msixpodualngc]*(?=\s*(?:$|[\r\n,.;})&|\-+*~<>!?^]|(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|x|xor)\b))/,greedy:!0}],variable:[/[&*$@%]\{\^[A-Z]+\}/,/[&*$@%]\^[A-Z_]/,/[&*$@%]#?(?=\{)/,/[&*$@%]#?(?:(?:::)*'?(?!\d)[\w$]+(?![\w$]))+(?:::)*/,/[&*$@%]\d+/,/(?!%=)[$@%][!"#$%&'()*+,\-.\/:;<=>?@[\\\]^_`{|}~]/],filehandle:{pattern:/<(?![<=])\S*?>|\b_\b/,alias:"symbol"},"v-string":{pattern:/v\d+(?:\.\d+)*|\d+(?:\.\d+){2,}/,alias:"string"},function:{pattern:/(\bsub[ \t]+)\w+/,lookbehind:!0},keyword:/\b(?:any|break|continue|default|delete|die|do|else|elsif|eval|for|foreach|given|goto|if|last|local|my|next|our|package|print|redo|require|return|say|state|sub|switch|undef|unless|until|use|when|while)\b/,number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)\b/,operator:/-[rwxoRWXOezsfdlpSbctugkTBMAC]\b|\+[+=]?|-[-=>]?|\*\*?=?|\/\/?=?|=[=~>]?|~[~=]?|\|\|?=?|&&?=?|<(?:=>?|<=?)?|>>?=?|![~=]?|[%^]=?|\.(?:=|\.\.?)?|[\\?]|\bx(?:=|\b)|\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\b/,punctuation:/[{}[\];(),:]/}})(e)}_d.displayName="markup-templating";_d.aliases=[];function _d(e){e.register(ou),(function(t){function n(r,s){return"___"+r.toUpperCase()+s+"___"}Object.defineProperties(t.languages["markup-templating"]={},{buildPlaceholders:{value:function(r,s,a,c){if(r.language===s){var l=r.tokenStack=[];r.code=r.code.replace(a,function(u){if(typeof c=="function"&&!c(u))return u;for(var h=l.length,p;r.code.indexOf(p=n(s,h))!==-1;)++h;return l[h]=u,p}),r.grammar=t.languages.markup}}},tokenizePlaceholders:{value:function(r,s){if(r.language!==s||!r.tokenStack)return;r.grammar=t.languages[s];var a=0,c=Object.keys(r.tokenStack);function l(u){for(var h=0;h=c.length);h++){var p=u[h];if(typeof p=="string"||p.content&&typeof p.content=="string"){var f=c[a],g=r.tokenStack[f],y=typeof p=="string"?p:p.content,C=n(s,f),w=y.indexOf(C);if(w>-1){++a;var b=y.substring(0,w),_=new t.Token(s,t.tokenize(g,r.grammar),"language-"+s,g),x=y.substring(w+C.length),S=[];b&&S.push.apply(S,l([b])),S.push(_),x&&S.push.apply(S,l([x])),typeof p=="string"?u.splice.apply(u,[h,1].concat(S)):p.content=S}}else p.content&&l(p.content)}return u}l(r.tokens)}}})})(e)}jv.displayName="php";jv.aliases=[];function jv(e){e.register(_d),(function(t){var n=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,r=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],s=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,a=/|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,c=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:n,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:s,operator:a,punctuation:c};var l={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},u=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:l}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:l}}];t.languages.insertBefore("php","variable",{string:u,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:n,string:u,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:r,number:s,operator:a,punctuation:c}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(h){if(/<\?/.test(h.code)){var p=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(h,"php",p)}}),t.hooks.add("after-tokenize",function(h){t.languages["markup-templating"].tokenizePlaceholders(h,"php")})})(e)}Lv.displayName="python";Lv.aliases=["py"];function Lv(e){e.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},e.languages.python["string-interpolation"].inside.interpolation.inside.rest=e.languages.python,e.languages.py=e.languages.python}Ov.displayName="r";Ov.aliases=[];function Ov(e){e.languages.r={comment:/#.*/,string:{pattern:/(['"])(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},"percent-operator":{pattern:/%[^%\s]*%/,alias:"operator"},boolean:/\b(?:FALSE|TRUE)\b/,ellipsis:/\.\.(?:\.|\d+)/,number:[/\b(?:Inf|NaN)\b/,/(?:\b0x[\dA-Fa-f]+(?:\.\d*)?|\b\d+(?:\.\d*)?|\B\.\d+)(?:[EePp][+-]?\d+)?[iL]?/],keyword:/\b(?:NA|NA_character_|NA_complex_|NA_integer_|NA_real_|NULL|break|else|for|function|if|in|next|repeat|while)\b/,operator:/->?>?|<(?:=|=!]=?|::?|&&?|\|\|?|[+*\/^$@~]/,punctuation:/[(){}\[\],;]/}}Bv.displayName="ruby";Bv.aliases=["rb"];function Bv(e){e.register(Di),(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===||[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var n={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var r="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",s=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+r+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:n,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+s),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+s+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+r),greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:n,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+r),greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:n,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(e)}zv.displayName="rust";zv.aliases=[];function zv(e){(function(t){for(var n=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|)*\*\//.source,r=0;r<2;r++)n=n.replace(//g,function(){return n});n=n.replace(//g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+n),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(e)}Iv.displayName="sass";Iv.aliases=[];function Iv(e){e.register(gl),(function(t){t.languages.sass=t.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),t.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete t.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,r=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];t.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:r}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:r,important:t.languages.sass.important}}}),delete t.languages.sass.property,delete t.languages.sass.important,t.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})})(e)}Hv.displayName="scss";Hv.aliases=[];function Hv(e){e.register(gl),e.languages.scss=e.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),e.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),e.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),e.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),e.languages.scss.atrule.inside.rest=e.languages.scss}Fv.displayName="sql";Fv.aliases=[];function Fv(e){e.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/}}Pv.displayName="swift";Pv.aliases=[];function Pv(e){e.languages.swift={comment:{pattern:/(^|[^\\:])(?:\/\/.*|\/\*(?:[^/*]|\/(?!\*)|\*(?!\/)|\/\*(?:[^*]|\*(?!\/))*\*\/)*\*\/)/,lookbehind:!0,greedy:!0},"string-literal":[{pattern:RegExp(/(^|[^"#])/.source+"(?:"+/"(?:\\(?:\((?:[^()]|\([^()]*\))*\)|\r\n|[^(])|[^\\\r\n"])*"/.source+"|"+/"""(?:\\(?:\((?:[^()]|\([^()]*\))*\)|[^(])|[^\\"]|"(?!""))*"""/.source+")"+/(?!["#])/.source),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\\($/,alias:"punctuation"},punctuation:/\\(?=[\r\n])/,string:/[\s\S]+/}},{pattern:RegExp(/(^|[^"#])(#+)/.source+"(?:"+/"(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|\r\n|[^#])|[^\\\r\n])*?"/.source+"|"+/"""(?:\\(?:#+\((?:[^()]|\([^()]*\))*\)|[^#])|[^\\])*?"""/.source+")\\2"),lookbehind:!0,greedy:!0,inside:{interpolation:{pattern:/(\\#+\()(?:[^()]|\([^()]*\))*(?=\))/,lookbehind:!0,inside:null},"interpolation-punctuation":{pattern:/^\)|\\#+\($/,alias:"punctuation"},string:/[\s\S]+/}}],directive:{pattern:RegExp(/#/.source+"(?:"+(/(?:elseif|if)\b/.source+"(?:[ ]*"+/(?:![ \t]*)?(?:\b\w+\b(?:[ \t]*\((?:[^()]|\([^()]*\))*\))?|\((?:[^()]|\([^()]*\))*\))(?:[ \t]*(?:&&|\|\|))?/.source+")+")+"|"+/(?:else|endif)\b/.source+")"),alias:"property",inside:{"directive-name":/^#\w+/,boolean:/\b(?:false|true)\b/,number:/\b\d+(?:\.\d+)*\b/,operator:/!|&&|\|\||[<>]=?/,punctuation:/[(),]/}},literal:{pattern:/#(?:colorLiteral|column|dsohandle|file(?:ID|Literal|Path)?|function|imageLiteral|line)\b/,alias:"constant"},"other-directive":{pattern:/#\w+\b/,alias:"property"},attribute:{pattern:/@\w+/,alias:"atrule"},"function-definition":{pattern:/(\bfunc\s+)\w+/,lookbehind:!0,alias:"function"},label:{pattern:/\b(break|continue)\s+\w+|\b[a-zA-Z_]\w*(?=\s*:\s*(?:for|repeat|while)\b)/,lookbehind:!0,alias:"important"},keyword:/\b(?:Any|Protocol|Self|Type|actor|as|assignment|associatedtype|associativity|async|await|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|higherThan|if|import|in|indirect|infix|init|inout|internal|is|isolated|lazy|left|let|lowerThan|mutating|none|nonisolated|nonmutating|open|operator|optional|override|postfix|precedencegroup|prefix|private|protocol|public|repeat|required|rethrows|return|right|safe|self|set|some|static|struct|subscript|super|switch|throw|throws|try|typealias|unowned|unsafe|var|weak|where|while|willSet)\b/,boolean:/\b(?:false|true)\b/,nil:{pattern:/\bnil\b/,alias:"constant"},"short-argument":/\$\d+\b/,omit:{pattern:/\b_\b/,alias:"keyword"},number:/\b(?:[\d_]+(?:\.[\de_]+)?|0x[a-f0-9_]+(?:\.[a-f0-9p_]+)?|0b[01_]+|0o[0-7_]+)\b/i,"class-name":/\b[A-Z](?:[A-Z_\d]*[a-z]\w*)?\b/,function:/\b[a-z_]\w*(?=\s*\()/i,constant:/\b(?:[A-Z_]{2,}|k[A-Z][A-Za-z_]+)\b/,operator:/[-+*/%=!<>&|^~?]+|\.[.\-+*/%=!<>&|^~?]+/,punctuation:/[{}[\]();,.:\\]/},e.languages.swift["string-literal"].forEach(function(t){t.inside.interpolation.inside=e.languages.swift})}$v.displayName="typescript";$v.aliases=["ts"];function $v(e){e.register(bd),(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var n=t.languages.extend("typescript",{});delete n["class-name"],t.languages.typescript["class-name"].inside=n,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),t.languages.ts=t.languages.typescript})(e)}xd.displayName="basic";xd.aliases=[];function xd(e){e.languages.basic={comment:{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},string:{pattern:/"(?:""|[!#$%&'()*,\/:;<=>?^\w +\-.])*"/,greedy:!0},number:/(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:E[+-]?\d+)?/i,keyword:/\b(?:AS|BEEP|BLOAD|BSAVE|CALL(?: ABSOLUTE)?|CASE|CHAIN|CHDIR|CLEAR|CLOSE|CLS|COM|COMMON|CONST|DATA|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DIM|DO|DOUBLE|ELSE|ELSEIF|END|ENVIRON|ERASE|ERROR|EXIT|FIELD|FILES|FOR|FUNCTION|GET|GOSUB|GOTO|IF|INPUT|INTEGER|IOCTL|KEY|KILL|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|MKDIR|NAME|NEXT|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPTION BASE|OUT|POKE|PUT|READ|REDIM|REM|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SELECT CASE|SHARED|SHELL|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|SUB|SWAP|SYSTEM|THEN|TIMER|TO|TROFF|TRON|TYPE|UNLOCK|UNTIL|USING|VIEW PRINT|WAIT|WEND|WHILE|WRITE)(?:\$|\b)/i,function:/\b(?:ABS|ACCESS|ACOS|ANGLE|AREA|ARITHMETIC|ARRAY|ASIN|ASK|AT|ATN|BASE|BEGIN|BREAK|CAUSE|CEIL|CHR|CLIP|COLLATE|COLOR|CON|COS|COSH|COT|CSC|DATE|DATUM|DEBUG|DECIMAL|DEF|DEG|DEGREES|DELETE|DET|DEVICE|DISPLAY|DOT|ELAPSED|EPS|ERASABLE|EXLINE|EXP|EXTERNAL|EXTYPE|FILETYPE|FIXED|FP|GO|GRAPH|HANDLER|IDN|IMAGE|IN|INT|INTERNAL|IP|IS|KEYED|LBOUND|LCASE|LEFT|LEN|LENGTH|LET|LINE|LINES|LOG|LOG10|LOG2|LTRIM|MARGIN|MAT|MAX|MAXNUM|MID|MIN|MISSING|MOD|NATIVE|NUL|NUMERIC|OF|OPTION|ORD|ORGANIZATION|OUTIN|OUTPUT|PI|POINT|POINTER|POINTS|POS|PRINT|PROGRAM|PROMPT|RAD|RADIANS|RANDOMIZE|RECORD|RECSIZE|RECTYPE|RELATIVE|REMAINDER|REPEAT|REST|RETRY|REWRITE|RIGHT|RND|ROUND|RTRIM|SAME|SEC|SELECT|SEQUENTIAL|SET|SETTER|SGN|SIN|SINH|SIZE|SKIP|SQR|STANDARD|STATUS|STR|STREAM|STYLE|TAB|TAN|TANH|TEMPLATE|TEXT|THERE|TIME|TIMEOUT|TRACE|TRANSFORM|TRUNCATE|UBOUND|UCASE|USE|VAL|VARIABLE|VIEWPORT|WHEN|WINDOW|WITH|ZER|ZONEWIDTH)(?:\$|\b)/i,operator:/<[=>]?|>=?|[+\-*\/^=&]|\b(?:AND|EQV|IMP|NOT|OR|XOR)\b/i,punctuation:/[,;:()]/}}Uv.displayName="vbnet";Uv.aliases=[];function Uv(e){e.register(xd),e.languages.vbnet=e.languages.extend("basic",{comment:[{pattern:/(?:!|REM\b).+/i,inside:{keyword:/^REM/i}},{pattern:/(^|[^\\:])'.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(^|[^"])"(?:""|[^"])*"(?!")/,lookbehind:!0,greedy:!0},keyword:/(?:\b(?:ADDHANDLER|ADDRESSOF|ALIAS|AND|ANDALSO|AS|BEEP|BLOAD|BOOLEAN|BSAVE|BYREF|BYTE|BYVAL|CALL(?: ABSOLUTE)?|CASE|CATCH|CBOOL|CBYTE|CCHAR|CDATE|CDBL|CDEC|CHAIN|CHAR|CHDIR|CINT|CLASS|CLEAR|CLNG|CLOSE|CLS|COBJ|COM|COMMON|CONST|CONTINUE|CSBYTE|CSHORT|CSNG|CSTR|CTYPE|CUINT|CULNG|CUSHORT|DATA|DATE|DECIMAL|DECLARE|DEF(?: FN| SEG|DBL|INT|LNG|SNG|STR)|DEFAULT|DELEGATE|DIM|DIRECTCAST|DO|DOUBLE|ELSE|ELSEIF|END|ENUM|ENVIRON|ERASE|ERROR|EVENT|EXIT|FALSE|FIELD|FILES|FINALLY|FOR(?: EACH)?|FRIEND|FUNCTION|GET|GETTYPE|GETXMLNAMESPACE|GLOBAL|GOSUB|GOTO|HANDLES|IF|IMPLEMENTS|IMPORTS|IN|INHERITS|INPUT|INTEGER|INTERFACE|IOCTL|IS|ISNOT|KEY|KILL|LET|LIB|LIKE|LINE INPUT|LOCATE|LOCK|LONG|LOOP|LSET|ME|MKDIR|MOD|MODULE|MUSTINHERIT|MUSTOVERRIDE|MYBASE|MYCLASS|NAME|NAMESPACE|NARROWING|NEW|NEXT|NOT|NOTHING|NOTINHERITABLE|NOTOVERRIDABLE|OBJECT|OF|OFF|ON(?: COM| ERROR| KEY| TIMER)?|OPEN|OPERATOR|OPTION(?: BASE)?|OPTIONAL|OR|ORELSE|OUT|OVERLOADS|OVERRIDABLE|OVERRIDES|PARAMARRAY|PARTIAL|POKE|PRIVATE|PROPERTY|PROTECTED|PUBLIC|PUT|RAISEEVENT|READ|READONLY|REDIM|REM|REMOVEHANDLER|RESTORE|RESUME|RETURN|RMDIR|RSET|RUN|SBYTE|SELECT(?: CASE)?|SET|SHADOWS|SHARED|SHELL|SHORT|SINGLE|SLEEP|STATIC|STEP|STOP|STRING|STRUCTURE|SUB|SWAP|SYNCLOCK|SYSTEM|THEN|THROW|TIMER|TO|TROFF|TRON|TRUE|TRY|TRYCAST|TYPE|TYPEOF|UINTEGER|ULONG|UNLOCK|UNTIL|USHORT|USING|VIEW PRINT|WAIT|WEND|WHEN|WHILE|WIDENING|WITH|WITHEVENTS|WRITE|WRITEONLY|XOR)|\B(?:#CONST|#ELSE|#ELSEIF|#END|#IF))(?:\$|\b)/i,punctuation:/[,;:(){}]/})}const Qz=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],a_={0:"�",128:"€",130:"‚",131:"ƒ",132:"„",133:"…",134:"†",135:"‡",136:"ˆ",137:"‰",138:"Š",139:"‹",140:"Œ",142:"Ž",145:"‘",146:"’",147:"“",148:"”",149:"•",150:"–",151:"—",152:"˜",153:"™",154:"š",155:"›",156:"œ",158:"ž",159:"Ÿ"};function r8(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=48&&t<=57}function Jz(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=102||t>=65&&t<=70||t>=48&&t<=57}function eI(e){const t=typeof e=="string"?e.charCodeAt(0):e;return t>=97&&t<=122||t>=65&&t<=90}function o_(e){return eI(e)||r8(e)}const tI=["","Named character references must be terminated by a semicolon","Numeric character references must be terminated by a semicolon","Named character references cannot be empty","Numeric character references cannot be empty","Named character references must be known","Numeric character references cannot be disallowed","Numeric character references cannot be outside the permissible Unicode range"];function nI(e,t){const n={},r=typeof n.additional=="string"?n.additional.charCodeAt(0):n.additional,s=[];let a=0,c=-1,l="",u,h;n.position&&("start"in n.position||"indent"in n.position?(h=n.position.indent,u=n.position.start):u=n.position);let p=(u?u.line:0)||1,f=(u?u.column:0)||1,g=C(),y;for(a--;++a<=e.length;)if(y===10&&(f=(h?h[c]:0)||1),y=e.charCodeAt(a),y===38){const _=e.charCodeAt(a+1);if(_===9||_===10||_===12||_===32||_===38||_===60||Number.isNaN(_)||r&&_===r){l+=String.fromCharCode(y),f++;continue}const x=a+1;let S=x,E=x,T;if(_===35){E=++S;const U=e.charCodeAt(E);U===88||U===120?(T="hexadecimal",E=++S):T="decimal"}else T="named";let A="",D="",M="";const R=T==="named"?o_:T==="decimal"?r8:Jz;for(E--;++E<=e.length;){const U=e.charCodeAt(E);if(!R(U))break;M+=String.fromCharCode(U),T==="named"&&Qz.includes(M)&&(A=M,D=jc(M))}let z=e.charCodeAt(E)===59;if(z){E++;const U=T==="named"?jc(M):!1;U&&(A=M,D=U)}let H=1+E-x,$="";if(!(!z&&n.nonTerminated===!1))if(!M)T!=="named"&&w(4,H);else if(T==="named"){if(z&&!D)w(5,1);else if(A!==M&&(E=S+A.length,H=1+E-S,z=!1),!z){const U=A?1:3;if(n.attribute){const q=e.charCodeAt(E);q===61?(w(U,H),D=""):o_(q)?D="":w(U,H)}else w(U,H)}$=D}else{z||w(2,H);let U=Number.parseInt(M,T==="hexadecimal"?16:10);if(rI(U))w(7,H),$="�";else if(U in a_)w(6,H),$=a_[U];else{let q="";iI(U)&&w(6,H),U>65535&&(U-=65536,q+=String.fromCharCode(U>>>10|55296),U=56320|U&1023),$=q+String.fromCharCode(U)}}if($){b(),g=C(),a=E-1,f+=E-x+1,s.push($);const U=C();U.offset++,n.reference&&n.reference.call(n.referenceContext||void 0,$,{start:g,end:U},e.slice(x-1,E)),g=U}else M=e.slice(x-1,E),l+=M,f+=M.length,a=E-1}else y===10&&(p++,c++,f=0),Number.isNaN(y)?b():(l+=String.fromCharCode(y),f++);return s.join("");function C(){return{line:p,column:f,offset:a+((u?u.offset:0)||0)}}function w(_,x){let S;n.warning&&(S=C(),S.column+=x,S.offset+=x,n.warning.call(n.warningContext||void 0,tI[_],S,_))}function b(){l&&(s.push(l),n.text&&n.text.call(n.textContext||void 0,l,{start:g,end:C()}),l="")}}function rI(e){return e>=55296&&e<=57343||e>1114111}function iI(e){return e>=1&&e<=8||e===11||e>=13&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534}var sI=0,F0={},Hn={util:{type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++sI}),e.__id},clone:function e(t,n){n=n||{};var r,s;switch(Hn.util.type(t)){case"Object":if(s=Hn.util.objId(t),n[s])return n[s];r={},n[s]=r;for(var a in t)t.hasOwnProperty(a)&&(r[a]=e(t[a],n));return r;case"Array":return s=Hn.util.objId(t),n[s]?n[s]:(r=[],n[s]=r,t.forEach(function(c,l){r[l]=e(c,n)}),r);default:return t}}},languages:{plain:F0,plaintext:F0,text:F0,txt:F0,extend:function(e,t){var n=Hn.util.clone(Hn.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r=r||Hn.languages;var s=r[e],a={};for(var c in s)if(s.hasOwnProperty(c)){if(c==t)for(var l in n)n.hasOwnProperty(l)&&(a[l]=n[l]);n.hasOwnProperty(c)||(a[c]=s[c])}var u=r[e];return r[e]=a,Hn.languages.DFS(Hn.languages,function(h,p){p===u&&h!=e&&(this[h]=a)}),a},DFS:function e(t,n,r,s){s=s||{};var a=Hn.util.objId;for(var c in t)if(t.hasOwnProperty(c)){n.call(t,c,t[c],r||c);var l=t[c],u=Hn.util.type(l);u==="Object"&&!s[a(l)]?(s[a(l)]=!0,e(l,n,null,s)):u==="Array"&&!s[a(l)]&&(s[a(l)]=!0,e(l,n,c,s))}}},plugins:{},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(Hn.hooks.run("before-tokenize",r),!r.grammar)throw new Error('The language "'+r.language+'" has no grammar.');return r.tokens=Hn.tokenize(r.code,r.grammar),Hn.hooks.run("after-tokenize",r),Ac.stringify(Hn.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var s=new aI;return fh(s,s.head,e),i8(e,s,t,s.head,0),lI(s)},hooks:{all:{},add:function(e,t){var n=Hn.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=Hn.hooks.all[e];if(!(!n||!n.length))for(var r=0,s;s=n[r++];)s(t)}},Token:Ac};function Ac(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||"").length|0}function l_(e,t,n,r){e.lastIndex=t;var s=e.exec(n);if(s&&r&&s[1]){var a=s[1].length;s.index+=a,s[0]=s[0].slice(a)}return s}function i8(e,t,n,r,s,a){for(var c in n)if(!(!n.hasOwnProperty(c)||!n[c])){var l=n[c];l=Array.isArray(l)?l:[l];for(var u=0;u=a.reach);_+=b.value.length,b=b.next){var x=b.value;if(t.length>e.length)return;if(!(x instanceof Ac)){var S=1,E;if(g){if(E=l_(w,_,e,f),!E||E.index>=e.length)break;var M=E.index,T=E.index+E[0].length,A=_;for(A+=b.value.length;M>=A;)b=b.next,A+=b.value.length;if(A-=b.value.length,_=A,b.value instanceof Ac)continue;for(var D=b;D!==t.tail&&(Aa.reach&&(a.reach=$);var U=b.prev;z&&(U=fh(t,U,z),_+=z.length),oI(t,U,S);var q=new Ac(c,p?Hn.tokenize(R,p):R,y,R);if(b=fh(t,U,q),H&&fh(t,b,H),S>1){var K={cause:c+","+u,reach:$};i8(e,t,n,b.prev,_,K),a&&K.reach>a.reach&&(a.reach=K.reach)}}}}}}function aI(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function fh(e,t,n){var r=t.next,s={value:n,prev:t,next:r};return t.next=s,r.prev=s,e.length++,s}function oI(e,t,n){for(var r=t.next,s=0;sn)return e;try{return Xe.highlight(e,t).children.map(o8)}catch{return e}}const gI=1e5;function vI({code:e,lang:t}){const[n,r]=P.useState(!1),s=()=>{var a;(a=navigator.clipboard)==null||a.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)})};return m.jsxs("div",{className:"md-code",children:[m.jsx("button",{className:"md-code-copy",title:"Copy","aria-label":"Copy code",onClick:s,children:n?m.jsx(Zr,{size:13}):m.jsx(Ng,{size:13})}),m.jsx("pre",{children:m.jsx("code",{children:l8(e,t,gI)})})]})}function yI(e){const t={};for(const n of e.matchAll(/([\w-]+)=(["'])(.*?)\2/g)){const r=n[1];r&&(t[r.toLowerCase()]=n[3]??"")}return t}function bI(e){const t=/]*?)\/?>/gi,n=[];let r=0,s=!1;for(const a of e.matchAll(t)){const c=yI(a[1]??"");c.path&&(s=!0,a.index>r&&n.push({type:"text",value:e.slice(r,a.index)}),n.push({children:[],data:{hName:"file-mention",hProperties:c},type:"fileMention"}),r=a.index+a[0].length)}return s?(rc8(e)}function c_({path:e,lines:t,onOpenFile:n}){const r=e.split("/").pop()||e,s=t&&Number.parseInt(t,10)||void 0,a=s!=null?`${r}:${s}`:r;return m.jsxs("button",{className:"file-chip",title:`Open ${e}`,onClick:()=>n==null?void 0:n(e),disabled:!n,children:[m.jsx(wx,{size:12}),m.jsx("span",{className:"file-chip-label",children:a})]})}const xI=/(```[\s\S]*?(?:```|$)|~~~[\s\S]*?(?:~~~|$)|`[^`\n]*`)/g,u8={singleDollarTextMath:!1};function h8(e){return!e.includes("\\(")&&!e.includes("\\[")?e:e.split(xI).map((t,n)=>n%2===1?t:t.replace(/\\\[([\s\S]+?)\\\]/g,(r,s)=>`$$${s}$$`).replace(/\\\(([\s\S]+?)\\\)/g,(r,s)=>`$$${s}$$`)).join("")}function SI(e){return!(/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("#")||e.startsWith("//"))}const d8={code:({node:e,className:t,children:n,...r})=>{const s=t??"",a=/language-(\w+)/.exec(s),c=String(n??"").replace(/\n$/,"");if(!(a!=null||c.includes(` +`)))return m.jsx("code",{className:s,...r,children:n});const u=a?Ym(a[1]):null;return m.jsx(vI,{code:c,lang:u})},pre:({children:e})=>m.jsx(m.Fragment,{children:e})},zc=P.memo(function({text:t,onOpenFile:n}){const r={"file-mention":s=>m.jsx(c_,{path:s.path,lines:s.lines,onOpenFile:n}),a:({node:s,href:a,children:c,...l})=>a&&SI(a)&&n?m.jsx(c_,{path:decodeURI(a),onOpenFile:n}):m.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",...l,children:c}),...d8};return m.jsx("div",{className:"md",children:m.jsx(w7,{remarkPlugins:[e8,[t8,u8],_I],rehypePlugins:[NS],components:r,children:h8(t)})})});function wI({synthesized:e,agentLabel:t,onView:n,onApprove:r,onReject:s,onRevise:a}){const[c,l]=P.useState(!1),u=P.useRef(null),[h,p]=P.useState(!1),[f,g]=P.useState(""),y=P.useRef(null);P.useEffect(()=>{if(!c)return;const w=b=>{u.current&&!u.current.contains(b.target)&&l(!1)};return window.addEventListener("pointerdown",w),()=>window.removeEventListener("pointerdown",w)},[c]),P.useEffect(()=>{var w;h&&((w=y.current)==null||w.focus())},[h]);const C=()=>{a(f.trim()||"no specific feedback — use your judgment"),g(""),p(!1)};return m.jsxs("div",{className:"plan-strip",children:[m.jsxs("div",{className:"plan-strip-info",children:[m.jsx(Ax,{size:14,className:"plan-strip-icon"}),m.jsx("span",{className:"plan-strip-title",children:e?`${t} is ready to proceed`:`${t} proposed a plan`}),m.jsx("button",{className:"plan-strip-open",onClick:n,children:"Open plan"})]}),h?m.jsxs(m.Fragment,{children:[m.jsx("textarea",{ref:y,className:"plan-strip-revise-input",placeholder:"What should change? (optional)",rows:2,value:f,onChange:w=>g(w.target.value),onKeyDown:w=>{w.key==="Escape"?(w.preventDefault(),g(""),p(!1)):w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),C())}}),m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:()=>{g(""),p(!1)},children:"Back"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("button",{className:"btn-primary plan-strip-primary",onClick:C,children:["Revise",m.jsx(_x,{size:13})]})]})]}):m.jsxs("div",{className:"prompt-actions plan-strip-actions",children:[m.jsx("button",{className:"btn-ghost",onClick:s,children:"Reject"}),m.jsx("button",{className:"btn-ghost",onClick:()=>p(!0),children:"Revise…"}),m.jsx("span",{className:"plan-strip-spacer"}),m.jsxs("div",{className:"plan-strip-approve",ref:u,children:[m.jsx("button",{className:"btn-primary plan-strip-primary",onClick:()=>r("auto"),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-primary plan-strip-primary plan-strip-caret","aria-label":"More approval options",onClick:()=>l(w=>!w),children:m.jsx(Pa,{size:13})}),c&&m.jsx("div",{className:"plan-strip-menu",children:m.jsx("button",{onClick:()=>{l(!1),r("bypass")},children:"Accept and bypass all"})})]})]})]})}function f8({onSaved:e}){const[t,n]=P.useState(""),[r,s]=P.useState(!1),[a,c]=P.useState(null);async function l(u){if(u.preventDefault(),!(r||!t.trim())){s(!0),c(null);try{e(await MT(t.trim())),n("")}catch(h){c(h instanceof Error?h.message:String(h))}finally{s(!1)}}}return m.jsxs("form",{className:"onb-token-form",onSubmit:l,children:[m.jsx("input",{type:"password",value:t,onChange:u=>n(u.target.value),placeholder:"ghp_… personal access token",autoComplete:"off"}),m.jsx("button",{type:"submit",className:"btn",disabled:r||!t.trim(),children:r?"Checking…":"Save"}),m.jsx("a",{href:"https://github.com/settings/tokens/new?scopes=repo,workflow&description=orx",target:"_blank",rel:"noreferrer",children:"Create a token ↗"}),a&&m.jsx("div",{className:"error",children:a})]})}function CI(e){switch(e){case"modal_job":return"Modal";case"hf_job":return"Hugging Face";case"k8s_job":return"Kubernetes";case"ssh_job":return"SSH";case"slurm_job":return"Slurm";case"ray_job":return"Ray";case"openresearch_job":return"OpenResearch";case"local_job":return"This machine";default:return e||"—"}}function EI({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 24 24","aria-hidden":"true",children:[m.jsx("path",{d:"M2.25 11.535c0-3.407 1.847-6.554 4.844-8.258a9.822 9.822 0 019.687 0c2.997 1.704 4.844 4.851 4.844 8.258 0 5.266-4.337 9.535-9.687 9.535S2.25 16.8 2.25 11.535z",fill:"#FF9D0B"}),m.jsx("path",{d:"M11.938 20.086c4.797 0 8.687-3.829 8.687-8.551 0-4.722-3.89-8.55-8.687-8.55-4.798 0-8.688 3.828-8.688 8.55 0 4.722 3.89 8.55 8.688 8.55z",fill:"#FFD21E"}),m.jsx("path",{d:"M11.875 15.113c2.457 0 3.25-2.156 3.25-3.263 0-.576-.393-.394-1.023-.089-.582.283-1.365.675-2.224.675-1.798 0-3.25-1.693-3.25-.586 0 1.107.79 3.263 3.25 3.263h-.003z",fill:"#FF323D"}),m.jsx("path",{d:"M14.76 9.21c.32.108.445.753.767.585.447-.233.707-.708.659-1.204a1.235 1.235 0 00-.879-1.059 1.262 1.262 0 00-1.33.394c-.322.384-.377.92-.14 1.36.153.283.638-.177.925-.079l-.002.003zm-5.887 0c-.32.108-.448.753-.768.585a1.226 1.226 0 01-.658-1.204c.048-.495.395-.913.878-1.059a1.262 1.262 0 011.33.394c.322.384.377.92.14 1.36-.152.283-.64-.177-.925-.079l.003.003z",fill:"#3A3B45"}),m.jsx("path",{d:"M17.812 10.366a.806.806 0 00.813-.8c0-.441-.364-.8-.813-.8a.806.806 0 00-.812.8c0 .442.364.8.812.8zm-11.624 0a.806.806 0 00.812-.8c0-.441-.364-.8-.812-.8a.806.806 0 00-.813.8c0 .442.364.8.813.8z",fill:"#3A3B45"}),m.jsx("path",{d:"M4.515 13.073c-.405 0-.765.162-1.017.46a1.455 1.455 0 00-.333.925 1.801 1.801 0 00-.485-.074c-.387 0-.737.146-.985.409a1.41 1.41 0 00-.2 1.722 1.302 1.302 0 00-.447.694c-.06.222-.12.69.2 1.166a1.267 1.267 0 00-.093 1.236c.238.533.81.958 1.89 1.405l.24.096c.768.3 1.473.492 1.478.494.89.243 1.808.375 2.732.394 1.465 0 2.513-.443 3.115-1.314.93-1.342.842-2.575-.274-3.763l-.151-.154c-.692-.684-1.155-1.69-1.25-1.912-.195-.655-.71-1.383-1.562-1.383-.46.007-.889.233-1.15.605-.25-.31-.495-.553-.715-.694a1.87 1.87 0 00-.993-.312zm14.97 0c.405 0 .767.162 1.017.46.216.262.333.588.333.925.158-.047.322-.071.487-.074.388 0 .738.146.985.409a1.41 1.41 0 01.2 1.722c.22.178.377.422.445.694.06.222.12.69-.2 1.166.244.37.279.836.093 1.236-.238.533-.81.958-1.889 1.405l-.239.096c-.77.3-1.475.492-1.48.494-.89.243-1.808.375-2.732.394-1.465 0-2.513-.443-3.115-1.314-.93-1.342-.842-2.575.274-3.763l.151-.154c.695-.684 1.157-1.69 1.252-1.912.195-.655.708-1.383 1.56-1.383.46.007.889.233 1.15.605.25-.31.495-.553.718-.694.244-.162.523-.265.814-.3l.176-.012z",fill:"#FF9D0B"}),m.jsx("path",{d:"M9.785 20.132c.688-.994.638-1.74-.305-2.667-.945-.928-1.495-2.288-1.495-2.288s-.205-.788-.672-.714c-.468.074-.81 1.25.17 1.971.977.721-.195 1.21-.573.534-.375-.677-1.405-2.416-1.94-2.751-.532-.332-.907-.148-.782.541.125.687 2.357 2.35 2.14 2.707-.218.362-.983-.42-.983-.42S2.953 14.9 2.43 15.46c-.52.558.398 1.026 1.7 1.803 1.308.778 1.41.985 1.225 1.28-.187.295-3.07-2.1-3.34-1.083-.27 1.011 2.943 1.304 2.745 2.006-.2.7-2.265-1.324-2.685-.537-.425.79 2.913 1.718 2.94 1.725 1.075.276 3.813.859 4.77-.522zm4.432 0c-.687-.994-.64-1.74.305-2.667.943-.928 1.493-2.288 1.493-2.288s.205-.788.675-.714c.465.074.807 1.25-.17 1.971-.98.721.195 1.21.57.534.377-.677 1.407-2.416 1.94-2.751.532-.332.91-.148.782.541-.125.687-2.355 2.35-2.137 2.707.215.362.98-.42.98-.42S21.05 14.9 21.57 15.46c.52.558-.395 1.026-1.7 1.803-1.308.778-1.408.985-1.225 1.28.187.295 3.07-2.1 3.34-1.083.27 1.011-2.94 1.304-2.743 2.006.2.7 2.263-1.324 2.685-.537.423.79-2.912 1.718-2.94 1.725-1.077.276-3.815.859-4.77-.522z",fill:"#FFD21E"})]})}function kI({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 300 300",fill:"none","aria-hidden":"true",children:[m.jsx("path",{d:"M121.683 75.25L149.997 124L91.4816 224.75C90.3128 226.757 88.155 228 85.8174 228H32.9664C31.7976 228 30.6778 227.691 29.697 227.131C28.7161 226.57 27.8906 225.758 27.3021 224.75L0.876625 179.25C-0.292208 177.243 -0.292208 174.765 0.876625 172.75L57.512 75.25C58.0923 74.2425 58.9259 73.43 59.9068 72.8694C60.8876 72.3088 62.0074 72 63.1762 72H116.027C118.365 72 120.523 73.2431 121.692 75.25H121.683ZM299.125 172.75L242.49 75.25C241.91 74.2425 241.076 73.43 240.095 72.8694C239.114 72.3088 237.995 72 236.826 72H183.975C181.637 72 179.479 73.2431 178.311 75.25L149.997 124L208.512 224.75C209.681 226.757 211.839 228 214.177 228H267.027C268.196 228 269.316 227.691 270.297 227.131C271.278 226.57 272.103 225.758 272.692 224.75L299.117 179.25C300.286 177.243 300.286 174.765 299.117 172.75H299.125Z",fill:"#62DE61"}),m.jsx("path",{d:"M89.6018 124H150.005L121.692 75.25C120.523 73.2431 118.365 72 116.027 72H63.1763C62.0074 72 60.8876 72.3088 59.9068 72.8694L89.6018 124Z",fill:"url(#orxModalA)"}),m.jsx("path",{d:"M89.6018 124L59.9068 72.8694C58.9259 73.43 58.1005 74.2425 57.512 75.25L0.876625 172.75C-0.292208 174.765 -0.292208 177.235 0.876625 179.25L27.3021 224.75C27.8825 225.758 28.7161 226.57 29.697 227.131L89.5936 124H89.6018Z",fill:"url(#orxModalB)"}),m.jsx("path",{d:"M149.997 124H89.5936L29.697 227.131C30.6778 227.691 31.7976 228 32.9664 228H85.8174C88.155 228 90.3128 226.757 91.4816 224.75L149.997 124Z",fill:"#09AF58"}),m.jsx("path",{d:"M299.125 179.25C299.706 178.243 300 177.121 300 176H240.61L210.915 227.131C211.896 227.691 213.016 228 214.185 228H267.036C269.373 228 271.531 226.757 272.7 224.75L299.125 179.25Z",fill:"#09AF58"}),m.jsx("path",{d:"M183.975 72C182.806 72 181.686 72.3088 180.705 72.8694L240.602 176H299.992C299.992 174.879 299.698 173.758 299.117 172.75L242.49 75.25C241.321 73.2431 239.163 72 236.826 72H183.967H183.975Z",fill:"url(#orxModalC)"}),m.jsx("path",{d:"M210.907 227.131L240.602 176L180.705 72.8694C179.725 73.43 178.899 74.2425 178.311 75.25L149.997 124L208.512 224.75C209.093 225.758 209.926 226.57 210.907 227.131Z",fill:"url(#orxModalD)"}),m.jsxs("defs",{children:[m.jsxs("linearGradient",{id:"orxModalA",x1:"127.348",y1:"137",x2:"82.9561",y2:"59.6398",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalB",x1:"7.04774",y1:"214.131",x2:"81.1284",y2:"85.0556",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]}),m.jsxs("linearGradient",{id:"orxModalC",x1:"278.103",y1:"188.561",x2:"204.022",y2:"59.4863",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#BFF9B4"}),m.jsx("stop",{offset:"1",stopColor:"#80EE64"})]}),m.jsxs("linearGradient",{id:"orxModalD",x1:"232.804",y1:"214.569",x2:"158.724",y2:"85.4864",gradientUnits:"userSpaceOnUse",children:[m.jsx("stop",{stopColor:"#80EE64"}),m.jsx("stop",{offset:"0.18",stopColor:"#7BEB63"}),m.jsx("stop",{offset:"0.36",stopColor:"#6FE562"}),m.jsx("stop",{offset:"0.55",stopColor:"#5ADA60"}),m.jsx("stop",{offset:"0.74",stopColor:"#3DCA5D"}),m.jsx("stop",{offset:"0.93",stopColor:"#18B759"}),m.jsx("stop",{offset:"1",stopColor:"#09AF58"})]})]})]})}function AI({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#326CE5","aria-hidden":"true",children:m.jsx("path",{d:"M10.204 14.35l.007.01-.999 2.413a5.171 5.171 0 0 1-2.075-2.597l2.578-.437.004.005a.44.44 0 0 1 .484.606zm-.833-2.129a.44.44 0 0 0 .173-.756l.002-.011L7.585 9.7a5.143 5.143 0 0 0-.73 3.255l2.514-.725.002-.009zm1.145-1.98a.44.44 0 0 0 .699-.337l.01-.005.15-2.62a5.144 5.144 0 0 0-3.01 1.442l2.147 1.523.004-.002zm.76 2.75l.723.349.722-.347.18-.78-.5-.623h-.804l-.5.623.179.779zm1.5-3.095a.44.44 0 0 0 .7.336l.008.003 2.134-1.513a5.188 5.188 0 0 0-2.992-1.442l.148 2.615.002.001zm10.876 5.97l-5.773 7.181a1.6 1.6 0 0 1-1.248.594l-9.261.003a1.6 1.6 0 0 1-1.247-.596l-5.776-7.18a1.583 1.583 0 0 1-.307-1.34L2.1 5.573c.108-.47.425-.864.863-1.073L11.305.513a1.606 1.606 0 0 1 1.385 0l8.345 3.985c.438.209.755.604.863 1.073l2.062 8.955c.108.47-.005.963-.308 1.34zm-3.289-2.057c-.042-.01-.103-.026-.145-.034-.174-.033-.315-.025-.479-.038-.35-.037-.638-.067-.895-.148-.105-.04-.18-.165-.216-.216l-.201-.059a6.45 6.45 0 0 0-.105-2.332 6.465 6.465 0 0 0-.936-2.163c.052-.047.15-.133.177-.159.008-.09.001-.183.094-.282.197-.185.444-.338.743-.522.142-.084.273-.137.415-.242.032-.024.076-.062.11-.089.24-.191.295-.52.123-.736-.172-.216-.506-.236-.745-.045-.034.027-.08.062-.111.088-.134.116-.217.23-.33.35-.246.25-.45.458-.673.609-.097.056-.239.037-.303.033l-.19.135a6.545 6.545 0 0 0-4.146-2.003l-.012-.223c-.065-.062-.143-.115-.163-.25-.022-.268.015-.557.057-.905.023-.163.061-.298.068-.475.001-.04-.001-.099-.001-.142 0-.306-.224-.555-.5-.555-.275 0-.499.249-.499.555l.001.014c0 .041-.002.092 0 .128.006.177.044.312.067.475.042.348.078.637.056.906a.545.545 0 0 1-.162.258l-.012.211a6.424 6.424 0 0 0-4.166 2.003 8.373 8.373 0 0 1-.18-.128c-.09.012-.18.04-.297-.029-.223-.15-.427-.358-.673-.608-.113-.12-.195-.234-.329-.349-.03-.026-.077-.062-.111-.088a.594.594 0 0 0-.348-.132.481.481 0 0 0-.398.176c-.172.216-.117.546.123.737l.007.005.104.083c.142.105.272.159.414.242.299.185.546.338.743.522.076.082.09.226.1.288l.16.143a6.462 6.462 0 0 0-1.02 4.506l-.208.06c-.055.072-.133.184-.215.217-.257.081-.546.11-.895.147-.164.014-.305.006-.48.039-.037.007-.09.02-.133.03l-.004.002-.007.002c-.295.071-.484.342-.423.608.061.267.349.429.645.365l.007-.001.01-.003.129-.029c.17-.046.294-.113.448-.172.33-.118.604-.217.87-.256.112-.009.23.069.288.101l.217-.037a6.5 6.5 0 0 0 2.88 3.596l-.09.218c.033.084.069.199.044.282-.097.252-.263.517-.452.813-.091.136-.185.242-.268.399-.02.037-.045.095-.064.134-.128.275-.034.591.213.71.248.12.556-.007.69-.282v-.002c.02-.039.046-.09.062-.127.07-.162.094-.301.144-.458.132-.332.205-.68.387-.897.05-.06.13-.082.215-.105l.113-.205a6.453 6.453 0 0 0 4.609.012l.106.192c.086.028.18.042.256.155.136.232.229.507.342.84.05.156.074.295.145.457.016.037.043.09.062.129.133.276.442.402.69.282.247-.118.341-.435.213-.71-.02-.039-.045-.096-.065-.134-.083-.156-.177-.261-.268-.398-.19-.296-.346-.541-.443-.793-.04-.13.007-.21.038-.294-.018-.022-.059-.144-.083-.202a6.499 6.499 0 0 0 2.88-3.622c.064.01.176.03.213.038.075-.05.144-.114.28-.104.266.039.54.138.87.256.154.06.277.128.448.173.036.01.088.019.13.028l.009.003.007.001c.297.064.584-.098.645-.365.06-.266-.128-.537-.423-.608zM16.4 9.701l-1.95 1.746v.005a.44.44 0 0 0 .173.757l.003.01 2.526.728a5.199 5.199 0 0 0-.108-1.674A5.208 5.208 0 0 0 16.4 9.7zm-4.013 5.325a.437.437 0 0 0-.404-.232.44.44 0 0 0-.372.233h-.002l-1.268 2.292a5.164 5.164 0 0 0 3.326.003l-1.27-2.296h-.01zm1.888-1.293a.44.44 0 0 0-.27.036.44.44 0 0 0-.214.572l-.003.004 1.01 2.438a5.15 5.15 0 0 0 2.081-2.615l-2.6-.44-.004.005z"})})}function TI({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"#028CF0","aria-hidden":"true",children:m.jsx("path",{d:"M16.153 12.826c-.63-.183-1.03.15-1.378.846-.58 1.13-1.643 1.644-2.888 1.594-1.245-.05-2.257-.63-2.788-1.776-.233-.498-.498-.664-1.046-.68-.93-.017-1.643.016-2.174 1.062-.631 1.261-2.258 1.693-3.619 1.261a3.234 3.234 0 0 1-2.257-3.22 3.198 3.198 0 0 1 2.29-3.02 3.276 3.276 0 0 1 3.702 1.327c.216.315.216.863.597.93.648.1 1.328.033 1.992.033.299 0 .316-.266.399-.465.58-1.295 1.61-1.959 2.987-1.975 1.361-.017 2.39.647 2.955 1.892.215.465.48.598.946.548.166-.017.332.016.498 0 .464-.083 1.062.282 1.344-.448.282-.73-.382-.913-.68-1.245-.847-.946-1.81-1.793-2.673-2.706-.415-.465-.763-.614-1.41-.415-1.876.614-3.619-.431-4.15-2.357-.448-1.676.714-3.535 2.44-3.917a3.293 3.293 0 0 1 3.95 2.457c.017.05.017.083.033.133.117.564.117 1.145-.132 1.626-.283.531-.133.83.249 1.195a152.61 152.61 0 0 1 3.286 3.27c.299.299.498.349.913.2 1.51-.565 2.97-.1 3.884 1.161a3.266 3.266 0 0 1-.067 3.801c-.896 1.195-2.357 1.643-3.834 1.079-.381-.15-.58-.1-.846.182a163.619 163.619 0 0 1-3.403 3.386c-.299.3-.415.532-.232.98a3.198 3.198 0 0 1-1.278 3.917A3.298 3.298 0 0 1 9.646 23c-1.062-1.062-1.228-2.688-.415-4.033a3.196 3.196 0 0 1 3.835-1.294c.498.182.78.083 1.145-.283 1.012-1.045 2.058-2.058 3.087-3.103.266-.266.68-.449.432-1.03-.233-.547-.631-.414-1.03-.431zM11.97 4.942c.913.016 1.643-.714 1.66-1.627v-.05a1.646 1.646 0 0 0-1.76-1.56 1.63 1.63 0 0 0-1.543 1.527 1.638 1.638 0 0 0 1.577 1.71zm.033 5.41a1.658 1.658 0 0 0-1.676 1.61v.084a1.73 1.73 0 0 0 1.643 1.66c.847.016 1.643-.78 1.677-1.627a1.648 1.648 0 0 0-1.577-1.71c-.017-.016-.05-.016-.067-.016zm7.088 1.694c.016.896.747 1.61 1.626 1.643a1.723 1.723 0 0 0 1.66-1.726 1.666 1.666 0 0 0-1.66-1.61 1.623 1.623 0 0 0-1.643 1.577c.017.05.017.083.017.116zM3.24 10.353a1.692 1.692 0 0 0-1.66 1.626c-.017.847.863 1.727 1.693 1.71a1.687 1.687 0 0 0 1.626-1.743 1.615 1.615 0 0 0-1.643-1.593Zm8.68 12c.98.033 1.71-.647 1.727-1.593a1.646 1.646 0 0 0-1.51-1.793 1.646 1.646 0 0 0-1.793 1.51v.233a1.609 1.609 0 0 0 1.543 1.66c0-.017.017-.017.033-.017z"})})}function NI({size:e=16}){return m.jsxs("svg",{width:e,height:e,viewBox:"0 0 100 100","aria-hidden":"true",children:[m.jsx("rect",{width:"100",height:"100",rx:"8",fill:"#9a2036"}),m.jsx("path",{d:"M15.375 16.782v63.843a4 4 0 0 0 4 4h63.843c3.564 0 5.348-4.309 2.829-6.828L22.203 13.953c-2.52-2.52-6.828-.735-6.828 2.829",fill:"#fff"})]})}function qv({size:e=16}){return m.jsx("svg",{width:e,height:e,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:m.jsx("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"})})}function p8({kind:e,size:t=16}){switch(e){case"modal_job":return m.jsx(kI,{size:t});case"hf_job":return m.jsx(EI,{size:t});case"k8s_job":return m.jsx(AI,{size:t});case"ssh_job":return m.jsx(dm,{size:t});case"slurm_job":return m.jsx(Hk,{size:t});case"ray_job":return m.jsx(TI,{size:t});case"openresearch_job":return m.jsx(NI,{size:t});case"local_job":return m.jsx(vA,{size:t});default:return m.jsx(dm,{size:t})}}function m8({backend:e}){const t=Jh(e),n=Hx(e);return t?m.jsxs("span",{className:"backend-badge",children:[m.jsx(p8,{kind:t}),m.jsx("span",{className:"backend-name",children:CI(t)}),n&&m.jsx("span",{className:"backend-detail mono",children:n})]}):m.jsx("span",{className:"backend-badge muted",children:"—"})}function g8({value:e,max:t,label:n,caption:r,fillColor:s}){const a=t>0?Math.min(100,Math.round(e/t*100)):0;return m.jsxs("div",{className:"progress",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,children:[m.jsx("div",{className:"progress-track",children:m.jsx("div",{className:"progress-fill",style:{width:`${a}%`,background:s}})}),(n!==void 0||r!==void 0)&&m.jsxs("div",{className:"progress-caption",children:[m.jsx("span",{children:n??`${a}%`}),r]})]})}const u_={done:{className:"st-done",live:!1},failed:{className:"st-failed",live:!1},running:{className:"st-running",live:!0},starting:{className:"st-starting",live:!0},cancelled:{className:"st-cancelled",live:!1},editing:{className:"st-editing",live:!0},idle:{className:"st-idle",live:!1}};function MI(e){return u_[e]??u_.idle}function DI(e){return e.charAt(0).toUpperCase()+e.slice(1)}function tl({status:e,label:t}){const n=MI(e);return m.jsxs("span",{className:`status-badge ${n.className}${n.live?" live":""}`,children:[m.jsx("span",{className:"dot"}),t??DI(e)]})}function qp(e){return e.installed&&e.authenticated?{cls:"ok",label:"Connected"}:e.installed?{cls:"warn",label:"Not signed in"}:{cls:"warn",label:"Not installed"}}function RI({h:e}){return e.authMethod?m.jsx(m.Fragment,{children:e.authMethod==="oauth"?"OAuth (subscription login)":"API key"}):m.jsx(m.Fragment,{children:"—"})}function jI(){const[e,t]=P.useState(null),[n,r]=P.useState("claude-code"),[s,a]=P.useState(!1),c=u=>{a(!0),Og(u).then(t).catch(()=>{}).finally(()=>a(!1))};P.useEffect(()=>c(!1),[]);const l=e==null?void 0:e.find(u=>u.id===n);return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Harnesses"}),m.jsx("p",{className:"settings-sub",children:"Coding-agent setups detected on this machine. The research agent chat is served by OpenCode; Claude Code and Codex accounts surface their models in the composer's model picker."}),m.jsx("div",{className:"harness-tabs",children:(e??[]).map(u=>m.jsxs("button",{className:u.id===n?"active":"",onClick:()=>r(u.id),children:[u.name,m.jsx("span",{className:`harness-dot ${qp(u).cls}`})]},u.id))}),e?l?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("span",{className:`badge ${qp(l).cls}`,children:qp(l).label}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>c(!0),disabled:s,children:[m.jsx(wh,{size:12,className:s?"spin":""})," Refresh"]})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Binary"}),m.jsx("span",{className:"v",children:l.binPath??"not found on PATH"}),m.jsx("span",{className:"k",children:"Version"}),m.jsx("span",{className:"v",children:l.version??"—"}),m.jsx("span",{className:"k",children:"Auth"}),m.jsx("span",{className:"v",children:m.jsx(RI,{h:l})}),l.account&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:l.id==="opencode"?"Providers":"Account"}),m.jsx("span",{className:"v",children:l.account})]}),l.org&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Org"}),m.jsx("span",{className:"v",children:l.org})]}),l.plan&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Plan"}),m.jsx("span",{className:"v",children:l.plan})]}),m.jsx("span",{className:"k",children:"Agent models"}),m.jsx("span",{className:"v",children:l.models.length>0?`${l.models.length} available — ${l.models.slice(0,4).map(u=>Ch(u)).join(", ")}${l.models.length>4?", …":""}`:"none"})]}),!l.agentReady&&l.agentNote&&m.jsx("p",{className:"settings-note",children:l.agentNote})]}):null:m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting harnesses…"]})]})}function LI({s:e}){if(!e.configured)return m.jsx("span",{className:"badge",children:"Not configured"});const t=e.preflight;return t.kubectlFound?t.reachable?t.canCreateJobs?m.jsx("span",{className:"badge ok",children:"Connected"}):m.jsx("span",{className:"badge err",children:"No job-create permission"}):m.jsx("span",{className:"badge err",children:"Cluster unreachable"}):m.jsx("span",{className:"badge err",children:"kubectl not found"})}function OI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(""),[u,h]=P.useState(!1),[p,f]=P.useState(null),g=w=>{t(w),a(w.context??""),l(w.namespace)};P.useEffect(()=>{oT().then(g).catch(w=>r(w instanceof Error?w.message:String(w)))},[]);const y=e!==null&&s===(e.context??"")&&c.trim()===e.namespace;async function C(w){if(w.preventDefault(),!u){h(!0),f(null);try{g(await lT({context:s,namespace:c.trim()}))}catch(b){f(b instanceof Error?b.message:String(b))}finally{h(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend k8s"}),". The run's resources (image, GPUs, topology) come from a manifest committed on the experiment branch (default ",m.jsx("code",{children:".orx/k8s.yaml"}),"); only the cluster context and namespace live here. Auth comes from your kubeconfig."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Cluster"}),m.jsx("span",{className:"v",children:m.jsx(LI,{s:e})})]}),e.preflight.error&&m.jsx("p",{className:"settings-note",children:e.preflight.error}),m.jsxs("form",{className:"form settings-form",onSubmit:C,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Context",m.jsxs("select",{value:s,onChange:w=>a(w.target.value),children:[m.jsxs("option",{value:"",children:["kubectl default",e.currentContext?` (${e.currentContext})`:""]}),e.contexts.map(w=>m.jsx("option",{value:w,children:w},w))]})]}),m.jsxs("label",{children:["Namespace",m.jsx("input",{className:"mono",type:"text",value:c,onChange:w=>l(w.target.value),placeholder:"default",autoComplete:"off",spellCheck:!1})]})]}),p&&m.jsx("div",{className:"error",children:p}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:u||y,children:u?"Saving…":"Save"})})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("div",{className:"settings-card-head",children:m.jsx("h3",{children:"Run manifest"})}),m.jsxs("p",{className:"settings-sub",children:["Each run applies the manifest committed on its experiment branch — default"," ",m.jsx("code",{children:".orx/k8s.yaml"}),", or ",m.jsx("code",{children:"--manifest "}),". It declares whatever the run needs (image, GPU requests, an Indexed Job across nodes, extra Services, …); orx injects the run script as ",m.jsx("code",{children:"$ORX_SCRIPT"}),", the"," ",m.jsx("code",{children:"orx-env"})," Secret, run labels, and a default timeout, and requires exactly one Job (or one labelled ",m.jsx("code",{children:'orx-primary: "true"'}),") whose completion is the run's. Logs follow that Job's leader pod. Use"," ",m.jsx("code",{children:"{{ORX_RUN}}"})," in resource names to keep re-runs collision-free."]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking kubectl…"]})]})}const BI={env:"MODAL_TOKEN_ID env var",syncedEnv:"~/.openresearch/env",modalToml:"~/.modal.toml (modal token new)"};function zI({s:e}){return e.ready?m.jsx("span",{className:"badge ok",children:"Connected"}):!e.tokenConfigured&&!e.modalImportable?m.jsx("span",{className:"badge",children:"Not set up"}):e.modalImportable?e.tokenConfigured?m.jsx("span",{className:"badge",children:"Unknown"}):m.jsx("span",{className:"badge err",children:"No token"}):m.jsx("span",{className:"badge err",children:e.envProvisioned?"Env broken":"Env not built"})}function II(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(!1),[c,l]=P.useState(null);P.useEffect(()=>{cT().then(t).catch(h=>r(h instanceof Error?h.message:String(h)))},[]);async function u(){if(!s){a(!0),l(null);try{t(await uT())}catch(h){l(h instanceof Error?h.message:String(h))}finally{a(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Serverless GPUs on your own Modal account with"," ",m.jsx("code",{children:"--backend modal --flavor "})," (t4, a10g, a100-80gb, h100, …). orx manages a dedicated Python env with the Modal SDK; sandboxes scale to zero between runs."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(zI,{s:e})}),m.jsx("span",{className:"k",children:"Environment"}),m.jsx("span",{className:"v",children:e.modalImportable?"Ready":e.envProvisioned?"Provisioned (modal import failing)":"Not built yet"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.tokenSource?BI[e.tokenSource]:"Not configured"})]}),!e.tokenConfigured&&m.jsxs("p",{className:"settings-note",children:["No Modal token found. Run ",m.jsx("code",{children:"modal token new"}),", or add"," ",m.jsx("code",{children:"MODAL_TOKEN_ID"})," and ",m.jsx("code",{children:"MODAL_TOKEN_SECRET"})," in the Environment tab."]}),e.error&&e.envProvisioned&&!e.modalImportable&&m.jsx("p",{className:"settings-note",children:e.error}),c&&m.jsx("div",{className:"error",children:c}),!e.modalImportable&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn primary",onClick:()=>void u(),disabled:s,children:s?"Setting up… (~30–60s)":"Set up environment"})})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking Modal…"]})]})}function HI({test:e}){if(e===void 0)return m.jsx("span",{className:"muted",children:"never tested"});if(e==="testing")return m.jsx("span",{className:"spinner"});const t=e.reachable?e.gitFound?m.jsx("span",{className:"badge ok",children:"Ready"}):m.jsx("span",{className:"badge err",children:"No git"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"Unreachable"});return m.jsxs(m.Fragment,{children:[t,m.jsx("span",{className:"ssh-tested-at",children:Ua(e.testedAt)})]})}function FI(){const[e,t]=P.useState(null),[n,r]=P.useState({});P.useEffect(()=>{gT().then(t).catch(()=>t([]))},[]);async function s(a){r(c=>({...c,[a]:"testing"}));try{const c=await vT(a);r(l=>({...l,[a]:c}))}catch(c){r(l=>({...l,[a]:{reachable:!1,gitFound:!1,error:c instanceof Error?c.message:String(c),testedAt:Date.now()}}))}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments directly on your own boxes with"," ",m.jsx("code",{children:"--backend ssh --host "}),". Hosts come from"," ",m.jsx("code",{children:"~/.ssh/config"}),"; auth uses your keys/agent (orx never reads a key). The host just needs ",m.jsx("code",{children:"git"})," and ",m.jsx("code",{children:"bash"}),"."]}),e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Reading ~/.ssh/config…"]}):e.length===0?m.jsx("p",{className:"settings-empty",children:"No hosts found in ~/.ssh/config."}):m.jsxs("table",{className:"flavor-table ssh-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Host"}),m.jsx("th",{children:"Address"}),m.jsx("th",{children:"Identity"}),m.jsx("th",{children:"Status"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:e.map(a=>m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:a.host}),m.jsxs("td",{className:"mono muted",children:[[a.user,a.hostname??"—"].filter(Boolean).join("@"),a.port?`:${a.port}`:""]}),m.jsx("td",{className:"mono muted",children:a.identityFile??"—"}),m.jsx("td",{children:m.jsx(HI,{test:n[a.host]??a.lastTest})}),m.jsx("td",{children:m.jsx("button",{className:"btn sm",onClick:()=>void s(a.host),disabled:n[a.host]==="testing",children:"Test"})})]},a.host))})]})]})}function PI({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"spinner"}):e.reachable?e.slurmFound?e.gitFound?m.jsx("span",{className:"badge ok",children:"Ready"}):m.jsx("span",{className:"badge err",children:"No git"}):m.jsx("span",{className:"badge err",children:"No Slurm CLI"}):m.jsx("span",{className:"badge err",title:e.error??void 0,children:"Unreachable"})}function $I(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(""),[u,h]=P.useState(""),[p,f]=P.useState(""),[g,y]=P.useState(!1),[C,w]=P.useState(null),[b,_]=P.useState(null),x=b!==null&&b!=="testing"?b:null,S=D=>{t(D),a(D.host??""),l(D.partition??""),h(D.account??""),f(D.timeLimit??"")};P.useEffect(()=>{yT().then(S).catch(D=>r(D instanceof Error?D.message:String(D)))},[]);const E=e!==null&&s===(e.host??"")&&c.trim()===(e.partition??"")&&u.trim()===(e.account??"")&&p.trim()===(e.timeLimit??"");async function T(D){if(D.preventDefault(),!g){y(!0),w(null);try{S(await bT({host:s,partition:c.trim(),account:u.trim(),timeLimit:p.trim()}))}catch(M){w(M instanceof Error?M.message:String(M))}finally{y(!1)}}}async function A(D){_("testing");try{_(await _T(D))}catch(M){_({reachable:!1,slurmFound:!1,gitFound:!1,partitions:[],error:M instanceof Error?M.message:String(M)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on your own cluster with ",m.jsx("code",{children:"--backend slurm [--flavor h100:2]"}),". orx submits via ",m.jsx("code",{children:"sbatch"})," on the login node over ssh (auth is your keys/agent; orx never reads a key) and the job runs in your cluster environment. The defaults below apply when a launch doesn't override them."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[(x==null?void 0:x.error)&&m.jsx("p",{className:"settings-note",children:x.error}),x&&x.partitions.length>0&&m.jsxs("p",{className:"settings-note",children:["Partitions: ",m.jsx("code",{children:x.partitions.join(", ")})]}),m.jsxs("form",{className:"form settings-form",onSubmit:T,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Login node",m.jsxs("select",{value:s,onChange:D=>{a(D.target.value),_(null)},children:[m.jsx("option",{value:"",children:"not set (pass --host per launch)"}),s&&!e.hosts.some(D=>D.host===s)&&m.jsxs("option",{value:s,children:[s," (not in ~/.ssh/config)"]}),e.hosts.map(D=>m.jsx("option",{value:D.host,children:D.host},D.host))]})]}),m.jsxs("label",{children:["Partition",m.jsx("input",{className:"mono",type:"text",list:"slurm-partitions",value:c,onChange:D=>l(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:"slurm-partitions",children:x==null?void 0:x.partitions.map(D=>m.jsx("option",{value:D},D))})]})]}),m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["Account",m.jsx("input",{className:"mono",type:"text",value:u,onChange:D=>h(D.target.value),placeholder:"cluster default",autoComplete:"off",spellCheck:!1})]}),m.jsxs("label",{children:["Time limit",m.jsx("input",{className:"mono",type:"text",value:p,onChange:D=>f(D.target.value),placeholder:"cluster default (e.g. 4h, 30m)",autoComplete:"off",spellCheck:!1})]})]}),C&&m.jsx("div",{className:"error",children:C}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:g||E,children:g?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void A(s),disabled:!s||b==="testing",title:s?void 0:"Pick a login node first",children:"Test connection"}),m.jsx(PI,{test:b})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading slurm settings…"]})]})}function UI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null),[p,f]=P.useState(null),g=p!==null&&p!=="testing"?p:null,y=_=>{t(_),a(_.address??"")};P.useEffect(()=>{xT().then(y).catch(_=>r(_ instanceof Error?_.message:String(_)))},[]);const C=e!==null&&s===(e.address??"");async function w(_){if(_.preventDefault(),!c){l(!0),h(null);try{y(await ST({address:s}))}catch(x){h(x instanceof Error?x.message:String(x))}finally{l(!1)}}}async function b(){f("testing");try{f(await wT(s.trim()||void 0))}catch(_){f({reachable:!1,address:s.trim()||"(unknown)",rayVersion:null,error:_ instanceof Error?_.message:String(_)})}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on a Ray cluster with ",m.jsx("code",{children:"--backend ray [--flavor gpu:1]"}),". orx submits via the Ray Jobs API (Dashboard URL). Address resolution: this setting, then ",m.jsx("code",{children:"ASTROAI_RAY_JOBS_ADDRESS"})," /"," ",m.jsx("code",{children:"RAY_DASHBOARD_URL"}),", then ",m.jsx("code",{children:"http://127.0.0.1:8265"}),". Optional flavor maps to entrypoint CPUs/GPUs/memory (e.g."," ",m.jsx("code",{children:"cpu:2"}),", ",m.jsx("code",{children:"gpu:1,mem:8GiB"}),")."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["Effective: ",m.jsx("code",{children:e.resolvedAddress})," (",e.source,")"]}),(g==null?void 0:g.error)&&m.jsx("p",{className:"settings-note",children:g.error}),(g==null?void 0:g.reachable)&&g.rayVersion&&m.jsxs("p",{className:"settings-note",children:["Ray version: ",m.jsx("code",{children:g.rayVersion})]}),m.jsxs("form",{className:"form settings-form",onSubmit:w,children:[m.jsxs("label",{children:["Jobs / Dashboard URL",m.jsx("input",{className:"mono",type:"text",value:s,onChange:_=>{a(_.target.value),f(null)},placeholder:"http://127.0.0.1:8265",autoComplete:"off",spellCheck:!1})]}),u&&m.jsx("div",{className:"error",children:u}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn primary",disabled:c||C,children:c?"Saving…":"Save"}),m.jsx("button",{type:"button",className:"btn",onClick:()=>void b(),disabled:p==="testing",children:"Test connection"}),m.jsx(qI,{test:p})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading Ray settings…"]})]})}function qI({test:e}){return e===null?null:e==="testing"?m.jsx("span",{className:"badge",children:"Testing…"}):e.reachable?m.jsx("span",{className:"badge ok",children:"Reachable"}):m.jsx("span",{className:"badge warn",children:"Unreachable"})}function GI(){const[e,t]=P.useState(null),[n,r]=P.useState(null);return P.useEffect(()=>{ET().then(t).catch(s=>r(s instanceof Error?s.message:String(s)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments as detached, supervised processes on the machine running orx with"," ",m.jsx("code",{children:"--backend local"})," — handy when you're already on a GPU box and using this dashboard over port forwarding. Runs share CPU/RAM/GPU with the dashboard itself, so prefer a remote backend for anything heavy."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Hostname"}),m.jsx("span",{className:"v mono",children:e.hostname}),m.jsx("span",{className:"k",children:"System"}),m.jsxs("span",{className:"v",children:[e.os,"/",e.arch,e.chip?` — ${e.chip}`:""]}),m.jsx("span",{className:"k",children:"CPU"}),m.jsx("span",{className:"v",children:e.cpuCount>0?`${e.cpuCount} cores`:"—"}),m.jsx("span",{className:"k",children:"RAM"}),m.jsx("span",{className:"v",children:e.memBytes!==null?Ma(e.memBytes):"—"}),m.jsx("span",{className:"k",children:"GPUs"}),m.jsx("span",{className:"v",children:e.gpus.length===0?"none detected (nvidia-smi)":e.gpus.map(s=>`${s.name}${s.memMib!==null?` — ${Ma(s.memMib*1024*1024)}`:""}`).join(", ")})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Detecting hardware…"]})]})}function VI(){const[e,t]=P.useState(null),[n,r]=P.useState(null);return P.useEffect(()=>{kT().then(t).catch(s=>r(s instanceof Error?s.message:String(s)))},[]),m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run on an ephemeral OpenResearch box billed to your org with"," ",m.jsx("code",{children:"--backend openresearch --flavor "})," (h100_sxm, cpu5c, …; browse with ",m.jsx("code",{children:"orx compute"}),"). The box is provisioned for the run and deleted when it ends. Needs ",m.jsx("code",{children:"orx login"})," and a registered SSH key."]}),n?m.jsx("div",{className:"error",children:n}):e?e.loggedIn?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx("span",{className:"badge ok",children:"Signed in"})}),m.jsx("span",{className:"k",children:"Orgs"}),m.jsx("span",{className:"v",children:e.orgs.length>0?e.orgs.join(", "):"—"}),m.jsx("span",{className:"k",children:"SSH key"}),m.jsx("span",{className:"v",children:e.sshKeyStatus==="matched"?m.jsx("span",{className:"badge ok",children:"On this computer"}):e.sshKeyStatus==="no_local_match"?m.jsx("span",{className:"badge warn",children:"Not on this computer"}):e.sshKeyStatus==="none_registered"?m.jsx("span",{className:"badge err",children:"None registered"}):m.jsx("span",{className:"badge",children:"Unknown"})})]}),e.sshKeyStatus==="none_registered"&&(e.sshKeyPath?m.jsxs("p",{className:"settings-note",children:["Add one with ",m.jsxs("code",{children:["orx ssh-key add ",e.sshKeyPath]}),"."]}):m.jsxs("p",{className:"settings-note",children:["No key on this computer yet — create one with"," ",m.jsx("code",{children:"ssh-keygen -t ed25519"}),", then add it with"," ",m.jsx("code",{children:"orx ssh-key add"}),"."]})),e.sshKeyStatus==="no_local_match"&&(e.sshKeyPath?m.jsxs("p",{className:"settings-note",children:["Register this computer with ",m.jsxs("code",{children:["orx ssh-key add ",e.sshKeyPath]}),", or load a registered key with ",m.jsx("code",{children:"ssh-add"}),"."]}):m.jsxs("p",{className:"settings-note",children:["No key on this computer to register — load a registered key with"," ",m.jsx("code",{children:"ssh-add"}),", or create one with"," ",m.jsx("code",{children:"ssh-keygen -t ed25519"}),"."]})),e.error&&m.jsx("p",{className:"settings-note",children:e.error})]}):m.jsxs("p",{className:"settings-note",children:["Not signed in. Run ",m.jsx("code",{children:"orx login"})," in a terminal to connect your OpenResearch account."]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking credentials…"]})]})}const h_={local:"This machine",hf:"HF Jobs",modal:"Modal",k8s:"Kubernetes",ssh:"SSH",slurm:"Slurm",ray:"Ray",openresearch:"OpenResearch"},WI={local:"local_job",hf:"hf_job",modal:"modal_job",k8s:"k8s_job",ssh:"ssh_job",slurm:"slurm_job",ray:"ray_job",openresearch:"openresearch_job"},YI=["hf","modal","slurm","ray","openresearch"],d_=["hf","modal","openresearch"],f_={hf:["cpu-basic","t4-small","a10g-small","a10g-large","a100-large","h100","h200"],modal:["cpu","t4","l4","a10g","a100","a100-80gb","l40s","h100","h100:2"],slurm:["gpu","h100:1","h100:2","a100:4"],ray:["cpu","cpu:2","gpu","gpu:1","gpu:1,cpu:4","gpu:1,mem:8GiB"],openresearch:["h100_sxm","h100_sxm:2","cpu5c","cpu5g","cpu5m"]};function XI({t:e,isDefault:t}){return e.id==="local"?m.jsx("span",{className:"badge ok",children:"Ready"}):e.unverified?m.jsx("span",{className:"badge",children:"Unknown"}):!e.configured&&t?m.jsx("span",{className:"badge warn",children:"Not configured"}):e.configured?m.jsx("span",{className:"badge ok",children:"Configured"}):m.jsx("span",{className:"badge",children:"Not set up"})}function KI({target:e,flavor:t,onSaved:n}){var f;const[r,s]=P.useState(t??""),[a,c]=P.useState(!1),[l,u]=P.useState(null);P.useEffect(()=>s(t??""),[t]);async function h(g){if(g.preventDefault(),!a){c(!0),u(null);try{n(await Ox({backend:e,flavor:r.trim()||null}))}catch(y){u(y instanceof Error?y.message:String(y))}finally{c(!1)}}}const p=r.trim()===(t??"");return m.jsxs("form",{className:"form settings-form compute-flavor-form",onSubmit:h,children:[m.jsxs("label",{children:["Default flavor",m.jsx("input",{className:"mono",type:"text",list:`flavors-${e}`,value:r,onChange:g=>s(g.target.value),placeholder:d_.includes(e)?`e.g. ${((f=f_[e])==null?void 0:f[1])??""}`:"none (CPU-only)",autoComplete:"off",spellCheck:!1}),m.jsx("datalist",{id:`flavors-${e}`,children:(f_[e]??[]).map(g=>m.jsx("option",{value:g},g))})]}),l&&m.jsx("div",{className:"error",children:l}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"submit",className:"btn sm",disabled:a||p,children:a?"Saving…":"Save flavor"}),d_.includes(e)&&!t&&m.jsxs("span",{className:"muted compute-flavor-hint",children:["This backend requires a flavor — without a default one, each launch must pass"," ",m.jsx("code",{children:"--flavor"}),"."]})]})]})}function ZI({target:e,isDefault:t,defaultFlavor:n,open:r,onToggle:s,onSettings:a,onError:c}){const[l,u]=P.useState(!1),[h,p]=P.useState(!1);r&&!l&&u(!0);async function f(g){if(!h){p(!0);try{a(await Ox({backend:g}))}catch(y){c(y instanceof Error?y.message:String(y))}finally{p(!1)}}}return m.jsxs("div",{className:`compute-row${r?" open":""}`,children:[m.jsxs("div",{className:"compute-row-head",onClick:s,children:[m.jsx("span",{className:"compute-row-logo",children:m.jsx(p8,{kind:WI[e.id],size:18})}),m.jsx("span",{className:"compute-row-name",children:h_[e.id]}),m.jsx("span",{className:"compute-row-summary",children:e.summary}),m.jsx(XI,{t:e,isDefault:t}),t?m.jsx("span",{className:"badge compute-default-pill",children:"Default"}):m.jsx("button",{type:"button",className:"btn sm compute-make-default",onClick:g=>{g.stopPropagation(),f(e.id)},disabled:h,children:"Make default"}),m.jsx("button",{type:"button",className:"compute-chevron-btn","aria-expanded":r,"aria-label":`${r?"Collapse":"Expand"} ${h_[e.id]}`,onClick:g=>{g.stopPropagation(),s()},children:m.jsx(Pa,{size:16,className:"compute-chevron"})})]}),l&&m.jsxs("div",{className:"compute-row-body",hidden:!r,children:[t&&m.jsxs("p",{className:"settings-note compute-default-note",children:["The agent launches runs here unless you tell it otherwise, and so does"," ",m.jsx("code",{children:"orx exp run"})," with no ",m.jsx("code",{children:"--backend"})," flag."," ",m.jsx("button",{type:"button",className:"btn sm",onClick:()=>void f(null),disabled:h,children:"Clear default"})]}),t&&!e.configured&&m.jsx("p",{className:"settings-note",children:"This target is the default but isn't configured — launches will fail until it's set up below."}),t&&YI.includes(e.id)&&m.jsx(KI,{target:e.id,flavor:n,onSaved:a}),e.id==="local"&&m.jsx(GI,{}),e.id==="hf"&&m.jsx(nH,{}),e.id==="modal"&&m.jsx(II,{}),e.id==="k8s"&&m.jsx(OI,{}),e.id==="ssh"&&m.jsx(FI,{}),e.id==="slurm"&&m.jsx($I,{}),e.id==="ray"&&m.jsx(UI,{}),e.id==="openresearch"&&m.jsx(VI,{})]})]})}function QI(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(null),[c,l]=P.useState(null),u=P.useRef(0);P.useEffect(()=>{const f=++u.current;CT().then(g=>{f===u.current&&(t(g),r(null))}).catch(g=>{if(f!==u.current)return;const y=g instanceof Error?g.message:String(g);t(C=>(C===null?r(y):l(y),C))})},[s]);const h=f=>{u.current++,t(f),l(null)},p=e?e.targets:null;return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Compute"}),m.jsxs("p",{className:"settings-sub",children:["Where ",m.jsx("code",{children:"orx exp run"})," executes. Pick a default target; the agent uses it when a launch doesn't name a backend (",m.jsx("code",{children:"--backend "})," always wins)."]}),n?m.jsx("div",{className:"error",children:n}):p?m.jsxs(m.Fragment,{children:[c&&m.jsx("div",{className:"error",children:c}),m.jsx("div",{className:"compute-list",children:p.map(f=>m.jsx(ZI,{target:f,isDefault:(e==null?void 0:e.defaultBackend)===f.id,defaultFlavor:(e==null?void 0:e.defaultFlavor)??null,open:s===f.id,onToggle:()=>a(g=>g===f.id?null:f.id),onSettings:h,onError:l},f.id))}),m.jsxs("p",{className:"compute-footnote",children:[m.jsx(mA,{size:14,"aria-hidden":"true"}),m.jsx("span",{children:"The default target and flavor are included in the research agent's instructions — it launches runs there unless you name another backend. No other compute settings are shared with it."})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Checking compute targets…"]})]})}const JI={env:"HF_TOKEN env var",openresearchEnv:"~/.openresearch/env",hfCache:"~/.cache/huggingface/token (hf auth login)"};function eH({settings:e}){return e.configured?e.valid?m.jsx("span",{className:"badge ok",children:"Connected"}):m.jsx("span",{className:"badge err",children:"Invalid token"}):m.jsx("span",{className:"badge",children:"Not configured"})}function tH({settings:e}){return!e.configured||!e.valid?null:e.jobsWrite===!0?m.jsx("span",{className:"badge ok",children:"Jobs: write OK"}):e.jobsWrite===!1?m.jsx("span",{className:"badge err",children:"No job.write permission"}):m.jsx("span",{className:"badge",children:"Jobs permission unknown"})}function nH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null),p=P.useRef(!1);P.useEffect(()=>{sT().then(g=>{p.current||t(g)}).catch(g=>{p.current||r(g instanceof Error?g.message:String(g))})},[]);async function f(g){if(g.preventDefault(),!(!s.trim()||c)){l(!0),h(null);try{const y=await aT(s.trim());p.current=!0,t(y),r(null),a("")}catch(y){h(y instanceof Error?y.message:String(y))}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-sub",children:["Run experiments on your Hugging Face account with"," ",m.jsx("code",{children:"--backend hf --flavor "})," (t4-small, a10g-small, a100-large, …). Billed to HF per minute."]}),n?m.jsx("div",{className:"error",children:n}):e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Status"}),m.jsx("span",{className:"v",children:m.jsx(eH,{settings:e})}),m.jsx("span",{className:"k",children:"Account"}),m.jsx("span",{className:"v",children:e.username??"—"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.maskedToken??"—"}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:e.source?JI[e.source]:"Not configured"}),m.jsx("span",{className:"k",children:"Jobs"}),m.jsxs("span",{className:"v",children:[m.jsx(tH,{settings:e}),(!e.configured||!e.valid)&&"—"]})]}),e.source==="env"&&m.jsx("p",{className:"settings-note",children:"HF_TOKEN is set in the environment and overrides any token saved here."}),e.valid&&e.jobsWrite===null&&m.jsxs("p",{className:"settings-note",children:["This token is valid but doesn't report whether it can launch Jobs — OAuth tokens from ",m.jsx("code",{children:"hf auth login"})," never do. Launches may still work; for a definitive check, save a write-scoped token from"," ",m.jsx("a",{href:"https://huggingface.co/settings/tokens",target:"_blank",rel:"noreferrer",children:"huggingface.co/settings/tokens"}),"."]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading status…"]}),m.jsxs("form",{className:"form settings-form",onSubmit:f,children:[m.jsxs("label",{children:[e!=null&&e.configured?"Replace token":"New token",m.jsx("input",{type:"password",value:s,onChange:g=>a(g.target.value),placeholder:"hf_…",autoComplete:"off"})]}),u&&m.jsx("div",{className:"error",children:u}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:!s.trim()||c,children:c?"Validating…":"Save"})})]})]})}const v8=/^hf_[A-Za-z0-9]{10,}$/;function y8(){return m.jsx("tr",{children:m.jsx("td",{colSpan:3,children:m.jsxs("p",{className:"settings-note",children:["This value looks like a Hugging Face token — compute runs only read it from"," ",m.jsx("code",{children:"HF_TOKEN"}),". Save it under that key if it's meant for HF Jobs."]})})})}const p_=["HF_TOKEN","WANDB_API_KEY"];function rH({name:e,entry:t,onVars:n,onError:r}){const[s,a]=P.useState(""),[c,l]=P.useState(!1),u=f=>r(`${e}: ${f instanceof Error?f.message:String(f)}`);async function h(){if(!(!s.trim()||c)){l(!0);try{n(await Lx(e,s.trim())),a("")}catch(f){u(f)}finally{l(!1)}}}async function p(){if(!c){l(!0);try{n(await dT(e))}catch(f){u(f)}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{className:"mono",children:e}),m.jsx("td",{className:"mono muted",children:t?m.jsxs(m.Fragment,{children:[t.maskedValue,t.inProcessEnv&&m.jsx("span",{className:"badge",children:"Overridden by env"})]}):m.jsx("input",{className:"mono",type:"password",value:s,onChange:f=>a(f.target.value),onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),h()),f.key==="Escape"&&!c&&a("")},placeholder:"value","aria-label":`Value for ${e}`,autoComplete:"new-password",disabled:c})}),m.jsx("td",{children:t?m.jsx("button",{className:"icon-btn",title:`Delete ${e}`,"aria-label":`Delete ${e}`,onClick:()=>void p(),disabled:c,children:m.jsx(Qh,{size:13})}):s.trim()&&m.jsx("button",{className:"btn sm",onClick:()=>void h(),disabled:c,children:c?"Saving…":"Save"})})]}),!t&&e!=="HF_TOKEN"&&v8.test(s.trim())&&m.jsx(y8,{})]})}function iH({onVars:e,onError:t,onDone:n}){const[r,s]=P.useState(""),[a,c]=P.useState(""),[l,u]=P.useState(!1);async function h(){if(!(!r.trim()||!a.trim()||l)){u(!0);try{e(await Lx(r.trim(),a.trim())),n()}catch(f){t(`${r.trim()}: ${f instanceof Error?f.message:String(f)}`)}finally{u(!1)}}}const p=f=>{f.key==="Enter"&&(f.preventDefault(),h()),f.key==="Escape"&&!l&&n()};return m.jsxs(m.Fragment,{children:[m.jsxs("tr",{children:[m.jsx("td",{children:m.jsx("input",{autoFocus:!0,className:"mono",type:"text",value:r,onChange:f=>s(f.target.value),onKeyDown:p,placeholder:"MY_API_KEY","aria-label":"New variable key",autoComplete:"off",spellCheck:!1,disabled:l})}),m.jsx("td",{children:m.jsx("input",{className:"mono",type:"password",value:a,onChange:f=>c(f.target.value),onKeyDown:p,placeholder:"value","aria-label":"New variable value",autoComplete:"new-password",disabled:l})}),m.jsxs("td",{children:[m.jsx("button",{className:"btn sm",onClick:()=>void h(),disabled:l||!r.trim()||!a.trim(),children:l?"Saving…":"Save"}),m.jsx("button",{className:"icon-btn",title:"Cancel","aria-label":"Cancel new variable",onClick:n,disabled:l,children:m.jsx(Ko,{size:13})})]})]}),r.trim()!=="HF_TOKEN"&&v8.test(a.trim())&&m.jsx(y8,{})]})}function sH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(!1),[c,l]=P.useState(null);P.useEffect(()=>{hT().then(t).catch(f=>r(f instanceof Error?f.message:String(f)))},[]);const u=f=>{t(f),l(null)},h=e===null?[]:e.map(f=>f.key).filter(f=>!p_.includes(f)),p=[...p_,...h];return m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Environment variables"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsxs("button",{className:"btn sm",onClick:()=>a(!0),disabled:s||e===null,children:[m.jsx(Rg,{size:12})," Add variable"]})]}),m.jsxs("p",{className:"settings-sub",children:["Stored in ",m.jsx("code",{children:"~/.openresearch/env"})," and passed to runs and the research agent."," ",m.jsx("code",{children:"HF_TOKEN"})," and ",m.jsx("code",{children:"WANDB_API_KEY"})," are always listed since runs typically need them. Variables set in orx's own environment win on conflicts."]}),n?m.jsx("div",{className:"error",children:n}):e===null?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsx("table",{className:"env-table",children:m.jsxs("tbody",{children:[p.map(f=>m.jsx(rH,{name:f,entry:e.find(g=>g.key===f),onVars:u,onError:l},f)),s&&m.jsx(iH,{onVars:u,onError:l,onDone:()=>a(!1)})]})}),c&&m.jsx("div",{className:"error",children:c})]})}function aH(){const[e,t]=P.useState(null),[n,r]=P.useState(""),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null);P.useEffect(()=>{Bx().then(g=>{t(g),r(g.userName??""),a(g.userEmail??"")}).catch(()=>{})},[]);const p=e!==null&&n.trim()===(e.userName??"")&&s.trim()===(e.userEmail??"");async function f(g){if(g.preventDefault(),!(c||p)){l(!0),h(null);try{const y=await NT({userName:n.trim(),userEmail:s.trim()});t(y),r(y.userName??""),a(y.userEmail??"")}catch(y){h(y instanceof Error?y.message:String(y))}finally{l(!1)}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Git"}),m.jsx("p",{className:"settings-sub",children:"Experiment branches are committed and pushed from local clones with this identity."}),e?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"Identity"}),m.jsxs("form",{className:"form",onSubmit:f,children:[m.jsxs("div",{className:"row2",children:[m.jsxs("label",{children:["user.name",m.jsx("input",{type:"text",value:n,onChange:g=>r(g.target.value),autoComplete:"off"})]}),m.jsxs("label",{children:["user.email",m.jsx("input",{type:"text",value:s,onChange:g=>a(g.target.value),autoComplete:"off"})]})]}),u&&m.jsx("div",{className:"error",children:u}),m.jsx("div",{className:"actions",children:m.jsx("button",{type:"submit",className:"btn primary",disabled:c||p||!n.trim()&&!s.trim(),children:c?"Saving…":"Save"})})]})]}),m.jsxs("div",{className:"settings-card",children:[m.jsx("h3",{children:"GitHub access"}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"git"}),m.jsx("span",{className:"v",children:e.gitVersion??"not found"}),m.jsx("span",{className:"k",children:"Token"}),m.jsx("span",{className:"v",children:e.githubTokenSource==="env"?"GITHUB_TOKEN env var":e.githubTokenSource==="stored"?"token saved in orx":e.githubTokenSource==="gh"?"gh CLI (gh auth token)":"none found"})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("p",{className:"settings-note",children:["No GitHub token found — private repo clones and branch pushes will fail. Run"," ",m.jsx("code",{children:"gh auth login"}),", or paste a personal access token:"]}),m.jsx(f8,{onSaved:t})]}),e.githubTokenSource==="stored"&&m.jsx("div",{className:"actions",children:m.jsx("button",{className:"btn",onClick:()=>{DT().then(t).catch(()=>{})},children:"Remove saved token"})})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const oH={env:"ORX_DATA_DIR environment variable",config:"your saved setting",xdg:"XDG_DATA_HOME",default:"default location"};function lH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(""),[c,l]=P.useState(!1),[u,h]=P.useState(null),[p,f]=P.useState({kind:"idle"}),[g,y]=P.useState(null),C=()=>fT().then(E=>{t(E),a(T=>T||E.current)}).catch(E=>r(E instanceof Error?E.message:String(E)));P.useEffect(()=>{C()},[]),P.useEffect(()=>VT(E=>{E.type==="progress"?f(T=>{const A=T.kind==="moving"?T.total:0;return{kind:"moving",phase:E.phase,copied:E.copiedBytes,total:E.totalBytes||A}}):E.type==="done"?(f({kind:"done",oldPathLeft:E.oldPathLeft}),h(null),a(""),C()):E.type==="error"&&f({kind:"error",message:E.error})}),[]);const w=(e==null?void 0:e.source)==="env",b=s.trim(),_=e!==null&&b===e.current;async function x(){if(!(c||!b)){l(!0),y(null),h(null);try{h(await pT(b))}catch(E){y(E instanceof Error?E.message:String(E))}finally{l(!1)}}}async function S(E){if(E.preventDefault(),!(p.kind==="moving"||!b||_)&&(y(null),!!window.confirm(`Move all orx data to: +${b} -The store is copied to the new location and activated there. Active runs or chats will block the move.`))){f({kind:"moving",phase:"preparing",copied:0,total:(u==null?void 0:u.treeBytes)??0});try{await gT(_)}catch(T){f({kind:"idle"}),y(T instanceof Error?T.message:String(T))}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Storage"}),m.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",m.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Data directory"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx("span",{className:"badge",children:e.isDefault?"Default":"Custom"})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Current"}),m.jsx("span",{className:"v mono",children:e.current}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:lH[e.source]}),!e.isDefault&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Default"}),m.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),w?m.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):m.jsxs("form",{className:"form settings-form",onSubmit:S,children:[m.jsxs("label",{children:["New location",m.jsx("input",{className:"mono",type:"text",value:s,onChange:E=>{a(E.target.value),h(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:p.kind==="moving"})]}),u&&!u.error&&u.ok&&m.jsxs("p",{className:"settings-note",children:["Ready to move ",Ma(u.treeBytes??0),u.freeBytes!=null&&` — ${Ma(u.freeBytes)} free at target`,u.sameFilesystem?" (same disk, instant)":"","."]}),u&&u.ok===!1&&u.error&&m.jsx("div",{className:"error",children:u.error}),g&&m.jsx("div",{className:"error",children:g}),p.kind==="moving"&&m.jsx(v8,{value:p.copied,max:p.total,label:`${p.phase.charAt(0).toUpperCase()}${p.phase.slice(1)}…`,caption:p.total>0?m.jsxs("span",{className:"mono",children:[Ma(p.copied)," / ",Ma(p.total)]}):void 0}),p.kind==="done"&&m.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",p.oldPathLeft&&m.jsxs(m.Fragment,{children:[" ","The old copy was left at ",m.jsx("code",{children:p.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),p.kind==="error"&&m.jsxs("div",{className:"error",children:["Move failed: ",p.message]}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"button",className:"btn",onClick:x,disabled:c||!_||b||p.kind==="moving",children:c?"Checking…":"Check"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!_||b||p.kind==="moving",children:p.kind==="moving"?"Moving…":"Move data here"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const Xm=e=>e==="running"||e==="starting";function uH(e){return Xm(e.status)?dm(Date.now()-e.createdAt):e.endedAt?dm(e.endedAt-e.createdAt):"—"}function m_({instances:e,emptyLabel:t}){return e.length===0?m.jsx("p",{className:"instances-empty",children:t}):m.jsx("div",{className:"instances-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Project"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Runtime"})]})}),m.jsx("tbody",{children:e.map(n=>{var s;const r=typeof((s=n.backend)==null?void 0:s.url)=="string"?n.backend.url:void 0;return m.jsxs("tr",{children:[m.jsx("td",{children:m.jsxs("span",{className:"backend-cell",children:[m.jsx(g8,{backend:n.backend}),r&&m.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:a=>a.stopPropagation(),children:m.jsx(Sx,{size:12})})]})}),m.jsx("td",{children:n.projectName??fm(n.projectId)}),m.jsx("td",{children:m.jsx(tl,{status:n.status})}),m.jsx("td",{children:Ua(n.createdAt)}),m.jsx("td",{children:uH(n)})]},n.id)})})]})})}function hH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(!1),[,c]=P.useState(0);P.useEffect(()=>{const f=setInterval(()=>c(g=>g+1),3e4);return()=>clearInterval(f)},[]);const l=()=>{a(!0),JA().then(f=>{t(f),r(null)}).catch(f=>{r(f instanceof Error?f.message:String(f)),t(g=>g??[])}).finally(()=>a(!1))};P.useEffect(()=>l(),[]);const u=(f,g)=>g.createdAt-f.createdAt,h=e==null?void 0:e.filter(f=>Xm(f.status)).sort(u),p=e==null?void 0:e.filter(f=>!Xm(f.status)).sort(u);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-head-row",children:[m.jsx("h1",{children:"Instances"}),m.jsxs("button",{className:"btn sm",onClick:l,disabled:s,children:[m.jsx(wh,{size:12,className:s?"spin":""})," Refresh"]})]}),m.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — this machine, Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&m.jsx("div",{className:"error",children:n}),!h||!p?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsxs(m.Fragment,{children:[m.jsxs("h2",{className:"instances-section-title",children:["Running",h.length>0&&m.jsx("span",{className:"count-badge",children:h.length})]}),m.jsx(m_,{instances:h,emptyLabel:"Nothing running right now."}),m.jsx("h2",{className:"instances-section-title",children:"Past"}),m.jsx(m_,{instances:p,emptyLabel:"No past instances yet."})]})]})}const dH=[{id:"harnesses",label:"Harnesses",icon:m.jsx(Ik,{size:15})},{id:"compute",label:"Compute",icon:m.jsx(Qk,{size:15})},{id:"instances",label:"Instances",icon:m.jsx(hm,{size:15})},{id:"environment",label:"Environment",icon:m.jsx(IA,{size:15})},{id:"git",label:"Git",icon:m.jsx(cl,{size:15})},{id:"storage",label:"Storage",icon:m.jsx(pA,{size:15})}];function fH({tab:e}){return m.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&m.jsx(LI,{}),e==="compute"&&m.jsx(JI,{}),e==="environment"&&m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Environment"}),m.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),m.jsx(aH,{})]}),e==="instances"&&m.jsx(hH,{}),e==="git"&&m.jsx(oH,{}),e==="storage"&&m.jsx(cH,{})]})}function pH({skills:e,activeIndex:t,onPick:n,onHover:r}){return m.jsx("div",{className:"skill-menu",children:e.map((s,a)=>m.jsxs("button",{type:"button",className:`skill-item ${a===t?"active":""}`,onMouseDown:c=>{c.preventDefault(),n(s)},onMouseEnter:()=>r(a),children:[m.jsxs("span",{className:"skill-name",children:["/",s.name," ",m.jsx("span",{className:"skill-hint",children:s.argHint})]}),m.jsx("span",{className:"skill-desc",children:s.description})]},s.name))})}function _8(e){return e?e.split(/`([^`]+)`/).map((t,n)=>n%2===1?m.jsx("code",{className:"mono",children:t},n):t):null}const Km={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function g_(e){var r,s;const t=e.find(a=>a.agentReady);if(!t)return null;const n=((r=t.models[0])==null?void 0:r.id)??null;return{harness:t.id,model:n,permissionMode:((s=t.options)==null?void 0:s.defaultPermissionMode)??null,reasoningLevel:Lg(t,n).defaultId}}function lu(){const[e,t]=P.useState(!1),n=P.useRef(null);return P.useEffect(()=>{if(!e)return;const r=a=>{var c;(c=n.current)!=null&&c.contains(a.target)||t(!1)},s=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",s,!0)}},[e]),{open:e,setOpen:t,ref:n}}function mH({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){var w;const[s,a]=P.useState([]),{open:c,setOpen:l,ref:u}=lu(),[h,p]=P.useState("");P.useEffect(()=>{Og().then(_=>{a(_),n==null||n(_)}).catch(()=>{})},[]);const f=P.useMemo(()=>{const _=h.trim().toLowerCase();return(r&&e?s.filter(x=>x.id===e.harness):s).map(x=>{let S=x.models;return _?S=S.filter(E=>E.id.toLowerCase().includes(_)):x.id==="opencode"&&(S=S.slice(0,6)),{harness:x,models:S,hidden:_?0:x.models.length-S.length}})},[s,h,r,e]),g=(_,b)=>{var S;const x=(e==null?void 0:e.harness)===_.id;t({harness:_.id,model:b,permissionMode:x?e.permissionMode:((S=_.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:Ix(_,b,x?e.reasoningLevel:null)}),l(!1),p("")},y=(e==null?void 0:e.model)!=null?(w=s.find(_=>_.id===e.harness))==null?void 0:w.models.find(_=>_.id===e.model):void 0,C=e?e.model?y?Ch(y):Hx(e.model):"Default model":"Model";return m.jsxs("div",{className:"model-picker","data-onboarding":"model-picker",ref:u,children:[m.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>l(_=>!_),children:[C,m.jsx(Pa,{size:12})]}),c&&m.jsxs("div",{className:"model-menu align-right",children:[m.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:h,onChange:_=>p(_.target.value)}),m.jsxs("div",{className:"model-menu-list",children:[f.map(({harness:_,models:b,hidden:x})=>m.jsxs("div",{children:[m.jsx("div",{className:"model-group",children:_.name}),_.agentReady?m.jsxs(m.Fragment,{children:[_.models.length===0&&m.jsxs("button",{className:"model-item",onClick:()=>g(_,null),children:[m.jsxs("span",{children:["Default model",m.jsx("span",{className:"model-id",children:"CLI configuration"})]}),(e==null?void 0:e.harness)===_.id&&(e==null?void 0:e.model)===null&&m.jsx(Zr,{size:13})]}),b.map(S=>m.jsxs("button",{className:"model-item",title:S.id,onClick:()=>g(_,S.id),children:[m.jsxs("span",{children:[Ch(S),m.jsx("span",{className:"model-id",children:S.description??S.id})]}),(e==null?void 0:e.harness)===_.id&&(e==null?void 0:e.model)===S.id&&m.jsx(Zr,{size:13})]},S.id)),x>0&&m.jsxs("div",{className:"model-more",children:[x," more — search to find"]}),h.trim().length>0&&!_.models.some(S=>S.id===h.trim())&&m.jsx("button",{className:"model-item",onClick:()=>g(_,h.trim()),children:m.jsxs("span",{children:["Use “",h.trim(),"”",m.jsx("span",{className:"model-id",children:"pass as the model id"})]})})]}):m.jsx("div",{className:"model-more",children:_.agentNote?_8(_.agentNote):"Not available"})]},_.id)),s.length===0&&m.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&s.length>1&&m.jsxs("div",{className:"model-locked-note",children:[m.jsx(_A,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function v_({choices:e,value:t,defaultId:n,header:r,align:s="left",variant:a="pill",title:c,numbered:l=!1,onSelect:u}){var S,E;const{open:h,setOpen:p,ref:f}=lu();if(e.length===0)return null;const g=t??n??((S=e[0])==null?void 0:S.id)??null,y=e.find(T=>T.id===g),C=e.find(T=>T.id===n),w=C&&C.id===Eh?C:void 0,_=w?e.filter(T=>T.id!==w.id):e,b=(y==null?void 0:y.label)??((E=e[0])==null?void 0:E.label)??"",x=T=>{u(T),p(!1)};return m.jsxs("div",{className:"option-picker",ref:f,children:[m.jsxs("button",{type:"button",className:a==="pill"?"composer-pill":"composer-bare",title:c,onClick:()=>p(T=>!T),children:[b,m.jsx(Pa,{size:12})]}),h&&m.jsxs("div",{className:`option-menu ${s==="right"?"align-right":""}`,children:[r&&m.jsx("div",{className:"model-group",children:r}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{className:"model-item",onClick:()=>x(w.id),children:[m.jsxs("span",{children:[w.label,m.jsx("span",{className:"option-default",children:w.label==="Default"?" · CLI configuration":" · Default"})]}),g===w.id&&m.jsx(Zr,{size:13})]}),m.jsx("div",{className:"option-sep"})]}),_.map((T,A)=>m.jsxs("button",{className:"model-item",onClick:()=>x(T.id),children:[m.jsxs("span",{children:[T.label,!w&&T.id===n&&m.jsx("span",{className:"option-default",children:" · Default"})]}),g===T.id?m.jsx(Zr,{size:13}):l&&m.jsx("span",{className:"option-num",children:A+1})]},T.id))]})]})}function gH(e){return e>=95?"var(--accent-red)":e>=80?"var(--accent-amber)":"var(--accent)"}const Zm=6.5,y_=2*Math.PI*Zm;function vH({usage:e}){const{open:t,setOpen:n,ref:r}=lu();if(!e)return null;const{usedTokens:s,contextWindow:a}=e,c=a&&a>0?Math.min(100,Math.round(s/a*100)):null,l=c===null?"var(--accent)":gH(c);return m.jsxs("div",{className:"option-picker",ref:r,children:[m.jsx("button",{type:"button",className:"composer-bare context-ring",title:"Context window used",onClick:()=>n(u=>!u),children:c===null?A0(s):m.jsxs("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:[m.jsx("circle",{cx:"8",cy:"8",r:Zm,fill:"none",stroke:"var(--border)",strokeWidth:"2.5"}),m.jsx("circle",{cx:"8",cy:"8",r:Zm,fill:"none",stroke:l,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${y_*Math.max(c,2)/100} ${y_}`,transform:"rotate(-90 8 8)"})]})}),t&&m.jsxs("div",{className:"option-menu align-right context-meter-menu",children:[m.jsxs("div",{className:"context-meter-head",children:[m.jsx("span",{children:"Context window"}),m.jsx("span",{className:"context-meter-value",children:c===null?`${A0(s)} tokens`:`${A0(s)} / ${A0(a)} (${c}%)`})]}),c!==null&&m.jsx(v8,{value:s,max:a,fillColor:l})]})]})}const x8="orx:agent-selection";function yH(){try{const e=localStorage.getItem(x8);return e?JSON.parse(e):null}catch{return null}}const Gv="local-";function bH(e,t){const n=e.findIndex(s=>s.id===t.id);if(n>=0){const s=e.slice();return s[n]=t,s}return[...t.role==="user"?e.filter(s=>!s.id.startsWith(Gv)):e,t]}function _H(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return t.onlyIfAbsent&&t.sessionId in e.messagesBySession?e:{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:bH(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((a,c)=>r.push({id:`img${c}`,type:"image",text:a}));const s={id:`${Gv}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,s]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":{const n=new Set(t.sessions),r=new Set(t.known);for(const s of e.busySessions)r.has(s)||n.add(s);return{...e,busySessions:n}}case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function xH({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?m.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):m.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function xd(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function SH(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function b_(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Vv(e){var c,l;const t=e.tool??"tool",n=((c=e.state)==null?void 0:c.input)??{},r=typeof n.command=="string"?n.command:null,s=typeof n.filePath=="string"?n.filePath:null,a=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return s?`Read ${b_(s)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return s?`Edited ${b_(s)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebSearch":{if(typeof n.query=="string"&&n.query)return`Searched the web: “${n.query}”`;const u=typeof n.url=="string"?n.url:null;return typeof n.pattern=="string"&&n.pattern&&u?`Searched “${n.pattern}” in ${u}`:u?`Opened ${u}`:n.type==="other"?"Browsed the web":a??"Searched the web"}case"WebFetch":return typeof n.url=="string"?`Fetched ${n.url}`:a??"Fetched a page";case"Task":return a??"Ran a subagent";case"subagent":return wH(n);case"error":return"Error";case"interrupted":return"Interrupted";default:{const u=a??s??r??((l=e.state)==null?void 0:l.title)??"";return u?`${t}: ${u}`:t}}}function wH(e){const t=r=>r.length>60?`${r.slice(0,60)}…`:r,n=typeof e.prompt=="string"&&e.prompt?` — “${t(e.prompt)}”`:"";switch(typeof e.tool=="string"?e.tool:""){case"spawnAgent":return`Spawned agent${n}`;case"sendInput":return`Sent input to agent${n}`;case"resumeAgent":return"Resumed agent";case"wait":return"Waiting on agent";case"closeAgent":return"Closed agent"}switch(typeof e.kind=="string"?e.kind:""){case"started":return"Sub-agent started";case"interacted":return"Sub-agent activity";case"interrupted":return"Sub-agent interrupted"}return"Sub-agent"}function __({part:e,onOpenFile:t}){var l,u;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",s=typeof((l=n==null?void 0:n.input)==null?void 0:l.command)=="string"?n.input.command:null,a=typeof((u=n==null?void 0:n.input)==null?void 0:u.filePath)=="string"?n.input.filePath:null,c=!!(r||s||a);return m.jsxs("details",{className:"tool-row",open:!1,children:[m.jsxs("summary",{children:[m.jsx("span",{className:xd(n==null?void 0:n.status)}),m.jsx("span",{className:"tool-line",children:Vv(e)}),a&&t&&m.jsx("button",{className:"tool-open file-link",title:`Open ${a}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),t(a)},children:"open"})]}),c&&m.jsxs("div",{className:"tool-detail",children:[s&&m.jsx("div",{className:"tool-cmd-full",children:s}),r&&m.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function CH({parts:e,onOpenFile:t}){const n=e.some(u=>{var h;return((h=u.state)==null?void 0:h.status)==="running"}),r=e.some(u=>{var h;return((h=u.state)==null?void 0:h.status)==="error"}),[s,a]=P.useState(!1);if(e.length===1)return m.jsx("div",{className:`tool-group ${r?"has-error":""}`,children:m.jsx(__,{part:e[0],onOpenFile:t})});const c=s||n,l=`Used ${e.length} tools`;return m.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[m.jsxs("button",{className:"tool-group-summary",onClick:()=>a(u=>!u),children:[m.jsx("span",{className:xd(n?"running":r?"error":"completed")}),m.jsx("span",{className:"tool-line",children:l}),m.jsx(Qc,{size:12,className:`tool-chevron ${c?"open":""}`})]}),c&&m.jsx("div",{className:"tool-group-rows",children:e.map(u=>m.jsx(__,{part:u,onOpenFile:t},u.id))})]})}function EH({part:e,onRespond:t,onOpenFile:n,onOpenPlan:r}){var p,f,g;const s=e.prompt,[a,c]=P.useState([]),l=!t,u=y=>t==null?void 0:t({promptId:e.id,...y});if(s.resolved){if(s.kind==="permission")return null;if(s.kind==="plan"){const C=s.approved===!0?"Plan approved":s.approved===!1?s.note?"Revision requested":"Rejected":"Resolved",w=s.approved===!0?"approved":s.approved===!1?s.note?"revised":"rejected":"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:s.synthesized?"Plan":"Proposed plan"}),m.jsx("span",{className:`prompt-outcome ${w}`,children:C})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[m.jsx(zc,{text:s.plan??"",onOpenFile:n}),s.note&&m.jsx("div",{className:"prompt-collapsed-note",children:s.note})]})]})}const y=(s.answers??[]).join(", ")||s.note||"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:s.header||s.question||"Question"}),m.jsx("span",{className:`prompt-outcome ${y?"chosen":""}`,children:y||"Resolved"})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[s.header&&s.question&&m.jsx("div",{className:"prompt-q",children:s.question}),(s.options??[]).length>0&&m.jsx("ul",{className:"prompt-collapsed-options",children:(s.options??[]).map(C=>{var w;return m.jsx("li",{className:(w=s.answers)!=null&&w.includes(C.label)?"sel":"",children:C.label},C.label)})}),s.note&&s.note!==y&&m.jsx("div",{className:"prompt-collapsed-note",children:s.note})]})]})}if(s.kind==="plan"){const y=!!r;return m.jsxs("div",{className:`prompt-card plan ${l?"readonly":""}`,children:[m.jsx("div",{className:"prompt-head",children:s.synthesized?"Plan mode — ready to proceed?":"Proposed plan"}),m.jsx("div",{className:`prompt-plan ${y?"clamped":""}`,children:m.jsx(zc,{text:s.plan??"",onOpenFile:n})}),y&&m.jsx("button",{className:"prompt-plan-open",onClick:()=>r(s.plan??"",e.id),children:"View full plan"}),!l&&!y&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>u({approve:!0,resumeMode:"auto"}),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-ghost",onClick:()=>u({approve:!0,resumeMode:"bypass"}),children:"Accept and bypass all"}),m.jsx("button",{className:"btn-ghost",onClick:()=>u({approve:!1}),children:"Reject"})]})]})}if(s.kind==="permission"){const y=typeof((p=s.toolInput)==null?void 0:p.command)=="string"&&s.toolInput.command||typeof((f=s.toolInput)==null?void 0:f.filePath)=="string"&&s.toolInput.filePath||"",C=typeof((g=s.toolInput)==null?void 0:g.reason)=="string"&&s.toolInput.reason||"";return m.jsxs("div",{className:`prompt-card permission ${l?"readonly":""}`,children:[m.jsxs("div",{className:"prompt-head",children:["Permission needed: ",m.jsx("code",{children:s.tool})]}),y&&m.jsx("div",{className:"prompt-sub",children:y}),C&&m.jsx("div",{className:"prompt-sub",children:C}),!l&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>u({approve:!0}),children:"Allow"}),m.jsx("button",{className:"btn-ghost",onClick:()=>u({approve:!1}),children:"Deny"})]})]})}const h=y=>c(C=>s.multiSelect?C.includes(y)?C.filter(w=>w!==y):[...C,y]:[y]);return m.jsxs("div",{className:`prompt-card question ${l?"readonly":""}`,children:[s.header&&m.jsx("div",{className:"prompt-head",children:s.header}),s.question&&m.jsx("div",{className:"prompt-q",children:s.question}),m.jsx("div",{className:"prompt-options",children:(s.options??[]).map(y=>{const C=a.includes(y.label);return m.jsxs("button",{className:`prompt-option ${C?"sel":""}`,disabled:l,onClick:()=>l?void 0:s.multiSelect?h(y.label):u({answers:[y.label]}),children:[m.jsx("span",{className:"prompt-option-label",children:y.label}),y.description&&m.jsx("span",{className:"prompt-option-desc",children:y.description})]},y.label)})}),s.multiSelect&&!l&&m.jsx("div",{className:"prompt-actions",children:m.jsx("button",{className:"btn-primary",disabled:a.length===0,onClick:()=>u({answers:a}),children:"Submit"})})]})}function S8(e){return e.type==="prompt"?!!e.prompt&&!(e.prompt.resolved&&e.prompt.kind==="permission"):e.type==="text"||e.type==="reasoning"?!!e.text:!0}function kH(e){return e.role==="user"?!0:e.parts.some(S8)}const AH=P.memo(function({message:t,onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a,skills:c}){if(t.role==="user"){const l=t.parts.filter(f=>f.type==="text").map(f=>f.text??"").join(` -`),u=l.match(/^\/(\S+)([\s\S]*)$/),h=u?c==null?void 0:c.find(f=>f.name===u[1]):void 0,p=t.parts.filter(f=>f.type==="image"&&f.text).map(f=>f.text.startsWith("data:")?f.text:PT(f.text));return m.jsxs("div",{className:"msg-user",children:[h?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"skill-chip",children:["/",h.name]}),u[2]]}):l,p.length>0&&m.jsx("div",{className:"msg-images",children:p.map((f,g)=>m.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:m.jsx("img",{src:f,alt:"attachment"})},g))})]})}return m.jsx("div",{className:"msg-assistant",children:w8(t.parts,{onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a})})});function w8(e,t){var h;const{onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a}=t,c=[];let l=[];const u=()=>{l.length!==0&&(c.push(m.jsx(CH,{parts:l,onOpenFile:n},`tg-${l[0].id}`)),l=[])};for(const p of e)if(S8(p)){if(p.type==="tool"&&(p.tool==="subagent"||(((h=p.children)==null?void 0:h.length)??0)>0)){u(),c.push(m.jsx(NH,{part:p,onOpenSubagent:a},p.id));continue}if(p.type==="tool"){l.push(p);continue}u(),p.type==="text"?c.push(m.jsx(zc,{text:p.text,onOpenFile:n},p.id)):p.type==="reasoning"?c.push(m.jsxs("details",{className:"reasoning",children:[m.jsx("summary",{children:"thinking…"}),p.text]},p.id)):p.type==="prompt"&&p.prompt&&c.push(m.jsx(EH,{part:p,onRespond:r,onOpenFile:n,onOpenPlan:s},p.id))}return u(),c}function C8(e,t){for(const n of e){if(n.id===t)return n;const r=n.children&&C8(n.children,t);if(r)return r}return null}function TH({spawn:e,onOpenFile:t,onOpenSubagent:n}){var c,l;const r=e.children??[],s=((c=e.state)==null?void 0:c.status)==="running",a=w8(r,{onOpenFile:t,onOpenSubagent:n});return m.jsxs("div",{className:"msg-assistant",children:[m.jsxs("div",{className:"subagent-tab-header",children:[m.jsx("span",{className:xd((l=e.state)==null?void 0:l.status)}),m.jsx("span",{className:"tool-line",children:Vv(e)}),s&&m.jsx("span",{className:"subagent-live",children:"live"})]}),a.length===0?m.jsx("div",{className:"subagent-empty",children:s?"Working…":"No activity"}):a]})}function NH({part:e,onOpenSubagent:t}){var r,s;const n=((r=e.state)==null?void 0:r.status)==="error";return m.jsxs("button",{className:`subagent-row ${n?"has-error":""}`,title:"Open sub-agent transcript",onClick:()=>t==null?void 0:t(e.id),disabled:!t,children:[m.jsx(Nx,{size:12,className:"subagent-icon"}),m.jsx("span",{className:xd((s=e.state)==null?void 0:s.status)}),m.jsx("span",{className:"tool-line",children:Vv(e)}),m.jsx(Qc,{size:12,className:"subagent-row-chevron"})]})}const MH=P.memo(function({messages:t,onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a,skills:c}){return m.jsx(m.Fragment,{children:t.filter(kH).map(l=>m.jsx(AH,{message:l,onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a,skills:c},l.id))})}),x_=(e,t)=>e==="all"?!0:e==="archived"?t:!t,E8=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function DH({value:e,onChange:t}){const{open:n,setOpen:r,ref:s}=lu();return m.jsxs("div",{className:"rail-filter",ref:s,children:[m.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(a=>!a),children:m.jsx(BA,{size:13})}),n&&m.jsx("div",{className:"option-menu drop-down align-right",children:E8.map(a=>m.jsxs("button",{className:"model-item",onClick:()=>{t(a.id),r(!1)},children:[m.jsx("span",{children:a.label}),e===a.id&&m.jsx(Zr,{size:13})]},a.id))})]})}const RH=14,jH=500,LH=1200;function k8({title:e,animate:t}){return t?m.jsx("span",{className:"title-reveal","aria-label":e,children:Array.from(e).map((n,r)=>n===" "?m.jsx("span",{"aria-hidden":!0,children:n},r):m.jsx("span",{"aria-hidden":!0,className:"title-reveal-char",style:{animationDelay:`${Math.min(r*RH,jH)}ms`},children:n},r))}):m.jsx(m.Fragment,{children:e})}function OH({session:e,active:t,busy:n,waiting:r,revealTitle:s,onOpen:a,onRename:c,onSetArchived:l,onDelete:u}){var E;const{open:h,setOpen:p,ref:f}=lu(),g=((E=e.title)==null?void 0:E.trim())||"Untitled",[y,C]=P.useState(!1),[w,_]=P.useState(""),b=P.useRef(null);function x(){var T;_(((T=e.title)==null?void 0:T.trim())||""),C(!0)}function S(){var A;const T=w.trim();C(!1),T&&T!==(((A=e.title)==null?void 0:A.trim())||"")&&c(T)}return P.useEffect(()=>{var T,A;y&&((T=b.current)==null||T.focus(),(A=b.current)==null||A.select())},[y]),m.jsxs("div",{ref:f,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${h?"menu-open":""} ${y?"editing":""}`,title:`${Km[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{y||(h?p(!1):a())},onKeyDown:T=>{T.target===T.currentTarget&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),h?p(!1):a())},children:[m.jsx("span",{className:"session-dot",children:n&&m.jsx("span",{className:`busy-dot ${r?"waiting":""}`})}),y?m.jsx("input",{ref:b,className:"session-title-input","aria-label":"Session title",value:w,onChange:T=>_(T.target.value),onClick:T=>T.stopPropagation(),onBlur:S,onKeyDown:T=>{T.stopPropagation(),T.key==="Enter"?(T.preventDefault(),S()):T.key==="Escape"&&(T.preventDefault(),C(!1))}}):m.jsx("span",{className:"session-title",children:m.jsx(k8,{title:g,animate:s!==void 0},s??"static")}),m.jsx("span",{className:"session-time",children:SH(e.updatedAt)}),m.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:T=>{T.stopPropagation(),p(A=>!A)},children:m.jsx(xx,{size:14})}),h&&m.jsxs("div",{className:"option-menu drop-down session-menu",children:[m.jsx("button",{className:"model-item",onClick:T=>{T.stopPropagation(),p(!1),x()},children:m.jsx("span",{children:"Rename"})}),m.jsx("button",{className:"model-item",onClick:T=>{T.stopPropagation(),p(!1),l(!e.archived)},children:m.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),m.jsx("button",{className:"model-item danger",onClick:T=>{T.stopPropagation(),p(!1),u()},children:m.jsx("span",{children:"Delete"})})]})]})}function BH({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:s,mainView:a,onSelectMainView:c,panelOpen:l,onTogglePanel:u,onOpenFile:h,onOpenPlan:p,onOpenSubagent:f,onOpenWorktree:g,onStartTour:y,onActiveSessionChange:C,children:w}){var ds,ti,ni;const[_,b]=P.useState([]),[x,S]=P.useState(null),[E,T]=P.useState("active"),[A,D]=P.useState(""),[M,R]=P.useState([]),[z,H]=P.useReducer(_H,{messagesBySession:{},busySessions:new Set}),[q,$]=P.useState([]),[U,K]=P.useState(yH),[Y,Q]=P.useState({}),[ee,B]=P.useState(new Map),L=P.useRef(new Map),O=P.useRef(new Set),W=P.useRef(new Set),G=P.useRef(0),ie=P.useRef([]),fe=P.useRef(null),pe=P.useRef(null),te=P.useRef(!0),V=P.useRef(null),[ae,oe]=P.useState([]),[be,he]=P.useState(0),[Se,Te]=P.useState(!1),[Re,He]=P.useState(null),ze=P.useRef(null),[zt,At]=P.useState(0);P.useLayoutEffect(()=>{At(Re&&ze.current?ze.current.offsetWidth+8:0),Tt()},[Re]);function Tt(){var ue;ze.current&&(ze.current.style.transform=`translateY(${-(((ue=V.current)==null?void 0:ue.scrollTop)??0)}px)`)}const Gt=P.useRef(!1);P.useEffect(()=>{BT().then(oe).catch(()=>{})},[]);const tn=!Re&&A.startsWith("/")&&!/\s/.test(A)?A.slice(1):null,mt=tn!==null&&!Se?ae.filter(ue=>ue.name.startsWith(tn.toLowerCase())):[],ct=mt.length>0,xt=Math.min(be,Math.max(0,mt.length-1));P.useEffect(()=>he(0),[tn]);function _e(ue){var ke;He(ue),D(""),(ke=V.current)==null||ke.focus()}function Ne(){var ue;He(null),(ue=V.current)==null||ue.focus()}function Pe(ue){for(const ke of ue){if(!/^image\/(png|jpeg|gif|webp)$/.test(ke.type))continue;const De=new FileReader;De.onload=()=>{const Fe=De.result;R(Je=>[...Je,{dataUrl:Fe,mediaType:ke.type}])},De.readAsDataURL(ke)}}function Qe(ue){const ke=Array.from(ue.clipboardData.items).filter(De=>De.kind==="file"&&De.type.startsWith("image/")).map(De=>De.getAsFile()).filter(De=>De!==null);ke.length>0&&(ue.preventDefault(),Pe(ke))}const Ye=_.find(ue=>ue.id===x),Rt=Ye?{harness:Ye.harness,model:Y.model??Ye.model,permissionMode:Y.permissionMode??Ye.permissionMode,reasoningLevel:Y.reasoningLevel??Ye.reasoningLevel}:U??g_(q),lt=Rt?q.find(ue=>ue.id===Rt.harness):void 0,Pt=lt==null?void 0:lt.options,ft=Rt&&{...Rt,reasoningLevel:Ix(lt,Rt.model,Rt.reasoningLevel)},pn=Lg(lt,ft==null?void 0:ft.model),St=ue=>{if(!ft)return;const ke={...ft,...ue};K(ke),localStorage.setItem(x8,JSON.stringify(ke)),Ye&&Q(De=>({...De,...ue}))},Kn=ue=>St({permissionMode:ue}),On=ue=>St({reasoningLevel:ue});ie.current=_;const Fn=P.useCallback(async()=>{const ue=ie.current.map(ke=>ke.id);try{const ke=(await oh(e)).filter(Fe=>!W.current.has(Fe.id)),De=new Set(ke.map(Fe=>Fe.id));for(const Fe of ue)De.has(Fe)||ar(Fe);return b(Fe=>{const Je=new Map(Fe.map(Vt=>[Vt.id,Vt.contextUsage]));return ke.map(Vt=>({...Vt,contextUsage:Vt.contextUsage??Je.get(Vt.id)}))}),L.current=new Map(ke.map(Fe=>[Fe.id,Fe.title])),H({type:"seedBusy",sessions:ke.filter(Fe=>Fe.busy).map(Fe=>Fe.id),known:ke.map(Fe=>Fe.id)}),ke}catch{return null}},[e]);P.useEffect(()=>{b([]),ie.current=[],S(null),D(""),He(null),R([]),H({type:"reset"}),O.current=new Set,B(new Map),L.current=new Map,Fn().then(ue=>{ue&&S(ke=>{var De;return ke??((De=ue.find(Fe=>!Fe.archived))==null?void 0:De.id)??null})})},[e,Fn]),P.useEffect(()=>{!x||O.current.has(x)||(O.current.add(x),lh(x).then(ue=>H({type:"seed",sessionId:x,messages:ue})).catch(()=>{H({type:"seed",sessionId:x,messages:[],onlyIfAbsent:!0}),O.current.delete(x)}))},[x]),P.useEffect(()=>Mc(ue=>{switch(ue.type){case"session":{if(ue.session.projectId!==e||W.current.has(ue.session.id))return;const ke=L.current.has(ue.session.id),De=L.current.get(ue.session.id)!==ue.session.title;L.current.set(ue.session.id,ue.session.title),ke&&De&&ue.session.titleSource==="generated"&&(B(Fe=>{const Je=new Map(Fe);return Je.set(ue.session.id,(Fe.get(ue.session.id)??0)+1),Je}),window.setTimeout(()=>{B(Fe=>{if(!Fe.has(ue.session.id))return Fe;const Je=new Map(Fe);return Je.delete(ue.session.id),Je})},LH)),b(Fe=>{const Je=Fe.findIndex(zn=>zn.id===ue.session.id);if(Je<0)return[ue.session,...Fe];const Vt=Fe.slice();return Vt[Je]={...ue.session,contextUsage:ue.session.contextUsage??Fe[Je].contextUsage},Vt});break}case"sessionDeleted":ar(ue.sessionId);break;case"message":G.current++,H({type:"upsertMessage",sessionId:ue.sessionId,message:ue.message});break;case"busy":H({type:"busy",sessionId:ue.sessionId,busy:ue.busy});break;case"usage":b(ke=>ke.map(De=>De.id===ue.sessionId?{...De,contextUsage:ue.usage}:De));break}}),[e]),P.useEffect(()=>Mc(ue=>{if(ue.type!=="reconnected"||(Fn(),!x||!O.current.has(x)))return;const ke=De=>{const Fe=G.current;lh(x).then(Je=>{H({type:"seed",sessionId:x,messages:Je}),De&&G.current!==Fe&&ke(!1)}).catch(()=>{})};ke(!0)}),[x,Fn]);const Zt=x?z.messagesBySession[x]??[]:[],bn=x?z.busySessions.has(x):!1,Pn=!!x&&!(x in z.messagesBySession),Zn=P.useMemo(()=>{const ue=new Set;for(const ke of z.busySessions)(z.messagesBySession[ke]??[]).some(De=>De.parts.some(Fe=>Fe.type==="prompt"&&Fe.prompt&&!Fe.prompt.resolved&&Fe.prompt.nativeId))&&ue.add(ke);return ue},[z.busySessions,z.messagesBySession]),Jr=x?Zn.has(x):!1,It=Ye,ji=It?ee.get(It.id):void 0,Mn=P.useMemo(()=>{var ue;for(let ke=Zt.length-1;ke>=0;ke--)for(const De of Zt[ke].parts)if(De.type==="prompt"&&((ue=De.prompt)==null?void 0:ue.kind)==="plan"&&!De.prompt.resolved)return{promptId:De.id,plan:De.prompt.plan??"",synthesized:!!De.prompt.synthesized};return null},[Zt]),sr=P.useMemo(()=>{const ue=It==null?void 0:It.harness;if(!x||ue!=="claude-code"&&ue!=="codex")return null;for(let ke=Zt.length-1;ke>=0;ke--)for(const De of Zt[ke].parts)if(!(De.type!=="prompt"||!De.prompt||De.prompt.resolved)&&De.prompt.kind==="question")return De.prompt.nativeId&&!z.busySessions.has(x)?null:De.id;return null},[Zt,It==null?void 0:It.harness,x,z.busySessions]),[Dn,ye]=P.useState(null),Ie=Dn&&Dn.sessionId===x?Dn:null;P.useEffect(()=>{if(!Dn)return;const ue=z.busySessions.has(Dn.sessionId),ke=Dn.sessionId===x&&Mn&&Mn.promptId!==Dn.promptId;(!ue||ke)&&ye(null)},[Dn,Mn,z.busySessions,x]);const Ke=P.useMemo(()=>p&&x?(ue,ke)=>p(ue,x,ke):void 0,[p,x]),rt=P.useMemo(()=>f&&x?ue=>f(x,ue):void 0,[f,x]),Nt=P.useMemo(()=>h&&(ue=>h(ue,x??void 0)),[h,x]);P.useEffect(()=>Q({}),[x]),P.useEffect(()=>{C==null||C(x)},[x,C]);const mn=a==="chat"&&(Zt.length>0||bn);P.useLayoutEffect(()=>{te.current=!0;const ue=fe.current;ue&&(ue.scrollTop=ue.scrollHeight)},[x,mn]),P.useLayoutEffect(()=>{const ue=fe.current;ue&&te.current&&(ue.scrollTop=ue.scrollHeight)},[Zt,bn]),P.useEffect(()=>{const ue=fe.current,ke=pe.current;if(!ue||!ke)return;const De=new ResizeObserver(()=>{te.current&&(ue.scrollTop=ue.scrollHeight)});return De.observe(ke),De.observe(ue),()=>De.disconnect()},[mn]);async function Qn(){const ue=A.trim(),ke=Re?`/${Re.name}${ue?` ${ue}`:""}`:ue,De=M;if(!ke&&De.length===0)return;if(ke&&sr&&De.length===0){D(""),He(null),Fr({promptId:sr,answers:[],note:ke}).then(Vt=>{Vt||D(zn=>zn||ke)});return}if(bn)return;const Fe=ft;if(!Fe&&!x)return;D(""),He(null),R([]);let Je=x;try{if(!Je){const _n=await zT(e,Fe.harness,{model:Fe.model,permissionMode:Fe.permissionMode,reasoningLevel:Fe.reasoningLevel});O.current.add(_n.id),b(or=>[_n,...or]),S(_n.id),Je=_n.id}H({type:"optimisticUser",sessionId:Je,text:ke,imageUrls:De.map(_n=>_n.dataUrl)}),H({type:"busy",sessionId:Je,busy:!0}),te.current=!0,E==="archived"&&T("active");const Vt=Fe?{model:Fe.model,permissionMode:Fe.permissionMode,reasoningLevel:Fe.reasoningLevel}:{};Q({});const zn=De.map(_n=>({mediaType:_n.mediaType,dataBase64:_n.dataUrl.slice(_n.dataUrl.indexOf(",")+1)}));await $T(Je,ke,Vt,zn.length?zn:void 0)}catch(Vt){if(D(_n=>_n||ke),R(_n=>_n.length?_n:De),!Je)return;const zn=Vt instanceof Error?Vt.message:String(Vt);if(!/session is busy/i.test(zn)&&await oh(e).then(or=>{var fs;return!!((fs=or.find(yl=>yl.id===Je))!=null&&fs.busy)}).catch(()=>!1)){D(or=>or===ke?"":or),R(or=>or===De?[]:or);return}H({type:"busy",sessionId:Je,busy:!1}),H({type:"upsertMessage",sessionId:Je,message:{id:`${Gv}senderr-${Date.now()}`,role:"assistant",parts:[{id:"p0",type:"tool",tool:"error",state:{status:"error",error:`Message not sent: ${zn}`}}],createdAt:Date.now()}})}}function Hr(){x&&UT(x)}P.useEffect(()=>{if(!bn||a!=="chat")return;function ue(ke){var De;ke.key!=="Escape"||ke.defaultPrevented||(ke.preventDefault(),Hr(),(De=V.current)==null||De.focus())}return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[bn,x,a]);function ar(ue){W.current.add(ue),b(ke=>ke.filter(De=>De.id!==ue)),S(ke=>ke===ue?null:ke),O.current.delete(ue),L.current.delete(ue),H({type:"forget",sessionId:ue})}function gn(ue,ke){const De=ue.archived;b(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,archived:ke}:Je)),x_(E,ke)||S(Fe=>Fe===ue.id?null:Fe),HT(ue.id,ke).catch(()=>{b(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,archived:De}:Je))})}function Bn(ue,ke){const De=ue.title;b(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,title:ke}:Je)),FT(ue.id,ke).catch(()=>{b(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,title:De}:Je))})}async function ei(ue){var De;const ke=((De=ue.title)==null?void 0:De.trim())||"Untitled";if(window.confirm(`Delete "${ke}"? +The store is copied to the new location and activated there. Active runs or chats will block the move.`))){f({kind:"moving",phase:"preparing",copied:0,total:(u==null?void 0:u.treeBytes)??0});try{await mT(b)}catch(T){f({kind:"idle"}),y(T instanceof Error?T.message:String(T))}}}return m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Storage"}),m.jsxs("p",{className:"settings-sub",children:["Where orx keeps everything on this machine — the local database, run logs, artifacts, and chat attachments for ",m.jsx("strong",{children:"all"})," projects. Moving it copies the whole store to the new location and activates it there."]}),n?m.jsx("div",{className:"settings-card",children:m.jsx("div",{className:"error",children:n})}):e?m.jsxs("div",{className:"settings-card",children:[m.jsxs("div",{className:"settings-card-head",children:[m.jsx("h3",{children:"Data directory"}),m.jsx("div",{className:"spacer",style:{flex:1}}),m.jsx("span",{className:"badge",children:e.isDefault?"Default":"Custom"})]}),m.jsxs("div",{className:"kv",children:[m.jsx("span",{className:"k",children:"Current"}),m.jsx("span",{className:"v mono",children:e.current}),m.jsx("span",{className:"k",children:"Source"}),m.jsx("span",{className:"v",children:oH[e.source]}),!e.isDefault&&m.jsxs(m.Fragment,{children:[m.jsx("span",{className:"k",children:"Default"}),m.jsx("span",{className:"v mono",children:e.defaultPath})]})]}),w?m.jsxs("p",{className:"settings-note",children:["The data directory is pinned by the ",m.jsx("code",{children:"ORX_DATA_DIR"})," environment variable, which overrides this setting. Unset it to choose a location here."]}):m.jsxs("form",{className:"form settings-form",onSubmit:S,children:[m.jsxs("label",{children:["New location",m.jsx("input",{className:"mono",type:"text",value:s,onChange:E=>{a(E.target.value),h(null)},placeholder:"/absolute/path/to/openresearch",autoComplete:"off",spellCheck:!1,disabled:p.kind==="moving"})]}),u&&!u.error&&u.ok&&m.jsxs("p",{className:"settings-note",children:["Ready to move ",Ma(u.treeBytes??0),u.freeBytes!=null&&` — ${Ma(u.freeBytes)} free at target`,u.sameFilesystem?" (same disk, instant)":"","."]}),u&&u.ok===!1&&u.error&&m.jsx("div",{className:"error",children:u.error}),g&&m.jsx("div",{className:"error",children:g}),p.kind==="moving"&&m.jsx(g8,{value:p.copied,max:p.total,label:`${p.phase.charAt(0).toUpperCase()}${p.phase.slice(1)}…`,caption:p.total>0?m.jsxs("span",{className:"mono",children:[Ma(p.copied)," / ",Ma(p.total)]}):void 0}),p.kind==="done"&&m.jsxs("p",{className:"settings-note",children:["Moved. orx is now using the new location.",p.oldPathLeft&&m.jsxs(m.Fragment,{children:[" ","The old copy was left at ",m.jsx("code",{children:p.oldPathLeft})," (different disk) — you can delete it once you've confirmed everything works."]})]}),p.kind==="error"&&m.jsxs("div",{className:"error",children:["Move failed: ",p.message]}),m.jsxs("div",{className:"actions",children:[m.jsx("button",{type:"button",className:"btn",onClick:x,disabled:c||!b||_||p.kind==="moving",children:c?"Checking…":"Check"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!b||_||p.kind==="moving",children:p.kind==="moving"?"Moving…":"Move data here"})]})]})]}):m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]})]})}const Km=e=>e==="running"||e==="starting";function cH(e){return Km(e.status)?fm(Date.now()-e.createdAt):e.endedAt?fm(e.endedAt-e.createdAt):"—"}function m_({instances:e,emptyLabel:t}){return e.length===0?m.jsx("p",{className:"instances-empty",children:t}):m.jsx("div",{className:"instances-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Project"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Runtime"})]})}),m.jsx("tbody",{children:e.map(n=>{var s;const r=typeof((s=n.backend)==null?void 0:s.url)=="string"?n.backend.url:void 0;return m.jsxs("tr",{children:[m.jsx("td",{children:m.jsxs("span",{className:"backend-cell",children:[m.jsx(m8,{backend:n.backend}),r&&m.jsx("a",{className:"icon-btn",href:r,target:"_blank",rel:"noreferrer",title:"Open job page","aria-label":"Open job page",onClick:a=>a.stopPropagation(),children:m.jsx(Sx,{size:12})})]})}),m.jsx("td",{children:n.projectName??pm(n.projectId)}),m.jsx("td",{children:m.jsx(tl,{status:n.status})}),m.jsx("td",{children:Ua(n.createdAt)}),m.jsx("td",{children:cH(n)})]},n.id)})})]})})}function uH(){const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState(!1),[,c]=P.useState(0);P.useEffect(()=>{const f=setInterval(()=>c(g=>g+1),3e4);return()=>clearInterval(f)},[]);const l=()=>{a(!0),QA().then(f=>{t(f),r(null)}).catch(f=>{r(f instanceof Error?f.message:String(f)),t(g=>g??[])}).finally(()=>a(!1))};P.useEffect(()=>l(),[]);const u=(f,g)=>g.createdAt-f.createdAt,h=e==null?void 0:e.filter(f=>Km(f.status)).sort(u),p=e==null?void 0:e.filter(f=>!Km(f.status)).sort(u);return m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"settings-head-row",children:[m.jsx("h1",{children:"Instances"}),m.jsxs("button",{className:"btn sm",onClick:l,disabled:s,children:[m.jsx(wh,{size:12,className:s?"spin":""})," Refresh"]})]}),m.jsx("p",{className:"settings-sub",children:"Compute spun up across all projects — this machine, Modal, Hugging Face, SSH, Kubernetes, Slurm, and OpenResearch."}),n&&m.jsx("div",{className:"error",children:n}),!h||!p?m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):m.jsxs(m.Fragment,{children:[m.jsxs("h2",{className:"instances-section-title",children:["Running",h.length>0&&m.jsx("span",{className:"count-badge",children:h.length})]}),m.jsx(m_,{instances:h,emptyLabel:"Nothing running right now."}),m.jsx("h2",{className:"instances-section-title",children:"Past"}),m.jsx(m_,{instances:p,emptyLabel:"No past instances yet."})]})]})}const hH=[{id:"harnesses",label:"Harnesses",icon:m.jsx(zk,{size:15})},{id:"compute",label:"Compute",icon:m.jsx(Zk,{size:15})},{id:"instances",label:"Instances",icon:m.jsx(dm,{size:15})},{id:"environment",label:"Environment",icon:m.jsx(zA,{size:15})},{id:"git",label:"Git",icon:m.jsx(cl,{size:15})},{id:"storage",label:"Storage",icon:m.jsx(fA,{size:15})}];function dH({tab:e}){return m.jsxs("div",{className:"settings-view",children:[e==="harnesses"&&m.jsx(jI,{}),e==="compute"&&m.jsx(QI,{}),e==="environment"&&m.jsxs(m.Fragment,{children:[m.jsx("h1",{children:"Environment"}),m.jsx("p",{className:"settings-sub",children:"Variables available to runs and the research agent (API keys, tokens)."}),m.jsx(sH,{})]}),e==="instances"&&m.jsx(uH,{}),e==="git"&&m.jsx(aH,{}),e==="storage"&&m.jsx(lH,{})]})}function fH({skills:e,activeIndex:t,onPick:n,onHover:r}){return m.jsx("div",{className:"skill-menu",children:e.map((s,a)=>m.jsxs("button",{type:"button",className:`skill-item ${a===t?"active":""}`,onMouseDown:c=>{c.preventDefault(),n(s)},onMouseEnter:()=>r(a),children:[m.jsxs("span",{className:"skill-name",children:["/",s.name," ",m.jsx("span",{className:"skill-hint",children:s.argHint})]}),m.jsx("span",{className:"skill-desc",children:s.description})]},s.name))})}function b8(e){return e?e.split(/`([^`]+)`/).map((t,n)=>n%2===1?m.jsx("code",{className:"mono",children:t},n):t):null}const Zm={"claude-code":"Claude Code",codex:"Codex",opencode:"OpenCode"};function g_(e){var r,s;const t=e.find(a=>a.agentReady);if(!t)return null;const n=((r=t.models[0])==null?void 0:r.id)??null;return{harness:t.id,model:n,permissionMode:((s=t.options)==null?void 0:s.defaultPermissionMode)??null,reasoningLevel:Lg(t,n).defaultId}}function lu(){const[e,t]=P.useState(!1),n=P.useRef(null);return P.useEffect(()=>{if(!e)return;const r=a=>{var c;(c=n.current)!=null&&c.contains(a.target)||t(!1)},s=a=>{a.key==="Escape"&&(a.preventDefault(),a.stopPropagation(),t(!1))};return document.addEventListener("mousedown",r),document.addEventListener("keydown",s,!0),()=>{document.removeEventListener("mousedown",r),document.removeEventListener("keydown",s,!0)}},[e]),{open:e,setOpen:t,ref:n}}function pH({value:e,onSelect:t,onHarnesses:n,lockHarness:r=!1}){var w;const[s,a]=P.useState([]),{open:c,setOpen:l,ref:u}=lu(),[h,p]=P.useState("");P.useEffect(()=>{Og().then(b=>{a(b),n==null||n(b)}).catch(()=>{})},[]);const f=P.useMemo(()=>{const b=h.trim().toLowerCase();return(r&&e?s.filter(x=>x.id===e.harness):s).map(x=>{let S=x.models;return b?S=S.filter(E=>E.id.toLowerCase().includes(b)):x.id==="opencode"&&(S=S.slice(0,6)),{harness:x,models:S,hidden:b?0:x.models.length-S.length}})},[s,h,r,e]),g=(b,_)=>{var S;const x=(e==null?void 0:e.harness)===b.id;t({harness:b.id,model:_,permissionMode:x?e.permissionMode:((S=b.options)==null?void 0:S.defaultPermissionMode)??null,reasoningLevel:zx(b,_,x?e.reasoningLevel:null)}),l(!1),p("")},y=(e==null?void 0:e.model)!=null?(w=s.find(b=>b.id===e.harness))==null?void 0:w.models.find(b=>b.id===e.model):void 0,C=e?e.model?y?Ch(y):Ix(e.model):"Default model":"Model";return m.jsxs("div",{className:"model-picker","data-onboarding":"model-picker",ref:u,children:[m.jsxs("button",{type:"button",className:"composer-pill",title:"Harness + model for this chat",onClick:()=>l(b=>!b),children:[C,m.jsx(Pa,{size:12})]}),c&&m.jsxs("div",{className:"model-menu align-right",children:[m.jsx("input",{autoFocus:!0,type:"text",placeholder:"Search models…",value:h,onChange:b=>p(b.target.value)}),m.jsxs("div",{className:"model-menu-list",children:[f.map(({harness:b,models:_,hidden:x})=>m.jsxs("div",{children:[m.jsx("div",{className:"model-group",children:b.name}),b.agentReady?m.jsxs(m.Fragment,{children:[b.models.length===0&&m.jsxs("button",{className:"model-item",onClick:()=>g(b,null),children:[m.jsxs("span",{children:["Default model",m.jsx("span",{className:"model-id",children:"CLI configuration"})]}),(e==null?void 0:e.harness)===b.id&&(e==null?void 0:e.model)===null&&m.jsx(Zr,{size:13})]}),_.map(S=>m.jsxs("button",{className:"model-item",title:S.id,onClick:()=>g(b,S.id),children:[m.jsxs("span",{children:[Ch(S),m.jsx("span",{className:"model-id",children:S.description??S.id})]}),(e==null?void 0:e.harness)===b.id&&(e==null?void 0:e.model)===S.id&&m.jsx(Zr,{size:13})]},S.id)),x>0&&m.jsxs("div",{className:"model-more",children:[x," more — search to find"]}),h.trim().length>0&&!b.models.some(S=>S.id===h.trim())&&m.jsx("button",{className:"model-item",onClick:()=>g(b,h.trim()),children:m.jsxs("span",{children:["Use “",h.trim(),"”",m.jsx("span",{className:"model-id",children:"pass as the model id"})]})})]}):m.jsx("div",{className:"model-more",children:b.agentNote?b8(b.agentNote):"Not available"})]},b.id)),s.length===0&&m.jsx("div",{className:"model-more",children:"Detecting harnesses…"})]}),r&&e&&s.length>1&&m.jsxs("div",{className:"model-locked-note",children:[m.jsx(bA,{size:11}),"Sessions keep their harness — new chat to switch"]})]})]})}function v_({choices:e,value:t,defaultId:n,header:r,align:s="left",variant:a="pill",title:c,numbered:l=!1,onSelect:u}){var S,E;const{open:h,setOpen:p,ref:f}=lu();if(e.length===0)return null;const g=t??n??((S=e[0])==null?void 0:S.id)??null,y=e.find(T=>T.id===g),C=e.find(T=>T.id===n),w=C&&C.id===Eh?C:void 0,b=w?e.filter(T=>T.id!==w.id):e,_=(y==null?void 0:y.label)??((E=e[0])==null?void 0:E.label)??"",x=T=>{u(T),p(!1)};return m.jsxs("div",{className:"option-picker",ref:f,children:[m.jsxs("button",{type:"button",className:a==="pill"?"composer-pill":"composer-bare",title:c,onClick:()=>p(T=>!T),children:[_,m.jsx(Pa,{size:12})]}),h&&m.jsxs("div",{className:`option-menu ${s==="right"?"align-right":""}`,children:[r&&m.jsx("div",{className:"model-group",children:r}),w&&m.jsxs(m.Fragment,{children:[m.jsxs("button",{className:"model-item",onClick:()=>x(w.id),children:[m.jsxs("span",{children:[w.label,m.jsx("span",{className:"option-default",children:w.label==="Default"?" · CLI configuration":" · Default"})]}),g===w.id&&m.jsx(Zr,{size:13})]}),m.jsx("div",{className:"option-sep"})]}),b.map((T,A)=>m.jsxs("button",{className:"model-item",onClick:()=>x(T.id),children:[m.jsxs("span",{children:[T.label,!w&&T.id===n&&m.jsx("span",{className:"option-default",children:" · Default"})]}),g===T.id?m.jsx(Zr,{size:13}):l&&m.jsx("span",{className:"option-num",children:A+1})]},T.id))]})]})}function mH(e){return e>=95?"var(--accent-red)":e>=80?"var(--accent-amber)":"var(--accent)"}const Qm=6.5,y_=2*Math.PI*Qm;function gH({usage:e}){const{open:t,setOpen:n,ref:r}=lu();if(!e)return null;const{usedTokens:s,contextWindow:a}=e,c=a&&a>0?Math.min(100,Math.round(s/a*100)):null,l=c===null?"var(--accent)":mH(c);return m.jsxs("div",{className:"option-picker",ref:r,children:[m.jsx("button",{type:"button",className:"composer-bare context-ring",title:"Context window used",onClick:()=>n(u=>!u),children:c===null?A0(s):m.jsxs("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":"true",children:[m.jsx("circle",{cx:"8",cy:"8",r:Qm,fill:"none",stroke:"var(--border)",strokeWidth:"2.5"}),m.jsx("circle",{cx:"8",cy:"8",r:Qm,fill:"none",stroke:l,strokeWidth:"2.5",strokeLinecap:"round",strokeDasharray:`${y_*Math.max(c,2)/100} ${y_}`,transform:"rotate(-90 8 8)"})]})}),t&&m.jsxs("div",{className:"option-menu align-right context-meter-menu",children:[m.jsxs("div",{className:"context-meter-head",children:[m.jsx("span",{children:"Context window"}),m.jsx("span",{className:"context-meter-value",children:c===null?`${A0(s)} tokens`:`${A0(s)} / ${A0(a)} (${c}%)`})]}),c!==null&&m.jsx(g8,{value:s,max:a,fillColor:l})]})]})}const _8="orx:agent-selection";function vH(){try{const e=localStorage.getItem(_8);return e?JSON.parse(e):null}catch{return null}}const Gv="local-";function yH(e,t){const n=e.findIndex(s=>s.id===t.id);if(n>=0){const s=e.slice();return s[n]=t,s}return[...t.role==="user"?e.filter(s=>!s.id.startsWith(Gv)):e,t]}function bH(e,t){switch(t.type){case"reset":return{messagesBySession:{},busySessions:new Set};case"seed":return t.onlyIfAbsent&&t.sessionId in e.messagesBySession?e:{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:t.messages}};case"upsertMessage":{const n=e.messagesBySession[t.sessionId]??[];return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:yH(n,t.message)}}}case"optimisticUser":{const n=e.messagesBySession[t.sessionId]??[],r=t.text?[{id:"p0",type:"text",text:t.text}]:[];t.imageUrls.forEach((a,c)=>r.push({id:`img${c}`,type:"image",text:a}));const s={id:`${Gv}${Date.now()}`,role:"user",parts:r,createdAt:Date.now()};return{...e,messagesBySession:{...e.messagesBySession,[t.sessionId]:[...n,s]}}}case"busy":{const n=new Set(e.busySessions);return t.busy?n.add(t.sessionId):n.delete(t.sessionId),{...e,busySessions:n}}case"seedBusy":{const n=new Set(t.sessions),r=new Set(t.known);for(const s of e.busySessions)r.has(s)||n.add(s);return{...e,busySessions:n}}case"forget":{const n={...e.messagesBySession};delete n[t.sessionId];const r=new Set(e.busySessions);return r.delete(t.sessionId),{messagesBySession:n,busySessions:r}}}}function _H({harnesses:e,selection:t}){if(e.length===0)return null;const n=t?e.find(r=>r.id===t.harness):void 0;return n?m.jsxs("p",{className:"chat-empty-hint",children:["Chatting with ",n.name,n.account?` as ${n.account}`:""," — detected automatically, switch in the model picker below."]}):m.jsx("p",{className:"chat-empty-hint",children:"No coding agent detected on this machine — install Claude Code, Codex or opencode and sign in, then re-open the model picker below."})}function Sd(e){return e==="error"?"tool-status error":e==="completed"?"tool-status":"tool-status running"}function xH(e){if(!e)return"";const t=Math.max(0,Math.floor((Date.now()-e)/1e3));if(t<60)return"now";const n=Math.floor(t/60);if(n<60)return`${n}m`;const r=Math.floor(n/60);return r<24?`${r}h`:`${Math.floor(r/24)}d`}function b_(e){const t=e.replace(/\/+$/,"");return t.slice(t.lastIndexOf("/")+1)||t}function Vv(e){var c,l;const t=e.tool??"tool",n=((c=e.state)==null?void 0:c.input)??{},r=typeof n.command=="string"?n.command:null,s=typeof n.filePath=="string"?n.filePath:null,a=typeof n.description=="string"?n.description:null;switch(t){case"Bash":case"bash":return r?`Ran ${r}`:"Ran command";case"Read":return s?`Read ${b_(s)}`:"Read file";case"Edit":case"Write":case"NotebookEdit":return s?`Edited ${b_(s)}`:"Edited file";case"Grep":return typeof n.pattern=="string"?`Searched “${n.pattern}”`:"Searched";case"Glob":return typeof n.pattern=="string"?`Found ${n.pattern}`:"Listed files";case"WebSearch":{if(typeof n.query=="string"&&n.query)return`Searched the web: “${n.query}”`;const u=typeof n.url=="string"?n.url:null;return typeof n.pattern=="string"&&n.pattern&&u?`Searched “${n.pattern}” in ${u}`:u?`Opened ${u}`:n.type==="other"?"Browsed the web":a??"Searched the web"}case"WebFetch":return typeof n.url=="string"?`Fetched ${n.url}`:a??"Fetched a page";case"Task":return a??"Ran a subagent";case"subagent":return SH(n);case"error":return"Error";case"interrupted":return"Interrupted";default:{const u=a??s??r??((l=e.state)==null?void 0:l.title)??"";return u?`${t}: ${u}`:t}}}function SH(e){const t=r=>r.length>60?`${r.slice(0,60)}…`:r,n=typeof e.prompt=="string"&&e.prompt?` — “${t(e.prompt)}”`:"";switch(typeof e.tool=="string"?e.tool:""){case"spawnAgent":return`Spawned agent${n}`;case"sendInput":return`Sent input to agent${n}`;case"resumeAgent":return"Resumed agent";case"wait":return"Waiting on agent";case"closeAgent":return"Closed agent"}switch(typeof e.kind=="string"?e.kind:""){case"started":return"Sub-agent started";case"interacted":return"Sub-agent activity";case"interrupted":return"Sub-agent interrupted"}return"Sub-agent"}function __({part:e,onOpenFile:t}){var l,u;const n=e.state,r=(n==null?void 0:n.error)||(n==null?void 0:n.output)||"",s=typeof((l=n==null?void 0:n.input)==null?void 0:l.command)=="string"?n.input.command:null,a=typeof((u=n==null?void 0:n.input)==null?void 0:u.filePath)=="string"?n.input.filePath:null,c=!!(r||s||a);return m.jsxs("details",{className:"tool-row",open:!1,children:[m.jsxs("summary",{children:[m.jsx("span",{className:Sd(n==null?void 0:n.status)}),m.jsx("span",{className:"tool-line",children:Vv(e)}),a&&t&&m.jsx("button",{className:"tool-open file-link",title:`Open ${a}`,onClick:h=>{h.preventDefault(),h.stopPropagation(),t(a)},children:"open"})]}),c&&m.jsxs("div",{className:"tool-detail",children:[s&&m.jsx("div",{className:"tool-cmd-full",children:s}),r&&m.jsx("div",{className:"tool-output",children:r.slice(0,2e4)})]})]})}function wH({parts:e,onOpenFile:t}){const n=e.some(u=>{var h;return((h=u.state)==null?void 0:h.status)==="running"}),r=e.some(u=>{var h;return((h=u.state)==null?void 0:h.status)==="error"}),[s,a]=P.useState(!1);if(e.length===1)return m.jsx("div",{className:`tool-group ${r?"has-error":""}`,children:m.jsx(__,{part:e[0],onOpenFile:t})});const c=s||n,l=`Used ${e.length} tools`;return m.jsxs("div",{className:`tool-group ${r?"has-error":""}`,children:[m.jsxs("button",{className:"tool-group-summary",onClick:()=>a(u=>!u),children:[m.jsx("span",{className:Sd(n?"running":r?"error":"completed")}),m.jsx("span",{className:"tool-line",children:l}),m.jsx(Qc,{size:12,className:`tool-chevron ${c?"open":""}`})]}),c&&m.jsx("div",{className:"tool-group-rows",children:e.map(u=>m.jsx(__,{part:u,onOpenFile:t},u.id))})]})}function CH({part:e,onRespond:t,onOpenFile:n,onOpenPlan:r}){var p,f,g;const s=e.prompt,[a,c]=P.useState([]),l=!t,u=y=>t==null?void 0:t({promptId:e.id,...y});if(s.resolved){if(s.kind==="permission")return null;if(s.kind==="plan"){const C=s.approved===!0?"Plan approved":s.approved===!1?s.note?"Revision requested":"Rejected":"Resolved",w=s.approved===!0?"approved":s.approved===!1?s.note?"revised":"rejected":"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:s.synthesized?"Plan":"Proposed plan"}),m.jsx("span",{className:`prompt-outcome ${w}`,children:C})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[m.jsx(zc,{text:s.plan??"",onOpenFile:n}),s.note&&m.jsx("div",{className:"prompt-collapsed-note",children:s.note})]})]})}const y=(s.answers??[]).join(", ")||s.note||"";return m.jsxs("details",{className:"prompt-collapsed",children:[m.jsxs("summary",{children:[m.jsx("span",{className:"prompt-collapsed-title",children:s.header||s.question||"Question"}),m.jsx("span",{className:`prompt-outcome ${y?"chosen":""}`,children:y||"Resolved"})]}),m.jsxs("div",{className:"prompt-collapsed-body",children:[s.header&&s.question&&m.jsx("div",{className:"prompt-q",children:s.question}),(s.options??[]).length>0&&m.jsx("ul",{className:"prompt-collapsed-options",children:(s.options??[]).map(C=>{var w;return m.jsx("li",{className:(w=s.answers)!=null&&w.includes(C.label)?"sel":"",children:C.label},C.label)})}),s.note&&s.note!==y&&m.jsx("div",{className:"prompt-collapsed-note",children:s.note})]})]})}if(s.kind==="plan"){const y=!!r;return m.jsxs("div",{className:`prompt-card plan ${l?"readonly":""}`,children:[m.jsx("div",{className:"prompt-head",children:s.synthesized?"Plan mode — ready to proceed?":"Proposed plan"}),m.jsx("div",{className:`prompt-plan ${y?"clamped":""}`,children:m.jsx(zc,{text:s.plan??"",onOpenFile:n})}),y&&m.jsx("button",{className:"prompt-plan-open",onClick:()=>r(s.plan??"",e.id),children:"View full plan"}),!l&&!y&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>u({approve:!0,resumeMode:"auto"}),children:"Accept and auto mode"}),m.jsx("button",{className:"btn-ghost",onClick:()=>u({approve:!0,resumeMode:"bypass"}),children:"Accept and bypass all"}),m.jsx("button",{className:"btn-ghost",onClick:()=>u({approve:!1}),children:"Reject"})]})]})}if(s.kind==="permission"){const y=typeof((p=s.toolInput)==null?void 0:p.command)=="string"&&s.toolInput.command||typeof((f=s.toolInput)==null?void 0:f.filePath)=="string"&&s.toolInput.filePath||"",C=typeof((g=s.toolInput)==null?void 0:g.reason)=="string"&&s.toolInput.reason||"";return m.jsxs("div",{className:`prompt-card permission ${l?"readonly":""}`,children:[m.jsxs("div",{className:"prompt-head",children:["Permission needed: ",m.jsx("code",{children:s.tool})]}),y&&m.jsx("div",{className:"prompt-sub",children:y}),C&&m.jsx("div",{className:"prompt-sub",children:C}),!l&&m.jsxs("div",{className:"prompt-actions",children:[m.jsx("button",{className:"btn-primary",onClick:()=>u({approve:!0}),children:"Allow"}),m.jsx("button",{className:"btn-ghost",onClick:()=>u({approve:!1}),children:"Deny"})]})]})}const h=y=>c(C=>s.multiSelect?C.includes(y)?C.filter(w=>w!==y):[...C,y]:[y]);return m.jsxs("div",{className:`prompt-card question ${l?"readonly":""}`,children:[s.header&&m.jsx("div",{className:"prompt-head",children:s.header}),s.question&&m.jsx("div",{className:"prompt-q",children:s.question}),m.jsx("div",{className:"prompt-options",children:(s.options??[]).map(y=>{const C=a.includes(y.label);return m.jsxs("button",{className:`prompt-option ${C?"sel":""}`,disabled:l,onClick:()=>l?void 0:s.multiSelect?h(y.label):u({answers:[y.label]}),children:[m.jsx("span",{className:"prompt-option-label",children:y.label}),y.description&&m.jsx("span",{className:"prompt-option-desc",children:y.description})]},y.label)})}),s.multiSelect&&!l&&m.jsx("div",{className:"prompt-actions",children:m.jsx("button",{className:"btn-primary",disabled:a.length===0,onClick:()=>u({answers:a}),children:"Submit"})})]})}function x8(e){return e.type==="prompt"?!!e.prompt&&!(e.prompt.resolved&&e.prompt.kind==="permission"):e.type==="text"||e.type==="reasoning"?!!e.text:!0}function EH(e){return e.role==="user"?!0:e.parts.some(x8)}const kH=P.memo(function({message:t,onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a,skills:c}){if(t.role==="user"){const l=t.parts.filter(f=>f.type==="text").map(f=>f.text??"").join(` +`),u=l.match(/^\/(\S+)([\s\S]*)$/),h=u?c==null?void 0:c.find(f=>f.name===u[1]):void 0,p=t.parts.filter(f=>f.type==="image"&&f.text).map(f=>f.text.startsWith("data:")?f.text:FT(f.text));return m.jsxs("div",{className:"msg-user",children:[h?m.jsxs(m.Fragment,{children:[m.jsxs("span",{className:"skill-chip",children:["/",h.name]}),u[2]]}):l,p.length>0&&m.jsx("div",{className:"msg-images",children:p.map((f,g)=>m.jsx("a",{href:f,target:"_blank",rel:"noreferrer",children:m.jsx("img",{src:f,alt:"attachment"})},g))})]})}return m.jsx("div",{className:"msg-assistant",children:S8(t.parts,{onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a})})});function S8(e,t){var h;const{onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a}=t,c=[];let l=[];const u=()=>{l.length!==0&&(c.push(m.jsx(wH,{parts:l,onOpenFile:n},`tg-${l[0].id}`)),l=[])};for(const p of e)if(x8(p)){if(p.type==="tool"&&(p.tool==="subagent"||(((h=p.children)==null?void 0:h.length)??0)>0)){u(),c.push(m.jsx(TH,{part:p,onOpenSubagent:a},p.id));continue}if(p.type==="tool"){l.push(p);continue}u(),p.type==="text"?c.push(m.jsx(zc,{text:p.text,onOpenFile:n},p.id)):p.type==="reasoning"?c.push(m.jsxs("details",{className:"reasoning",children:[m.jsx("summary",{children:"thinking…"}),p.text]},p.id)):p.type==="prompt"&&p.prompt&&c.push(m.jsx(CH,{part:p,onRespond:r,onOpenFile:n,onOpenPlan:s},p.id))}return u(),c}function w8(e,t){for(const n of e){if(n.id===t)return n;const r=n.children&&w8(n.children,t);if(r)return r}return null}function AH({spawn:e,onOpenFile:t,onOpenSubagent:n}){var c,l;const r=e.children??[],s=((c=e.state)==null?void 0:c.status)==="running",a=S8(r,{onOpenFile:t,onOpenSubagent:n});return m.jsxs("div",{className:"msg-assistant",children:[m.jsxs("div",{className:"subagent-tab-header",children:[m.jsx("span",{className:Sd((l=e.state)==null?void 0:l.status)}),m.jsx("span",{className:"tool-line",children:Vv(e)}),s&&m.jsx("span",{className:"subagent-live",children:"live"})]}),a.length===0?m.jsx("div",{className:"subagent-empty",children:s?"Working…":"No activity"}):a]})}function TH({part:e,onOpenSubagent:t}){var r,s;const n=((r=e.state)==null?void 0:r.status)==="error";return m.jsxs("button",{className:`subagent-row ${n?"has-error":""}`,title:"Open sub-agent transcript",onClick:()=>t==null?void 0:t(e.id),disabled:!t,children:[m.jsx(Nx,{size:12,className:"subagent-icon"}),m.jsx("span",{className:Sd((s=e.state)==null?void 0:s.status)}),m.jsx("span",{className:"tool-line",children:Vv(e)}),m.jsx(Qc,{size:12,className:"subagent-row-chevron"})]})}const NH=P.memo(function({messages:t,onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a,skills:c}){return m.jsx(m.Fragment,{children:t.filter(EH).map(l=>m.jsx(kH,{message:l,onOpenFile:n,onRespond:r,onOpenPlan:s,onOpenSubagent:a,skills:c},l.id))})}),x_=(e,t)=>e==="all"?!0:e==="archived"?t:!t,C8=[{id:"active",label:"Active",railLabel:"Recents"},{id:"archived",label:"Archived",railLabel:"Archived"},{id:"all",label:"All",railLabel:"All sessions"}];function MH({value:e,onChange:t}){const{open:n,setOpen:r,ref:s}=lu();return m.jsxs("div",{className:"rail-filter",ref:s,children:[m.jsx("button",{className:`icon-btn rail-filter-btn ${e!=="active"?"active":""}`,title:"Filter sessions","aria-label":"Filter sessions",onClick:()=>r(a=>!a),children:m.jsx(OA,{size:13})}),n&&m.jsx("div",{className:"option-menu drop-down align-right",children:C8.map(a=>m.jsxs("button",{className:"model-item",onClick:()=>{t(a.id),r(!1)},children:[m.jsx("span",{children:a.label}),e===a.id&&m.jsx(Zr,{size:13})]},a.id))})]})}const DH=14,RH=500,jH=1200;function E8({title:e,animate:t}){return t?m.jsx("span",{className:"title-reveal","aria-label":e,children:Array.from(e).map((n,r)=>n===" "?m.jsx("span",{"aria-hidden":!0,children:n},r):m.jsx("span",{"aria-hidden":!0,className:"title-reveal-char",style:{animationDelay:`${Math.min(r*DH,RH)}ms`},children:n},r))}):m.jsx(m.Fragment,{children:e})}function LH({session:e,active:t,busy:n,waiting:r,revealTitle:s,onOpen:a,onRename:c,onSetArchived:l,onDelete:u}){var E;const{open:h,setOpen:p,ref:f}=lu(),g=((E=e.title)==null?void 0:E.trim())||"Untitled",[y,C]=P.useState(!1),[w,b]=P.useState(""),_=P.useRef(null);function x(){var T;b(((T=e.title)==null?void 0:T.trim())||""),C(!0)}function S(){var A;const T=w.trim();C(!1),T&&T!==(((A=e.title)==null?void 0:A.trim())||"")&&c(T)}return P.useEffect(()=>{var T,A;y&&((T=_.current)==null||T.focus(),(A=_.current)==null||A.select())},[y]),m.jsxs("div",{ref:f,role:"button",tabIndex:0,className:`session-row ${t?"active":""} ${h?"menu-open":""} ${y?"editing":""}`,title:`${Zm[e.harness]}${e.model?` · ${e.model}`:""}`,onClick:()=>{y||(h?p(!1):a())},onKeyDown:T=>{T.target===T.currentTarget&&(T.key==="Enter"||T.key===" ")&&(T.preventDefault(),h?p(!1):a())},children:[m.jsx("span",{className:"session-dot",children:n&&m.jsx("span",{className:`busy-dot ${r?"waiting":""}`})}),y?m.jsx("input",{ref:_,className:"session-title-input","aria-label":"Session title",value:w,onChange:T=>b(T.target.value),onClick:T=>T.stopPropagation(),onBlur:S,onKeyDown:T=>{T.stopPropagation(),T.key==="Enter"?(T.preventDefault(),S()):T.key==="Escape"&&(T.preventDefault(),C(!1))}}):m.jsx("span",{className:"session-title",children:m.jsx(E8,{title:g,animate:s!==void 0},s??"static")}),m.jsx("span",{className:"session-time",children:xH(e.updatedAt)}),m.jsx("button",{className:"session-menu-btn",title:"Session options","aria-label":"Session options",onClick:T=>{T.stopPropagation(),p(A=>!A)},children:m.jsx(xx,{size:14})}),h&&m.jsxs("div",{className:"option-menu drop-down session-menu",children:[m.jsx("button",{className:"model-item",onClick:T=>{T.stopPropagation(),p(!1),x()},children:m.jsx("span",{children:"Rename"})}),m.jsx("button",{className:"model-item",onClick:T=>{T.stopPropagation(),p(!1),l(!e.archived)},children:m.jsx("span",{children:e.archived?"Unarchive":"Archive"})}),m.jsx("button",{className:"model-item danger",onClick:T=>{T.stopPropagation(),p(!1),u()},children:m.jsx("span",{children:"Delete"})})]})]})}function OH({projectId:e,paperId:t,railHeader:n,railOpen:r,onShowRail:s,mainView:a,onSelectMainView:c,panelOpen:l,onTogglePanel:u,onOpenFile:h,onOpenPlan:p,onOpenSubagent:f,onOpenWorktree:g,onStartTour:y,onActiveSessionChange:C,children:w}){var ds,ti,ni;const[b,_]=P.useState([]),[x,S]=P.useState(null),[E,T]=P.useState("active"),[A,D]=P.useState(""),[M,R]=P.useState([]),[z,H]=P.useReducer(bH,{messagesBySession:{},busySessions:new Set}),[$,U]=P.useState([]),[q,K]=P.useState(vH),[Y,Q]=P.useState({}),[ee,B]=P.useState(new Map),L=P.useRef(new Map),O=P.useRef(new Set),W=P.useRef(new Set),G=P.useRef(0),ie=P.useRef([]),fe=P.useRef(null),pe=P.useRef(null),te=P.useRef(!0),V=P.useRef(null),[ae,oe]=P.useState([]),[be,he]=P.useState(0),[Se,Te]=P.useState(!1),[Re,He]=P.useState(null),ze=P.useRef(null),[zt,At]=P.useState(0);P.useLayoutEffect(()=>{At(Re&&ze.current?ze.current.offsetWidth+8:0),Tt()},[Re]);function Tt(){var ue;ze.current&&(ze.current.style.transform=`translateY(${-(((ue=V.current)==null?void 0:ue.scrollTop)??0)}px)`)}const Gt=P.useRef(!1);P.useEffect(()=>{OT().then(oe).catch(()=>{})},[]);const tn=!Re&&A.startsWith("/")&&!/\s/.test(A)?A.slice(1):null,mt=tn!==null&&!Se?ae.filter(ue=>ue.name.startsWith(tn.toLowerCase())):[],ct=mt.length>0,xt=Math.min(be,Math.max(0,mt.length-1));P.useEffect(()=>he(0),[tn]);function _e(ue){var ke;He(ue),D(""),(ke=V.current)==null||ke.focus()}function Ne(){var ue;He(null),(ue=V.current)==null||ue.focus()}function Pe(ue){for(const ke of ue){if(!/^image\/(png|jpeg|gif|webp)$/.test(ke.type))continue;const De=new FileReader;De.onload=()=>{const Fe=De.result;R(Je=>[...Je,{dataUrl:Fe,mediaType:ke.type}])},De.readAsDataURL(ke)}}function Qe(ue){const ke=Array.from(ue.clipboardData.items).filter(De=>De.kind==="file"&&De.type.startsWith("image/")).map(De=>De.getAsFile()).filter(De=>De!==null);ke.length>0&&(ue.preventDefault(),Pe(ke))}const Ye=b.find(ue=>ue.id===x),Rt=Ye?{harness:Ye.harness,model:Y.model??Ye.model,permissionMode:Y.permissionMode??Ye.permissionMode,reasoningLevel:Y.reasoningLevel??Ye.reasoningLevel}:q??g_($),lt=Rt?$.find(ue=>ue.id===Rt.harness):void 0,Pt=lt==null?void 0:lt.options,ft=Rt&&{...Rt,reasoningLevel:zx(lt,Rt.model,Rt.reasoningLevel)},pn=Lg(lt,ft==null?void 0:ft.model),St=ue=>{if(!ft)return;const ke={...ft,...ue};K(ke),localStorage.setItem(_8,JSON.stringify(ke)),Ye&&Q(De=>({...De,...ue}))},Kn=ue=>St({permissionMode:ue}),On=ue=>St({reasoningLevel:ue});ie.current=b;const Fn=P.useCallback(async()=>{const ue=ie.current.map(ke=>ke.id);try{const ke=(await oh(e)).filter(Fe=>!W.current.has(Fe.id)),De=new Set(ke.map(Fe=>Fe.id));for(const Fe of ue)De.has(Fe)||ar(Fe);return _(Fe=>{const Je=new Map(Fe.map(Vt=>[Vt.id,Vt.contextUsage]));return ke.map(Vt=>({...Vt,contextUsage:Vt.contextUsage??Je.get(Vt.id)}))}),L.current=new Map(ke.map(Fe=>[Fe.id,Fe.title])),H({type:"seedBusy",sessions:ke.filter(Fe=>Fe.busy).map(Fe=>Fe.id),known:ke.map(Fe=>Fe.id)}),ke}catch{return null}},[e]);P.useEffect(()=>{_([]),ie.current=[],S(null),D(""),He(null),R([]),H({type:"reset"}),O.current=new Set,B(new Map),L.current=new Map,Fn().then(ue=>{ue&&S(ke=>{var De;return ke??((De=ue.find(Fe=>!Fe.archived))==null?void 0:De.id)??null})})},[e,Fn]),P.useEffect(()=>{!x||O.current.has(x)||(O.current.add(x),lh(x).then(ue=>H({type:"seed",sessionId:x,messages:ue})).catch(()=>{H({type:"seed",sessionId:x,messages:[],onlyIfAbsent:!0}),O.current.delete(x)}))},[x]),P.useEffect(()=>Mc(ue=>{switch(ue.type){case"session":{if(ue.session.projectId!==e||W.current.has(ue.session.id))return;const ke=L.current.has(ue.session.id),De=L.current.get(ue.session.id)!==ue.session.title;L.current.set(ue.session.id,ue.session.title),ke&&De&&ue.session.titleSource==="generated"&&(B(Fe=>{const Je=new Map(Fe);return Je.set(ue.session.id,(Fe.get(ue.session.id)??0)+1),Je}),window.setTimeout(()=>{B(Fe=>{if(!Fe.has(ue.session.id))return Fe;const Je=new Map(Fe);return Je.delete(ue.session.id),Je})},jH)),_(Fe=>{const Je=Fe.findIndex(zn=>zn.id===ue.session.id);if(Je<0)return[ue.session,...Fe];const Vt=Fe.slice();return Vt[Je]={...ue.session,contextUsage:ue.session.contextUsage??Fe[Je].contextUsage},Vt});break}case"sessionDeleted":ar(ue.sessionId);break;case"message":G.current++,H({type:"upsertMessage",sessionId:ue.sessionId,message:ue.message});break;case"busy":H({type:"busy",sessionId:ue.sessionId,busy:ue.busy});break;case"usage":_(ke=>ke.map(De=>De.id===ue.sessionId?{...De,contextUsage:ue.usage}:De));break}}),[e]),P.useEffect(()=>Mc(ue=>{if(ue.type!=="reconnected"||(Fn(),!x||!O.current.has(x)))return;const ke=De=>{const Fe=G.current;lh(x).then(Je=>{H({type:"seed",sessionId:x,messages:Je}),De&&G.current!==Fe&&ke(!1)}).catch(()=>{})};ke(!0)}),[x,Fn]);const Zt=x?z.messagesBySession[x]??[]:[],bn=x?z.busySessions.has(x):!1,Pn=!!x&&!(x in z.messagesBySession),Zn=P.useMemo(()=>{const ue=new Set;for(const ke of z.busySessions)(z.messagesBySession[ke]??[]).some(De=>De.parts.some(Fe=>Fe.type==="prompt"&&Fe.prompt&&!Fe.prompt.resolved&&Fe.prompt.nativeId))&&ue.add(ke);return ue},[z.busySessions,z.messagesBySession]),Jr=x?Zn.has(x):!1,It=Ye,ji=It?ee.get(It.id):void 0,Mn=P.useMemo(()=>{var ue;for(let ke=Zt.length-1;ke>=0;ke--)for(const De of Zt[ke].parts)if(De.type==="prompt"&&((ue=De.prompt)==null?void 0:ue.kind)==="plan"&&!De.prompt.resolved)return{promptId:De.id,plan:De.prompt.plan??"",synthesized:!!De.prompt.synthesized};return null},[Zt]),sr=P.useMemo(()=>{const ue=It==null?void 0:It.harness;if(!x||ue!=="claude-code"&&ue!=="codex")return null;for(let ke=Zt.length-1;ke>=0;ke--)for(const De of Zt[ke].parts)if(!(De.type!=="prompt"||!De.prompt||De.prompt.resolved)&&De.prompt.kind==="question")return De.prompt.nativeId&&!z.busySessions.has(x)?null:De.id;return null},[Zt,It==null?void 0:It.harness,x,z.busySessions]),[Dn,ye]=P.useState(null),Ie=Dn&&Dn.sessionId===x?Dn:null;P.useEffect(()=>{if(!Dn)return;const ue=z.busySessions.has(Dn.sessionId),ke=Dn.sessionId===x&&Mn&&Mn.promptId!==Dn.promptId;(!ue||ke)&&ye(null)},[Dn,Mn,z.busySessions,x]);const Ke=P.useMemo(()=>p&&x?(ue,ke)=>p(ue,x,ke):void 0,[p,x]),nt=P.useMemo(()=>f&&x?ue=>f(x,ue):void 0,[f,x]),Nt=P.useMemo(()=>h&&(ue=>h(ue,x??void 0)),[h,x]);P.useEffect(()=>Q({}),[x]),P.useEffect(()=>{C==null||C(x)},[x,C]);const mn=a==="chat"&&(Zt.length>0||bn);P.useLayoutEffect(()=>{te.current=!0;const ue=fe.current;ue&&(ue.scrollTop=ue.scrollHeight)},[x,mn]),P.useLayoutEffect(()=>{const ue=fe.current;ue&&te.current&&(ue.scrollTop=ue.scrollHeight)},[Zt,bn]),P.useEffect(()=>{const ue=fe.current,ke=pe.current;if(!ue||!ke)return;const De=new ResizeObserver(()=>{te.current&&(ue.scrollTop=ue.scrollHeight)});return De.observe(ke),De.observe(ue),()=>De.disconnect()},[mn]);async function Qn(){const ue=A.trim(),ke=Re?`/${Re.name}${ue?` ${ue}`:""}`:ue,De=M;if(!ke&&De.length===0)return;if(ke&&sr&&De.length===0){D(""),He(null),Fr({promptId:sr,answers:[],note:ke}).then(Vt=>{Vt||D(zn=>zn||ke)});return}if(bn)return;const Fe=ft;if(!Fe&&!x)return;D(""),He(null),R([]);let Je=x;try{if(!Je){const _n=await BT(e,Fe.harness,{model:Fe.model,permissionMode:Fe.permissionMode,reasoningLevel:Fe.reasoningLevel});O.current.add(_n.id),_(or=>[_n,...or]),S(_n.id),Je=_n.id}H({type:"optimisticUser",sessionId:Je,text:ke,imageUrls:De.map(_n=>_n.dataUrl)}),H({type:"busy",sessionId:Je,busy:!0}),te.current=!0,E==="archived"&&T("active");const Vt=Fe?{model:Fe.model,permissionMode:Fe.permissionMode,reasoningLevel:Fe.reasoningLevel}:{};Q({});const zn=De.map(_n=>({mediaType:_n.mediaType,dataBase64:_n.dataUrl.slice(_n.dataUrl.indexOf(",")+1)}));await PT(Je,ke,Vt,zn.length?zn:void 0)}catch(Vt){if(D(_n=>_n||ke),R(_n=>_n.length?_n:De),!Je)return;const zn=Vt instanceof Error?Vt.message:String(Vt);if(!/session is busy/i.test(zn)&&await oh(e).then(or=>{var fs;return!!((fs=or.find(yl=>yl.id===Je))!=null&&fs.busy)}).catch(()=>!1)){D(or=>or===ke?"":or),R(or=>or===De?[]:or);return}H({type:"busy",sessionId:Je,busy:!1}),H({type:"upsertMessage",sessionId:Je,message:{id:`${Gv}senderr-${Date.now()}`,role:"assistant",parts:[{id:"p0",type:"tool",tool:"error",state:{status:"error",error:`Message not sent: ${zn}`}}],createdAt:Date.now()}})}}function Hr(){x&&$T(x)}P.useEffect(()=>{if(!bn||a!=="chat")return;function ue(ke){var De;ke.key!=="Escape"||ke.defaultPrevented||(ke.preventDefault(),Hr(),(De=V.current)==null||De.focus())}return document.addEventListener("keydown",ue),()=>document.removeEventListener("keydown",ue)},[bn,x,a]);function ar(ue){W.current.add(ue),_(ke=>ke.filter(De=>De.id!==ue)),S(ke=>ke===ue?null:ke),O.current.delete(ue),L.current.delete(ue),H({type:"forget",sessionId:ue})}function gn(ue,ke){const De=ue.archived;_(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,archived:ke}:Je)),x_(E,ke)||S(Fe=>Fe===ue.id?null:Fe),IT(ue.id,ke).catch(()=>{_(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,archived:De}:Je))})}function Bn(ue,ke){const De=ue.title;_(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,title:ke}:Je)),HT(ue.id,ke).catch(()=>{_(Fe=>Fe.map(Je=>Je.id===ue.id?{...Je,title:De}:Je))})}async function ei(ue){var De;const ke=((De=ue.title)==null?void 0:De.trim())||"Untitled";if(window.confirm(`Delete "${ke}"? -Its transcript is permanently removed.`)){try{await IT(ue.id)}catch(Fe){window.alert(`Failed to delete "${ke}": ${Fe instanceof Error?Fe.message:String(Fe)}`);return}ar(ue.id)}}const Fr=P.useCallback(ue=>{if(!x)return Promise.resolve(!1);const ke=x;return H({type:"busy",sessionId:ke,busy:!0}),qT(ke,ue).then(()=>!0).catch(()=>!1).finally(()=>{lh(ke).then(De=>H({type:"seed",sessionId:ke,messages:De})).catch(()=>{}),oh(e).then(De=>{var Fe;return H({type:"busy",sessionId:ke,busy:!!((Fe=De.find(Je=>Je.id===ke))!=null&&Fe.busy)})}).catch(()=>{})})},[x,e]),na=_.filter(ue=>x_(E,ue.archived)),Xa=m.jsxs("aside",{className:"session-rail floating-panel",children:[n,m.jsxs("nav",{className:"rail-nav",children:[m.jsxs("button",{className:"rail-nav-item","data-onboarding":"new-session",onClick:()=>{S(null),c("chat")},children:[m.jsx(Dg,{size:15}),"New session"]}),m.jsxs("button",{className:`rail-nav-item ${a==="files"?"active":""}`,"data-onboarding":"nav-files",onClick:()=>c("files"),children:[m.jsx(Mg,{size:15}),"Files"]}),dH.map(ue=>m.jsxs("button",{className:`rail-nav-item ${a===ue.id?"active":""}`,"data-onboarding":ue.id==="compute"?"nav-compute":void 0,onClick:()=>c(ue.id),children:[ue.icon,ue.label]},ue.id))]}),m.jsxs("div",{className:"rail-body",children:[m.jsxs("div",{className:"rail-section-head",children:[m.jsx("div",{className:"rail-section-label",children:((ds=E8.find(ue=>ue.id===E))==null?void 0:ds.railLabel)??"Recents"}),m.jsx(DH,{value:E,onChange:T})]}),na.map(ue=>m.jsx(OH,{session:ue,active:ue.id===x&&a==="chat",busy:z.busySessions.has(ue.id),waiting:Zn.has(ue.id),revealTitle:ee.get(ue.id),onOpen:()=>{S(ue.id),c("chat")},onRename:ke=>Bn(ue,ke),onSetArchived:ke=>gn(ue,ke),onDelete:()=>void ei(ue)},ue.id)),na.length===0&&m.jsx("div",{className:"rail-empty",children:E==="archived"?"No archived sessions":_.length>0?"No active sessions":"No sessions yet"})]})]}),ra=`chat-header${r?"":" rail-hidden"}`,gi=!r&&m.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:s,children:m.jsx(kx,{size:15})});return a!=="chat"?m.jsxs(m.Fragment,{children:[r&&Xa,m.jsxs("section",{className:"chat-pane",children:[!r&&m.jsx("div",{className:ra,children:gi}),m.jsx("div",{className:"settings-view-scroll",children:w})]})]}):m.jsxs(m.Fragment,{children:[r&&Xa,m.jsxs("section",{className:"chat-pane",children:[m.jsxs("div",{className:ra,children:[gi,m.jsx("div",{className:"title",title:It?((ti=It.title)==null?void 0:ti.trim())||"Untitled":"New session",children:It?m.jsx(k8,{title:((ni=It.title)==null?void 0:ni.trim())||"Untitled",animate:ji!==void 0},ji??"static"):"New session"}),y&&m.jsx("button",{className:"icon-btn","data-tip":"Replay tour","aria-label":"Replay tour",onClick:y,children:m.jsx(Gk,{size:15})}),g&&x&&m.jsx("button",{className:"icon-btn","data-tip":"View session worktree","aria-label":"View session worktree",onClick:()=>g(x),children:m.jsx(Ng,{size:15})}),m.jsx("button",{className:`icon-btn ${l?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:u,children:m.jsx(aA,{size:15})})]}),Pn?m.jsxs("div",{className:"chat-loading","aria-live":"polite","aria-busy":"true",children:[m.jsx("span",{className:"spinner"}),m.jsx("span",{children:"Loading conversation…"})]}):mn?m.jsx("div",{className:"chat-thread",ref:fe,onScroll:ue=>{const ke=ue.currentTarget;te.current=ke.scrollHeight-ke.scrollTop-ke.clientHeight<60},children:m.jsxs("div",{className:"chat-thread-inner",ref:pe,children:[m.jsx(MH,{messages:Zt,onOpenFile:Nt,onRespond:Fr,onOpenPlan:Ke,onOpenSubagent:rt,skills:ae}),bn&&(Jr?m.jsx("div",{className:"working awaiting",children:"Waiting for your input…"}):m.jsxs("div",{className:"working",children:[m.jsx("span",{className:"spinner"})," Working…"]}))]})}):m.jsxs("div",{className:"chat-empty",children:[m.jsx("h2",{children:m.jsx(Sc,{})}),m.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),m.jsx(xH,{harnesses:q,selection:U??g_(q)}),t&&m.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var ke;const ue=ae.find(De=>De.name==="reproduce-paper");ue?(He(ue),D(`${t} on `)):D(`/reproduce-paper ${t} on `),(ke=V.current)==null||ke.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),m.jsxs("div",{className:"composer",children:[Mn&&!(Ie&&Mn.promptId===Ie.promptId)&&m.jsx(CI,{synthesized:Mn.synthesized,agentLabel:It?Km[It.harness]:"The agent",onView:()=>Ke==null?void 0:Ke(Mn.plan,Mn.promptId),onApprove:ue=>Fr({promptId:Mn.promptId,approve:!0,resumeMode:ue}),onReject:()=>Fr({promptId:Mn.promptId,approve:!1}),onRevise:ue=>{x&&ye({sessionId:x,promptId:Mn.promptId}),Fr({promptId:Mn.promptId,approve:!1,note:ue})}}),m.jsxs("div",{className:"composer-box","data-onboarding":"composer",children:[ct&&m.jsx(pH,{skills:mt,activeIndex:xt,onPick:_e,onHover:he}),M.length>0&&m.jsx("div",{className:"composer-attachments",children:M.map((ue,ke)=>m.jsxs("div",{className:"attachment-thumb",children:[m.jsx("img",{src:ue.dataUrl,alt:"pasted"}),m.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>R(De=>De.filter((Fe,Je)=>Je!==ke)),children:m.jsx(Ko,{size:11})})]},ke))}),m.jsxs("div",{className:"composer-input",children:[Re&&m.jsxs("span",{ref:ze,className:"skill-chip composer-chip",children:["/",Re.name]}),m.jsx("textarea",{ref:V,value:A,style:Re?{textIndent:zt}:void 0,onScroll:Tt,placeholder:sr?"Type a custom answer…":Re?["reproduce-paper","paper-to-marimo"].includes(Re.name)&&t?`[paper — optional, defaults to ${t}] on [compute]`:Re.argHint:ft?`Message ${Km[ft.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:Qe,onDragOver:ue=>{ue.dataTransfer.types.includes("Files")&&ue.preventDefault()},onDrop:ue=>{ue.dataTransfer.files.length!==0&&(ue.preventDefault(),Pe(Array.from(ue.dataTransfer.files)))},onChange:ue=>{const ke=ue.target.value;if(!Re&&!sr&&!Gt.current){const De=ke.match(/^\/(\S+)\s([\s\S]*)$/),Fe=De&&ae.find(Je=>Je.name===De[1].toLowerCase());if(Fe){He(Fe),D(De[2]),Te(!1);return}}D(ke),Te(!1)},onCompositionStart:()=>{Gt.current=!0},onCompositionEnd:()=>{Gt.current=!1},onKeyDown:ue=>{if(ct){if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){ue.preventDefault();const ke=ue.key==="ArrowDown"?1:-1;he((xt+ke+mt.length)%mt.length);return}if(ue.key==="Enter"||ue.key==="Tab"){ue.preventDefault(),_e(mt[xt]);return}if(ue.key==="Escape"){ue.preventDefault(),Te(!0);return}}if(Re&&ue.key==="Backspace"&&ue.currentTarget.selectionStart===0&&ue.currentTarget.selectionEnd===0){ue.preventDefault(),Ne();return}ue.key==="Enter"&&!ue.shiftKey&&!ue.nativeEvent.isComposing&&(ue.preventDefault(),Qn())}})]}),m.jsxs("div",{className:"composer-actions",children:[m.jsx(v_,{choices:(Pt==null?void 0:Pt.permissionModes)??[],value:(ft==null?void 0:ft.permissionMode)??null,defaultId:(Pt==null?void 0:Pt.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:Kn}),m.jsx("div",{style:{flex:1}}),m.jsx(mH,{value:ft,onSelect:St,onHarnesses:$,lockHarness:!!Ye}),m.jsx(v_,{choices:pn.choices,value:(ft==null?void 0:ft.reasoningLevel)??null,defaultId:pn.defaultId,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat — Default sends no override, so the harness CLI's own configured effort applies",onSelect:On}),m.jsx(vH,{usage:Ye==null?void 0:Ye.contextUsage}),bn&&!sr?m.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:Hr,children:m.jsx(Ko,{size:16})}):m.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void Qn(),disabled:!Re&&!A.trim()&&M.length===0,children:m.jsx(_x,{size:16})})]})]})]})]})]})}function zH({sessionId:e,spawnPartId:t,onOpenFile:n,onOpenSubagent:r}){const[s,a]=P.useState(null);if(P.useEffect(()=>{let l=!0;lh(e).then(h=>l&&a(h)).catch(()=>l&&a([]));const u=Mc(h=>{h.type!=="message"||h.sessionId!==e||a(p=>{const f=p?p.slice():[],g=f.findIndex(y=>y.id===h.message.id);return g===-1?f.push(h.message):f[g]=h.message,f})});return()=>{l=!1,u()}},[e]),s===null)return m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content subagent-tab-content",children:m.jsx("div",{className:"subagent-empty",children:"Loading…"})})});let c=null;for(const l of s)if(c=C8(l.parts,t),c)break;return m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content subagent-tab-content",children:c?m.jsx(TH,{spawn:c,onOpenFile:n,onOpenSubagent:r}):m.jsx("div",{className:"subagent-empty",children:"This sub-agent is no longer available."})})})}function S_(){return{dirs:new Map,files:[]}}function A8(e){const t=S_();for(const n of e){const r=n.split("/");let s=t;for(let a=0;aa(n),title:n,children:[u?m.jsx(Pa,{size:13,className:"code-tree-chev"}):m.jsx(Qc,{size:13,className:"code-tree-chev"}),u?m.jsx(Mg,{size:13}):m.jsx(hA,{size:13}),m.jsx("span",{className:"code-tree-name",children:e})]}),u&&m.jsx(Wv,{node:t,parentPath:n,depth:r+1,toggled:s,onToggle:a,onOpenFile:c})]})}function Wv({node:e,parentPath:t,depth:n,toggled:r,onToggle:s,onOpenFile:a}){const c=[...e.dirs.keys()].sort((u,h)=>u.localeCompare(h)),l=[...e.files].sort((u,h)=>u.localeCompare(h));return m.jsxs(m.Fragment,{children:[c.map(u=>{const h=t?`${t}/${u}`:u;return m.jsx(IH,{name:u,node:e.dirs.get(u),path:h,depth:n,toggled:r,onToggle:s,onOpenFile:a},`d:${h}`)}),l.map(u=>{const h=t?`${t}/${u}`:u;return m.jsxs("button",{type:"button",className:"code-tree-row",style:{paddingLeft:8+n*14},onClick:()=>a(h),title:h,children:[m.jsx(iA,{size:13}),m.jsx("span",{className:"code-tree-name",children:u})]},`f:${h}`)})]})}function HH({projectId:e,project:t,experiments:n,sel:r,toggled:s,onSelChange:a,onToggledChange:c,onOpenFile:l}){const[u,h]=P.useState(null),[p,f]=P.useState(null),[g,y]=P.useState(!0),C=P.useRef(0),w=P.useCallback(()=>{const E=++C.current;y(!0),jx(e,r?{ref:r}:{}).then(T=>{E===C.current&&(h(T),f(null))}).catch(T=>{E===C.current&&f(T.message)}).finally(()=>{E===C.current&&y(!1)})},[e,r]);P.useEffect(()=>(h(null),f(null),w(),()=>{C.current++}),[w]);const _=P.useMemo(()=>u?A8(u.entries):null,[u]),b=P.useCallback(E=>{const T=new Set(s);T.has(E)?T.delete(E):T.add(E),c(T)},[s,c]),x=P.useMemo(()=>{const E=new Set,T=[];for(const A of n)E.has(A.branchName)||(E.add(A.branchName),T.push({branch:A.branchName,label:A.slug}));return T},[n]),S=r||(u==null?void 0:u.branch)||null;return m.jsxs("div",{className:"code-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsx("span",{className:"ctl-label",children:"Source"}),m.jsxs("select",{className:"input sm code-tab-select",value:r,onChange:E=>a(E.target.value),title:"Source to browse",children:[m.jsx("option",{value:"",children:"project clone"}),r&&!x.some(E=>E.branch===r)&&m.jsx("option",{value:r,children:r}),x.map(E=>m.jsx("option",{value:E.branch,children:E.label},E.branch))]}),S&&m.jsx("a",{className:"icon-btn",href:jg(t.githubOwner,t.githubRepo,S),target:"_blank",rel:"noopener noreferrer",title:`Open ${S} on GitHub`,children:m.jsx(qv,{size:13})}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:w,children:g?m.jsx("span",{className:"spinner"}):m.jsx(Zh,{size:13})})]}),(u==null?void 0:u.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),p&&_&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",p]}),m.jsx("div",{className:"code-tab-body",children:_?_.dirs.size===0&&_.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Wv,{node:_,parentPath:"",depth:0,toggled:s,onToggle:b,onOpenFile:E=>l(E,void 0,r||void 0)})}):m.jsx("div",{className:"code-tab-note",children:p?`Failed to load: ${p}`:"Loading…"})})]})}function w_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,r)}return n}function Ot(e){for(var t=1;t=0||(p[u]=c[u]);return p})(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function Ct(e,t){return N8(e)||(function(n,r){var s=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(s!=null){var a,c,l,u,h=[],p=!0,f=!1;try{if(l=(s=s.call(n)).next,r===0){if(Object(s)!==s)return;p=!1}else for(;!(p=(a=l.call(s)).done)&&(h.push(a.value),h.length!==r);p=!0);}catch(g){f=!0,c=g}finally{try{if(!p&&s.return!=null&&(u=s.return(),Object(u)!==u))return}finally{if(f)throw c}}return h}})(e,t)||Sd(e,t)||D8()}function T8(e){return N8(e)||M8(e)||Sd(e)||D8()}function Rr(e){return(function(t){if(Array.isArray(t))return Jm(t)})(e)||M8(e)||Sd(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function N8(e){if(Array.isArray(e))return e}function M8(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sd(e,t){if(e){if(typeof e=="string")return Jm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Jm(e,t):void 0}}function Jm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +Its transcript is permanently removed.`)){try{await zT(ue.id)}catch(Fe){window.alert(`Failed to delete "${ke}": ${Fe instanceof Error?Fe.message:String(Fe)}`);return}ar(ue.id)}}const Fr=P.useCallback(ue=>{if(!x)return Promise.resolve(!1);const ke=x;return H({type:"busy",sessionId:ke,busy:!0}),UT(ke,ue).then(()=>!0).catch(()=>!1).finally(()=>{lh(ke).then(De=>H({type:"seed",sessionId:ke,messages:De})).catch(()=>{}),oh(e).then(De=>{var Fe;return H({type:"busy",sessionId:ke,busy:!!((Fe=De.find(Je=>Je.id===ke))!=null&&Fe.busy)})}).catch(()=>{})})},[x,e]),na=b.filter(ue=>x_(E,ue.archived)),Xa=m.jsxs("aside",{className:"session-rail floating-panel",children:[n,m.jsxs("nav",{className:"rail-nav",children:[m.jsxs("button",{className:"rail-nav-item","data-onboarding":"new-session",onClick:()=>{S(null),c("chat")},children:[m.jsx(Rg,{size:15}),"New session"]}),m.jsxs("button",{className:`rail-nav-item ${a==="artifacts"?"active":""}`,"data-onboarding":"nav-artifacts",onClick:()=>c("artifacts"),children:[m.jsx(Dg,{size:15}),"Artifacts"]}),hH.map(ue=>m.jsxs("button",{className:`rail-nav-item ${a===ue.id?"active":""}`,"data-onboarding":ue.id==="compute"?"nav-compute":void 0,onClick:()=>c(ue.id),children:[ue.icon,ue.label]},ue.id))]}),m.jsxs("div",{className:"rail-body",children:[m.jsxs("div",{className:"rail-section-head",children:[m.jsx("div",{className:"rail-section-label",children:((ds=C8.find(ue=>ue.id===E))==null?void 0:ds.railLabel)??"Recents"}),m.jsx(MH,{value:E,onChange:T})]}),na.map(ue=>m.jsx(LH,{session:ue,active:ue.id===x&&a==="chat",busy:z.busySessions.has(ue.id),waiting:Zn.has(ue.id),revealTitle:ee.get(ue.id),onOpen:()=>{S(ue.id),c("chat")},onRename:ke=>Bn(ue,ke),onSetArchived:ke=>gn(ue,ke),onDelete:()=>void ei(ue)},ue.id)),na.length===0&&m.jsx("div",{className:"rail-empty",children:E==="archived"?"No archived sessions":b.length>0?"No active sessions":"No sessions yet"})]})]}),ra=`chat-header${r?"":" rail-hidden"}`,gi=!r&&m.jsx("button",{className:"icon-btn",title:"Show sidebar","aria-label":"Show sidebar",onClick:s,children:m.jsx(kx,{size:15})});return a!=="chat"?m.jsxs(m.Fragment,{children:[r&&Xa,m.jsxs("section",{className:"chat-pane",children:[!r&&m.jsx("div",{className:ra,children:gi}),m.jsx("div",{className:"settings-view-scroll",children:w})]})]}):m.jsxs(m.Fragment,{children:[r&&Xa,m.jsxs("section",{className:"chat-pane",children:[m.jsxs("div",{className:ra,children:[gi,m.jsx("div",{className:"title",title:It?((ti=It.title)==null?void 0:ti.trim())||"Untitled":"New session",children:It?m.jsx(E8,{title:((ni=It.title)==null?void 0:ni.trim())||"Untitled",animate:ji!==void 0},ji??"static"):"New session"}),y&&m.jsx("button",{className:"icon-btn","data-tip":"Replay tour","aria-label":"Replay tour",onClick:y,children:m.jsx(qk,{size:15})}),g&&x&&m.jsx("button",{className:"icon-btn","data-tip":"View session worktree","aria-label":"View session worktree",onClick:()=>g(x),children:m.jsx(Mg,{size:15})}),m.jsx("button",{className:`icon-btn ${l?"active":""}`,title:"Experiments","aria-label":"Experiments",onClick:u,children:m.jsx(sA,{size:15})})]}),Pn?m.jsxs("div",{className:"chat-loading","aria-live":"polite","aria-busy":"true",children:[m.jsx("span",{className:"spinner"}),m.jsx("span",{children:"Loading conversation…"})]}):mn?m.jsx("div",{className:"chat-thread",ref:fe,onScroll:ue=>{const ke=ue.currentTarget;te.current=ke.scrollHeight-ke.scrollTop-ke.clientHeight<60},children:m.jsxs("div",{className:"chat-thread-inner",ref:pe,children:[m.jsx(NH,{messages:Zt,onOpenFile:Nt,onRespond:Fr,onOpenPlan:Ke,onOpenSubagent:nt,skills:ae}),bn&&(Jr?m.jsx("div",{className:"working awaiting",children:"Waiting for your input…"}):m.jsxs("div",{className:"working",children:[m.jsx("span",{className:"spinner"})," Working…"]}))]})}):m.jsxs("div",{className:"chat-empty",children:[m.jsx("h2",{children:m.jsx(Sc,{})}),m.jsx("p",{children:"Ask the agent to explore your codebase, create and run your baseline experiment, and branch variants off it."}),m.jsx(_H,{harnesses:$,selection:q??g_($)}),t&&m.jsxs("button",{type:"button",className:"chat-suggest mono",title:"Prefills the composer — add the compute to run on, then send",onClick:()=>{var ke;const ue=ae.find(De=>De.name==="reproduce-paper");ue?(He(ue),D(`${t} on `)):D(`/reproduce-paper ${t} on `),(ke=V.current)==null||ke.focus()},children:["/reproduce-paper ",t," on [describe your compute setup]"]})]}),m.jsxs("div",{className:"composer",children:[Mn&&!(Ie&&Mn.promptId===Ie.promptId)&&m.jsx(wI,{synthesized:Mn.synthesized,agentLabel:It?Zm[It.harness]:"The agent",onView:()=>Ke==null?void 0:Ke(Mn.plan,Mn.promptId),onApprove:ue=>Fr({promptId:Mn.promptId,approve:!0,resumeMode:ue}),onReject:()=>Fr({promptId:Mn.promptId,approve:!1}),onRevise:ue=>{x&&ye({sessionId:x,promptId:Mn.promptId}),Fr({promptId:Mn.promptId,approve:!1,note:ue})}}),m.jsxs("div",{className:"composer-box","data-onboarding":"composer",children:[ct&&m.jsx(fH,{skills:mt,activeIndex:xt,onPick:_e,onHover:he}),M.length>0&&m.jsx("div",{className:"composer-attachments",children:M.map((ue,ke)=>m.jsxs("div",{className:"attachment-thumb",children:[m.jsx("img",{src:ue.dataUrl,alt:"pasted"}),m.jsx("button",{title:"Remove image","aria-label":"Remove image",onClick:()=>R(De=>De.filter((Fe,Je)=>Je!==ke)),children:m.jsx(Ko,{size:11})})]},ke))}),m.jsxs("div",{className:"composer-input",children:[Re&&m.jsxs("span",{ref:ze,className:"skill-chip composer-chip",children:["/",Re.name]}),m.jsx("textarea",{ref:V,value:A,style:Re?{textIndent:zt}:void 0,onScroll:Tt,placeholder:sr?"Type a custom answer…":Re?["reproduce-paper","paper-to-marimo"].includes(Re.name)&&t?`[paper — optional, defaults to ${t}] on [compute]`:Re.argHint:ft?`Message ${Zm[ft.harness]}… ( / for skills)`:"Ask the research agent… ( / for skills)",rows:2,onPaste:Qe,onDragOver:ue=>{ue.dataTransfer.types.includes("Files")&&ue.preventDefault()},onDrop:ue=>{ue.dataTransfer.files.length!==0&&(ue.preventDefault(),Pe(Array.from(ue.dataTransfer.files)))},onChange:ue=>{const ke=ue.target.value;if(!Re&&!sr&&!Gt.current){const De=ke.match(/^\/(\S+)\s([\s\S]*)$/),Fe=De&&ae.find(Je=>Je.name===De[1].toLowerCase());if(Fe){He(Fe),D(De[2]),Te(!1);return}}D(ke),Te(!1)},onCompositionStart:()=>{Gt.current=!0},onCompositionEnd:()=>{Gt.current=!1},onKeyDown:ue=>{if(ct){if(ue.key==="ArrowDown"||ue.key==="ArrowUp"){ue.preventDefault();const ke=ue.key==="ArrowDown"?1:-1;he((xt+ke+mt.length)%mt.length);return}if(ue.key==="Enter"||ue.key==="Tab"){ue.preventDefault(),_e(mt[xt]);return}if(ue.key==="Escape"){ue.preventDefault(),Te(!0);return}}if(Re&&ue.key==="Backspace"&&ue.currentTarget.selectionStart===0&&ue.currentTarget.selectionEnd===0){ue.preventDefault(),Ne();return}ue.key==="Enter"&&!ue.shiftKey&&!ue.nativeEvent.isComposing&&(ue.preventDefault(),Qn())}})]}),m.jsxs("div",{className:"composer-actions",children:[m.jsx(v_,{choices:(Pt==null?void 0:Pt.permissionModes)??[],value:(ft==null?void 0:ft.permissionMode)??null,defaultId:(Pt==null?void 0:Pt.defaultPermissionMode)??null,header:"Mode",align:"left",variant:"pill",numbered:!0,title:"Permission mode for this chat",onSelect:Kn}),m.jsx("div",{style:{flex:1}}),m.jsx(pH,{value:ft,onSelect:St,onHarnesses:U,lockHarness:!!Ye}),m.jsx(v_,{choices:pn.choices,value:(ft==null?void 0:ft.reasoningLevel)??null,defaultId:pn.defaultId,header:"Reasoning",align:"right",variant:"bare",title:"Reasoning level for this chat — Default sends no override, so the harness CLI's own configured effort applies",onSelect:On}),m.jsx(gH,{usage:Ye==null?void 0:Ye.contextUsage}),bn&&!sr?m.jsx("button",{className:"send-btn stop",title:"Stop","aria-label":"Stop",onClick:Hr,children:m.jsx(Ko,{size:16})}):m.jsx("button",{className:"send-btn",title:"Send","aria-label":"Send",onClick:()=>void Qn(),disabled:!Re&&!A.trim()&&M.length===0,children:m.jsx(_x,{size:16})})]})]})]})]})]})}function BH({sessionId:e,spawnPartId:t,onOpenFile:n,onOpenSubagent:r}){const[s,a]=P.useState(null);if(P.useEffect(()=>{let l=!0;lh(e).then(h=>l&&a(h)).catch(()=>l&&a([]));const u=Mc(h=>{h.type!=="message"||h.sessionId!==e||a(p=>{const f=p?p.slice():[],g=f.findIndex(y=>y.id===h.message.id);return g===-1?f.push(h.message):f[g]=h.message,f})});return()=>{l=!1,u()}},[e]),s===null)return m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content subagent-tab-content",children:m.jsx("div",{className:"subagent-empty",children:"Loading…"})})});let c=null;for(const l of s)if(c=w8(l.parts,t),c)break;return m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content subagent-tab-content",children:c?m.jsx(AH,{spawn:c,onOpenFile:n,onOpenSubagent:r}):m.jsx("div",{className:"subagent-empty",children:"This sub-agent is no longer available."})})})}function S_(){return{dirs:new Map,files:[]}}function k8(e){const t=S_();for(const n of e){const r=n.split("/");let s=t;for(let a=0;aa(n),title:n,children:[u?m.jsx(Pa,{size:13,className:"code-tree-chev"}):m.jsx(Qc,{size:13,className:"code-tree-chev"}),u?m.jsx(Dg,{size:13}):m.jsx(uA,{size:13}),m.jsx("span",{className:"code-tree-name",children:e})]}),u&&m.jsx(Wv,{node:t,parentPath:n,depth:r+1,toggled:s,onToggle:a,onOpenFile:c})]})}function Wv({node:e,parentPath:t,depth:n,toggled:r,onToggle:s,onOpenFile:a}){const c=[...e.dirs.keys()].sort((u,h)=>u.localeCompare(h)),l=[...e.files].sort((u,h)=>u.localeCompare(h));return m.jsxs(m.Fragment,{children:[c.map(u=>{const h=t?`${t}/${u}`:u;return m.jsx(zH,{name:u,node:e.dirs.get(u),path:h,depth:n,toggled:r,onToggle:s,onOpenFile:a},`d:${h}`)}),l.map(u=>{const h=t?`${t}/${u}`:u;return m.jsxs("button",{type:"button",className:"code-tree-row",style:{paddingLeft:8+n*14},onClick:()=>a(h),title:h,children:[m.jsx(rA,{size:13}),m.jsx("span",{className:"code-tree-name",children:u})]},`f:${h}`)})]})}function IH({projectId:e,project:t,experiments:n,sel:r,toggled:s,onSelChange:a,onToggledChange:c,onOpenFile:l}){const[u,h]=P.useState(null),[p,f]=P.useState(null),[g,y]=P.useState(!0),C=P.useRef(0),w=P.useCallback(()=>{const E=++C.current;y(!0),jx(e,r?{ref:r}:{}).then(T=>{E===C.current&&(h(T),f(null))}).catch(T=>{E===C.current&&f(T.message)}).finally(()=>{E===C.current&&y(!1)})},[e,r]);P.useEffect(()=>(h(null),f(null),w(),()=>{C.current++}),[w]);const b=P.useMemo(()=>u?k8(u.entries):null,[u]),_=P.useCallback(E=>{const T=new Set(s);T.has(E)?T.delete(E):T.add(E),c(T)},[s,c]),x=P.useMemo(()=>{const E=new Set,T=[];for(const A of n)E.has(A.branchName)||(E.add(A.branchName),T.push({branch:A.branchName,label:A.slug}));return T},[n]),S=r||(u==null?void 0:u.branch)||null;return m.jsxs("div",{className:"code-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsx("span",{className:"ctl-label",children:"Source"}),m.jsxs("select",{className:"input sm code-tab-select",value:r,onChange:E=>a(E.target.value),title:"Source to browse",children:[m.jsx("option",{value:"",children:"project clone"}),r&&!x.some(E=>E.branch===r)&&m.jsx("option",{value:r,children:r}),x.map(E=>m.jsx("option",{value:E.branch,children:E.label},E.branch))]}),S&&m.jsx("a",{className:"icon-btn",href:jg(t.githubOwner,t.githubRepo,S),target:"_blank",rel:"noopener noreferrer",title:`Open ${S} on GitHub`,children:m.jsx(qv,{size:13})}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:w,children:g?m.jsx("span",{className:"spinner"}):m.jsx(Zh,{size:13})})]}),(u==null?void 0:u.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),p&&b&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",p]}),m.jsx("div",{className:"code-tab-body",children:b?b.dirs.size===0&&b.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Wv,{node:b,parentPath:"",depth:0,toggled:s,onToggle:_,onOpenFile:E=>l(E,void 0,r||void 0)})}):m.jsx("div",{className:"code-tab-note",children:p?`Failed to load: ${p}`:"Loading…"})})]})}function w_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable}))),n.push.apply(n,r)}return n}function Ot(e){for(var t=1;t=0||(p[u]=c[u]);return p})(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}function Ct(e,t){return T8(e)||(function(n,r){var s=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(s!=null){var a,c,l,u,h=[],p=!0,f=!1;try{if(l=(s=s.call(n)).next,r===0){if(Object(s)!==s)return;p=!1}else for(;!(p=(a=l.call(s)).done)&&(h.push(a.value),h.length!==r);p=!0);}catch(g){f=!0,c=g}finally{try{if(!p&&s.return!=null&&(u=s.return(),Object(u)!==u))return}finally{if(f)throw c}}return h}})(e,t)||wd(e,t)||M8()}function A8(e){return T8(e)||N8(e)||wd(e)||M8()}function Rr(e){return(function(t){if(Array.isArray(t))return eg(t)})(e)||N8(e)||wd(e)||(function(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)})()}function T8(e){if(Array.isArray(e))return e}function N8(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function wd(e,t){if(e){if(typeof e=="string")return eg(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?eg(e,t):void 0}}function eg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,c=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return c=u.done,u},e:function(u){l=!0,a=u},f:function(){try{c||n.return==null||n.return()}finally{if(l)throw a}}}}var P0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cu(e,t){return e(t={exports:{}},t.exports),t.exports}var Mr=cu((function(e){/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],s=0;s-1?b.slice(0,S):E;switch(E){case"diff":w--;break e;case"deleted":case"new":var T=b.slice(S+1);T.indexOf("file mode")===0&&(c[E==="new"?"newMode":"oldMode"]=T.slice(10));break;case"similarity":c.similarity=parseInt(b.split(" ")[2],10);break;case"index":var A=b.slice(S+1).split(" "),D=A[0].split("..");c.oldRevision=D[0],c.newRevision=D[1],A[1]&&(c.oldMode=c.newMode=A[1]);break;case"copy":case"rename":var M=b.slice(S+1);M.indexOf("from")===0?c.oldPath=M.slice(5):c.newPath=M.slice(3),x=E;break;case"---":var R=b.slice(S+1),z=y[++w].slice(4);R==="/dev/null"?(z=z.slice(2),x="add"):z==="/dev/null"?(R=R.slice(2),x="delete"):(x="modify",R=R.slice(2),z=z.slice(2)),R&&(c.oldPath=R),z&&(c.newPath=z),g=5;break e}}c.type=x||"modify"}else if(_.indexOf("Binary")===0)c.isBinary=!0,c.type=_.indexOf("/dev/null and")>=0?"add":_.indexOf("and /dev/null")>=0?"delete":"modify",g=2,c=null;else if(g===5)if(_.indexOf("@@")===0){var H=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(_);l={content:_,oldStart:H[1]-0,newStart:H[4]-0,oldLines:H[3]-0||1,newLines:H[6]-0||1,changes:[]},c.hunks.push(l),u=l.oldStart,h=l.newStart}else{var q=_.slice(0,1),$={content:_.slice(1)};switch(q){case"+":$.type="insert",$.isInsert=!0,$.lineNumber=h,h++;break;case"-":$.type="delete",$.isDelete=!0,$.lineNumber=u,u++;break;case" ":$.type="normal",$.isNormal=!0,$.oldLineNumber=u,$.newLineNumber=h,u++,h++;break;case"\\":var U=l.changes[l.changes.length-1];U.isDelete||(c.newEndingNewLine=!1),U.isInsert||(c.oldEndingNewLine=!1)}$.type&&l.changes.push($)}w++}return f}};e.exports=s})()}));function ta(e){return e.type==="insert"}function jr(e){return e.type==="delete"}function is(e){return e.type==="normal"}function UH(e,t){var n=t.nearbySequences==="zip"?(function(r){var s=r.reduce((function(a,c,l){var u=Ct(a,3),h=u[0],p=u[1],f=u[2];return p?ta(c)&&f>=0?(h.splice(f+1,0,c),[h,c,f+2]):(h.push(c),[h,c,jr(c)&&jr(p)?f:l]):(h.push(c),[h,c,jr(c)?l:-1])}),[[],null,-1]);return Ct(s,1)[0]})(e.changes):e.changes;return Ot(Ot({},e),{},{isPlain:!1,changes:n})}function j8(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var s=r.indexOf(` +*/(function(){var t={}.hasOwnProperty;function n(){for(var r=[],s=0;s-1?_.slice(0,S):E;switch(E){case"diff":w--;break e;case"deleted":case"new":var T=_.slice(S+1);T.indexOf("file mode")===0&&(c[E==="new"?"newMode":"oldMode"]=T.slice(10));break;case"similarity":c.similarity=parseInt(_.split(" ")[2],10);break;case"index":var A=_.slice(S+1).split(" "),D=A[0].split("..");c.oldRevision=D[0],c.newRevision=D[1],A[1]&&(c.oldMode=c.newMode=A[1]);break;case"copy":case"rename":var M=_.slice(S+1);M.indexOf("from")===0?c.oldPath=M.slice(5):c.newPath=M.slice(3),x=E;break;case"---":var R=_.slice(S+1),z=y[++w].slice(4);R==="/dev/null"?(z=z.slice(2),x="add"):z==="/dev/null"?(R=R.slice(2),x="delete"):(x="modify",R=R.slice(2),z=z.slice(2)),R&&(c.oldPath=R),z&&(c.newPath=z),g=5;break e}}c.type=x||"modify"}else if(b.indexOf("Binary")===0)c.isBinary=!0,c.type=b.indexOf("/dev/null and")>=0?"add":b.indexOf("and /dev/null")>=0?"delete":"modify",g=2,c=null;else if(g===5)if(b.indexOf("@@")===0){var H=/^@@\s+-([0-9]+)(,([0-9]+))?\s+\+([0-9]+)(,([0-9]+))?/.exec(b);l={content:b,oldStart:H[1]-0,newStart:H[4]-0,oldLines:H[3]-0||1,newLines:H[6]-0||1,changes:[]},c.hunks.push(l),u=l.oldStart,h=l.newStart}else{var $=b.slice(0,1),U={content:b.slice(1)};switch($){case"+":U.type="insert",U.isInsert=!0,U.lineNumber=h,h++;break;case"-":U.type="delete",U.isDelete=!0,U.lineNumber=u,u++;break;case" ":U.type="normal",U.isNormal=!0,U.oldLineNumber=u,U.newLineNumber=h,u++,h++;break;case"\\":var q=l.changes[l.changes.length-1];q.isDelete||(c.newEndingNewLine=!1),q.isInsert||(c.oldEndingNewLine=!1)}U.type&&l.changes.push(U)}w++}return f}};e.exports=s})()}));function ta(e){return e.type==="insert"}function jr(e){return e.type==="delete"}function is(e){return e.type==="normal"}function $H(e,t){var n=t.nearbySequences==="zip"?(function(r){var s=r.reduce((function(a,c,l){var u=Ct(a,3),h=u[0],p=u[1],f=u[2];return p?ta(c)&&f>=0?(h.splice(f+1,0,c),[h,c,f+2]):(h.push(c),[h,c,jr(c)&&jr(p)?f:l]):(h.push(c),[h,c,jr(c)?l:-1])}),[[],null,-1]);return Ct(s,1)[0]})(e.changes):e.changes;return Ot(Ot({},e),{},{isPlain:!1,changes:n})}function R8(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(function(r){if(r.startsWith("diff --git"))return r;var s=r.indexOf(` `),a=r.indexOf(` `,s+1),c=r.slice(0,s),l=r.slice(s+1,a),u=c.split(" ").slice(1,-3).join(" "),h=l.split(" ").slice(1,-3).join(" ");return["diff --git a/".concat(u," b/").concat(h),"index 1111111..2222222 100644","--- a/".concat(u),"+++ b/".concat(h),r.slice(a+1)].join(` -`)})(e.trimStart());return $H.parse(n).map((function(r){return(function(s,a){var c=s.hunks.map((function(l){return UH(l,a)}));return Ot(Ot({},s),{},{hunks:c})})(r,t)}))}function qH(e){return e[0]}function GH(e){return e[e.length-1]}function eg(e){return["".concat(e,"Start"),"".concat(e,"Lines")]}function Ic(e){return e==="old"?function(t){return ta(t)?-1:is(t)?t.oldLineNumber:t.lineNumber}:function(t){return jr(t)?-1:is(t)?t.newLineNumber:t.lineNumber}}function L8(e,t){return function(n,r){var s=n[e],a=s+n[t];return r>=s&&r=a&&s-1},JH=function(e,t){var n=this.__data__,r=wd(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Fo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++tl))return!1;var h=a.get(e),p=a.get(t);if(h&&p)return h==t&&p==e;var f=-1,g=!0,y=2&n?new BF:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},en={};en["[object Float32Array]"]=en["[object Float64Array]"]=en["[object Int8Array]"]=en["[object Int16Array]"]=en["[object Int32Array]"]=en["[object Uint8Array]"]=en["[object Uint8ClampedArray]"]=en["[object Uint16Array]"]=en["[object Uint32Array]"]=!0,en["[object Arguments]"]=en["[object Array]"]=en["[object ArrayBuffer]"]=en["[object Boolean]"]=en["[object DataView]"]=en["[object Date]"]=en["[object Error]"]=en["[object Function]"]=en["[object Map]"]=en["[object Number]"]=en["[object Object]"]=en["[object RegExp]"]=en["[object Set]"]=en["[object String]"]=en["[object WeakMap]"]=!1;var QF=function(e){return nl(e)&&Kv(e.length)&&!!en[vl(e)]},JF=function(e){return function(t){return e(t)}},D_=cu((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,s=r&&r.exports===n&&z8.process,a=(function(){try{var c=r&&r.require&&r.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}})();e.exports=a})),R_=D_&&D_.isTypedArray,Zv=R_?JF(R_):QF,eP=Object.prototype.hasOwnProperty,tP=function(e,t){var n=Or(e),r=!n&&Ad(e),s=!n&&!r&&Oh(e),a=!n&&!r&&!s&&Zv(e),c=n||r||s||a,l=c?WF(e.length,String):[],u=l.length;for(var h in e)!eP.call(e,h)||c&&(h=="length"||s&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||U8(h,u))||l.push(h);return l},nP=Object.prototype,q8=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||nP)},rP=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),iP=Object.prototype.hasOwnProperty,G8=function(e){if(!q8(e))return rP(e);var t=[];for(var n in Object(e))iP.call(e,n)&&n!="constructor"&&t.push(n);return t},Td=function(e){return e!=null&&Kv(e.length)&&!H8(e)},Qv=function(e){return Td(e)?tP(e):G8(e)},j_=function(e){return $F(e,Qv,VF)},sP=Object.prototype.hasOwnProperty,aP=function(e,t,n,r,s,a){var c=1&n,l=j_(e),u=l.length;if(u!=j_(t).length&&!c)return!1;for(var h=u;h--;){var p=l[h];if(!(c?p in t:sP.call(t,p)))return!1}var f=a.get(e),g=a.get(t);if(f&&g)return f==t&&g==e;var y=!0;a.set(e,t),a.set(t,e);for(var C=c;++h1)return!1;if(e.length===1){var t=Ct(e,1)[0];return t.type==="text"&&!t.value}return!0}function YP(e){var t=e.changeKey,n=e.text,r=e.tokens,s=e.renderToken,a=Zs(e,VP),c=s?function(l,u){return s(l,I_,u)}:I_;return m.jsx("td",Ot(Ot({},a),{},{"data-change-key":t,children:r?WP(r)?" ":r.map(c):n||" "}))}var J8=P.memo(YP);function ew(e,t){return function(){var n=t==="old"?jd(e):Ld(e);return n===-1?void 0:n}}function tw(e,t){return function(n){return e&&n?m.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function Bh(e,t){return t?function(n){e(),t(n)}:e}function H_(e,t,n,r){return P.useMemo((function(){var s=Q8(e,(function(a){return function(c){return a&&a(t,c)}}));return s.onMouseEnter=Bh(n,s.onMouseEnter),s.onMouseLeave=Bh(r,s.onMouseLeave),s}),[e,n,r,t])}function F_(e,t,n,r,s,a,c,l,u){var h={change:t,side:r,inHoverState:l,renderDefault:ew(t,r),wrapInAnchor:tw(s,a)};return m.jsx("td",Ot(Ot({className:e},c),{},{"data-change-key":n,children:u(h)}))}function XP(e){var t,n,r,s=e.change,a=e.selected,c=e.tokens,l=e.className,u=e.generateLineClassName,h=e.gutterClassName,p=e.codeClassName,f=e.gutterEvents,g=e.codeEvents,y=e.hideGutter,C=e.gutterAnchor,w=e.generateAnchorID,_=e.renderToken,b=e.renderGutter,x=s.type,S=s.content,E=Vs(s),T=(t=Ct(P.useState(!1),2),n=t[0],r=t[1],[n,P.useCallback((function(){return r(!0)}),[]),P.useCallback((function(){return r(!1)}),[])]),A=Ct(T,3),D=A[0],M=A[1],R=A[2],z=P.useMemo((function(){return{change:s}}),[s]),H=H_(f,z,M,R),q=H_(g,z,M,R),$=w(s),U=u({changes:[s],defaultGenerate:function(){return l}}),K=Mr("diff-gutter","diff-gutter-".concat(x),h,{"diff-gutter-selected":a}),Y=Mr("diff-code","diff-code-".concat(x),p,{"diff-code-selected":a});return m.jsxs("tr",{id:$,className:Mr("diff-line",U),children:[!y&&F_(K,s,E,"old",C,$,H,D,b),!y&&F_(K,s,E,"new",C,$,H,D,b),m.jsx(J8,Ot({className:Y,changeKey:E,text:S,tokens:c,renderToken:_},q))]})}var KP=P.memo(XP);function ZP(e){var t=e.hideGutter,n=e.element;return m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var QP=["hideGutter","selectedChanges","tokens","lineClassName"],JP=["hunk","widgets","className"];function e$(e){var t=e.hunk,n=e.widgets,r=e.className,s=Zs(e,JP),a=(function(c,l){return c.reduce((function(u,h){var p=Vs(h);u.push(["change",p,h]);var f=l[p];return f&&u.push(["widget",p,f]),u}),[])})(t.changes,n);return m.jsx("tbody",{className:Mr("diff-hunk",r),children:a.map((function(c){return(function(l,u){var h=Ct(l,3),p=h[0],f=h[1],g=h[2],y=u.hideGutter,C=u.selectedChanges,w=u.tokens,_=u.lineClassName,b=Zs(u,QP);if(p==="change"){var x=jr(g)?"old":"new",S=jr(g)?jd(g):Ld(g),E=w?w[x][S-1]:null;return m.jsx(KP,Ot({className:_,change:g,hideGutter:y,selected:C.includes(f),tokens:E},b),"change".concat(f))}return p==="widget"?m.jsx(ZP,{hideGutter:y,element:g},"widget".concat(f)):null})(c,s)}))})}var nw=0;function U0(e,t,n,r){var s=P.useCallback((function(){return t(e)}),[e,t]),a=P.useCallback((function(){return t("")}),[t]);return P.useMemo((function(){var c=Q8(r,(function(l){return function(u){return l&&l({side:e,change:n},u)}}));return c.onMouseEnter=Bh(s,c.onMouseEnter),c.onMouseLeave=Bh(a,c.onMouseLeave),c}),[n,r,s,e,a])}function Vp(e){var t=e.change,n=e.side,r=e.selected,s=e.tokens,a=e.gutterClassName,c=e.codeClassName,l=e.gutterEvents,u=e.codeEvents,h=e.anchorID,p=e.gutterAnchor,f=e.gutterAnchorTarget,g=e.hideGutter,y=e.hover,C=e.renderToken,w=e.renderGutter;if(!t){var _=Mr("diff-gutter","diff-gutter-omit",a),b=Mr("diff-code","diff-code-omit",c);return[!g&&m.jsx("td",{className:_},"gutter"),m.jsx("td",{className:b},"code")]}var x=t.type,S=t.content,E=Vs(t),T=n===nw?"old":"new",A=Ot({id:h||void 0,className:Mr("diff-gutter","diff-gutter-".concat(x),Qm({"diff-gutter-selected":r},"diff-line-hover-"+T,y),a),children:w({change:t,side:T,inHoverState:y,renderDefault:ew(t,T),wrapInAnchor:tw(p,f)})},l),D=Mr("diff-code","diff-code-".concat(x),Qm({"diff-code-selected":r},"diff-line-hover-"+T,y),c);return[!g&&m.jsx("td",Ot(Ot({},A),{},{"data-change-key":E}),"gutter"),m.jsx(J8,Ot({className:D,changeKey:E,text:S,tokens:s,renderToken:C},u),"code")]}function t$(e){var t=e.className,n=e.oldChange,r=e.newChange,s=e.oldSelected,a=e.newSelected,c=e.oldTokens,l=e.newTokens,u=e.monotonous,h=e.gutterClassName,p=e.codeClassName,f=e.gutterEvents,g=e.codeEvents,y=e.hideGutter,C=e.generateAnchorID,w=e.generateLineClassName,_=e.gutterAnchor,b=e.renderToken,x=e.renderGutter,S=Ct(P.useState(""),2),E=S[0],T=S[1],A=U0("old",T,n,f),D=U0("new",T,r,f),M=U0("old",T,n,g),R=U0("new",T,r,g),z=n&&C(n),H=r&&C(r),q=w({changes:[n,r],defaultGenerate:function(){return t}}),$={monotonous:u,hideGutter:y,gutterClassName:h,codeClassName:p,gutterEvents:f,codeEvents:g,renderToken:b,renderGutter:x},U=Ot(Ot({},$),{},{change:n,side:nw,selected:s,tokens:c,gutterEvents:A,codeEvents:M,anchorID:z,gutterAnchor:_,gutterAnchorTarget:z,hover:E==="old"}),K=Ot(Ot({},$),{},{change:r,side:1,selected:a,tokens:l,gutterEvents:D,codeEvents:R,anchorID:n===r?null:H,gutterAnchor:_,gutterAnchorTarget:n===r?z:H,hover:E==="new"});if(u)return m.jsx("tr",{className:Mr("diff-line",q),children:Vp(n?U:K)});var Y=(function(Q,ee){return Q&&!ee?"diff-line-old-only":!Q&&ee?"diff-line-new-only":Q===ee?"diff-line-normal":"diff-line-compare"})(n,r);return m.jsxs("tr",{className:Mr("diff-line",Y,q),children:[Vp(U),Vp(K)]})}var n$=P.memo(t$);function r$(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):m.jsxs("tr",{className:"diff-widget",children:[m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var i$=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],s$=["hunk","widgets","className"];function q0(e,t){return(e?Vs(e):"00")+(t?Vs(t):"00")}function a$(e){var t=e.hunk,n=e.widgets,r=e.className,s=Zs(e,s$),a=(function(c,l){for(var u=function(b){if(!b)return null;var x=Vs(b);return l[x]||null},h=[],p=0;p=s&&r=a&&s-1},QH=function(e,t){var n=this.__data__,r=Cd(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this};function Fo(e){var t=-1,n=e==null?0:e.length;for(this.clear();++tl))return!1;var h=a.get(e),p=a.get(t);if(h&&p)return h==t&&p==e;var f=-1,g=!0,y=2&n?new OF:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=9007199254740991},en={};en["[object Float32Array]"]=en["[object Float64Array]"]=en["[object Int8Array]"]=en["[object Int16Array]"]=en["[object Int32Array]"]=en["[object Uint8Array]"]=en["[object Uint8ClampedArray]"]=en["[object Uint16Array]"]=en["[object Uint32Array]"]=!0,en["[object Arguments]"]=en["[object Array]"]=en["[object ArrayBuffer]"]=en["[object Boolean]"]=en["[object DataView]"]=en["[object Date]"]=en["[object Error]"]=en["[object Function]"]=en["[object Map]"]=en["[object Number]"]=en["[object Object]"]=en["[object RegExp]"]=en["[object Set]"]=en["[object String]"]=en["[object WeakMap]"]=!1;var ZF=function(e){return nl(e)&&Kv(e.length)&&!!en[vl(e)]},QF=function(e){return function(t){return e(t)}},D_=cu((function(e,t){var n=t&&!t.nodeType&&t,r=n&&e&&!e.nodeType&&e,s=r&&r.exports===n&&B8.process,a=(function(){try{var c=r&&r.require&&r.require("util").types;return c||s&&s.binding&&s.binding("util")}catch{}})();e.exports=a})),R_=D_&&D_.isTypedArray,Zv=R_?QF(R_):ZF,JF=Object.prototype.hasOwnProperty,eP=function(e,t){var n=Or(e),r=!n&&Td(e),s=!n&&!r&&Oh(e),a=!n&&!r&&!s&&Zv(e),c=n||r||s||a,l=c?VF(e.length,String):[],u=l.length;for(var h in e)!JF.call(e,h)||c&&(h=="length"||s&&(h=="offset"||h=="parent")||a&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||$8(h,u))||l.push(h);return l},tP=Object.prototype,U8=function(e){var t=e&&e.constructor;return e===(typeof t=="function"&&t.prototype||tP)},nP=(function(e,t){return function(n){return e(t(n))}})(Object.keys,Object),rP=Object.prototype.hasOwnProperty,q8=function(e){if(!U8(e))return nP(e);var t=[];for(var n in Object(e))rP.call(e,n)&&n!="constructor"&&t.push(n);return t},Nd=function(e){return e!=null&&Kv(e.length)&&!I8(e)},Qv=function(e){return Nd(e)?eP(e):q8(e)},j_=function(e){return PF(e,Qv,GF)},iP=Object.prototype.hasOwnProperty,sP=function(e,t,n,r,s,a){var c=1&n,l=j_(e),u=l.length;if(u!=j_(t).length&&!c)return!1;for(var h=u;h--;){var p=l[h];if(!(c?p in t:iP.call(t,p)))return!1}var f=a.get(e),g=a.get(t);if(f&&g)return f==t&&g==e;var y=!0;a.set(e,t),a.set(t,e);for(var C=c;++h1)return!1;if(e.length===1){var t=Ct(e,1)[0];return t.type==="text"&&!t.value}return!0}function WP(e){var t=e.changeKey,n=e.text,r=e.tokens,s=e.renderToken,a=Zs(e,GP),c=s?function(l,u){return s(l,I_,u)}:I_;return m.jsx("td",Ot(Ot({},a),{},{"data-change-key":t,children:r?VP(r)?" ":r.map(c):n||" "}))}var Q8=P.memo(WP);function J8(e,t){return function(){var n=t==="old"?Ld(e):Od(e);return n===-1?void 0:n}}function ew(e,t){return function(n){return e&&n?m.jsx("a",{href:t?"#"+t:void 0,children:n}):n}}function Bh(e,t){return t?function(n){e(),t(n)}:e}function H_(e,t,n,r){return P.useMemo((function(){var s=Z8(e,(function(a){return function(c){return a&&a(t,c)}}));return s.onMouseEnter=Bh(n,s.onMouseEnter),s.onMouseLeave=Bh(r,s.onMouseLeave),s}),[e,n,r,t])}function F_(e,t,n,r,s,a,c,l,u){var h={change:t,side:r,inHoverState:l,renderDefault:J8(t,r),wrapInAnchor:ew(s,a)};return m.jsx("td",Ot(Ot({className:e},c),{},{"data-change-key":n,children:u(h)}))}function YP(e){var t,n,r,s=e.change,a=e.selected,c=e.tokens,l=e.className,u=e.generateLineClassName,h=e.gutterClassName,p=e.codeClassName,f=e.gutterEvents,g=e.codeEvents,y=e.hideGutter,C=e.gutterAnchor,w=e.generateAnchorID,b=e.renderToken,_=e.renderGutter,x=s.type,S=s.content,E=Vs(s),T=(t=Ct(P.useState(!1),2),n=t[0],r=t[1],[n,P.useCallback((function(){return r(!0)}),[]),P.useCallback((function(){return r(!1)}),[])]),A=Ct(T,3),D=A[0],M=A[1],R=A[2],z=P.useMemo((function(){return{change:s}}),[s]),H=H_(f,z,M,R),$=H_(g,z,M,R),U=w(s),q=u({changes:[s],defaultGenerate:function(){return l}}),K=Mr("diff-gutter","diff-gutter-".concat(x),h,{"diff-gutter-selected":a}),Y=Mr("diff-code","diff-code-".concat(x),p,{"diff-code-selected":a});return m.jsxs("tr",{id:U,className:Mr("diff-line",q),children:[!y&&F_(K,s,E,"old",C,U,H,D,_),!y&&F_(K,s,E,"new",C,U,H,D,_),m.jsx(Q8,Ot({className:Y,changeKey:E,text:S,tokens:c,renderToken:b},$))]})}var XP=P.memo(YP);function KP(e){var t=e.hideGutter,n=e.element;return m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:3,className:"diff-widget-content",children:n})})}var ZP=["hideGutter","selectedChanges","tokens","lineClassName"],QP=["hunk","widgets","className"];function JP(e){var t=e.hunk,n=e.widgets,r=e.className,s=Zs(e,QP),a=(function(c,l){return c.reduce((function(u,h){var p=Vs(h);u.push(["change",p,h]);var f=l[p];return f&&u.push(["widget",p,f]),u}),[])})(t.changes,n);return m.jsx("tbody",{className:Mr("diff-hunk",r),children:a.map((function(c){return(function(l,u){var h=Ct(l,3),p=h[0],f=h[1],g=h[2],y=u.hideGutter,C=u.selectedChanges,w=u.tokens,b=u.lineClassName,_=Zs(u,ZP);if(p==="change"){var x=jr(g)?"old":"new",S=jr(g)?Ld(g):Od(g),E=w?w[x][S-1]:null;return m.jsx(XP,Ot({className:b,change:g,hideGutter:y,selected:C.includes(f),tokens:E},_),"change".concat(f))}return p==="widget"?m.jsx(KP,{hideGutter:y,element:g},"widget".concat(f)):null})(c,s)}))})}var tw=0;function U0(e,t,n,r){var s=P.useCallback((function(){return t(e)}),[e,t]),a=P.useCallback((function(){return t("")}),[t]);return P.useMemo((function(){var c=Z8(r,(function(l){return function(u){return l&&l({side:e,change:n},u)}}));return c.onMouseEnter=Bh(s,c.onMouseEnter),c.onMouseLeave=Bh(a,c.onMouseLeave),c}),[n,r,s,e,a])}function Wp(e){var t=e.change,n=e.side,r=e.selected,s=e.tokens,a=e.gutterClassName,c=e.codeClassName,l=e.gutterEvents,u=e.codeEvents,h=e.anchorID,p=e.gutterAnchor,f=e.gutterAnchorTarget,g=e.hideGutter,y=e.hover,C=e.renderToken,w=e.renderGutter;if(!t){var b=Mr("diff-gutter","diff-gutter-omit",a),_=Mr("diff-code","diff-code-omit",c);return[!g&&m.jsx("td",{className:b},"gutter"),m.jsx("td",{className:_},"code")]}var x=t.type,S=t.content,E=Vs(t),T=n===tw?"old":"new",A=Ot({id:h||void 0,className:Mr("diff-gutter","diff-gutter-".concat(x),Jm({"diff-gutter-selected":r},"diff-line-hover-"+T,y),a),children:w({change:t,side:T,inHoverState:y,renderDefault:J8(t,T),wrapInAnchor:ew(p,f)})},l),D=Mr("diff-code","diff-code-".concat(x),Jm({"diff-code-selected":r},"diff-line-hover-"+T,y),c);return[!g&&m.jsx("td",Ot(Ot({},A),{},{"data-change-key":E}),"gutter"),m.jsx(Q8,Ot({className:D,changeKey:E,text:S,tokens:s,renderToken:C},u),"code")]}function e$(e){var t=e.className,n=e.oldChange,r=e.newChange,s=e.oldSelected,a=e.newSelected,c=e.oldTokens,l=e.newTokens,u=e.monotonous,h=e.gutterClassName,p=e.codeClassName,f=e.gutterEvents,g=e.codeEvents,y=e.hideGutter,C=e.generateAnchorID,w=e.generateLineClassName,b=e.gutterAnchor,_=e.renderToken,x=e.renderGutter,S=Ct(P.useState(""),2),E=S[0],T=S[1],A=U0("old",T,n,f),D=U0("new",T,r,f),M=U0("old",T,n,g),R=U0("new",T,r,g),z=n&&C(n),H=r&&C(r),$=w({changes:[n,r],defaultGenerate:function(){return t}}),U={monotonous:u,hideGutter:y,gutterClassName:h,codeClassName:p,gutterEvents:f,codeEvents:g,renderToken:_,renderGutter:x},q=Ot(Ot({},U),{},{change:n,side:tw,selected:s,tokens:c,gutterEvents:A,codeEvents:M,anchorID:z,gutterAnchor:b,gutterAnchorTarget:z,hover:E==="old"}),K=Ot(Ot({},U),{},{change:r,side:1,selected:a,tokens:l,gutterEvents:D,codeEvents:R,anchorID:n===r?null:H,gutterAnchor:b,gutterAnchorTarget:n===r?z:H,hover:E==="new"});if(u)return m.jsx("tr",{className:Mr("diff-line",$),children:Wp(n?q:K)});var Y=(function(Q,ee){return Q&&!ee?"diff-line-old-only":!Q&&ee?"diff-line-new-only":Q===ee?"diff-line-normal":"diff-line-compare"})(n,r);return m.jsxs("tr",{className:Mr("diff-line",Y,$),children:[Wp(q),Wp(K)]})}var t$=P.memo(e$);function n$(e){var t=e.hideGutter,n=e.oldElement,r=e.newElement;return e.monotonous?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n||r})}):n===r?m.jsx("tr",{className:"diff-widget",children:m.jsx("td",{colSpan:t?2:4,className:"diff-widget-content",children:n})}):m.jsxs("tr",{className:"diff-widget",children:[m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:n}),m.jsx("td",{colSpan:t?1:2,className:"diff-widget-content",children:r})]})}var r$=["selectedChanges","monotonous","hideGutter","tokens","lineClassName"],i$=["hunk","widgets","className"];function q0(e,t){return(e?Vs(e):"00")+(t?Vs(t):"00")}function s$(e){var t=e.hunk,n=e.widgets,r=e.className,s=Zs(e,i$),a=(function(c,l){for(var u=function(_){if(!_)return null;var x=Vs(_);return l[x]||null},h=[],p=0;p=(a==null?void 0:a.value.length))return[e];var l=function(f,g){var y=a.value.slice(f,g);return[].concat(Rr(s),[Ot(Ot({},a),{},{value:y})])};if(t>0){var u=l(0,t);c.push(qo(u))}var h=l(Math.max(t,0),n);if(c.push(r?(function(f,g){return[g].concat(Rr(qo(f)))})(h,r):qo(h)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,s=Zs(e,k$);n.push(s);var a,c=Yv(r);try{for(c.s();!(a=c.n()).done;)aw(a.value,t,n)}catch(l){c.e(l)}finally{c.f()}n.pop()}else t.push(qo([].concat(Rr(n.slice(1)),[e])));return t}function A$(e){return e.reduce((function(t,n){var r=t[t.length-1],s=(function(u){var h=r2(u);return h.value.includes(` +`)})(t.oldSource,e),r=t.highlight?function(u){return t.refractor.highlight(u,t.language)}:function(u){return[{type:"text",value:u}]};return[G0(r(t.oldSource)),G0(r(n))]}var s=Ct(_$(e),2),a=s[0],c=s[1],l=t.highlight?function(u){return G0(t.refractor.highlight(u,t.language))}:function(u){return G0([{type:"text",value:u}])};return[l(a),l(c)]}function qo(e){return e.map((function(t){return Ot({},t)}))}function S$(e,t){return[].concat(Rr(qo(e.slice(0,-1))),[t])}function w$(e){return e.type==="text"}function r2(e){var t=e[e.length-1];if(w$(t))return t;throw new Error("Invalid token path with leaf of type ".concat(t.type))}function C$(e,t,n,r){var s=e.slice(0,-1),a=r2(e),c=[];if(n<=0||t>=(a==null?void 0:a.value.length))return[e];var l=function(f,g){var y=a.value.slice(f,g);return[].concat(Rr(s),[Ot(Ot({},a),{},{value:y})])};if(t>0){var u=l(0,t);c.push(qo(u))}var h=l(Math.max(t,0),n);if(c.push(r?(function(f,g){return[g].concat(Rr(qo(f)))})(h,r):qo(h)),n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(e.children){var r=e.children,s=Zs(e,E$);n.push(s);var a,c=Yv(r);try{for(c.s();!(a=c.n()).done;)sw(a.value,t,n)}catch(l){c.e(l)}finally{c.f()}n.pop()}else t.push(qo([].concat(Rr(n.slice(1)),[e])));return t}function k$(e){return e.reduce((function(t,n){var r=t[t.length-1],s=(function(u){var h=r2(u);return h.value.includes(` `)?h.value.split(` -`).map((function(p){return w$(u,Ot(Ot({},h),{},{value:p}))})):[u]})(n),a=T8(s),c=a[0],l=a.slice(1);return[].concat(Rr(t.slice(0,-1)),[[].concat(Rr(r),[c])],Rr(l.map((function(u){return[u]}))))}),[[]])}function q_(e){return A$(aw(e))}var T$=function(e,t,n){var r=(n=typeof n=="function"?n:void 0)?n(e,t):void 0;return r===void 0?Nd(e,t,void 0,n):!!r},N$=function(e,t){return Nd(e,t)},M$=function(e){var t=e==null?0:e.length;return t?e[t-1]:void 0};function D$(e,t){if(!e.children)throw new Error("parent node missing children property");var n,r,s=M$(e.children);return s&&(r=t,(n=s).type===r.type&&(n.type==="text"||n.children&&r.children&&T$(n,r,(function(a,c,l){return l==="chlidren"||N$(a,c)}))))?e.children[e.children.length-1]=(function(a,c){return"value"in a&&"value"in c?Ot(Ot({},a),{},{value:"".concat(a.value).concat(c.value)}):a})(s,t):e.children.push(t),e.children[e.children.length-1]}function G_(e){var t,n={type:"root",children:[]},r=Yv(e);try{var s=function(){var a=t.value;a.reduce((function(c,l,u){return D$(c,u===a.length-1?Ot({},l):Ot(Ot({},l),{},{children:[]}))}),n)};for(r.s();!(t=r.n()).done;)s()}catch(a){r.e(a)}finally{r.f()}return n}var R$=Object.prototype.hasOwnProperty,j$=iw((function(e,t,n){R$.call(e,n)?e[n].push(t):t2(e,n,[t])})),L$=Object.prototype.hasOwnProperty,O$=function(e){if(e==null)return!0;if(Td(e)&&(Or(e)||typeof e=="string"||typeof e.splice=="function"||Oh(e)||Zv(e)||Ad(e)))return!e.length;var t=sg(e);if(t=="[object Map]"||t=="[object Set]")return!e.size;if(q8(e))return!G8(e).length;for(var n in e)if(L$.call(e,n))return!1;return!0},B$=function(e,t){var n=t.start,r=t.length,s=n+r,a=e.reduce((function(c,l){var u=Ct(c,2),h=u[0],p=u[1],f=p+r2(l).value.length;if(p>s||fr.length?n:r,u=n.length>r.length?r:n,h=l.indexOf(u);if(h!=-1)return c=[new t.Diff(1,l.substring(0,h)),new t.Diff(0,u),new t.Diff(1,l.substring(h+u.length))],n.length>r.length&&(c[0][0]=c[2][0]=-1),c;if(u.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var p=this.diff_halfMatch_(n,r);if(p){var f=p[0],g=p[1],y=p[2],C=p[3],w=p[4],_=this.diff_main(f,y,s,a),b=this.diff_main(g,C,s,a);return _.concat([new t.Diff(0,w)],b)}return s&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,a):this.diff_bisect_(n,r,a)},t.prototype.diff_lineMode_=function(n,r,s){var a=this.diff_linesToChars_(n,r);n=a.chars1,r=a.chars2;var c=a.lineArray,l=this.diff_main(n,r,!1,s);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new t.Diff(0,""));for(var u=0,h=0,p=0,f="",g="";u=1&&p>=1){l.splice(u-h-p,h+p),u=u-h-p;for(var y=this.diff_main(f,g,!1,s),C=y.length-1;C>=0;C--)l.splice(u,0,y[C]);u+=y.length}p=0,h=0,f="",g=""}u++}return l.pop(),l},t.prototype.diff_bisect_=function(n,r,s){for(var a=n.length,c=r.length,l=Math.ceil((a+c)/2),u=l,h=2*l,p=new Array(h),f=new Array(h),g=0;gs);S++){for(var E=-S+w;E<=S-_;E+=2){for(var T=u+E,A=(H=E==-S||E!=S&&p[T-1]a)_+=2;else if(A>c)w+=2;else if(C&&(R=u+y-E)>=0&&R=(M=a-f[R]))return this.diff_bisectSplit_(n,r,H,A,s)}for(var D=-S+b;D<=S-x;D+=2){for(var M,R=u+D,z=(M=D==-S||D!=S&&f[R-1]a)x+=2;else if(z>c)b+=2;else if(!C&&(T=u+y-D)>=0&&T=(M=a-M))return this.diff_bisectSplit_(n,r,H,A,s)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,s,a,c){var l=n.substring(0,s),u=r.substring(0,a),h=n.substring(s),p=r.substring(a),f=this.diff_main(l,u,!1,c),g=this.diff_main(h,p,!1,c);return f.concat(g)},t.prototype.diff_linesToChars_=function(n,r){var s=[],a={};function c(h){for(var p="",f=0,g=-1,y=s.length;ga?n=n.substring(s-a):sr.length?n:r,a=n.length>r.length?r:n;if(s.length<4||2*a.length=w.length?[x,S,E,T,M]:null}var u,h,p,f,g,y=l(s,a,Math.ceil(s.length/4)),C=l(s,a,Math.ceil(s.length/2));return y||C?(u=C?y&&y[4].length>C[4].length?y:C:y,n.length>r.length?(h=u[0],p=u[1],f=u[2],g=u[3]):(f=u[0],g=u[1],h=u[2],p=u[3]),[h,p,f,g,u[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,s=[],a=0,c=null,l=0,u=0,h=0,p=0,f=0;l0?s[a-1]:-1,u=0,h=0,p=0,f=0,c=null,r=!0)),l++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),l=1;l=w?(C>=g.length/2||C>=y.length/2)&&(n.splice(l,0,new t.Diff(0,y.substring(0,C))),n[l-1][1]=g.substring(0,g.length-C),n[l+1][1]=y.substring(C),l++):(w>=g.length/2||w>=y.length/2)&&(n.splice(l,0,new t.Diff(0,g.substring(0,w))),n[l-1][0]=1,n[l-1][1]=y.substring(0,y.length-w),n[l+1][0]=-1,n[l+1][1]=g.substring(w),l++),l++}l++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(w,_){if(!w||!_)return 6;var b=w.charAt(w.length-1),x=_.charAt(0),S=b.match(t.nonAlphaNumericRegex_),E=x.match(t.nonAlphaNumericRegex_),T=S&&b.match(t.whitespaceRegex_),A=E&&x.match(t.whitespaceRegex_),D=T&&b.match(t.linebreakRegex_),M=A&&x.match(t.linebreakRegex_),R=D&&w.match(t.blanklineEndRegex_),z=M&&_.match(t.blanklineStartRegex_);return R||z?5:D||M?4:S&&!T&&A?3:T||A?2:S||E?1:0}for(var s=1;s=y&&(y=C,p=a,f=c,g=l)}n[s-1][1]!=p&&(p?n[s-1][1]=p:(n.splice(s-1,1),s--),n[s][1]=f,g?n[s+1][1]=g:(n.splice(s+1,1),s--))}s++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,s=[],a=0,c=null,l=0,u=!1,h=!1,p=!1,f=!1;l0?s[a-1]:-1,p=f=!1),r=!0)),l++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,s=0,a=0,c=0,l="",u="";s1?(a!==0&&c!==0&&((r=this.diff_commonPrefix(u,l))!==0&&(s-a-c>0&&n[s-a-c-1][0]==0?n[s-a-c-1][1]+=u.substring(0,r):(n.splice(0,0,new t.Diff(0,u.substring(0,r))),s++),u=u.substring(r),l=l.substring(r)),(r=this.diff_commonSuffix(u,l))!==0&&(n[s][1]=u.substring(u.length-r)+n[s][1],u=u.substring(0,u.length-r),l=l.substring(0,l.length-r))),s-=a+c,n.splice(s,a+c),l.length&&(n.splice(s,0,new t.Diff(-1,l)),s++),u.length&&(n.splice(s,0,new t.Diff(1,u)),s++),s++):s!==0&&n[s-1][0]==0?(n[s-1][1]+=n[s][1],n.splice(s,1)):s++,c=0,a=0,l="",u=""}n[n.length-1][1]===""&&n.pop();var h=!1;for(s=1;sr));s++)l=a,u=c;return n.length!=s&&n[s][0]===-1?u:u+(r-l)},t.prototype.diff_prettyHtml=function(n){for(var r=[],s=/&/g,a=//g,l=/\n/g,u=0;u");switch(h){case 1:r[u]=''+p+"";break;case-1:r[u]=''+p+"";break;case 0:r[u]=""+p+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],s=0;sthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var a=this.match_alphabet_(r),c=this;function l(A,D){var M=A/r.length,R=Math.abs(s-D);return c.Match_Distance?M+R/c.Match_Distance:R?1:M}var u=this.Match_Threshold,h=n.indexOf(r,s);h!=-1&&(u=Math.min(l(0,h),u),(h=n.lastIndexOf(r,s+r.length))!=-1&&(u=Math.min(l(0,h),u)));var p,f,g=1<=_;S--){var E=a[n.charAt(S-1)];if(x[S]=w===0?(x[S+1]<<1|1)&E:(x[S+1]<<1|1)&E|(y[S+1]|y[S])<<1|1|y[S+1],x[S]&g){var T=l(w,S-1);if(T<=u){if(u=T,!((h=S-1)>s))break;_=Math.max(1,2*s-h)}}}if(l(w+1,s)>u)break;y=x}return h},t.prototype.match_alphabet_=function(n){for(var r={},s=0;s2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(n&&typeof n=="object"&&r===void 0&&s===void 0)c=n,a=this.diff_text1(c);else if(typeof n=="string"&&r&&typeof r=="object"&&s===void 0)a=n,c=r;else{if(typeof n!="string"||typeof r!="string"||!s||typeof s!="object")throw new Error("Unknown call format to patch_make.");a=n,c=s}if(c.length===0)return[];for(var l=[],u=new t.patch_obj,h=0,p=0,f=0,g=a,y=a,C=0;C=2*this.Patch_Margin&&h&&(this.patch_addContext_(u,g),l.push(u),u=new t.patch_obj,h=0,g=y,p=f)}w!==1&&(p+=_.length),w!==-1&&(f+=_.length)}return h&&(this.patch_addContext_(u,g),l.push(u)),l},t.prototype.patch_deepCopy=function(n){for(var r=[],s=0;sthis.Match_MaxBits?(u=this.match_main(r,f.substring(0,this.Match_MaxBits),p))!=-1&&((g=this.match_main(r,f.substring(f.length-this.Match_MaxBits),p+f.length-this.Match_MaxBits))==-1||u>=g)&&(u=-1):u=this.match_main(r,f,p),u==-1)c[l]=!1,a-=n[l].length2-n[l].length1;else if(c[l]=!0,a=u-p,f==(h=g==-1?r.substring(u,u+f.length):r.substring(u,g+this.Match_MaxBits)))r=r.substring(0,u)+this.diff_text2(n[l].diffs)+r.substring(u+f.length);else{var y=this.diff_main(f,h,!1);if(f.length>this.Match_MaxBits&&this.diff_levenshtein(y)/f.length>this.Patch_DeleteThreshold)c[l]=!1;else{this.diff_cleanupSemanticLossless(y);for(var C,w=0,_=0;_l[0][1].length){var u=r-l[0][1].length;l[0][1]=s.substring(l[0][1].length)+l[0][1],c.start1-=u,c.start2-=u,c.length1+=u,c.length2+=u}return(l=(c=n[n.length-1]).diffs).length==0||l[l.length-1][0]!=0?(l.push(new t.Diff(0,s)),c.length1+=r,c.length2+=r):r>l[l.length-1][1].length&&(u=r-l[l.length-1][1].length,l[l.length-1][1]+=s.substring(0,u),c.length1+=u,c.length2+=u),s},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,s=0;s2*r?(h.length1+=g.length,c+=g.length,p=!1,h.diffs.push(new t.Diff(f,g)),a.diffs.shift()):(g=g.substring(0,r-h.length1-this.Patch_Margin),h.length1+=g.length,c+=g.length,f===0?(h.length2+=g.length,l+=g.length):p=!1,h.diffs.push(new t.Diff(f,g)),g==a.diffs[0][1]?a.diffs.shift():a.diffs[0][1]=a.diffs[0][1].substring(g.length))}u=(u=this.diff_text2(h.diffs)).substring(u.length-this.Patch_Margin);var y=this.diff_text1(a.diffs).substring(0,this.Patch_Margin);y!==""&&(h.length1+=y.length,h.length2+=y.length,h.diffs.length!==0&&h.diffs[h.diffs.length-1][0]===0?h.diffs[h.diffs.length-1][1]+=y:h.diffs.push(new t.Diff(0,y))),p||n.splice(++s,0,h)}}},t.prototype.patch_toText=function(n){for(var r=[],s=0;ss||fr.length?n:r,u=n.length>r.length?r:n,h=l.indexOf(u);if(h!=-1)return c=[new t.Diff(1,l.substring(0,h)),new t.Diff(0,u),new t.Diff(1,l.substring(h+u.length))],n.length>r.length&&(c[0][0]=c[2][0]=-1),c;if(u.length==1)return[new t.Diff(-1,n),new t.Diff(1,r)];var p=this.diff_halfMatch_(n,r);if(p){var f=p[0],g=p[1],y=p[2],C=p[3],w=p[4],b=this.diff_main(f,y,s,a),_=this.diff_main(g,C,s,a);return b.concat([new t.Diff(0,w)],_)}return s&&n.length>100&&r.length>100?this.diff_lineMode_(n,r,a):this.diff_bisect_(n,r,a)},t.prototype.diff_lineMode_=function(n,r,s){var a=this.diff_linesToChars_(n,r);n=a.chars1,r=a.chars2;var c=a.lineArray,l=this.diff_main(n,r,!1,s);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new t.Diff(0,""));for(var u=0,h=0,p=0,f="",g="";u=1&&p>=1){l.splice(u-h-p,h+p),u=u-h-p;for(var y=this.diff_main(f,g,!1,s),C=y.length-1;C>=0;C--)l.splice(u,0,y[C]);u+=y.length}p=0,h=0,f="",g=""}u++}return l.pop(),l},t.prototype.diff_bisect_=function(n,r,s){for(var a=n.length,c=r.length,l=Math.ceil((a+c)/2),u=l,h=2*l,p=new Array(h),f=new Array(h),g=0;gs);S++){for(var E=-S+w;E<=S-b;E+=2){for(var T=u+E,A=(H=E==-S||E!=S&&p[T-1]a)b+=2;else if(A>c)w+=2;else if(C&&(R=u+y-E)>=0&&R=(M=a-f[R]))return this.diff_bisectSplit_(n,r,H,A,s)}for(var D=-S+_;D<=S-x;D+=2){for(var M,R=u+D,z=(M=D==-S||D!=S&&f[R-1]a)x+=2;else if(z>c)_+=2;else if(!C&&(T=u+y-D)>=0&&T=(M=a-M))return this.diff_bisectSplit_(n,r,H,A,s)}}}return[new t.Diff(-1,n),new t.Diff(1,r)]},t.prototype.diff_bisectSplit_=function(n,r,s,a,c){var l=n.substring(0,s),u=r.substring(0,a),h=n.substring(s),p=r.substring(a),f=this.diff_main(l,u,!1,c),g=this.diff_main(h,p,!1,c);return f.concat(g)},t.prototype.diff_linesToChars_=function(n,r){var s=[],a={};function c(h){for(var p="",f=0,g=-1,y=s.length;ga?n=n.substring(s-a):sr.length?n:r,a=n.length>r.length?r:n;if(s.length<4||2*a.length=w.length?[x,S,E,T,M]:null}var u,h,p,f,g,y=l(s,a,Math.ceil(s.length/4)),C=l(s,a,Math.ceil(s.length/2));return y||C?(u=C?y&&y[4].length>C[4].length?y:C:y,n.length>r.length?(h=u[0],p=u[1],f=u[2],g=u[3]):(f=u[0],g=u[1],h=u[2],p=u[3]),[h,p,f,g,u[4]]):null},t.prototype.diff_cleanupSemantic=function(n){for(var r=!1,s=[],a=0,c=null,l=0,u=0,h=0,p=0,f=0;l0?s[a-1]:-1,u=0,h=0,p=0,f=0,c=null,r=!0)),l++;for(r&&this.diff_cleanupMerge(n),this.diff_cleanupSemanticLossless(n),l=1;l=w?(C>=g.length/2||C>=y.length/2)&&(n.splice(l,0,new t.Diff(0,y.substring(0,C))),n[l-1][1]=g.substring(0,g.length-C),n[l+1][1]=y.substring(C),l++):(w>=g.length/2||w>=y.length/2)&&(n.splice(l,0,new t.Diff(0,g.substring(0,w))),n[l-1][0]=1,n[l-1][1]=y.substring(0,y.length-w),n[l+1][0]=-1,n[l+1][1]=g.substring(w),l++),l++}l++}},t.prototype.diff_cleanupSemanticLossless=function(n){function r(w,b){if(!w||!b)return 6;var _=w.charAt(w.length-1),x=b.charAt(0),S=_.match(t.nonAlphaNumericRegex_),E=x.match(t.nonAlphaNumericRegex_),T=S&&_.match(t.whitespaceRegex_),A=E&&x.match(t.whitespaceRegex_),D=T&&_.match(t.linebreakRegex_),M=A&&x.match(t.linebreakRegex_),R=D&&w.match(t.blanklineEndRegex_),z=M&&b.match(t.blanklineStartRegex_);return R||z?5:D||M?4:S&&!T&&A?3:T||A?2:S||E?1:0}for(var s=1;s=y&&(y=C,p=a,f=c,g=l)}n[s-1][1]!=p&&(p?n[s-1][1]=p:(n.splice(s-1,1),s--),n[s][1]=f,g?n[s+1][1]=g:(n.splice(s+1,1),s--))}s++}},t.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,t.whitespaceRegex_=/\s/,t.linebreakRegex_=/[\r\n]/,t.blanklineEndRegex_=/\n\r?\n$/,t.blanklineStartRegex_=/^\r?\n\r?\n/,t.prototype.diff_cleanupEfficiency=function(n){for(var r=!1,s=[],a=0,c=null,l=0,u=!1,h=!1,p=!1,f=!1;l0?s[a-1]:-1,p=f=!1),r=!0)),l++;r&&this.diff_cleanupMerge(n)},t.prototype.diff_cleanupMerge=function(n){n.push(new t.Diff(0,""));for(var r,s=0,a=0,c=0,l="",u="";s1?(a!==0&&c!==0&&((r=this.diff_commonPrefix(u,l))!==0&&(s-a-c>0&&n[s-a-c-1][0]==0?n[s-a-c-1][1]+=u.substring(0,r):(n.splice(0,0,new t.Diff(0,u.substring(0,r))),s++),u=u.substring(r),l=l.substring(r)),(r=this.diff_commonSuffix(u,l))!==0&&(n[s][1]=u.substring(u.length-r)+n[s][1],u=u.substring(0,u.length-r),l=l.substring(0,l.length-r))),s-=a+c,n.splice(s,a+c),l.length&&(n.splice(s,0,new t.Diff(-1,l)),s++),u.length&&(n.splice(s,0,new t.Diff(1,u)),s++),s++):s!==0&&n[s-1][0]==0?(n[s-1][1]+=n[s][1],n.splice(s,1)):s++,c=0,a=0,l="",u=""}n[n.length-1][1]===""&&n.pop();var h=!1;for(s=1;sr));s++)l=a,u=c;return n.length!=s&&n[s][0]===-1?u:u+(r-l)},t.prototype.diff_prettyHtml=function(n){for(var r=[],s=/&/g,a=//g,l=/\n/g,u=0;u");switch(h){case 1:r[u]=''+p+"";break;case-1:r[u]=''+p+"";break;case 0:r[u]=""+p+""}}return r.join("")},t.prototype.diff_text1=function(n){for(var r=[],s=0;sthis.Match_MaxBits)throw new Error("Pattern too long for this browser.");var a=this.match_alphabet_(r),c=this;function l(A,D){var M=A/r.length,R=Math.abs(s-D);return c.Match_Distance?M+R/c.Match_Distance:R?1:M}var u=this.Match_Threshold,h=n.indexOf(r,s);h!=-1&&(u=Math.min(l(0,h),u),(h=n.lastIndexOf(r,s+r.length))!=-1&&(u=Math.min(l(0,h),u)));var p,f,g=1<=b;S--){var E=a[n.charAt(S-1)];if(x[S]=w===0?(x[S+1]<<1|1)&E:(x[S+1]<<1|1)&E|(y[S+1]|y[S])<<1|1|y[S+1],x[S]&g){var T=l(w,S-1);if(T<=u){if(u=T,!((h=S-1)>s))break;b=Math.max(1,2*s-h)}}}if(l(w+1,s)>u)break;y=x}return h},t.prototype.match_alphabet_=function(n){for(var r={},s=0;s2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(n&&typeof n=="object"&&r===void 0&&s===void 0)c=n,a=this.diff_text1(c);else if(typeof n=="string"&&r&&typeof r=="object"&&s===void 0)a=n,c=r;else{if(typeof n!="string"||typeof r!="string"||!s||typeof s!="object")throw new Error("Unknown call format to patch_make.");a=n,c=s}if(c.length===0)return[];for(var l=[],u=new t.patch_obj,h=0,p=0,f=0,g=a,y=a,C=0;C=2*this.Patch_Margin&&h&&(this.patch_addContext_(u,g),l.push(u),u=new t.patch_obj,h=0,g=y,p=f)}w!==1&&(p+=b.length),w!==-1&&(f+=b.length)}return h&&(this.patch_addContext_(u,g),l.push(u)),l},t.prototype.patch_deepCopy=function(n){for(var r=[],s=0;sthis.Match_MaxBits?(u=this.match_main(r,f.substring(0,this.Match_MaxBits),p))!=-1&&((g=this.match_main(r,f.substring(f.length-this.Match_MaxBits),p+f.length-this.Match_MaxBits))==-1||u>=g)&&(u=-1):u=this.match_main(r,f,p),u==-1)c[l]=!1,a-=n[l].length2-n[l].length1;else if(c[l]=!0,a=u-p,f==(h=g==-1?r.substring(u,u+f.length):r.substring(u,g+this.Match_MaxBits)))r=r.substring(0,u)+this.diff_text2(n[l].diffs)+r.substring(u+f.length);else{var y=this.diff_main(f,h,!1);if(f.length>this.Match_MaxBits&&this.diff_levenshtein(y)/f.length>this.Patch_DeleteThreshold)c[l]=!1;else{this.diff_cleanupSemanticLossless(y);for(var C,w=0,b=0;bl[0][1].length){var u=r-l[0][1].length;l[0][1]=s.substring(l[0][1].length)+l[0][1],c.start1-=u,c.start2-=u,c.length1+=u,c.length2+=u}return(l=(c=n[n.length-1]).diffs).length==0||l[l.length-1][0]!=0?(l.push(new t.Diff(0,s)),c.length1+=r,c.length2+=r):r>l[l.length-1][1].length&&(u=r-l[l.length-1][1].length,l[l.length-1][1]+=s.substring(0,u),c.length1+=u,c.length2+=u),s},t.prototype.patch_splitMax=function(n){for(var r=this.Match_MaxBits,s=0;s2*r?(h.length1+=g.length,c+=g.length,p=!1,h.diffs.push(new t.Diff(f,g)),a.diffs.shift()):(g=g.substring(0,r-h.length1-this.Patch_Margin),h.length1+=g.length,c+=g.length,f===0?(h.length2+=g.length,l+=g.length):p=!1,h.diffs.push(new t.Diff(f,g)),g==a.diffs[0][1]?a.diffs.shift():a.diffs[0][1]=a.diffs[0][1].substring(g.length))}u=(u=this.diff_text2(h.diffs)).substring(u.length-this.Patch_Margin);var y=this.diff_text1(a.diffs).substring(0,this.Patch_Margin);y!==""&&(h.length1+=y.length,h.length2+=y.length,h.diffs.length!==0&&h.diffs[h.diffs.length-1][0]===0?h.diffs[h.diffs.length-1][1]+=y:h.diffs.push(new t.Diff(0,y))),p||n.splice(++s,0,h)}}},t.prototype.patch_toText=function(n){for(var r=[],s=0;s1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?$$:U$,r=n2(e.map((function(l){return l.changes})),ow).map(n).reduce((function(l,u){var h=Ct(l,2),p=h[0],f=h[1],g=Ct(u,2),y=g[0],C=g[1];return[p.concat(y),f.concat(C)]}),[[],[]]),s=Ct(r,2),a=s[0],c=s[1];return z$(W_(a),W_(c))}var G$=["enhancers"],Z_=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,s=r===void 0?[]:r,a=Ct(S$(e,Zs(n,G$)),2),c=a[0],l=a[1],u=[q_(c),q_(l)],h=(t=[u[0],u[1]],s.reduce((function(w,_){return _(w)}),t)),p=Ct(h,2),f=p[0],g=p[1],y=[f.map(G_),g.map(G_)],C=y[1];return{old:y[0].map((function(w){var _;return(_=w.children)!==null&&_!==void 0?_:[]})),new:C.map((function(w){var _;return(_=w.children)!==null&&_!==void 0?_:[]}))}};const V$=2e3,W$={highlight(e,t){return Xe.highlight(e,t).children}};function Y$(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function cw(e){let t=0,n=0;for(const r of e.hunks)for(const s of r.changes)s.type==="insert"?t++:s.type==="delete"&&n++;return{additions:t,deletions:n}}function X$(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function K$(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function Z$(e){const t=[q$(e.hunks,{type:"line"})],n=r8(X$(e));return n&&Xe.registered(n)?Z_(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:W$}):Z_(e.hunks,{enhancers:t,highlight:!1})}const Q$=({change:e,side:t})=>t==="old"?null:Y$(e);function Q_(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function uw({bytesRead:e,byteLimit:t}){return m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsxs("p",{children:["This diff is larger than ",Q_(t)," (",Q_(e)," read). View it locally with git."]})]})}function J$({file:e,defaultExpanded:t}){const[n,r]=P.useState(t),{additions:s,deletions:a}=P.useMemo(()=>cw(e),[e]),c=n&&s+a<=V$,l=P.useMemo(()=>{if(c)try{return Z$(e)}catch{return}},[e,c]);return m.jsxs("section",{className:"diff-file-card",children:[m.jsxs("button",{className:"diff-file-header",onClick:()=>r(u=>!u),children:[m.jsx("span",{className:"chev",children:n?m.jsx(Pa,{size:14}):m.jsx(Qc,{size:14})}),m.jsx("span",{className:"path",children:m.jsx("code",{children:K$(e)})}),m.jsxs("span",{className:"stats",children:[m.jsxs("span",{className:"diff-stat-add",children:["+",s]}),m.jsxs("span",{className:"diff-stat-del",children:["−",a]})]})]}),n&&(e.hunks.length===0?m.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):m.jsx(d$,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:Q$,tokens:l,viewType:"unified"}))]})}function i2({diff:e,className:t}){const n=P.useMemo(()=>{if(!e.trim())return[];try{return j8(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?m.jsx("div",{className:"diff-empty",children:"No changes."}):m.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,s)=>m.jsx(J$,{file:r,defaultExpanded:s===0},`${r.oldPath}→${r.newPath}#${s}`))})}const eU=5e3;function tU({sessionId:e,projectId:t,view:n,toggled:r,onViewChange:s,onToggledChange:a,onOpenFile:c}){var T;const[l,u]=P.useState(null),[h,p]=P.useState(null),[f,g]=P.useState(null),[y,C]=P.useState(!0),w=P.useRef(0),_=P.useCallback(()=>{const A=++w.current;C(!0),Promise.all([sT(e),jx(t,{sessionId:e})]).then(([D,M])=>{A===w.current&&(u(D),p(M),g(null))}).catch(D=>{A===w.current&&g(D.message)}).finally(()=>{A===w.current&&C(!1)})},[e,t]);P.useEffect(()=>(u(null),p(null),g(null),_(),()=>{w.current++}),[_]),P.useEffect(()=>{let A=!1,D=!1,M=!1,R=null;const z=()=>{R||(R=setInterval(_,eU))},H=()=>{R&&(clearInterval(R),R=null)},q=Mc($=>{$.type!=="busy"||$.sessionId!==e||(D=!0,$.busy&&!A?(A=!0,z()):!$.busy&&A&&(A=!1,H(),_()))});return oh(t).then($=>{var U;M||D||A||(U=$.find(K=>K.id===e))!=null&&U.busy&&(A=!0,z())}).catch(()=>{}),()=>{M=!0,q(),H()}},[e,t,_]);const b=P.useMemo(()=>h?A8(h.entries):null,[h]),x=P.useCallback(A=>{const D=new Set(r);D.has(A)?D.delete(A):D.add(A),a(D)},[r,a]),S=(l==null?void 0:l.branch)??(l!=null&&l.baselineBranch?`detached @ ${l.baselineBranch}`:"detached"),E=((T=l==null?void 0:l.files)==null?void 0:T.length)??0;return m.jsxs("div",{className:"code-tab wt-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:n==="changes"?"active":"",onClick:()=>s("changes"),children:"Changes"}),m.jsx("button",{className:n==="files"?"active":"",onClick:()=>s("files"),children:"Files"})]}),(l==null?void 0:l.exists)&&m.jsxs("span",{className:"wt-branch-chip",title:S,children:[m.jsx(cl,{size:12}),m.jsx("span",{className:"wt-branch-name",children:S})]}),(l==null?void 0:l.exists)&&n==="changes"&&m.jsxs("span",{className:"code-tab-note wt-count",children:[E," ",E===1?"file":"files"]}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:_,children:y?m.jsx("span",{className:"spinner"}):m.jsx(Zh,{size:13})})]}),f&&(l||h)&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",f]}),l?l.exists?n==="changes"?m.jsx("div",{className:"code-tab-body wt-changes",children:E===0||!l.diff?m.jsx("div",{className:"changes-note",children:"No changes yet."}):m.jsxs(m.Fragment,{children:[l.diff.truncated&&m.jsx(uw,{bytesRead:l.diff.bytesRead,byteLimit:l.diff.byteLimit}),m.jsx(i2,{diff:l.diff.diff})]})}):m.jsxs("div",{className:"code-tab-body",children:[(h==null?void 0:h.root)==="clone"&&m.jsx("div",{className:"code-tab-note",children:"Worktree unavailable — showing the project clone."}),(h==null?void 0:h.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),b?b.dirs.size===0&&b.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Wv,{node:b,parentPath:"",depth:0,toggled:r,onToggle:x,onOpenFile:A=>c(A,e)})}):m.jsx("div",{className:"code-tab-note",children:"Loading…"})]}):m.jsx("div",{className:"code-tab-body",children:m.jsxs("div",{className:"wt-empty",children:[m.jsx(Ng,{size:22}),m.jsx("p",{children:"The agent hasn't started working yet — its worktree is created on the first message."})]})}):m.jsx("div",{className:"code-tab-body",children:m.jsx("div",{className:"code-tab-note",children:f?`Failed to load: ${f}`:"Loading…"})})]})}function hw({text:e,path:t}){const n=P.useMemo(()=>c8(e,r8(t)),[e,t]),r=e?e.split(` +`:"")+p.content]}),["",""]),n=Ct(t,2),r=Ct(ow(n[0],n[1]),2),s=r[0],a=r[1];if(s.length===0&&a.length===0)return[[],[]];var c=function(h){if(h&&!is(h))return h.lineNumber},l=c(e.find(jr)),u=c(e.find(ta));if(l===void 0||u===void 0)throw new Error("Could not find start line number for edit");return[K_(X_(s),l),K_(X_(a),u)]}function $$(e){var t=e.reduce((function(r,s){var a=Ct(r,3),c=a[0],l=a[1],u=a[2];if(!u||!jr(u)||!ta(s))return[c,l,s];var h=Ct(ow(u.content,s.content),2),p=h[0],f=h[1];return[c.concat(og(p,u.lineNumber)),l.concat(og(f,s.lineNumber)),s]}),[[],[],null]),n=Ct(t,2);return[n[0],n[1]]}function U$(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).type,n=(t===void 0?"block":t)==="block"?P$:$$,r=n2(e.map((function(l){return l.changes})),aw).map(n).reduce((function(l,u){var h=Ct(l,2),p=h[0],f=h[1],g=Ct(u,2),y=g[0],C=g[1];return[p.concat(y),f.concat(C)]}),[[],[]]),s=Ct(r,2),a=s[0],c=s[1];return B$(W_(a),W_(c))}var q$=["enhancers"],Z_=function(e){var t,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.enhancers,s=r===void 0?[]:r,a=Ct(x$(e,Zs(n,q$)),2),c=a[0],l=a[1],u=[q_(c),q_(l)],h=(t=[u[0],u[1]],s.reduce((function(w,b){return b(w)}),t)),p=Ct(h,2),f=p[0],g=p[1],y=[f.map(G_),g.map(G_)],C=y[1];return{old:y[0].map((function(w){var b;return(b=w.children)!==null&&b!==void 0?b:[]})),new:C.map((function(w){var b;return(b=w.children)!==null&&b!==void 0?b:[]}))}};const G$=2e3,V$={highlight(e,t){return Xe.highlight(e,t).children}};function W$(e){return e.type==="normal"?e.newLineNumber:e.lineNumber}function lw(e){let t=0,n=0;for(const r of e.hunks)for(const s of r.changes)s.type==="insert"?t++:s.type==="delete"&&n++;return{additions:t,deletions:n}}function Y$(e){return e.newPath==="/dev/null"?e.oldPath:(e.oldPath==="/dev/null",e.newPath)}function X$(e){switch(e.type){case"delete":return e.oldPath;case"add":case"modify":return e.newPath;case"rename":case"copy":return`${e.oldPath} → ${e.newPath}`}}function K$(e){const t=[U$(e.hunks,{type:"line"})],n=n8(Y$(e));return n&&Xe.registered(n)?Z_(e.hunks,{enhancers:t,highlight:!0,language:n,refractor:V$}):Z_(e.hunks,{enhancers:t,highlight:!1})}const Z$=({change:e,side:t})=>t==="old"?null:W$(e);function Q_(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/1024).toFixed(1)} KB`}function cw({bytesRead:e,byteLimit:t}){return m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsxs("p",{children:["This diff is larger than ",Q_(t)," (",Q_(e)," read). View it locally with git."]})]})}function Q$({file:e,defaultExpanded:t}){const[n,r]=P.useState(t),{additions:s,deletions:a}=P.useMemo(()=>lw(e),[e]),c=n&&s+a<=G$,l=P.useMemo(()=>{if(c)try{return K$(e)}catch{return}},[e,c]);return m.jsxs("section",{className:"diff-file-card",children:[m.jsxs("button",{className:"diff-file-header",onClick:()=>r(u=>!u),children:[m.jsx("span",{className:"chev",children:n?m.jsx(Pa,{size:14}):m.jsx(Qc,{size:14})}),m.jsx("span",{className:"path",children:m.jsx("code",{children:X$(e)})}),m.jsxs("span",{className:"stats",children:[m.jsxs("span",{className:"diff-stat-add",children:["+",s]}),m.jsxs("span",{className:"diff-stat-del",children:["−",a]})]})]}),n&&(e.hunks.length===0?m.jsx("div",{className:"diff-empty",children:"No textual diff for this file."}):m.jsx(h$,{className:"openresearch-diff-file",diffType:e.type,gutterType:"default",hunks:e.hunks,renderGutter:Z$,tokens:l,viewType:"unified"}))]})}function i2({diff:e,className:t}){const n=P.useMemo(()=>{if(!e.trim())return[];try{return R8(e,{nearbySequences:"zip"})}catch{return[]}},[e]);return n.length===0?m.jsx("div",{className:"diff-empty",children:"No changes."}):m.jsx("div",{className:t?`openresearch-diff ${t}`:"openresearch-diff",children:n.map((r,s)=>m.jsx(Q$,{file:r,defaultExpanded:s===0},`${r.oldPath}→${r.newPath}#${s}`))})}const J$=5e3;function eU({sessionId:e,projectId:t,view:n,toggled:r,onViewChange:s,onToggledChange:a,onOpenFile:c}){var T;const[l,u]=P.useState(null),[h,p]=P.useState(null),[f,g]=P.useState(null),[y,C]=P.useState(!0),w=P.useRef(0),b=P.useCallback(()=>{const A=++w.current;C(!0),Promise.all([iT(e),jx(t,{sessionId:e})]).then(([D,M])=>{A===w.current&&(u(D),p(M),g(null))}).catch(D=>{A===w.current&&g(D.message)}).finally(()=>{A===w.current&&C(!1)})},[e,t]);P.useEffect(()=>(u(null),p(null),g(null),b(),()=>{w.current++}),[b]),P.useEffect(()=>{let A=!1,D=!1,M=!1,R=null;const z=()=>{R||(R=setInterval(b,J$))},H=()=>{R&&(clearInterval(R),R=null)},$=Mc(U=>{U.type!=="busy"||U.sessionId!==e||(D=!0,U.busy&&!A?(A=!0,z()):!U.busy&&A&&(A=!1,H(),b()))});return oh(t).then(U=>{var q;M||D||A||(q=U.find(K=>K.id===e))!=null&&q.busy&&(A=!0,z())}).catch(()=>{}),()=>{M=!0,$(),H()}},[e,t,b]);const _=P.useMemo(()=>h?k8(h.entries):null,[h]),x=P.useCallback(A=>{const D=new Set(r);D.has(A)?D.delete(A):D.add(A),a(D)},[r,a]),S=(l==null?void 0:l.branch)??(l!=null&&l.baselineBranch?`detached @ ${l.baselineBranch}`:"detached"),E=((T=l==null?void 0:l.files)==null?void 0:T.length)??0;return m.jsxs("div",{className:"code-tab wt-tab",children:[m.jsxs("div",{className:"code-tab-header",children:[m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:n==="changes"?"active":"",onClick:()=>s("changes"),children:"Changes"}),m.jsx("button",{className:n==="files"?"active":"",onClick:()=>s("files"),children:"Files"})]}),(l==null?void 0:l.exists)&&m.jsxs("span",{className:"wt-branch-chip",title:S,children:[m.jsx(cl,{size:12}),m.jsx("span",{className:"wt-branch-name",children:S})]}),(l==null?void 0:l.exists)&&n==="changes"&&m.jsxs("span",{className:"code-tab-note wt-count",children:[E," ",E===1?"file":"files"]}),m.jsx("span",{style:{flex:1}}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:b,children:y?m.jsx("span",{className:"spinner"}):m.jsx(Zh,{size:13})})]}),f&&(l||h)&&m.jsxs("div",{className:"code-tab-note",children:["Refresh failed: ",f]}),l?l.exists?n==="changes"?m.jsx("div",{className:"code-tab-body wt-changes",children:E===0||!l.diff?m.jsx("div",{className:"changes-note",children:"No changes yet."}):m.jsxs(m.Fragment,{children:[l.diff.truncated&&m.jsx(cw,{bytesRead:l.diff.bytesRead,byteLimit:l.diff.byteLimit}),m.jsx(i2,{diff:l.diff.diff})]})}):m.jsxs("div",{className:"code-tab-body",children:[(h==null?void 0:h.root)==="clone"&&m.jsx("div",{className:"code-tab-note",children:"Worktree unavailable — showing the project clone."}),(h==null?void 0:h.truncated)&&m.jsx("div",{className:"code-tab-note",children:"listing truncated"}),_?_.dirs.size===0&&_.files.length===0?m.jsx("div",{className:"code-tab-note",children:"No files."}):m.jsx("div",{className:"code-tree",children:m.jsx(Wv,{node:_,parentPath:"",depth:0,toggled:r,onToggle:x,onOpenFile:A=>c(A,e)})}):m.jsx("div",{className:"code-tab-note",children:"Loading…"})]}):m.jsx("div",{className:"code-tab-body",children:m.jsxs("div",{className:"wt-empty",children:[m.jsx(Mg,{size:22}),m.jsx("p",{children:"The agent hasn't started working yet — its worktree is created on the first message."})]})}):m.jsx("div",{className:"code-tab-body",children:m.jsx("div",{className:"code-tab-note",children:f?`Failed to load: ${f}`:"Loading…"})})]})}function uw({text:e,path:t}){const n=P.useMemo(()=>l8(e,n8(t)),[e,t]),r=e?e.split(` `).length-(e.endsWith(` `)?1:0):0;return m.jsxs("div",{className:"file-view-codewrap",children:[r>0&&m.jsx("pre",{className:"file-view-gutter","aria-hidden":"true",children:Array.from({length:r},(s,a)=>a+1).join(` -`)}),m.jsx("pre",{className:"file-view-code",children:m.jsx("code",{children:n})})]})}const nU="project";function rU(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function iU(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` ----`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const dw=/\.(png|jpe?g|gif|webp|svg)$/i,sU=/\.(md|mdx|markdown)$/i,aU=512*1024,fw="orx:files-tree-width",pw=180,mw=560,oU=280;function lU(){try{const e=Number(localStorage.getItem(fw));if(Number.isFinite(e)&&e>=pw&&e<=mw)return e}catch{}return oU}function og(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=og(n.children??[],t);if(r)return r}}return null}function gw(e){const t=[];for(const n of e)n.isDir&&(n.reportTitle!==void 0&&t.push(n),t.push(...gw(n.children??[])));return t}function vw({projectId:e,folder:t,markdown:n}){const r=s=>{if(rU(s))return s;const a=s.replace(/^\.?\//,"");return Jc(e,t?`${t}/${a}`:a)};return m.jsx("div",{className:"md report-md",children:m.jsx(C7,{remarkPlugins:[t8,[n8,h8]],rehypePlugins:[MS],components:{a:({href:s,children:a,...c})=>{const l=!s||s.startsWith("#");return m.jsx("a",{...c,href:l?s:r(s),...l?{}:{target:"_blank",rel:"noopener noreferrer"},children:a})},img:({src:s,alt:a})=>{if(!s||typeof s!="string")return null;const c=r(s);return m.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"report-img",children:[m.jsx("img",{src:c,alt:a??"",loading:"lazy"}),a&&m.jsx("span",{className:"report-img-caption",children:a})]})},...f8},children:d8(iU(n))})})}function cU(e){return e.isDir?"report":sU.test(e.name)?"markdown":dw.test(e.name)?"image":/\.pdf$/i.test(e.name)?"pdf":"text"}function uU(e,t,n){const[r,s]=P.useState(null),[a,c]=P.useState(!1),[l,u]=P.useState(null),h=n==="report"||n==="markdown"||n==="text"&&t.size<=aU;return P.useEffect(()=>{if(s(null),c(!1),u(null),!h)return;let p=!1;return(n==="report"?Bx(e,t.path).then(g=>g.markdown):fetch(Jc(e,t.path)).then(g=>{if(!g.ok)throw new Error(`Failed to load file (${g.status})`);return g.text()})).then(g=>{p||(g.includes("\0")?c(!0):s(g))}).catch(g=>{p||u(g instanceof Error?g.message:String(g))}),()=>{p=!0}},[e,t.path,t.modifiedAt,n,h]),{text:r,binary:a,error:l,wantsText:h}}function hU({projectId:e,entry:t,onDelete:n}){const r=cU(t),{text:s,binary:a,error:c,wantsText:l}=uU(e,t,r),[u,h]=P.useState(!1),p=r==="report"||r==="markdown",f=t.isDir?t.path:t.path.split("/").slice(0,-1).join("/"),g=Jc(e,t.isDir?`${t.path}/report.md`:t.path);let y;return r==="image"?y=m.jsx("a",{className:"fpreview-image",href:g,target:"_blank",rel:"noopener noreferrer",children:m.jsx("img",{src:g,alt:t.name})}):r==="pdf"?y=m.jsx("iframe",{className:"fpreview-pdf",title:t.name,src:g}):!l||a?y=m.jsxs("div",{className:"file-view-note",children:[a?"Binary file — no inline preview.":"File too large to preview inline."," ",m.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",children:"Open raw"})]}):c?y=m.jsxs("div",{className:"file-view-note",children:["Failed to load: ",c]}):s===null?y=m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):p&&!u?y=m.jsx(vw,{projectId:e,folder:f,markdown:s}):y=m.jsx(hw,{text:s,path:t.isDir?"report.md":t.path}),m.jsxs("div",{className:"fpreview file-view",children:[m.jsxs("div",{className:"fpreview-head",children:[m.jsx(Cx,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"fpreview-path",title:t.path,children:t.isDir?`${t.path}/report.md`:t.path}),m.jsxs("span",{className:"fpreview-date",children:["Modified"," ",new Date(t.modifiedAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})]}),!t.isDir&&r==="text"&&m.jsx("span",{className:"fpreview-size",children:Ma(t.size)}),p&&m.jsx("button",{className:`icon-btn ${u?"active":""}`,"data-tip":u?"Rendered view":"View source","aria-label":u?"Rendered view":"View source",onClick:()=>h(C=>!C),children:m.jsx(bx,{size:13})}),m.jsx("a",{className:"icon-btn",href:g,target:"_blank",rel:"noopener noreferrer","data-tip":"Open raw in new tab","aria-label":"Open raw in new tab",children:m.jsx(Sx,{size:13})}),m.jsx("button",{className:"icon-btn","data-tip":t.isDir?"Delete report folder":"Delete file","aria-label":t.isDir?"Delete report folder":"Delete file",onClick:()=>{window.confirm(`Delete "${t.path}" from the files dir?`)&&n(t.path)},children:m.jsx(Rg,{size:13})})]}),m.jsx("div",{className:`fpreview-body ${p&&!u?"doc":""}`,children:y})]})}function yw({projectId:e,entries:t,depth:n,collapsed:r,selected:s,onToggle:a,onSelect:c}){return m.jsx(m.Fragment,{children:t.map(l=>{var h,p;const u={paddingLeft:8+n*14};if(l.isDir){const f=l.reportTitle!==void 0,g=!r.has(l.path),y=f?l.reportTitle:`${l.name}/`,C=f?[l.name,(h=l.experiment)==null?void 0:h.latestRunStatus].filter(Boolean).join(" — "):void 0;return m.jsxs("div",{children:[m.jsxs("div",{className:`ft-row ${s===l.path?"selected":""}`,style:u,title:C,onClick:()=>f?c(l.path):a(l.path),children:[m.jsx("button",{className:`ft-chevron ${g?"open":""}`,"aria-label":g?`Collapse ${l.name}`:`Expand ${l.name}`,onClick:w=>{w.stopPropagation(),a(l.path)},children:m.jsx(Qc,{size:12})}),m.jsx("span",{className:f?"ft-title":"ft-dirname",children:y})]}),g&&(((p=l.children)==null?void 0:p.length)??0)>0&&m.jsx(yw,{projectId:e,entries:l.children??[],depth:n+1,collapsed:r,selected:s,onToggle:a,onSelect:c})]},l.path)}return m.jsxs("div",{className:`ft-row file ${s===l.path?"selected":""}`,style:u,title:l.path,onClick:()=>c(l.path),children:[m.jsx("span",{className:"ft-chevron spacer"}),dw.test(l.name)&&m.jsx("img",{className:"ft-thumb",src:Jc(e,l.path),alt:"",loading:"lazy"}),m.jsx("span",{className:"ft-name",children:l.name})]},l.path)})})}function dU(e){const t=[],n=[],r=[];for(const s of e)s.isDir&&s.name===nU?t.push(s):s.isDir&&s.experiment?n.push(s):r.push(s);return{project:t,experiments:n,other:r}}function J_({dir:e,onOpenStorage:t}){const[n,r]=P.useState(!1);return m.jsxs("div",{className:"ftree-footer",title:e,children:[m.jsx("code",{children:e}),m.jsx("button",{className:"icon-btn tip-up","data-tip":n?"Copied!":"Copy path","aria-label":"Copy files directory path",onClick:()=>{var s;(s=navigator.clipboard)==null||s.writeText(e),r(!0),setTimeout(()=>r(!1),1200)},children:n?m.jsx(Zr,{size:12}):m.jsx(Tg,{size:12})}),m.jsx("button",{className:"icon-btn tip-up","data-tip":"Storage settings","aria-label":"Storage settings",onClick:t,children:m.jsx(LA,{size:12})})]})}function fU({project:e,files:t,onChanged:n,onOpenStorage:r}){const[s,a]=P.useState(null),[c,l]=P.useState(new Set),[u,h]=P.useState(!1),[p,f]=P.useState(lU),g=P.useRef(null),y=T=>{var z;T.preventDefault(),T.currentTarget.setPointerCapture(T.pointerId);const A=((z=g.current)==null?void 0:z.getBoundingClientRect().left)??0,D=document.body.style.userSelect;document.body.style.userSelect="none";const M=H=>{const q=Math.round(H.clientX-A),$=Math.min(Math.max(q,pw),mw);f($);try{localStorage.setItem(fw,String($))}catch{}},R=()=>{window.removeEventListener("pointermove",M),window.removeEventListener("pointerup",R),window.removeEventListener("pointercancel",R),document.body.style.userSelect=D};window.addEventListener("pointermove",M),window.addEventListener("pointerup",R),window.addEventListener("pointercancel",R)};P.useEffect(()=>{if(!t||u||(h(!0),s))return;const T=gw(t.entries);if(T.length===0)return;const A=T.reduce((D,M)=>M.modifiedAt>D.modifiedAt?M:D);a(A.path)},[t,u,s]),P.useEffect(()=>{s&&t&&!og(t.entries,s)&&a(null)},[s,t]);const C=T=>l(A=>{const D=new Set(A);return D.has(T)?D.delete(T):D.add(T),D}),w=T=>{(s===T||s!=null&&s.startsWith(T+"/"))&&a(null),TT(e.id,T).catch(()=>{}).finally(n)};if(!t)return m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"settings-loading",style:{padding:20},children:[m.jsx("span",{className:"spinner"})," Loading files…"]})});const{project:_,experiments:b,other:x}=dU(t.entries),S=T=>m.jsx(yw,{projectId:e.id,entries:T,depth:0,collapsed:c,selected:s,onToggle:C,onSelect:a}),E=s?og(t.entries,s):null;return t.entries.length===0?m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"files-empty-state",children:[m.jsx(Mg,{size:28,strokeWidth:1.5}),m.jsx("h3",{children:"No files yet"}),m.jsx("p",{children:"This is where the agent saves the project's files — experiment reports, figures, and other artifacts. Ask it for a write-up of its findings and the report will land here. You can also drop your own files into the folder:"}),m.jsx(J_,{dir:t.dir,onOpenStorage:r})]})}):m.jsxs("div",{className:"files-tab",children:[m.jsxs("div",{className:"ftree-pane",ref:g,style:{width:p},children:[m.jsx("div",{className:"ftree-resizer",onPointerDown:y}),m.jsxs("div",{className:"ftree-scroll",children:[S(_),S(b),x.length>0&&(b.length>0||_.length>0)&&m.jsx("div",{className:"ft-divider",children:"Other files"}),S(x),t.truncated&&m.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more files."})]}),m.jsx(J_,{dir:t.dir,onOpenStorage:r})]}),E?m.jsx(hU,{projectId:e.id,entry:E,onDelete:w},E.path):m.jsxs("div",{className:"fpreview fpreview-none",children:[m.jsx(kA,{size:22,strokeWidth:1.5}),m.jsx("span",{children:"Click a file to view it"})]})]})}function Bo({active:e,label:t,icon:n,onSelect:r,onClose:s}){return m.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,m.jsx("span",{className:"tab-label",children:t}),m.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:a=>{a.stopPropagation(),s()},children:m.jsx(Ko,{size:12})})]})}function pU({owner:e,repo:t,branch:n}){return m.jsxs("a",{className:"files-pill",href:jg(e,t,n),target:"_blank",rel:"noopener noreferrer",title:`Open ${n} on GitHub`,children:[m.jsx("code",{children:n}),m.jsx(qv,{size:12})]})}var Wp={exports:{}},e6;function mU(){return e6||(e6=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(s){this._terminal=s}dispose(){}fit(){const s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;const a=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(a._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const s=this._terminal._core,a=s._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(l.getPropertyValue("height")),h=Math.max(0,parseInt(l.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),f=u-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),g=h-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(g/a.css.cell.width)),rows:Math.max(1,Math.floor(f/a.css.cell.height))}}}})(),n})()))})(Wp)),Wp.exports}var gU=mU(),Yp={exports:{}},t6;function vU(){return t6||(t6=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const f=u(9042),g=u(9924),y=u(844),C=u(4725),w=u(2585),_=u(3656);let b=l.AccessibilityManager=class extends y.Disposable{constructor(x,S,E,T){super(),this._terminal=x,this._coreBrowserService=E,this._renderService=T,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let A=0;Athis._handleBoundaryFocus(A,0),this._bottomBoundaryFocusListener=A=>this._handleBoundaryFocus(A,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((A=>this._handleResize(A.rows)))),this.register(this._terminal.onRender((A=>this._refreshRows(A.start,A.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((A=>this._handleChar(A)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` -`)))),this.register(this._terminal.onA11yTab((A=>this._handleTab(A)))),this.register(this._terminal.onKey((A=>this._handleKey(A.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,_.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let S=0;S0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` -`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,S){this._liveRegionDebouncer.refresh(x,S,this._terminal.rows)}_renderRows(x,S){const E=this._terminal.buffer,T=E.lines.length.toString();for(let A=x;A<=S;A++){const D=E.lines.get(E.ydisp+A),M=[],R=(D==null?void 0:D.translateToString(!0,void 0,void 0,M))||"",z=(E.ydisp+A+1).toString(),H=this._rowElements[A];H&&(R.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=R,this._rowColumns.set(H,M)),H.setAttribute("aria-posinset",z),H.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,S){const E=x.target,T=this._rowElements[S===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==T)return;let A,D;if(S===0?(A=E,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(A=this._rowElements.shift(),D=E,this._rowContainer.removeChild(A)),A.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const M=this._createAccessibilityTreeNode();this._rowElements.unshift(M),this._rowContainer.insertAdjacentElement("afterbegin",M)}else{const M=this._createAccessibilityTreeNode();this._rowElements.push(M),this._rowContainer.appendChild(M)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var R;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:x.anchorNode,offset:x.anchorOffset},E={node:x.focusNode,offset:x.focusOffset};if((S.node.compareDocumentPosition(E.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===E.node&&S.offset>E.offset)&&([S,E]=[E,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const T=this._rowElements.slice(-1)[0];if(E.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(E={node:T,offset:((R=T.textContent)==null?void 0:R.length)??0}),!this._rowContainer.contains(E.node))return;const A=({node:z,offset:H})=>{const q=z instanceof Text?z.parentNode:z;let $=parseInt(q==null?void 0:q.getAttribute("aria-posinset"),10)-1;if(isNaN($))return console.warn("row is invalid. Race condition?"),null;const U=this._rowColumns.get(q);if(!U)return console.warn("columns is null. Race condition?"),null;let K=H=this._terminal.cols&&(++$,K=0),{row:$,column:K}},D=A(S),M=A(E);if(D&&M){if(D.row>M.row||D.row===M.row&&D.column>=M.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(M.row-D.row)*this._terminal.cols-D.column+M.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;Sx;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x{function u(g){return g.replace(/\r?\n/g,"\r")}function h(g,y){return y?"\x1B[200~"+g+"\x1B[201~":g}function p(g,y,C,w){g=h(g=u(g),C.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(g,!0),y.value=""}function f(g,y,C){const w=C.getBoundingClientRect(),_=g.clientX-w.left-10,b=g.clientY-w.top-10;y.style.width="20px",y.style.height="20px",y.style.left=`${_}px`,y.style.top=`${b}px`,y.style.zIndex="1000",y.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=u,l.bracketTextForPaste=h,l.copyHandler=function(g,y){g.clipboardData&&g.clipboardData.setData("text/plain",y.selectionText),g.preventDefault()},l.handlePasteEvent=function(g,y,C,w){g.stopPropagation(),g.clipboardData&&p(g.clipboardData.getData("text/plain"),y,C,w)},l.paste=p,l.moveTextAreaUnderMouseCursor=f,l.rightClickHandler=function(g,y,C,w,_){f(g,y,C),_&&w.rightClickSelect(g),y.value=w.selectionText,y.select()}},7239:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const h=u(1505);l.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(p,f,g){this._css.set(p,f,g)}getCss(p,f){return this._css.get(p,f)}setColor(p,f,g){this._color.set(p,f,g)}getColor(p,f){return this._color.get(p,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(u,h,p,f){u.addEventListener(h,p,f);let g=!1;return{dispose:()=>{g||(g=!0,u.removeEventListener(h,p,f))}}}},3551:function(c,l,u){var h=this&&this.__decorate||function(b,x,S,E){var T,A=arguments.length,D=A<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,E);else for(var M=b.length-1;M>=0;M--)(T=b[M])&&(D=(A<3?T(D):A>3?T(x,S,D):T(x,S))||D);return A>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(b,x){return function(S,E){x(S,E,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const f=u(3656),g=u(8460),y=u(844),C=u(2585),w=u(4725);let _=l.Linkifier=class extends y.Disposable{get currentLink(){return this._currentLink}constructor(b,x,S,E,T){super(),this._element=b,this._mouseService=x,this._renderService=S,this._bufferService=E,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,y.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,y.toDisposable)((()=>{var A;this._lastMouseEvent=void 0,(A=this._activeProviderReplies)==null||A.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(b){this._lastMouseEvent=b;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const S=b.composedPath();for(let E=0;E{A==null||A.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=b.y);let S=!1;for(const[A,D]of this._linkProviderService.linkProviders.entries())x?(T=this._activeProviderReplies)!=null&&T.get(A)&&(S=this._checkLinkProviderResult(A,b,S)):D.provideLinks(b.y,(M=>{var z,H;if(this._isMouseOut)return;const R=M==null?void 0:M.map((q=>({link:q})));(z=this._activeProviderReplies)==null||z.set(A,R),S=this._checkLinkProviderResult(A,b,S),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(b.y,this._activeProviderReplies)}))}_removeIntersectingLinks(b,x){const S=new Set;for(let E=0;Eb?this._bufferService.cols:D.link.range.end.x;for(let z=M;z<=R;z++){if(S.has(z)){T.splice(A--,1);break}S.add(z)}}}}_checkLinkProviderResult(b,x,S){var A;if(!this._activeProviderReplies)return S;const E=this._activeProviderReplies.get(b);let T=!1;for(let D=0;Dthis._linkAtPosition(M.link,x)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;Dthis._linkAtPosition(R.link,x)));if(M){S=!0,this._handleNewLink(M);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(b){if(!this._currentLink)return;const x=this._positionFromMouseEvent(b,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(b,this._currentLink.link.text)}_clearCurrentLink(b,x){this._currentLink&&this._lastMouseEvent&&(!b||!x||this._currentLink.link.range.start.y>=b&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,y.disposeArray)(this._linkCacheDisposables))}_handleNewLink(b){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(b.link,x)&&(this._currentLink=b,this._currentLink.state={decorations:{underline:b.link.decorations===void 0||b.link.decorations.underline,pointerCursor:b.link.decorations===void 0||b.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,b.link,this._lastMouseEvent),b.link.decorations={},Object.defineProperties(b.link.decorations,{pointerCursor:{get:()=>{var S,E;return(E=(S=this._currentLink)==null?void 0:S.state)==null?void 0:E.decorations.pointerCursor},set:S=>{var E;(E=this._currentLink)!=null&&E.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,E;return(E=(S=this._currentLink)==null?void 0:S.state)==null?void 0:E.decorations.underline},set:S=>{var E,T,A;(E=this._currentLink)!=null&&E.state&&((A=(T=this._currentLink)==null?void 0:T.state)==null?void 0:A.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(b.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const E=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,T=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=E&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(E,T),this._lastMouseEvent)){const A=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);A&&this._askForLink(A,!1)}}))))}_linkHover(b,x,S){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&b.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(S,x.text)}_fireUnderlineEvent(b,x){const S=b.range,E=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-E-1,S.end.x,S.end.y-E-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(b,x,S){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&b.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(S,x.text)}_linkAtPosition(b,x){const S=b.range.start.y*this._bufferService.cols+b.range.start.x,E=b.range.end.y*this._bufferService.cols+b.range.end.x,T=x.y*this._bufferService.cols+x.x;return S<=T&&T<=E}_positionFromMouseEvent(b,x,S){const E=S.getCoords(b,x,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(b,x,S,E,T){return{x1:b,y1:x,x2:S,y2:E,cols:this._bufferService.cols,fg:T}}};l.Linkifier=_=h([p(1,w.IMouseService),p(2,w.IRenderService),p(3,C.IBufferService),p(4,w.ILinkProviderService)],_)},9042:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,l,u){var h=this&&this.__decorate||function(w,_,b,x){var S,E=arguments.length,T=E<3?_:x===null?x=Object.getOwnPropertyDescriptor(_,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(w,_,b,x);else for(var A=w.length-1;A>=0;A--)(S=w[A])&&(T=(E<3?S(T):E>3?S(_,b,T):S(_,b))||T);return E>3&&T&&Object.defineProperty(_,b,T),T},p=this&&this.__param||function(w,_){return function(b,x){_(b,x,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const f=u(511),g=u(2585);let y=l.OscLinkProvider=class{constructor(w,_,b){this._bufferService=w,this._optionsService=_,this._oscLinkService=b}provideLinks(w,_){var R;const b=this._bufferService.buffer.lines.get(w-1);if(!b)return void _(void 0);const x=[],S=this._optionsService.rawOptions.linkHandler,E=new f.CellData,T=b.getTrimmedLength();let A=-1,D=-1,M=!1;for(let z=0;zS?S.activate(U,K,q):C(0,K),hover:(U,K)=>{var Y;return(Y=S==null?void 0:S.hover)==null?void 0:Y.call(S,U,K,q)},leave:(U,K)=>{var Y;return(Y=S==null?void 0:S.leave)==null?void 0:Y.call(S,U,K,q)}})}M=!1,E.hasExtendedAttrs()&&E.extended.urlId?(D=z,A=E.extended.urlId):(D=-1,A=-1)}}_(x)}};function C(w,_){if(confirm(`Do you want to navigate to ${_}? +`)}),m.jsx("pre",{className:"file-view-code",children:m.jsx("code",{children:n})})]})}function tU(e){return/^[a-z][a-z0-9+.-]*:/i.test(e)||e.startsWith("//")}function nU(e,t,n){const r=n.indexOf("#"),s=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r),c=s.indexOf("?"),l=c===-1?s:s.slice(0,c),u=c===-1?"":s.slice(c+1),h=l.startsWith("/")?[]:t.split("/").filter(y=>y.length>0);for(const y of l.split("/"))if(!(!y||y==="."))if(y===".."){if(h.length===0)return null;h.pop()}else h.push(y);const p=h.join("/");if(!p)return null;const f=new URLSearchParams(u);f.delete("path");const g=f.toString();return`${Jc(e,p)}${g?`&${g}`:""}${a}`}function rU(e){if(!e.startsWith("---"))return e;const t=e.indexOf(` +---`,3);return t===-1?e:e.slice(t+4).replace(/^\r?\n/,"")}const hw=/\.(png|jpe?g|gif|webp|svg)$/i,iU=/\.(md|mdx|markdown)$/i,sU=512*1024,dw="orx:files-tree-width",fw="orx:artifacts-collapsed:",pw=180,mw=560,aU=280;function oU(){try{const e=Number(localStorage.getItem(dw));if(Number.isFinite(e)&&e>=pw&&e<=mw)return e}catch{}return aU}function lU(e){try{const t=localStorage.getItem(`${fw}${e}`);if(!t)return new Set;const n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(r=>typeof r=="string")):new Set}catch{return new Set}}function lg(e,t){for(const n of e){if(n.path===t)return n;if(n.isDir&&t.startsWith(n.path+"/")){const r=lg(n.children??[],t);if(r)return r}}return null}function gw({projectId:e,folder:t,markdown:n}){const r=s=>tU(s)?s:nU(e,t,s);return m.jsx("div",{className:"md artifact-md",children:m.jsx(w7,{remarkPlugins:[e8,[t8,u8]],rehypePlugins:[NS],components:{a:({href:s,children:a,...c})=>{const l=!s||s.startsWith("#"),u=l?s:r(s);return u?m.jsx("a",{...c,href:u,...l?{}:{target:"_blank",rel:"noopener noreferrer"},children:a}):m.jsx("span",{children:a})},img:({src:s,alt:a})=>{if(!s||typeof s!="string")return null;const c=r(s);return c?m.jsxs("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"artifact-img",children:[m.jsx("img",{src:c,alt:a??"",loading:"lazy"}),a&&m.jsx("span",{className:"artifact-img-caption",children:a})]}):null},...d8},children:h8(rU(n))})})}function cU(e){return iU.test(e.name)?"markdown":hw.test(e.name)?"image":/\.pdf$/i.test(e.name)?"pdf":"text"}function uU(e,t,n){const[r,s]=P.useState(null),[a,c]=P.useState(!1),[l,u]=P.useState(null),h=n==="markdown"||n==="text"&&t.size<=sU;return P.useEffect(()=>{if(s(null),c(!1),u(null),!h)return;let p=!1;return fetch(Jc(e,t.path)).then(g=>{if(!g.ok)throw new Error(`Failed to load artifact (${g.status})`);return g.text()}).then(g=>{p||(g.includes("\0")?c(!0):s(g))}).catch(g=>{p||u(g instanceof Error?g.message:String(g))}),()=>{p=!0}},[e,t.path,t.modifiedAt,n,h]),{text:r,binary:a,error:l,wantsText:h}}function hU({projectId:e,entry:t,onDelete:n}){const r=cU(t),{text:s,binary:a,error:c,wantsText:l}=uU(e,t,r),[u,h]=P.useState(!1),p=r==="markdown",f=t.path.split("/").slice(0,-1).join("/"),g=Jc(e,t.path);let y;return r==="image"?y=m.jsx("a",{className:"fpreview-image",href:g,target:"_blank",rel:"noopener noreferrer",children:m.jsx("img",{src:g,alt:t.name})}):r==="pdf"?y=m.jsx("iframe",{className:"fpreview-pdf",title:t.name,src:g}):!l||a?y=m.jsxs("div",{className:"file-view-note",children:[a?"Binary file — no inline preview.":"File too large to preview inline."," ",m.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",children:"Open raw"})]}):c?y=m.jsxs("div",{className:"file-view-note",children:["Failed to load: ",c]}):s===null?y=m.jsxs("div",{className:"settings-loading",children:[m.jsx("span",{className:"spinner"})," Loading…"]}):p&&!u?y=m.jsx(gw,{projectId:e,folder:f,markdown:s}):y=m.jsx(uw,{text:s,path:t.path}),m.jsxs("div",{className:"fpreview file-view",children:[m.jsxs("div",{className:"fpreview-head",children:[m.jsx(Cx,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"fpreview-path",title:t.path,children:t.path}),m.jsxs("span",{className:"fpreview-date",children:["Modified"," ",new Date(t.modifiedAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})]}),r==="text"&&m.jsx("span",{className:"fpreview-size",children:Ma(t.size)}),p&&m.jsx("button",{className:`icon-btn ${u?"active":""}`,"data-tip":u?"Rendered view":"View source","aria-label":u?"Rendered view":"View source",onClick:()=>h(C=>!C),children:m.jsx(bx,{size:13})}),m.jsx("a",{className:"icon-btn",href:g,target:"_blank",rel:"noopener noreferrer","data-tip":"Open raw in new tab","aria-label":"Open raw in new tab",children:m.jsx(Sx,{size:13})}),m.jsx("button",{className:"icon-btn","data-tip":"Delete artifact","aria-label":"Delete artifact",onClick:()=>{window.confirm(`Delete "${t.path}" from the artifacts directory?`)&&n(t.path)},children:m.jsx(Qh,{size:13})})]}),m.jsx("div",{className:`fpreview-body ${p&&!u?"doc":""}`,children:y})]})}function vw({projectId:e,entries:t,depth:n,collapsed:r,selected:s,onToggle:a,onSelect:c,onDelete:l}){return m.jsx(m.Fragment,{children:t.map(u=>{var p;const h={paddingLeft:8+n*14};if(u.isDir){const f=!r.has(u.path);return m.jsxs("div",{children:[m.jsxs("div",{className:"ft-row",style:h,onClick:()=>a(u.path),children:[m.jsx("button",{className:`ft-chevron ${f?"open":""}`,"aria-label":f?`Collapse ${u.name}`:`Expand ${u.name}`,onClick:g=>{g.stopPropagation(),a(u.path)},children:m.jsx(Qc,{size:12})}),m.jsxs("span",{className:"ft-dirname",children:[u.name,"/"]}),m.jsx("button",{className:"icon-btn ft-row-delete","data-tip":"Delete folder","aria-label":`Delete folder ${u.name}`,onClick:g=>{g.stopPropagation(),window.confirm(`Delete "${u.path}" from the artifacts directory?`)&&l(u.path)},children:m.jsx(Qh,{size:12})})]}),f&&(((p=u.children)==null?void 0:p.length)??0)>0&&m.jsx(vw,{projectId:e,entries:u.children??[],depth:n+1,collapsed:r,selected:s,onToggle:a,onSelect:c,onDelete:l})]},u.path)}return m.jsxs("div",{className:`ft-row file ${s===u.path?"selected":""}`,style:h,title:u.path,onClick:()=>c(u.path),children:[m.jsx("span",{className:"ft-chevron spacer"}),hw.test(u.name)&&m.jsx("img",{className:"ft-thumb",src:Jc(e,u.path),alt:"",loading:"lazy"}),m.jsx("span",{className:"ft-name",children:u.name})]},u.path)})})}function J_({dir:e,onOpenStorage:t}){const[n,r]=P.useState(!1);return m.jsxs("div",{className:"ftree-footer",title:e,children:[m.jsx("code",{children:e}),m.jsx("button",{className:"icon-btn tip-up","data-tip":n?"Copied!":"Copy path","aria-label":"Copy artifacts directory path",onClick:()=>{var s;(s=navigator.clipboard)==null||s.writeText(e),r(!0),setTimeout(()=>r(!1),1200)},children:n?m.jsx(Zr,{size:12}):m.jsx(Ng,{size:12})}),m.jsx("button",{className:"icon-btn tip-up","data-tip":"Storage settings","aria-label":"Storage settings",onClick:t,children:m.jsx(jA,{size:12})})]})}function dU({project:e,artifacts:t,onChanged:n,onOpenStorage:r}){const[s,a]=P.useState(null),[c,l]=P.useState(()=>lU(e.id)),[u,h]=P.useState(oU),p=P.useRef(null);P.useEffect(()=>{try{localStorage.setItem(`${fw}${e.id}`,JSON.stringify([...c]))}catch{}},[e.id,c]);const f=b=>{var T;b.preventDefault(),b.currentTarget.setPointerCapture(b.pointerId);const _=((T=p.current)==null?void 0:T.getBoundingClientRect().left)??0,x=document.body.style.userSelect;document.body.style.userSelect="none";const S=A=>{const D=Math.round(A.clientX-_),M=Math.min(Math.max(D,pw),mw);h(M);try{localStorage.setItem(dw,String(M))}catch{}},E=()=>{window.removeEventListener("pointermove",S),window.removeEventListener("pointerup",E),window.removeEventListener("pointercancel",E),document.body.style.userSelect=x};window.addEventListener("pointermove",S),window.addEventListener("pointerup",E),window.addEventListener("pointercancel",E)};P.useEffect(()=>{if(!s||!t)return;const b=lg(t.entries,s);(!b||b.isDir)&&a(null)},[s,t]);const g=b=>l(_=>{const x=new Set(_);return x.has(b)?x.delete(b):x.add(b),x}),y=b=>{(s===b||s!=null&&s.startsWith(b+"/"))&&a(null),AT(e.id,b).catch(()=>{}).finally(n)};if(!t)return m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"settings-loading",style:{padding:20},children:[m.jsx("span",{className:"spinner"})," Loading artifacts…"]})});const C=b=>m.jsx(vw,{projectId:e.id,entries:b,depth:0,collapsed:c,selected:s,onToggle:g,onSelect:a,onDelete:y}),w=s?lg(t.entries,s):null;return t.entries.length===0?m.jsx("div",{className:"files-tab",children:m.jsxs("div",{className:"files-empty-state",children:[m.jsx(Dg,{size:28,strokeWidth:1.5}),m.jsx("h3",{children:"No artifacts yet"}),m.jsx("p",{children:"This is the project's durable output space for reports, figures, images, CSVs, PDFs, and other research artifacts. Ask the agent for a write-up or add your own files:"}),m.jsx(J_,{dir:t.dir,onOpenStorage:r})]})}):m.jsxs("div",{className:"files-tab",children:[m.jsxs("div",{className:"ftree-pane",ref:p,style:{width:u},children:[m.jsx("div",{className:"ftree-resizer",onPointerDown:f}),m.jsxs("div",{className:"ftree-scroll",children:[C(t.entries),t.truncated&&m.jsx("p",{className:"files-truncated",children:"Listing truncated — the folder has more artifacts."})]}),m.jsx(J_,{dir:t.dir,onOpenStorage:r})]}),w?m.jsx(hU,{projectId:e.id,entry:w,onDelete:y},w.path):m.jsxs("div",{className:"fpreview fpreview-none",children:[m.jsx(EA,{size:22,strokeWidth:1.5}),m.jsx("span",{children:"Click an artifact to view it"})]})]})}function Bo({active:e,label:t,icon:n,onSelect:r,onClose:s}){return m.jsxs("button",{className:`tab closable ${e?"active":""}`,onClick:r,title:t,children:[n,m.jsx("span",{className:"tab-label",children:t}),m.jsx("span",{role:"button",className:"tab-close",title:"Close tab",onClick:a=>{a.stopPropagation(),s()},children:m.jsx(Ko,{size:12})})]})}function fU({owner:e,repo:t,branch:n}){return m.jsxs("a",{className:"files-pill",href:jg(e,t,n),target:"_blank",rel:"noopener noreferrer",title:`Open ${n} on GitHub`,children:[m.jsx("code",{children:n}),m.jsx(qv,{size:12})]})}var Yp={exports:{}},e6;function pU(){return e6||(e6=1,(function(e,t){(function(n,r){e.exports=r()})(self,(()=>(()=>{var n={};return(()=>{var r=n;Object.defineProperty(r,"__esModule",{value:!0}),r.FitAddon=void 0,r.FitAddon=class{activate(s){this._terminal=s}dispose(){}fit(){const s=this.proposeDimensions();if(!s||!this._terminal||isNaN(s.cols)||isNaN(s.rows))return;const a=this._terminal._core;this._terminal.rows===s.rows&&this._terminal.cols===s.cols||(a._renderService.clear(),this._terminal.resize(s.cols,s.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const s=this._terminal._core,a=s._renderService.dimensions;if(a.css.cell.width===0||a.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:s.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),u=parseInt(l.getPropertyValue("height")),h=Math.max(0,parseInt(l.getPropertyValue("width"))),p=window.getComputedStyle(this._terminal.element),f=u-(parseInt(p.getPropertyValue("padding-top"))+parseInt(p.getPropertyValue("padding-bottom"))),g=h-(parseInt(p.getPropertyValue("padding-right"))+parseInt(p.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(g/a.css.cell.width)),rows:Math.max(1,Math.floor(f/a.css.cell.height))}}}})(),n})()))})(Yp)),Yp.exports}var mU=pU(),Xp={exports:{}},t6;function gU(){return t6||(t6=1,(function(e,t){(function(n,r){e.exports=r()})(globalThis,(()=>(()=>{var n={4567:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.AccessibilityManager=void 0;const f=u(9042),g=u(9924),y=u(844),C=u(4725),w=u(2585),b=u(3656);let _=l.AccessibilityManager=class extends y.Disposable{constructor(x,S,E,T){super(),this._terminal=x,this._coreBrowserService=E,this._renderService=T,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let A=0;Athis._handleBoundaryFocus(A,0),this._bottomBoundaryFocusListener=A=>this._handleBoundaryFocus(A,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new g.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize((A=>this._handleResize(A.rows)))),this.register(this._terminal.onRender((A=>this._refreshRows(A.start,A.end)))),this.register(this._terminal.onScroll((()=>this._refreshRows()))),this.register(this._terminal.onA11yChar((A=>this._handleChar(A)))),this.register(this._terminal.onLineFeed((()=>this._handleChar(` +`)))),this.register(this._terminal.onA11yTab((A=>this._handleTab(A)))),this.register(this._terminal.onKey((A=>this._handleKey(A.key)))),this.register(this._terminal.onBlur((()=>this._clearLiveRegion()))),this.register(this._renderService.onDimensionsChange((()=>this._refreshRowsDimensions()))),this.register((0,b.addDisposableDomListener)(document,"selectionchange",(()=>this._handleSelectionChange()))),this.register(this._coreBrowserService.onDprChange((()=>this._refreshRowsDimensions()))),this._refreshRows(),this.register((0,y.toDisposable)((()=>{this._accessibilityContainer.remove(),this._rowElements.length=0})))}_handleTab(x){for(let S=0;S0?this._charsToConsume.shift()!==x&&(this._charsToAnnounce+=x):this._charsToAnnounce+=x,x===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=f.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(x){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(x)||this._charsToConsume.push(x)}_refreshRows(x,S){this._liveRegionDebouncer.refresh(x,S,this._terminal.rows)}_renderRows(x,S){const E=this._terminal.buffer,T=E.lines.length.toString();for(let A=x;A<=S;A++){const D=E.lines.get(E.ydisp+A),M=[],R=(D==null?void 0:D.translateToString(!0,void 0,void 0,M))||"",z=(E.ydisp+A+1).toString(),H=this._rowElements[A];H&&(R.length===0?(H.innerText=" ",this._rowColumns.set(H,[0,1])):(H.textContent=R,this._rowColumns.set(H,M)),H.setAttribute("aria-posinset",z),H.setAttribute("aria-setsize",T))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(x,S){const E=x.target,T=this._rowElements[S===0?1:this._rowElements.length-2];if(E.getAttribute("aria-posinset")===(S===0?"1":`${this._terminal.buffer.lines.length}`)||x.relatedTarget!==T)return;let A,D;if(S===0?(A=E,D=this._rowElements.pop(),this._rowContainer.removeChild(D)):(A=this._rowElements.shift(),D=E,this._rowContainer.removeChild(A)),A.removeEventListener("focus",this._topBoundaryFocusListener),D.removeEventListener("focus",this._bottomBoundaryFocusListener),S===0){const M=this._createAccessibilityTreeNode();this._rowElements.unshift(M),this._rowContainer.insertAdjacentElement("afterbegin",M)}else{const M=this._createAccessibilityTreeNode();this._rowElements.push(M),this._rowContainer.appendChild(M)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(S===0?-1:1),this._rowElements[S===0?1:this._rowElements.length-2].focus(),x.preventDefault(),x.stopImmediatePropagation()}_handleSelectionChange(){var R;if(this._rowElements.length===0)return;const x=document.getSelection();if(!x)return;if(x.isCollapsed)return void(this._rowContainer.contains(x.anchorNode)&&this._terminal.clearSelection());if(!x.anchorNode||!x.focusNode)return void console.error("anchorNode and/or focusNode are null");let S={node:x.anchorNode,offset:x.anchorOffset},E={node:x.focusNode,offset:x.focusOffset};if((S.node.compareDocumentPosition(E.node)&Node.DOCUMENT_POSITION_PRECEDING||S.node===E.node&&S.offset>E.offset)&&([S,E]=[E,S]),S.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(S={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(S.node))return;const T=this._rowElements.slice(-1)[0];if(E.node.compareDocumentPosition(T)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(E={node:T,offset:((R=T.textContent)==null?void 0:R.length)??0}),!this._rowContainer.contains(E.node))return;const A=({node:z,offset:H})=>{const $=z instanceof Text?z.parentNode:z;let U=parseInt($==null?void 0:$.getAttribute("aria-posinset"),10)-1;if(isNaN(U))return console.warn("row is invalid. Race condition?"),null;const q=this._rowColumns.get($);if(!q)return console.warn("columns is null. Race condition?"),null;let K=H=this._terminal.cols&&(++U,K=0),{row:U,column:K}},D=A(S),M=A(E);if(D&&M){if(D.row>M.row||D.row===M.row&&D.column>=M.column)throw new Error("invalid range");this._terminal.select(D.column,D.row,(M.row-D.row)*this._terminal.cols-D.column+M.column)}}_handleResize(x){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let S=this._rowContainer.children.length;Sx;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const x=this._coreBrowserService.mainDocument.createElement("div");return x.setAttribute("role","listitem"),x.tabIndex=-1,this._refreshRowDimensions(x),x}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let x=0;x{function u(g){return g.replace(/\r?\n/g,"\r")}function h(g,y){return y?"\x1B[200~"+g+"\x1B[201~":g}function p(g,y,C,w){g=h(g=u(g),C.decPrivateModes.bracketedPasteMode&&w.rawOptions.ignoreBracketedPasteMode!==!0),C.triggerDataEvent(g,!0),y.value=""}function f(g,y,C){const w=C.getBoundingClientRect(),b=g.clientX-w.left-10,_=g.clientY-w.top-10;y.style.width="20px",y.style.height="20px",y.style.left=`${b}px`,y.style.top=`${_}px`,y.style.zIndex="1000",y.focus()}Object.defineProperty(l,"__esModule",{value:!0}),l.rightClickHandler=l.moveTextAreaUnderMouseCursor=l.paste=l.handlePasteEvent=l.copyHandler=l.bracketTextForPaste=l.prepareTextForTerminal=void 0,l.prepareTextForTerminal=u,l.bracketTextForPaste=h,l.copyHandler=function(g,y){g.clipboardData&&g.clipboardData.setData("text/plain",y.selectionText),g.preventDefault()},l.handlePasteEvent=function(g,y,C,w){g.stopPropagation(),g.clipboardData&&p(g.clipboardData.getData("text/plain"),y,C,w)},l.paste=p,l.moveTextAreaUnderMouseCursor=f,l.rightClickHandler=function(g,y,C,w,b){f(g,y,C),b&&w.rightClickSelect(g),y.value=w.selectionText,y.select()}},7239:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorContrastCache=void 0;const h=u(1505);l.ColorContrastCache=class{constructor(){this._color=new h.TwoKeyMap,this._css=new h.TwoKeyMap}setCss(p,f,g){this._css.set(p,f,g)}getCss(p,f){return this._css.get(p,f)}setColor(p,f,g){this._color.set(p,f,g)}getColor(p,f){return this._color.get(p,f)}clear(){this._color.clear(),this._css.clear()}}},3656:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.addDisposableDomListener=void 0,l.addDisposableDomListener=function(u,h,p,f){u.addEventListener(h,p,f);let g=!1;return{dispose:()=>{g||(g=!0,u.removeEventListener(h,p,f))}}}},3551:function(c,l,u){var h=this&&this.__decorate||function(_,x,S,E){var T,A=arguments.length,D=A<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(_,x,S,E);else for(var M=_.length-1;M>=0;M--)(T=_[M])&&(D=(A<3?T(D):A>3?T(x,S,D):T(x,S))||D);return A>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(_,x){return function(S,E){x(S,E,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Linkifier=void 0;const f=u(3656),g=u(8460),y=u(844),C=u(2585),w=u(4725);let b=l.Linkifier=class extends y.Disposable{get currentLink(){return this._currentLink}constructor(_,x,S,E,T){super(),this._element=_,this._mouseService=x,this._renderService=S,this._bufferService=E,this._linkProviderService=T,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new g.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new g.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,y.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,y.toDisposable)((()=>{var A;this._lastMouseEvent=void 0,(A=this._activeProviderReplies)==null||A.clear()}))),this.register(this._bufferService.onResize((()=>{this._clearCurrentLink(),this._wasResized=!0}))),this.register((0,f.addDisposableDomListener)(this._element,"mouseleave",(()=>{this._isMouseOut=!0,this._clearCurrentLink()}))),this.register((0,f.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,f.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(_){this._lastMouseEvent=_;const x=this._positionFromMouseEvent(_,this._element,this._mouseService);if(!x)return;this._isMouseOut=!1;const S=_.composedPath();for(let E=0;E{A==null||A.forEach((D=>{D.link.dispose&&D.link.dispose()}))})),this._activeProviderReplies=new Map,this._activeLine=_.y);let S=!1;for(const[A,D]of this._linkProviderService.linkProviders.entries())x?(T=this._activeProviderReplies)!=null&&T.get(A)&&(S=this._checkLinkProviderResult(A,_,S)):D.provideLinks(_.y,(M=>{var z,H;if(this._isMouseOut)return;const R=M==null?void 0:M.map(($=>({link:$})));(z=this._activeProviderReplies)==null||z.set(A,R),S=this._checkLinkProviderResult(A,_,S),((H=this._activeProviderReplies)==null?void 0:H.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(_.y,this._activeProviderReplies)}))}_removeIntersectingLinks(_,x){const S=new Set;for(let E=0;E_?this._bufferService.cols:D.link.range.end.x;for(let z=M;z<=R;z++){if(S.has(z)){T.splice(A--,1);break}S.add(z)}}}}_checkLinkProviderResult(_,x,S){var A;if(!this._activeProviderReplies)return S;const E=this._activeProviderReplies.get(_);let T=!1;for(let D=0;D<_;D++)this._activeProviderReplies.has(D)&&!this._activeProviderReplies.get(D)||(T=!0);if(!T&&E){const D=E.find((M=>this._linkAtPosition(M.link,x)));D&&(S=!0,this._handleNewLink(D))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!S)for(let D=0;Dthis._linkAtPosition(R.link,x)));if(M){S=!0,this._handleNewLink(M);break}}return S}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(_){if(!this._currentLink)return;const x=this._positionFromMouseEvent(_,this._element,this._mouseService);x&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,x)&&this._currentLink.link.activate(_,this._currentLink.link.text)}_clearCurrentLink(_,x){this._currentLink&&this._lastMouseEvent&&(!_||!x||this._currentLink.link.range.start.y>=_&&this._currentLink.link.range.end.y<=x)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,y.disposeArray)(this._linkCacheDisposables))}_handleNewLink(_){if(!this._lastMouseEvent)return;const x=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);x&&this._linkAtPosition(_.link,x)&&(this._currentLink=_,this._currentLink.state={decorations:{underline:_.link.decorations===void 0||_.link.decorations.underline,pointerCursor:_.link.decorations===void 0||_.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,_.link,this._lastMouseEvent),_.link.decorations={},Object.defineProperties(_.link.decorations,{pointerCursor:{get:()=>{var S,E;return(E=(S=this._currentLink)==null?void 0:S.state)==null?void 0:E.decorations.pointerCursor},set:S=>{var E;(E=this._currentLink)!=null&&E.state&&this._currentLink.state.decorations.pointerCursor!==S&&(this._currentLink.state.decorations.pointerCursor=S,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",S))}},underline:{get:()=>{var S,E;return(E=(S=this._currentLink)==null?void 0:S.state)==null?void 0:E.decorations.underline},set:S=>{var E,T,A;(E=this._currentLink)!=null&&E.state&&((A=(T=this._currentLink)==null?void 0:T.state)==null?void 0:A.decorations.underline)!==S&&(this._currentLink.state.decorations.underline=S,this._currentLink.state.isHovered&&this._fireUnderlineEvent(_.link,S))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange((S=>{if(!this._currentLink)return;const E=S.start===0?0:S.start+1+this._bufferService.buffer.ydisp,T=this._bufferService.buffer.ydisp+1+S.end;if(this._currentLink.link.range.start.y>=E&&this._currentLink.link.range.end.y<=T&&(this._clearCurrentLink(E,T),this._lastMouseEvent)){const A=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);A&&this._askForLink(A,!1)}}))))}_linkHover(_,x,S){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!0),this._currentLink.state.decorations.pointerCursor&&_.classList.add("xterm-cursor-pointer")),x.hover&&x.hover(S,x.text)}_fireUnderlineEvent(_,x){const S=_.range,E=this._bufferService.buffer.ydisp,T=this._createLinkUnderlineEvent(S.start.x-1,S.start.y-E-1,S.end.x,S.end.y-E-1,void 0);(x?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(T)}_linkLeave(_,x,S){var E;(E=this._currentLink)!=null&&E.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(x,!1),this._currentLink.state.decorations.pointerCursor&&_.classList.remove("xterm-cursor-pointer")),x.leave&&x.leave(S,x.text)}_linkAtPosition(_,x){const S=_.range.start.y*this._bufferService.cols+_.range.start.x,E=_.range.end.y*this._bufferService.cols+_.range.end.x,T=x.y*this._bufferService.cols+x.x;return S<=T&&T<=E}_positionFromMouseEvent(_,x,S){const E=S.getCoords(_,x,this._bufferService.cols,this._bufferService.rows);if(E)return{x:E[0],y:E[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(_,x,S,E,T){return{x1:_,y1:x,x2:S,y2:E,cols:this._bufferService.cols,fg:T}}};l.Linkifier=b=h([p(1,w.IMouseService),p(2,w.IRenderService),p(3,C.IBufferService),p(4,w.ILinkProviderService)],b)},9042:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.tooMuchOutput=l.promptLabel=void 0,l.promptLabel="Terminal input",l.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(c,l,u){var h=this&&this.__decorate||function(w,b,_,x){var S,E=arguments.length,T=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,_):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(w,b,_,x);else for(var A=w.length-1;A>=0;A--)(S=w[A])&&(T=(E<3?S(T):E>3?S(b,_,T):S(b,_))||T);return E>3&&T&&Object.defineProperty(b,_,T),T},p=this&&this.__param||function(w,b){return function(_,x){b(_,x,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkProvider=void 0;const f=u(511),g=u(2585);let y=l.OscLinkProvider=class{constructor(w,b,_){this._bufferService=w,this._optionsService=b,this._oscLinkService=_}provideLinks(w,b){var R;const _=this._bufferService.buffer.lines.get(w-1);if(!_)return void b(void 0);const x=[],S=this._optionsService.rawOptions.linkHandler,E=new f.CellData,T=_.getTrimmedLength();let A=-1,D=-1,M=!1;for(let z=0;zS?S.activate(q,K,$):C(0,K),hover:(q,K)=>{var Y;return(Y=S==null?void 0:S.hover)==null?void 0:Y.call(S,q,K,$)},leave:(q,K)=>{var Y;return(Y=S==null?void 0:S.leave)==null?void 0:Y.call(S,q,K,$)}})}M=!1,E.hasExtendedAttrs()&&E.extended.urlId?(D=z,A=E.extended.urlId):(D=-1,A=-1)}}b(x)}};function C(w,b){if(confirm(`Do you want to navigate to ${b}? -WARNING: This link could potentially be dangerous`)){const b=window.open();if(b){try{b.opener=null}catch{}b.location.href=_}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=y=h([p(0,g.IBufferService),p(1,g.IOptionsService),p(2,g.IOscLinkService)],y)},6193:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(u,h){this._renderCallback=u,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,h,p){this._rowCount=p,u=u!==void 0?u:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const u=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const h=u(3614),p=u(3656),f=u(3551),g=u(9042),y=u(3730),C=u(1680),w=u(3107),_=u(5744),b=u(2950),x=u(1296),S=u(428),E=u(4269),T=u(5114),A=u(8934),D=u(3230),M=u(9312),R=u(4725),z=u(6731),H=u(8055),q=u(8969),$=u(8460),U=u(844),K=u(6114),Y=u(8437),Q=u(2584),ee=u(7399),B=u(5941),L=u(9074),O=u(2585),W=u(5435),G=u(4567),ie=u(779);class fe extends q.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(te={}){super(te),this.browser=K,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new U.MutableDisposable),this._onCursorMove=this.register(new $.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new $.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new $.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new $.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new $.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new $.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new $.EventEmitter),this._onBlur=this.register(new $.EventEmitter),this._onA11yCharEmitter=this.register(new $.EventEmitter),this._onA11yTabEmitter=this.register(new $.EventEmitter),this._onWillOpen=this.register(new $.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(R.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(y.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,ae)=>this.refresh(V,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,$.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,$.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,$.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,U.toDisposable)((()=>{var V,ae;this._customKeyEventHandler=void 0,(ae=(V=this.element)==null?void 0:V.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(te){if(this._themeService)for(const V of te){let ae,oe="";switch(V.index){case 256:ae="foreground",oe="10";break;case 257:ae="background",oe="11";break;case 258:ae="cursor",oe="12";break;default:ae="ansi",oe="4;"+V.index}switch(V.type){case 0:const be=H.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${oe};${(0,B.toRgbString)(be)}${Q.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((he=>he.ansi[V.index]=H.channels.toColor(...V.color)));else{const he=ae;this._themeService.modifyColors((Se=>Se[he]=H.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(te){te?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(te){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var te;return(te=this.textarea)==null?void 0:te.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const te=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(te);if(!V)return;const ae=Math.min(this.buffer.x,this.cols-1),oe=this._renderService.dimensions.css.cell.height,be=V.getWidth(ae),he=this._renderService.dimensions.css.cell.width*be,Se=this.buffer.y*this._renderService.dimensions.css.cell.height,Te=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Te+"px",this.textarea.style.top=Se+"px",this.textarea.style.width=he+"px",this.textarea.style.height=oe+"px",this.textarea.style.lineHeight=oe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,h.copyHandler)(V,this._selectionService)})));const te=V=>(0,h.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",te)),this.register((0,p.addDisposableDomListener)(this.element,"paste",te)),K.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,h.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,h.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),K.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,h.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(te=>this._keyUp(te)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(te=>this._keyDown(te)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(te=>this._keyPress(te)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(te=>this._compositionHelper.compositionupdate(te)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(te=>this._inputEvent(te)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(te){var ae;if(!te)throw new Error("Terminal requires a parent element.");if(te.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=te.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),te.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(oe=>this.updateCursorStyle(oe)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),K.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(T.CoreBrowserService,this.textarea,te.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(R.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(oe=>this._handleTextAreaFocus(oe)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(R.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(R.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(R.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(R.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((oe=>this._onRender.fire(oe)))),this.onResize((oe=>this._renderService.resize(oe.cols,oe.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(b.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(A.MouseService),this._instantiationService.setService(R.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(V);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(M.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(R.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((oe=>this._renderService.handleSelectionChanged(oe.start,oe.end,oe.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((oe=>{this.textarea.value=oe,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((oe=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(oe=>this._selectionService.handleMouseDown(oe)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(oe=>this._handleScreenReaderModeOptionChange(oe)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(oe=>{!this._overviewRulerRenderer&&oe&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(_.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const te=this,V=this.element;function ae(he){const Se=te._mouseService.getMouseReportCoords(he,te.screenElement);if(!Se)return!1;let Te,Re;switch(he.overrideType||he.type){case"mousemove":Re=32,he.buttons===void 0?(Te=3,he.button!==void 0&&(Te=he.button<3?he.button:3)):Te=1&he.buttons?0:4&he.buttons?1:2&he.buttons?2:3;break;case"mouseup":Re=0,Te=he.button<3?he.button:3;break;case"mousedown":Re=1,Te=he.button<3?he.button:3;break;case"wheel":if(te._customWheelEventHandler&&te._customWheelEventHandler(he)===!1||te.viewport.getLinesScrolled(he)===0)return!1;Re=he.deltaY<0?0:1,Te=4;break;default:return!1}return!(Re===void 0||Te===void 0||Te>4)&&te.coreMouseService.triggerMouseEvent({col:Se.col,row:Se.row,x:Se.x,y:Se.y,button:Te,action:Re,ctrl:he.ctrlKey,alt:he.altKey,shift:he.shiftKey})}const oe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},be={mouseup:he=>(ae(he),he.buttons||(this._document.removeEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.removeEventListener("mousemove",oe.mousedrag)),this.cancel(he)),wheel:he=>(ae(he),this.cancel(he,!0)),mousedrag:he=>{he.buttons&&ae(he)},mousemove:he=>{he.buttons||ae(he)}};this.register(this.coreMouseService.onProtocolChange((he=>{he?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(he)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&he?oe.mousemove||(V.addEventListener("mousemove",be.mousemove),oe.mousemove=be.mousemove):(V.removeEventListener("mousemove",oe.mousemove),oe.mousemove=null),16&he?oe.wheel||(V.addEventListener("wheel",be.wheel,{passive:!1}),oe.wheel=be.wheel):(V.removeEventListener("wheel",oe.wheel),oe.wheel=null),2&he?oe.mouseup||(oe.mouseup=be.mouseup):(this._document.removeEventListener("mouseup",oe.mouseup),oe.mouseup=null),4&he?oe.mousedrag||(oe.mousedrag=be.mousedrag):(this._document.removeEventListener("mousemove",oe.mousedrag),oe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(V,"mousedown",(he=>{if(he.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(he))return ae(he),oe.mouseup&&this._document.addEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.addEventListener("mousemove",oe.mousedrag),this.cancel(he)}))),this.register((0,p.addDisposableDomListener)(V,"wheel",(he=>{if(!oe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(he)===!1)return!1;if(!this.buffer.hasScrollback){const Se=this.viewport.getLinesScrolled(he);if(Se===0)return;const Te=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(he.deltaY<0?"A":"B");let Re="";for(let He=0;He{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(he),this.cancel(he)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(V,"touchmove",(he=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(he)?void 0:this.cancel(he)}),{passive:!1}))}refresh(te,V){var ae;(ae=this._renderService)==null||ae.refreshRows(te,V)}updateCursorStyle(te){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(te)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(te,V,ae=0){var oe;ae===1?(super.scrollLines(te,V,ae),this.refresh(0,this.rows-1)):(oe=this.viewport)==null||oe.scrollLines(te)}paste(te){(0,h.paste)(te,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(te){this._customKeyEventHandler=te}attachCustomWheelEventHandler(te){this._customWheelEventHandler=te}registerLinkProvider(te){return this._linkProviderService.registerLinkProvider(te)}registerCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(te);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(te)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(te){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+te)}registerDecoration(te){return this._decorationService.registerDecoration(te)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(te,V,ae){this._selectionService.setSelection(te,V,ae)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var te;(te=this._selectionService)==null||te.clearSelection()}selectAll(){var te;(te=this._selectionService)==null||te.selectAll()}selectLines(te,V){var ae;(ae=this._selectionService)==null||ae.selectLines(te,V)}_keyDown(te){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&te.altKey;if(!V&&!this._compositionHelper.keydown(te))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||te.key!=="Dead"&&te.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,ee.evaluateKeyboardEvent)(te,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(te),ae.type===3||ae.type===2){const oe=this.rows-1;return this.scrollLines(ae.type===2?-oe:oe),this.cancel(te,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,te)||(ae.cancel&&this.cancel(te,!0),!ae.key||!!(te.key&&!te.ctrlKey&&!te.altKey&&!te.metaKey&&te.key.length===1&&te.key.charCodeAt(0)>=65&&te.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==Q.C0.ETX&&ae.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||te.altKey||te.ctrlKey?this.cancel(te,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(te,V){const ae=te.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||te.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||te.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?ae:ae&&(!V.keyCode||V.keyCode>47)}_keyUp(te){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(te)||this.focus(),this.updateCursorStyle(te),this._keyPressHandled=!1)}_keyPress(te){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;if(this.cancel(te),te.charCode)V=te.charCode;else if(te.which===null||te.which===void 0)V=te.keyCode;else{if(te.which===0||te.charCode===0)return!1;V=te.which}return!(!V||(te.altKey||te.ctrlKey||te.metaKey)&&!this._isThirdLevelShift(this.browser,te)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(te){if(te.data&&te.inputType==="insertText"&&(!te.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=te.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(te),!0}return!1}resize(te,V){te!==this.cols||V!==this.rows?super.resize(te,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(te,V){var ae,oe;(ae=this._charSizeService)==null||ae.measure(),(oe=this.viewport)==null||oe.syncScrollArea(!0)}clear(){var te;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let V=1;V{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(u,h=1e3){this._renderCallback=u,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,h,p){this._rowCount=p,u=u!==void 0?u:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=f-this._lastRefreshMs,y=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),y)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,h)}}},1680:function(c,l,u){var h=this&&this.__decorate||function(b,x,S,E){var T,A=arguments.length,D=A<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,E);else for(var M=b.length-1;M>=0;M--)(T=b[M])&&(D=(A<3?T(D):A>3?T(x,S,D):T(x,S))||D);return A>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(b,x){return function(S,E){x(S,E,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const f=u(3656),g=u(4725),y=u(8460),C=u(844),w=u(2585);let _=l.Viewport=class extends C.Disposable{constructor(b,x,S,E,T,A,D,M){super(),this._viewportElement=b,this._scrollArea=x,this._bufferService=S,this._optionsService=E,this._charSizeService=T,this._renderService=A,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new y.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((R=>this._activeBuffer=R.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((R=>this._renderDimensions=R))),this._handleThemeChange(M.colors),this.register(M.onChangeColors((R=>this._handleThemeChange(R)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(b){this._viewportElement.style.backgroundColor=b.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(b){if(b)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const b=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==b&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=b),this._refreshAnimationFrame=null}syncScrollArea(b=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(b);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(b)}_handleScroll(b){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const b=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(b*(this._smoothScrollState.target-this._smoothScrollState.origin)),b<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(b,x){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&S0&&(S=q),E=""}}return{bufferElements:T,cursorElement:S}}getLinesScrolled(b){if(b.deltaY===0||b.shiftKey)return 0;let x=this._applyScrollModifier(b.deltaY,b);return b.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):b.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(b,x){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&x.altKey||S==="ctrl"&&x.ctrlKey||S==="shift"&&x.shiftKey?b*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:b*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(b){this._lastTouchY=b.touches[0].pageY}handleTouchMove(b){const x=this._lastTouchY-b.touches[0].pageY;return this._lastTouchY=b.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(b,x))}};l.Viewport=_=h([p(2,w.IBufferService),p(3,w.IOptionsService),p(4,g.ICharSizeService),p(5,g.IRenderService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],_)},3107:function(c,l,u){var h=this&&this.__decorate||function(w,_,b,x){var S,E=arguments.length,T=E<3?_:x===null?x=Object.getOwnPropertyDescriptor(_,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(w,_,b,x);else for(var A=w.length-1;A>=0;A--)(S=w[A])&&(T=(E<3?S(T):E>3?S(_,b,T):S(_,b))||T);return E>3&&T&&Object.defineProperty(_,b,T),T},p=this&&this.__param||function(w,_){return function(b,x){_(b,x,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const f=u(4725),g=u(844),y=u(2585);let C=l.BufferDecorationRenderer=class extends g.Disposable{constructor(w,_,b,x,S){super(),this._screenElement=w,this._bufferService=_,this._coreBrowserService=b,this._decorationService=x,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((E=>this._removeDecoration(E)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var x;const _=this._coreBrowserService.mainDocument.createElement("div");_.classList.add("xterm-decoration"),_.classList.toggle("xterm-decoration-top-layer",((x=w==null?void 0:w.options)==null?void 0:x.layer)==="top"),_.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,_.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",_.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",_.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const b=w.options.x??0;return b&&b>this._bufferService.cols&&(_.style.display="none"),this._refreshXPosition(w,_),_}_refreshStyle(w){const _=w.marker.line-this._bufferService.buffers.active.ydisp;if(_<0||_>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let b=this._decorationElements.get(w);b||(b=this._createElement(w),w.element=b,this._decorationElements.set(w,b),this._container.appendChild(b),w.onDispose((()=>{this._decorationElements.delete(w),b.remove()}))),b.style.top=_*this._renderService.dimensions.css.cell.height+"px",b.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(b)}}_refreshXPosition(w,_=w.element){if(!_)return;const b=w.options.x??0;(w.options.anchor||"left")==="right"?_.style.right=b?b*this._renderService.dimensions.css.cell.width+"px":"":_.style.left=b?b*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var _;(_=this._decorationElements.get(w))==null||_.remove(),this._decorationElements.delete(w),w.dispose()}};l.BufferDecorationRenderer=C=h([p(1,y.IBufferService),p(2,f.ICoreBrowserService),p(3,y.IDecorationService),p(4,f.IRenderService)],C)},5871:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(u){if(u.options.overviewRulerOptions){for(const h of this._zones)if(h.color===u.options.overviewRulerOptions.color&&h.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,u.marker.line))return;if(this._lineAdjacentToZone(h,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(h,u.marker.line)}if(this._zonePoolIndex=u.startBufferLine&&h<=u.endBufferLine}_lineAdjacentToZone(u,h,p){return h>=u.startBufferLine-this._linePadding[p||"full"]&&h<=u.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(u,h){u.startBufferLine=Math.min(u.startBufferLine,h),u.endBufferLine=Math.max(u.endBufferLine,h)}}},5744:function(c,l,u){var h=this&&this.__decorate||function(S,E,T,A){var D,M=arguments.length,R=M<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,E,T,A);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(R=(M<3?D(R):M>3?D(E,T,R):D(E,T))||R);return M>3&&R&&Object.defineProperty(E,T,R),R},p=this&&this.__param||function(S,E){return function(T,A){E(T,A,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const f=u(5871),g=u(4725),y=u(844),C=u(2585),w={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,E,T,A,D,M,R){var H;super(),this._viewportElement=S,this._screenElement=E,this._bufferService=T,this._decorationService=A,this._renderService=D,this._optionsService=M,this._coreBrowserService=R,this._colorZoneStore=new f.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const z=this._canvas.getContext("2d");if(!z)throw new Error("Ctx cannot be null");this._ctx=z,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,y.toDisposable)((()=>{var q;(q=this._canvas)==null||q.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),E=Math.ceil(this._canvas.width/3);_.full=this._canvas.width,_.left=S,_.center=E,_.right=S,this._refreshDrawHeightConstants(),b.full=0,b.left=0,b.center=_.left,b.right=_.left+_.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,E=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);w.left=E,w.center=E,w.right=E}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const E of this._decorationService.decorations)this._colorZoneStore.addDecoration(E);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const E of S)E.position!=="full"&&this._renderColorZone(E);for(const E of S)E.position==="full"&&this._renderColorZone(E);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(b[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-w[S.position||"full"]/2),_[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[S.position||"full"]))}_queueRefresh(S,E){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=E||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=h([p(2,C.IBufferService),p(3,C.IDecorationService),p(4,g.IRenderService),p(5,C.IOptionsService),p(6,g.ICoreBrowserService)],x)},2950:function(c,l,u){var h=this&&this.__decorate||function(w,_,b,x){var S,E=arguments.length,T=E<3?_:x===null?x=Object.getOwnPropertyDescriptor(_,b):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(w,_,b,x);else for(var A=w.length-1;A>=0;A--)(S=w[A])&&(T=(E<3?S(T):E>3?S(_,b,T):S(_,b))||T);return E>3&&T&&Object.defineProperty(_,b,T),T},p=this&&this.__param||function(w,_){return function(b,x){_(b,x,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const f=u(4725),g=u(2585),y=u(2584);let C=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,_,b,x,S,E){this._textarea=w,this._compositionView=_,this._bufferService=b,this._optionsService=x,this._coreService=S,this._renderService=E,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const _={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let b;this._isSendingComposition=!1,_.start+=this._dataAlreadySent.length,b=this._isComposing?this._textarea.value.substring(_.start,_.end):this._textarea.value.substring(_.start),b.length>0&&this._coreService.triggerDataEvent(b,!0)}}),0)}else{this._isSendingComposition=!1;const _=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(_,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const _=this._textarea.value,b=_.replace(w,"");this._dataAlreadySent=b,_.length>w.length?this._coreService.triggerDataEvent(b,!0):_.lengththis.updateCompositionElements(!0)),0)}}};l.CompositionHelper=C=h([p(2,g.IBufferService),p(3,g.IOptionsService),p(4,g.ICoreService),p(5,f.IRenderService)],C)},9806:(c,l)=>{function u(h,p,f){const g=f.getBoundingClientRect(),y=h.getComputedStyle(f),C=parseInt(y.getPropertyValue("padding-left")),w=parseInt(y.getPropertyValue("padding-top"));return[p.clientX-g.left-C,p.clientY-g.top-w]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=u,l.getCoords=function(h,p,f,g,y,C,w,_,b){if(!C)return;const x=u(h,p,f);return x?(x[0]=Math.ceil((x[0]+(b?w/2:0))/w),x[1]=Math.ceil(x[1]/_),x[0]=Math.min(Math.max(x[0],1),g+(b?1:0)),x[1]=Math.min(Math.max(x[1],1),y),x):void 0}},9504:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const h=u(2584);function p(_,b,x,S){const E=_-f(_,x),T=b-f(b,x),A=Math.abs(E-T)-(function(D,M,R){let z=0;const H=D-f(D,R),q=M-f(M,R);for(let $=0;$=0&&_b?"A":"B"}function y(_,b,x,S,E,T){let A=_,D=b,M="";for(;A!==x||D!==S;)A+=E?1:-1,E&&A>T.cols-1?(M+=T.buffer.translateBufferLineToString(D,!1,_,A),A=0,_=0,D++):!E&&A<0&&(M+=T.buffer.translateBufferLineToString(D,!1,0,_+1),A=T.cols-1,_=A,D--);return M+T.buffer.translateBufferLineToString(D,!1,_,A)}function C(_,b){const x=b?"O":"[";return h.C0.ESC+x+_}function w(_,b){_=Math.floor(_);let x="";for(let S=0;S<_;S++)x+=b;return x}l.moveToCellSequence=function(_,b,x,S){const E=x.buffer.x,T=x.buffer.y;if(!x.buffer.hasScrollback)return(function(M,R,z,H,q,$){return p(R,H,q,$).length===0?"":w(y(M,R,M,R-f(R,q),!1,q).length,C("D",$))})(E,T,0,b,x,S)+p(T,b,x,S)+(function(M,R,z,H,q,$){let U;U=p(R,H,q,$).length>0?H-f(H,q):R;const K=H,Y=(function(Q,ee,B,L,O,W){let G;return G=p(B,L,O,W).length>0?L-f(L,O):ee,Q=B&&G_?"D":"C",w(Math.abs(E-_),C(A,S));A=T>b?"D":"C";const D=Math.abs(T-b);return w((function(M,R){return R.cols-M})(T>b?_:E,x)+(D-1)*x.cols+1+((T>b?E:_)-1),C(A,S))}},1296:function(c,l,u){var h=this&&this.__decorate||function($,U,K,Y){var Q,ee=arguments.length,B=ee<3?U:Y===null?Y=Object.getOwnPropertyDescriptor(U,K):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate($,U,K,Y);else for(var L=$.length-1;L>=0;L--)(Q=$[L])&&(B=(ee<3?Q(B):ee>3?Q(U,K,B):Q(U,K))||B);return ee>3&&B&&Object.defineProperty(U,K,B),B},p=this&&this.__param||function($,U){return function(K,Y){U(K,Y,$)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const f=u(3787),g=u(2550),y=u(2223),C=u(6171),w=u(6052),_=u(4725),b=u(8055),x=u(8460),S=u(844),E=u(2585),T="xterm-dom-renderer-owner-",A="xterm-rows",D="xterm-fg-",M="xterm-bg-",R="xterm-focus",z="xterm-selection";let H=1,q=l.DomRenderer=class extends S.Disposable{constructor($,U,K,Y,Q,ee,B,L,O,W,G,ie,fe){super(),this._terminal=$,this._document=U,this._element=K,this._screenElement=Y,this._viewportElement=Q,this._helperContainer=ee,this._linkifier2=B,this._charSizeService=O,this._optionsService=W,this._bufferService=G,this._coreBrowserService=ie,this._themeService=fe,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(A),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((pe=>this._injectCss(pe)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(T+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((pe=>this._handleLinkHover(pe)))),this.register(this._linkifier2.onHideLinkUnderline((pe=>this._handleLinkLeave(pe)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const $=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*$,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*$),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/$),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/$),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const K of this._rowElements)K.style.width=`${this.dimensions.css.canvas.width}px`,K.style.height=`${this.dimensions.css.cell.height}px`,K.style.lineHeight=`${this.dimensions.css.cell.height}px`,K.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const U=`${this._terminalSelector} .${A} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=U,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss($){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let U=`${this._terminalSelector} .${A} { color: ${$.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;U+=`${this._terminalSelector} .${A} .xterm-dim { color: ${b.color.multiplyOpacity($.foreground,.5).css};}`,U+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const K=`blink_underline_${this._terminalClass}`,Y=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;U+=`@keyframes ${K} { 50% { border-bottom-style: hidden; }}`,U+=`@keyframes ${Y} { 50% { box-shadow: none; }}`,U+=`@keyframes ${Q} { 0% { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css}; } 50% { background-color: inherit; color: ${$.cursor.css}; }}`,U+=`${this._terminalSelector} .${A}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${A}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${A}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block { background-color: ${$.cursor.css}; color: ${$.cursorAccent.css};}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${$.cursor.css} !important; color: ${$.cursorAccent.css} !important;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${$.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${$.cursor.css} inset;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${$.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,U+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${$.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${$.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,B]of $.ansi.entries())U+=`${this._terminalSelector} .${D}${ee} { color: ${B.css}; }${this._terminalSelector} .${D}${ee}.xterm-dim { color: ${b.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${M}${ee} { background-color: ${B.css}; }`;U+=`${this._terminalSelector} .${D}${y.INVERTED_DEFAULT_COLOR} { color: ${b.color.opaque($.background).css}; }${this._terminalSelector} .${D}${y.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${b.color.multiplyOpacity(b.color.opaque($.background),.5).css}; }${this._terminalSelector} .${M}${y.INVERTED_DEFAULT_COLOR} { background-color: ${$.foreground.css}; }`,this._themeStyleElement.textContent=U}_setDefaultSpacing(){const $=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${$}px`,this._rowFactory.defaultSpacing=$}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements($,U){for(let K=this._rowElements.length;K<=U;K++){const Y=this._document.createElement("div");this._rowContainer.appendChild(Y),this._rowElements.push(Y)}for(;this._rowElements.length>U;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize($,U){this._refreshRowElements($,U),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(R),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(R),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged($,U,K){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged($,U,K),this.renderRows(0,this._bufferService.rows-1),!$||!U)return;this._selectionRenderModel.update(this._terminal,$,U,K);const Y=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,B=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||B<0)return;const L=this._document.createDocumentFragment();if(K){const O=$[0]>U[0];L.appendChild(this._createSelectionElement(ee,O?U[0]:$[0],O?$[0]:U[0],B-ee+1))}else{const O=Y===ee?$[0]:0,W=ee===Q?U[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(ee,O,W));const G=B-ee-1;if(L.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,G)),ee!==B){const ie=Q===B?U[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(B,0,ie))}}this._selectionContainer.appendChild(L)}_createSelectionElement($,U,K,Y=1){const Q=this._document.createElement("div"),ee=U*this.dimensions.css.cell.width;let B=this.dimensions.css.cell.width*(K-U);return ee+B>this.dimensions.css.canvas.width&&(B=this.dimensions.css.canvas.width-ee),Q.style.height=Y*this.dimensions.css.cell.height+"px",Q.style.top=$*this.dimensions.css.cell.height+"px",Q.style.left=`${ee}px`,Q.style.width=`${B}px`,Q}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const $ of this._rowElements)$.replaceChildren()}renderRows($,U){const K=this._bufferService.buffer,Y=K.ybase+K.y,Q=Math.min(K.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,B=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=$;O<=U;O++){const W=O+K.ydisp,G=this._rowElements[O],ie=K.lines.get(W);if(!G||!ie)break;G.replaceChildren(...this._rowFactory.createRow(ie,W,W===Y,B,L,Q,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!0)}_handleLinkLeave($){this._setCellUnderline($.x1,$.x2,$.y1,$.y2,$.cols,!1)}_setCellUnderline($,U,K,Y,Q,ee){K<0&&($=0),Y<0&&(U=0);const B=this._bufferService.rows-1;K=Math.max(Math.min(K,B),0),Y=Math.max(Math.min(Y,B),0),Q=Math.min(Q,this._bufferService.cols);const L=this._bufferService.buffer,O=L.ybase+L.y,W=Math.min(L.x,Q-1),G=this._optionsService.rawOptions.cursorBlink,ie=this._optionsService.rawOptions.cursorStyle,fe=this._optionsService.rawOptions.cursorInactiveStyle;for(let pe=K;pe<=Y;++pe){const te=pe+L.ydisp,V=this._rowElements[pe],ae=L.lines.get(te);if(!V||!ae)break;V.replaceChildren(...this._rowFactory.createRow(ae,te,te===O,ie,fe,W,G,this.dimensions.css.cell.width,this._widthCache,ee?pe===K?$:0:-1,ee?(pe===Y?U:Q)-1:-1))}}};l.DomRenderer=q=h([p(7,E.IInstantiationService),p(8,_.ICharSizeService),p(9,E.IOptionsService),p(10,E.IBufferService),p(11,_.ICoreBrowserService),p(12,_.IThemeService)],q)},3787:function(c,l,u){var h=this&&this.__decorate||function(A,D,M,R){var z,H=arguments.length,q=H<3?D:R===null?R=Object.getOwnPropertyDescriptor(D,M):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(A,D,M,R);else for(var $=A.length-1;$>=0;$--)(z=A[$])&&(q=(H<3?z(q):H>3?z(D,M,q):z(D,M))||q);return H>3&&q&&Object.defineProperty(D,M,q),q},p=this&&this.__param||function(A,D){return function(M,R){D(M,R,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const f=u(2223),g=u(643),y=u(511),C=u(2585),w=u(8055),_=u(4725),b=u(4269),x=u(6171),S=u(3734);let E=l.DomRendererRowFactory=class{constructor(A,D,M,R,z,H,q){this._document=A,this._characterJoinerService=D,this._optionsService=M,this._coreBrowserService=R,this._coreService=z,this._decorationService=H,this._themeService=q,this._workCell=new y.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(A,D,M){this._selectionStart=A,this._selectionEnd=D,this._columnSelectMode=M}createRow(A,D,M,R,z,H,q,$,U,K,Y){const Q=[],ee=this._characterJoinerService.getJoinedCharacters(D),B=this._themeService.colors;let L,O=A.getNoBgTrimmedLength();M&&O0&&Se===ee[0][0]){Re=!0;const lt=ee.shift();ze=new b.JoinedCellData(this._workCell,A.translateToString(!0,lt[0],lt[1]),lt[1]-lt[0]),He=lt[1]-1,Te=ze.getWidth()}const zt=this._isCellInSelection(Se,D),At=M&&Se===H,Tt=he&&Se>=K&&Se<=Y;let Gt=!1;this._decorationService.forEachDecorationAtCell(Se,D,void 0,(lt=>{Gt=!0}));let tn=ze.getChars()||g.WHITESPACE_CELL_CHAR;if(tn===" "&&(ze.isUnderline()||ze.isOverline())&&(tn=" "),oe=Te*$-U.get(tn,ze.isBold(),ze.isItalic()),L){if(W&&(zt&&ae||!zt&&!ae&&ze.bg===ie)&&(zt&&ae&&B.selectionForeground||ze.fg===fe)&&ze.extended.ext===pe&&Tt===te&&oe===V&&!At&&!Re&&!Gt){ze.isInvisible()?G+=g.WHITESPACE_CELL_CHAR:G+=tn,W++;continue}W&&(L.textContent=G),L=this._document.createElement("span"),W=0,G=""}else L=this._document.createElement("span");if(ie=ze.bg,fe=ze.fg,pe=ze.extended.ext,te=Tt,V=oe,ae=zt,Re&&H>=Se&&H<=He&&(H=Se),!this._coreService.isCursorHidden&&At&&this._coreService.isCursorInitialized){if(be.push("xterm-cursor"),this._coreBrowserService.isFocused)q&&be.push("xterm-cursor-blink"),be.push(R==="bar"?"xterm-cursor-bar":R==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":be.push("xterm-cursor-outline");break;case"block":be.push("xterm-cursor-block");break;case"bar":be.push("xterm-cursor-bar");break;case"underline":be.push("xterm-cursor-underline")}}if(ze.isBold()&&be.push("xterm-bold"),ze.isItalic()&&be.push("xterm-italic"),ze.isDim()&&be.push("xterm-dim"),G=ze.isInvisible()?g.WHITESPACE_CELL_CHAR:ze.getChars()||g.WHITESPACE_CELL_CHAR,ze.isUnderline()&&(be.push(`xterm-underline-${ze.extended.underlineStyle}`),G===" "&&(G=" "),!ze.isUnderlineColorDefault()))if(ze.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(ze.getUnderlineColor()).join(",")})`;else{let lt=ze.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ze.isBold()&<<8&&(lt+=8),L.style.textDecorationColor=B.ansi[lt].css}ze.isOverline()&&(be.push("xterm-overline"),G===" "&&(G=" ")),ze.isStrikethrough()&&be.push("xterm-strikethrough"),Tt&&(L.style.textDecoration="underline");let mt=ze.getFgColor(),ct=ze.getFgColorMode(),xt=ze.getBgColor(),_e=ze.getBgColorMode();const Ne=!!ze.isInverse();if(Ne){const lt=mt;mt=xt,xt=lt;const Pt=ct;ct=_e,_e=Pt}let Pe,Qe,Ye,Rt=!1;switch(this._decorationService.forEachDecorationAtCell(Se,D,void 0,(lt=>{lt.options.layer!=="top"&&Rt||(lt.backgroundColorRGB&&(_e=50331648,xt=lt.backgroundColorRGB.rgba>>8&16777215,Pe=lt.backgroundColorRGB),lt.foregroundColorRGB&&(ct=50331648,mt=lt.foregroundColorRGB.rgba>>8&16777215,Qe=lt.foregroundColorRGB),Rt=lt.options.layer==="top")})),!Rt&&zt&&(Pe=this._coreBrowserService.isFocused?B.selectionBackgroundOpaque:B.selectionInactiveBackgroundOpaque,xt=Pe.rgba>>8&16777215,_e=50331648,Rt=!0,B.selectionForeground&&(ct=50331648,mt=B.selectionForeground.rgba>>8&16777215,Qe=B.selectionForeground)),Rt&&be.push("xterm-decoration-top"),_e){case 16777216:case 33554432:Ye=B.ansi[xt],be.push(`xterm-bg-${xt}`);break;case 50331648:Ye=w.channels.toColor(xt>>16,xt>>8&255,255&xt),this._addStyle(L,`background-color:#${T((xt>>>0).toString(16),"0",6)}`);break;default:Ne?(Ye=B.foreground,be.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):Ye=B.background}switch(Pe||ze.isDim()&&(Pe=w.color.multiplyOpacity(Ye,.5)),ct){case 16777216:case 33554432:ze.isBold()&&mt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(mt+=8),this._applyMinimumContrast(L,Ye,B.ansi[mt],ze,Pe,void 0)||be.push(`xterm-fg-${mt}`);break;case 50331648:const lt=w.channels.toColor(mt>>16&255,mt>>8&255,255&mt);this._applyMinimumContrast(L,Ye,lt,ze,Pe,Qe)||this._addStyle(L,`color:#${T(mt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ye,B.foreground,ze,Pe,Qe)||Ne&&be.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}be.length&&(L.className=be.join(" "),be.length=0),At||Re||Gt?L.textContent=G:W++,oe!==this.defaultSpacing&&(L.style.letterSpacing=`${oe}px`),Q.push(L),Se=He}return L&&W&&(L.textContent=G),Q}_applyMinimumContrast(A,D,M,R,z,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(R.getCode()))return!1;const q=this._getContrastCache(R);let $;if(z||H||($=q.getColor(D.rgba,M.rgba)),$===void 0){const U=this._optionsService.rawOptions.minimumContrastRatio/(R.isDim()?2:1);$=w.color.ensureContrastRatio(z||D,H||M,U),q.setColor((z||D).rgba,(H||M).rgba,$??null)}return!!$&&(this._addStyle(A,`color:${$.css}`),!0)}_getContrastCache(A){return A.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(A,D){A.setAttribute("style",`${A.getAttribute("style")||""}${D};`)}_isCellInSelection(A,D){const M=this._selectionStart,R=this._selectionEnd;return!(!M||!R)&&(this._columnSelectMode?M[0]<=R[0]?A>=M[0]&&D>=M[1]&&A=M[1]&&A>=R[0]&&D<=R[1]:D>M[1]&&D=M[0]&&A=M[0])}};function T(A,D,M){for(;A.length{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(u,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const p=u.createElement("span");p.classList.add("xterm-char-measure-element");const f=u.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const g=u.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const y=u.createElement("span");y.classList.add("xterm-char-measure-element"),y.style.fontWeight="bold",y.style.fontStyle="italic",this._measureElements=[p,f,g,y],this._container.appendChild(p),this._container.appendChild(f),this._container.appendChild(g),this._container.appendChild(y),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(u,h,p,f){u===this._font&&h===this._fontSize&&p===this._weight&&f===this._weightBold||(this._font=u,this._fontSize=h,this._weight=p,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(u,h,p){let f=0;if(!h&&!p&&u.length===1&&(f=u.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const C=this._measure(u,0);return C>0&&(this._flat[f]=C),C}let g=u;h&&(g+="B"),p&&(g+="I");let y=this._holey.get(g);if(y===void 0){let C=0;h&&(C|=1),p&&(C|=2),y=this._measure(u,C),y>0&&this._holey.set(g,y)}return y}_measure(u,h){const p=this._measureElements[h];return p.textContent=u.repeat(32),p.offsetWidth/32}}},2223:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const h=u(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(c,l)=>{function u(p){return 57508<=p&&p<=57558}function h(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},l.isPowerlineGlyph=u,l.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},l.isEmoji=h,l.allowRescaling=function(p,f,g,y){return f===1&&g>Math.ceil(1.5*y)&&p!==void 0&&p>255&&!h(p)&&!u(p)&&!(function(C){return 57344<=C&&C<=63743})(p)},l.treatGlyphAsBackgroundColor=function(p){return u(p)||(function(f){return 9472<=f&&f<=9631})(p)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(p,f,g=0){return(p-(2*Math.round(f)-g))%(2*Math.round(f))}},6052:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,f,g,y=!1){if(this.selectionStart=f,this.selectionEnd=g,!f||!g||f[0]===g[0]&&f[1]===g[1])return void this.clear();const C=p.buffers.active.ydisp,w=f[1]-C,_=g[1]-C,b=Math.max(w,0),x=Math.min(_,p.rows-1);b>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=y,this.viewportStartRow=w,this.viewportEndRow=_,this.viewportCappedStartRow=b,this.viewportCappedEndRow=x,this.startCol=f[0],this.endCol=g[0])}isCellSelected(p,f,g){return!!this.hasSelection&&(g-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&g>=this.viewportCappedStartRow&&f=this.viewportCappedStartRow&&f>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g=this.startCol&&f=this.startCol)}}l.createSelectionRenderModel=function(){return new u}},456:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(u){this._bufferService=u,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,h=this.selectionEnd;return!(!u||!h)&&(u[1]>h[1]||u[1]===h[1]&&u[0]>h[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const f=u(2585),g=u(8460),y=u(844);let C=l.CharSizeService=class extends y.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,S,E){super(),this._optionsService=E,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new b(this._optionsService))}catch{this._measureStrategy=this.register(new _(x,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=C=h([p(2,f.IOptionsService)],C);class w extends y.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,E){S!==void 0&&S>0&&E!==void 0&&E>0&&(this._result.width=S,this._result.height=E)}}class _ extends w{constructor(S,E,T){super(),this._document=S,this._parentElement=E,this._optionsService=T,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class b extends w{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const E=this._ctx.measureText("W");if(!("width"in E&&"fontBoundingBoxAscent"in E&&"fontBoundingBoxDescent"in E))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(c,l,u){var h=this&&this.__decorate||function(b,x,S,E){var T,A=arguments.length,D=A<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(b,x,S,E);else for(var M=b.length-1;M>=0;M--)(T=b[M])&&(D=(A<3?T(D):A>3?T(x,S,D):T(x,S))||D);return A>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(b,x){return function(S,E){x(S,E,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const f=u(3734),g=u(643),y=u(511),C=u(2585);class w extends f.AttributeData{constructor(x,S,E){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=S,this._width=E}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=w;let _=l.CharacterJoinerService=class bw{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new y.CellData}register(x){const S={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(S),S.id}deregister(x){for(let S=0;S1){const q=this._getJoinedRanges(T,M,D,S,A);for(let $=0;$1){const H=this._getJoinedRanges(T,M,D,S,A);for(let q=0;q{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const h=u(844),p=u(8460),f=u(3656);class g extends h.Disposable{constructor(w,_,b){super(),this._textarea=w,this._window=_,this.mainDocument=b,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new y(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=g;class y extends h.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const h=u(844);class p extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{const y=this.linkProviders.indexOf(g);y!==-1&&this.linkProviders.splice(y,1)}}}}l.LinkProviderService=p},8934:function(c,l,u){var h=this&&this.__decorate||function(C,w,_,b){var x,S=arguments.length,E=S<3?w:b===null?b=Object.getOwnPropertyDescriptor(w,_):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,w,_,b);else for(var T=C.length-1;T>=0;T--)(x=C[T])&&(E=(S<3?x(E):S>3?x(w,_,E):x(w,_))||E);return S>3&&E&&Object.defineProperty(w,_,E),E},p=this&&this.__param||function(C,w){return function(_,b){w(_,b,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const f=u(4725),g=u(9806);let y=l.MouseService=class{constructor(C,w){this._renderService=C,this._charSizeService=w}getCoords(C,w,_,b,x){return(0,g.getCoords)(window,C,w,_,b,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(C,w){const _=(0,g.getCoordsRelativeToElement)(window,C,w);if(this._charSizeService.hasValidSize)return _[0]=Math.min(Math.max(_[0],0),this._renderService.dimensions.css.canvas.width-1),_[1]=Math.min(Math.max(_[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(_[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(_[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(_[0]),y:Math.floor(_[1])}}};l.MouseService=y=h([p(0,f.IRenderService),p(1,f.ICharSizeService)],y)},3230:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const f=u(6193),g=u(4725),y=u(8460),C=u(844),w=u(7226),_=u(2585);let b=l.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,S,E,T,A,D,M,R){super(),this._rowCount=x,this._charSizeService=T,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new C.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new y.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new y.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new y.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new y.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((z,H)=>this._renderRows(z,H)),M),this.register(this._renderDebouncer),this.register(M.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(E.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(A.onDecorationRegistered((()=>this._fullRefresh()))),this.register(A.onDecorationRemoved((()=>this._fullRefresh()))),this.register(E.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(E.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(R.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(M.window,S),this.register(M.onWindowChange((z=>this._registerIntersectionObserver(z,S))))}_registerIntersectionObserver(x,S){if("IntersectionObserver"in x){const E=new x.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});E.observe(S),this._observerDisposable.value=(0,C.toDisposable)((()=>E.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(x,S,E=!1){this._isPaused?this._needsFullRefresh=!0:(E||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,S,this._rowCount))}_renderRows(x,S){this._renderer.value&&(x=Math.min(x,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(x,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:S}),this._onRender.fire({start:x,end:S}),this._isNextRenderRedrawOnly=!0)}resize(x,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,S;this._renderer.value&&((S=(x=this._renderer.value).clearTextureAtlas)==null||S.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var E;return(E=this._renderer.value)==null?void 0:E.handleResize(x,S)})):this._renderer.value.handleResize(x,S),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,S,E){var T;this._selectionState.start=x,this._selectionState.end=S,this._selectionState.columnSelectMode=E,(T=this._renderer.value)==null||T.handleSelectionChanged(x,S,E)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=b=h([p(2,_.IOptionsService),p(3,g.ICharSizeService),p(4,_.IDecorationService),p(5,_.IBufferService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],b)},9312:function(c,l,u){var h=this&&this.__decorate||function(M,R,z,H){var q,$=arguments.length,U=$<3?R:H===null?H=Object.getOwnPropertyDescriptor(R,z):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(M,R,z,H);else for(var K=M.length-1;K>=0;K--)(q=M[K])&&(U=($<3?q(U):$>3?q(R,z,U):q(R,z))||U);return $>3&&U&&Object.defineProperty(R,z,U),U},p=this&&this.__param||function(M,R){return function(z,H){R(z,H,M)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const f=u(9806),g=u(9504),y=u(456),C=u(4725),w=u(8460),_=u(844),b=u(6114),x=u(4841),S=u(511),E=u(2585),T=" ",A=new RegExp(T,"g");let D=l.SelectionService=class extends _.Disposable{constructor(M,R,z,H,q,$,U,K,Y){super(),this._element=M,this._screenElement=R,this._linkifier=z,this._bufferService=H,this._coreService=q,this._mouseService=$,this._optionsService=U,this._renderService=K,this._coreBrowserService=Y,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new y.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,_.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const M=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!M||!R||M[0]===R[0]&&M[1]===R[1])}get selectionText(){const M=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;if(!M||!R)return"";const z=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(M[0]===R[0])return"";const q=M[0]q.replace(A," "))).join(b.isWindows?`\r +WARNING: This link could potentially be dangerous`)){const _=window.open();if(_){try{_.opener=null}catch{}_.location.href=b}else console.warn("Opening link blocked as opener could not be cleared")}}l.OscLinkProvider=y=h([p(0,g.IBufferService),p(1,g.IOptionsService),p(2,g.IOscLinkService)],y)},6193:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.RenderDebouncer=void 0,l.RenderDebouncer=class{constructor(u,h){this._renderCallback=u,this._coreBrowserService=h,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(u){return this._refreshCallbacks.push(u),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh()))),this._animationFrame}refresh(u,h,p){this._rowCount=p,u=u!==void 0?u:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const u=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,h),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const u of this._refreshCallbacks)u(0);this._refreshCallbacks=[]}}},3236:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Terminal=void 0;const h=u(3614),p=u(3656),f=u(3551),g=u(9042),y=u(3730),C=u(1680),w=u(3107),b=u(5744),_=u(2950),x=u(1296),S=u(428),E=u(4269),T=u(5114),A=u(8934),D=u(3230),M=u(9312),R=u(4725),z=u(6731),H=u(8055),$=u(8969),U=u(8460),q=u(844),K=u(6114),Y=u(8437),Q=u(2584),ee=u(7399),B=u(5941),L=u(9074),O=u(2585),W=u(5435),G=u(4567),ie=u(779);class fe extends $.CoreTerminal{get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}constructor(te={}){super(te),this.browser=K,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this.register(new q.MutableDisposable),this._onCursorMove=this.register(new U.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onKey=this.register(new U.EventEmitter),this.onKey=this._onKey.event,this._onRender=this.register(new U.EventEmitter),this.onRender=this._onRender.event,this._onSelectionChange=this.register(new U.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this.register(new U.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onBell=this.register(new U.EventEmitter),this.onBell=this._onBell.event,this._onFocus=this.register(new U.EventEmitter),this._onBlur=this.register(new U.EventEmitter),this._onA11yCharEmitter=this.register(new U.EventEmitter),this._onA11yTabEmitter=this.register(new U.EventEmitter),this._onWillOpen=this.register(new U.EventEmitter),this._setup(),this._decorationService=this._instantiationService.createInstance(L.DecorationService),this._instantiationService.setService(O.IDecorationService,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(ie.LinkProviderService),this._instantiationService.setService(R.ILinkProviderService,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(y.OscLinkProvider)),this.register(this._inputHandler.onRequestBell((()=>this._onBell.fire()))),this.register(this._inputHandler.onRequestRefreshRows(((V,ae)=>this.refresh(V,ae)))),this.register(this._inputHandler.onRequestSendFocus((()=>this._reportFocus()))),this.register(this._inputHandler.onRequestReset((()=>this.reset()))),this.register(this._inputHandler.onRequestWindowsOptionsReport((V=>this._reportWindowsOptions(V)))),this.register(this._inputHandler.onColor((V=>this._handleColorEvent(V)))),this.register((0,U.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,U.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,U.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize((V=>this._afterResize(V.cols,V.rows)))),this.register((0,q.toDisposable)((()=>{var V,ae;this._customKeyEventHandler=void 0,(ae=(V=this.element)==null?void 0:V.parentNode)==null||ae.removeChild(this.element)})))}_handleColorEvent(te){if(this._themeService)for(const V of te){let ae,oe="";switch(V.index){case 256:ae="foreground",oe="10";break;case 257:ae="background",oe="11";break;case 258:ae="cursor",oe="12";break;default:ae="ansi",oe="4;"+V.index}switch(V.type){case 0:const be=H.color.toColorRGB(ae==="ansi"?this._themeService.colors.ansi[V.index]:this._themeService.colors[ae]);this.coreService.triggerDataEvent(`${Q.C0.ESC}]${oe};${(0,B.toRgbString)(be)}${Q.C1_ESCAPED.ST}`);break;case 1:if(ae==="ansi")this._themeService.modifyColors((he=>he.ansi[V.index]=H.channels.toColor(...V.color)));else{const he=ae;this._themeService.modifyColors((Se=>Se[he]=H.channels.toColor(...V.color)))}break;case 2:this._themeService.restoreColor(V.index)}}}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_handleScreenReaderModeOptionChange(te){te?!this._accessibilityManager.value&&this._renderService&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(te){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[I"),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var te;return(te=this.textarea)==null?void 0:te.blur()}_handleTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(Q.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const te=this.buffer.ybase+this.buffer.y,V=this.buffer.lines.get(te);if(!V)return;const ae=Math.min(this.buffer.x,this.cols-1),oe=this._renderService.dimensions.css.cell.height,be=V.getWidth(ae),he=this._renderService.dimensions.css.cell.width*be,Se=this.buffer.y*this._renderService.dimensions.css.cell.height,Te=ae*this._renderService.dimensions.css.cell.width;this.textarea.style.left=Te+"px",this.textarea.style.top=Se+"px",this.textarea.style.width=he+"px",this.textarea.style.height=oe+"px",this.textarea.style.lineHeight=oe+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,p.addDisposableDomListener)(this.element,"copy",(V=>{this.hasSelection()&&(0,h.copyHandler)(V,this._selectionService)})));const te=V=>(0,h.handlePasteEvent)(V,this.textarea,this.coreService,this.optionsService);this.register((0,p.addDisposableDomListener)(this.textarea,"paste",te)),this.register((0,p.addDisposableDomListener)(this.element,"paste",te)),K.isFirefox?this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(V=>{V.button===2&&(0,h.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))):this.register((0,p.addDisposableDomListener)(this.element,"contextmenu",(V=>{(0,h.rightClickHandler)(V,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)}))),K.isLinux&&this.register((0,p.addDisposableDomListener)(this.element,"auxclick",(V=>{V.button===1&&(0,h.moveTextAreaUnderMouseCursor)(V,this.textarea,this.screenElement)})))}_bindKeys(){this.register((0,p.addDisposableDomListener)(this.textarea,"keyup",(te=>this._keyUp(te)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keydown",(te=>this._keyDown(te)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"keypress",(te=>this._keyPress(te)),!0)),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionstart",(()=>this._compositionHelper.compositionstart()))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionupdate",(te=>this._compositionHelper.compositionupdate(te)))),this.register((0,p.addDisposableDomListener)(this.textarea,"compositionend",(()=>this._compositionHelper.compositionend()))),this.register((0,p.addDisposableDomListener)(this.textarea,"input",(te=>this._inputEvent(te)),!0)),this.register(this.onRender((()=>this._compositionHelper.updateCompositionElements())))}open(te){var ae;if(!te)throw new Error("Terminal requires a parent element.");if(te.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((ae=this.element)==null?void 0:ae.ownerDocument.defaultView)&&this._coreBrowserService)return void(this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView));this._document=te.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),te.appendChild(this.element);const V=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),V.appendChild(this._viewportElement),this._viewportScrollArea=this._document.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this.register((0,p.addDisposableDomListener)(this.screenElement,"mousemove",(oe=>this.updateCursorStyle(oe)))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),V.appendChild(this.screenElement),this.textarea=this._document.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",g.promptLabel),K.isChromeOS||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._coreBrowserService=this.register(this._instantiationService.createInstance(T.CoreBrowserService,this.textarea,te.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(R.ICoreBrowserService,this._coreBrowserService),this.register((0,p.addDisposableDomListener)(this.textarea,"focus",(oe=>this._handleTextAreaFocus(oe)))),this.register((0,p.addDisposableDomListener)(this.textarea,"blur",(()=>this._handleTextAreaBlur()))),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(S.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(R.ICharSizeService,this._charSizeService),this._themeService=this._instantiationService.createInstance(z.ThemeService),this._instantiationService.setService(R.IThemeService,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(R.ICharacterJoinerService,this._characterJoinerService),this._renderService=this.register(this._instantiationService.createInstance(D.RenderService,this.rows,this.screenElement)),this._instantiationService.setService(R.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange((oe=>this._onRender.fire(oe)))),this.onResize((oe=>this._renderService.resize(oe.cols,oe.rows))),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(_.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(A.MouseService),this._instantiationService.setService(R.IMouseService,this._mouseService),this.linkifier=this.register(this._instantiationService.createInstance(f.Linkifier,this.screenElement)),this.element.appendChild(V);try{this._onWillOpen.fire(this.element)}catch{}this._renderService.hasRenderer()||this._renderService.setRenderer(this._createRenderer()),this.viewport=this._instantiationService.createInstance(C.Viewport,this._viewportElement,this._viewportScrollArea),this.viewport.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent,1))),this.register(this._inputHandler.onRequestSyncScrollBar((()=>this.viewport.syncScrollArea()))),this.register(this.viewport),this.register(this.onCursorMove((()=>{this._renderService.handleCursorMove(),this._syncTextArea()}))),this.register(this.onResize((()=>this._renderService.handleResize(this.cols,this.rows)))),this.register(this.onBlur((()=>this._renderService.handleBlur()))),this.register(this.onFocus((()=>this._renderService.handleFocus()))),this.register(this._renderService.onDimensionsChange((()=>this.viewport.syncScrollArea()))),this._selectionService=this.register(this._instantiationService.createInstance(M.SelectionService,this.element,this.screenElement,this.linkifier)),this._instantiationService.setService(R.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines((oe=>this.scrollLines(oe.amount,oe.suppressScrollEvent)))),this.register(this._selectionService.onSelectionChange((()=>this._onSelectionChange.fire()))),this.register(this._selectionService.onRequestRedraw((oe=>this._renderService.handleSelectionChanged(oe.start,oe.end,oe.columnSelectMode)))),this.register(this._selectionService.onLinuxMouseSelection((oe=>{this.textarea.value=oe,this.textarea.focus(),this.textarea.select()}))),this.register(this._onScroll.event((oe=>{this.viewport.syncScrollArea(),this._selectionService.refresh()}))),this.register((0,p.addDisposableDomListener)(this._viewportElement,"scroll",(()=>this._selectionService.refresh()))),this.register(this._instantiationService.createInstance(w.BufferDecorationRenderer,this.screenElement)),this.register((0,p.addDisposableDomListener)(this.element,"mousedown",(oe=>this._selectionService.handleMouseDown(oe)))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(G.AccessibilityManager,this)),this.register(this.optionsService.onSpecificOptionChange("screenReaderMode",(oe=>this._handleScreenReaderModeOptionChange(oe)))),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRulerWidth",(oe=>{!this._overviewRulerRenderer&&oe&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(b.OverviewRulerRenderer,this._viewportElement,this.screenElement)))})),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(x.DomRenderer,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){const te=this,V=this.element;function ae(he){const Se=te._mouseService.getMouseReportCoords(he,te.screenElement);if(!Se)return!1;let Te,Re;switch(he.overrideType||he.type){case"mousemove":Re=32,he.buttons===void 0?(Te=3,he.button!==void 0&&(Te=he.button<3?he.button:3)):Te=1&he.buttons?0:4&he.buttons?1:2&he.buttons?2:3;break;case"mouseup":Re=0,Te=he.button<3?he.button:3;break;case"mousedown":Re=1,Te=he.button<3?he.button:3;break;case"wheel":if(te._customWheelEventHandler&&te._customWheelEventHandler(he)===!1||te.viewport.getLinesScrolled(he)===0)return!1;Re=he.deltaY<0?0:1,Te=4;break;default:return!1}return!(Re===void 0||Te===void 0||Te>4)&&te.coreMouseService.triggerMouseEvent({col:Se.col,row:Se.row,x:Se.x,y:Se.y,button:Te,action:Re,ctrl:he.ctrlKey,alt:he.altKey,shift:he.shiftKey})}const oe={mouseup:null,wheel:null,mousedrag:null,mousemove:null},be={mouseup:he=>(ae(he),he.buttons||(this._document.removeEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.removeEventListener("mousemove",oe.mousedrag)),this.cancel(he)),wheel:he=>(ae(he),this.cancel(he,!0)),mousedrag:he=>{he.buttons&&ae(he)},mousemove:he=>{he.buttons||ae(he)}};this.register(this.coreMouseService.onProtocolChange((he=>{he?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(he)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&he?oe.mousemove||(V.addEventListener("mousemove",be.mousemove),oe.mousemove=be.mousemove):(V.removeEventListener("mousemove",oe.mousemove),oe.mousemove=null),16&he?oe.wheel||(V.addEventListener("wheel",be.wheel,{passive:!1}),oe.wheel=be.wheel):(V.removeEventListener("wheel",oe.wheel),oe.wheel=null),2&he?oe.mouseup||(oe.mouseup=be.mouseup):(this._document.removeEventListener("mouseup",oe.mouseup),oe.mouseup=null),4&he?oe.mousedrag||(oe.mousedrag=be.mousedrag):(this._document.removeEventListener("mousemove",oe.mousedrag),oe.mousedrag=null)}))),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,p.addDisposableDomListener)(V,"mousedown",(he=>{if(he.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(he))return ae(he),oe.mouseup&&this._document.addEventListener("mouseup",oe.mouseup),oe.mousedrag&&this._document.addEventListener("mousemove",oe.mousedrag),this.cancel(he)}))),this.register((0,p.addDisposableDomListener)(V,"wheel",(he=>{if(!oe.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(he)===!1)return!1;if(!this.buffer.hasScrollback){const Se=this.viewport.getLinesScrolled(he);if(Se===0)return;const Te=Q.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(he.deltaY<0?"A":"B");let Re="";for(let He=0;He{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchStart(he),this.cancel(he)}),{passive:!0})),this.register((0,p.addDisposableDomListener)(V,"touchmove",(he=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.handleTouchMove(he)?void 0:this.cancel(he)}),{passive:!1}))}refresh(te,V){var ae;(ae=this._renderService)==null||ae.refreshRows(te,V)}updateCursorStyle(te){var V;(V=this._selectionService)!=null&&V.shouldColumnSelect(te)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(te,V,ae=0){var oe;ae===1?(super.scrollLines(te,V,ae),this.refresh(0,this.rows-1)):(oe=this.viewport)==null||oe.scrollLines(te)}paste(te){(0,h.paste)(te,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(te){this._customKeyEventHandler=te}attachCustomWheelEventHandler(te){this._customWheelEventHandler=te}registerLinkProvider(te){return this._linkProviderService.registerLinkProvider(te)}registerCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const V=this._characterJoinerService.register(te);return this.refresh(0,this.rows-1),V}deregisterCharacterJoiner(te){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(te)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(te){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+te)}registerDecoration(te){return this._decorationService.registerDecoration(te)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(te,V,ae){this._selectionService.setSelection(te,V,ae)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var te;(te=this._selectionService)==null||te.clearSelection()}selectAll(){var te;(te=this._selectionService)==null||te.selectAll()}selectLines(te,V){var ae;(ae=this._selectionService)==null||ae.selectLines(te,V)}_keyDown(te){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;const V=this.browser.isMac&&this.options.macOptionIsMeta&&te.altKey;if(!V&&!this._compositionHelper.keydown(te))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(),!1;V||te.key!=="Dead"&&te.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const ae=(0,ee.evaluateKeyboardEvent)(te,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(te),ae.type===3||ae.type===2){const oe=this.rows-1;return this.scrollLines(ae.type===2?-oe:oe),this.cancel(te,!0)}return ae.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,te)||(ae.cancel&&this.cancel(te,!0),!ae.key||!!(te.key&&!te.ctrlKey&&!te.altKey&&!te.metaKey&&te.key.length===1&&te.key.charCodeAt(0)>=65&&te.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(ae.key!==Q.C0.ETX&&ae.key!==Q.C0.CR||(this.textarea.value=""),this._onKey.fire({key:ae.key,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(ae.key,!0),!this.optionsService.rawOptions.screenReaderMode||te.altKey||te.ctrlKey?this.cancel(te,!0):void(this._keyDownHandled=!0))))}_isThirdLevelShift(te,V){const ae=te.isMac&&!this.options.macOptionIsMeta&&V.altKey&&!V.ctrlKey&&!V.metaKey||te.isWindows&&V.altKey&&V.ctrlKey&&!V.metaKey||te.isWindows&&V.getModifierState("AltGraph");return V.type==="keypress"?ae:ae&&(!V.keyCode||V.keyCode>47)}_keyUp(te){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1||((function(V){return V.keyCode===16||V.keyCode===17||V.keyCode===18})(te)||this.focus(),this.updateCursorStyle(te),this._keyPressHandled=!1)}_keyPress(te){let V;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(te)===!1)return!1;if(this.cancel(te),te.charCode)V=te.charCode;else if(te.which===null||te.which===void 0)V=te.keyCode;else{if(te.which===0||te.charCode===0)return!1;V=te.which}return!(!V||(te.altKey||te.ctrlKey||te.metaKey)&&!this._isThirdLevelShift(this.browser,te)||(V=String.fromCharCode(V),this._onKey.fire({key:V,domEvent:te}),this._showCursor(),this.coreService.triggerDataEvent(V,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(te){if(te.data&&te.inputType==="insertText"&&(!te.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const V=te.data;return this.coreService.triggerDataEvent(V,!0),this.cancel(te),!0}return!1}resize(te,V){te!==this.cols||V!==this.rows?super.resize(te,V):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(te,V){var ae,oe;(ae=this._charSizeService)==null||ae.measure(),(oe=this.viewport)==null||oe.syncScrollArea(!0)}clear(){var te;if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let V=1;V{Object.defineProperty(l,"__esModule",{value:!0}),l.TimeBasedDebouncer=void 0,l.TimeBasedDebouncer=class{constructor(u,h=1e3){this._renderCallback=u,this._debounceThresholdMS=h,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(u,h,p){this._rowCount=p,u=u!==void 0?u:0,h=h!==void 0?h:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,u):u,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,h):h;const f=Date.now();if(f-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=f,this._innerRefresh();else if(!this._additionalRefreshRequested){const g=f-this._lastRefreshMs,y=this._debounceThresholdMS-g;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout((()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0}),y)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const u=Math.max(this._rowStart,0),h=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(u,h)}}},1680:function(c,l,u){var h=this&&this.__decorate||function(_,x,S,E){var T,A=arguments.length,D=A<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(_,x,S,E);else for(var M=_.length-1;M>=0;M--)(T=_[M])&&(D=(A<3?T(D):A>3?T(x,S,D):T(x,S))||D);return A>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(_,x){return function(S,E){x(S,E,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.Viewport=void 0;const f=u(3656),g=u(4725),y=u(8460),C=u(844),w=u(2585);let b=l.Viewport=class extends C.Disposable{constructor(_,x,S,E,T,A,D,M){super(),this._viewportElement=_,this._scrollArea=x,this._bufferService=S,this._optionsService=E,this._charSizeService=T,this._renderService=A,this._coreBrowserService=D,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this._onRequestScrollLines=this.register(new y.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,f.addDisposableDomListener)(this._viewportElement,"scroll",this._handleScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((R=>this._activeBuffer=R.activeBuffer))),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange((R=>this._renderDimensions=R))),this._handleThemeChange(M.colors),this.register(M.onChangeColors((R=>this._handleThemeChange(R)))),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.syncScrollArea()))),setTimeout((()=>this.syncScrollArea()))}_handleThemeChange(_){this._viewportElement.style.backgroundColor=_.background.css}reset(){this._currentRowHeight=0,this._currentDeviceCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._coreBrowserService.window.requestAnimationFrame((()=>this.syncScrollArea()))}_refresh(_){if(_)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._innerRefresh())))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderDimensions.device.cell.height/this._coreBrowserService.dpr,this._currentDeviceCellHeight=this._renderDimensions.device.cell.height,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const x=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderDimensions.css.canvas.height);this._lastRecordedBufferHeight!==x&&(this._lastRecordedBufferHeight=x,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const _=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==_&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=_),this._refreshAnimationFrame=null}syncScrollArea(_=!1){if(this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(_);this._lastRecordedViewportHeight===this._renderService.dimensions.css.canvas.height&&this._lastScrollTop===this._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.device.cell.height===this._currentDeviceCellHeight||this._refresh(_)}_handleScroll(_){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._onRequestScrollLines.fire({amount:0,suppressScrollEvent:!0});const x=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._onRequestScrollLines.fire({amount:x,suppressScrollEvent:!0})}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const _=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(_*(this._smoothScrollState.target-this._smoothScrollState.origin)),_<1?this._coreBrowserService.window.requestAnimationFrame((()=>this._smoothScroll())):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(_,x){const S=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(x<0&&this._viewportElement.scrollTop!==0||x>0&&S0&&(S=$),E=""}}return{bufferElements:T,cursorElement:S}}getLinesScrolled(_){if(_.deltaY===0||_.shiftKey)return 0;let x=this._applyScrollModifier(_.deltaY,_);return _.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(x/=this._currentRowHeight+0,this._wheelPartialScroll+=x,x=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):_.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(x*=this._bufferService.rows),x}_applyScrollModifier(_,x){const S=this._optionsService.rawOptions.fastScrollModifier;return S==="alt"&&x.altKey||S==="ctrl"&&x.ctrlKey||S==="shift"&&x.shiftKey?_*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:_*this._optionsService.rawOptions.scrollSensitivity}handleTouchStart(_){this._lastTouchY=_.touches[0].pageY}handleTouchMove(_){const x=this._lastTouchY-_.touches[0].pageY;return this._lastTouchY=_.touches[0].pageY,x!==0&&(this._viewportElement.scrollTop+=x,this._bubbleScroll(_,x))}};l.Viewport=b=h([p(2,w.IBufferService),p(3,w.IOptionsService),p(4,g.ICharSizeService),p(5,g.IRenderService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],b)},3107:function(c,l,u){var h=this&&this.__decorate||function(w,b,_,x){var S,E=arguments.length,T=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,_):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(w,b,_,x);else for(var A=w.length-1;A>=0;A--)(S=w[A])&&(T=(E<3?S(T):E>3?S(b,_,T):S(b,_))||T);return E>3&&T&&Object.defineProperty(b,_,T),T},p=this&&this.__param||function(w,b){return function(_,x){b(_,x,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferDecorationRenderer=void 0;const f=u(4725),g=u(844),y=u(2585);let C=l.BufferDecorationRenderer=class extends g.Disposable{constructor(w,b,_,x,S){super(),this._screenElement=w,this._bufferService=b,this._coreBrowserService=_,this._decorationService=x,this._renderService=S,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange((()=>this._doRefreshDecorations()))),this.register(this._renderService.onDimensionsChange((()=>{this._dimensionsChanged=!0,this._queueRefresh()}))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt}))),this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh()))),this.register(this._decorationService.onDecorationRemoved((E=>this._removeDecoration(E)))),this.register((0,g.toDisposable)((()=>{this._container.remove(),this._decorationElements.clear()})))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback((()=>{this._doRefreshDecorations(),this._animationFrame=void 0})))}_doRefreshDecorations(){for(const w of this._decorationService.decorations)this._renderDecoration(w);this._dimensionsChanged=!1}_renderDecoration(w){this._refreshStyle(w),this._dimensionsChanged&&this._refreshXPosition(w)}_createElement(w){var x;const b=this._coreBrowserService.mainDocument.createElement("div");b.classList.add("xterm-decoration"),b.classList.toggle("xterm-decoration-top-layer",((x=w==null?void 0:w.options)==null?void 0:x.layer)==="top"),b.style.width=`${Math.round((w.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,b.style.height=(w.options.height||1)*this._renderService.dimensions.css.cell.height+"px",b.style.top=(w.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height+"px",b.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;const _=w.options.x??0;return _&&_>this._bufferService.cols&&(b.style.display="none"),this._refreshXPosition(w,b),b}_refreshStyle(w){const b=w.marker.line-this._bufferService.buffers.active.ydisp;if(b<0||b>=this._bufferService.rows)w.element&&(w.element.style.display="none",w.onRenderEmitter.fire(w.element));else{let _=this._decorationElements.get(w);_||(_=this._createElement(w),w.element=_,this._decorationElements.set(w,_),this._container.appendChild(_),w.onDispose((()=>{this._decorationElements.delete(w),_.remove()}))),_.style.top=b*this._renderService.dimensions.css.cell.height+"px",_.style.display=this._altBufferIsActive?"none":"block",w.onRenderEmitter.fire(_)}}_refreshXPosition(w,b=w.element){if(!b)return;const _=w.options.x??0;(w.options.anchor||"left")==="right"?b.style.right=_?_*this._renderService.dimensions.css.cell.width+"px":"":b.style.left=_?_*this._renderService.dimensions.css.cell.width+"px":""}_removeDecoration(w){var b;(b=this._decorationElements.get(w))==null||b.remove(),this._decorationElements.delete(w),w.dispose()}};l.BufferDecorationRenderer=C=h([p(1,y.IBufferService),p(2,f.ICoreBrowserService),p(3,y.IDecorationService),p(4,f.IRenderService)],C)},5871:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ColorZoneStore=void 0,l.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(u){if(u.options.overviewRulerOptions){for(const h of this._zones)if(h.color===u.options.overviewRulerOptions.color&&h.position===u.options.overviewRulerOptions.position){if(this._lineIntersectsZone(h,u.marker.line))return;if(this._lineAdjacentToZone(h,u.marker.line,u.options.overviewRulerOptions.position))return void this._addLineToZone(h,u.marker.line)}if(this._zonePoolIndex=u.startBufferLine&&h<=u.endBufferLine}_lineAdjacentToZone(u,h,p){return h>=u.startBufferLine-this._linePadding[p||"full"]&&h<=u.endBufferLine+this._linePadding[p||"full"]}_addLineToZone(u,h){u.startBufferLine=Math.min(u.startBufferLine,h),u.endBufferLine=Math.max(u.endBufferLine,h)}}},5744:function(c,l,u){var h=this&&this.__decorate||function(S,E,T,A){var D,M=arguments.length,R=M<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,E,T,A);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(R=(M<3?D(R):M>3?D(E,T,R):D(E,T))||R);return M>3&&R&&Object.defineProperty(E,T,R),R},p=this&&this.__param||function(S,E){return function(T,A){E(T,A,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OverviewRulerRenderer=void 0;const f=u(5871),g=u(4725),y=u(844),C=u(2585),w={full:0,left:0,center:0,right:0},b={full:0,left:0,center:0,right:0},_={full:0,left:0,center:0,right:0};let x=l.OverviewRulerRenderer=class extends y.Disposable{get _width(){return this._optionsService.options.overviewRulerWidth||0}constructor(S,E,T,A,D,M,R){var H;super(),this._viewportElement=S,this._screenElement=E,this._bufferService=T,this._decorationService=A,this._renderService=D,this._optionsService=M,this._coreBrowserService=R,this._colorZoneStore=new f.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(H=this._viewportElement.parentElement)==null||H.insertBefore(this._canvas,this._viewportElement);const z=this._canvas.getContext("2d");if(!z)throw new Error("Ctx cannot be null");this._ctx=z,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners(),this.register((0,y.toDisposable)((()=>{var $;($=this._canvas)==null||$.remove()})))}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered((()=>this._queueRefresh(void 0,!0)))),this.register(this._decorationService.onDecorationRemoved((()=>this._queueRefresh(void 0,!0))))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange((()=>this._queueRefresh()))),this.register(this._bufferService.buffers.onBufferActivate((()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"}))),this.register(this._bufferService.onScroll((()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender((()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)}))),this.register(this._optionsService.onSpecificOptionChange("overviewRulerWidth",(()=>this._queueRefresh(!0)))),this.register(this._coreBrowserService.onDprChange((()=>this._queueRefresh(!0)))),this._queueRefresh(!0)}_refreshDrawConstants(){const S=Math.floor(this._canvas.width/3),E=Math.ceil(this._canvas.width/3);b.full=this._canvas.width,b.left=S,b.center=E,b.right=S,this._refreshDrawHeightConstants(),_.full=0,_.left=0,_.center=b.left,_.right=b.left+b.center}_refreshDrawHeightConstants(){w.full=Math.round(2*this._coreBrowserService.dpr);const S=this._canvas.height/this._bufferService.buffer.lines.length,E=Math.round(Math.max(Math.min(S,12),6)*this._coreBrowserService.dpr);w.left=E,w.center=E,w.right=E}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*w.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const E of this._decorationService.decorations)this._colorZoneStore.addDecoration(E);this._ctx.lineWidth=1;const S=this._colorZoneStore.zones;for(const E of S)E.position!=="full"&&this._renderColorZone(E);for(const E of S)E.position==="full"&&this._renderColorZone(E);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(S){this._ctx.fillStyle=S.color,this._ctx.fillRect(_[S.position||"full"],Math.round((this._canvas.height-1)*(S.startBufferLine/this._bufferService.buffers.active.lines.length)-w[S.position||"full"]/2),b[S.position||"full"],Math.round((this._canvas.height-1)*((S.endBufferLine-S.startBufferLine)/this._bufferService.buffers.active.lines.length)+w[S.position||"full"]))}_queueRefresh(S,E){this._shouldUpdateDimensions=S||this._shouldUpdateDimensions,this._shouldUpdateAnchor=E||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>{this._refreshDecorations(),this._animationFrame=void 0})))}};l.OverviewRulerRenderer=x=h([p(2,C.IBufferService),p(3,C.IDecorationService),p(4,g.IRenderService),p(5,C.IOptionsService),p(6,g.ICoreBrowserService)],x)},2950:function(c,l,u){var h=this&&this.__decorate||function(w,b,_,x){var S,E=arguments.length,T=E<3?b:x===null?x=Object.getOwnPropertyDescriptor(b,_):x;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")T=Reflect.decorate(w,b,_,x);else for(var A=w.length-1;A>=0;A--)(S=w[A])&&(T=(E<3?S(T):E>3?S(b,_,T):S(b,_))||T);return E>3&&T&&Object.defineProperty(b,_,T),T},p=this&&this.__param||function(w,b){return function(_,x){b(_,x,w)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CompositionHelper=void 0;const f=u(4725),g=u(2585),y=u(2584);let C=l.CompositionHelper=class{get isComposing(){return this._isComposing}constructor(w,b,_,x,S,E){this._textarea=w,this._compositionView=b,this._bufferService=_,this._optionsService=x,this._coreService=S,this._renderService=E,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(w){this._compositionView.textContent=w.data,this.updateCompositionElements(),setTimeout((()=>{this._compositionPosition.end=this._textarea.value.length}),0)}compositionend(){this._finalizeComposition(!0)}keydown(w){if(this._isComposing||this._isSendingComposition){if(w.keyCode===229||w.keyCode===16||w.keyCode===17||w.keyCode===18)return!1;this._finalizeComposition(!1)}return w.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(w){if(this._compositionView.classList.remove("active"),this._isComposing=!1,w){const b={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout((()=>{if(this._isSendingComposition){let _;this._isSendingComposition=!1,b.start+=this._dataAlreadySent.length,_=this._isComposing?this._textarea.value.substring(b.start,b.end):this._textarea.value.substring(b.start),_.length>0&&this._coreService.triggerDataEvent(_,!0)}}),0)}else{this._isSendingComposition=!1;const b=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(b,!0)}}_handleAnyTextareaChanges(){const w=this._textarea.value;setTimeout((()=>{if(!this._isComposing){const b=this._textarea.value,_=b.replace(w,"");this._dataAlreadySent=_,b.length>w.length?this._coreService.triggerDataEvent(_,!0):b.lengththis.updateCompositionElements(!0)),0)}}};l.CompositionHelper=C=h([p(2,g.IBufferService),p(3,g.IOptionsService),p(4,g.ICoreService),p(5,f.IRenderService)],C)},9806:(c,l)=>{function u(h,p,f){const g=f.getBoundingClientRect(),y=h.getComputedStyle(f),C=parseInt(y.getPropertyValue("padding-left")),w=parseInt(y.getPropertyValue("padding-top"));return[p.clientX-g.left-C,p.clientY-g.top-w]}Object.defineProperty(l,"__esModule",{value:!0}),l.getCoords=l.getCoordsRelativeToElement=void 0,l.getCoordsRelativeToElement=u,l.getCoords=function(h,p,f,g,y,C,w,b,_){if(!C)return;const x=u(h,p,f);return x?(x[0]=Math.ceil((x[0]+(_?w/2:0))/w),x[1]=Math.ceil(x[1]/b),x[0]=Math.min(Math.max(x[0],1),g+(_?1:0)),x[1]=Math.min(Math.max(x[1],1),y),x):void 0}},9504:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.moveToCellSequence=void 0;const h=u(2584);function p(b,_,x,S){const E=b-f(b,x),T=_-f(_,x),A=Math.abs(E-T)-(function(D,M,R){let z=0;const H=D-f(D,R),$=M-f(M,R);for(let U=0;U=0&&b<_.rows;)x++,S=_.buffer.lines.get(--b),E=S==null?void 0:S.isWrapped;return x}function g(b,_){return b>_?"A":"B"}function y(b,_,x,S,E,T){let A=b,D=_,M="";for(;A!==x||D!==S;)A+=E?1:-1,E&&A>T.cols-1?(M+=T.buffer.translateBufferLineToString(D,!1,b,A),A=0,b=0,D++):!E&&A<0&&(M+=T.buffer.translateBufferLineToString(D,!1,0,b+1),A=T.cols-1,b=A,D--);return M+T.buffer.translateBufferLineToString(D,!1,b,A)}function C(b,_){const x=_?"O":"[";return h.C0.ESC+x+b}function w(b,_){b=Math.floor(b);let x="";for(let S=0;S0?H-f(H,$):R;const K=H,Y=(function(Q,ee,B,L,O,W){let G;return G=p(B,L,O,W).length>0?L-f(L,O):ee,Q=B&&Gb?"D":"C",w(Math.abs(E-b),C(A,S));A=T>_?"D":"C";const D=Math.abs(T-_);return w((function(M,R){return R.cols-M})(T>_?b:E,x)+(D-1)*x.cols+1+((T>_?E:b)-1),C(A,S))}},1296:function(c,l,u){var h=this&&this.__decorate||function(U,q,K,Y){var Q,ee=arguments.length,B=ee<3?q:Y===null?Y=Object.getOwnPropertyDescriptor(q,K):Y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")B=Reflect.decorate(U,q,K,Y);else for(var L=U.length-1;L>=0;L--)(Q=U[L])&&(B=(ee<3?Q(B):ee>3?Q(q,K,B):Q(q,K))||B);return ee>3&&B&&Object.defineProperty(q,K,B),B},p=this&&this.__param||function(U,q){return function(K,Y){q(K,Y,U)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRenderer=void 0;const f=u(3787),g=u(2550),y=u(2223),C=u(6171),w=u(6052),b=u(4725),_=u(8055),x=u(8460),S=u(844),E=u(2585),T="xterm-dom-renderer-owner-",A="xterm-rows",D="xterm-fg-",M="xterm-bg-",R="xterm-focus",z="xterm-selection";let H=1,$=l.DomRenderer=class extends S.Disposable{constructor(U,q,K,Y,Q,ee,B,L,O,W,G,ie,fe){super(),this._terminal=U,this._document=q,this._element=K,this._screenElement=Y,this._viewportElement=Q,this._helperContainer=ee,this._linkifier2=B,this._charSizeService=O,this._optionsService=W,this._bufferService=G,this._coreBrowserService=ie,this._themeService=fe,this._terminalClass=H++,this._rowElements=[],this._selectionRenderModel=(0,w.createSelectionRenderModel)(),this.onRequestRedraw=this.register(new x.EventEmitter).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(A),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement("div"),this._selectionContainer.classList.add(z),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=(0,C.createRenderDimensions)(),this._updateDimensions(),this.register(this._optionsService.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._themeService.onChangeColors((pe=>this._injectCss(pe)))),this._injectCss(this._themeService.colors),this._rowFactory=L.createInstance(f.DomRendererRowFactory,document),this._element.classList.add(T+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline((pe=>this._handleLinkHover(pe)))),this.register(this._linkifier2.onHideLinkUnderline((pe=>this._handleLinkLeave(pe)))),this.register((0,S.toDisposable)((()=>{this._element.classList.remove(T+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()}))),this._widthCache=new g.WidthCache(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){const U=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*U,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*U),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/U),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/U),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(const K of this._rowElements)K.style.width=`${this.dimensions.css.canvas.width}px`,K.style.height=`${this.dimensions.css.cell.height}px`,K.style.lineHeight=`${this.dimensions.css.cell.height}px`,K.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const q=`${this._terminalSelector} .${A} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=q,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(U){this._themeStyleElement||(this._themeStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let q=`${this._terminalSelector} .${A} { color: ${U.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;q+=`${this._terminalSelector} .${A} .xterm-dim { color: ${_.color.multiplyOpacity(U.foreground,.5).css};}`,q+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;const K=`blink_underline_${this._terminalClass}`,Y=`blink_bar_${this._terminalClass}`,Q=`blink_block_${this._terminalClass}`;q+=`@keyframes ${K} { 50% { border-bottom-style: hidden; }}`,q+=`@keyframes ${Y} { 50% { box-shadow: none; }}`,q+=`@keyframes ${Q} { 0% { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css}; } 50% { background-color: inherit; color: ${U.cursor.css}; }}`,q+=`${this._terminalSelector} .${A}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${K} 1s step-end infinite;}${this._terminalSelector} .${A}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${Y} 1s step-end infinite;}${this._terminalSelector} .${A}.${R} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${Q} 1s step-end infinite;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block { background-color: ${U.cursor.css}; color: ${U.cursorAccent.css};}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${U.cursor.css} !important; color: ${U.cursorAccent.css} !important;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${U.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${U.cursor.css} inset;}${this._terminalSelector} .${A} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${U.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,q+=`${this._terminalSelector} .${z} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${z} div { position: absolute; background-color: ${U.selectionBackgroundOpaque.css};}${this._terminalSelector} .${z} div { position: absolute; background-color: ${U.selectionInactiveBackgroundOpaque.css};}`;for(const[ee,B]of U.ansi.entries())q+=`${this._terminalSelector} .${D}${ee} { color: ${B.css}; }${this._terminalSelector} .${D}${ee}.xterm-dim { color: ${_.color.multiplyOpacity(B,.5).css}; }${this._terminalSelector} .${M}${ee} { background-color: ${B.css}; }`;q+=`${this._terminalSelector} .${D}${y.INVERTED_DEFAULT_COLOR} { color: ${_.color.opaque(U.background).css}; }${this._terminalSelector} .${D}${y.INVERTED_DEFAULT_COLOR}.xterm-dim { color: ${_.color.multiplyOpacity(_.color.opaque(U.background),.5).css}; }${this._terminalSelector} .${M}${y.INVERTED_DEFAULT_COLOR} { background-color: ${U.foreground.css}; }`,this._themeStyleElement.textContent=q}_setDefaultSpacing(){const U=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${U}px`,this._rowFactory.defaultSpacing=U}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(U,q){for(let K=this._rowElements.length;K<=q;K++){const Y=this._document.createElement("div");this._rowContainer.appendChild(Y),this._rowElements.push(Y)}for(;this._rowElements.length>q;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(U,q){this._refreshRowElements(U,q),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(R),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(R),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(U,q,K){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(U,q,K),this.renderRows(0,this._bufferService.rows-1),!U||!q)return;this._selectionRenderModel.update(this._terminal,U,q,K);const Y=this._selectionRenderModel.viewportStartRow,Q=this._selectionRenderModel.viewportEndRow,ee=this._selectionRenderModel.viewportCappedStartRow,B=this._selectionRenderModel.viewportCappedEndRow;if(ee>=this._bufferService.rows||B<0)return;const L=this._document.createDocumentFragment();if(K){const O=U[0]>q[0];L.appendChild(this._createSelectionElement(ee,O?q[0]:U[0],O?U[0]:q[0],B-ee+1))}else{const O=Y===ee?U[0]:0,W=ee===Q?q[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(ee,O,W));const G=B-ee-1;if(L.appendChild(this._createSelectionElement(ee+1,0,this._bufferService.cols,G)),ee!==B){const ie=Q===B?q[0]:this._bufferService.cols;L.appendChild(this._createSelectionElement(B,0,ie))}}this._selectionContainer.appendChild(L)}_createSelectionElement(U,q,K,Y=1){const Q=this._document.createElement("div"),ee=q*this.dimensions.css.cell.width;let B=this.dimensions.css.cell.width*(K-q);return ee+B>this.dimensions.css.canvas.width&&(B=this.dimensions.css.canvas.width-ee),Q.style.height=Y*this.dimensions.css.cell.height+"px",Q.style.top=U*this.dimensions.css.cell.height+"px",Q.style.left=`${ee}px`,Q.style.width=`${B}px`,Q}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(const U of this._rowElements)U.replaceChildren()}renderRows(U,q){const K=this._bufferService.buffer,Y=K.ybase+K.y,Q=Math.min(K.x,this._bufferService.cols-1),ee=this._optionsService.rawOptions.cursorBlink,B=this._optionsService.rawOptions.cursorStyle,L=this._optionsService.rawOptions.cursorInactiveStyle;for(let O=U;O<=q;O++){const W=O+K.ydisp,G=this._rowElements[O],ie=K.lines.get(W);if(!G||!ie)break;G.replaceChildren(...this._rowFactory.createRow(ie,W,W===Y,B,L,Q,ee,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${T}${this._terminalClass}`}_handleLinkHover(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!0)}_handleLinkLeave(U){this._setCellUnderline(U.x1,U.x2,U.y1,U.y2,U.cols,!1)}_setCellUnderline(U,q,K,Y,Q,ee){K<0&&(U=0),Y<0&&(q=0);const B=this._bufferService.rows-1;K=Math.max(Math.min(K,B),0),Y=Math.max(Math.min(Y,B),0),Q=Math.min(Q,this._bufferService.cols);const L=this._bufferService.buffer,O=L.ybase+L.y,W=Math.min(L.x,Q-1),G=this._optionsService.rawOptions.cursorBlink,ie=this._optionsService.rawOptions.cursorStyle,fe=this._optionsService.rawOptions.cursorInactiveStyle;for(let pe=K;pe<=Y;++pe){const te=pe+L.ydisp,V=this._rowElements[pe],ae=L.lines.get(te);if(!V||!ae)break;V.replaceChildren(...this._rowFactory.createRow(ae,te,te===O,ie,fe,W,G,this.dimensions.css.cell.width,this._widthCache,ee?pe===K?U:0:-1,ee?(pe===Y?q:Q)-1:-1))}}};l.DomRenderer=$=h([p(7,E.IInstantiationService),p(8,b.ICharSizeService),p(9,E.IOptionsService),p(10,E.IBufferService),p(11,b.ICoreBrowserService),p(12,b.IThemeService)],$)},3787:function(c,l,u){var h=this&&this.__decorate||function(A,D,M,R){var z,H=arguments.length,$=H<3?D:R===null?R=Object.getOwnPropertyDescriptor(D,M):R;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(A,D,M,R);else for(var U=A.length-1;U>=0;U--)(z=A[U])&&($=(H<3?z($):H>3?z(D,M,$):z(D,M))||$);return H>3&&$&&Object.defineProperty(D,M,$),$},p=this&&this.__param||function(A,D){return function(M,R){D(M,R,A)}};Object.defineProperty(l,"__esModule",{value:!0}),l.DomRendererRowFactory=void 0;const f=u(2223),g=u(643),y=u(511),C=u(2585),w=u(8055),b=u(4725),_=u(4269),x=u(6171),S=u(3734);let E=l.DomRendererRowFactory=class{constructor(A,D,M,R,z,H,$){this._document=A,this._characterJoinerService=D,this._optionsService=M,this._coreBrowserService=R,this._coreService=z,this._decorationService=H,this._themeService=$,this._workCell=new y.CellData,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(A,D,M){this._selectionStart=A,this._selectionEnd=D,this._columnSelectMode=M}createRow(A,D,M,R,z,H,$,U,q,K,Y){const Q=[],ee=this._characterJoinerService.getJoinedCharacters(D),B=this._themeService.colors;let L,O=A.getNoBgTrimmedLength();M&&O0&&Se===ee[0][0]){Re=!0;const lt=ee.shift();ze=new _.JoinedCellData(this._workCell,A.translateToString(!0,lt[0],lt[1]),lt[1]-lt[0]),He=lt[1]-1,Te=ze.getWidth()}const zt=this._isCellInSelection(Se,D),At=M&&Se===H,Tt=he&&Se>=K&&Se<=Y;let Gt=!1;this._decorationService.forEachDecorationAtCell(Se,D,void 0,(lt=>{Gt=!0}));let tn=ze.getChars()||g.WHITESPACE_CELL_CHAR;if(tn===" "&&(ze.isUnderline()||ze.isOverline())&&(tn=" "),oe=Te*U-q.get(tn,ze.isBold(),ze.isItalic()),L){if(W&&(zt&&ae||!zt&&!ae&&ze.bg===ie)&&(zt&&ae&&B.selectionForeground||ze.fg===fe)&&ze.extended.ext===pe&&Tt===te&&oe===V&&!At&&!Re&&!Gt){ze.isInvisible()?G+=g.WHITESPACE_CELL_CHAR:G+=tn,W++;continue}W&&(L.textContent=G),L=this._document.createElement("span"),W=0,G=""}else L=this._document.createElement("span");if(ie=ze.bg,fe=ze.fg,pe=ze.extended.ext,te=Tt,V=oe,ae=zt,Re&&H>=Se&&H<=He&&(H=Se),!this._coreService.isCursorHidden&&At&&this._coreService.isCursorInitialized){if(be.push("xterm-cursor"),this._coreBrowserService.isFocused)$&&be.push("xterm-cursor-blink"),be.push(R==="bar"?"xterm-cursor-bar":R==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(z)switch(z){case"outline":be.push("xterm-cursor-outline");break;case"block":be.push("xterm-cursor-block");break;case"bar":be.push("xterm-cursor-bar");break;case"underline":be.push("xterm-cursor-underline")}}if(ze.isBold()&&be.push("xterm-bold"),ze.isItalic()&&be.push("xterm-italic"),ze.isDim()&&be.push("xterm-dim"),G=ze.isInvisible()?g.WHITESPACE_CELL_CHAR:ze.getChars()||g.WHITESPACE_CELL_CHAR,ze.isUnderline()&&(be.push(`xterm-underline-${ze.extended.underlineStyle}`),G===" "&&(G=" "),!ze.isUnderlineColorDefault()))if(ze.isUnderlineColorRGB())L.style.textDecorationColor=`rgb(${S.AttributeData.toColorRGB(ze.getUnderlineColor()).join(",")})`;else{let lt=ze.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&ze.isBold()&<<8&&(lt+=8),L.style.textDecorationColor=B.ansi[lt].css}ze.isOverline()&&(be.push("xterm-overline"),G===" "&&(G=" ")),ze.isStrikethrough()&&be.push("xterm-strikethrough"),Tt&&(L.style.textDecoration="underline");let mt=ze.getFgColor(),ct=ze.getFgColorMode(),xt=ze.getBgColor(),_e=ze.getBgColorMode();const Ne=!!ze.isInverse();if(Ne){const lt=mt;mt=xt,xt=lt;const Pt=ct;ct=_e,_e=Pt}let Pe,Qe,Ye,Rt=!1;switch(this._decorationService.forEachDecorationAtCell(Se,D,void 0,(lt=>{lt.options.layer!=="top"&&Rt||(lt.backgroundColorRGB&&(_e=50331648,xt=lt.backgroundColorRGB.rgba>>8&16777215,Pe=lt.backgroundColorRGB),lt.foregroundColorRGB&&(ct=50331648,mt=lt.foregroundColorRGB.rgba>>8&16777215,Qe=lt.foregroundColorRGB),Rt=lt.options.layer==="top")})),!Rt&&zt&&(Pe=this._coreBrowserService.isFocused?B.selectionBackgroundOpaque:B.selectionInactiveBackgroundOpaque,xt=Pe.rgba>>8&16777215,_e=50331648,Rt=!0,B.selectionForeground&&(ct=50331648,mt=B.selectionForeground.rgba>>8&16777215,Qe=B.selectionForeground)),Rt&&be.push("xterm-decoration-top"),_e){case 16777216:case 33554432:Ye=B.ansi[xt],be.push(`xterm-bg-${xt}`);break;case 50331648:Ye=w.channels.toColor(xt>>16,xt>>8&255,255&xt),this._addStyle(L,`background-color:#${T((xt>>>0).toString(16),"0",6)}`);break;default:Ne?(Ye=B.foreground,be.push(`xterm-bg-${f.INVERTED_DEFAULT_COLOR}`)):Ye=B.background}switch(Pe||ze.isDim()&&(Pe=w.color.multiplyOpacity(Ye,.5)),ct){case 16777216:case 33554432:ze.isBold()&&mt<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(mt+=8),this._applyMinimumContrast(L,Ye,B.ansi[mt],ze,Pe,void 0)||be.push(`xterm-fg-${mt}`);break;case 50331648:const lt=w.channels.toColor(mt>>16&255,mt>>8&255,255&mt);this._applyMinimumContrast(L,Ye,lt,ze,Pe,Qe)||this._addStyle(L,`color:#${T(mt.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(L,Ye,B.foreground,ze,Pe,Qe)||Ne&&be.push(`xterm-fg-${f.INVERTED_DEFAULT_COLOR}`)}be.length&&(L.className=be.join(" "),be.length=0),At||Re||Gt?L.textContent=G:W++,oe!==this.defaultSpacing&&(L.style.letterSpacing=`${oe}px`),Q.push(L),Se=He}return L&&W&&(L.textContent=G),Q}_applyMinimumContrast(A,D,M,R,z,H){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,x.treatGlyphAsBackgroundColor)(R.getCode()))return!1;const $=this._getContrastCache(R);let U;if(z||H||(U=$.getColor(D.rgba,M.rgba)),U===void 0){const q=this._optionsService.rawOptions.minimumContrastRatio/(R.isDim()?2:1);U=w.color.ensureContrastRatio(z||D,H||M,q),$.setColor((z||D).rgba,(H||M).rgba,U??null)}return!!U&&(this._addStyle(A,`color:${U.css}`),!0)}_getContrastCache(A){return A.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(A,D){A.setAttribute("style",`${A.getAttribute("style")||""}${D};`)}_isCellInSelection(A,D){const M=this._selectionStart,R=this._selectionEnd;return!(!M||!R)&&(this._columnSelectMode?M[0]<=R[0]?A>=M[0]&&D>=M[1]&&A=M[1]&&A>=R[0]&&D<=R[1]:D>M[1]&&D=M[0]&&A=M[0])}};function T(A,D,M){for(;A.length{Object.defineProperty(l,"__esModule",{value:!0}),l.WidthCache=void 0,l.WidthCache=class{constructor(u,h){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=u.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";const p=u.createElement("span");p.classList.add("xterm-char-measure-element");const f=u.createElement("span");f.classList.add("xterm-char-measure-element"),f.style.fontWeight="bold";const g=u.createElement("span");g.classList.add("xterm-char-measure-element"),g.style.fontStyle="italic";const y=u.createElement("span");y.classList.add("xterm-char-measure-element"),y.style.fontWeight="bold",y.style.fontStyle="italic",this._measureElements=[p,f,g,y],this._container.appendChild(p),this._container.appendChild(f),this._container.appendChild(g),this._container.appendChild(y),h.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(u,h,p,f){u===this._font&&h===this._fontSize&&p===this._weight&&f===this._weightBold||(this._font=u,this._fontSize=h,this._weight=p,this._weightBold=f,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${p}`,this._measureElements[1].style.fontWeight=`${f}`,this._measureElements[2].style.fontWeight=`${p}`,this._measureElements[3].style.fontWeight=`${f}`,this.clear())}get(u,h,p){let f=0;if(!h&&!p&&u.length===1&&(f=u.charCodeAt(0))<256){if(this._flat[f]!==-9999)return this._flat[f];const C=this._measure(u,0);return C>0&&(this._flat[f]=C),C}let g=u;h&&(g+="B"),p&&(g+="I");let y=this._holey.get(g);if(y===void 0){let C=0;h&&(C|=1),p&&(C|=2),y=this._measure(u,C),y>0&&this._holey.set(g,y)}return y}_measure(u,h){const p=this._measureElements[h];return p.textContent=u.repeat(32),p.offsetWidth/32}}},2223:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TEXT_BASELINE=l.DIM_OPACITY=l.INVERTED_DEFAULT_COLOR=void 0;const h=u(6114);l.INVERTED_DEFAULT_COLOR=257,l.DIM_OPACITY=.5,l.TEXT_BASELINE=h.isFirefox||h.isLegacyEdge?"bottom":"ideographic"},6171:(c,l)=>{function u(p){return 57508<=p&&p<=57558}function h(p){return p>=128512&&p<=128591||p>=127744&&p<=128511||p>=128640&&p<=128767||p>=9728&&p<=9983||p>=9984&&p<=10175||p>=65024&&p<=65039||p>=129280&&p<=129535||p>=127462&&p<=127487}Object.defineProperty(l,"__esModule",{value:!0}),l.computeNextVariantOffset=l.createRenderDimensions=l.treatGlyphAsBackgroundColor=l.allowRescaling=l.isEmoji=l.isRestrictedPowerlineGlyph=l.isPowerlineGlyph=l.throwIfFalsy=void 0,l.throwIfFalsy=function(p){if(!p)throw new Error("value must not be falsy");return p},l.isPowerlineGlyph=u,l.isRestrictedPowerlineGlyph=function(p){return 57520<=p&&p<=57527},l.isEmoji=h,l.allowRescaling=function(p,f,g,y){return f===1&&g>Math.ceil(1.5*y)&&p!==void 0&&p>255&&!h(p)&&!u(p)&&!(function(C){return 57344<=C&&C<=63743})(p)},l.treatGlyphAsBackgroundColor=function(p){return u(p)||(function(f){return 9472<=f&&f<=9631})(p)},l.createRenderDimensions=function(){return{css:{canvas:{width:0,height:0},cell:{width:0,height:0}},device:{canvas:{width:0,height:0},cell:{width:0,height:0},char:{width:0,height:0,left:0,top:0}}}},l.computeNextVariantOffset=function(p,f,g=0){return(p-(2*Math.round(f)-g))%(2*Math.round(f))}},6052:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createSelectionRenderModel=void 0;class u{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(p,f,g,y=!1){if(this.selectionStart=f,this.selectionEnd=g,!f||!g||f[0]===g[0]&&f[1]===g[1])return void this.clear();const C=p.buffers.active.ydisp,w=f[1]-C,b=g[1]-C,_=Math.max(w,0),x=Math.min(b,p.rows-1);_>=p.rows||x<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=y,this.viewportStartRow=w,this.viewportEndRow=b,this.viewportCappedStartRow=_,this.viewportCappedEndRow=x,this.startCol=f[0],this.endCol=g[0])}isCellSelected(p,f,g){return!!this.hasSelection&&(g-=p.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?f>=this.startCol&&g>=this.viewportCappedStartRow&&f=this.viewportCappedStartRow&&f>=this.endCol&&g<=this.viewportCappedEndRow:g>this.viewportStartRow&&g=this.startCol&&f=this.startCol)}}l.createSelectionRenderModel=function(){return new u}},456:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionModel=void 0,l.SelectionModel=class{constructor(u){this._bufferService=u,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?u%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)-1]:[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[u,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const u=this.selectionStart[0]+this.selectionStartLength;return u>this._bufferService.cols?[u%this._bufferService.cols,this.selectionStart[1]+Math.floor(u/this._bufferService.cols)]:[Math.max(u,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const u=this.selectionStart,h=this.selectionEnd;return!(!u||!h)&&(u[1]>h[1]||u[1]===h[1]&&u[0]>h[0])}handleTrim(u){return this.selectionStart&&(this.selectionStart[1]-=u),this.selectionEnd&&(this.selectionEnd[1]-=u),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharSizeService=void 0;const f=u(2585),g=u(8460),y=u(844);let C=l.CharSizeService=class extends y.Disposable{get hasValidSize(){return this.width>0&&this.height>0}constructor(x,S,E){super(),this._optionsService=E,this.width=0,this.height=0,this._onCharSizeChange=this.register(new g.EventEmitter),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this.register(new _(this._optionsService))}catch{this._measureStrategy=this.register(new b(x,S,this._optionsService))}this.register(this._optionsService.onMultipleOptionChange(["fontFamily","fontSize"],(()=>this.measure())))}measure(){const x=this._measureStrategy.measure();x.width===this.width&&x.height===this.height||(this.width=x.width,this.height=x.height,this._onCharSizeChange.fire())}};l.CharSizeService=C=h([p(2,f.IOptionsService)],C);class w extends y.Disposable{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(S,E){S!==void 0&&S>0&&E!==void 0&&E>0&&(this._result.width=S,this._result.height=E)}}class b extends w{constructor(S,E,T){super(),this._document=S,this._parentElement=E,this._optionsService=T,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}}class _ extends w{constructor(S){super(),this._optionsService=S,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext("2d");const E=this._ctx.measureText("W");if(!("width"in E&&"fontBoundingBoxAscent"in E&&"fontBoundingBoxDescent"in E))throw new Error("Required font metrics not supported")}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;const S=this._ctx.measureText("W");return this._validateAndSet(S.width,S.fontBoundingBoxAscent+S.fontBoundingBoxDescent),this._result}}},4269:function(c,l,u){var h=this&&this.__decorate||function(_,x,S,E){var T,A=arguments.length,D=A<3?x:E===null?E=Object.getOwnPropertyDescriptor(x,S):E;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")D=Reflect.decorate(_,x,S,E);else for(var M=_.length-1;M>=0;M--)(T=_[M])&&(D=(A<3?T(D):A>3?T(x,S,D):T(x,S))||D);return A>3&&D&&Object.defineProperty(x,S,D),D},p=this&&this.__param||function(_,x){return function(S,E){x(S,E,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CharacterJoinerService=l.JoinedCellData=void 0;const f=u(3734),g=u(643),y=u(511),C=u(2585);class w extends f.AttributeData{constructor(x,S,E){super(),this.content=0,this.combinedData="",this.fg=x.fg,this.bg=x.bg,this.combinedData=S,this._width=E}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(x){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.JoinedCellData=w;let b=l.CharacterJoinerService=class yw{constructor(x){this._bufferService=x,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new y.CellData}register(x){const S={id:this._nextCharacterJoinerId++,handler:x};return this._characterJoiners.push(S),S.id}deregister(x){for(let S=0;S1){const $=this._getJoinedRanges(T,M,D,S,A);for(let U=0;U<$.length;U++)E.push($[U])}A=H,M=D,R=this._workCell.fg,z=this._workCell.bg}D+=this._workCell.getChars().length||g.WHITESPACE_CELL_CHAR.length}if(this._bufferService.cols-A>1){const H=this._getJoinedRanges(T,M,D,S,A);for(let $=0;${Object.defineProperty(l,"__esModule",{value:!0}),l.CoreBrowserService=void 0;const h=u(844),p=u(8460),f=u(3656);class g extends h.Disposable{constructor(w,b,_){super(),this._textarea=w,this._window=b,this.mainDocument=_,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=new y(this._window),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._onWindowChange=this.register(new p.EventEmitter),this.onWindowChange=this._onWindowChange.event,this.register(this.onWindowChange((x=>this._screenDprMonitor.setWindow(x)))),this.register((0,p.forwardEvent)(this._screenDprMonitor.onDprChange,this._onDprChange)),this._textarea.addEventListener("focus",(()=>this._isFocused=!0)),this._textarea.addEventListener("blur",(()=>this._isFocused=!1))}get window(){return this._window}set window(w){this._window!==w&&(this._window=w,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask((()=>this._cachedIsFocused=void 0))),this._cachedIsFocused}}l.CoreBrowserService=g;class y extends h.Disposable{constructor(w){super(),this._parentWindow=w,this._windowResizeListener=this.register(new h.MutableDisposable),this._onDprChange=this.register(new p.EventEmitter),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this.register((0,h.toDisposable)((()=>this.clearListener())))}setWindow(w){this._parentWindow=w,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=(0,f.addDisposableDomListener)(this._parentWindow,"resize",(()=>this._setDprAndFireIfDiffers()))}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){var w;this._outerListener&&((w=this._resolutionMediaMatchList)==null||w.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}}},779:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.LinkProviderService=void 0;const h=u(844);class p extends h.Disposable{constructor(){super(),this.linkProviders=[],this.register((0,h.toDisposable)((()=>this.linkProviders.length=0)))}registerLinkProvider(g){return this.linkProviders.push(g),{dispose:()=>{const y=this.linkProviders.indexOf(g);y!==-1&&this.linkProviders.splice(y,1)}}}}l.LinkProviderService=p},8934:function(c,l,u){var h=this&&this.__decorate||function(C,w,b,_){var x,S=arguments.length,E=S<3?w:_===null?_=Object.getOwnPropertyDescriptor(w,b):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")E=Reflect.decorate(C,w,b,_);else for(var T=C.length-1;T>=0;T--)(x=C[T])&&(E=(S<3?x(E):S>3?x(w,b,E):x(w,b))||E);return S>3&&E&&Object.defineProperty(w,b,E),E},p=this&&this.__param||function(C,w){return function(b,_){w(b,_,C)}};Object.defineProperty(l,"__esModule",{value:!0}),l.MouseService=void 0;const f=u(4725),g=u(9806);let y=l.MouseService=class{constructor(C,w){this._renderService=C,this._charSizeService=w}getCoords(C,w,b,_,x){return(0,g.getCoords)(window,C,w,b,_,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,x)}getMouseReportCoords(C,w){const b=(0,g.getCoordsRelativeToElement)(window,C,w);if(this._charSizeService.hasValidSize)return b[0]=Math.min(Math.max(b[0],0),this._renderService.dimensions.css.canvas.width-1),b[1]=Math.min(Math.max(b[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(b[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(b[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(b[0]),y:Math.floor(b[1])}}};l.MouseService=y=h([p(0,f.IRenderService),p(1,f.ICharSizeService)],y)},3230:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.RenderService=void 0;const f=u(6193),g=u(4725),y=u(8460),C=u(844),w=u(7226),b=u(2585);let _=l.RenderService=class extends C.Disposable{get dimensions(){return this._renderer.value.dimensions}constructor(x,S,E,T,A,D,M,R){super(),this._rowCount=x,this._charSizeService=T,this._renderer=this.register(new C.MutableDisposable),this._pausedResizeTask=new w.DebouncedIdleTask,this._observerDisposable=this.register(new C.MutableDisposable),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this.register(new y.EventEmitter),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this.register(new y.EventEmitter),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this.register(new y.EventEmitter),this.onRender=this._onRender.event,this._onRefreshRequest=this.register(new y.EventEmitter),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new f.RenderDebouncer(((z,H)=>this._renderRows(z,H)),M),this.register(this._renderDebouncer),this.register(M.onDprChange((()=>this.handleDevicePixelRatioChange()))),this.register(D.onResize((()=>this._fullRefresh()))),this.register(D.buffers.onBufferActivate((()=>{var z;return(z=this._renderer.value)==null?void 0:z.clear()}))),this.register(E.onOptionChange((()=>this._handleOptionsChanged()))),this.register(this._charSizeService.onCharSizeChange((()=>this.handleCharSizeChanged()))),this.register(A.onDecorationRegistered((()=>this._fullRefresh()))),this.register(A.onDecorationRemoved((()=>this._fullRefresh()))),this.register(E.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],(()=>{this.clear(),this.handleResize(D.cols,D.rows),this._fullRefresh()}))),this.register(E.onMultipleOptionChange(["cursorBlink","cursorStyle"],(()=>this.refreshRows(D.buffer.y,D.buffer.y,!0)))),this.register(R.onChangeColors((()=>this._fullRefresh()))),this._registerIntersectionObserver(M.window,S),this.register(M.onWindowChange((z=>this._registerIntersectionObserver(z,S))))}_registerIntersectionObserver(x,S){if("IntersectionObserver"in x){const E=new x.IntersectionObserver((T=>this._handleIntersectionChange(T[T.length-1])),{threshold:0});E.observe(S),this._observerDisposable.value=(0,C.toDisposable)((()=>E.disconnect()))}}_handleIntersectionChange(x){this._isPaused=x.isIntersecting===void 0?x.intersectionRatio===0:!x.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(x,S,E=!1){this._isPaused?this._needsFullRefresh=!0:(E||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(x,S,this._rowCount))}_renderRows(x,S){this._renderer.value&&(x=Math.min(x,this._rowCount-1),S=Math.min(S,this._rowCount-1),this._renderer.value.renderRows(x,S),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:x,end:S}),this._onRender.fire({start:x,end:S}),this._isNextRenderRedrawOnly=!0)}resize(x,S){this._rowCount=S,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(x){this._renderer.value=x,this._renderer.value&&(this._renderer.value.onRequestRedraw((S=>this.refreshRows(S.start,S.end,!0))),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(x){return this._renderDebouncer.addRefreshCallback(x)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var x,S;this._renderer.value&&((S=(x=this._renderer.value).clearTextureAtlas)==null||S.call(x),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(x,S){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set((()=>{var E;return(E=this._renderer.value)==null?void 0:E.handleResize(x,S)})):this._renderer.value.handleResize(x,S),this._fullRefresh())}handleCharSizeChanged(){var x;(x=this._renderer.value)==null||x.handleCharSizeChanged()}handleBlur(){var x;(x=this._renderer.value)==null||x.handleBlur()}handleFocus(){var x;(x=this._renderer.value)==null||x.handleFocus()}handleSelectionChanged(x,S,E){var T;this._selectionState.start=x,this._selectionState.end=S,this._selectionState.columnSelectMode=E,(T=this._renderer.value)==null||T.handleSelectionChanged(x,S,E)}handleCursorMove(){var x;(x=this._renderer.value)==null||x.handleCursorMove()}clear(){var x;(x=this._renderer.value)==null||x.clear()}};l.RenderService=_=h([p(2,b.IOptionsService),p(3,g.ICharSizeService),p(4,b.IDecorationService),p(5,b.IBufferService),p(6,g.ICoreBrowserService),p(7,g.IThemeService)],_)},9312:function(c,l,u){var h=this&&this.__decorate||function(M,R,z,H){var $,U=arguments.length,q=U<3?R:H===null?H=Object.getOwnPropertyDescriptor(R,z):H;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")q=Reflect.decorate(M,R,z,H);else for(var K=M.length-1;K>=0;K--)($=M[K])&&(q=(U<3?$(q):U>3?$(R,z,q):$(R,z))||q);return U>3&&q&&Object.defineProperty(R,z,q),q},p=this&&this.__param||function(M,R){return function(z,H){R(z,H,M)}};Object.defineProperty(l,"__esModule",{value:!0}),l.SelectionService=void 0;const f=u(9806),g=u(9504),y=u(456),C=u(4725),w=u(8460),b=u(844),_=u(6114),x=u(4841),S=u(511),E=u(2585),T=" ",A=new RegExp(T,"g");let D=l.SelectionService=class extends b.Disposable{constructor(M,R,z,H,$,U,q,K,Y){super(),this._element=M,this._screenElement=R,this._linkifier=z,this._bufferService=H,this._coreService=$,this._mouseService=U,this._optionsService=q,this._renderService=K,this._coreBrowserService=Y,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new S.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new w.EventEmitter),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this.register(new w.EventEmitter),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this.register(new w.EventEmitter),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this.register(new w.EventEmitter),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=Q=>this._handleMouseMove(Q),this._mouseUpListener=Q=>this._handleMouseUp(Q),this._coreService.onUserInput((()=>{this.hasSelection&&this.clearSelection()})),this._trimListener=this._bufferService.buffer.lines.onTrim((Q=>this._handleTrim(Q))),this.register(this._bufferService.buffers.onBufferActivate((Q=>this._handleBufferActivate(Q)))),this.enable(),this._model=new y.SelectionModel(this._bufferService),this._activeSelectionMode=0,this.register((0,b.toDisposable)((()=>{this._removeMouseDownListeners()})))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const M=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;return!(!M||!R||M[0]===R[0]&&M[1]===R[1])}get selectionText(){const M=this._model.finalSelectionStart,R=this._model.finalSelectionEnd;if(!M||!R)return"";const z=this._bufferService.buffer,H=[];if(this._activeSelectionMode===3){if(M[0]===R[0])return"";const $=M[0]$.replace(A," "))).join(_.isWindows?`\r `:` -`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(M){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),b.isLinux&&M&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(M){const R=this._getMouseBufferCoords(M),z=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(z&&H&&R)&&this._areCoordsInSelection(R,z,H)}isCellInSelection(M,R){const z=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!z||!H)&&this._areCoordsInSelection([M,R],z,H)}_areCoordsInSelection(M,R,z){return M[1]>R[1]&&M[1]=R[0]&&M[0]=R[0]}_selectWordAtCursor(M,R){var q,$;const z=($=(q=this._linkifier.currentLink)==null?void 0:q.link)==null?void 0:$.range;if(z)return this._model.selectionStart=[z.start.x-1,z.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(M);return!!H&&(this._selectWordAt(H,R),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(M,R){this._model.clearSelection(),M=Math.max(M,0),R=Math.min(R,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,M],this._model.selectionEnd=[this._bufferService.cols,R],this.refresh(),this._onSelectionChange.fire()}_handleTrim(M){this._model.handleTrim(M)&&this.refresh()}_getMouseBufferCoords(M){const R=this._mouseService.getCoords(M,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(R)return R[0]--,R[1]--,R[1]+=this._bufferService.buffer.ydisp,R}_getMouseEventScrollAmount(M){let R=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,M,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return R>=0&&R<=z?0:(R>z&&(R-=z),R=Math.min(Math.max(R,-50),50),R/=50,R/Math.abs(R)+Math.round(14*R))}shouldForceSelection(M){return b.isMac?M.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:M.shiftKey}handleMouseDown(M){if(this._mouseDownTimeStamp=M.timeStamp,(M.button!==2||!this.hasSelection)&&M.button===0){if(!this._enabled){if(!this.shouldForceSelection(M))return;M.stopPropagation()}M.preventDefault(),this._dragScrollAmount=0,this._enabled&&M.shiftKey?this._handleIncrementalClick(M):M.detail===1?this._handleSingleClick(M):M.detail===2?this._handleDoubleClick(M):M.detail===3&&this._handleTripleClick(M),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(M){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(M))}_handleSingleClick(M){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(M)?3:0,this._model.selectionStart=this._getMouseBufferCoords(M),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const R=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);R&&R.length!==this._model.selectionStart[0]&&R.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(M){this._selectWordAtCursor(M,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(M){const R=this._getMouseBufferCoords(M);R&&(this._activeSelectionMode=2,this._selectLineAt(R[1]))}shouldColumnSelect(M){return M.altKey&&!(b.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(M){if(M.stopImmediatePropagation(),!this._model.selectionStart)return;const R=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(M),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(M.ydisp+this._bufferService.rows,M.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=M.ydisp),this.refresh()}}_handleMouseUp(M){const R=M.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&R<500&&M.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(M,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const H=(0,g.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const M=this._model.finalSelectionStart,R=this._model.finalSelectionEnd,z=!(!M||!R||M[0]===R[0]&&M[1]===R[1]);z?M&&R&&(this._oldSelectionStart&&this._oldSelectionEnd&&M[0]===this._oldSelectionStart[0]&&M[1]===this._oldSelectionStart[1]&&R[0]===this._oldSelectionEnd[0]&&R[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(M,R,z)):this._oldHasSelection&&this._fireOnSelectionChange(M,R,z)}_fireOnSelectionChange(M,R,z){this._oldSelectionStart=M,this._oldSelectionEnd=R,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(M){this.clearSelection(),this._trimListener.dispose(),this._trimListener=M.activeBuffer.lines.onTrim((R=>this._handleTrim(R)))}_convertViewportColToCharacterIndex(M,R){let z=R;for(let H=0;R>=H;H++){const q=M.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:q>1&&R!==H&&(z+=q-1)}return z}setSelection(M,R,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[M,R],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(M){this._isClickInSelection(M)||(this._selectWordAtCursor(M,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(M,R,z=!0,H=!0){if(M[0]>=this._bufferService.cols)return;const q=this._bufferService.buffer,$=q.lines.get(M[1]);if(!$)return;const U=q.translateBufferLineToString(M[1],!1);let K=this._convertViewportColToCharacterIndex($,M[0]),Y=K;const Q=M[0]-K;let ee=0,B=0,L=0,O=0;if(U.charAt(K)===" "){for(;K>0&&U.charAt(K-1)===" ";)K--;for(;Y1&&(O+=pe-1,Y+=pe-1);ie>0&&K>0&&!this._isCharWordSeparator($.loadCell(ie-1,this._workCell));){$.loadCell(ie-1,this._workCell);const te=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,ie--):te>1&&(L+=te-1,K-=te-1),K--,ie--}for(;fe<$.length&&Y+11&&(O+=te-1,Y+=te-1),Y++,fe++}}Y++;let W=K+Q-ee+L,G=Math.min(this._bufferService.cols,Y-K+ee+B-L-O);if(R||U.slice(K,Y).trim()!==""){if(z&&W===0&&$.getCodePoint(0)!==32){const ie=q.lines.get(M[1]-1);if(ie&&$.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const fe=this._getWordAt([this._bufferService.cols-1,M[1]-1],!1,!0,!1);if(fe){const pe=this._bufferService.cols-fe.start;W-=pe,G+=pe}}}if(H&&W+G===this._bufferService.cols&&$.getCodePoint(this._bufferService.cols-1)!==32){const ie=q.lines.get(M[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const fe=this._getWordAt([0,M[1]+1],!1,!1,!0);fe&&(G+=fe.length)}}return{start:W,length:G}}}_selectWordAt(M,R){const z=this._getWordAt(M,R);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,M[1]--;this._model.selectionStart=[z.start,M[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(M){const R=this._getWordAt(M,!0);if(R){let z=M[1];for(;R.start<0;)R.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;R.start+R.length>this._bufferService.cols;)R.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?R.start:R.start+R.length,z]}}_isCharWordSeparator(M){return M.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(M.getChars())>=0}_selectLineAt(M){const R=this._bufferService.buffer.getWrappedRangeForLine(M),z={start:{x:0,y:R.first},end:{x:this._bufferService.cols-1,y:R.last}};this._model.selectionStart=[0,R.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols)}};l.SelectionService=D=h([p(3,E.IBufferService),p(4,E.ICoreService),p(5,C.IMouseService),p(6,E.IOptionsService),p(7,C.IRenderService),p(8,C.ICoreBrowserService)],D)},4725:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const h=u(8343);l.ICharSizeService=(0,h.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),l.IMouseService=(0,h.createDecorator)("MouseService"),l.IRenderService=(0,h.createDecorator)("RenderService"),l.ISelectionService=(0,h.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,h.createDecorator)("ThemeService"),l.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(c,l,u){var h=this&&this.__decorate||function(D,M,R,z){var H,q=arguments.length,$=q<3?M:z===null?z=Object.getOwnPropertyDescriptor(M,R):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")$=Reflect.decorate(D,M,R,z);else for(var U=D.length-1;U>=0;U--)(H=D[U])&&($=(q<3?H($):q>3?H(M,R,$):H(M,R))||$);return q>3&&$&&Object.defineProperty(M,R,$),$},p=this&&this.__param||function(D,M){return function(R,z){M(R,z,D)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const f=u(7239),g=u(8055),y=u(8460),C=u(844),w=u(2585),_=g.css.toColor("#ffffff"),b=g.css.toColor("#000000"),x=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),E={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],M=[0,95,135,175,215,255];for(let R=0;R<216;R++){const z=M[R/36%6|0],H=M[R/6%6|0],q=M[R%6];D.push({css:g.channels.toCss(z,H,q),rgba:g.channels.toRgba(z,H,q)})}for(let R=0;R<24;R++){const z=8+10*R;D.push({css:g.channels.toCss(z,z,z),rgba:g.channels.toRgba(z,z,z)})}return D})());let T=l.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new f.ColorContrastCache,this._halfContrastCache=new f.ColorContrastCache,this._onChangeColors=this.register(new y.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:_,background:b,cursor:x,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:E,selectionBackgroundOpaque:g.color.blend(b,E),selectionInactiveBackgroundTransparent:E,selectionInactiveBackgroundOpaque:g.color.blend(b,E),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(D={}){const M=this._colors;if(M.foreground=A(D.foreground,_),M.background=A(D.background,b),M.cursor=A(D.cursor,x),M.cursorAccent=A(D.cursorAccent,S),M.selectionBackgroundTransparent=A(D.selectionBackground,E),M.selectionBackgroundOpaque=g.color.blend(M.background,M.selectionBackgroundTransparent),M.selectionInactiveBackgroundTransparent=A(D.selectionInactiveBackground,M.selectionBackgroundTransparent),M.selectionInactiveBackgroundOpaque=g.color.blend(M.background,M.selectionInactiveBackgroundTransparent),M.selectionForeground=D.selectionForeground?A(D.selectionForeground,g.NULL_COLOR):void 0,M.selectionForeground===g.NULL_COLOR&&(M.selectionForeground=void 0),g.color.isOpaque(M.selectionBackgroundTransparent)&&(M.selectionBackgroundTransparent=g.color.opacity(M.selectionBackgroundTransparent,.3)),g.color.isOpaque(M.selectionInactiveBackgroundTransparent)&&(M.selectionInactiveBackgroundTransparent=g.color.opacity(M.selectionInactiveBackgroundTransparent,.3)),M.ansi=l.DEFAULT_ANSI_COLORS.slice(),M.ansi[0]=A(D.black,l.DEFAULT_ANSI_COLORS[0]),M.ansi[1]=A(D.red,l.DEFAULT_ANSI_COLORS[1]),M.ansi[2]=A(D.green,l.DEFAULT_ANSI_COLORS[2]),M.ansi[3]=A(D.yellow,l.DEFAULT_ANSI_COLORS[3]),M.ansi[4]=A(D.blue,l.DEFAULT_ANSI_COLORS[4]),M.ansi[5]=A(D.magenta,l.DEFAULT_ANSI_COLORS[5]),M.ansi[6]=A(D.cyan,l.DEFAULT_ANSI_COLORS[6]),M.ansi[7]=A(D.white,l.DEFAULT_ANSI_COLORS[7]),M.ansi[8]=A(D.brightBlack,l.DEFAULT_ANSI_COLORS[8]),M.ansi[9]=A(D.brightRed,l.DEFAULT_ANSI_COLORS[9]),M.ansi[10]=A(D.brightGreen,l.DEFAULT_ANSI_COLORS[10]),M.ansi[11]=A(D.brightYellow,l.DEFAULT_ANSI_COLORS[11]),M.ansi[12]=A(D.brightBlue,l.DEFAULT_ANSI_COLORS[12]),M.ansi[13]=A(D.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),M.ansi[14]=A(D.brightCyan,l.DEFAULT_ANSI_COLORS[14]),M.ansi[15]=A(D.brightWhite,l.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const R=Math.min(M.ansi.length-16,D.extendedAnsi.length);for(let z=0;z{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const h=u(8460),p=u(844);class f extends p.Disposable{constructor(y){super(),this._maxLength=y,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(y){if(this._maxLength===y)return;const C=new Array(y);for(let w=0;wthis._length)for(let C=this._length;C=y;_--)this._array[this._getCyclicIndex(_+w.length)]=this._array[this._getCyclicIndex(_)];for(let _=0;_this._maxLength){const _=this._length+w.length-this._maxLength;this._startIndex+=_,this._length=this._maxLength,this.onTrimEmitter.fire(_)}else this._length+=w.length}trimStart(y){y>this._length&&(y=this._length),this._startIndex+=y,this._length-=y,this.onTrimEmitter.fire(y)}shiftElements(y,C,w){if(!(C<=0)){if(y<0||y>=this._length)throw new Error("start argument out of range");if(y+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let b=C-1;b>=0;b--)this.set(y+b+w,this.get(y+b));const _=y+C+w-this._length;if(_>0)for(this._length+=_;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let _=0;_{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function u(h,p=5){if(typeof h!="object")return h;const f=Array.isArray(h)?[]:{};for(const g in h)f[g]=p<=1?h[g]:h[g]&&u(h[g],p-1);return f}},8055:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let u=0,h=0,p=0,f=0;var g,y,C,w,_;function b(S){const E=S.toString(16);return E.length<2?"0"+E:E}function x(S,E){return S>>0},S.toColor=function(E,T,A,D){return{css:S.toCss(E,T,A,D),rgba:S.toRgba(E,T,A,D)}}})(g||(l.channels=g={})),(function(S){function E(T,A){return f=Math.round(255*A),[u,h,p]=_.toChannels(T.rgba),{css:g.toCss(u,h,p,f),rgba:g.toRgba(u,h,p,f)}}S.blend=function(T,A){if(f=(255&A.rgba)/255,f===1)return{css:A.css,rgba:A.rgba};const D=A.rgba>>24&255,M=A.rgba>>16&255,R=A.rgba>>8&255,z=T.rgba>>24&255,H=T.rgba>>16&255,q=T.rgba>>8&255;return u=z+Math.round((D-z)*f),h=H+Math.round((M-H)*f),p=q+Math.round((R-q)*f),{css:g.toCss(u,h,p),rgba:g.toRgba(u,h,p)}},S.isOpaque=function(T){return(255&T.rgba)==255},S.ensureContrastRatio=function(T,A,D){const M=_.ensureContrastRatio(T.rgba,A.rgba,D);if(M)return g.toColor(M>>24&255,M>>16&255,M>>8&255)},S.opaque=function(T){const A=(255|T.rgba)>>>0;return[u,h,p]=_.toChannels(A),{css:g.toCss(u,h,p),rgba:A}},S.opacity=E,S.multiplyOpacity=function(T,A){return f=255&T.rgba,E(T,f*A/255)},S.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(y||(l.color=y={})),(function(S){let E,T;try{const A=document.createElement("canvas");A.width=1,A.height=1;const D=A.getContext("2d",{willReadFrequently:!0});D&&(E=D,E.globalCompositeOperation="copy",T=E.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(A){if(A.match(/#[\da-f]{3,8}/i))switch(A.length){case 4:return u=parseInt(A.slice(1,2).repeat(2),16),h=parseInt(A.slice(2,3).repeat(2),16),p=parseInt(A.slice(3,4).repeat(2),16),g.toColor(u,h,p);case 5:return u=parseInt(A.slice(1,2).repeat(2),16),h=parseInt(A.slice(2,3).repeat(2),16),p=parseInt(A.slice(3,4).repeat(2),16),f=parseInt(A.slice(4,5).repeat(2),16),g.toColor(u,h,p,f);case 7:return{css:A,rgba:(parseInt(A.slice(1),16)<<8|255)>>>0};case 9:return{css:A,rgba:parseInt(A.slice(1),16)>>>0}}const D=A.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return u=parseInt(D[1]),h=parseInt(D[2]),p=parseInt(D[3]),f=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),g.toColor(u,h,p,f);if(!E||!T)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=T,E.fillStyle=A,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[u,h,p,f]=E.getImageData(0,0,1,1).data,f!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(u,h,p,f),css:A}}})(C||(l.css=C={})),(function(S){function E(T,A,D){const M=T/255,R=A/255,z=D/255;return .2126*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.7152*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(T){return E(T>>16&255,T>>8&255,255&T)},S.relativeLuminance2=E})(w||(l.rgb=w={})),(function(S){function E(A,D,M){const R=A>>24&255,z=A>>16&255,H=A>>8&255;let q=D>>24&255,$=D>>16&255,U=D>>8&255,K=x(w.relativeLuminance2(q,$,U),w.relativeLuminance2(R,z,H));for(;K0||$>0||U>0);)q-=Math.max(0,Math.ceil(.1*q)),$-=Math.max(0,Math.ceil(.1*$)),U-=Math.max(0,Math.ceil(.1*U)),K=x(w.relativeLuminance2(q,$,U),w.relativeLuminance2(R,z,H));return(q<<24|$<<16|U<<8|255)>>>0}function T(A,D,M){const R=A>>24&255,z=A>>16&255,H=A>>8&255;let q=D>>24&255,$=D>>16&255,U=D>>8&255,K=x(w.relativeLuminance2(q,$,U),w.relativeLuminance2(R,z,H));for(;K>>0}S.blend=function(A,D){if(f=(255&D)/255,f===1)return D;const M=D>>24&255,R=D>>16&255,z=D>>8&255,H=A>>24&255,q=A>>16&255,$=A>>8&255;return u=H+Math.round((M-H)*f),h=q+Math.round((R-q)*f),p=$+Math.round((z-$)*f),g.toRgba(u,h,p)},S.ensureContrastRatio=function(A,D,M){const R=w.relativeLuminance(A>>8),z=w.relativeLuminance(D>>8);if(x(R,z)>8));if(Ux(R,w.relativeLuminance(K>>8))?$:K}return $}const H=T(A,D,M),q=x(R,w.relativeLuminance(H>>8));if(qx(R,w.relativeLuminance($>>8))?H:$}return H}},S.reduceLuminance=E,S.increaseLuminance=T,S.toChannels=function(A){return[A>>24&255,A>>16&255,A>>8&255,255&A]}})(_||(l.rgba=_={})),l.toPaddedHex=b,l.contrastRatio=x},8969:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const h=u(844),p=u(2585),f=u(4348),g=u(7866),y=u(744),C=u(7302),w=u(6975),_=u(8460),b=u(1753),x=u(1480),S=u(7994),E=u(9282),T=u(5435),A=u(5981),D=u(2660);let M=!1;class R extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new _.EventEmitter),this._onScroll.event((H=>{var q;(q=this._onScrollApi)==null||q.fire(H.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(H){for(const q in H)this.optionsService.options[q]=H[q]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new _.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new _.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new _.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new _.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new _.EventEmitter),this._instantiationService=new f.InstantiationService,this.optionsService=this.register(new C.OptionsService(H)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(y.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(b.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,_.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,_.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,_.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,_.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll((q=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll((q=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new A.WriteBuffer(((q,$)=>this._inputHandler.parse(q,$)))),this.register((0,_.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,q){this._writeBuffer.write(H,q)}writeSync(H,q){this._logService.logLevel<=p.LogLevelEnum.WARN&&!M&&(this._logService.warn("writeSync is unreliable and will be removed soon."),M=!0),this._writeBuffer.writeSync(H,q)}input(H,q=!0){this.coreService.triggerDataEvent(H,q)}resize(H,q){isNaN(H)||isNaN(q)||(H=Math.max(H,y.MINIMUM_COLS),q=Math.max(q,y.MINIMUM_ROWS),this._bufferService.resize(H,q))}scroll(H,q=!1){this._bufferService.scroll(H,q)}scrollLines(H,q,$){this._bufferService.scrollLines(H,q,$)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const q=H-this._bufferService.buffer.ydisp;q!==0&&this.scrollLines(q)}registerEscHandler(H,q){return this._inputHandler.registerEscHandler(H,q)}registerDcsHandler(H,q){return this._inputHandler.registerDcsHandler(H,q)}registerCsiHandler(H,q){return this._inputHandler.registerCsiHandler(H,q)}registerOscHandler(H,q){return this._inputHandler.registerOscHandler(H,q)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const q=this.optionsService.rawOptions.windowsPty;q&&q.buildNumber!==void 0&&q.buildNumber!==void 0?H=q.backend==="conpty"&&q.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,E.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const q of H)q.dispose()}))}}}l.CoreTerminal=R},8460:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let h=0;hh.fire(p)))},l.runAndSubscribe=function(u,h){return h(void 0),u((p=>h(p)))}},5435:function(c,l,u){var h=this&&this.__decorate||function(ee,B,L,O){var W,G=arguments.length,ie=G<3?B:O===null?O=Object.getOwnPropertyDescriptor(B,L):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(ee,B,L,O);else for(var fe=ee.length-1;fe>=0;fe--)(W=ee[fe])&&(ie=(G<3?W(ie):G>3?W(B,L,ie):W(B,L))||ie);return G>3&&ie&&Object.defineProperty(B,L,ie),ie},p=this&&this.__param||function(ee,B){return function(L,O){B(L,O,ee)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const f=u(2584),g=u(7116),y=u(2015),C=u(844),w=u(482),_=u(8437),b=u(8460),x=u(643),S=u(511),E=u(3734),T=u(2585),A=u(1480),D=u(6242),M=u(6351),R=u(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function q(ee,B){if(ee>24)return B.setWinLines||!1;switch(ee){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}var $;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})($||(l.WindowsOptionsReportType=$={}));let U=0;class K extends C.Disposable{getAttrData(){return this._curAttrData}constructor(B,L,O,W,G,ie,fe,pe,te=new y.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=L,this._coreService=O,this._logService=W,this._optionsService=G,this._oscLinkService=ie,this._coreMouseService=fe,this._unicodeService=pe,this._parser=te,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new b.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new b.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new b.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new b.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new b.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new b.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new b.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new b.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new b.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new b.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new b.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new b.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new Y(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:ae.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,ae,oe)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:ae,data:oe})})),this._parser.setDcsHandlerFallback(((V,ae,oe)=>{ae==="HOOK"&&(oe=oe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:ae,payload:oe})})),this._parser.setPrintHandler(((V,ae,oe)=>this.print(V,ae,oe))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!1))),this._parser.setExecuteHandler(f.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(f.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(f.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(f.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(f.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(f.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(f.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(f.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(f.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new D.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new D.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new D.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new D.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new D.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new D.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new D.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new D.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new D.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new D.OscHandler((V=>this.restoreCursorColor(V)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const V in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new M.DcsHandler(((V,ae)=>this.requestStatusString(V,ae))))}_preserveStack(B,L,O,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=O,this._parseStack.position=W}_logSlowResolvingAsync(B){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([B,new Promise(((L,O)=>setTimeout((()=>O("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(B,L){let O,W=this._activeBuffer.x,G=this._activeBuffer.y,ie=0;const fe=this._parseStack.paused;if(fe){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(O),O;W=this._parseStack.cursorStartX,G=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>H&&(ie=this._parseStack.position+H)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(V=>String.fromCharCode(V))).join("")}"`),typeof B=="string"?B.split("").map((V=>V.charCodeAt(0))):B),this._parseBuffer.lengthH)for(let V=ie;V0&&oe.getWidth(this._activeBuffer.x-1)===2&&oe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let be=this._parser.precedingJoinState;for(let he=L;hepe){if(te){const He=oe;let ze=this._activeBuffer.x-Re;for(this._activeBuffer.x=Re,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Re>0&&oe instanceof _.BufferLine&&oe.copyCellsFrom(He,ze,0,Re,!1);ze=0;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(V&&(oe.insertCells(this._activeBuffer.x,G-Re,this._activeBuffer.getNullCell(ae)),oe.getWidth(pe-1)===2&&oe.setCellFromCodepoint(pe-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ae)),oe.setCellFromCodepoint(this._activeBuffer.x++,W,G,ae),G>0)for(;--G;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=be,this._activeBuffer.x0&&oe.getWidth(this._activeBuffer.x)===0&&!oe.hasContent(this._activeBuffer.x)&&oe.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,L){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,L):this._parser.registerCsiHandler(B,(O=>!q(O.params[0],this._optionsService.rawOptions.windowOptions)||L(O)))}registerDcsHandler(B,L){return this._parser.registerDcsHandler(B,new M.DcsHandler(L))}registerEscHandler(B,L){return this._parser.registerEscHandler(B,L)}registerOscHandler(B,L){return this._parser.registerOscHandler(B,new D.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var B;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&B.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(B,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=B,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+L)}cursorUp(B){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const L=B.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=B.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=B.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const L=B.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,L,O,W=!1,G=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);ie.replaceCells(L,O,this._activeBuffer.getNullCell(this._eraseAttrData()),G),W&&(ie.isWrapped=!1)}_resetBufferLine(B,L=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),O.isWrapped=!1)}eraseInDisplay(B,L=!1){let O;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);O=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,L);this._dirtyRowTracker.markDirty(0);break;case 3:const W=this._activeBuffer.lines.length-this._bufferService.rows;W>0&&(this._activeBuffer.lines.trimStart(W),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-W,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-W,0),this._onScroll.fire(0))}return!0}eraseInLine(B,L=!1){switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(B){this._restrictCursor();let L=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let te=pe;for(let V=1;V0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(B){return B.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let L=0;LTe?1:2,be=B.params[0];return he=be,Se=L?be===2?4:be===4?oe(ie.modes.insertMode):be===12?3:be===20?oe(ae.convertEol):0:be===1?oe(O.applicationCursorKeys):be===3?ae.windowOptions.setWinLines?pe===80?2:pe===132?1:0:0:be===6?oe(O.origin):be===7?oe(O.wraparound):be===8?3:be===9?oe(W==="X10"):be===12?oe(ae.cursorBlink):be===25?oe(!ie.isCursorHidden):be===45?oe(O.reverseWraparound):be===66?oe(O.applicationKeypad):be===67?4:be===1e3?oe(W==="VT200"):be===1002?oe(W==="DRAG"):be===1003?oe(W==="ANY"):be===1004?oe(O.sendFocus):be===1005?4:be===1006?oe(G==="SGR"):be===1015?4:be===1016?oe(G==="SGR_PIXELS"):be===1048?1:be===47||be===1047||be===1049?oe(te===V):be===2004?oe(O.bracketedPasteMode):0,ie.triggerDataEvent(`${f.C0.ESC}[${L?"":"?"}${he};${Se}$y`),!0;var he,Se}_updateAttrColor(B,L,O,W,G){return L===2?(B|=50331648,B&=-16777216,B|=E.AttributeData.fromColorRGB([O,W,G])):L===5&&(B&=-50331904,B|=33554432|255&O),B}_extractColor(B,L,O){const W=[0,0,-1,0,0,0];let G=0,ie=0;do{if(W[ie+G]=B.params[L+ie],B.hasSubParams(L+ie)){const fe=B.getSubParams(L+ie);let pe=0;do W[1]===5&&(G=1),W[ie+pe+1+G]=fe[pe];while(++pe=2||W[1]===2&&ie+G>=5)break;W[1]&&(G=1)}while(++ie+L5)&&(B=1),L.extended.underlineStyle=B,L.fg|=268435456,B===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(B){B.fg=_.DEFAULT_ATTR_DATA.fg,B.bg=_.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=B.length;let O;const W=this._curAttrData;for(let G=0;G=30&&O<=37?(W.fg&=-50331904,W.fg|=16777216|O-30):O>=40&&O<=47?(W.bg&=-50331904,W.bg|=16777216|O-40):O>=90&&O<=97?(W.fg&=-50331904,W.fg|=16777224|O-90):O>=100&&O<=107?(W.bg&=-50331904,W.bg|=16777224|O-100):O===0?this._processSGR0(W):O===1?W.fg|=134217728:O===3?W.bg|=67108864:O===4?(W.fg|=268435456,this._processUnderline(B.hasSubParams(G)?B.getSubParams(G)[0]:1,W)):O===5?W.fg|=536870912:O===7?W.fg|=67108864:O===8?W.fg|=1073741824:O===9?W.fg|=2147483648:O===2?W.bg|=134217728:O===21?this._processUnderline(2,W):O===22?(W.fg&=-134217729,W.bg&=-134217729):O===23?W.bg&=-67108865:O===24?(W.fg&=-268435457,this._processUnderline(0,W)):O===25?W.fg&=-536870913:O===27?W.fg&=-67108865:O===28?W.fg&=-1073741825:O===29?W.fg&=2147483647:O===39?(W.fg&=-67108864,W.fg|=16777215&_.DEFAULT_ATTR_DATA.fg):O===49?(W.bg&=-67108864,W.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?G+=this._extractColor(B,G,W):O===53?W.bg|=1073741824:O===55?W.bg&=-1073741825:O===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):O===100?(W.fg&=-67108864,W.fg|=16777215&_.DEFAULT_ATTR_DATA.fg,W.bg&=-67108864,W.bg|=16777215&_.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",O);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${L};${O}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const L=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${L};${O}R`)}return!0}softReset(B){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(B){const L=B.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const O=L%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(B){const L=B.params[0]||1;let O;return(B.length<2||(O=B.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(B){if(!q(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=B.length>1?B.params[1]:0;switch(B.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire($.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire($.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${f.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(B){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(B){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const L=[],O=B.split(";");for(;O.length>1;){const W=O.shift(),G=O.shift();if(/^\d+$/.exec(W)){const ie=parseInt(W);if(Q(ie))if(G==="?")L.push({type:0,index:ie});else{const fe=(0,R.parseColor)(G);fe&&L.push({type:1,index:ie,color:fe})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(B){const L=B.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(B,L){this._getCurrentLinkId()&&this._finishHyperlink();const O=B.split(":");let W;const G=O.findIndex((ie=>ie.startsWith("id=")));return G!==-1&&(W=O[G].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:W,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(B,L){const O=B.split(";");for(let W=0;W=this._specialColors.length);++W,++L)if(O[W]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const G=(0,R.parseColor)(O[W]);G&&this._onColor.fire([{type:1,index:this._specialColors[L],color:G}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const L=[],O=B.split(";");for(let W=0;W=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=_.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=_.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new S.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${f.C0.ESC}${G}${f.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[W.cursorStyle]-(W.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,L){this._dirtyRowTracker.markRangeDirty(B,L)}}l.InputHandler=K;let Y=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){eethis.end&&(this.end=ee)}markRangeDirty(ee,B){ee>B&&(U=ee,ee=B,B=U),eethis.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(ee){return 0<=ee&&ee<256}Y=h([p(0,T.IBufferService)],Y)},844:(c,l)=>{function u(h){for(const p of h)p.dispose();h.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const p=this._disposables.indexOf(h);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var p;this._isDisposed||h===this._value||((p=this._value)==null||p.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},l.toDisposable=function(h){return{dispose:h}},l.disposeArray=u,l.getDisposeArrayDisposable=function(h){return{dispose:()=>u(h)}}},1505:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(p,f,g){this._data[p]||(this._data[p]={}),this._data[p][f]=g}get(p,f){return this._data[p]?this._data[p][f]:void 0}clear(){this._data={}}}l.TwoKeyMap=u,l.FourKeyMap=class{constructor(){this._data=new u}set(h,p,f,g,y){this._data.get(h,p)||this._data.set(h,p,new u),this._data.get(h,p).set(f,g,y)}get(h,p,f,g){var y;return(y=this._data.get(h,p))==null?void 0:y.get(f,g)}clear(){this._data.clear()}}},6114:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const u=l.isNode?"node":navigator.userAgent,h=l.isNode?"node":navigator.platform;l.isFirefox=u.includes("Firefox"),l.isLegacyEdge=u.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(u),l.getSafariVersion=function(){if(!l.isSafari)return 0;const p=u.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),l.isIpad=h==="iPad",l.isIphone=h==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),l.isLinux=h.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(u)},6106:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let u=0;l.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(u=this._search(this._getKey(h)),this._array.splice(u,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const p=this._getKey(h);if(p===void 0||(u=this._search(p),u===-1)||this._getKey(this._array[u])!==p)return!1;do if(this._array[u]===h)return this._array.splice(u,1),!0;while(++u=this._array.length)&&this._getKey(this._array[u])===h))do yield this._array[u];while(++u=this._array.length)&&this._getKey(this._array[u])===h))do p(this._array[u]);while(++u=p;){let g=p+f>>1;const y=this._getKey(this._array[g]);if(y>h)f=g-1;else{if(!(y0&&this._getKey(this._array[g-1])===h;)g--;return g}p=g+1}}return p}}},7226:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const h=u(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(y){this._tasks.push(y),this._start()}flush(){for(;this._ib)return _-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(_-C))}ms`),void this._start();_=b}this.clear()}}class f extends p{_requestCallback(y){return setTimeout((()=>y(this._createDeadline(16))))}_cancelCallback(y){clearTimeout(y)}_createDeadline(y){const C=Date.now()+y;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}l.PriorityTaskQueue=f,l.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:f,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const h=u(643);l.updateWindowsModeWrappedState=function(p){const f=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),g=f==null?void 0:f.get(p.cols-1),y=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);y&&g&&(y.isWrapped=g[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&g[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(f){return[f>>>16&255,f>>>8&255,255&f]}static fromColorRGB(f){return(255&f[0])<<16|(255&f[1])<<8|255&f[2]}clone(){const f=new u;return f.fg=this.fg,f.bg=this.bg,f.extended=this.extended.clone(),f}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=u;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(f){this._ext=f}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(f){this._ext&=-469762049,this._ext|=f<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(f){this._ext&=-67108864,this._ext|=67108863&f}get urlId(){return this._urlId}set urlId(f){this._urlId=f}get underlineVariantOffset(){const f=(3758096384&this._ext)>>29;return f<0?4294967288^f:f}set underlineVariantOffset(f){this._ext&=536870911,this._ext|=f<<29&3758096384}constructor(f=0,g=0){this._ext=0,this._urlId=0,this._ext=f,this._urlId=g}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=h},9092:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const h=u(6349),p=u(7226),f=u(3734),g=u(8437),y=u(4634),C=u(511),w=u(643),_=u(4863),b=u(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,S,E){this._hasScrollback=x,this._optionsService=S,this._bufferService=E,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=b.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new f.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new f.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,S){return new g.BufferLine(this._bufferService.cols,this.getNullCell(x),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xl.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=g.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,S){const E=this.getNullCell(g.DEFAULT_ATTR_DATA);let T=0;const A=this._getCorrectBufferLength(S);if(A>this.lines.maxLength&&(this.lines.maxLength=A),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(x,E)));else for(let M=this._rows;M>S;M--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(A0&&(this.lines.trimStart(M),this.ybase=Math.max(this.ybase-M,0),this.ydisp=Math.max(this.ydisp-M,0),this.savedY=Math.max(this.savedY-M,0)),this.lines.maxLength=A}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(x,S),this._cols>x))for(let D=0;D.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let S=0;for(;this._memoryCleanupPosition100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,S){this._cols!==x&&(x>this._cols?this._reflowLarger(x,S):this._reflowSmaller(x,S))}_reflowLarger(x,S){const E=(0,y.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(E.length>0){const T=(0,y.reflowLargerCreateNewLayout)(this.lines,E);(0,y.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(x,S,T.countRemoved)}}_reflowLargerAdjustViewport(x,S,E){const T=this.getNullCell(g.DEFAULT_ATTR_DATA);let A=E;for(;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;D--){let M=this.lines.get(D);if(!M||!M.isWrapped&&M.getTrimmedLength()<=x)continue;const R=[M];for(;M.isWrapped&&D>0;)M=this.lines.get(--D),R.unshift(M);const z=this.ybase+this.y;if(z>=D&&z0&&(T.push({start:D+R.length+A,newLines:K}),A+=K.length),R.push(...K);let Y=q.length-1,Q=q[Y];Q===0&&(Y--,Q=q[Y]);let ee=R.length-$-1,B=H;for(;ee>=0;){const O=Math.min(B,Q);if(R[Y]===void 0)break;if(R[Y].copyCellsFrom(R[ee],B-O,Q-O,O,!0),Q-=O,Q===0&&(Y--,Q=q[Y]),B-=O,B===0){ee--;const W=Math.max(ee,0);B=(0,y.getWrappedLineTrimmedLength)(R,W,this._cols)}}for(let O=0;O0;)this.ybase===0?this.y0){const D=[],M=[];for(let Y=0;Y=0;Y--)if(q&&q.start>z+$){for(let Q=q.newLines.length-1;Q>=0;Q--)this.lines.set(Y--,q.newLines[Q]);Y++,D.push({index:z+1,amount:q.newLines.length}),$+=q.newLines.length,q=T[++H]}else this.lines.set(Y,M[z--]);let U=0;for(let Y=D.length-1;Y>=0;Y--)D[Y].index+=U,this.lines.onInsertEmitter.fire(D[Y]),U+=D[Y].amount;const K=Math.max(0,R+A-this.lines.maxLength);K>0&&this.lines.onTrimEmitter.fire(K)}}translateBufferLineToString(x,S,E=0,T){const A=this.lines.get(x);return A?A.translateToString(S,E,T):""}getWrappedRangeForLine(x){let S=x,E=x;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;E+10;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let S=0;S{S.line-=E,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((E=>{S.line>=E.index&&(S.line+=E.amount)}))),S.register(this.lines.onDelete((E=>{S.line>=E.index&&S.lineE.index&&(S.line-=E.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const h=u(3734),p=u(511),f=u(643),g=u(482);l.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let y=0;class C{constructor(_,b,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*_);const S=b||p.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]);for(let E=0;E<_;++E)this.setCell(E,S);this.length=_}get(_){const b=this._data[3*_+0],x=2097151&b;return[this._data[3*_+1],2097152&b?this._combined[_]:x?(0,g.stringFromCodePoint)(x):"",b>>22,2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):x]}set(_,b){this._data[3*_+1]=b[f.CHAR_DATA_ATTR_INDEX],b[f.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[_]=b[1],this._data[3*_+0]=2097152|_|b[f.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*_+0]=b[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|b[f.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(_){return this._data[3*_+0]>>22}hasWidth(_){return 12582912&this._data[3*_+0]}getFg(_){return this._data[3*_+1]}getBg(_){return this._data[3*_+2]}hasContent(_){return 4194303&this._data[3*_+0]}getCodePoint(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_].charCodeAt(this._combined[_].length-1):2097151&b}isCombined(_){return 2097152&this._data[3*_+0]}getString(_){const b=this._data[3*_+0];return 2097152&b?this._combined[_]:2097151&b?(0,g.stringFromCodePoint)(2097151&b):""}isProtected(_){return 536870912&this._data[3*_+2]}loadCell(_,b){return y=3*_,b.content=this._data[y+0],b.fg=this._data[y+1],b.bg=this._data[y+2],2097152&b.content&&(b.combinedData=this._combined[_]),268435456&b.bg&&(b.extended=this._extendedAttrs[_]),b}setCell(_,b){2097152&b.content&&(this._combined[_]=b.combinedData),268435456&b.bg&&(this._extendedAttrs[_]=b.extended),this._data[3*_+0]=b.content,this._data[3*_+1]=b.fg,this._data[3*_+2]=b.bg}setCellFromCodepoint(_,b,x,S){268435456&S.bg&&(this._extendedAttrs[_]=S.extended),this._data[3*_+0]=b|x<<22,this._data[3*_+1]=S.fg,this._data[3*_+2]=S.bg}addCodepointToCell(_,b,x){let S=this._data[3*_+0];2097152&S?this._combined[_]+=(0,g.stringFromCodePoint)(b):2097151&S?(this._combined[_]=(0,g.stringFromCodePoint)(2097151&S)+(0,g.stringFromCodePoint)(b),S&=-2097152,S|=2097152):S=b|4194304,x&&(S&=-12582913,S|=x<<22),this._data[3*_+0]=S}insertCells(_,b,x){if((_%=this.length)&&this.getWidth(_-1)===2&&this.setCellFromCodepoint(_-1,0,1,x),b=0;--E)this.setCell(_+b+E,this.loadCell(_+E,S));for(let E=0;Ethis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const S=new Uint32Array(x);S.set(this._data),this._data=S}for(let S=this.length;S<_;++S)this.setCell(S,b)}else{this._data=this._data.subarray(0,x);const S=Object.keys(this._combined);for(let T=0;T=_&&delete this._combined[A]}const E=Object.keys(this._extendedAttrs);for(let T=0;T=_&&delete this._extendedAttrs[A]}}return this.length=_,4*x*2=0;--_)if(4194303&this._data[3*_+0])return _+(this._data[3*_+0]>>22);return 0}getNoBgTrimmedLength(){for(let _=this.length-1;_>=0;--_)if(4194303&this._data[3*_+0]||50331648&this._data[3*_+2])return _+(this._data[3*_+0]>>22);return 0}copyCellsFrom(_,b,x,S,E){const T=_._data;if(E)for(let D=S-1;D>=0;D--){for(let M=0;M<3;M++)this._data[3*(x+D)+M]=T[3*(b+D)+M];268435456&T[3*(b+D)+2]&&(this._extendedAttrs[x+D]=_._extendedAttrs[b+D])}else for(let D=0;D=b&&(this._combined[M-b+x]=_._combined[M])}}translateToString(_,b,x,S){b=b??0,x=x??this.length,_&&(x=Math.min(x,this.getTrimmedLength())),S&&(S.length=0);let E="";for(;b>22||1}return S&&S.push(b),E}}l.BufferLine=C},4841:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(u,h){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return h*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(c,l)=>{function u(h,p,f){if(p===h.length-1)return h[p].getTrimmedLength();const g=!h[p].hasContent(f-1)&&h[p].getWidth(f-1)===1,y=h[p+1].getWidth(0)===2;return g&&y?f-1:f}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(h,p,f,g,y){const C=[];for(let w=0;w=w&&g<_){w+=x.length-1;continue}let S=0,E=u(x,S,p),T=1,A=0;for(;T0&&(M>S||x[M].getTrimmedLength()===0);M--)D++;D>0&&(C.push(w+x.length-D),C.push(D)),w+=x.length-1}return C},l.reflowLargerCreateNewLayout=function(h,p){const f=[];let g=0,y=p[g],C=0;for(let w=0;wu(h,x,p))).reduce(((b,x)=>b+x));let C=0,w=0,_=0;for(;_b&&(C-=b,w++);const x=h[w].getWidth(C-1)===2;x&&C--;const S=x?f-1:f;g.push(S),_+=S}return g},l.getWrappedLineTrimmedLength=u},5295:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const h=u(8460),p=u(844),f=u(9092);class g extends p.Disposable{constructor(C,w){super(),this._optionsService=C,this._bufferService=w,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new f.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new f.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(C,w){this._normal.resize(C,w),this._alt.resize(C,w),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}l.BufferSet=g},511:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const h=u(482),p=u(643),f=u(3734);class g extends f.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new f.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const w=new g;return w.setFromCharData(C),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(C[p.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(C[p.CHAR_DATA_CHAR_INDEX].length===2){const _=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=_&&_<=56319){const b=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=b&&b<=57343?this.content=1024*(_-55296)+b-56320+65536|C[p.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[p.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=C[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=g},643:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const h=u(8460),p=u(844);class f{get id(){return this._id}constructor(y){this.line=y,this.isDisposed=!1,this._disposables=[],this._id=f._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(y){return this._disposables.push(y),y}}l.Marker=f,f._nextId=1},7116:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,l)=>{var u,h,p;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(f){f.NUL="\0",f.SOH="",f.STX="",f.ETX="",f.EOT="",f.ENQ="",f.ACK="",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=` -`,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(u||(l.C0=u={})),(function(f){f.PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ"})(h||(l.C1=h={})),(function(f){f.ST=`${u.ESC}\\`})(p||(l.C1_ESCAPED=p={}))},7399:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const h=u(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(f,g,y,C){const w={type:0,cancel:!1,key:void 0},_=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?w.key=g?h.C0.ESC+"OA":h.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?w.key=g?h.C0.ESC+"OD":h.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?w.key=g?h.C0.ESC+"OC":h.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(w.key=g?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:w.key=f.ctrlKey?"\b":h.C0.DEL,f.altKey&&(w.key=h.C0.ESC+w.key);break;case 9:if(f.shiftKey){w.key=h.C0.ESC+"[Z";break}w.key=h.C0.HT,w.cancel=!0;break;case 13:w.key=f.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,w.cancel=!0;break;case 27:w.key=h.C0.ESC,f.altKey&&(w.key=h.C0.ESC+h.C0.ESC),w.cancel=!0;break;case 37:if(f.metaKey)break;_?(w.key=h.C0.ESC+"[1;"+(_+1)+"D",w.key===h.C0.ESC+"[1;3D"&&(w.key=h.C0.ESC+(y?"b":"[1;5D"))):w.key=g?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(f.metaKey)break;_?(w.key=h.C0.ESC+"[1;"+(_+1)+"C",w.key===h.C0.ESC+"[1;3C"&&(w.key=h.C0.ESC+(y?"f":"[1;5C"))):w.key=g?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(f.metaKey)break;_?(w.key=h.C0.ESC+"[1;"+(_+1)+"A",y||w.key!==h.C0.ESC+"[1;3A"||(w.key=h.C0.ESC+"[1;5A")):w.key=g?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(f.metaKey)break;_?(w.key=h.C0.ESC+"[1;"+(_+1)+"B",y||w.key!==h.C0.ESC+"[1;3B"||(w.key=h.C0.ESC+"[1;5B")):w.key=g?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(w.key=h.C0.ESC+"[2~");break;case 46:w.key=_?h.C0.ESC+"[3;"+(_+1)+"~":h.C0.ESC+"[3~";break;case 36:w.key=_?h.C0.ESC+"[1;"+(_+1)+"H":g?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:w.key=_?h.C0.ESC+"[1;"+(_+1)+"F":g?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:f.shiftKey?w.type=2:f.ctrlKey?w.key=h.C0.ESC+"[5;"+(_+1)+"~":w.key=h.C0.ESC+"[5~";break;case 34:f.shiftKey?w.type=3:f.ctrlKey?w.key=h.C0.ESC+"[6;"+(_+1)+"~":w.key=h.C0.ESC+"[6~";break;case 112:w.key=_?h.C0.ESC+"[1;"+(_+1)+"P":h.C0.ESC+"OP";break;case 113:w.key=_?h.C0.ESC+"[1;"+(_+1)+"Q":h.C0.ESC+"OQ";break;case 114:w.key=_?h.C0.ESC+"[1;"+(_+1)+"R":h.C0.ESC+"OR";break;case 115:w.key=_?h.C0.ESC+"[1;"+(_+1)+"S":h.C0.ESC+"OS";break;case 116:w.key=_?h.C0.ESC+"[15;"+(_+1)+"~":h.C0.ESC+"[15~";break;case 117:w.key=_?h.C0.ESC+"[17;"+(_+1)+"~":h.C0.ESC+"[17~";break;case 118:w.key=_?h.C0.ESC+"[18;"+(_+1)+"~":h.C0.ESC+"[18~";break;case 119:w.key=_?h.C0.ESC+"[19;"+(_+1)+"~":h.C0.ESC+"[19~";break;case 120:w.key=_?h.C0.ESC+"[20;"+(_+1)+"~":h.C0.ESC+"[20~";break;case 121:w.key=_?h.C0.ESC+"[21;"+(_+1)+"~":h.C0.ESC+"[21~";break;case 122:w.key=_?h.C0.ESC+"[23;"+(_+1)+"~":h.C0.ESC+"[23~";break;case 123:w.key=_?h.C0.ESC+"[24;"+(_+1)+"~":h.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(y&&!C||!f.altKey||f.metaKey)!y||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?w.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(w.key=h.C0.US),f.key==="@"&&(w.key=h.C0.NUL)):f.keyCode===65&&(w.type=1);else{const b=p[f.keyCode],x=b==null?void 0:b[f.shiftKey?1:0];if(x)w.key=h.C0.ESC+x;else if(f.keyCode>=65&&f.keyCode<=90){const S=f.ctrlKey?f.keyCode-64:f.keyCode+32;let E=String.fromCharCode(S);f.shiftKey&&(E=E.toUpperCase()),w.key=h.C0.ESC+E}else if(f.keyCode===32)w.key=h.C0.ESC+(f.ctrlKey?h.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let S=f.code.slice(3,4);f.shiftKey||(S=S.toLowerCase()),w.key=h.C0.ESC+S,w.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?w.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?w.key=h.C0.NUL:f.keyCode>=51&&f.keyCode<=55?w.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?w.key=h.C0.DEL:f.keyCode===219?w.key=h.C0.ESC:f.keyCode===220?w.key=h.C0.FS:f.keyCode===221&&(w.key=h.C0.GS)}return w}},482:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},l.utf32ToString=function(u,h=0,p=u.length){let f="";for(let g=h;g65535?(y-=65536,f+=String.fromCharCode(55296+(y>>10))+String.fromCharCode(y%1024+56320)):f+=String.fromCharCode(y)}return f},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,h){const p=u.length;if(!p)return 0;let f=0,g=0;if(this._interim){const y=u.charCodeAt(g++);56320<=y&&y<=57343?h[f++]=1024*(this._interim-55296)+y-56320+65536:(h[f++]=this._interim,h[f++]=y),this._interim=0}for(let y=g;y=p)return this._interim=C,f;const w=u.charCodeAt(y);56320<=w&&w<=57343?h[f++]=1024*(C-55296)+w-56320+65536:(h[f++]=C,h[f++]=w)}else C!==65279&&(h[f++]=C)}return f}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,h){const p=u.length;if(!p)return 0;let f,g,y,C,w=0,_=0,b=0;if(this.interim[0]){let E=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let A,D=0;for(;(A=63&this.interim[++D])&&D<4;)T<<=6,T|=A;const M=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=M-D;for(;b=p)return 0;if(A=u[b++],(192&A)!=128){b--,E=!0;break}this.interim[D++]=A,T<<=6,T|=63&A}E||(M===2?T<128?b--:h[w++]=T:M===3?T<2048||T>=55296&&T<=57343||T===65279||(h[w++]=T):T<65536||T>1114111||(h[w++]=T)),this.interim.fill(0)}const x=p-4;let S=b;for(;S=p)return this.interim[0]=f,w;if(g=u[S++],(192&g)!=128){S--;continue}if(_=(31&f)<<6|63&g,_<128){S--;continue}h[w++]=_}else if((240&f)==224){if(S>=p)return this.interim[0]=f,w;if(g=u[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=g,w;if(y=u[S++],(192&y)!=128){S--;continue}if(_=(15&f)<<12|(63&g)<<6|63&y,_<2048||_>=55296&&_<=57343||_===65279)continue;h[w++]=_}else if((248&f)==240){if(S>=p)return this.interim[0]=f,w;if(g=u[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=g,w;if(y=u[S++],(192&y)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=g,this.interim[2]=y,w;if(C=u[S++],(192&C)!=128){S--;continue}if(_=(7&f)<<18|(63&g)<<12|(63&y)<<6|63&C,_<65536||_>1114111)continue;h[w++]=_}}return w}}},225:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const h=u(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],f=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let g;l.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let y=0;yw[x][1])return!1;for(;x>=b;)if(_=b+x>>1,C>w[_][1])b=_+1;else{if(!(C=131072&&y<=196605||y>=196608&&y<=262141?2:1}charProperties(y,C){let w=this.wcwidth(y),_=w===0&&C!==0;if(_){const b=h.UnicodeService.extractWidth(C);b===0?_=!1:b>w&&(w=b)}return h.UnicodeService.createPropertyValue(0,w,_)}}},5981:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const h=u(8460),p=u(844);class f extends p.Disposable{constructor(y){super(),this._action=y,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(y,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const _=this._callbacks.shift();_&&_()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(y,C){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(C),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(C)}_innerWrite(y=0,C=!0){const w=y||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const _=this._writeBuffer[this._bufferOffset],b=this._action(_,C);if(b){const S=E=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,E))):this._innerWrite(w,E);return void b.catch((E=>(queueMicrotask((()=>{throw E})),Promise.resolve(!1)))).then(S)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=_.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=f},5941:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const u=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function p(f,g){const y=f.toString(16),C=y.length<2?"0"+y:y;switch(g){case 4:return y[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}l.parseColor=function(f){if(!f)return;let g=f.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const y=u.exec(g);if(y){const C=y[1]?15:y[4]?255:y[7]?4095:65535;return[Math.round(parseInt(y[1]||y[4]||y[7]||y[10],16)/C*255),Math.round(parseInt(y[2]||y[5]||y[8]||y[11],16)/C*255),Math.round(parseInt(y[3]||y[6]||y[9]||y[12],16)/C*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),h.exec(g)&&[3,6,9,12].includes(g.length))){const y=g.length/3,C=[0,0,0];for(let w=0;w<3;++w){const _=parseInt(g.slice(y*w,y*w+y),16);C[w]=y===1?_<<4:y===2?_:y===3?_>>4:_>>8}return C}},l.toRgbString=function(f,g=16){const[y,C,w]=f;return`rgb:${p(y,g)}/${p(C,g)}/${p(w,g)}`}},5770:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const h=u(482),p=u(8742),f=u(5770),g=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(C,w){this._handlers[C]===void 0&&(this._handlers[C]=[]);const _=this._handlers[C];return _.push(w),{dispose:()=>{const b=_.indexOf(w);b!==-1&&_.splice(b,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(C,w){if(this.reset(),this._ident=C,this._active=this._handlers[C]||g,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(C,w,_){if(this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].put(C,w,_);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(C,w,_))}unhook(C,w=!0){if(this._active.length){let _=!1,b=this._active.length-1,x=!1;if(this._stack.paused&&(b=this._stack.loopPosition-1,_=w,x=this._stack.fallThrough,this._stack.paused=!1),!x&&_===!1){for(;b>=0&&(_=this._active[b].unhook(C),_!==!0);b--)if(_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!1,_;b--}for(;b>=0;b--)if(_=this._active[b].unhook(!1),_ instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=b,this._stack.fallThrough=!0,_}else this._handlerFb(this._ident,"UNHOOK",C);this._active=g,this._ident=0}};const y=new p.Params;y.addParam(0),l.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=y,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():y,this._data="",this._hitLimit=!1}put(C,w,_){this._hitLimit||(this._data+=(0,h.utf32ToString)(C,w,_),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let w=!1;if(this._hitLimit)w=!1;else if(C&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((_=>(this._params=y,this._data="",this._hitLimit=!1,_)));return this._params=y,this._data="",this._hitLimit=!1,w}}},2015:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const h=u(844),p=u(8742),f=u(6242),g=u(6351);class y{constructor(b){this.table=new Uint8Array(b)}setDefault(b,x){this.table.fill(b<<4|x)}add(b,x,S,E){this.table[x<<8|b]=S<<4|E}addMany(b,x,S,E){for(let T=0;TM)),x=(D,M)=>b.slice(D,M),S=x(32,127),E=x(0,24);E.push(25),E.push.apply(E,x(28,32));const T=x(0,14);let A;for(A in _.setDefault(1,0),_.addMany(S,0,2,0),T)_.addMany([24,26,153,154],A,3,0),_.addMany(x(128,144),A,3,0),_.addMany(x(144,152),A,3,0),_.add(156,A,0,0),_.add(27,A,11,1),_.add(157,A,4,8),_.addMany([152,158,159],A,0,7),_.add(155,A,11,3),_.add(144,A,11,9);return _.addMany(E,0,3,0),_.addMany(E,1,3,1),_.add(127,1,0,1),_.addMany(E,8,0,8),_.addMany(E,3,3,3),_.add(127,3,0,3),_.addMany(E,4,3,4),_.add(127,4,0,4),_.addMany(E,6,3,6),_.addMany(E,5,3,5),_.add(127,5,0,5),_.addMany(E,2,3,2),_.add(127,2,0,2),_.add(93,1,4,8),_.addMany(S,8,5,8),_.add(127,8,5,8),_.addMany([156,27,24,26,7],8,6,0),_.addMany(x(28,32),8,0,8),_.addMany([88,94,95],1,0,7),_.addMany(S,7,0,7),_.addMany(E,7,0,7),_.add(156,7,0,0),_.add(127,7,0,7),_.add(91,1,11,3),_.addMany(x(64,127),3,7,0),_.addMany(x(48,60),3,8,4),_.addMany([60,61,62,63],3,9,4),_.addMany(x(48,60),4,8,4),_.addMany(x(64,127),4,7,0),_.addMany([60,61,62,63],4,0,6),_.addMany(x(32,64),6,0,6),_.add(127,6,0,6),_.addMany(x(64,127),6,0,0),_.addMany(x(32,48),3,9,5),_.addMany(x(32,48),5,9,5),_.addMany(x(48,64),5,0,6),_.addMany(x(64,127),5,7,0),_.addMany(x(32,48),4,9,5),_.addMany(x(32,48),1,9,2),_.addMany(x(32,48),2,9,2),_.addMany(x(48,127),2,10,0),_.addMany(x(48,80),1,10,0),_.addMany(x(81,88),1,10,0),_.addMany([89,90,92],1,10,0),_.addMany(x(96,127),1,10,0),_.add(80,1,11,9),_.addMany(E,9,0,9),_.add(127,9,0,9),_.addMany(x(28,32),9,0,9),_.addMany(x(32,48),9,9,12),_.addMany(x(48,60),9,8,10),_.addMany([60,61,62,63],9,9,10),_.addMany(E,11,0,11),_.addMany(x(32,128),11,0,11),_.addMany(x(28,32),11,0,11),_.addMany(E,10,0,10),_.add(127,10,0,10),_.addMany(x(28,32),10,0,10),_.addMany(x(48,60),10,8,10),_.addMany([60,61,62,63],10,0,11),_.addMany(x(32,48),10,9,12),_.addMany(E,12,0,12),_.add(127,12,0,12),_.addMany(x(28,32),12,0,12),_.addMany(x(32,48),12,9,12),_.addMany(x(48,64),12,0,11),_.addMany(x(64,127),12,12,13),_.addMany(x(64,127),10,12,13),_.addMany(x(64,127),9,12,13),_.addMany(E,13,13,13),_.addMany(S,13,13,13),_.add(127,13,0,13),_.addMany([27,156,24,26],13,14,0),_.add(C,0,2,0),_.add(C,8,5,8),_.add(C,6,0,6),_.add(C,11,0,11),_.add(C,13,13,13),_})();class w extends h.Disposable{constructor(b=l.VT500_TRANSITION_TABLE){super(),this._transitions=b,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,S,E)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,S)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(b,x=[64,126]){let S=0;if(b.prefix){if(b.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=b.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(b.intermediates){if(b.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let T=0;TA||A>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=A}}if(b.final.length!==1)throw new Error("final must be a single byte");const E=b.final.charCodeAt(0);if(x[0]>E||E>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return S<<=8,S|=E,S}identToString(b){const x=[];for(;b;)x.push(String.fromCharCode(255&b)),b>>=8;return x.reverse().join("")}setPrintHandler(b){this._printHandler=b}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(b,x){const S=this._identifier(b,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const E=this._escHandlers[S];return E.push(x),{dispose:()=>{const T=E.indexOf(x);T!==-1&&E.splice(T,1)}}}clearEscHandler(b){this._escHandlers[this._identifier(b,[48,126])]&&delete this._escHandlers[this._identifier(b,[48,126])]}setEscHandlerFallback(b){this._escHandlerFb=b}setExecuteHandler(b,x){this._executeHandlers[b.charCodeAt(0)]=x}clearExecuteHandler(b){this._executeHandlers[b.charCodeAt(0)]&&delete this._executeHandlers[b.charCodeAt(0)]}setExecuteHandlerFallback(b){this._executeHandlerFb=b}registerCsiHandler(b,x){const S=this._identifier(b);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const E=this._csiHandlers[S];return E.push(x),{dispose:()=>{const T=E.indexOf(x);T!==-1&&E.splice(T,1)}}}clearCsiHandler(b){this._csiHandlers[this._identifier(b)]&&delete this._csiHandlers[this._identifier(b)]}setCsiHandlerFallback(b){this._csiHandlerFb=b}registerDcsHandler(b,x){return this._dcsParser.registerHandler(this._identifier(b),x)}clearDcsHandler(b){this._dcsParser.clearHandler(this._identifier(b))}setDcsHandlerFallback(b){this._dcsParser.setHandlerFallback(b)}registerOscHandler(b,x){return this._oscParser.registerHandler(b,x)}clearOscHandler(b){this._oscParser.clearHandler(b)}setOscHandlerFallback(b){this._oscParser.setHandlerFallback(b)}setErrorHandler(b){this._errorHandler=b}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(b,x,S,E,T){this._parseStack.state=b,this._parseStack.handlers=x,this._parseStack.handlerPos=S,this._parseStack.transition=E,this._parseStack.chunkPos=T}parse(b,x,S){let E,T=0,A=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const M=this._parseStack.handlers;let R=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&R>-1){for(;R>=0&&(E=M[R](this._params),E!==!0);R--)if(E instanceof Promise)return this._parseStack.handlerPos=R,E}this._parseStack.handlers=[];break;case 4:if(S===!1&&R>-1){for(;R>=0&&(E=M[R](),E!==!0);R--)if(E instanceof Promise)return this._parseStack.handlerPos=R,E}this._parseStack.handlers=[];break;case 6:if(T=b[this._parseStack.chunkPos],E=this._dcsParser.unhook(T!==24&&T!==26,S),E)return E;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=b[this._parseStack.chunkPos],E=this._oscParser.end(T!==24&&T!==26,S),E)return E;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let M=D;M>4){case 2:for(let $=M+1;;++$){if($>=x||(T=b[$])<32||T>126&&T=x||(T=b[$])<32||T>126&&T=x||(T=b[$])<32||T>126&&T=x||(T=b[$])<32||T>126&&T=0&&(E=R[z](this._params),E!==!0);z--)if(E instanceof Promise)return this._preserveStack(3,R,z,A,M),E;z<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++M47&&T<60);M--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const H=this._escHandlers[this._collect<<8|T];let q=H?H.length-1:-1;for(;q>=0&&(E=H[q](),E!==!0);q--)if(E instanceof Promise)return this._preserveStack(4,H,q,A,M),E;q<0&&this._escHandlerFb(this._collect<<8|T),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|T,this._params);break;case 13:for(let $=M+1;;++$)if($>=x||(T=b[$])===24||T===26||T===27||T>127&&T=x||(T=b[$])<32||T>127&&T{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const h=u(5770),p=u(482),f=[];l.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,y){this._handlers[g]===void 0&&(this._handlers[g]=[]);const C=this._handlers[g];return C.push(y),{dispose:()=>{const w=C.indexOf(y);w!==-1&&C.splice(w,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,y,C){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(g,y,C);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,y,C))}start(){this.reset(),this._state=1}put(g,y,C){if(this._state!==3){if(this._state===1)for(;y0&&this._put(g,y,C)}}end(g,y=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,w=this._active.length-1,_=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,C=y,_=this._stack.fallThrough,this._stack.paused=!1),!_&&C===!1){for(;w>=0&&(C=this._active[w].end(g),C!==!0);w--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,C;w--}for(;w>=0;w--)if(C=this._active[w].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",g);this._active=f,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,y,C){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,y,C),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let y=!1;if(this._hitLimit)y=!1;else if(g&&(y=this._handler(this._data),y instanceof Promise))return y.then((C=>(this._data="",this._hitLimit=!1,C)));return this._data="",this._hitLimit=!1,y}}},8742:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const u=2147483647;class h{static fromArray(f){const g=new h;if(!f.length)return g;for(let y=Array.isArray(f[0])?1:0;y256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new h(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let g=0;g>8,C=255&this._subParamsIdx[g];C-y>0&&f.push(Array.prototype.slice.call(this._subParams,y,C))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>u?u:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>u?u:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const g=this._subParamsIdx[f]>>8,y=255&this._subParamsIdx[f];return y-g>0?this._subParams.subarray(g,y):null}getSubParamsAll(){const f={};for(let g=0;g>8,C=255&this._subParamsIdx[g];C-y>0&&(f[g]=this._subParams.slice(y,C))}return f}addDigit(f){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const y=this._digitIsSub?this._subParams:this.params,C=y[g-1];y[g-1]=~C?Math.min(10*C+f,u):f}}l.Params=h},5741:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,h){const p={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(p),h.dispose=()=>this._wrappedAddonDispose(p),h.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let h=-1;for(let p=0;p{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const h=u(3785),p=u(511);l.BufferApiView=class{constructor(f,g){this._buffer=f,this.type=g}init(f){return this._buffer=f,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(f){const g=this._buffer.lines.get(f);if(g)return new h.BufferLineApiView(g)}getNullCell(){return new p.CellData}}},3785:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const h=u(511);l.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,f){if(!(p<0||p>=this._line.length))return f?(this._line.loadCell(p,f),f):this._line.loadCell(p,new h.CellData)}translateToString(p,f,g){return this._line.translateToString(p,f,g)}}},8285:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const h=u(8771),p=u(8460),f=u(844);class g extends f.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=g},7975:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,h){return this._core.registerCsiHandler(u,(p=>h(p.toArray())))}addCsiHandler(u,h){return this.registerCsiHandler(u,h)}registerDcsHandler(u,h){return this._core.registerDcsHandler(u,((p,f)=>h(p,f.toArray())))}addDcsHandler(u,h){return this.registerDcsHandler(u,h)}registerEscHandler(u,h){return this._core.registerEscHandler(u,h)}addEscHandler(u,h){return this.registerEscHandler(u,h)}registerOscHandler(u,h){return this._core.registerOscHandler(u,h)}addOscHandler(u,h){return this.registerOscHandler(u,h)}}},7090:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(c,l,u){var h=this&&this.__decorate||function(_,b,x,S){var E,T=arguments.length,A=T<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,b,x,S);else for(var D=_.length-1;D>=0;D--)(E=_[D])&&(A=(T<3?E(A):T>3?E(b,x,A):E(b,x))||A);return T>3&&A&&Object.defineProperty(b,x,A),A},p=this&&this.__param||function(_,b){return function(x,S){b(x,S,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const f=u(8460),g=u(844),y=u(5295),C=u(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let w=l.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(_){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(_.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(_.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new y.BufferSet(_,this))}resize(_,b){this.cols=_,this.rows=b,this.buffers.resize(_,b),this._onResize.fire({cols:_,rows:b})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(_,b=!1){const x=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===_.fg&&S.getBg(0)===_.bg||(S=x.getBlankLine(_,b),this._cachedBlankLine=S),S.isWrapped=b;const E=x.ybase+x.scrollTop,T=x.ybase+x.scrollBottom;if(x.scrollTop===0){const A=x.lines.isFull;T===x.lines.length-1?A?x.lines.recycle().copyFrom(S):x.lines.push(S.clone()):x.lines.splice(T+1,0,S.clone()),A?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const A=T-E+1;x.lines.shiftElements(E+1,A-1,-1),x.lines.set(T,S.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(_,b,x){const S=this.buffer;if(_<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else _+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const E=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+_,S.ybase),0),E!==S.ydisp&&(b||this._onScroll.fire(S.ydisp))}};l.BufferService=w=h([p(0,C.IOptionsService)],w)},7994:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,h){this._charsets[u]=h,this.glevel===u&&(this.charset=h)}}},1753:function(c,l,u){var h=this&&this.__decorate||function(S,E,T,A){var D,M=arguments.length,R=M<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,E,T,A);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(R=(M<3?D(R):M>3?D(E,T,R):D(E,T))||R);return M>3&&R&&Object.defineProperty(E,T,R),R},p=this&&this.__param||function(S,E){return function(T,A){E(T,A,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const f=u(2585),g=u(8460),y=u(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function w(S,E){let T=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(T|=64,T|=S.action):(T|=3&S.button,4&S.button&&(T|=64),8&S.button&&(T|=128),S.action===32?T|=32:S.action!==0||E||(T|=3)),T}const _=String.fromCharCode,b={DEFAULT:S=>{const E=[w(S,!1)+32,S.col+32,S.row+32];return E[0]>255||E[1]>255||E[2]>255?"":`\x1B[M${_(E[0])}${_(E[1])}${_(E[2])}`},SGR:S=>{const E=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${w(S,!0)};${S.col};${S.row}${E}`},SGR_PIXELS:S=>{const E=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${w(S,!0)};${S.x};${S.y}${E}`}};let x=l.CoreMouseService=class extends y.Disposable{constructor(S,E){super(),this._bufferService=S,this._coreService=E,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(C))this.addProtocol(T,C[T]);for(const T of Object.keys(b))this.addEncoding(T,b[T]);this.reset()}addProtocol(S,E){this._protocols[S]=E}addEncoding(S,E){this._encodings[S]=E}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const E=this._encodings[this._activeEncoding](S);return E&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(E):this._coreService.triggerDataEvent(E,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,E,T){if(T){if(S.x!==E.x||S.y!==E.y)return!1}else if(S.col!==E.col||S.row!==E.row)return!1;return S.button===E.button&&S.action===E.action&&S.ctrl===E.ctrl&&S.alt===E.alt&&S.shift===E.shift}};l.CoreMouseService=x=h([p(0,f.IBufferService),p(1,f.ICoreService)],x)},6975:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const f=u(1439),g=u(8460),y=u(844),C=u(2585),w=Object.freeze({insertMode:!1}),_=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let b=l.CoreService=class extends y.Disposable{constructor(x,S,E){super(),this._bufferService=x,this._logService=S,this._optionsService=E,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(w),this.decPrivateModes=(0,f.clone)(_)}reset(){this.modes=(0,f.clone)(w),this.decPrivateModes=(0,f.clone)(_)}triggerDataEvent(x,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const E=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&E.ybase!==E.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=b=h([p(0,C.IBufferService),p(1,C.ILogService),p(2,C.IOptionsService)],b)},9074:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const h=u(8055),p=u(8460),f=u(844),g=u(6106);let y=0,C=0;class w extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const S=new _(x);if(S){const E=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),E.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,S,E){let T=0,A=0;for(const D of this._decorations.getKeyIterator(S))T=D.options.x??0,A=T+(D.options.width??1),x>=T&&x{y=A.options.x??0,C=y+(A.options.width??1),x>=y&&x{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const h=u(2585),p=u(8343);class f{constructor(...y){this._entries=new Map;for(const[C,w]of y)this.set(C,w)}set(y,C){const w=this._entries.get(y);return this._entries.set(y,C),w}forEach(y){for(const[C,w]of this._entries.entries())y(C,w)}has(y){return this._entries.has(y)}get(y){return this._entries.get(y)}}l.ServiceCollection=f,l.InstantiationService=class{constructor(){this._services=new f,this._services.set(h.IInstantiationService,this)}setService(g,y){this._services.set(g,y)}getService(g){return this._services.get(g)}createInstance(g,...y){const C=(0,p.getServiceDependencies)(g).sort(((b,x)=>b.index-x.index)),w=[];for(const b of C){const x=this._services.get(b.id);if(!x)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${b.id}.`);w.push(x)}const _=C.length>0?C[0].index:y.length;if(y.length!==_)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${_+1} conflicts with ${y.length} static arguments`);return new g(...y,...w)}}},7866:function(c,l,u){var h=this&&this.__decorate||function(_,b,x,S){var E,T=arguments.length,A=T<3?b:S===null?S=Object.getOwnPropertyDescriptor(b,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(_,b,x,S);else for(var D=_.length-1;D>=0;D--)(E=_[D])&&(A=(T<3?E(A):T>3?E(b,x,A):E(b,x))||A);return T>3&&A&&Object.defineProperty(b,x,A),A},p=this&&this.__param||function(_,b){return function(x,S){b(x,S,_)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const f=u(844),g=u(2585),y={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let C,w=l.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(_){super(),this._optionsService=_,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),C=this}_updateLogLevel(){this._logLevel=y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(_){for(let b=0;b<_.length;b++)typeof _[b]=="function"&&(_[b]=_[b]())}_log(_,b,x){this._evalLazyOptionalParams(x),_.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+b,...x)}trace(_,...b){var x;this._logLevel<=g.LogLevelEnum.TRACE&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.trace.bind(this._optionsService.options.logger))??console.log,_,b)}debug(_,...b){var x;this._logLevel<=g.LogLevelEnum.DEBUG&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.debug.bind(this._optionsService.options.logger))??console.log,_,b)}info(_,...b){var x;this._logLevel<=g.LogLevelEnum.INFO&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.info.bind(this._optionsService.options.logger))??console.info,_,b)}warn(_,...b){var x;this._logLevel<=g.LogLevelEnum.WARN&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.warn.bind(this._optionsService.options.logger))??console.warn,_,b)}error(_,...b){var x;this._logLevel<=g.LogLevelEnum.ERROR&&this._log(((x=this._optionsService.options.logger)==null?void 0:x.error.bind(this._optionsService.options.logger))??console.error,_,b)}};l.LogService=w=h([p(0,g.IOptionsService)],w),l.setTraceLogger=function(_){C=_},l.traceCall=function(_,b,x){if(typeof x.value!="function")throw new Error("not supported");const S=x.value;x.value=function(...E){if(C.logLevel!==g.LogLevelEnum.TRACE)return S.apply(this,E);C.trace(`GlyphRenderer#${S.name}(${E.map((A=>JSON.stringify(A))).join(", ")})`);const T=S.apply(this,E);return C.trace(`GlyphRenderer#${S.name} return`,T),T}}},7302:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const h=u(8460),p=u(844),f=u(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class y extends p.Disposable{constructor(w){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const _={...l.DEFAULT_OPTIONS};for(const b in w)if(b in _)try{const x=w[b];_[b]=this._sanitizeAndValidateOption(b,x)}catch(x){console.error(x)}this.rawOptions=_,this.options={..._},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,_){return this.onOptionChange((b=>{b===w&&_(this.rawOptions[w])}))}onMultipleOptionChange(w,_){return this.onOptionChange((b=>{w.indexOf(b)!==-1&&_()}))}_setupOptions(){const w=b=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);return this.rawOptions[b]},_=(b,x)=>{if(!(b in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${b}"`);x=this._sanitizeAndValidateOption(b,x),this.rawOptions[b]!==x&&(this.rawOptions[b]=x,this._onOptionChange.fire(b))};for(const b in this.rawOptions){const x={get:w.bind(this,b),set:_.bind(this,b)};Object.defineProperty(this.options,b,x)}}_sanitizeAndValidateOption(w,_){switch(w){case"cursorStyle":if(_||(_=l.DEFAULT_OPTIONS[w]),!(function(b){return b==="block"||b==="underline"||b==="bar"})(_))throw new Error(`"${_}" is not a valid value for ${w}`);break;case"wordSeparator":_||(_=l.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof _=="number"&&1<=_&&_<=1e3)break;_=g.includes(_)?_:l.DEFAULT_OPTIONS[w];break;case"cursorWidth":_=Math.floor(_);case"lineHeight":case"tabStopWidth":if(_<1)throw new Error(`${w} cannot be less than 1, value: ${_}`);break;case"minimumContrastRatio":_=Math.max(1,Math.min(21,Math.round(10*_)/10));break;case"scrollback":if((_=Math.min(_,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${_}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(_<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${_}`);break;case"rows":case"cols":if(!_&&_!==0)throw new Error(`${w} must be numeric, value: ${_}`);break;case"windowsPty":_=_??{}}return _}}l.OptionsService=y},2660:function(c,l,u){var h=this&&this.__decorate||function(y,C,w,_){var b,x=arguments.length,S=x<3?C:_===null?_=Object.getOwnPropertyDescriptor(C,w):_;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(y,C,w,_);else for(var E=y.length-1;E>=0;E--)(b=y[E])&&(S=(x<3?b(S):x>3?b(C,w,S):b(C,w))||S);return x>3&&S&&Object.defineProperty(C,w,S),S},p=this&&this.__param||function(y,C){return function(w,_){C(w,_,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const f=u(2585);let g=l.OscLinkService=class{constructor(y){this._bufferService=y,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(y){const C=this._bufferService.buffer;if(y.id===void 0){const E=C.addMarker(C.ybase+C.y),T={data:y,id:this._nextId++,lines:[E]};return E.onDispose((()=>this._removeMarkerFromLink(T,E))),this._dataByLinkId.set(T.id,T),T.id}const w=y,_=this._getEntryIdKey(w),b=this._entriesWithId.get(_);if(b)return this.addLineToLink(b.id,C.ybase+C.y),b.id;const x=C.addMarker(C.ybase+C.y),S={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(S,x))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(y,C){const w=this._dataByLinkId.get(y);if(w&&w.lines.every((_=>_.line!==C))){const _=this._bufferService.buffer.addMarker(C);w.lines.push(_),_.onDispose((()=>this._removeMarkerFromLink(w,_)))}}getLinkData(y){var C;return(C=this._dataByLinkId.get(y))==null?void 0:C.data}_getEntryIdKey(y){return`${y.id};;${y.uri}`}_removeMarkerFromLink(y,C){const w=y.lines.indexOf(C);w!==-1&&(y.lines.splice(w,1),y.lines.length===0&&(y.data.id!==void 0&&this._entriesWithId.delete(y.key),this._dataByLinkId.delete(y.id)))}};l.OscLinkService=g=h([p(0,f.IBufferService)],g)},8343:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const u="di$target",h="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[h]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const f=function(g,y,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,_,b){_[u]===_?_[h].push({id:w,index:b}):(_[h]=[{id:w,index:b}],_[u]=_)})(f,g,C)};return f.toString=()=>p,l.serviceRegistry.set(p,f),f}},2585:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const h=u(8343);var p;l.IBufferService=(0,h.createDecorator)("BufferService"),l.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),l.ICoreService=(0,h.createDecorator)("CoreService"),l.ICharsetService=(0,h.createDecorator)("CharsetService"),l.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,h.createDecorator)("LogService"),l.IOptionsService=(0,h.createDecorator)("OptionsService"),l.IOscLinkService=(0,h.createDecorator)("OscLinkService"),l.IUnicodeService=(0,h.createDecorator)("UnicodeService"),l.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const h=u(8460),p=u(225);class f{static extractShouldJoin(y){return(1&y)!=0}static extractWidth(y){return y>>1&3}static extractCharKind(y){return y>>3}static createPropertyValue(y,C,w=!1){return(16777215&y)<<3|(3&C)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const y=new p.UnicodeV6;this.register(y),this._active=y.version,this._activeProvider=y}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(y){if(!this._providers[y])throw new Error(`unknown Unicode version "${y}"`);this._active=y,this._activeProvider=this._providers[y],this._onChange.fire(y)}register(y){this._providers[y.version]=y}wcwidth(y){return this._activeProvider.wcwidth(y)}getStringCellWidth(y){let C=0,w=0;const _=y.length;for(let b=0;b<_;++b){let x=y.charCodeAt(b);if(55296<=x&&x<=56319){if(++b>=_)return C+this.wcwidth(x);const T=y.charCodeAt(b);56320<=T&&T<=57343?x=1024*(x-55296)+T-56320+65536:C+=this.wcwidth(T)}const S=this.charProperties(x,w);let E=f.extractWidth(S);f.extractShouldJoin(S)&&(E-=f.extractWidth(w)),C+=E,w=S}return C}charProperties(y,C){return this._activeProvider.charProperties(y,C)}}l.UnicodeService=f}},r={};function s(c){var l=r[c];if(l!==void 0)return l.exports;var u=r[c]={exports:{}};return n[c].call(u.exports,u,u.exports,s),u.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const l=s(9042),u=s(3236),h=s(844),p=s(5741),f=s(8285),g=s(7975),y=s(7090),C=["cols","rows"];class w extends h.Disposable{constructor(b){super(),this._core=this.register(new u.Terminal(b)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=E=>this._core.options[E],S=(E,T)=>{this._checkReadonlyOptions(E),this._core.options[E]=T};for(const E in this._core.options){const T={get:x.bind(this,E),set:S.bind(this,E)};Object.defineProperty(this._publicOptions,E,T)}}_checkReadonlyOptions(b){if(C.includes(b))throw new Error(`Option "${b}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new y.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const b=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:b.applicationCursorKeys,applicationKeypadMode:b.applicationKeypad,bracketedPasteMode:b.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:b.origin,reverseWraparoundMode:b.reverseWraparound,sendFocusMode:b.sendFocus,wraparoundMode:b.wraparound}}get options(){return this._publicOptions}set options(b){for(const x in b)this._publicOptions[x]=b[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(b,x=!0){this._core.input(b,x)}resize(b,x){this._verifyIntegers(b,x),this._core.resize(b,x)}open(b){this._core.open(b)}attachCustomKeyEventHandler(b){this._core.attachCustomKeyEventHandler(b)}attachCustomWheelEventHandler(b){this._core.attachCustomWheelEventHandler(b)}registerLinkProvider(b){return this._core.registerLinkProvider(b)}registerCharacterJoiner(b){return this._checkProposedApi(),this._core.registerCharacterJoiner(b)}deregisterCharacterJoiner(b){this._checkProposedApi(),this._core.deregisterCharacterJoiner(b)}registerMarker(b=0){return this._verifyIntegers(b),this._core.registerMarker(b)}registerDecoration(b){return this._checkProposedApi(),this._verifyPositiveIntegers(b.x??0,b.width??0,b.height??0),this._core.registerDecoration(b)}hasSelection(){return this._core.hasSelection()}select(b,x,S){this._verifyIntegers(b,x,S),this._core.select(b,x,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(b,x){this._verifyIntegers(b,x),this._core.selectLines(b,x)}dispose(){super.dispose()}scrollLines(b){this._verifyIntegers(b),this._core.scrollLines(b)}scrollPages(b){this._verifyIntegers(b),this._core.scrollPages(b)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(b){this._verifyIntegers(b),this._core.scrollToLine(b)}clear(){this._core.clear()}write(b,x){this._core.write(b,x)}writeln(b,x){this._core.write(b),this._core.write(`\r -`,x)}paste(b){this._core.paste(b)}refresh(b,x){this._verifyIntegers(b,x),this._core.refresh(b,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(b){this._addonManager.loadAddon(this,b)}static get strings(){return l}_verifyIntegers(...b){for(const x of b)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...b){for(const x of b)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}c.Terminal=w})(),a})()))})(Yp)),Yp.exports}var yU=vU();function n6(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new yU.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()||"ui-monospace, Menlo, Consolas, monospace",scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),s=new gU.FitAddon;r.loadAddon(s),r.open(n);try{s.fit()}catch{}const a=new ResizeObserver(()=>{try{s.fit()}catch{}});a.observe(n);let c=!1,l=0,u=!1,h=!1;async function p(){if(u){h=!0;return}u=!0;try{for(;;){const g=await eT(e,l);if(c)return;if(g.dataBase64&&r.write(n6(g.dataBase64)),l=g.nextOffset,g.eof)break}}catch{}finally{u=!1,h&&!c&&(h=!1,p())}}const f=GT(e,g=>{if(c)return;const y=n6(g.dataBase64);!u&&g.offset===l?(r.write(y),l+=y.length):g.offset+y.length>l&&p()});return p(),()=>{c=!0,f(),a.disconnect(),r.dispose()}},[e]),m.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const zo="__uncommitted__";function _U({state:e}){return!e||e.loading?m.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?m.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?m.jsx(uw,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):m.jsx(i2,{diff:e.payload.diff}):m.jsx("div",{className:"diff-empty",children:"No changes."})}function xU({experiment:e,project:t,view:n,runs:r,selectedRunId:s,onSelectRun:a}){const c=r.filter(l=>l.experimentId===e.id).sort((l,u)=>u.createdAt-l.createdAt);return n==="terminal"?m.jsx(SU,{experiment:e,expRuns:c,selectedRunId:s,onSelectRun:a}):m.jsx(wU,{experiment:e,project:t})}function SU({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[s,a]=P.useState(null),[c,l]=P.useState(!1),u=P.useRef(null),h=n&&t.find(C=>C.id===n)||t[0]||null,p=(h==null?void 0:h.status)==="running"||(h==null?void 0:h.status)==="starting",f=C=>{const w=t.findIndex(_=>_.id===C);return w===-1?t.length:t.length-w},g=P.useRef(null);P.useEffect(()=>{if(g.current===null){g.current=new Set(t.map(w=>w.id));return}const C=t.find(w=>!g.current.has(w.id));for(const w of t)g.current.add(w.id);C&&r(C.id)},[t,r]),P.useEffect(()=>{if(!c)return;const C=w=>{var _;(_=u.current)!=null&&_.contains(w.target)||l(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);async function y(){if(h){a(null);try{await Dx(h.id)}catch(C){a(C instanceof Error?C.message:String(C))}}}return m.jsxs("div",{className:"term-view",children:[m.jsxs("div",{className:"term-bar",children:[m.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),m.jsx("span",{style:{flex:1}}),s&&m.jsx("span",{className:"error",children:s}),p&&m.jsxs("button",{className:"btn sm ghost",onClick:()=>void y(),children:[m.jsx(Wk,{size:13}),"Stop"]}),t.length>0&&h&&m.jsxs("div",{className:"run-history",ref:u,children:[m.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>l(C=>!C),children:[m.jsxs("span",{className:"run-label",children:["Run ",f(h.id)]}),m.jsx(tl,{status:h.status}),m.jsx(Pa,{size:14,className:"run-picker-chev"})]}),c&&m.jsx("div",{className:"history-menu",children:t.map(C=>m.jsxs("button",{className:`history-item ${C.id===(h==null?void 0:h.id)?"active":""}`,onClick:()=>{r(C.id),l(!1)},children:[m.jsxs("span",{className:"run-label",children:["Run ",f(C.id)]}),m.jsx(tl,{status:C.status}),m.jsx("span",{className:"when",children:Ua(C.createdAt)})]},C.id))})]})]}),m.jsx("div",{className:"term-fill",children:h?m.jsx(bU,{runId:h.id},h.id):m.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function wU({experiment:e,project:t}){const[n,r]=P.useState(null),[s,a]=P.useState(null),[c,l]=P.useState(null),[u,h]=P.useState(null),[p,f]=P.useState({}),g=!!(c&&c.diff.trim()!==""&&c.experimentId===e.id);async function y(){a(null);try{const[w,_]=await Promise.all([nT(e.id),y3(e.projectId)]);r(w),l(_),h(b=>{var S;return b!==null?b:_.diff.trim()!==""&&_.experimentId===e.id?zo:((S=w[0])==null?void 0:S.sha)??null})}catch(w){a(w instanceof Error?w.message:String(w))}}P.useEffect(()=>{n===null&&!s&&y()},[n,s,e.id]),P.useEffect(()=>{const w=setInterval(()=>{y3(e.projectId).then(l).catch(()=>{})},5e3);return()=>clearInterval(w)},[e.projectId]),P.useEffect(()=>{var w;u===zo&&c&&!g&&h(((w=n==null?void 0:n[0])==null?void 0:w.sha)??null)},[u,c,g,n]),P.useEffect(()=>{if(!u||u===zo||p[u])return;const w=u;f(_=>({..._,[w]:{loading:!0}})),rT(e.id,w).then(_=>f(b=>({...b,[w]:{loading:!1,payload:_}}))).catch(_=>f(b=>({...b,[w]:{loading:!1,error:_ instanceof Error?_.message:String(_)}})))},[u,p,e.id]);const C=!g&&((n==null?void 0:n.length)??0)===0;return m.jsx("div",{className:"drawer",children:m.jsx("div",{className:"drawer-body",children:m.jsxs("div",{className:"drawer-section",children:[m.jsxs("div",{className:"changes-branch",children:[m.jsx("span",{className:"ctl-label",children:"Branch"}),m.jsx(pU,{owner:t.githubOwner,repo:t.githubRepo,branch:e.branchName})]}),s?m.jsx("div",{className:"error",children:s}):n===null?m.jsx("div",{className:"changes-note",children:"Loading changes…"}):C?m.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"commit-picker",children:[m.jsx("span",{className:"ctl-label",children:"Commit"}),u===zo&&m.jsx("span",{className:"uncommitted-dot"}),m.jsxs("select",{className:"input sm",value:u??"",onChange:w=>h(w.target.value),children:[g&&m.jsx("option",{value:zo,children:"● Uncommitted changes"}),n.map(w=>m.jsxs("option",{value:w.sha,children:[w.sha.slice(0,7)," — ",w.subject]},w.sha))]}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void y(),children:m.jsx(Zh,{size:14})})]}),m.jsx("div",{style:{marginTop:10},children:u===zo&&c?c.truncated?m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):m.jsx(i2,{diff:c.diff}):u?m.jsx(_U,{state:p[u]}):m.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})]})})})}function CU({projectId:e,path:t,source:n="repo",sessionId:r,gitRef:s,onOpenFile:a}){const[c,l]=P.useState(null),[u,h]=P.useState(!1),[p,f]=P.useState(null),[g,y]=P.useState(!0),[C,w]=P.useState(0),_=n==="files",b=/\.(md|mdx|markdown)$/i.test(t),x=/(^|\/)report\.md$/i.test(t),S=x?t.replace(/\/?report\.md$/i,""):t.split("/").slice(0,-1).join("/"),[E,T]=P.useState(!1),A=(c==null?void 0:c.file)??null,D=(c==null?void 0:c.viaFiles)??!1,M=_||D;P.useEffect(()=>{let z=!1;y(!0),h(!1);const H=()=>(x&&S?Bx(e,S).then($=>$.markdown).catch(()=>null):NT(e,t)).then($=>({path:t,content:$??"",truncated:!1,notFound:$===null,root:"clone"}));return(_?H().then($=>({file:$,viaFiles:!1})):iT(e,t,{sessionId:r,ref:s}).then($=>$.notFound&&!s?H().then(U=>U.notFound?{file:$,viaFiles:!1}:{file:{...U,root:$.root},viaFiles:!0}):{file:$,viaFiles:!1})).then($=>{z||((_||$.viaFiles)&&$.file.content.includes("\0")&&h(!0),l($),f(null))}).catch($=>{z||f($.message)}).finally(()=>{z||y(!1)}),()=>{z=!0}},[e,t,n,r,s,C]);const R=z=>_?"File not found in the project's files.":s?`File not found on branch ${s}.`:r&&z.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone or the project's files.":`File not found in the ${z.root==="worktree"?"session's worktree":"project clone"} or the project's files.`;return m.jsxs("div",{className:"file-view",children:[m.jsxs("div",{className:"file-view-header",children:[m.jsx(Cx,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"file-view-path",title:t,children:t}),s&&m.jsx("code",{className:"file-view-ref",title:`Committed state of ${s}`,children:s}),b&&m.jsx("button",{className:`icon-btn ${E?"active":""}`,"data-tip":E?"Rendered view":"View source","aria-label":E?"Rendered view":"View source",onClick:()=>T(z=>!z),children:m.jsx(bx,{size:13})}),m.jsx("button",{className:"icon-btn","data-tip":"Reload file","aria-label":"Reload file",onClick:()=>w(z=>z+1),children:g?m.jsx("span",{className:"spinner"}):m.jsx(Zh,{size:13})})]}),m.jsx("div",{className:"file-view-body",children:p?m.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",p]}):A===null?m.jsx("div",{className:"file-view-note",children:"Loading…"}):A.notFound?m.jsx("div",{className:"file-view-note",children:R(A)}):u?m.jsx("div",{className:"file-view-note",children:"Binary file — no inline preview."}):m.jsxs(m.Fragment,{children:[!M&&!s&&r&&A.root==="clone"&&m.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),D&&m.jsxs("div",{className:"file-view-note",children:["Not in the ",A.root==="worktree"?"session's worktree":"project clone"," — showing the copy from the project's files."]}),b&&!E?m.jsx("div",{className:"file-view-md",children:M?m.jsx(vw,{projectId:e,folder:S,markdown:A.content}):m.jsx(zc,{text:A.content,onOpenFile:a&&(z=>a(z,r,s))})}):m.jsx(hw,{text:A.content,path:t}),!M&&A.truncated&&m.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function EU({projectName:e,onHome:t,onCollapse:n}){return m.jsxs("div",{className:"rail-brand",children:[m.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[m.jsx(um,{size:15}),m.jsx("span",{className:"brand-project",children:e})]}),n&&m.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:m.jsx(kx,{size:15})})]})}const r6="Couldn't reach orx. Check it's still running, then re-check.";function kU({onDone:e}){const[t,n]=P.useState(0),[r,s]=P.useState(null),[a,c]=P.useState(null),[l,u]=P.useState(null),[h,p]=P.useState(!1),[f,g]=P.useState(!1),[y,C]=P.useState(!1),w=f||((r==null?void 0:r.some(E=>E.agentReady))??!1),_=(a==null?void 0:a.githubTokenSource)!=null,b=P.useRef(0),x=E=>{const T=++b.current;p(!0),g(!1),C(!1);const A=()=>T===b.current;Promise.allSettled([Og(E).then(D=>A()&&s(D)),zx().then(D=>A()&&c(D)),jT().then(D=>A()&&u(D))]).then(([D,M])=>{A()&&(D.status==="rejected"&&(g(!0),s(null)),M.status==="rejected"&&(C(!0),c(null)))}).finally(()=>p(!1))};P.useEffect(()=>x(!1),[]);const S=()=>{OT((l==null?void 0:l.enabled)??!0).catch(()=>{}),e()};return m.jsx("div",{className:"home onboarding",children:m.jsx("div",{className:"home-inner",children:t===0?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:[m.jsx(Sc,{})," · Step 1 of 3"]}),m.jsx("h2",{className:"onb-title",children:"Your coding agents"}),m.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),m.jsx("div",{className:"onb-cards",children:r!==null?r.map(E=>m.jsx(TU,{h:E},E.id)):f?m.jsx("div",{className:"onb-card-meta",children:r6}):m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]})}),r!==null&&!w&&m.jsx("p",{className:"onb-gate-hint",children:"Sign in to at least one agent to continue."}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>x(!0),disabled:h,children:[m.jsx(wh,{size:12,className:h?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(1),disabled:!w,title:w?void 0:"Sign in to at least one coding agent to continue",children:["Continue ",m.jsx(op,{size:13})]})]})]}):t===1?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:[m.jsx(Sc,{})," · Step 2 of 3"]}),m.jsx("h2",{className:"onb-title",children:"Connect GitHub"}),m.jsx("p",{className:"onb-sub",children:"orx clones your GitHub repos and pushes each experiment as a branch."}),m.jsx("div",{className:"onb-cards",children:y?m.jsx("div",{className:"onb-card-meta",children:r6}):m.jsx(NU,{git:a,onUpdate:E=>{b.current++,c(E),C(!1)}})}),a!==null&&!_&&m.jsx("p",{className:"onb-gate-hint",children:"Without GitHub access, orx can't create repos for you — cloning and pushing still work if you have SSH keys."}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[m.jsx(um,{size:12})," Back"]}),m.jsxs("button",{className:"btn ghost",onClick:()=>x(!1),disabled:h,children:[m.jsx(wh,{size:12,className:h?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",m.jsx(op,{size:13})]})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:[m.jsx(Sc,{})," · Step 3 of 3"]}),m.jsx("h2",{className:"onb-title",children:"Usage analytics"}),m.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),m.jsx("div",{className:"onb-cards",children:m.jsx(MU,{telemetry:l,onUpdate:u})}),m.jsx("p",{className:"onb-aside-text",style:{marginTop:12},children:"Your database, run logs, and artifacts stay on this machine — change where they live any time in Settings → Storage."}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[m.jsx(um,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:S,children:["Create your first project ",m.jsx(op,{size:13})]})]})]})})})}function i6({cmd:e}){const[t,n]=P.useState(!1),r=()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})};return m.jsxs("span",{className:"onb-cmd-chip",children:[m.jsx("code",{children:e}),m.jsx("button",{className:"onb-cmd-copy",onClick:r,"aria-label":t?"Copied":"Copy command",title:t?"Copied":"Copy",children:t?m.jsx(Zr,{size:13,strokeWidth:3}):m.jsx(Tg,{size:13})})]})}function AU(e){return e.agentReady?{cls:"st-done",label:"Connected"}:e.installed?{cls:"st-starting",label:"Not signed in"}:{cls:"st-idle",label:"Not detected"}}function TU({h:e}){var r;const t=AU(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:e.name}),m.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?m.jsx(Zr,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),m.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(s=>Ch(s)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):m.jsx("div",{className:"onb-card-meta",children:_8(e.agentNote)})]})}function NU({git:e,onUpdate:t}){const[n,r]=P.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"status-badge st-failed",children:[m.jsx("span",{className:"dot"})," Not found"]})]}),m.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const s=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"GitHub"}),m.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"Token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"Token saved in orx":e.githubTokenSource==="gh"?"Signed in via gh CLI":""}),m.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?m.jsx(Zr,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),e.githubTokenSource?"Connected":"Not connected"]})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-fix",children:[m.jsx("span",{className:"onb-fix-label",children:n?"Paste a personal access token:":e.ghInstalled?"Run this in your terminal to sign in:":"Install the GitHub CLI, then run this to sign in:"}),m.jsx("button",{className:"onb-fix-alt",onClick:()=>r(a=>!a),children:n?"Use gh instead":"Paste a token instead"})]}),n?m.jsx(p8,{onSaved:t}):m.jsx(i6,{cmd:"gh auth login"})]}),!s&&m.jsxs("div",{className:"onb-aside",children:[m.jsx("div",{className:"onb-aside-text",children:"Optional — so the agent's commits are attributed to you:"}),m.jsx(i6,{cmd:'git config --global user.name "Your Name" && git config --global user.email "you@example.com"'})]})]})}function MU({telemetry:e,onUpdate:t}){const[n,r]=P.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking analytics…"]});const s=e.enabled,a=!s&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",c=l=>{n||l===s||(r(!0),LT(l).then(t).finally(()=>r(!1)))};return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsxs("div",{children:[m.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),m.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:s?"On — helps prioritize what to build next.":a?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),m.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[m.jsxs("button",{className:`btn ${s?"primary":"ghost"}`,onClick:()=>c(!0),disabled:n,"aria-pressed":s,children:[s?m.jsx(Zr,{size:12,strokeWidth:3}):null," On"]}),m.jsxs("button",{className:`btn ${s?"ghost":"primary"}`,onClick:()=>c(!1),disabled:n,"aria-pressed":!s,children:[s?null:m.jsx(Zr,{size:12,strokeWidth:3})," Off"]})]})]}),m.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",m.jsx("code",{children:"orx telemetry off"}),"."]}),a&&m.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function V0(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function DU(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function RU(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function jU(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function LU({onCreated:e,onCancel:t}){var be;const[n,r]=P.useState("paper"),[s,a]=P.useState("use"),[c,l]=P.useState(""),[u,h]=P.useState(""),[p,f]=P.useState(!1),[g,y]=P.useState(!1),[C,w]=P.useState(null),[_,b]=P.useState(""),[x,S]=P.useState([]),[E,T]=P.useState(!1),[A,D]=P.useState(null),[M,R]=P.useState(!1),[z,H]=P.useState(null),q=P.useRef(0),[$,U]=P.useState(null),[K,Y]=P.useState(null);P.useEffect(()=>{VA().then(he=>Y(he.login)).catch(()=>Y(null))},[]);const Q=K??"you",ee=V0(c),B=!!(u.trim()&&(n==="new"||n==="existing"&&ee!==null||n==="paper"&&A!==null&&(c.trim()===""||ee!==null))),L=he=>{r(he),he!=="paper"&&a("use")},O=he=>{var Se;l(he),n!=="paper"&&a("use"),p||h(((Se=V0(he))==null?void 0:Se.repo)??"")};async function W(he){const Se=++q.current;S([]),T(!1),R(!0),H(null);try{const Te=await YA(he);if(Se!==q.current)return;D(Te);const Re=Te.repoUrl?V0(Te.repoUrl):null;l(Re?`${Re.owner}/${Re.repo}`:""),a("fork"),p||h((Re==null?void 0:Re.repo)??(Te.title??"").trim().slice(0,60))}catch(Te){if(Se!==q.current)return;H(Te instanceof Error?Te.message:String(Te))}finally{Se===q.current&&R(!1)}}function G(){q.current++,D(null),b(""),S([]),H(null),l(""),p||h("")}const ie=ee?`${ee.owner}/${ee.repo}`:"";P.useEffect(()=>{if(!ie){U(null);return}const[he,Se]=ie.split("/");U(null);let Te=!0;const Re=setTimeout(()=>{WA(he,Se).then(He=>{Te&&(U(He.canPush),He.canPush||a("fork"))}).catch(()=>{Te&&U(!0)})},400);return()=>{Te=!1,clearTimeout(Re)}},[ie]),P.useEffect(()=>{if(n!=="paper"||A)return;const he=_.trim(),Se=RU(he);if(!Se&&he.length<3){S([]),T(!1);return}const Te=++q.current;Se||T(!0);const Re=setTimeout(()=>{if(Se){W(Se);return}GA(he).then(He=>{Te===q.current&&S(He)}).catch(He=>{Te===q.current&&(S([]),H(He instanceof Error?He.message:String(He)))}).finally(()=>{Te===q.current&&T(!1)})},350);return()=>clearTimeout(Re)},[n,A,_]);async function fe(he){if(he.preventDefault(),!(!B||g)){y(!0),w(null);try{const Se=await qA(n==="new"?{name:u.trim(),createRepo:!0}:n==="paper"&&!ee?{name:u.trim(),createRepo:!0,paperId:A.paperId}:{name:u.trim(),githubOwner:ee.owner,githubRepo:ee.repo,forkRepo:s==="fork",...n==="paper"?{paperId:A.paperId}:{}});e(Se)}catch(Se){w(Se instanceof Error?Se.message:String(Se))}finally{y(!1)}}}const pe=n==="new"||n==="paper"&&!ee,te=ee?`${ee.owner}/${ee.repo}`:"the repo",V=ee?$===null?m.jsxs("span",{className:"repo-hint",children:["Checking your access to ",te,"…"]}):m.jsx(m.Fragment,{children:$===!1?m.jsxs("span",{className:"repo-hint",children:["You can't push to ",te,", so orx snapshots its latest commit into a new private repo on github.com/",Q,". Your experiments push there."]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:s==="use"?"active":"",onClick:()=>a("use"),children:"Use this repo"}),m.jsx("button",{type:"button",className:s==="fork"?"active":"",onClick:()=>a("fork"),children:"Private copy"})]}),m.jsx("span",{className:"repo-hint mono ok",children:s==="fork"?`Snapshots the latest commit of ${te} into a new private repo on github.com/${Q}`:`Experiments push branches straight to ${te}`})]})}):null,ae=m.jsxs("label",{children:["Project name",m.jsx("input",{value:u,onChange:he=>{f(!0),h(he.target.value)},placeholder:"my-research"})]}),oe=m.jsx("span",{className:`repo-hint mono ${u.trim()?"ok":""}`,children:u.trim()?`Creates github.com/${Q}/${DU(u)} · private`:"A blank private repo is created on your GitHub account"});return m.jsxs("form",{className:"form",onSubmit:fe,children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>L("paper"),children:"From a paper"}),m.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>L("existing"),children:"Existing repo"}),m.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>L("new"),children:"New blank repo"})]}),n==="existing"&&m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["GitHub repository",m.jsx("input",{value:c,onChange:he=>O(he.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${ee?"ok":""}`,children:ee?`${ee.owner} / ${ee.repo}`:c.trim()?"Paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),V,ee&&ae]}),n==="paper"&&(A===null?m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["Paper",m.jsx("input",{value:_,onChange:he=>b(he.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint ${z?"":"mono"}`,children:M?"Looking up paper…":E?"Searching alphaXiv…":z??"Searches alphaXiv by title — or paste an arXiv id / URL"})]}),!z&&!M&&!E&&m.jsx("span",{className:"repo-hint",children:"orx clones the code repo linked to the paper on alphaXiv."}),x.length>0&&m.jsx("div",{className:"paper-results",children:x.map(he=>m.jsxs("button",{type:"button",onClick:()=>void W(he.paperId),children:[m.jsx("span",{className:"title",children:jU(he.title)}),m.jsx("span",{className:"id",children:he.paperId})]},he.paperId))})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"paper-pick",children:[m.jsxs("div",{className:"meta",children:[m.jsx("div",{className:"title",children:A.title||A.paperId}),m.jsxs("div",{className:"id",children:["arXiv ",A.paperId]})]}),m.jsx("button",{type:"button",className:"btn ghost",onClick:G,children:"Change"})]}),m.jsxs("label",{children:["GitHub repository",A.repoUrl?"":" (optional)",m.jsx("input",{value:c,onChange:he=>O(he.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${ee?"ok":""}`,children:ee?`${ee.owner} / ${ee.repo}`+(A.repoUrl&&((be=V0(A.repoUrl))==null?void 0:be.repo)===ee.repo?` · linked on alphaXiv${A.repoStars!=null?` · ★ ${A.repoStars}`:""}`:""):c.trim()?"Paste a GitHub URL or owner/repo":"No code linked to this paper — a blank private repo will be created"})]}),V,ae,!ee&&oe]})),n==="new"&&m.jsxs(m.Fragment,{children:[ae,oe]}),C&&m.jsx("div",{className:"error",children:C}),m.jsxs("div",{className:"actions",children:[t&&m.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!B||g,children:g?pe?"Creating repo…":s==="fork"?"Copying repo…":"Cloning repo…":"Create project"})]})]})}function s6({projects:e,onOpen:t,onCreated:n,onDeleted:r,openNewProject:s=!1,onNewProjectOpened:a}){const[c,l]=P.useState(s),[u,h]=P.useState(null);P.useEffect(()=>{s&&(a==null||a())},[]);async function p(f){if(window.confirm(`Delete project "${f.name}"? +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(M){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame((()=>this._refresh()))),_.isLinux&&M&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(M){const R=this._getMouseBufferCoords(M),z=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!!(z&&H&&R)&&this._areCoordsInSelection(R,z,H)}isCellInSelection(M,R){const z=this._model.finalSelectionStart,H=this._model.finalSelectionEnd;return!(!z||!H)&&this._areCoordsInSelection([M,R],z,H)}_areCoordsInSelection(M,R,z){return M[1]>R[1]&&M[1]=R[0]&&M[0]=R[0]}_selectWordAtCursor(M,R){var $,U;const z=(U=($=this._linkifier.currentLink)==null?void 0:$.link)==null?void 0:U.range;if(z)return this._model.selectionStart=[z.start.x-1,z.start.y-1],this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const H=this._getMouseBufferCoords(M);return!!H&&(this._selectWordAt(H,R),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(M,R){this._model.clearSelection(),M=Math.max(M,0),R=Math.min(R,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,M],this._model.selectionEnd=[this._bufferService.cols,R],this.refresh(),this._onSelectionChange.fire()}_handleTrim(M){this._model.handleTrim(M)&&this.refresh()}_getMouseBufferCoords(M){const R=this._mouseService.getCoords(M,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(R)return R[0]--,R[1]--,R[1]+=this._bufferService.buffer.ydisp,R}_getMouseEventScrollAmount(M){let R=(0,f.getCoordsRelativeToElement)(this._coreBrowserService.window,M,this._screenElement)[1];const z=this._renderService.dimensions.css.canvas.height;return R>=0&&R<=z?0:(R>z&&(R-=z),R=Math.min(Math.max(R,-50),50),R/=50,R/Math.abs(R)+Math.round(14*R))}shouldForceSelection(M){return _.isMac?M.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:M.shiftKey}handleMouseDown(M){if(this._mouseDownTimeStamp=M.timeStamp,(M.button!==2||!this.hasSelection)&&M.button===0){if(!this._enabled){if(!this.shouldForceSelection(M))return;M.stopPropagation()}M.preventDefault(),this._dragScrollAmount=0,this._enabled&&M.shiftKey?this._handleIncrementalClick(M):M.detail===1?this._handleSingleClick(M):M.detail===2?this._handleDoubleClick(M):M.detail===3&&this._handleTripleClick(M),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval((()=>this._dragScroll()),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_handleIncrementalClick(M){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(M))}_handleSingleClick(M){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(M)?3:0,this._model.selectionStart=this._getMouseBufferCoords(M),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const R=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);R&&R.length!==this._model.selectionStart[0]&&R.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_handleDoubleClick(M){this._selectWordAtCursor(M,!0)&&(this._activeSelectionMode=1)}_handleTripleClick(M){const R=this._getMouseBufferCoords(M);R&&(this._activeSelectionMode=2,this._selectLineAt(R[1]))}shouldColumnSelect(M){return M.altKey&&!(_.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(M){if(M.stopImmediatePropagation(),!this._model.selectionStart)return;const R=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(M),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const z=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(M.ydisp+this._bufferService.rows,M.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=M.ydisp),this.refresh()}}_handleMouseUp(M){const R=M.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&R<500&&M.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const z=this._mouseService.getCoords(M,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(z&&z[0]!==void 0&&z[1]!==void 0){const H=(0,g.moveToCellSequence)(z[0]-1,z[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(H,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const M=this._model.finalSelectionStart,R=this._model.finalSelectionEnd,z=!(!M||!R||M[0]===R[0]&&M[1]===R[1]);z?M&&R&&(this._oldSelectionStart&&this._oldSelectionEnd&&M[0]===this._oldSelectionStart[0]&&M[1]===this._oldSelectionStart[1]&&R[0]===this._oldSelectionEnd[0]&&R[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(M,R,z)):this._oldHasSelection&&this._fireOnSelectionChange(M,R,z)}_fireOnSelectionChange(M,R,z){this._oldSelectionStart=M,this._oldSelectionEnd=R,this._oldHasSelection=z,this._onSelectionChange.fire()}_handleBufferActivate(M){this.clearSelection(),this._trimListener.dispose(),this._trimListener=M.activeBuffer.lines.onTrim((R=>this._handleTrim(R)))}_convertViewportColToCharacterIndex(M,R){let z=R;for(let H=0;R>=H;H++){const $=M.loadCell(H,this._workCell).getChars().length;this._workCell.getWidth()===0?z--:$>1&&R!==H&&(z+=$-1)}return z}setSelection(M,R,z){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[M,R],this._model.selectionStartLength=z,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(M){this._isClickInSelection(M)||(this._selectWordAtCursor(M,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(M,R,z=!0,H=!0){if(M[0]>=this._bufferService.cols)return;const $=this._bufferService.buffer,U=$.lines.get(M[1]);if(!U)return;const q=$.translateBufferLineToString(M[1],!1);let K=this._convertViewportColToCharacterIndex(U,M[0]),Y=K;const Q=M[0]-K;let ee=0,B=0,L=0,O=0;if(q.charAt(K)===" "){for(;K>0&&q.charAt(K-1)===" ";)K--;for(;Y1&&(O+=pe-1,Y+=pe-1);ie>0&&K>0&&!this._isCharWordSeparator(U.loadCell(ie-1,this._workCell));){U.loadCell(ie-1,this._workCell);const te=this._workCell.getChars().length;this._workCell.getWidth()===0?(ee++,ie--):te>1&&(L+=te-1,K-=te-1),K--,ie--}for(;fe1&&(O+=te-1,Y+=te-1),Y++,fe++}}Y++;let W=K+Q-ee+L,G=Math.min(this._bufferService.cols,Y-K+ee+B-L-O);if(R||q.slice(K,Y).trim()!==""){if(z&&W===0&&U.getCodePoint(0)!==32){const ie=$.lines.get(M[1]-1);if(ie&&U.isWrapped&&ie.getCodePoint(this._bufferService.cols-1)!==32){const fe=this._getWordAt([this._bufferService.cols-1,M[1]-1],!1,!0,!1);if(fe){const pe=this._bufferService.cols-fe.start;W-=pe,G+=pe}}}if(H&&W+G===this._bufferService.cols&&U.getCodePoint(this._bufferService.cols-1)!==32){const ie=$.lines.get(M[1]+1);if(ie!=null&&ie.isWrapped&&ie.getCodePoint(0)!==32){const fe=this._getWordAt([0,M[1]+1],!1,!1,!0);fe&&(G+=fe.length)}}return{start:W,length:G}}}_selectWordAt(M,R){const z=this._getWordAt(M,R);if(z){for(;z.start<0;)z.start+=this._bufferService.cols,M[1]--;this._model.selectionStart=[z.start,M[1]],this._model.selectionStartLength=z.length}}_selectToWordAt(M){const R=this._getWordAt(M,!0);if(R){let z=M[1];for(;R.start<0;)R.start+=this._bufferService.cols,z--;if(!this._model.areSelectionValuesReversed())for(;R.start+R.length>this._bufferService.cols;)R.length-=this._bufferService.cols,z++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?R.start:R.start+R.length,z]}}_isCharWordSeparator(M){return M.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(M.getChars())>=0}_selectLineAt(M){const R=this._bufferService.buffer.getWrappedRangeForLine(M),z={start:{x:0,y:R.first},end:{x:this._bufferService.cols-1,y:R.last}};this._model.selectionStart=[0,R.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,x.getRangeLength)(z,this._bufferService.cols)}};l.SelectionService=D=h([p(3,E.IBufferService),p(4,E.ICoreService),p(5,C.IMouseService),p(6,E.IOptionsService),p(7,C.IRenderService),p(8,C.ICoreBrowserService)],D)},4725:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ILinkProviderService=l.IThemeService=l.ICharacterJoinerService=l.ISelectionService=l.IRenderService=l.IMouseService=l.ICoreBrowserService=l.ICharSizeService=void 0;const h=u(8343);l.ICharSizeService=(0,h.createDecorator)("CharSizeService"),l.ICoreBrowserService=(0,h.createDecorator)("CoreBrowserService"),l.IMouseService=(0,h.createDecorator)("MouseService"),l.IRenderService=(0,h.createDecorator)("RenderService"),l.ISelectionService=(0,h.createDecorator)("SelectionService"),l.ICharacterJoinerService=(0,h.createDecorator)("CharacterJoinerService"),l.IThemeService=(0,h.createDecorator)("ThemeService"),l.ILinkProviderService=(0,h.createDecorator)("LinkProviderService")},6731:function(c,l,u){var h=this&&this.__decorate||function(D,M,R,z){var H,$=arguments.length,U=$<3?M:z===null?z=Object.getOwnPropertyDescriptor(M,R):z;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")U=Reflect.decorate(D,M,R,z);else for(var q=D.length-1;q>=0;q--)(H=D[q])&&(U=($<3?H(U):$>3?H(M,R,U):H(M,R))||U);return $>3&&U&&Object.defineProperty(M,R,U),U},p=this&&this.__param||function(D,M){return function(R,z){M(R,z,D)}};Object.defineProperty(l,"__esModule",{value:!0}),l.ThemeService=l.DEFAULT_ANSI_COLORS=void 0;const f=u(7239),g=u(8055),y=u(8460),C=u(844),w=u(2585),b=g.css.toColor("#ffffff"),_=g.css.toColor("#000000"),x=g.css.toColor("#ffffff"),S=g.css.toColor("#000000"),E={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};l.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const D=[g.css.toColor("#2e3436"),g.css.toColor("#cc0000"),g.css.toColor("#4e9a06"),g.css.toColor("#c4a000"),g.css.toColor("#3465a4"),g.css.toColor("#75507b"),g.css.toColor("#06989a"),g.css.toColor("#d3d7cf"),g.css.toColor("#555753"),g.css.toColor("#ef2929"),g.css.toColor("#8ae234"),g.css.toColor("#fce94f"),g.css.toColor("#729fcf"),g.css.toColor("#ad7fa8"),g.css.toColor("#34e2e2"),g.css.toColor("#eeeeec")],M=[0,95,135,175,215,255];for(let R=0;R<216;R++){const z=M[R/36%6|0],H=M[R/6%6|0],$=M[R%6];D.push({css:g.channels.toCss(z,H,$),rgba:g.channels.toRgba(z,H,$)})}for(let R=0;R<24;R++){const z=8+10*R;D.push({css:g.channels.toCss(z,z,z),rgba:g.channels.toRgba(z,z,z)})}return D})());let T=l.ThemeService=class extends C.Disposable{get colors(){return this._colors}constructor(D){super(),this._optionsService=D,this._contrastCache=new f.ColorContrastCache,this._halfContrastCache=new f.ColorContrastCache,this._onChangeColors=this.register(new y.EventEmitter),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:b,background:_,cursor:x,cursorAccent:S,selectionForeground:void 0,selectionBackgroundTransparent:E,selectionBackgroundOpaque:g.color.blend(_,E),selectionInactiveBackgroundTransparent:E,selectionInactiveBackgroundOpaque:g.color.blend(_,E),ansi:l.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this.register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",(()=>this._contrastCache.clear()))),this.register(this._optionsService.onSpecificOptionChange("theme",(()=>this._setTheme(this._optionsService.rawOptions.theme))))}_setTheme(D={}){const M=this._colors;if(M.foreground=A(D.foreground,b),M.background=A(D.background,_),M.cursor=A(D.cursor,x),M.cursorAccent=A(D.cursorAccent,S),M.selectionBackgroundTransparent=A(D.selectionBackground,E),M.selectionBackgroundOpaque=g.color.blend(M.background,M.selectionBackgroundTransparent),M.selectionInactiveBackgroundTransparent=A(D.selectionInactiveBackground,M.selectionBackgroundTransparent),M.selectionInactiveBackgroundOpaque=g.color.blend(M.background,M.selectionInactiveBackgroundTransparent),M.selectionForeground=D.selectionForeground?A(D.selectionForeground,g.NULL_COLOR):void 0,M.selectionForeground===g.NULL_COLOR&&(M.selectionForeground=void 0),g.color.isOpaque(M.selectionBackgroundTransparent)&&(M.selectionBackgroundTransparent=g.color.opacity(M.selectionBackgroundTransparent,.3)),g.color.isOpaque(M.selectionInactiveBackgroundTransparent)&&(M.selectionInactiveBackgroundTransparent=g.color.opacity(M.selectionInactiveBackgroundTransparent,.3)),M.ansi=l.DEFAULT_ANSI_COLORS.slice(),M.ansi[0]=A(D.black,l.DEFAULT_ANSI_COLORS[0]),M.ansi[1]=A(D.red,l.DEFAULT_ANSI_COLORS[1]),M.ansi[2]=A(D.green,l.DEFAULT_ANSI_COLORS[2]),M.ansi[3]=A(D.yellow,l.DEFAULT_ANSI_COLORS[3]),M.ansi[4]=A(D.blue,l.DEFAULT_ANSI_COLORS[4]),M.ansi[5]=A(D.magenta,l.DEFAULT_ANSI_COLORS[5]),M.ansi[6]=A(D.cyan,l.DEFAULT_ANSI_COLORS[6]),M.ansi[7]=A(D.white,l.DEFAULT_ANSI_COLORS[7]),M.ansi[8]=A(D.brightBlack,l.DEFAULT_ANSI_COLORS[8]),M.ansi[9]=A(D.brightRed,l.DEFAULT_ANSI_COLORS[9]),M.ansi[10]=A(D.brightGreen,l.DEFAULT_ANSI_COLORS[10]),M.ansi[11]=A(D.brightYellow,l.DEFAULT_ANSI_COLORS[11]),M.ansi[12]=A(D.brightBlue,l.DEFAULT_ANSI_COLORS[12]),M.ansi[13]=A(D.brightMagenta,l.DEFAULT_ANSI_COLORS[13]),M.ansi[14]=A(D.brightCyan,l.DEFAULT_ANSI_COLORS[14]),M.ansi[15]=A(D.brightWhite,l.DEFAULT_ANSI_COLORS[15]),D.extendedAnsi){const R=Math.min(M.ansi.length-16,D.extendedAnsi.length);for(let z=0;z{Object.defineProperty(l,"__esModule",{value:!0}),l.CircularList=void 0;const h=u(8460),p=u(844);class f extends p.Disposable{constructor(y){super(),this._maxLength=y,this.onDeleteEmitter=this.register(new h.EventEmitter),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this.register(new h.EventEmitter),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this.register(new h.EventEmitter),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(y){if(this._maxLength===y)return;const C=new Array(y);for(let w=0;wthis._length)for(let C=this._length;C=y;b--)this._array[this._getCyclicIndex(b+w.length)]=this._array[this._getCyclicIndex(b)];for(let b=0;bthis._maxLength){const b=this._length+w.length-this._maxLength;this._startIndex+=b,this._length=this._maxLength,this.onTrimEmitter.fire(b)}else this._length+=w.length}trimStart(y){y>this._length&&(y=this._length),this._startIndex+=y,this._length-=y,this.onTrimEmitter.fire(y)}shiftElements(y,C,w){if(!(C<=0)){if(y<0||y>=this._length)throw new Error("start argument out of range");if(y+w<0)throw new Error("Cannot shift elements in list beyond index 0");if(w>0){for(let _=C-1;_>=0;_--)this.set(y+_+w,this.get(y+_));const b=y+C+w-this._length;if(b>0)for(this._length+=b;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let b=0;b{Object.defineProperty(l,"__esModule",{value:!0}),l.clone=void 0,l.clone=function u(h,p=5){if(typeof h!="object")return h;const f=Array.isArray(h)?[]:{};for(const g in h)f[g]=p<=1?h[g]:h[g]&&u(h[g],p-1);return f}},8055:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.contrastRatio=l.toPaddedHex=l.rgba=l.rgb=l.css=l.color=l.channels=l.NULL_COLOR=void 0;let u=0,h=0,p=0,f=0;var g,y,C,w,b;function _(S){const E=S.toString(16);return E.length<2?"0"+E:E}function x(S,E){return S>>0},S.toColor=function(E,T,A,D){return{css:S.toCss(E,T,A,D),rgba:S.toRgba(E,T,A,D)}}})(g||(l.channels=g={})),(function(S){function E(T,A){return f=Math.round(255*A),[u,h,p]=b.toChannels(T.rgba),{css:g.toCss(u,h,p,f),rgba:g.toRgba(u,h,p,f)}}S.blend=function(T,A){if(f=(255&A.rgba)/255,f===1)return{css:A.css,rgba:A.rgba};const D=A.rgba>>24&255,M=A.rgba>>16&255,R=A.rgba>>8&255,z=T.rgba>>24&255,H=T.rgba>>16&255,$=T.rgba>>8&255;return u=z+Math.round((D-z)*f),h=H+Math.round((M-H)*f),p=$+Math.round((R-$)*f),{css:g.toCss(u,h,p),rgba:g.toRgba(u,h,p)}},S.isOpaque=function(T){return(255&T.rgba)==255},S.ensureContrastRatio=function(T,A,D){const M=b.ensureContrastRatio(T.rgba,A.rgba,D);if(M)return g.toColor(M>>24&255,M>>16&255,M>>8&255)},S.opaque=function(T){const A=(255|T.rgba)>>>0;return[u,h,p]=b.toChannels(A),{css:g.toCss(u,h,p),rgba:A}},S.opacity=E,S.multiplyOpacity=function(T,A){return f=255&T.rgba,E(T,f*A/255)},S.toColorRGB=function(T){return[T.rgba>>24&255,T.rgba>>16&255,T.rgba>>8&255]}})(y||(l.color=y={})),(function(S){let E,T;try{const A=document.createElement("canvas");A.width=1,A.height=1;const D=A.getContext("2d",{willReadFrequently:!0});D&&(E=D,E.globalCompositeOperation="copy",T=E.createLinearGradient(0,0,1,1))}catch{}S.toColor=function(A){if(A.match(/#[\da-f]{3,8}/i))switch(A.length){case 4:return u=parseInt(A.slice(1,2).repeat(2),16),h=parseInt(A.slice(2,3).repeat(2),16),p=parseInt(A.slice(3,4).repeat(2),16),g.toColor(u,h,p);case 5:return u=parseInt(A.slice(1,2).repeat(2),16),h=parseInt(A.slice(2,3).repeat(2),16),p=parseInt(A.slice(3,4).repeat(2),16),f=parseInt(A.slice(4,5).repeat(2),16),g.toColor(u,h,p,f);case 7:return{css:A,rgba:(parseInt(A.slice(1),16)<<8|255)>>>0};case 9:return{css:A,rgba:parseInt(A.slice(1),16)>>>0}}const D=A.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(D)return u=parseInt(D[1]),h=parseInt(D[2]),p=parseInt(D[3]),f=Math.round(255*(D[5]===void 0?1:parseFloat(D[5]))),g.toColor(u,h,p,f);if(!E||!T)throw new Error("css.toColor: Unsupported css format");if(E.fillStyle=T,E.fillStyle=A,typeof E.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(E.fillRect(0,0,1,1),[u,h,p,f]=E.getImageData(0,0,1,1).data,f!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:g.toRgba(u,h,p,f),css:A}}})(C||(l.css=C={})),(function(S){function E(T,A,D){const M=T/255,R=A/255,z=D/255;return .2126*(M<=.03928?M/12.92:Math.pow((M+.055)/1.055,2.4))+.7152*(R<=.03928?R/12.92:Math.pow((R+.055)/1.055,2.4))+.0722*(z<=.03928?z/12.92:Math.pow((z+.055)/1.055,2.4))}S.relativeLuminance=function(T){return E(T>>16&255,T>>8&255,255&T)},S.relativeLuminance2=E})(w||(l.rgb=w={})),(function(S){function E(A,D,M){const R=A>>24&255,z=A>>16&255,H=A>>8&255;let $=D>>24&255,U=D>>16&255,q=D>>8&255,K=x(w.relativeLuminance2($,U,q),w.relativeLuminance2(R,z,H));for(;K0||U>0||q>0);)$-=Math.max(0,Math.ceil(.1*$)),U-=Math.max(0,Math.ceil(.1*U)),q-=Math.max(0,Math.ceil(.1*q)),K=x(w.relativeLuminance2($,U,q),w.relativeLuminance2(R,z,H));return($<<24|U<<16|q<<8|255)>>>0}function T(A,D,M){const R=A>>24&255,z=A>>16&255,H=A>>8&255;let $=D>>24&255,U=D>>16&255,q=D>>8&255,K=x(w.relativeLuminance2($,U,q),w.relativeLuminance2(R,z,H));for(;K>>0}S.blend=function(A,D){if(f=(255&D)/255,f===1)return D;const M=D>>24&255,R=D>>16&255,z=D>>8&255,H=A>>24&255,$=A>>16&255,U=A>>8&255;return u=H+Math.round((M-H)*f),h=$+Math.round((R-$)*f),p=U+Math.round((z-U)*f),g.toRgba(u,h,p)},S.ensureContrastRatio=function(A,D,M){const R=w.relativeLuminance(A>>8),z=w.relativeLuminance(D>>8);if(x(R,z)>8));if(qx(R,w.relativeLuminance(K>>8))?U:K}return U}const H=T(A,D,M),$=x(R,w.relativeLuminance(H>>8));if($x(R,w.relativeLuminance(U>>8))?H:U}return H}},S.reduceLuminance=E,S.increaseLuminance=T,S.toChannels=function(A){return[A>>24&255,A>>16&255,A>>8&255,255&A]}})(b||(l.rgba=b={})),l.toPaddedHex=_,l.contrastRatio=x},8969:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CoreTerminal=void 0;const h=u(844),p=u(2585),f=u(4348),g=u(7866),y=u(744),C=u(7302),w=u(6975),b=u(8460),_=u(1753),x=u(1480),S=u(7994),E=u(9282),T=u(5435),A=u(5981),D=u(2660);let M=!1;class R extends h.Disposable{get onScroll(){return this._onScrollApi||(this._onScrollApi=this.register(new b.EventEmitter),this._onScroll.event((H=>{var $;($=this._onScrollApi)==null||$.fire(H.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(H){for(const $ in H)this.optionsService.options[$]=H[$]}constructor(H){super(),this._windowsWrappingHeuristics=this.register(new h.MutableDisposable),this._onBinary=this.register(new b.EventEmitter),this.onBinary=this._onBinary.event,this._onData=this.register(new b.EventEmitter),this.onData=this._onData.event,this._onLineFeed=this.register(new b.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onResize=this.register(new b.EventEmitter),this.onResize=this._onResize.event,this._onWriteParsed=this.register(new b.EventEmitter),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this.register(new b.EventEmitter),this._instantiationService=new f.InstantiationService,this.optionsService=this.register(new C.OptionsService(H)),this._instantiationService.setService(p.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(y.BufferService)),this._instantiationService.setService(p.IBufferService,this._bufferService),this._logService=this.register(this._instantiationService.createInstance(g.LogService)),this._instantiationService.setService(p.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(w.CoreService)),this._instantiationService.setService(p.ICoreService,this.coreService),this.coreMouseService=this.register(this._instantiationService.createInstance(_.CoreMouseService)),this._instantiationService.setService(p.ICoreMouseService,this.coreMouseService),this.unicodeService=this.register(this._instantiationService.createInstance(x.UnicodeService)),this._instantiationService.setService(p.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(S.CharsetService),this._instantiationService.setService(p.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(D.OscLinkService),this._instantiationService.setService(p.IOscLinkService,this._oscLinkService),this._inputHandler=this.register(new T.InputHandler(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this.register((0,b.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,b.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,b.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,b.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.coreService.onRequestScrollToBottom((()=>this.scrollToBottom()))),this.register(this.coreService.onUserInput((()=>this._writeBuffer.handleUserInput()))),this.register(this.optionsService.onMultipleOptionChange(["windowsMode","windowsPty"],(()=>this._handleWindowsPtyOptionChange()))),this.register(this._bufferService.onScroll(($=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this.register(this._inputHandler.onScroll(($=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._inputHandler.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)}))),this._writeBuffer=this.register(new A.WriteBuffer((($,U)=>this._inputHandler.parse($,U)))),this.register((0,b.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}write(H,$){this._writeBuffer.write(H,$)}writeSync(H,$){this._logService.logLevel<=p.LogLevelEnum.WARN&&!M&&(this._logService.warn("writeSync is unreliable and will be removed soon."),M=!0),this._writeBuffer.writeSync(H,$)}input(H,$=!0){this.coreService.triggerDataEvent(H,$)}resize(H,$){isNaN(H)||isNaN($)||(H=Math.max(H,y.MINIMUM_COLS),$=Math.max($,y.MINIMUM_ROWS),this._bufferService.resize(H,$))}scroll(H,$=!1){this._bufferService.scroll(H,$)}scrollLines(H,$,U){this._bufferService.scrollLines(H,$,U)}scrollPages(H){this.scrollLines(H*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(H){const $=H-this._bufferService.buffer.ydisp;$!==0&&this.scrollLines($)}registerEscHandler(H,$){return this._inputHandler.registerEscHandler(H,$)}registerDcsHandler(H,$){return this._inputHandler.registerDcsHandler(H,$)}registerCsiHandler(H,$){return this._inputHandler.registerCsiHandler(H,$)}registerOscHandler(H,$){return this._inputHandler.registerOscHandler(H,$)}_setup(){this._handleWindowsPtyOptionChange()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_handleWindowsPtyOptionChange(){let H=!1;const $=this.optionsService.rawOptions.windowsPty;$&&$.buildNumber!==void 0&&$.buildNumber!==void 0?H=$.backend==="conpty"&&$.buildNumber<21376:this.optionsService.rawOptions.windowsMode&&(H=!0),H?this._enableWindowsWrappingHeuristics():this._windowsWrappingHeuristics.clear()}_enableWindowsWrappingHeuristics(){if(!this._windowsWrappingHeuristics.value){const H=[];H.push(this.onLineFeed(E.updateWindowsModeWrappedState.bind(null,this._bufferService))),H.push(this.registerCsiHandler({final:"H"},(()=>((0,E.updateWindowsModeWrappedState)(this._bufferService),!1)))),this._windowsWrappingHeuristics.value=(0,h.toDisposable)((()=>{for(const $ of H)$.dispose()}))}}}l.CoreTerminal=R},8460:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.runAndSubscribe=l.forwardEvent=l.EventEmitter=void 0,l.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=u=>(this._listeners.push(u),{dispose:()=>{if(!this._disposed){for(let h=0;hh.fire(p)))},l.runAndSubscribe=function(u,h){return h(void 0),u((p=>h(p)))}},5435:function(c,l,u){var h=this&&this.__decorate||function(ee,B,L,O){var W,G=arguments.length,ie=G<3?B:O===null?O=Object.getOwnPropertyDescriptor(B,L):O;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")ie=Reflect.decorate(ee,B,L,O);else for(var fe=ee.length-1;fe>=0;fe--)(W=ee[fe])&&(ie=(G<3?W(ie):G>3?W(B,L,ie):W(B,L))||ie);return G>3&&ie&&Object.defineProperty(B,L,ie),ie},p=this&&this.__param||function(ee,B){return function(L,O){B(L,O,ee)}};Object.defineProperty(l,"__esModule",{value:!0}),l.InputHandler=l.WindowsOptionsReportType=void 0;const f=u(2584),g=u(7116),y=u(2015),C=u(844),w=u(482),b=u(8437),_=u(8460),x=u(643),S=u(511),E=u(3734),T=u(2585),A=u(1480),D=u(6242),M=u(6351),R=u(5941),z={"(":0,")":1,"*":2,"+":3,"-":1,".":2},H=131072;function $(ee,B){if(ee>24)return B.setWinLines||!1;switch(ee){case 1:return!!B.restoreWin;case 2:return!!B.minimizeWin;case 3:return!!B.setWinPosition;case 4:return!!B.setWinSizePixels;case 5:return!!B.raiseWin;case 6:return!!B.lowerWin;case 7:return!!B.refreshWin;case 8:return!!B.setWinSizeChars;case 9:return!!B.maximizeWin;case 10:return!!B.fullscreenWin;case 11:return!!B.getWinState;case 13:return!!B.getWinPosition;case 14:return!!B.getWinSizePixels;case 15:return!!B.getScreenSizePixels;case 16:return!!B.getCellSizePixels;case 18:return!!B.getWinSizeChars;case 19:return!!B.getScreenSizeChars;case 20:return!!B.getIconTitle;case 21:return!!B.getWinTitle;case 22:return!!B.pushTitle;case 23:return!!B.popTitle;case 24:return!!B.setWinLines}return!1}var U;(function(ee){ee[ee.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",ee[ee.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(U||(l.WindowsOptionsReportType=U={}));let q=0;class K extends C.Disposable{getAttrData(){return this._curAttrData}constructor(B,L,O,W,G,ie,fe,pe,te=new y.EscapeSequenceParser){super(),this._bufferService=B,this._charsetService=L,this._coreService=O,this._logService=W,this._optionsService=G,this._oscLinkService=ie,this._coreMouseService=fe,this._unicodeService=pe,this._parser=te,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new w.StringToUtf32,this._utf8Decoder=new w.Utf8ToUtf32,this._workCell=new S.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=this.register(new _.EventEmitter),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this.register(new _.EventEmitter),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this.register(new _.EventEmitter),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this.register(new _.EventEmitter),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this.register(new _.EventEmitter),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this.register(new _.EventEmitter),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this.register(new _.EventEmitter),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this.register(new _.EventEmitter),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this.register(new _.EventEmitter),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this.register(new _.EventEmitter),this.onLineFeed=this._onLineFeed.event,this._onScroll=this.register(new _.EventEmitter),this.onScroll=this._onScroll.event,this._onTitleChange=this.register(new _.EventEmitter),this.onTitleChange=this._onTitleChange.event,this._onColor=this.register(new _.EventEmitter),this.onColor=this._onColor.event,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._dirtyRowTracker=new Y(this._bufferService),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate((V=>this._activeBuffer=V.activeBuffer))),this._parser.setCsiHandlerFallback(((V,ae)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(V),params:ae.toArray()})})),this._parser.setEscHandlerFallback((V=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(V)})})),this._parser.setExecuteHandlerFallback((V=>{this._logService.debug("Unknown EXECUTE code: ",{code:V})})),this._parser.setOscHandlerFallback(((V,ae,oe)=>{this._logService.debug("Unknown OSC code: ",{identifier:V,action:ae,data:oe})})),this._parser.setDcsHandlerFallback(((V,ae,oe)=>{ae==="HOOK"&&(oe=oe.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(V),action:ae,payload:oe})})),this._parser.setPrintHandler(((V,ae,oe)=>this.print(V,ae,oe))),this._parser.registerCsiHandler({final:"@"},(V=>this.insertChars(V))),this._parser.registerCsiHandler({intermediates:" ",final:"@"},(V=>this.scrollLeft(V))),this._parser.registerCsiHandler({final:"A"},(V=>this.cursorUp(V))),this._parser.registerCsiHandler({intermediates:" ",final:"A"},(V=>this.scrollRight(V))),this._parser.registerCsiHandler({final:"B"},(V=>this.cursorDown(V))),this._parser.registerCsiHandler({final:"C"},(V=>this.cursorForward(V))),this._parser.registerCsiHandler({final:"D"},(V=>this.cursorBackward(V))),this._parser.registerCsiHandler({final:"E"},(V=>this.cursorNextLine(V))),this._parser.registerCsiHandler({final:"F"},(V=>this.cursorPrecedingLine(V))),this._parser.registerCsiHandler({final:"G"},(V=>this.cursorCharAbsolute(V))),this._parser.registerCsiHandler({final:"H"},(V=>this.cursorPosition(V))),this._parser.registerCsiHandler({final:"I"},(V=>this.cursorForwardTab(V))),this._parser.registerCsiHandler({final:"J"},(V=>this.eraseInDisplay(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"J"},(V=>this.eraseInDisplay(V,!0))),this._parser.registerCsiHandler({final:"K"},(V=>this.eraseInLine(V,!1))),this._parser.registerCsiHandler({prefix:"?",final:"K"},(V=>this.eraseInLine(V,!0))),this._parser.registerCsiHandler({final:"L"},(V=>this.insertLines(V))),this._parser.registerCsiHandler({final:"M"},(V=>this.deleteLines(V))),this._parser.registerCsiHandler({final:"P"},(V=>this.deleteChars(V))),this._parser.registerCsiHandler({final:"S"},(V=>this.scrollUp(V))),this._parser.registerCsiHandler({final:"T"},(V=>this.scrollDown(V))),this._parser.registerCsiHandler({final:"X"},(V=>this.eraseChars(V))),this._parser.registerCsiHandler({final:"Z"},(V=>this.cursorBackwardTab(V))),this._parser.registerCsiHandler({final:"`"},(V=>this.charPosAbsolute(V))),this._parser.registerCsiHandler({final:"a"},(V=>this.hPositionRelative(V))),this._parser.registerCsiHandler({final:"b"},(V=>this.repeatPrecedingCharacter(V))),this._parser.registerCsiHandler({final:"c"},(V=>this.sendDeviceAttributesPrimary(V))),this._parser.registerCsiHandler({prefix:">",final:"c"},(V=>this.sendDeviceAttributesSecondary(V))),this._parser.registerCsiHandler({final:"d"},(V=>this.linePosAbsolute(V))),this._parser.registerCsiHandler({final:"e"},(V=>this.vPositionRelative(V))),this._parser.registerCsiHandler({final:"f"},(V=>this.hVPosition(V))),this._parser.registerCsiHandler({final:"g"},(V=>this.tabClear(V))),this._parser.registerCsiHandler({final:"h"},(V=>this.setMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"h"},(V=>this.setModePrivate(V))),this._parser.registerCsiHandler({final:"l"},(V=>this.resetMode(V))),this._parser.registerCsiHandler({prefix:"?",final:"l"},(V=>this.resetModePrivate(V))),this._parser.registerCsiHandler({final:"m"},(V=>this.charAttributes(V))),this._parser.registerCsiHandler({final:"n"},(V=>this.deviceStatus(V))),this._parser.registerCsiHandler({prefix:"?",final:"n"},(V=>this.deviceStatusPrivate(V))),this._parser.registerCsiHandler({intermediates:"!",final:"p"},(V=>this.softReset(V))),this._parser.registerCsiHandler({intermediates:" ",final:"q"},(V=>this.setCursorStyle(V))),this._parser.registerCsiHandler({final:"r"},(V=>this.setScrollRegion(V))),this._parser.registerCsiHandler({final:"s"},(V=>this.saveCursor(V))),this._parser.registerCsiHandler({final:"t"},(V=>this.windowOptions(V))),this._parser.registerCsiHandler({final:"u"},(V=>this.restoreCursor(V))),this._parser.registerCsiHandler({intermediates:"'",final:"}"},(V=>this.insertColumns(V))),this._parser.registerCsiHandler({intermediates:"'",final:"~"},(V=>this.deleteColumns(V))),this._parser.registerCsiHandler({intermediates:'"',final:"q"},(V=>this.selectProtected(V))),this._parser.registerCsiHandler({intermediates:"$",final:"p"},(V=>this.requestMode(V,!0))),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},(V=>this.requestMode(V,!1))),this._parser.setExecuteHandler(f.C0.BEL,(()=>this.bell())),this._parser.setExecuteHandler(f.C0.LF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.VT,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.FF,(()=>this.lineFeed())),this._parser.setExecuteHandler(f.C0.CR,(()=>this.carriageReturn())),this._parser.setExecuteHandler(f.C0.BS,(()=>this.backspace())),this._parser.setExecuteHandler(f.C0.HT,(()=>this.tab())),this._parser.setExecuteHandler(f.C0.SO,(()=>this.shiftOut())),this._parser.setExecuteHandler(f.C0.SI,(()=>this.shiftIn())),this._parser.setExecuteHandler(f.C1.IND,(()=>this.index())),this._parser.setExecuteHandler(f.C1.NEL,(()=>this.nextLine())),this._parser.setExecuteHandler(f.C1.HTS,(()=>this.tabSet())),this._parser.registerOscHandler(0,new D.OscHandler((V=>(this.setTitle(V),this.setIconName(V),!0)))),this._parser.registerOscHandler(1,new D.OscHandler((V=>this.setIconName(V)))),this._parser.registerOscHandler(2,new D.OscHandler((V=>this.setTitle(V)))),this._parser.registerOscHandler(4,new D.OscHandler((V=>this.setOrReportIndexedColor(V)))),this._parser.registerOscHandler(8,new D.OscHandler((V=>this.setHyperlink(V)))),this._parser.registerOscHandler(10,new D.OscHandler((V=>this.setOrReportFgColor(V)))),this._parser.registerOscHandler(11,new D.OscHandler((V=>this.setOrReportBgColor(V)))),this._parser.registerOscHandler(12,new D.OscHandler((V=>this.setOrReportCursorColor(V)))),this._parser.registerOscHandler(104,new D.OscHandler((V=>this.restoreIndexedColor(V)))),this._parser.registerOscHandler(110,new D.OscHandler((V=>this.restoreFgColor(V)))),this._parser.registerOscHandler(111,new D.OscHandler((V=>this.restoreBgColor(V)))),this._parser.registerOscHandler(112,new D.OscHandler((V=>this.restoreCursorColor(V)))),this._parser.registerEscHandler({final:"7"},(()=>this.saveCursor())),this._parser.registerEscHandler({final:"8"},(()=>this.restoreCursor())),this._parser.registerEscHandler({final:"D"},(()=>this.index())),this._parser.registerEscHandler({final:"E"},(()=>this.nextLine())),this._parser.registerEscHandler({final:"H"},(()=>this.tabSet())),this._parser.registerEscHandler({final:"M"},(()=>this.reverseIndex())),this._parser.registerEscHandler({final:"="},(()=>this.keypadApplicationMode())),this._parser.registerEscHandler({final:">"},(()=>this.keypadNumericMode())),this._parser.registerEscHandler({final:"c"},(()=>this.fullReset())),this._parser.registerEscHandler({final:"n"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"o"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"|"},(()=>this.setgLevel(3))),this._parser.registerEscHandler({final:"}"},(()=>this.setgLevel(2))),this._parser.registerEscHandler({final:"~"},(()=>this.setgLevel(1))),this._parser.registerEscHandler({intermediates:"%",final:"@"},(()=>this.selectDefaultCharset())),this._parser.registerEscHandler({intermediates:"%",final:"G"},(()=>this.selectDefaultCharset()));for(const V in g.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:V},(()=>this.selectCharset("("+V))),this._parser.registerEscHandler({intermediates:")",final:V},(()=>this.selectCharset(")"+V))),this._parser.registerEscHandler({intermediates:"*",final:V},(()=>this.selectCharset("*"+V))),this._parser.registerEscHandler({intermediates:"+",final:V},(()=>this.selectCharset("+"+V))),this._parser.registerEscHandler({intermediates:"-",final:V},(()=>this.selectCharset("-"+V))),this._parser.registerEscHandler({intermediates:".",final:V},(()=>this.selectCharset("."+V))),this._parser.registerEscHandler({intermediates:"/",final:V},(()=>this.selectCharset("/"+V)));this._parser.registerEscHandler({intermediates:"#",final:"8"},(()=>this.screenAlignmentPattern())),this._parser.setErrorHandler((V=>(this._logService.error("Parsing error: ",V),V))),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new M.DcsHandler(((V,ae)=>this.requestStatusString(V,ae))))}_preserveStack(B,L,O,W){this._parseStack.paused=!0,this._parseStack.cursorStartX=B,this._parseStack.cursorStartY=L,this._parseStack.decodedLength=O,this._parseStack.position=W}_logSlowResolvingAsync(B){this._logService.logLevel<=T.LogLevelEnum.WARN&&Promise.race([B,new Promise(((L,O)=>setTimeout((()=>O("#SLOW_TIMEOUT")),5e3)))]).catch((L=>{if(L!=="#SLOW_TIMEOUT")throw L;console.warn("async parser handler taking longer than 5000 ms")}))}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(B,L){let O,W=this._activeBuffer.x,G=this._activeBuffer.y,ie=0;const fe=this._parseStack.paused;if(fe){if(O=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,L))return this._logSlowResolvingAsync(O),O;W=this._parseStack.cursorStartX,G=this._parseStack.cursorStartY,this._parseStack.paused=!1,B.length>H&&(ie=this._parseStack.position+H)}if(this._logService.logLevel<=T.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof B=="string"?` "${B}"`:` "${Array.prototype.map.call(B,(V=>String.fromCharCode(V))).join("")}"`),typeof B=="string"?B.split("").map((V=>V.charCodeAt(0))):B),this._parseBuffer.lengthH)for(let V=ie;V0&&oe.getWidth(this._activeBuffer.x-1)===2&&oe.setCellFromCodepoint(this._activeBuffer.x-1,0,1,ae);let be=this._parser.precedingJoinState;for(let he=L;hepe){if(te){const He=oe;let ze=this._activeBuffer.x-Re;for(this._activeBuffer.x=Re,this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData(),!0)):(this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),oe=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),Re>0&&oe instanceof b.BufferLine&&oe.copyCellsFrom(He,ze,0,Re,!1);ze=0;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}else if(V&&(oe.insertCells(this._activeBuffer.x,G-Re,this._activeBuffer.getNullCell(ae)),oe.getWidth(pe-1)===2&&oe.setCellFromCodepoint(pe-1,x.NULL_CELL_CODE,x.NULL_CELL_WIDTH,ae)),oe.setCellFromCodepoint(this._activeBuffer.x++,W,G,ae),G>0)for(;--G;)oe.setCellFromCodepoint(this._activeBuffer.x++,0,0,ae)}this._parser.precedingJoinState=be,this._activeBuffer.x0&&oe.getWidth(this._activeBuffer.x)===0&&!oe.hasContent(this._activeBuffer.x)&&oe.setCellFromCodepoint(this._activeBuffer.x,0,1,ae),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(B,L){return B.final!=="t"||B.prefix||B.intermediates?this._parser.registerCsiHandler(B,L):this._parser.registerCsiHandler(B,(O=>!$(O.params[0],this._optionsService.rawOptions.windowOptions)||L(O)))}registerDcsHandler(B,L){return this._parser.registerDcsHandler(B,new M.DcsHandler(L))}registerEscHandler(B,L){return this._parser.registerEscHandler(B,L)}registerOscHandler(B,L){return this._parser.registerOscHandler(B,new D.OscHandler(L))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var B;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&B.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);L.hasWidth(this._activeBuffer.x)&&!L.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const B=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-B),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(B=this._bufferService.cols-1){this._activeBuffer.x=Math.min(B,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(B,L){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=B,this._activeBuffer.y=this._activeBuffer.scrollTop+L):(this._activeBuffer.x=B,this._activeBuffer.y=L),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(B,L){this._restrictCursor(),this._setCursor(this._activeBuffer.x+B,this._activeBuffer.y+L)}cursorUp(B){const L=this._activeBuffer.y-this._activeBuffer.scrollTop;return L>=0?this._moveCursor(0,-Math.min(L,B.params[0]||1)):this._moveCursor(0,-(B.params[0]||1)),!0}cursorDown(B){const L=this._activeBuffer.scrollBottom-this._activeBuffer.y;return L>=0?this._moveCursor(0,Math.min(L,B.params[0]||1)):this._moveCursor(0,B.params[0]||1),!0}cursorForward(B){return this._moveCursor(B.params[0]||1,0),!0}cursorBackward(B){return this._moveCursor(-(B.params[0]||1),0),!0}cursorNextLine(B){return this.cursorDown(B),this._activeBuffer.x=0,!0}cursorPrecedingLine(B){return this.cursorUp(B),this._activeBuffer.x=0,!0}cursorCharAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(B){return this._setCursor(B.length>=2?(B.params[1]||1)-1:0,(B.params[0]||1)-1),!0}charPosAbsolute(B){return this._setCursor((B.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(B){return this._moveCursor(B.params[0]||1,0),!0}linePosAbsolute(B){return this._setCursor(this._activeBuffer.x,(B.params[0]||1)-1),!0}vPositionRelative(B){return this._moveCursor(0,B.params[0]||1),!0}hVPosition(B){return this.cursorPosition(B),!0}tabClear(B){const L=B.params[0];return L===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:L===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=B.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(B){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let L=B.params[0]||1;for(;L--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(B){const L=B.params[0];return L===1&&(this._curAttrData.bg|=536870912),L!==2&&L!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(B,L,O,W=!1,G=!1){const ie=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);ie.replaceCells(L,O,this._activeBuffer.getNullCell(this._eraseAttrData()),G),W&&(ie.isWrapped=!1)}_resetBufferLine(B,L=!1){const O=this._activeBuffer.lines.get(this._activeBuffer.ybase+B);O&&(O.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),L),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+B),O.isWrapped=!1)}eraseInDisplay(B,L=!1){let O;switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:for(O=this._activeBuffer.y,this._dirtyRowTracker.markDirty(O),this._eraseInBufferLine(O++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);O=this._bufferService.cols&&(this._activeBuffer.lines.get(O+1).isWrapped=!1);O--;)this._resetBufferLine(O,L);this._dirtyRowTracker.markDirty(0);break;case 2:for(O=this._bufferService.rows,this._dirtyRowTracker.markDirty(O-1);O--;)this._resetBufferLine(O,L);this._dirtyRowTracker.markDirty(0);break;case 3:const W=this._activeBuffer.lines.length-this._bufferService.rows;W>0&&(this._activeBuffer.lines.trimStart(W),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-W,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-W,0),this._onScroll.fire(0))}return!0}eraseInLine(B,L=!1){switch(this._restrictCursor(this._bufferService.cols),B.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,L);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,L);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,L)}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(B){this._restrictCursor();let L=B.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y65535?2:1}let te=pe;for(let V=1;V0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(f.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(f.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(B){return B.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(f.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(f.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(B.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(f.C0.ESC+"[>83;40003;0c")),!0}_is(B){return(this._optionsService.rawOptions.termName+"").indexOf(B)===0}setMode(B){for(let L=0;LTe?1:2,be=B.params[0];return he=be,Se=L?be===2?4:be===4?oe(ie.modes.insertMode):be===12?3:be===20?oe(ae.convertEol):0:be===1?oe(O.applicationCursorKeys):be===3?ae.windowOptions.setWinLines?pe===80?2:pe===132?1:0:0:be===6?oe(O.origin):be===7?oe(O.wraparound):be===8?3:be===9?oe(W==="X10"):be===12?oe(ae.cursorBlink):be===25?oe(!ie.isCursorHidden):be===45?oe(O.reverseWraparound):be===66?oe(O.applicationKeypad):be===67?4:be===1e3?oe(W==="VT200"):be===1002?oe(W==="DRAG"):be===1003?oe(W==="ANY"):be===1004?oe(O.sendFocus):be===1005?4:be===1006?oe(G==="SGR"):be===1015?4:be===1016?oe(G==="SGR_PIXELS"):be===1048?1:be===47||be===1047||be===1049?oe(te===V):be===2004?oe(O.bracketedPasteMode):0,ie.triggerDataEvent(`${f.C0.ESC}[${L?"":"?"}${he};${Se}$y`),!0;var he,Se}_updateAttrColor(B,L,O,W,G){return L===2?(B|=50331648,B&=-16777216,B|=E.AttributeData.fromColorRGB([O,W,G])):L===5&&(B&=-50331904,B|=33554432|255&O),B}_extractColor(B,L,O){const W=[0,0,-1,0,0,0];let G=0,ie=0;do{if(W[ie+G]=B.params[L+ie],B.hasSubParams(L+ie)){const fe=B.getSubParams(L+ie);let pe=0;do W[1]===5&&(G=1),W[ie+pe+1+G]=fe[pe];while(++pe=2||W[1]===2&&ie+G>=5)break;W[1]&&(G=1)}while(++ie+L5)&&(B=1),L.extended.underlineStyle=B,L.fg|=268435456,B===0&&(L.fg&=-268435457),L.updateExtended()}_processSGR0(B){B.fg=b.DEFAULT_ATTR_DATA.fg,B.bg=b.DEFAULT_ATTR_DATA.bg,B.extended=B.extended.clone(),B.extended.underlineStyle=0,B.extended.underlineColor&=-67108864,B.updateExtended()}charAttributes(B){if(B.length===1&&B.params[0]===0)return this._processSGR0(this._curAttrData),!0;const L=B.length;let O;const W=this._curAttrData;for(let G=0;G=30&&O<=37?(W.fg&=-50331904,W.fg|=16777216|O-30):O>=40&&O<=47?(W.bg&=-50331904,W.bg|=16777216|O-40):O>=90&&O<=97?(W.fg&=-50331904,W.fg|=16777224|O-90):O>=100&&O<=107?(W.bg&=-50331904,W.bg|=16777224|O-100):O===0?this._processSGR0(W):O===1?W.fg|=134217728:O===3?W.bg|=67108864:O===4?(W.fg|=268435456,this._processUnderline(B.hasSubParams(G)?B.getSubParams(G)[0]:1,W)):O===5?W.fg|=536870912:O===7?W.fg|=67108864:O===8?W.fg|=1073741824:O===9?W.fg|=2147483648:O===2?W.bg|=134217728:O===21?this._processUnderline(2,W):O===22?(W.fg&=-134217729,W.bg&=-134217729):O===23?W.bg&=-67108865:O===24?(W.fg&=-268435457,this._processUnderline(0,W)):O===25?W.fg&=-536870913:O===27?W.fg&=-67108865:O===28?W.fg&=-1073741825:O===29?W.fg&=2147483647:O===39?(W.fg&=-67108864,W.fg|=16777215&b.DEFAULT_ATTR_DATA.fg):O===49?(W.bg&=-67108864,W.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):O===38||O===48||O===58?G+=this._extractColor(B,G,W):O===53?W.bg|=1073741824:O===55?W.bg&=-1073741825:O===59?(W.extended=W.extended.clone(),W.extended.underlineColor=-1,W.updateExtended()):O===100?(W.fg&=-67108864,W.fg|=16777215&b.DEFAULT_ATTR_DATA.fg,W.bg&=-67108864,W.bg|=16777215&b.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",O);return!0}deviceStatus(B){switch(B.params[0]){case 5:this._coreService.triggerDataEvent(`${f.C0.ESC}[0n`);break;case 6:const L=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[${L};${O}R`)}return!0}deviceStatusPrivate(B){if(B.params[0]===6){const L=this._activeBuffer.y+1,O=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${f.C0.ESC}[?${L};${O}R`)}return!0}softReset(B){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(B){const L=B.params[0]||1;switch(L){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}const O=L%2==1;return this._optionsService.options.cursorBlink=O,!0}setScrollRegion(B){const L=B.params[0]||1;let O;return(B.length<2||(O=B.params[1])>this._bufferService.rows||O===0)&&(O=this._bufferService.rows),O>L&&(this._activeBuffer.scrollTop=L-1,this._activeBuffer.scrollBottom=O-1,this._setCursor(0,0)),!0}windowOptions(B){if(!$(B.params[0],this._optionsService.rawOptions.windowOptions))return!0;const L=B.length>1?B.params[1]:0;switch(B.params[0]){case 14:L!==2&&this._onRequestWindowsOptionsReport.fire(U.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(U.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${f.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:L!==0&&L!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),L!==0&&L!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:L!==0&&L!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),L!==0&&L!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(B){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(B){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(B){return this._windowTitle=B,this._onTitleChange.fire(B),!0}setIconName(B){return this._iconName=B,!0}setOrReportIndexedColor(B){const L=[],O=B.split(";");for(;O.length>1;){const W=O.shift(),G=O.shift();if(/^\d+$/.exec(W)){const ie=parseInt(W);if(Q(ie))if(G==="?")L.push({type:0,index:ie});else{const fe=(0,R.parseColor)(G);fe&&L.push({type:1,index:ie,color:fe})}}}return L.length&&this._onColor.fire(L),!0}setHyperlink(B){const L=B.split(";");return!(L.length<2)&&(L[1]?this._createHyperlink(L[0],L[1]):!L[0]&&this._finishHyperlink())}_createHyperlink(B,L){this._getCurrentLinkId()&&this._finishHyperlink();const O=B.split(":");let W;const G=O.findIndex((ie=>ie.startsWith("id=")));return G!==-1&&(W=O[G].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:W,uri:L}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(B,L){const O=B.split(";");for(let W=0;W=this._specialColors.length);++W,++L)if(O[W]==="?")this._onColor.fire([{type:0,index:this._specialColors[L]}]);else{const G=(0,R.parseColor)(O[W]);G&&this._onColor.fire([{type:1,index:this._specialColors[L],color:G}])}return!0}setOrReportFgColor(B){return this._setOrReportSpecialColor(B,0)}setOrReportBgColor(B){return this._setOrReportSpecialColor(B,1)}setOrReportCursorColor(B){return this._setOrReportSpecialColor(B,2)}restoreIndexedColor(B){if(!B)return this._onColor.fire([{type:2}]),!0;const L=[],O=B.split(";");for(let W=0;W=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const B=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,B,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=b.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=b.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(B){return this._charsetService.setgLevel(B),!0}screenAlignmentPattern(){const B=new S.CellData;B.content=4194373,B.fg=this._curAttrData.fg,B.bg=this._curAttrData.bg,this._setCursor(0,0);for(let L=0;L(this._coreService.triggerDataEvent(`${f.C0.ESC}${G}${f.C0.ESC}\\`),!0))(B==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:B==='"p'?'P1$r61;1"p':B==="r"?`P1$r${O.scrollTop+1};${O.scrollBottom+1}r`:B==="m"?"P1$r0m":B===" q"?`P1$r${{block:2,underline:4,bar:6}[W.cursorStyle]-(W.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(B,L){this._dirtyRowTracker.markRangeDirty(B,L)}}l.InputHandler=K;let Y=class{constructor(ee){this._bufferService=ee,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(ee){eethis.end&&(this.end=ee)}markRangeDirty(ee,B){ee>B&&(q=ee,ee=B,B=q),eethis.end&&(this.end=B)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};function Q(ee){return 0<=ee&&ee<256}Y=h([p(0,T.IBufferService)],Y)},844:(c,l)=>{function u(h){for(const p of h)p.dispose();h.length=0}Object.defineProperty(l,"__esModule",{value:!0}),l.getDisposeArrayDisposable=l.disposeArray=l.toDisposable=l.MutableDisposable=l.Disposable=void 0,l.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const h of this._disposables)h.dispose();this._disposables.length=0}register(h){return this._disposables.push(h),h}unregister(h){const p=this._disposables.indexOf(h);p!==-1&&this._disposables.splice(p,1)}},l.MutableDisposable=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(h){var p;this._isDisposed||h===this._value||((p=this._value)==null||p.dispose(),this._value=h)}clear(){this.value=void 0}dispose(){var h;this._isDisposed=!0,(h=this._value)==null||h.dispose(),this._value=void 0}},l.toDisposable=function(h){return{dispose:h}},l.disposeArray=u,l.getDisposeArrayDisposable=function(h){return{dispose:()=>u(h)}}},1505:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FourKeyMap=l.TwoKeyMap=void 0;class u{constructor(){this._data={}}set(p,f,g){this._data[p]||(this._data[p]={}),this._data[p][f]=g}get(p,f){return this._data[p]?this._data[p][f]:void 0}clear(){this._data={}}}l.TwoKeyMap=u,l.FourKeyMap=class{constructor(){this._data=new u}set(h,p,f,g,y){this._data.get(h,p)||this._data.set(h,p,new u),this._data.get(h,p).set(f,g,y)}get(h,p,f,g){var y;return(y=this._data.get(h,p))==null?void 0:y.get(f,g)}clear(){this._data.clear()}}},6114:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isChromeOS=l.isLinux=l.isWindows=l.isIphone=l.isIpad=l.isMac=l.getSafariVersion=l.isSafari=l.isLegacyEdge=l.isFirefox=l.isNode=void 0,l.isNode=typeof process<"u"&&"title"in process;const u=l.isNode?"node":navigator.userAgent,h=l.isNode?"node":navigator.platform;l.isFirefox=u.includes("Firefox"),l.isLegacyEdge=u.includes("Edge"),l.isSafari=/^((?!chrome|android).)*safari/i.test(u),l.getSafariVersion=function(){if(!l.isSafari)return 0;const p=u.match(/Version\/(\d+)/);return p===null||p.length<2?0:parseInt(p[1])},l.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(h),l.isIpad=h==="iPad",l.isIphone=h==="iPhone",l.isWindows=["Windows","Win16","Win32","WinCE"].includes(h),l.isLinux=h.indexOf("Linux")>=0,l.isChromeOS=/\bCrOS\b/.test(u)},6106:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SortedList=void 0;let u=0;l.SortedList=class{constructor(h){this._getKey=h,this._array=[]}clear(){this._array.length=0}insert(h){this._array.length!==0?(u=this._search(this._getKey(h)),this._array.splice(u,0,h)):this._array.push(h)}delete(h){if(this._array.length===0)return!1;const p=this._getKey(h);if(p===void 0||(u=this._search(p),u===-1)||this._getKey(this._array[u])!==p)return!1;do if(this._array[u]===h)return this._array.splice(u,1),!0;while(++u=this._array.length)&&this._getKey(this._array[u])===h))do yield this._array[u];while(++u=this._array.length)&&this._getKey(this._array[u])===h))do p(this._array[u]);while(++u=p;){let g=p+f>>1;const y=this._getKey(this._array[g]);if(y>h)f=g-1;else{if(!(y0&&this._getKey(this._array[g-1])===h;)g--;return g}p=g+1}}return p}}},7226:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DebouncedIdleTask=l.IdleTaskQueue=l.PriorityTaskQueue=void 0;const h=u(6114);class p{constructor(){this._tasks=[],this._i=0}enqueue(y){this._tasks.push(y),this._start()}flush(){for(;this._i_)return b-C<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(b-C))}ms`),void this._start();b=_}this.clear()}}class f extends p{_requestCallback(y){return setTimeout((()=>y(this._createDeadline(16))))}_cancelCallback(y){clearTimeout(y)}_createDeadline(y){const C=Date.now()+y;return{timeRemaining:()=>Math.max(0,C-Date.now())}}}l.PriorityTaskQueue=f,l.IdleTaskQueue=!h.isNode&&"requestIdleCallback"in window?class extends p{_requestCallback(g){return requestIdleCallback(g)}_cancelCallback(g){cancelIdleCallback(g)}}:f,l.DebouncedIdleTask=class{constructor(){this._queue=new l.IdleTaskQueue}set(g){this._queue.clear(),this._queue.enqueue(g)}flush(){this._queue.flush()}}},9282:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.updateWindowsModeWrappedState=void 0;const h=u(643);l.updateWindowsModeWrappedState=function(p){const f=p.buffer.lines.get(p.buffer.ybase+p.buffer.y-1),g=f==null?void 0:f.get(p.cols-1),y=p.buffer.lines.get(p.buffer.ybase+p.buffer.y);y&&g&&(y.isWrapped=g[h.CHAR_DATA_CODE_INDEX]!==h.NULL_CELL_CODE&&g[h.CHAR_DATA_CODE_INDEX]!==h.WHITESPACE_CELL_CODE)}},3734:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ExtendedAttrs=l.AttributeData=void 0;class u{constructor(){this.fg=0,this.bg=0,this.extended=new h}static toColorRGB(f){return[f>>>16&255,f>>>8&255,255&f]}static fromColorRGB(f){return(255&f[0])<<16|(255&f[1])<<8|255&f[2]}clone(){const f=new u;return f.fg=this.fg,f.bg=this.bg,f.extended=this.extended.clone(),f}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}isOverline(){return 1073741824&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}}l.AttributeData=u;class h{get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(f){this._ext=f}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(f){this._ext&=-469762049,this._ext|=f<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(f){this._ext&=-67108864,this._ext|=67108863&f}get urlId(){return this._urlId}set urlId(f){this._urlId=f}get underlineVariantOffset(){const f=(3758096384&this._ext)>>29;return f<0?4294967288^f:f}set underlineVariantOffset(f){this._ext&=536870911,this._ext|=f<<29&3758096384}constructor(f=0,g=0){this._ext=0,this._urlId=0,this._ext=f,this._urlId=g}clone(){return new h(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}l.ExtendedAttrs=h},9092:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Buffer=l.MAX_BUFFER_SIZE=void 0;const h=u(6349),p=u(7226),f=u(3734),g=u(8437),y=u(4634),C=u(511),w=u(643),b=u(4863),_=u(7116);l.MAX_BUFFER_SIZE=4294967295,l.Buffer=class{constructor(x,S,E){this._hasScrollback=x,this._optionsService=S,this._bufferService=E,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=g.DEFAULT_ATTR_DATA.clone(),this.savedCharset=_.DEFAULT_CHARSET,this.markers=[],this._nullCell=C.CellData.fromCharData([0,w.NULL_CELL_CHAR,w.NULL_CELL_WIDTH,w.NULL_CELL_CODE]),this._whitespaceCell=C.CellData.fromCharData([0,w.WHITESPACE_CELL_CHAR,w.WHITESPACE_CELL_WIDTH,w.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._memoryCleanupQueue=new p.IdleTaskQueue,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(x){return x?(this._nullCell.fg=x.fg,this._nullCell.bg=x.bg,this._nullCell.extended=x.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new f.ExtendedAttrs),this._nullCell}getWhitespaceCell(x){return x?(this._whitespaceCell.fg=x.fg,this._whitespaceCell.bg=x.bg,this._whitespaceCell.extended=x.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new f.ExtendedAttrs),this._whitespaceCell}getBlankLine(x,S){return new g.BufferLine(this._bufferService.cols,this.getNullCell(x),S)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const x=this.ybase+this.y-this.ydisp;return x>=0&&xl.MAX_BUFFER_SIZE?l.MAX_BUFFER_SIZE:S}fillViewportRows(x){if(this.lines.length===0){x===void 0&&(x=g.DEFAULT_ATTR_DATA);let S=this._rows;for(;S--;)this.lines.push(this.getBlankLine(x))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new h.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(x,S){const E=this.getNullCell(g.DEFAULT_ATTR_DATA);let T=0;const A=this._getCorrectBufferLength(S);if(A>this.lines.maxLength&&(this.lines.maxLength=A),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+D+1?(this.ybase--,D++,this.ydisp>0&&this.ydisp--):this.lines.push(new g.BufferLine(x,E)));else for(let M=this._rows;M>S;M--)this.lines.length>S+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(A0&&(this.lines.trimStart(M),this.ybase=Math.max(this.ybase-M,0),this.ydisp=Math.max(this.ydisp-M,0),this.savedY=Math.max(this.savedY-M,0)),this.lines.maxLength=A}this.x=Math.min(this.x,x-1),this.y=Math.min(this.y,S-1),D&&(this.y+=D),this.savedX=Math.min(this.savedX,x-1),this.scrollTop=0}if(this.scrollBottom=S-1,this._isReflowEnabled&&(this._reflow(x,S),this._cols>x))for(let D=0;D.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue((()=>this._batchedMemoryCleanup())))}_batchedMemoryCleanup(){let x=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,x=!1);let S=0;for(;this._memoryCleanupPosition100)return!0;return x}get _isReflowEnabled(){const x=this._optionsService.rawOptions.windowsPty;return x&&x.buildNumber?this._hasScrollback&&x.backend==="conpty"&&x.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(x,S){this._cols!==x&&(x>this._cols?this._reflowLarger(x,S):this._reflowSmaller(x,S))}_reflowLarger(x,S){const E=(0,y.reflowLargerGetLinesToRemove)(this.lines,this._cols,x,this.ybase+this.y,this.getNullCell(g.DEFAULT_ATTR_DATA));if(E.length>0){const T=(0,y.reflowLargerCreateNewLayout)(this.lines,E);(0,y.reflowLargerApplyNewLayout)(this.lines,T.layout),this._reflowLargerAdjustViewport(x,S,T.countRemoved)}}_reflowLargerAdjustViewport(x,S,E){const T=this.getNullCell(g.DEFAULT_ATTR_DATA);let A=E;for(;A-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;D--){let M=this.lines.get(D);if(!M||!M.isWrapped&&M.getTrimmedLength()<=x)continue;const R=[M];for(;M.isWrapped&&D>0;)M=this.lines.get(--D),R.unshift(M);const z=this.ybase+this.y;if(z>=D&&z0&&(T.push({start:D+R.length+A,newLines:K}),A+=K.length),R.push(...K);let Y=$.length-1,Q=$[Y];Q===0&&(Y--,Q=$[Y]);let ee=R.length-U-1,B=H;for(;ee>=0;){const O=Math.min(B,Q);if(R[Y]===void 0)break;if(R[Y].copyCellsFrom(R[ee],B-O,Q-O,O,!0),Q-=O,Q===0&&(Y--,Q=$[Y]),B-=O,B===0){ee--;const W=Math.max(ee,0);B=(0,y.getWrappedLineTrimmedLength)(R,W,this._cols)}}for(let O=0;O0;)this.ybase===0?this.y0){const D=[],M=[];for(let Y=0;Y=0;Y--)if($&&$.start>z+U){for(let Q=$.newLines.length-1;Q>=0;Q--)this.lines.set(Y--,$.newLines[Q]);Y++,D.push({index:z+1,amount:$.newLines.length}),U+=$.newLines.length,$=T[++H]}else this.lines.set(Y,M[z--]);let q=0;for(let Y=D.length-1;Y>=0;Y--)D[Y].index+=q,this.lines.onInsertEmitter.fire(D[Y]),q+=D[Y].amount;const K=Math.max(0,R+A-this.lines.maxLength);K>0&&this.lines.onTrimEmitter.fire(K)}}translateBufferLineToString(x,S,E=0,T){const A=this.lines.get(x);return A?A.translateToString(S,E,T):""}getWrappedRangeForLine(x){let S=x,E=x;for(;S>0&&this.lines.get(S).isWrapped;)S--;for(;E+10;);return x>=this._cols?this._cols-1:x<0?0:x}nextStop(x){for(x==null&&(x=this.x);!this.tabs[++x]&&x=this._cols?this._cols-1:x<0?0:x}clearMarkers(x){this._isClearing=!0;for(let S=0;S{S.line-=E,S.line<0&&S.dispose()}))),S.register(this.lines.onInsert((E=>{S.line>=E.index&&(S.line+=E.amount)}))),S.register(this.lines.onDelete((E=>{S.line>=E.index&&S.lineE.index&&(S.line-=E.amount)}))),S.register(S.onDispose((()=>this._removeMarker(S)))),S}_removeMarker(x){this._isClearing||this.markers.splice(this.markers.indexOf(x),1)}}},8437:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLine=l.DEFAULT_ATTR_DATA=void 0;const h=u(3734),p=u(511),f=u(643),g=u(482);l.DEFAULT_ATTR_DATA=Object.freeze(new h.AttributeData);let y=0;class C{constructor(b,_,x=!1){this.isWrapped=x,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*b);const S=_||p.CellData.fromCharData([0,f.NULL_CELL_CHAR,f.NULL_CELL_WIDTH,f.NULL_CELL_CODE]);for(let E=0;E>22,2097152&_?this._combined[b].charCodeAt(this._combined[b].length-1):x]}set(b,_){this._data[3*b+1]=_[f.CHAR_DATA_ATTR_INDEX],_[f.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[b]=_[1],this._data[3*b+0]=2097152|b|_[f.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*b+0]=_[f.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|_[f.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(b){return this._data[3*b+0]>>22}hasWidth(b){return 12582912&this._data[3*b+0]}getFg(b){return this._data[3*b+1]}getBg(b){return this._data[3*b+2]}hasContent(b){return 4194303&this._data[3*b+0]}getCodePoint(b){const _=this._data[3*b+0];return 2097152&_?this._combined[b].charCodeAt(this._combined[b].length-1):2097151&_}isCombined(b){return 2097152&this._data[3*b+0]}getString(b){const _=this._data[3*b+0];return 2097152&_?this._combined[b]:2097151&_?(0,g.stringFromCodePoint)(2097151&_):""}isProtected(b){return 536870912&this._data[3*b+2]}loadCell(b,_){return y=3*b,_.content=this._data[y+0],_.fg=this._data[y+1],_.bg=this._data[y+2],2097152&_.content&&(_.combinedData=this._combined[b]),268435456&_.bg&&(_.extended=this._extendedAttrs[b]),_}setCell(b,_){2097152&_.content&&(this._combined[b]=_.combinedData),268435456&_.bg&&(this._extendedAttrs[b]=_.extended),this._data[3*b+0]=_.content,this._data[3*b+1]=_.fg,this._data[3*b+2]=_.bg}setCellFromCodepoint(b,_,x,S){268435456&S.bg&&(this._extendedAttrs[b]=S.extended),this._data[3*b+0]=_|x<<22,this._data[3*b+1]=S.fg,this._data[3*b+2]=S.bg}addCodepointToCell(b,_,x){let S=this._data[3*b+0];2097152&S?this._combined[b]+=(0,g.stringFromCodePoint)(_):2097151&S?(this._combined[b]=(0,g.stringFromCodePoint)(2097151&S)+(0,g.stringFromCodePoint)(_),S&=-2097152,S|=2097152):S=_|4194304,x&&(S&=-12582913,S|=x<<22),this._data[3*b+0]=S}insertCells(b,_,x){if((b%=this.length)&&this.getWidth(b-1)===2&&this.setCellFromCodepoint(b-1,0,1,x),_=0;--E)this.setCell(b+_+E,this.loadCell(b+E,S));for(let E=0;E<_;++E)this.setCell(b+E,x)}else for(let S=b;Sthis.length){if(this._data.buffer.byteLength>=4*x)this._data=new Uint32Array(this._data.buffer,0,x);else{const S=new Uint32Array(x);S.set(this._data),this._data=S}for(let S=this.length;S=b&&delete this._combined[A]}const E=Object.keys(this._extendedAttrs);for(let T=0;T=b&&delete this._extendedAttrs[A]}}return this.length=b,4*x*2=0;--b)if(4194303&this._data[3*b+0])return b+(this._data[3*b+0]>>22);return 0}getNoBgTrimmedLength(){for(let b=this.length-1;b>=0;--b)if(4194303&this._data[3*b+0]||50331648&this._data[3*b+2])return b+(this._data[3*b+0]>>22);return 0}copyCellsFrom(b,_,x,S,E){const T=b._data;if(E)for(let D=S-1;D>=0;D--){for(let M=0;M<3;M++)this._data[3*(x+D)+M]=T[3*(_+D)+M];268435456&T[3*(_+D)+2]&&(this._extendedAttrs[x+D]=b._extendedAttrs[_+D])}else for(let D=0;D=_&&(this._combined[M-_+x]=b._combined[M])}}translateToString(b,_,x,S){_=_??0,x=x??this.length,b&&(x=Math.min(x,this.getTrimmedLength())),S&&(S.length=0);let E="";for(;_>22||1}return S&&S.push(_),E}}l.BufferLine=C},4841:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getRangeLength=void 0,l.getRangeLength=function(u,h){if(u.start.y>u.end.y)throw new Error(`Buffer range end (${u.end.x}, ${u.end.y}) cannot be before start (${u.start.x}, ${u.start.y})`);return h*(u.end.y-u.start.y)+(u.end.x-u.start.x+1)}},4634:(c,l)=>{function u(h,p,f){if(p===h.length-1)return h[p].getTrimmedLength();const g=!h[p].hasContent(f-1)&&h[p].getWidth(f-1)===1,y=h[p+1].getWidth(0)===2;return g&&y?f-1:f}Object.defineProperty(l,"__esModule",{value:!0}),l.getWrappedLineTrimmedLength=l.reflowSmallerGetNewLineLengths=l.reflowLargerApplyNewLayout=l.reflowLargerCreateNewLayout=l.reflowLargerGetLinesToRemove=void 0,l.reflowLargerGetLinesToRemove=function(h,p,f,g,y){const C=[];for(let w=0;w=w&&g0&&(M>S||x[M].getTrimmedLength()===0);M--)D++;D>0&&(C.push(w+x.length-D),C.push(D)),w+=x.length-1}return C},l.reflowLargerCreateNewLayout=function(h,p){const f=[];let g=0,y=p[g],C=0;for(let w=0;wu(h,x,p))).reduce(((_,x)=>_+x));let C=0,w=0,b=0;for(;b_&&(C-=_,w++);const x=h[w].getWidth(C-1)===2;x&&C--;const S=x?f-1:f;g.push(S),b+=S}return g},l.getWrappedLineTrimmedLength=u},5295:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferSet=void 0;const h=u(8460),p=u(844),f=u(9092);class g extends p.Disposable{constructor(C,w){super(),this._optionsService=C,this._bufferService=w,this._onBufferActivate=this.register(new h.EventEmitter),this.onBufferActivate=this._onBufferActivate.event,this.reset(),this.register(this._optionsService.onSpecificOptionChange("scrollback",(()=>this.resize(this._bufferService.cols,this._bufferService.rows)))),this.register(this._optionsService.onSpecificOptionChange("tabStopWidth",(()=>this.setupTabStops())))}reset(){this._normal=new f.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new f.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(C){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(C),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))}resize(C,w){this._normal.resize(C,w),this._alt.resize(C,w),this.setupTabStops(C)}setupTabStops(C){this._normal.setupTabStops(C),this._alt.setupTabStops(C)}}l.BufferSet=g},511:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CellData=void 0;const h=u(482),p=u(643),f=u(3734);class g extends f.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new f.ExtendedAttrs,this.combinedData=""}static fromCharData(C){const w=new g;return w.setFromCharData(C),w}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,h.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(C){this.fg=C[p.CHAR_DATA_ATTR_INDEX],this.bg=0;let w=!1;if(C[p.CHAR_DATA_CHAR_INDEX].length>2)w=!0;else if(C[p.CHAR_DATA_CHAR_INDEX].length===2){const b=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=b&&b<=56319){const _=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=_&&_<=57343?this.content=1024*(b-55296)+_-56320+65536|C[p.CHAR_DATA_WIDTH_INDEX]<<22:w=!0}else w=!0}else this.content=C[p.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|C[p.CHAR_DATA_WIDTH_INDEX]<<22;w&&(this.combinedData=C[p.CHAR_DATA_CHAR_INDEX],this.content=2097152|C[p.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}l.CellData=g},643:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WHITESPACE_CELL_CODE=l.WHITESPACE_CELL_WIDTH=l.WHITESPACE_CELL_CHAR=l.NULL_CELL_CODE=l.NULL_CELL_WIDTH=l.NULL_CELL_CHAR=l.CHAR_DATA_CODE_INDEX=l.CHAR_DATA_WIDTH_INDEX=l.CHAR_DATA_CHAR_INDEX=l.CHAR_DATA_ATTR_INDEX=l.DEFAULT_EXT=l.DEFAULT_ATTR=l.DEFAULT_COLOR=void 0,l.DEFAULT_COLOR=0,l.DEFAULT_ATTR=256|l.DEFAULT_COLOR<<9,l.DEFAULT_EXT=0,l.CHAR_DATA_ATTR_INDEX=0,l.CHAR_DATA_CHAR_INDEX=1,l.CHAR_DATA_WIDTH_INDEX=2,l.CHAR_DATA_CODE_INDEX=3,l.NULL_CELL_CHAR="",l.NULL_CELL_WIDTH=1,l.NULL_CELL_CODE=0,l.WHITESPACE_CELL_CHAR=" ",l.WHITESPACE_CELL_WIDTH=1,l.WHITESPACE_CELL_CODE=32},4863:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Marker=void 0;const h=u(8460),p=u(844);class f{get id(){return this._id}constructor(y){this.line=y,this.isDisposed=!1,this._disposables=[],this._id=f._nextId++,this._onDispose=this.register(new h.EventEmitter),this.onDispose=this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),(0,p.disposeArray)(this._disposables),this._disposables.length=0)}register(y){return this._disposables.push(y),y}}l.Marker=f,f._nextId=1},7116:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DEFAULT_CHARSET=l.CHARSETS=void 0,l.CHARSETS={},l.DEFAULT_CHARSET=l.CHARSETS.B,l.CHARSETS[0]={"`":"◆",a:"▒",b:"␉",c:"␌",d:"␍",e:"␊",f:"°",g:"±",h:"␤",i:"␋",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"},l.CHARSETS.A={"#":"£"},l.CHARSETS.B=void 0,l.CHARSETS[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"},l.CHARSETS.C=l.CHARSETS[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"},l.CHARSETS.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"},l.CHARSETS.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"},l.CHARSETS.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"},l.CHARSETS.E=l.CHARSETS[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"},l.CHARSETS.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"},l.CHARSETS.H=l.CHARSETS[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"},l.CHARSETS["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"}},2584:(c,l)=>{var u,h,p;Object.defineProperty(l,"__esModule",{value:!0}),l.C1_ESCAPED=l.C1=l.C0=void 0,(function(f){f.NUL="\0",f.SOH="",f.STX="",f.ETX="",f.EOT="",f.ENQ="",f.ACK="",f.BEL="\x07",f.BS="\b",f.HT=" ",f.LF=` +`,f.VT="\v",f.FF="\f",f.CR="\r",f.SO="",f.SI="",f.DLE="",f.DC1="",f.DC2="",f.DC3="",f.DC4="",f.NAK="",f.SYN="",f.ETB="",f.CAN="",f.EM="",f.SUB="",f.ESC="\x1B",f.FS="",f.GS="",f.RS="",f.US="",f.SP=" ",f.DEL=""})(u||(l.C0=u={})),(function(f){f.PAD="€",f.HOP="",f.BPH="‚",f.NBH="ƒ",f.IND="„",f.NEL="…",f.SSA="†",f.ESA="‡",f.HTS="ˆ",f.HTJ="‰",f.VTS="Š",f.PLD="‹",f.PLU="Œ",f.RI="",f.SS2="Ž",f.SS3="",f.DCS="",f.PU1="‘",f.PU2="’",f.STS="“",f.CCH="”",f.MW="•",f.SPA="–",f.EPA="—",f.SOS="˜",f.SGCI="™",f.SCI="š",f.CSI="›",f.ST="œ",f.OSC="",f.PM="ž",f.APC="Ÿ"})(h||(l.C1=h={})),(function(f){f.ST=`${u.ESC}\\`})(p||(l.C1_ESCAPED=p={}))},7399:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.evaluateKeyboardEvent=void 0;const h=u(2584),p={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};l.evaluateKeyboardEvent=function(f,g,y,C){const w={type:0,cancel:!1,key:void 0},b=(f.shiftKey?1:0)|(f.altKey?2:0)|(f.ctrlKey?4:0)|(f.metaKey?8:0);switch(f.keyCode){case 0:f.key==="UIKeyInputUpArrow"?w.key=g?h.C0.ESC+"OA":h.C0.ESC+"[A":f.key==="UIKeyInputLeftArrow"?w.key=g?h.C0.ESC+"OD":h.C0.ESC+"[D":f.key==="UIKeyInputRightArrow"?w.key=g?h.C0.ESC+"OC":h.C0.ESC+"[C":f.key==="UIKeyInputDownArrow"&&(w.key=g?h.C0.ESC+"OB":h.C0.ESC+"[B");break;case 8:w.key=f.ctrlKey?"\b":h.C0.DEL,f.altKey&&(w.key=h.C0.ESC+w.key);break;case 9:if(f.shiftKey){w.key=h.C0.ESC+"[Z";break}w.key=h.C0.HT,w.cancel=!0;break;case 13:w.key=f.altKey?h.C0.ESC+h.C0.CR:h.C0.CR,w.cancel=!0;break;case 27:w.key=h.C0.ESC,f.altKey&&(w.key=h.C0.ESC+h.C0.ESC),w.cancel=!0;break;case 37:if(f.metaKey)break;b?(w.key=h.C0.ESC+"[1;"+(b+1)+"D",w.key===h.C0.ESC+"[1;3D"&&(w.key=h.C0.ESC+(y?"b":"[1;5D"))):w.key=g?h.C0.ESC+"OD":h.C0.ESC+"[D";break;case 39:if(f.metaKey)break;b?(w.key=h.C0.ESC+"[1;"+(b+1)+"C",w.key===h.C0.ESC+"[1;3C"&&(w.key=h.C0.ESC+(y?"f":"[1;5C"))):w.key=g?h.C0.ESC+"OC":h.C0.ESC+"[C";break;case 38:if(f.metaKey)break;b?(w.key=h.C0.ESC+"[1;"+(b+1)+"A",y||w.key!==h.C0.ESC+"[1;3A"||(w.key=h.C0.ESC+"[1;5A")):w.key=g?h.C0.ESC+"OA":h.C0.ESC+"[A";break;case 40:if(f.metaKey)break;b?(w.key=h.C0.ESC+"[1;"+(b+1)+"B",y||w.key!==h.C0.ESC+"[1;3B"||(w.key=h.C0.ESC+"[1;5B")):w.key=g?h.C0.ESC+"OB":h.C0.ESC+"[B";break;case 45:f.shiftKey||f.ctrlKey||(w.key=h.C0.ESC+"[2~");break;case 46:w.key=b?h.C0.ESC+"[3;"+(b+1)+"~":h.C0.ESC+"[3~";break;case 36:w.key=b?h.C0.ESC+"[1;"+(b+1)+"H":g?h.C0.ESC+"OH":h.C0.ESC+"[H";break;case 35:w.key=b?h.C0.ESC+"[1;"+(b+1)+"F":g?h.C0.ESC+"OF":h.C0.ESC+"[F";break;case 33:f.shiftKey?w.type=2:f.ctrlKey?w.key=h.C0.ESC+"[5;"+(b+1)+"~":w.key=h.C0.ESC+"[5~";break;case 34:f.shiftKey?w.type=3:f.ctrlKey?w.key=h.C0.ESC+"[6;"+(b+1)+"~":w.key=h.C0.ESC+"[6~";break;case 112:w.key=b?h.C0.ESC+"[1;"+(b+1)+"P":h.C0.ESC+"OP";break;case 113:w.key=b?h.C0.ESC+"[1;"+(b+1)+"Q":h.C0.ESC+"OQ";break;case 114:w.key=b?h.C0.ESC+"[1;"+(b+1)+"R":h.C0.ESC+"OR";break;case 115:w.key=b?h.C0.ESC+"[1;"+(b+1)+"S":h.C0.ESC+"OS";break;case 116:w.key=b?h.C0.ESC+"[15;"+(b+1)+"~":h.C0.ESC+"[15~";break;case 117:w.key=b?h.C0.ESC+"[17;"+(b+1)+"~":h.C0.ESC+"[17~";break;case 118:w.key=b?h.C0.ESC+"[18;"+(b+1)+"~":h.C0.ESC+"[18~";break;case 119:w.key=b?h.C0.ESC+"[19;"+(b+1)+"~":h.C0.ESC+"[19~";break;case 120:w.key=b?h.C0.ESC+"[20;"+(b+1)+"~":h.C0.ESC+"[20~";break;case 121:w.key=b?h.C0.ESC+"[21;"+(b+1)+"~":h.C0.ESC+"[21~";break;case 122:w.key=b?h.C0.ESC+"[23;"+(b+1)+"~":h.C0.ESC+"[23~";break;case 123:w.key=b?h.C0.ESC+"[24;"+(b+1)+"~":h.C0.ESC+"[24~";break;default:if(!f.ctrlKey||f.shiftKey||f.altKey||f.metaKey)if(y&&!C||!f.altKey||f.metaKey)!y||f.altKey||f.ctrlKey||f.shiftKey||!f.metaKey?f.key&&!f.ctrlKey&&!f.altKey&&!f.metaKey&&f.keyCode>=48&&f.key.length===1?w.key=f.key:f.key&&f.ctrlKey&&(f.key==="_"&&(w.key=h.C0.US),f.key==="@"&&(w.key=h.C0.NUL)):f.keyCode===65&&(w.type=1);else{const _=p[f.keyCode],x=_==null?void 0:_[f.shiftKey?1:0];if(x)w.key=h.C0.ESC+x;else if(f.keyCode>=65&&f.keyCode<=90){const S=f.ctrlKey?f.keyCode-64:f.keyCode+32;let E=String.fromCharCode(S);f.shiftKey&&(E=E.toUpperCase()),w.key=h.C0.ESC+E}else if(f.keyCode===32)w.key=h.C0.ESC+(f.ctrlKey?h.C0.NUL:" ");else if(f.key==="Dead"&&f.code.startsWith("Key")){let S=f.code.slice(3,4);f.shiftKey||(S=S.toLowerCase()),w.key=h.C0.ESC+S,w.cancel=!0}}else f.keyCode>=65&&f.keyCode<=90?w.key=String.fromCharCode(f.keyCode-64):f.keyCode===32?w.key=h.C0.NUL:f.keyCode>=51&&f.keyCode<=55?w.key=String.fromCharCode(f.keyCode-51+27):f.keyCode===56?w.key=h.C0.DEL:f.keyCode===219?w.key=h.C0.ESC:f.keyCode===220?w.key=h.C0.FS:f.keyCode===221&&(w.key=h.C0.GS)}return w}},482:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Utf8ToUtf32=l.StringToUtf32=l.utf32ToString=l.stringFromCodePoint=void 0,l.stringFromCodePoint=function(u){return u>65535?(u-=65536,String.fromCharCode(55296+(u>>10))+String.fromCharCode(u%1024+56320)):String.fromCharCode(u)},l.utf32ToString=function(u,h=0,p=u.length){let f="";for(let g=h;g65535?(y-=65536,f+=String.fromCharCode(55296+(y>>10))+String.fromCharCode(y%1024+56320)):f+=String.fromCharCode(y)}return f},l.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(u,h){const p=u.length;if(!p)return 0;let f=0,g=0;if(this._interim){const y=u.charCodeAt(g++);56320<=y&&y<=57343?h[f++]=1024*(this._interim-55296)+y-56320+65536:(h[f++]=this._interim,h[f++]=y),this._interim=0}for(let y=g;y=p)return this._interim=C,f;const w=u.charCodeAt(y);56320<=w&&w<=57343?h[f++]=1024*(C-55296)+w-56320+65536:(h[f++]=C,h[f++]=w)}else C!==65279&&(h[f++]=C)}return f}},l.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(u,h){const p=u.length;if(!p)return 0;let f,g,y,C,w=0,b=0,_=0;if(this.interim[0]){let E=!1,T=this.interim[0];T&=(224&T)==192?31:(240&T)==224?15:7;let A,D=0;for(;(A=63&this.interim[++D])&&D<4;)T<<=6,T|=A;const M=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,R=M-D;for(;_=p)return 0;if(A=u[_++],(192&A)!=128){_--,E=!0;break}this.interim[D++]=A,T<<=6,T|=63&A}E||(M===2?T<128?_--:h[w++]=T:M===3?T<2048||T>=55296&&T<=57343||T===65279||(h[w++]=T):T<65536||T>1114111||(h[w++]=T)),this.interim.fill(0)}const x=p-4;let S=_;for(;S=p)return this.interim[0]=f,w;if(g=u[S++],(192&g)!=128){S--;continue}if(b=(31&f)<<6|63&g,b<128){S--;continue}h[w++]=b}else if((240&f)==224){if(S>=p)return this.interim[0]=f,w;if(g=u[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=g,w;if(y=u[S++],(192&y)!=128){S--;continue}if(b=(15&f)<<12|(63&g)<<6|63&y,b<2048||b>=55296&&b<=57343||b===65279)continue;h[w++]=b}else if((248&f)==240){if(S>=p)return this.interim[0]=f,w;if(g=u[S++],(192&g)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=g,w;if(y=u[S++],(192&y)!=128){S--;continue}if(S>=p)return this.interim[0]=f,this.interim[1]=g,this.interim[2]=y,w;if(C=u[S++],(192&C)!=128){S--;continue}if(b=(7&f)<<18|(63&g)<<12|(63&y)<<6|63&C,b<65536||b>1114111)continue;h[w++]=b}}return w}}},225:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeV6=void 0;const h=u(1480),p=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],f=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]];let g;l.UnicodeV6=class{constructor(){if(this.version="6",!g){g=new Uint8Array(65536),g.fill(1),g[0]=0,g.fill(0,1,32),g.fill(0,127,160),g.fill(2,4352,4448),g[9001]=2,g[9002]=2,g.fill(2,11904,42192),g[12351]=1,g.fill(2,44032,55204),g.fill(2,63744,64256),g.fill(2,65040,65050),g.fill(2,65072,65136),g.fill(2,65280,65377),g.fill(2,65504,65511);for(let y=0;yw[x][1])return!1;for(;x>=_;)if(b=_+x>>1,C>w[b][1])_=b+1;else{if(!(C=131072&&y<=196605||y>=196608&&y<=262141?2:1}charProperties(y,C){let w=this.wcwidth(y),b=w===0&&C!==0;if(b){const _=h.UnicodeService.extractWidth(C);_===0?b=!1:_>w&&(w=_)}return h.UnicodeService.createPropertyValue(0,w,b)}}},5981:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.WriteBuffer=void 0;const h=u(8460),p=u(844);class f extends p.Disposable{constructor(y){super(),this._action=y,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this.register(new h.EventEmitter),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(y,C){if(C!==void 0&&this._syncCalls>C)return void(this._syncCalls=0);if(this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let w;for(this._isSyncWriting=!0;w=this._writeBuffer.shift();){this._action(w);const b=this._callbacks.shift();b&&b()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(y,C){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");if(!this._writeBuffer.length){if(this._bufferOffset=0,this._didUserInput)return this._didUserInput=!1,this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(C),void this._innerWrite();setTimeout((()=>this._innerWrite()))}this._pendingData+=y.length,this._writeBuffer.push(y),this._callbacks.push(C)}_innerWrite(y=0,C=!0){const w=y||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const b=this._writeBuffer[this._bufferOffset],_=this._action(b,C);if(_){const S=E=>Date.now()-w>=12?setTimeout((()=>this._innerWrite(0,E))):this._innerWrite(w,E);return void _.catch((E=>(queueMicrotask((()=>{throw E})),Promise.resolve(!1)))).then(S)}const x=this._callbacks[this._bufferOffset];if(x&&x(),this._bufferOffset++,this._pendingData-=b.length,Date.now()-w>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout((()=>this._innerWrite()))):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}l.WriteBuffer=f},5941:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.toRgbString=l.parseColor=void 0;const u=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,h=/^[\da-f]+$/;function p(f,g){const y=f.toString(16),C=y.length<2?"0"+y:y;switch(g){case 4:return y[0];case 8:return C;case 12:return(C+C).slice(0,3);default:return C+C}}l.parseColor=function(f){if(!f)return;let g=f.toLowerCase();if(g.indexOf("rgb:")===0){g=g.slice(4);const y=u.exec(g);if(y){const C=y[1]?15:y[4]?255:y[7]?4095:65535;return[Math.round(parseInt(y[1]||y[4]||y[7]||y[10],16)/C*255),Math.round(parseInt(y[2]||y[5]||y[8]||y[11],16)/C*255),Math.round(parseInt(y[3]||y[6]||y[9]||y[12],16)/C*255)]}}else if(g.indexOf("#")===0&&(g=g.slice(1),h.exec(g)&&[3,6,9,12].includes(g.length))){const y=g.length/3,C=[0,0,0];for(let w=0;w<3;++w){const b=parseInt(g.slice(y*w,y*w+y),16);C[w]=y===1?b<<4:y===2?b:y===3?b>>4:b>>8}return C}},l.toRgbString=function(f,g=16){const[y,C,w]=f;return`rgb:${p(y,g)}/${p(C,g)}/${p(w,g)}`}},5770:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PAYLOAD_LIMIT=void 0,l.PAYLOAD_LIMIT=1e7},6351:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DcsHandler=l.DcsParser=void 0;const h=u(482),p=u(8742),f=u(5770),g=[];l.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=g,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=g}registerHandler(C,w){this._handlers[C]===void 0&&(this._handlers[C]=[]);const b=this._handlers[C];return b.push(w),{dispose:()=>{const _=b.indexOf(w);_!==-1&&b.splice(_,1)}}}clearHandler(C){this._handlers[C]&&delete this._handlers[C]}setHandlerFallback(C){this._handlerFb=C}reset(){if(this._active.length)for(let C=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;C>=0;--C)this._active[C].unhook(!1);this._stack.paused=!1,this._active=g,this._ident=0}hook(C,w){if(this.reset(),this._ident=C,this._active=this._handlers[C]||g,this._active.length)for(let b=this._active.length-1;b>=0;b--)this._active[b].hook(w);else this._handlerFb(this._ident,"HOOK",w)}put(C,w,b){if(this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].put(C,w,b);else this._handlerFb(this._ident,"PUT",(0,h.utf32ToString)(C,w,b))}unhook(C,w=!0){if(this._active.length){let b=!1,_=this._active.length-1,x=!1;if(this._stack.paused&&(_=this._stack.loopPosition-1,b=w,x=this._stack.fallThrough,this._stack.paused=!1),!x&&b===!1){for(;_>=0&&(b=this._active[_].unhook(C),b!==!0);_--)if(b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!1,b;_--}for(;_>=0;_--)if(b=this._active[_].unhook(!1),b instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=_,this._stack.fallThrough=!0,b}else this._handlerFb(this._ident,"UNHOOK",C);this._active=g,this._ident=0}};const y=new p.Params;y.addParam(0),l.DcsHandler=class{constructor(C){this._handler=C,this._data="",this._params=y,this._hitLimit=!1}hook(C){this._params=C.length>1||C.params[0]?C.clone():y,this._data="",this._hitLimit=!1}put(C,w,b){this._hitLimit||(this._data+=(0,h.utf32ToString)(C,w,b),this._data.length>f.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(C){let w=!1;if(this._hitLimit)w=!1;else if(C&&(w=this._handler(this._data,this._params),w instanceof Promise))return w.then((b=>(this._params=y,this._data="",this._hitLimit=!1,b)));return this._params=y,this._data="",this._hitLimit=!1,w}}},2015:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.EscapeSequenceParser=l.VT500_TRANSITION_TABLE=l.TransitionTable=void 0;const h=u(844),p=u(8742),f=u(6242),g=u(6351);class y{constructor(_){this.table=new Uint8Array(_)}setDefault(_,x){this.table.fill(_<<4|x)}add(_,x,S,E){this.table[x<<8|_]=S<<4|E}addMany(_,x,S,E){for(let T=0;T<_.length;T++)this.table[x<<8|_[T]]=S<<4|E}}l.TransitionTable=y;const C=160;l.VT500_TRANSITION_TABLE=(function(){const b=new y(4095),_=Array.apply(null,Array(256)).map(((D,M)=>M)),x=(D,M)=>_.slice(D,M),S=x(32,127),E=x(0,24);E.push(25),E.push.apply(E,x(28,32));const T=x(0,14);let A;for(A in b.setDefault(1,0),b.addMany(S,0,2,0),T)b.addMany([24,26,153,154],A,3,0),b.addMany(x(128,144),A,3,0),b.addMany(x(144,152),A,3,0),b.add(156,A,0,0),b.add(27,A,11,1),b.add(157,A,4,8),b.addMany([152,158,159],A,0,7),b.add(155,A,11,3),b.add(144,A,11,9);return b.addMany(E,0,3,0),b.addMany(E,1,3,1),b.add(127,1,0,1),b.addMany(E,8,0,8),b.addMany(E,3,3,3),b.add(127,3,0,3),b.addMany(E,4,3,4),b.add(127,4,0,4),b.addMany(E,6,3,6),b.addMany(E,5,3,5),b.add(127,5,0,5),b.addMany(E,2,3,2),b.add(127,2,0,2),b.add(93,1,4,8),b.addMany(S,8,5,8),b.add(127,8,5,8),b.addMany([156,27,24,26,7],8,6,0),b.addMany(x(28,32),8,0,8),b.addMany([88,94,95],1,0,7),b.addMany(S,7,0,7),b.addMany(E,7,0,7),b.add(156,7,0,0),b.add(127,7,0,7),b.add(91,1,11,3),b.addMany(x(64,127),3,7,0),b.addMany(x(48,60),3,8,4),b.addMany([60,61,62,63],3,9,4),b.addMany(x(48,60),4,8,4),b.addMany(x(64,127),4,7,0),b.addMany([60,61,62,63],4,0,6),b.addMany(x(32,64),6,0,6),b.add(127,6,0,6),b.addMany(x(64,127),6,0,0),b.addMany(x(32,48),3,9,5),b.addMany(x(32,48),5,9,5),b.addMany(x(48,64),5,0,6),b.addMany(x(64,127),5,7,0),b.addMany(x(32,48),4,9,5),b.addMany(x(32,48),1,9,2),b.addMany(x(32,48),2,9,2),b.addMany(x(48,127),2,10,0),b.addMany(x(48,80),1,10,0),b.addMany(x(81,88),1,10,0),b.addMany([89,90,92],1,10,0),b.addMany(x(96,127),1,10,0),b.add(80,1,11,9),b.addMany(E,9,0,9),b.add(127,9,0,9),b.addMany(x(28,32),9,0,9),b.addMany(x(32,48),9,9,12),b.addMany(x(48,60),9,8,10),b.addMany([60,61,62,63],9,9,10),b.addMany(E,11,0,11),b.addMany(x(32,128),11,0,11),b.addMany(x(28,32),11,0,11),b.addMany(E,10,0,10),b.add(127,10,0,10),b.addMany(x(28,32),10,0,10),b.addMany(x(48,60),10,8,10),b.addMany([60,61,62,63],10,0,11),b.addMany(x(32,48),10,9,12),b.addMany(E,12,0,12),b.add(127,12,0,12),b.addMany(x(28,32),12,0,12),b.addMany(x(32,48),12,9,12),b.addMany(x(48,64),12,0,11),b.addMany(x(64,127),12,12,13),b.addMany(x(64,127),10,12,13),b.addMany(x(64,127),9,12,13),b.addMany(E,13,13,13),b.addMany(S,13,13,13),b.add(127,13,0,13),b.addMany([27,156,24,26],13,14,0),b.add(C,0,2,0),b.add(C,8,5,8),b.add(C,6,0,6),b.add(C,11,0,11),b.add(C,13,13,13),b})();class w extends h.Disposable{constructor(_=l.VT500_TRANSITION_TABLE){super(),this._transitions=_,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new p.Params,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(x,S,E)=>{},this._executeHandlerFb=x=>{},this._csiHandlerFb=(x,S)=>{},this._escHandlerFb=x=>{},this._errorHandlerFb=x=>x,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this.register((0,h.toDisposable)((()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)}))),this._oscParser=this.register(new f.OscParser),this._dcsParser=this.register(new g.DcsParser),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},(()=>!0))}_identifier(_,x=[64,126]){let S=0;if(_.prefix){if(_.prefix.length>1)throw new Error("only one byte as prefix supported");if(S=_.prefix.charCodeAt(0),S&&60>S||S>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(_.intermediates){if(_.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let T=0;T<_.intermediates.length;++T){const A=_.intermediates.charCodeAt(T);if(32>A||A>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");S<<=8,S|=A}}if(_.final.length!==1)throw new Error("final must be a single byte");const E=_.final.charCodeAt(0);if(x[0]>E||E>x[1])throw new Error(`final must be in range ${x[0]} .. ${x[1]}`);return S<<=8,S|=E,S}identToString(_){const x=[];for(;_;)x.push(String.fromCharCode(255&_)),_>>=8;return x.reverse().join("")}setPrintHandler(_){this._printHandler=_}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(_,x){const S=this._identifier(_,[48,126]);this._escHandlers[S]===void 0&&(this._escHandlers[S]=[]);const E=this._escHandlers[S];return E.push(x),{dispose:()=>{const T=E.indexOf(x);T!==-1&&E.splice(T,1)}}}clearEscHandler(_){this._escHandlers[this._identifier(_,[48,126])]&&delete this._escHandlers[this._identifier(_,[48,126])]}setEscHandlerFallback(_){this._escHandlerFb=_}setExecuteHandler(_,x){this._executeHandlers[_.charCodeAt(0)]=x}clearExecuteHandler(_){this._executeHandlers[_.charCodeAt(0)]&&delete this._executeHandlers[_.charCodeAt(0)]}setExecuteHandlerFallback(_){this._executeHandlerFb=_}registerCsiHandler(_,x){const S=this._identifier(_);this._csiHandlers[S]===void 0&&(this._csiHandlers[S]=[]);const E=this._csiHandlers[S];return E.push(x),{dispose:()=>{const T=E.indexOf(x);T!==-1&&E.splice(T,1)}}}clearCsiHandler(_){this._csiHandlers[this._identifier(_)]&&delete this._csiHandlers[this._identifier(_)]}setCsiHandlerFallback(_){this._csiHandlerFb=_}registerDcsHandler(_,x){return this._dcsParser.registerHandler(this._identifier(_),x)}clearDcsHandler(_){this._dcsParser.clearHandler(this._identifier(_))}setDcsHandlerFallback(_){this._dcsParser.setHandlerFallback(_)}registerOscHandler(_,x){return this._oscParser.registerHandler(_,x)}clearOscHandler(_){this._oscParser.clearHandler(_)}setOscHandlerFallback(_){this._oscParser.setHandlerFallback(_)}setErrorHandler(_){this._errorHandler=_}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(_,x,S,E,T){this._parseStack.state=_,this._parseStack.handlers=x,this._parseStack.handlerPos=S,this._parseStack.transition=E,this._parseStack.chunkPos=T}parse(_,x,S){let E,T=0,A=0,D=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,D=this._parseStack.chunkPos+1;else{if(S===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const M=this._parseStack.handlers;let R=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(S===!1&&R>-1){for(;R>=0&&(E=M[R](this._params),E!==!0);R--)if(E instanceof Promise)return this._parseStack.handlerPos=R,E}this._parseStack.handlers=[];break;case 4:if(S===!1&&R>-1){for(;R>=0&&(E=M[R](),E!==!0);R--)if(E instanceof Promise)return this._parseStack.handlerPos=R,E}this._parseStack.handlers=[];break;case 6:if(T=_[this._parseStack.chunkPos],E=this._dcsParser.unhook(T!==24&&T!==26,S),E)return E;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(T=_[this._parseStack.chunkPos],E=this._oscParser.end(T!==24&&T!==26,S),E)return E;T===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,D=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=15&this._parseStack.transition}for(let M=D;M>4){case 2:for(let U=M+1;;++U){if(U>=x||(T=_[U])<32||T>126&&T=x||(T=_[U])<32||T>126&&T=x||(T=_[U])<32||T>126&&T=x||(T=_[U])<32||T>126&&T=0&&(E=R[z](this._params),E!==!0);z--)if(E instanceof Promise)return this._preserveStack(3,R,z,A,M),E;z<0&&this._csiHandlerFb(this._collect<<8|T,this._params),this.precedingJoinState=0;break;case 8:do switch(T){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(T-48)}while(++M47&&T<60);M--;break;case 9:this._collect<<=8,this._collect|=T;break;case 10:const H=this._escHandlers[this._collect<<8|T];let $=H?H.length-1:-1;for(;$>=0&&(E=H[$](),E!==!0);$--)if(E instanceof Promise)return this._preserveStack(4,H,$,A,M),E;$<0&&this._escHandlerFb(this._collect<<8|T),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|T,this._params);break;case 13:for(let U=M+1;;++U)if(U>=x||(T=_[U])===24||T===26||T===27||T>127&&T=x||(T=_[U])<32||T>127&&T{Object.defineProperty(l,"__esModule",{value:!0}),l.OscHandler=l.OscParser=void 0;const h=u(5770),p=u(482),f=[];l.OscParser=class{constructor(){this._state=0,this._active=f,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(g,y){this._handlers[g]===void 0&&(this._handlers[g]=[]);const C=this._handlers[g];return C.push(y),{dispose:()=>{const w=C.indexOf(y);w!==-1&&C.splice(w,1)}}}clearHandler(g){this._handlers[g]&&delete this._handlers[g]}setHandlerFallback(g){this._handlerFb=g}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=f}reset(){if(this._state===2)for(let g=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;g>=0;--g)this._active[g].end(!1);this._stack.paused=!1,this._active=f,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||f,this._active.length)for(let g=this._active.length-1;g>=0;g--)this._active[g].start();else this._handlerFb(this._id,"START")}_put(g,y,C){if(this._active.length)for(let w=this._active.length-1;w>=0;w--)this._active[w].put(g,y,C);else this._handlerFb(this._id,"PUT",(0,p.utf32ToString)(g,y,C))}start(){this.reset(),this._state=1}put(g,y,C){if(this._state!==3){if(this._state===1)for(;y0&&this._put(g,y,C)}}end(g,y=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let C=!1,w=this._active.length-1,b=!1;if(this._stack.paused&&(w=this._stack.loopPosition-1,C=y,b=this._stack.fallThrough,this._stack.paused=!1),!b&&C===!1){for(;w>=0&&(C=this._active[w].end(g),C!==!0);w--)if(C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!1,C;w--}for(;w>=0;w--)if(C=this._active[w].end(!1),C instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=w,this._stack.fallThrough=!0,C}else this._handlerFb(this._id,"END",g);this._active=f,this._id=-1,this._state=0}}},l.OscHandler=class{constructor(g){this._handler=g,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(g,y,C){this._hitLimit||(this._data+=(0,p.utf32ToString)(g,y,C),this._data.length>h.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(g){let y=!1;if(this._hitLimit)y=!1;else if(g&&(y=this._handler(this._data),y instanceof Promise))return y.then((C=>(this._data="",this._hitLimit=!1,C)));return this._data="",this._hitLimit=!1,y}}},8742:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Params=void 0;const u=2147483647;class h{static fromArray(f){const g=new h;if(!f.length)return g;for(let y=Array.isArray(f[0])?1:0;y256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(f),this.length=0,this._subParams=new Int32Array(g),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(f),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}clone(){const f=new h(this.maxLength,this.maxSubParamsLength);return f.params.set(this.params),f.length=this.length,f._subParams.set(this._subParams),f._subParamsLength=this._subParamsLength,f._subParamsIdx.set(this._subParamsIdx),f._rejectDigits=this._rejectDigits,f._rejectSubDigits=this._rejectSubDigits,f._digitIsSub=this._digitIsSub,f}toArray(){const f=[];for(let g=0;g>8,C=255&this._subParamsIdx[g];C-y>0&&f.push(Array.prototype.slice.call(this._subParams,y,C))}return f}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(f){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=f>u?u:f}}addSubParam(f){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(f<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=f>u?u:f,this._subParamsIdx[this.length-1]++}}hasSubParams(f){return(255&this._subParamsIdx[f])-(this._subParamsIdx[f]>>8)>0}getSubParams(f){const g=this._subParamsIdx[f]>>8,y=255&this._subParamsIdx[f];return y-g>0?this._subParams.subarray(g,y):null}getSubParamsAll(){const f={};for(let g=0;g>8,C=255&this._subParamsIdx[g];C-y>0&&(f[g]=this._subParams.slice(y,C))}return f}addDigit(f){let g;if(this._rejectDigits||!(g=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const y=this._digitIsSub?this._subParams:this.params,C=y[g-1];y[g-1]=~C?Math.min(10*C+f,u):f}}l.Params=h},5741:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AddonManager=void 0,l.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let u=this._addons.length-1;u>=0;u--)this._addons[u].instance.dispose()}loadAddon(u,h){const p={instance:h,dispose:h.dispose,isDisposed:!1};this._addons.push(p),h.dispose=()=>this._wrappedAddonDispose(p),h.activate(u)}_wrappedAddonDispose(u){if(u.isDisposed)return;let h=-1;for(let p=0;p{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferApiView=void 0;const h=u(3785),p=u(511);l.BufferApiView=class{constructor(f,g){this._buffer=f,this.type=g}init(f){return this._buffer=f,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(f){const g=this._buffer.lines.get(f);if(g)return new h.BufferLineApiView(g)}getNullCell(){return new p.CellData}}},3785:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferLineApiView=void 0;const h=u(511);l.BufferLineApiView=class{constructor(p){this._line=p}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(p,f){if(!(p<0||p>=this._line.length))return f?(this._line.loadCell(p,f),f):this._line.loadCell(p,new h.CellData)}translateToString(p,f,g){return this._line.translateToString(p,f,g)}}},8285:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BufferNamespaceApi=void 0;const h=u(8771),p=u(8460),f=u(844);class g extends f.Disposable{constructor(C){super(),this._core=C,this._onBufferChange=this.register(new p.EventEmitter),this.onBufferChange=this._onBufferChange.event,this._normal=new h.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new h.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate((()=>this._onBufferChange.fire(this.active)))}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}l.BufferNamespaceApi=g},7975:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.ParserApi=void 0,l.ParserApi=class{constructor(u){this._core=u}registerCsiHandler(u,h){return this._core.registerCsiHandler(u,(p=>h(p.toArray())))}addCsiHandler(u,h){return this.registerCsiHandler(u,h)}registerDcsHandler(u,h){return this._core.registerDcsHandler(u,((p,f)=>h(p,f.toArray())))}addDcsHandler(u,h){return this.registerDcsHandler(u,h)}registerEscHandler(u,h){return this._core.registerEscHandler(u,h)}addEscHandler(u,h){return this.registerEscHandler(u,h)}registerOscHandler(u,h){return this._core.registerOscHandler(u,h)}addOscHandler(u,h){return this.registerOscHandler(u,h)}}},7090:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeApi=void 0,l.UnicodeApi=class{constructor(u){this._core=u}register(u){this._core.unicodeService.register(u)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(u){this._core.unicodeService.activeVersion=u}}},744:function(c,l,u){var h=this&&this.__decorate||function(b,_,x,S){var E,T=arguments.length,A=T<3?_:S===null?S=Object.getOwnPropertyDescriptor(_,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,_,x,S);else for(var D=b.length-1;D>=0;D--)(E=b[D])&&(A=(T<3?E(A):T>3?E(_,x,A):E(_,x))||A);return T>3&&A&&Object.defineProperty(_,x,A),A},p=this&&this.__param||function(b,_){return function(x,S){_(x,S,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.BufferService=l.MINIMUM_ROWS=l.MINIMUM_COLS=void 0;const f=u(8460),g=u(844),y=u(5295),C=u(2585);l.MINIMUM_COLS=2,l.MINIMUM_ROWS=1;let w=l.BufferService=class extends g.Disposable{get buffer(){return this.buffers.active}constructor(b){super(),this.isUserScrolling=!1,this._onResize=this.register(new f.EventEmitter),this.onResize=this._onResize.event,this._onScroll=this.register(new f.EventEmitter),this.onScroll=this._onScroll.event,this.cols=Math.max(b.rawOptions.cols||0,l.MINIMUM_COLS),this.rows=Math.max(b.rawOptions.rows||0,l.MINIMUM_ROWS),this.buffers=this.register(new y.BufferSet(b,this))}resize(b,_){this.cols=b,this.rows=_,this.buffers.resize(b,_),this._onResize.fire({cols:b,rows:_})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(b,_=!1){const x=this.buffer;let S;S=this._cachedBlankLine,S&&S.length===this.cols&&S.getFg(0)===b.fg&&S.getBg(0)===b.bg||(S=x.getBlankLine(b,_),this._cachedBlankLine=S),S.isWrapped=_;const E=x.ybase+x.scrollTop,T=x.ybase+x.scrollBottom;if(x.scrollTop===0){const A=x.lines.isFull;T===x.lines.length-1?A?x.lines.recycle().copyFrom(S):x.lines.push(S.clone()):x.lines.splice(T+1,0,S.clone()),A?this.isUserScrolling&&(x.ydisp=Math.max(x.ydisp-1,0)):(x.ybase++,this.isUserScrolling||x.ydisp++)}else{const A=T-E+1;x.lines.shiftElements(E+1,A-1,-1),x.lines.set(T,S.clone())}this.isUserScrolling||(x.ydisp=x.ybase),this._onScroll.fire(x.ydisp)}scrollLines(b,_,x){const S=this.buffer;if(b<0){if(S.ydisp===0)return;this.isUserScrolling=!0}else b+S.ydisp>=S.ybase&&(this.isUserScrolling=!1);const E=S.ydisp;S.ydisp=Math.max(Math.min(S.ydisp+b,S.ybase),0),E!==S.ydisp&&(_||this._onScroll.fire(S.ydisp))}};l.BufferService=w=h([p(0,C.IOptionsService)],w)},7994:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CharsetService=void 0,l.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(u){this.glevel=u,this.charset=this._charsets[u]}setgCharset(u,h){this._charsets[u]=h,this.glevel===u&&(this.charset=h)}}},1753:function(c,l,u){var h=this&&this.__decorate||function(S,E,T,A){var D,M=arguments.length,R=M<3?E:A===null?A=Object.getOwnPropertyDescriptor(E,T):A;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")R=Reflect.decorate(S,E,T,A);else for(var z=S.length-1;z>=0;z--)(D=S[z])&&(R=(M<3?D(R):M>3?D(E,T,R):D(E,T))||R);return M>3&&R&&Object.defineProperty(E,T,R),R},p=this&&this.__param||function(S,E){return function(T,A){E(T,A,S)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreMouseService=void 0;const f=u(2585),g=u(8460),y=u(844),C={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:S=>S.button!==4&&S.action===1&&(S.ctrl=!1,S.alt=!1,S.shift=!1,!0)},VT200:{events:19,restrict:S=>S.action!==32},DRAG:{events:23,restrict:S=>S.action!==32||S.button!==3},ANY:{events:31,restrict:S=>!0}};function w(S,E){let T=(S.ctrl?16:0)|(S.shift?4:0)|(S.alt?8:0);return S.button===4?(T|=64,T|=S.action):(T|=3&S.button,4&S.button&&(T|=64),8&S.button&&(T|=128),S.action===32?T|=32:S.action!==0||E||(T|=3)),T}const b=String.fromCharCode,_={DEFAULT:S=>{const E=[w(S,!1)+32,S.col+32,S.row+32];return E[0]>255||E[1]>255||E[2]>255?"":`\x1B[M${b(E[0])}${b(E[1])}${b(E[2])}`},SGR:S=>{const E=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${w(S,!0)};${S.col};${S.row}${E}`},SGR_PIXELS:S=>{const E=S.action===0&&S.button!==4?"m":"M";return`\x1B[<${w(S,!0)};${S.x};${S.y}${E}`}};let x=l.CoreMouseService=class extends y.Disposable{constructor(S,E){super(),this._bufferService=S,this._coreService=E,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._onProtocolChange=this.register(new g.EventEmitter),this.onProtocolChange=this._onProtocolChange.event;for(const T of Object.keys(C))this.addProtocol(T,C[T]);for(const T of Object.keys(_))this.addEncoding(T,_[T]);this.reset()}addProtocol(S,E){this._protocols[S]=E}addEncoding(S,E){this._encodings[S]=E}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(S){if(!this._protocols[S])throw new Error(`unknown protocol "${S}"`);this._activeProtocol=S,this._onProtocolChange.fire(this._protocols[S].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(S){if(!this._encodings[S])throw new Error(`unknown encoding "${S}"`);this._activeEncoding=S}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}triggerMouseEvent(S){if(S.col<0||S.col>=this._bufferService.cols||S.row<0||S.row>=this._bufferService.rows||S.button===4&&S.action===32||S.button===3&&S.action!==32||S.button!==4&&(S.action===2||S.action===3)||(S.col++,S.row++,S.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,S,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(S))return!1;const E=this._encodings[this._activeEncoding](S);return E&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(E):this._coreService.triggerDataEvent(E,!0)),this._lastEvent=S,!0}explainEvents(S){return{down:!!(1&S),up:!!(2&S),drag:!!(4&S),move:!!(8&S),wheel:!!(16&S)}}_equalEvents(S,E,T){if(T){if(S.x!==E.x||S.y!==E.y)return!1}else if(S.col!==E.col||S.row!==E.row)return!1;return S.button===E.button&&S.action===E.action&&S.ctrl===E.ctrl&&S.alt===E.alt&&S.shift===E.shift}};l.CoreMouseService=x=h([p(0,f.IBufferService),p(1,f.ICoreService)],x)},6975:function(c,l,u){var h=this&&this.__decorate||function(x,S,E,T){var A,D=arguments.length,M=D<3?S:T===null?T=Object.getOwnPropertyDescriptor(S,E):T;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")M=Reflect.decorate(x,S,E,T);else for(var R=x.length-1;R>=0;R--)(A=x[R])&&(M=(D<3?A(M):D>3?A(S,E,M):A(S,E))||M);return D>3&&M&&Object.defineProperty(S,E,M),M},p=this&&this.__param||function(x,S){return function(E,T){S(E,T,x)}};Object.defineProperty(l,"__esModule",{value:!0}),l.CoreService=void 0;const f=u(1439),g=u(8460),y=u(844),C=u(2585),w=Object.freeze({insertMode:!1}),b=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let _=l.CoreService=class extends y.Disposable{constructor(x,S,E){super(),this._bufferService=x,this._logService=S,this._optionsService=E,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new g.EventEmitter),this.onData=this._onData.event,this._onUserInput=this.register(new g.EventEmitter),this.onUserInput=this._onUserInput.event,this._onBinary=this.register(new g.EventEmitter),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this.register(new g.EventEmitter),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=(0,f.clone)(w),this.decPrivateModes=(0,f.clone)(b)}reset(){this.modes=(0,f.clone)(w),this.decPrivateModes=(0,f.clone)(b)}triggerDataEvent(x,S=!1){if(this._optionsService.rawOptions.disableStdin)return;const E=this._bufferService.buffer;S&&this._optionsService.rawOptions.scrollOnUserInput&&E.ybase!==E.ydisp&&this._onRequestScrollToBottom.fire(),S&&this._onUserInput.fire(),this._logService.debug(`sending data "${x}"`,(()=>x.split("").map((T=>T.charCodeAt(0))))),this._onData.fire(x)}triggerBinaryEvent(x){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${x}"`,(()=>x.split("").map((S=>S.charCodeAt(0))))),this._onBinary.fire(x))}};l.CoreService=_=h([p(0,C.IBufferService),p(1,C.ILogService),p(2,C.IOptionsService)],_)},9074:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.DecorationService=void 0;const h=u(8055),p=u(8460),f=u(844),g=u(6106);let y=0,C=0;class w extends f.Disposable{get decorations(){return this._decorations.values()}constructor(){super(),this._decorations=new g.SortedList((x=>x==null?void 0:x.marker.line)),this._onDecorationRegistered=this.register(new p.EventEmitter),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this.register(new p.EventEmitter),this.onDecorationRemoved=this._onDecorationRemoved.event,this.register((0,f.toDisposable)((()=>this.reset())))}registerDecoration(x){if(x.marker.isDisposed)return;const S=new b(x);if(S){const E=S.marker.onDispose((()=>S.dispose()));S.onDispose((()=>{S&&(this._decorations.delete(S)&&this._onDecorationRemoved.fire(S),E.dispose())})),this._decorations.insert(S),this._onDecorationRegistered.fire(S)}return S}reset(){for(const x of this._decorations.values())x.dispose();this._decorations.clear()}*getDecorationsAtCell(x,S,E){let T=0,A=0;for(const D of this._decorations.getKeyIterator(S))T=D.options.x??0,A=T+(D.options.width??1),x>=T&&x{y=A.options.x??0,C=y+(A.options.width??1),x>=y&&x{Object.defineProperty(l,"__esModule",{value:!0}),l.InstantiationService=l.ServiceCollection=void 0;const h=u(2585),p=u(8343);class f{constructor(...y){this._entries=new Map;for(const[C,w]of y)this.set(C,w)}set(y,C){const w=this._entries.get(y);return this._entries.set(y,C),w}forEach(y){for(const[C,w]of this._entries.entries())y(C,w)}has(y){return this._entries.has(y)}get(y){return this._entries.get(y)}}l.ServiceCollection=f,l.InstantiationService=class{constructor(){this._services=new f,this._services.set(h.IInstantiationService,this)}setService(g,y){this._services.set(g,y)}getService(g){return this._services.get(g)}createInstance(g,...y){const C=(0,p.getServiceDependencies)(g).sort(((_,x)=>_.index-x.index)),w=[];for(const _ of C){const x=this._services.get(_.id);if(!x)throw new Error(`[createInstance] ${g.name} depends on UNKNOWN service ${_.id}.`);w.push(x)}const b=C.length>0?C[0].index:y.length;if(y.length!==b)throw new Error(`[createInstance] First service dependency of ${g.name} at position ${b+1} conflicts with ${y.length} static arguments`);return new g(...y,...w)}}},7866:function(c,l,u){var h=this&&this.__decorate||function(b,_,x,S){var E,T=arguments.length,A=T<3?_:S===null?S=Object.getOwnPropertyDescriptor(_,x):S;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")A=Reflect.decorate(b,_,x,S);else for(var D=b.length-1;D>=0;D--)(E=b[D])&&(A=(T<3?E(A):T>3?E(_,x,A):E(_,x))||A);return T>3&&A&&Object.defineProperty(_,x,A),A},p=this&&this.__param||function(b,_){return function(x,S){_(x,S,b)}};Object.defineProperty(l,"__esModule",{value:!0}),l.traceCall=l.setTraceLogger=l.LogService=void 0;const f=u(844),g=u(2585),y={trace:g.LogLevelEnum.TRACE,debug:g.LogLevelEnum.DEBUG,info:g.LogLevelEnum.INFO,warn:g.LogLevelEnum.WARN,error:g.LogLevelEnum.ERROR,off:g.LogLevelEnum.OFF};let C,w=l.LogService=class extends f.Disposable{get logLevel(){return this._logLevel}constructor(b){super(),this._optionsService=b,this._logLevel=g.LogLevelEnum.OFF,this._updateLogLevel(),this.register(this._optionsService.onSpecificOptionChange("logLevel",(()=>this._updateLogLevel()))),C=this}_updateLogLevel(){this._logLevel=y[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(b){for(let _=0;_JSON.stringify(A))).join(", ")})`);const T=S.apply(this,E);return C.trace(`GlyphRenderer#${S.name} return`,T),T}}},7302:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionsService=l.DEFAULT_OPTIONS=void 0;const h=u(8460),p=u(844),f=u(6114);l.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,cursorInactiveStyle:"outline",customGlyphs:!0,drawBoldTextInBrightColors:!0,documentOverride:null,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",ignoreBracketedPasteMode:!1,lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",logger:null,scrollback:1e3,scrollOnUserInput:!0,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rescaleOverlappingGlyphs:!1,rightClickSelectsWord:f.isMac,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const g=["normal","bold","100","200","300","400","500","600","700","800","900"];class y extends p.Disposable{constructor(w){super(),this._onOptionChange=this.register(new h.EventEmitter),this.onOptionChange=this._onOptionChange.event;const b={...l.DEFAULT_OPTIONS};for(const _ in w)if(_ in b)try{const x=w[_];b[_]=this._sanitizeAndValidateOption(_,x)}catch(x){console.error(x)}this.rawOptions=b,this.options={...b},this._setupOptions(),this.register((0,p.toDisposable)((()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null})))}onSpecificOptionChange(w,b){return this.onOptionChange((_=>{_===w&&b(this.rawOptions[w])}))}onMultipleOptionChange(w,b){return this.onOptionChange((_=>{w.indexOf(_)!==-1&&b()}))}_setupOptions(){const w=_=>{if(!(_ in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);return this.rawOptions[_]},b=(_,x)=>{if(!(_ in l.DEFAULT_OPTIONS))throw new Error(`No option with key "${_}"`);x=this._sanitizeAndValidateOption(_,x),this.rawOptions[_]!==x&&(this.rawOptions[_]=x,this._onOptionChange.fire(_))};for(const _ in this.rawOptions){const x={get:w.bind(this,_),set:b.bind(this,_)};Object.defineProperty(this.options,_,x)}}_sanitizeAndValidateOption(w,b){switch(w){case"cursorStyle":if(b||(b=l.DEFAULT_OPTIONS[w]),!(function(_){return _==="block"||_==="underline"||_==="bar"})(b))throw new Error(`"${b}" is not a valid value for ${w}`);break;case"wordSeparator":b||(b=l.DEFAULT_OPTIONS[w]);break;case"fontWeight":case"fontWeightBold":if(typeof b=="number"&&1<=b&&b<=1e3)break;b=g.includes(b)?b:l.DEFAULT_OPTIONS[w];break;case"cursorWidth":b=Math.floor(b);case"lineHeight":case"tabStopWidth":if(b<1)throw new Error(`${w} cannot be less than 1, value: ${b}`);break;case"minimumContrastRatio":b=Math.max(1,Math.min(21,Math.round(10*b)/10));break;case"scrollback":if((b=Math.min(b,4294967295))<0)throw new Error(`${w} cannot be less than 0, value: ${b}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(b<=0)throw new Error(`${w} cannot be less than or equal to 0, value: ${b}`);break;case"rows":case"cols":if(!b&&b!==0)throw new Error(`${w} must be numeric, value: ${b}`);break;case"windowsPty":b=b??{}}return b}}l.OptionsService=y},2660:function(c,l,u){var h=this&&this.__decorate||function(y,C,w,b){var _,x=arguments.length,S=x<3?C:b===null?b=Object.getOwnPropertyDescriptor(C,w):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(y,C,w,b);else for(var E=y.length-1;E>=0;E--)(_=y[E])&&(S=(x<3?_(S):x>3?_(C,w,S):_(C,w))||S);return x>3&&S&&Object.defineProperty(C,w,S),S},p=this&&this.__param||function(y,C){return function(w,b){C(w,b,y)}};Object.defineProperty(l,"__esModule",{value:!0}),l.OscLinkService=void 0;const f=u(2585);let g=l.OscLinkService=class{constructor(y){this._bufferService=y,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(y){const C=this._bufferService.buffer;if(y.id===void 0){const E=C.addMarker(C.ybase+C.y),T={data:y,id:this._nextId++,lines:[E]};return E.onDispose((()=>this._removeMarkerFromLink(T,E))),this._dataByLinkId.set(T.id,T),T.id}const w=y,b=this._getEntryIdKey(w),_=this._entriesWithId.get(b);if(_)return this.addLineToLink(_.id,C.ybase+C.y),_.id;const x=C.addMarker(C.ybase+C.y),S={id:this._nextId++,key:this._getEntryIdKey(w),data:w,lines:[x]};return x.onDispose((()=>this._removeMarkerFromLink(S,x))),this._entriesWithId.set(S.key,S),this._dataByLinkId.set(S.id,S),S.id}addLineToLink(y,C){const w=this._dataByLinkId.get(y);if(w&&w.lines.every((b=>b.line!==C))){const b=this._bufferService.buffer.addMarker(C);w.lines.push(b),b.onDispose((()=>this._removeMarkerFromLink(w,b)))}}getLinkData(y){var C;return(C=this._dataByLinkId.get(y))==null?void 0:C.data}_getEntryIdKey(y){return`${y.id};;${y.uri}`}_removeMarkerFromLink(y,C){const w=y.lines.indexOf(C);w!==-1&&(y.lines.splice(w,1),y.lines.length===0&&(y.data.id!==void 0&&this._entriesWithId.delete(y.key),this._dataByLinkId.delete(y.id)))}};l.OscLinkService=g=h([p(0,f.IBufferService)],g)},8343:(c,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createDecorator=l.getServiceDependencies=l.serviceRegistry=void 0;const u="di$target",h="di$dependencies";l.serviceRegistry=new Map,l.getServiceDependencies=function(p){return p[h]||[]},l.createDecorator=function(p){if(l.serviceRegistry.has(p))return l.serviceRegistry.get(p);const f=function(g,y,C){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");(function(w,b,_){b[u]===b?b[h].push({id:w,index:_}):(b[h]=[{id:w,index:_}],b[u]=b)})(f,g,C)};return f.toString=()=>p,l.serviceRegistry.set(p,f),f}},2585:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.IDecorationService=l.IUnicodeService=l.IOscLinkService=l.IOptionsService=l.ILogService=l.LogLevelEnum=l.IInstantiationService=l.ICharsetService=l.ICoreService=l.ICoreMouseService=l.IBufferService=void 0;const h=u(8343);var p;l.IBufferService=(0,h.createDecorator)("BufferService"),l.ICoreMouseService=(0,h.createDecorator)("CoreMouseService"),l.ICoreService=(0,h.createDecorator)("CoreService"),l.ICharsetService=(0,h.createDecorator)("CharsetService"),l.IInstantiationService=(0,h.createDecorator)("InstantiationService"),(function(f){f[f.TRACE=0]="TRACE",f[f.DEBUG=1]="DEBUG",f[f.INFO=2]="INFO",f[f.WARN=3]="WARN",f[f.ERROR=4]="ERROR",f[f.OFF=5]="OFF"})(p||(l.LogLevelEnum=p={})),l.ILogService=(0,h.createDecorator)("LogService"),l.IOptionsService=(0,h.createDecorator)("OptionsService"),l.IOscLinkService=(0,h.createDecorator)("OscLinkService"),l.IUnicodeService=(0,h.createDecorator)("UnicodeService"),l.IDecorationService=(0,h.createDecorator)("DecorationService")},1480:(c,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.UnicodeService=void 0;const h=u(8460),p=u(225);class f{static extractShouldJoin(y){return(1&y)!=0}static extractWidth(y){return y>>1&3}static extractCharKind(y){return y>>3}static createPropertyValue(y,C,w=!1){return(16777215&y)<<3|(3&C)<<1|(w?1:0)}constructor(){this._providers=Object.create(null),this._active="",this._onChange=new h.EventEmitter,this.onChange=this._onChange.event;const y=new p.UnicodeV6;this.register(y),this._active=y.version,this._activeProvider=y}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(y){if(!this._providers[y])throw new Error(`unknown Unicode version "${y}"`);this._active=y,this._activeProvider=this._providers[y],this._onChange.fire(y)}register(y){this._providers[y.version]=y}wcwidth(y){return this._activeProvider.wcwidth(y)}getStringCellWidth(y){let C=0,w=0;const b=y.length;for(let _=0;_=b)return C+this.wcwidth(x);const T=y.charCodeAt(_);56320<=T&&T<=57343?x=1024*(x-55296)+T-56320+65536:C+=this.wcwidth(T)}const S=this.charProperties(x,w);let E=f.extractWidth(S);f.extractShouldJoin(S)&&(E-=f.extractWidth(w)),C+=E,w=S}return C}charProperties(y,C){return this._activeProvider.charProperties(y,C)}}l.UnicodeService=f}},r={};function s(c){var l=r[c];if(l!==void 0)return l.exports;var u=r[c]={exports:{}};return n[c].call(u.exports,u,u.exports,s),u.exports}var a={};return(()=>{var c=a;Object.defineProperty(c,"__esModule",{value:!0}),c.Terminal=void 0;const l=s(9042),u=s(3236),h=s(844),p=s(5741),f=s(8285),g=s(7975),y=s(7090),C=["cols","rows"];class w extends h.Disposable{constructor(_){super(),this._core=this.register(new u.Terminal(_)),this._addonManager=this.register(new p.AddonManager),this._publicOptions={...this._core.options};const x=E=>this._core.options[E],S=(E,T)=>{this._checkReadonlyOptions(E),this._core.options[E]=T};for(const E in this._core.options){const T={get:x.bind(this,E),set:S.bind(this,E)};Object.defineProperty(this._publicOptions,E,T)}}_checkReadonlyOptions(_){if(C.includes(_))throw new Error(`Option "${_}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new g.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new y.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._buffer||(this._buffer=this.register(new f.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const _=this._core.coreService.decPrivateModes;let x="none";switch(this._core.coreMouseService.activeProtocol){case"X10":x="x10";break;case"VT200":x="vt200";break;case"DRAG":x="drag";break;case"ANY":x="any"}return{applicationCursorKeysMode:_.applicationCursorKeys,applicationKeypadMode:_.applicationKeypad,bracketedPasteMode:_.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:x,originMode:_.origin,reverseWraparoundMode:_.reverseWraparound,sendFocusMode:_.sendFocus,wraparoundMode:_.wraparound}}get options(){return this._publicOptions}set options(_){for(const x in _)this._publicOptions[x]=_[x]}blur(){this._core.blur()}focus(){this._core.focus()}input(_,x=!0){this._core.input(_,x)}resize(_,x){this._verifyIntegers(_,x),this._core.resize(_,x)}open(_){this._core.open(_)}attachCustomKeyEventHandler(_){this._core.attachCustomKeyEventHandler(_)}attachCustomWheelEventHandler(_){this._core.attachCustomWheelEventHandler(_)}registerLinkProvider(_){return this._core.registerLinkProvider(_)}registerCharacterJoiner(_){return this._checkProposedApi(),this._core.registerCharacterJoiner(_)}deregisterCharacterJoiner(_){this._checkProposedApi(),this._core.deregisterCharacterJoiner(_)}registerMarker(_=0){return this._verifyIntegers(_),this._core.registerMarker(_)}registerDecoration(_){return this._checkProposedApi(),this._verifyPositiveIntegers(_.x??0,_.width??0,_.height??0),this._core.registerDecoration(_)}hasSelection(){return this._core.hasSelection()}select(_,x,S){this._verifyIntegers(_,x,S),this._core.select(_,x,S)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(_,x){this._verifyIntegers(_,x),this._core.selectLines(_,x)}dispose(){super.dispose()}scrollLines(_){this._verifyIntegers(_),this._core.scrollLines(_)}scrollPages(_){this._verifyIntegers(_),this._core.scrollPages(_)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(_){this._verifyIntegers(_),this._core.scrollToLine(_)}clear(){this._core.clear()}write(_,x){this._core.write(_,x)}writeln(_,x){this._core.write(_),this._core.write(`\r +`,x)}paste(_){this._core.paste(_)}refresh(_,x){this._verifyIntegers(_,x),this._core.refresh(_,x)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(_){this._addonManager.loadAddon(this,_)}static get strings(){return l}_verifyIntegers(..._){for(const x of _)if(x===1/0||isNaN(x)||x%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(..._){for(const x of _)if(x&&(x===1/0||isNaN(x)||x%1!=0||x<0))throw new Error("This API only accepts positive integers")}}c.Terminal=w})(),a})()))})(Xp)),Xp.exports}var vU=gU();function n6(e){const t=atob(e),n=new Uint8Array(t.length);for(let r=0;r{const n=t.current;if(!n)return;const r=new vU.Terminal({convertEol:!0,disableStdin:!0,fontSize:12,fontFamily:getComputedStyle(document.documentElement).getPropertyValue("--mono").trim()||"ui-monospace, Menlo, Consolas, monospace",scrollback:2e4,theme:{background:"#1a1a1a",foreground:"#e6e1e0",cursor:"#1a1a1a",selectionBackground:"#2c3441"}}),s=new mU.FitAddon;r.loadAddon(s),r.open(n);try{s.fit()}catch{}const a=new ResizeObserver(()=>{try{s.fit()}catch{}});a.observe(n);let c=!1,l=0,u=!1,h=!1;async function p(){if(u){h=!0;return}u=!0;try{for(;;){const g=await JA(e,l);if(c)return;if(g.dataBase64&&r.write(n6(g.dataBase64)),l=g.nextOffset,g.eof)break}}catch{}finally{u=!1,h&&!c&&(h=!1,p())}}const f=qT(e,g=>{if(c)return;const y=n6(g.dataBase64);!u&&g.offset===l?(r.write(y),l+=y.length):g.offset+y.length>l&&p()});return p(),()=>{c=!0,f(),a.disconnect(),r.dispose()}},[e]),m.jsx("div",{ref:t,style:{width:"100%",height:"100%"}})}const zo="__uncommitted__";function bU({state:e}){return!e||e.loading?m.jsx("div",{className:"changes-note",children:"Loading diff…"}):e.error?m.jsx("div",{className:"error",children:e.error}):e.payload?e.payload.truncated?m.jsx(cw,{bytesRead:e.payload.bytesRead,byteLimit:e.payload.byteLimit}):m.jsx(i2,{diff:e.payload.diff}):m.jsx("div",{className:"diff-empty",children:"No changes."})}function _U({experiment:e,project:t,view:n,runs:r,selectedRunId:s,onSelectRun:a}){const c=r.filter(l=>l.experimentId===e.id).sort((l,u)=>u.createdAt-l.createdAt);return n==="terminal"?m.jsx(xU,{experiment:e,expRuns:c,selectedRunId:s,onSelectRun:a}):m.jsx(SU,{experiment:e,project:t})}function xU({experiment:e,expRuns:t,selectedRunId:n,onSelectRun:r}){const[s,a]=P.useState(null),[c,l]=P.useState(!1),u=P.useRef(null),h=n&&t.find(C=>C.id===n)||t[0]||null,p=(h==null?void 0:h.status)==="running"||(h==null?void 0:h.status)==="starting",f=C=>{const w=t.findIndex(b=>b.id===C);return w===-1?t.length:t.length-w},g=P.useRef(null);P.useEffect(()=>{if(g.current===null){g.current=new Set(t.map(w=>w.id));return}const C=t.find(w=>!g.current.has(w.id));for(const w of t)g.current.add(w.id);C&&r(C.id)},[t,r]),P.useEffect(()=>{if(!c)return;const C=w=>{var b;(b=u.current)!=null&&b.contains(w.target)||l(!1)};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[c]);async function y(){if(h){a(null);try{await Dx(h.id)}catch(C){a(C instanceof Error?C.message:String(C))}}}return m.jsxs("div",{className:"term-view",children:[m.jsxs("div",{className:"term-bar",children:[m.jsx("div",{className:"term-title",title:e.title||e.slug,children:e.title||e.slug}),m.jsx("span",{style:{flex:1}}),s&&m.jsx("span",{className:"error",children:s}),p&&m.jsxs("button",{className:"btn sm ghost",onClick:()=>void y(),children:[m.jsx(Vk,{size:13}),"Stop"]}),t.length>0&&h&&m.jsxs("div",{className:"run-history",ref:u,children:[m.jsxs("button",{className:"run-picker",title:"Switch run",onClick:()=>l(C=>!C),children:[m.jsxs("span",{className:"run-label",children:["Run ",f(h.id)]}),m.jsx(tl,{status:h.status}),m.jsx(Pa,{size:14,className:"run-picker-chev"})]}),c&&m.jsx("div",{className:"history-menu",children:t.map(C=>m.jsxs("button",{className:`history-item ${C.id===(h==null?void 0:h.id)?"active":""}`,onClick:()=>{r(C.id),l(!1)},children:[m.jsxs("span",{className:"run-label",children:["Run ",f(C.id)]}),m.jsx(tl,{status:C.status}),m.jsx("span",{className:"when",children:Ua(C.createdAt)})]},C.id))})]})]}),m.jsx("div",{className:"term-fill",children:h?m.jsx(yU,{runId:h.id},h.id):m.jsx("div",{className:"term-empty",children:"No runs yet — ask the agent to launch one."})})]})}function SU({experiment:e,project:t}){const[n,r]=P.useState(null),[s,a]=P.useState(null),[c,l]=P.useState(null),[u,h]=P.useState(null),[p,f]=P.useState({}),g=!!(c&&c.diff.trim()!==""&&c.experimentId===e.id);async function y(){a(null);try{const[w,b]=await Promise.all([tT(e.id),y3(e.projectId)]);r(w),l(b),h(_=>{var S;return _!==null?_:b.diff.trim()!==""&&b.experimentId===e.id?zo:((S=w[0])==null?void 0:S.sha)??null})}catch(w){a(w instanceof Error?w.message:String(w))}}P.useEffect(()=>{n===null&&!s&&y()},[n,s,e.id]),P.useEffect(()=>{const w=setInterval(()=>{y3(e.projectId).then(l).catch(()=>{})},5e3);return()=>clearInterval(w)},[e.projectId]),P.useEffect(()=>{var w;u===zo&&c&&!g&&h(((w=n==null?void 0:n[0])==null?void 0:w.sha)??null)},[u,c,g,n]),P.useEffect(()=>{if(!u||u===zo||p[u])return;const w=u;f(b=>({...b,[w]:{loading:!0}})),nT(e.id,w).then(b=>f(_=>({..._,[w]:{loading:!1,payload:b}}))).catch(b=>f(_=>({..._,[w]:{loading:!1,error:b instanceof Error?b.message:String(b)}})))},[u,p,e.id]);const C=!g&&((n==null?void 0:n.length)??0)===0;return m.jsx("div",{className:"drawer",children:m.jsx("div",{className:"drawer-body",children:m.jsxs("div",{className:"drawer-section",children:[m.jsxs("div",{className:"changes-branch",children:[m.jsx("span",{className:"ctl-label",children:"Branch"}),m.jsx(fU,{owner:t.githubOwner,repo:t.githubRepo,branch:e.branchName})]}),s?m.jsx("div",{className:"error",children:s}):n===null?m.jsx("div",{className:"changes-note",children:"Loading changes…"}):C?m.jsx("div",{className:"changes-note",children:"No changes yet — the agent hasn't committed on this branch."}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"commit-picker",children:[m.jsx("span",{className:"ctl-label",children:"Commit"}),u===zo&&m.jsx("span",{className:"uncommitted-dot"}),m.jsxs("select",{className:"input sm",value:u??"",onChange:w=>h(w.target.value),children:[g&&m.jsx("option",{value:zo,children:"● Uncommitted changes"}),n.map(w=>m.jsxs("option",{value:w.sha,children:[w.sha.slice(0,7)," — ",w.subject]},w.sha))]}),m.jsx("button",{className:"icon-btn",title:"Refresh","aria-label":"Refresh",onClick:()=>void y(),children:m.jsx(Zh,{size:14})})]}),m.jsx("div",{style:{marginTop:10},children:u===zo&&c?c.truncated?m.jsxs("div",{className:"truncated-notice",children:[m.jsx("h4",{children:"Diff too large to display"}),m.jsx("p",{children:"The uncommitted diff is too large to display. View it locally with git."})]}):m.jsx(i2,{diff:c.diff}):u?m.jsx(bU,{state:p[u]}):m.jsx("div",{className:"changes-note",children:"Select a commit to view its diff."})})]})]})})})}function wU({projectId:e,path:t,source:n="repo",sessionId:r,gitRef:s,onOpenFile:a}){const[c,l]=P.useState(null),[u,h]=P.useState(!1),[p,f]=P.useState(null),[g,y]=P.useState(!0),[C,w]=P.useState(0),b=n==="artifacts",_=/\.(md|mdx|markdown)$/i.test(t),x=t.split("/").slice(0,-1).join("/"),[S,E]=P.useState(!1),T=(c==null?void 0:c.file)??null,A=(c==null?void 0:c.viaArtifacts)??!1,D=b||A;P.useEffect(()=>{let R=!1;y(!0),h(!1);const z=()=>TT(e,t).then($=>({path:t,content:$??"",truncated:!1,notFound:$===null,root:"clone"}));return(b?z().then($=>({file:$,viaArtifacts:!1})):rT(e,t,{sessionId:r,ref:s}).then($=>$.notFound&&!s?z().then(U=>U.notFound?{file:$,viaArtifacts:!1}:{file:{...U,root:$.root},viaArtifacts:!0}):{file:$,viaArtifacts:!1})).then($=>{R||((b||$.viaArtifacts)&&$.file.content.includes("\0")&&h(!0),l($),f(null))}).catch($=>{R||f($.message)}).finally(()=>{R||y(!1)}),()=>{R=!0}},[e,t,n,r,s,C]);const M=R=>b?"Artifact not found in the project.":s?`File not found on branch ${s}.`:r&&R.root==="clone"?"This session's worktree isn't available, and the file isn't in the project clone or its artifacts.":`File not found in the ${R.root==="worktree"?"session's worktree":"project clone"} or the project's artifacts.`;return m.jsxs("div",{className:"file-view",children:[m.jsxs("div",{className:"file-view-header",children:[m.jsx(Cx,{size:13,style:{flexShrink:0}}),m.jsx("code",{className:"file-view-path",title:t,children:t}),s&&m.jsx("code",{className:"file-view-ref",title:`Committed state of ${s}`,children:s}),_&&m.jsx("button",{className:`icon-btn ${S?"active":""}`,"data-tip":S?"Rendered view":"View source","aria-label":S?"Rendered view":"View source",onClick:()=>E(R=>!R),children:m.jsx(bx,{size:13})}),m.jsx("button",{className:"icon-btn","data-tip":"Reload file","aria-label":"Reload file",onClick:()=>w(R=>R+1),children:g?m.jsx("span",{className:"spinner"}):m.jsx(Zh,{size:13})})]}),m.jsx("div",{className:"file-view-body",children:p?m.jsxs("div",{className:"file-view-note",children:["Failed to load file: ",p]}):T===null?m.jsx("div",{className:"file-view-note",children:"Loading…"}):T.notFound?m.jsx("div",{className:"file-view-note",children:M(T)}):u?m.jsx("div",{className:"file-view-note",children:"Binary file — no inline preview."}):m.jsxs(m.Fragment,{children:[!D&&!s&&r&&T.root==="clone"&&m.jsx("div",{className:"file-view-note",children:"This session's worktree isn't available — showing the project clone's copy."}),A&&m.jsxs("div",{className:"file-view-note",children:["Not in the ",T.root==="worktree"?"session's worktree":"project clone"," — showing the copy from the project's artifacts."]}),_&&!S?m.jsx("div",{className:"file-view-md",children:D?m.jsx(gw,{projectId:e,folder:x,markdown:T.content}):m.jsx(zc,{text:T.content,onOpenFile:a&&(R=>a(R,r,s))})}):m.jsx(uw,{text:T.content,path:t}),!D&&T.truncated&&m.jsx("div",{className:"file-view-note",children:"File truncated — showing the first 512 KB."})]})})]})}function CU({projectName:e,onHome:t,onCollapse:n}){return m.jsxs("div",{className:"rail-brand",children:[m.jsxs("button",{className:"brand",onClick:t,title:"All projects",children:[m.jsx(hm,{size:15}),m.jsx("span",{className:"brand-project",children:e})]}),n&&m.jsx("button",{className:"icon-btn",title:"Hide sidebar","aria-label":"Hide sidebar",onClick:n,children:m.jsx(kx,{size:15})})]})}const r6="Couldn't reach orx. Check it's still running, then re-check.";function EU({onDone:e}){const[t,n]=P.useState(0),[r,s]=P.useState(null),[a,c]=P.useState(null),[l,u]=P.useState(null),[h,p]=P.useState(!1),[f,g]=P.useState(!1),[y,C]=P.useState(!1),w=f||((r==null?void 0:r.some(E=>E.agentReady))??!1),b=(a==null?void 0:a.githubTokenSource)!=null,_=P.useRef(0),x=E=>{const T=++_.current;p(!0),g(!1),C(!1);const A=()=>T===_.current;Promise.allSettled([Og(E).then(D=>A()&&s(D)),Bx().then(D=>A()&&c(D)),RT().then(D=>A()&&u(D))]).then(([D,M])=>{A()&&(D.status==="rejected"&&(g(!0),s(null)),M.status==="rejected"&&(C(!0),c(null)))}).finally(()=>p(!1))};P.useEffect(()=>x(!1),[]);const S=()=>{LT((l==null?void 0:l.enabled)??!0).catch(()=>{}),e()};return m.jsx("div",{className:"home onboarding",children:m.jsx("div",{className:"home-inner",children:t===0?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:[m.jsx(Sc,{})," · Step 1 of 3"]}),m.jsx("h2",{className:"onb-title",children:"Your coding agents"}),m.jsx("p",{className:"onb-sub",children:"orx found the agent CLIs on this machine and drives them directly — chat and autoresearch run on your own logins, no extra API keys."}),m.jsx("div",{className:"onb-cards",children:r!==null?r.map(E=>m.jsx(AU,{h:E},E.id)):f?m.jsx("div",{className:"onb-card-meta",children:r6}):m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Detecting Claude Code, Codex, OpenCode…"]})}),r!==null&&!w&&m.jsx("p",{className:"onb-gate-hint",children:"Sign in to at least one agent to continue."}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>x(!0),disabled:h,children:[m.jsx(wh,{size:12,className:h?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(1),disabled:!w,title:w?void 0:"Sign in to at least one coding agent to continue",children:["Continue ",m.jsx(lp,{size:13})]})]})]}):t===1?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:[m.jsx(Sc,{})," · Step 2 of 3"]}),m.jsx("h2",{className:"onb-title",children:"Connect GitHub"}),m.jsx("p",{className:"onb-sub",children:"orx clones your GitHub repos and pushes each experiment as a branch."}),m.jsx("div",{className:"onb-cards",children:y?m.jsx("div",{className:"onb-card-meta",children:r6}):m.jsx(TU,{git:a,onUpdate:E=>{_.current++,c(E),C(!1)}})}),a!==null&&!b&&m.jsx("p",{className:"onb-gate-hint",children:"Without GitHub access, orx can't create repos for you — cloning and pushing still work if you have SSH keys."}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(0),children:[m.jsx(hm,{size:12})," Back"]}),m.jsxs("button",{className:"btn ghost",onClick:()=>x(!1),disabled:h,children:[m.jsx(wh,{size:12,className:h?"spin":""})," Re-check"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:()=>n(2),children:["Continue ",m.jsx(lp,{size:13})]})]})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-eyebrow",children:[m.jsx(Sc,{})," · Step 3 of 3"]}),m.jsx("h2",{className:"onb-title",children:"Usage analytics"}),m.jsx("p",{className:"onb-sub",children:"orx can send anonymous usage analytics to help improve the tool. No code, prompts, file contents, or identifiers are ever sent — just a random per-install id, the command run, and your OS."}),m.jsx("div",{className:"onb-cards",children:m.jsx(NU,{telemetry:l,onUpdate:u})}),m.jsx("p",{className:"onb-aside-text",style:{marginTop:12},children:"Your database, run logs, and artifacts stay on this machine — change where they live any time in Settings → Storage."}),m.jsxs("div",{className:"onb-actions",children:[m.jsxs("button",{className:"btn ghost",onClick:()=>n(1),children:[m.jsx(hm,{size:12})," Back"]}),m.jsx("div",{style:{flex:1}}),m.jsxs("button",{className:"btn primary",onClick:S,children:["Create your first project ",m.jsx(lp,{size:13})]})]})]})})})}function i6({cmd:e}){const[t,n]=P.useState(!1),r=()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})};return m.jsxs("span",{className:"onb-cmd-chip",children:[m.jsx("code",{children:e}),m.jsx("button",{className:"onb-cmd-copy",onClick:r,"aria-label":t?"Copied":"Copy command",title:t?"Copied":"Copy",children:t?m.jsx(Zr,{size:13,strokeWidth:3}):m.jsx(Ng,{size:13})})]})}function kU(e){return e.agentReady?{cls:"st-done",label:"Connected"}:e.installed?{cls:"st-starting",label:"Not signed in"}:{cls:"st-idle",label:"Not detected"}}function AU({h:e}){var r;const t=kU(e),n=(r=e.version)==null?void 0:r.replace(/\s*\(.*\)$/,"");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:e.name}),m.jsxs("span",{className:`status-badge ${t.cls}`,children:[e.agentReady?m.jsx(Zr,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),t.label]})]}),e.agentReady?m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-card-detail mono",children:[e.account??"API key",e.plan?` · ${e.plan}`:""]}),m.jsx("div",{className:"onb-card-meta",children:[n,e.models.length>0&&`${e.models.length} model${e.models.length===1?"":"s"} — ${e.models.slice(0,3).map(s=>Ch(s)).join(", ")}${e.models.length>3?", …":""}`].filter(Boolean).join(" · ")})]}):m.jsx("div",{className:"onb-card-meta",children:b8(e.agentNote)})]})}function TU({git:e,onUpdate:t}){const[n,r]=P.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking git…"]});if(!e.gitVersion)return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsx("span",{className:"onb-card-name",children:"git"}),m.jsxs("span",{className:"status-badge st-failed",children:[m.jsx("span",{className:"dot"})," Not found"]})]}),m.jsx("div",{className:"onb-card-meta",children:"Install git to clone projects, then re-open orx."})]});const s=[e.userName,e.userEmail&&`<${e.userEmail}>`].filter(Boolean).join(" ");return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-row",children:[m.jsx("span",{className:"onb-card-name",children:"GitHub"}),m.jsx("span",{className:"onb-card-detail mono",children:e.githubTokenSource==="env"?"Token from GITHUB_TOKEN":e.githubTokenSource==="stored"?"Token saved in orx":e.githubTokenSource==="gh"?"Signed in via gh CLI":""}),m.jsxs("span",{className:`status-badge ${e.githubTokenSource?"st-done":"st-starting"}`,children:[e.githubTokenSource?m.jsx(Zr,{size:12,strokeWidth:3}):m.jsx("span",{className:"dot"}),e.githubTokenSource?"Connected":"Not connected"]})]}),!e.githubTokenSource&&m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"onb-fix",children:[m.jsx("span",{className:"onb-fix-label",children:n?"Paste a personal access token:":e.ghInstalled?"Run this in your terminal to sign in:":"Install the GitHub CLI, then run this to sign in:"}),m.jsx("button",{className:"onb-fix-alt",onClick:()=>r(a=>!a),children:n?"Use gh instead":"Paste a token instead"})]}),n?m.jsx(f8,{onSaved:t}):m.jsx(i6,{cmd:"gh auth login"})]}),!s&&m.jsxs("div",{className:"onb-aside",children:[m.jsx("div",{className:"onb-aside-text",children:"Optional — so the agent's commits are attributed to you:"}),m.jsx(i6,{cmd:'git config --global user.name "Your Name" && git config --global user.email "you@example.com"'})]})]})}function NU({telemetry:e,onUpdate:t}){const[n,r]=P.useState(!1);if(e===null)return m.jsxs("div",{className:"onb-loading",children:[m.jsx("span",{className:"spinner"})," Checking analytics…"]});const s=e.enabled,a=!s&&e.reason!==null&&e.reason!=="disabled via `orx telemetry off`",c=l=>{n||l===s||(r(!0),jT(l).then(t).finally(()=>r(!1)))};return m.jsxs("div",{className:"onb-card",children:[m.jsxs("div",{className:"onb-card-head",children:[m.jsxs("div",{children:[m.jsx("div",{className:"onb-card-name",children:"Share anonymous usage analytics"}),m.jsx("div",{className:"onb-card-meta",style:{marginTop:2},children:s?"On — helps prioritize what to build next.":a?`Off — ${e.reason}.`:"Off — you can turn it back on anytime."})]}),m.jsxs("div",{style:{display:"flex",gap:6,flex:"none"},children:[m.jsxs("button",{className:`btn ${s?"primary":"ghost"}`,onClick:()=>c(!0),disabled:n,"aria-pressed":s,children:[s?m.jsx(Zr,{size:12,strokeWidth:3}):null," On"]}),m.jsxs("button",{className:`btn ${s?"ghost":"primary"}`,onClick:()=>c(!1),disabled:n,"aria-pressed":!s,children:[s?null:m.jsx(Zr,{size:12,strokeWidth:3})," Off"]})]})]}),m.jsxs("div",{className:"onb-card-meta",style:{marginTop:12},children:["Sent: a random per-install id, the command run, CLI version, and OS. Never sent: code, prompts, file contents, paths, or repo names. Change anytime in Settings or with"," ",m.jsx("code",{children:"orx telemetry off"}),"."]}),a&&m.jsxs("div",{className:"onb-card-meta",style:{marginTop:8},children:["Note: this run is off because of ",e.reason,", which overrides the saved choice."]})]})}function V0(e){const t=e.trim().replace(/^git@github\.com:/i,"").replace(/^https?:\/\/(www\.)?github\.com\//i,"").replace(/\.git$/i,"").replace(/^\/+|\/+$/g,""),[n,r]=t.split("/");return!n||!r||/[\s:@]/.test(n)||/[\s:@]/.test(r)?null:{owner:n,repo:r}}function MU(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48).replace(/-+$/,"")||"experiment"}function DU(e){const r=(e.trim().split(/[?#]/)[0].split("/").filter(Boolean).pop()??"").replace(/\.(pdf|md)$/i,"");return/^\d{4}\.\d{4,5}(v\d+)?$/.test(r)?r:null}function RU(e){return e.replace(/^\[[^\]]*\]\s*/,"").replace(/\s*[-–|]\s*arXiv\s*$/i,"")}function jU({onCreated:e,onCancel:t}){var be;const[n,r]=P.useState("paper"),[s,a]=P.useState("use"),[c,l]=P.useState(""),[u,h]=P.useState(""),[p,f]=P.useState(!1),[g,y]=P.useState(!1),[C,w]=P.useState(null),[b,_]=P.useState(""),[x,S]=P.useState([]),[E,T]=P.useState(!1),[A,D]=P.useState(null),[M,R]=P.useState(!1),[z,H]=P.useState(null),$=P.useRef(0),[U,q]=P.useState(null),[K,Y]=P.useState(null);P.useEffect(()=>{GA().then(he=>Y(he.login)).catch(()=>Y(null))},[]);const Q=K??"you",ee=V0(c),B=!!(u.trim()&&(n==="new"||n==="existing"&&ee!==null||n==="paper"&&A!==null&&(c.trim()===""||ee!==null))),L=he=>{r(he),he!=="paper"&&a("use")},O=he=>{var Se;l(he),n!=="paper"&&a("use"),p||h(((Se=V0(he))==null?void 0:Se.repo)??"")};async function W(he){const Se=++$.current;S([]),T(!1),R(!0),H(null);try{const Te=await WA(he);if(Se!==$.current)return;D(Te);const Re=Te.repoUrl?V0(Te.repoUrl):null;l(Re?`${Re.owner}/${Re.repo}`:""),a("fork"),p||h((Re==null?void 0:Re.repo)??(Te.title??"").trim().slice(0,60))}catch(Te){if(Se!==$.current)return;H(Te instanceof Error?Te.message:String(Te))}finally{Se===$.current&&R(!1)}}function G(){$.current++,D(null),_(""),S([]),H(null),l(""),p||h("")}const ie=ee?`${ee.owner}/${ee.repo}`:"";P.useEffect(()=>{if(!ie){q(null);return}const[he,Se]=ie.split("/");q(null);let Te=!0;const Re=setTimeout(()=>{VA(he,Se).then(He=>{Te&&(q(He.canPush),He.canPush||a("fork"))}).catch(()=>{Te&&q(!0)})},400);return()=>{Te=!1,clearTimeout(Re)}},[ie]),P.useEffect(()=>{if(n!=="paper"||A)return;const he=b.trim(),Se=DU(he);if(!Se&&he.length<3){S([]),T(!1);return}const Te=++$.current;Se||T(!0);const Re=setTimeout(()=>{if(Se){W(Se);return}qA(he).then(He=>{Te===$.current&&S(He)}).catch(He=>{Te===$.current&&(S([]),H(He instanceof Error?He.message:String(He)))}).finally(()=>{Te===$.current&&T(!1)})},350);return()=>clearTimeout(Re)},[n,A,b]);async function fe(he){if(he.preventDefault(),!(!B||g)){y(!0),w(null);try{const Se=await UA(n==="new"?{name:u.trim(),createRepo:!0}:n==="paper"&&!ee?{name:u.trim(),createRepo:!0,paperId:A.paperId}:{name:u.trim(),githubOwner:ee.owner,githubRepo:ee.repo,forkRepo:s==="fork",...n==="paper"?{paperId:A.paperId}:{}});e(Se)}catch(Se){w(Se instanceof Error?Se.message:String(Se))}finally{y(!1)}}}const pe=n==="new"||n==="paper"&&!ee,te=ee?`${ee.owner}/${ee.repo}`:"the repo",V=ee?U===null?m.jsxs("span",{className:"repo-hint",children:["Checking your access to ",te,"…"]}):m.jsx(m.Fragment,{children:U===!1?m.jsxs("span",{className:"repo-hint",children:["You can't push to ",te,", so orx snapshots its latest commit into a new private repo on github.com/",Q,". Your experiments push there."]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:s==="use"?"active":"",onClick:()=>a("use"),children:"Use this repo"}),m.jsx("button",{type:"button",className:s==="fork"?"active":"",onClick:()=>a("fork"),children:"Private copy"})]}),m.jsx("span",{className:"repo-hint mono ok",children:s==="fork"?`Snapshots the latest commit of ${te} into a new private repo on github.com/${Q}`:`Experiments push branches straight to ${te}`})]})}):null,ae=m.jsxs("label",{children:["Project name",m.jsx("input",{value:u,onChange:he=>{f(!0),h(he.target.value)},placeholder:"my-research"})]}),oe=m.jsx("span",{className:`repo-hint mono ${u.trim()?"ok":""}`,children:u.trim()?`Creates github.com/${Q}/${MU(u)} · private`:"A blank private repo is created on your GitHub account"});return m.jsxs("form",{className:"form",onSubmit:fe,children:[m.jsxs("div",{className:"seg form-seg",children:[m.jsx("button",{type:"button",className:n==="paper"?"active":"",onClick:()=>L("paper"),children:"From a paper"}),m.jsx("button",{type:"button",className:n==="existing"?"active":"",onClick:()=>L("existing"),children:"Existing repo"}),m.jsx("button",{type:"button",className:n==="new"?"active":"",onClick:()=>L("new"),children:"New blank repo"})]}),n==="existing"&&m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["GitHub repository",m.jsx("input",{value:c,onChange:he=>O(he.target.value),placeholder:"https://github.com/karpathy/nanoGPT",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${ee?"ok":""}`,children:ee?`${ee.owner} / ${ee.repo}`:c.trim()?"Paste a GitHub URL or owner/repo":"URL or owner/repo — cloned with your git credentials"})]}),V,ee&&ae]}),n==="paper"&&(A===null?m.jsxs(m.Fragment,{children:[m.jsxs("label",{children:["Paper",m.jsx("input",{value:b,onChange:he=>_(he.target.value),placeholder:"arXiv id, URL, or title — e.g. 1706.03762",autoFocus:!0,spellCheck:!1}),m.jsx("span",{className:`repo-hint ${z?"":"mono"}`,children:M?"Looking up paper…":E?"Searching alphaXiv…":z??"Searches alphaXiv by title — or paste an arXiv id / URL"})]}),!z&&!M&&!E&&m.jsx("span",{className:"repo-hint",children:"orx clones the code repo linked to the paper on alphaXiv."}),x.length>0&&m.jsx("div",{className:"paper-results",children:x.map(he=>m.jsxs("button",{type:"button",onClick:()=>void W(he.paperId),children:[m.jsx("span",{className:"title",children:RU(he.title)}),m.jsx("span",{className:"id",children:he.paperId})]},he.paperId))})]}):m.jsxs(m.Fragment,{children:[m.jsxs("div",{className:"paper-pick",children:[m.jsxs("div",{className:"meta",children:[m.jsx("div",{className:"title",children:A.title||A.paperId}),m.jsxs("div",{className:"id",children:["arXiv ",A.paperId]})]}),m.jsx("button",{type:"button",className:"btn ghost",onClick:G,children:"Change"})]}),m.jsxs("label",{children:["GitHub repository",A.repoUrl?"":" (optional)",m.jsx("input",{value:c,onChange:he=>O(he.target.value),placeholder:"owner/repo — leave blank for a new private repo",spellCheck:!1}),m.jsx("span",{className:`repo-hint mono ${ee?"ok":""}`,children:ee?`${ee.owner} / ${ee.repo}`+(A.repoUrl&&((be=V0(A.repoUrl))==null?void 0:be.repo)===ee.repo?` · linked on alphaXiv${A.repoStars!=null?` · ★ ${A.repoStars}`:""}`:""):c.trim()?"Paste a GitHub URL or owner/repo":"No code linked to this paper — a blank private repo will be created"})]}),V,ae,!ee&&oe]})),n==="new"&&m.jsxs(m.Fragment,{children:[ae,oe]}),C&&m.jsx("div",{className:"error",children:C}),m.jsxs("div",{className:"actions",children:[t&&m.jsx("button",{type:"button",className:"btn ghost",onClick:t,children:"Cancel"}),m.jsx("button",{type:"submit",className:"btn primary",disabled:!B||g,children:g?pe?"Creating repo…":s==="fork"?"Copying repo…":"Cloning repo…":"Create project"})]})]})}function s6({projects:e,onOpen:t,onCreated:n,onDeleted:r,openNewProject:s=!1,onNewProjectOpened:a}){const[c,l]=P.useState(s),[u,h]=P.useState(null);P.useEffect(()=>{s&&(a==null||a())},[]);async function p(f){if(window.confirm(`Delete project "${f.name}"? -Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){h(f.id);try{await KA(f.id),r(f.id)}catch(y){window.alert(y instanceof Error?y.message:String(y))}finally{h(null)}}}return m.jsxs("div",{className:"home",children:[m.jsxs("div",{className:"home-inner",children:[m.jsx("div",{className:"home-brand",children:m.jsx(Sc,{})}),m.jsxs("div",{className:"home-head",children:[m.jsx("h2",{children:"Projects"}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[m.jsx(Dg,{size:13})," New project"]})]}),m.jsx("div",{className:"home-list",children:e.length===0?m.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,g)=>g.updatedAt-f.updatedAt).map(f=>m.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&t(f.id)},children:[m.jsx("span",{className:"name",children:f.name}),m.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&m.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),m.jsxs("span",{className:"time",children:["created ",Ua(f.createdAt)]}),m.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:u===f.id,onClick:g=>{g.stopPropagation(),p(f)},children:m.jsx(Rg,{size:14})})]},f.id))})]}),c&&m.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:m.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[m.jsx("h2",{children:"New project"}),m.jsx(LU,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function OU(e){const t=Qh(e.backend);return t?[t,Fx(e.backend)].filter(Boolean).join(" · "):"—"}function BU({runs:e,experiments:t,emptyHint:n,onOpen:r,onOpenChanges:s,onCancel:a}){const c=new Map(t.map(u=>[u.id,u.slug])),l=[...e].sort((u,h)=>h.createdAt-u.createdAt);return l.length===0?m.jsx("div",{className:"empty-state",children:m.jsx("p",{children:n??"No runs yet."})}):m.jsx("div",{className:"runs-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Run"}),m.jsx("th",{children:"Experiment"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Commit"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Exit"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:l.map(u=>{const h=u.status==="running"||u.status==="starting";return m.jsxs("tr",{className:"clickable",onClick:()=>r(u),children:[m.jsx("td",{className:"mono",children:fm(u.id)}),m.jsx("td",{className:"mono",children:c.get(u.experimentId)??fm(u.experimentId)}),m.jsx("td",{children:m.jsx(tl,{status:u.status})}),m.jsx("td",{className:"mono",children:OU(u)}),m.jsx("td",{className:"mono",children:u.commitSha?u.commitSha.slice(0,7):"—"}),m.jsx("td",{children:Ua(u.createdAt)}),m.jsx("td",{className:"mono",children:u.exitCode??"—"}),m.jsx("td",{children:m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsx("button",{className:"icon-btn",title:"Open changes",onClick:p=>{p.stopPropagation(),s(u.experimentId)},children:m.jsx(cl,{size:14})}),h&&m.jsx("button",{className:"btn sm danger",onClick:p=>{p.stopPropagation(),a(u.id)},children:"Cancel"})]})})]},u.id)})})]})})}var _w=vx();function zU(e){const[t,n]=P.useState(null),[,r]=P.useState({});return t==null||t.setTracked(e),P.useEffect(()=>{const s=new IU(()=>r({}));return s.setTracked(e),n(s),()=>s.dispose()},[]),(t==null?void 0:t.bounds)??null}var pi,lg,cg,ug;class IU{constructor(t){a3(this,pi);xa(this,"selectors",new Set);xa(this,"elements",new Set);xa(this,"onSizeChange",()=>Sa(this,pi,lg).call(this));xa(this,"resizeObs",new ResizeObserver(this.onSizeChange));xa(this,"mutationObs",new MutationObserver(t=>this.onMutation(t)));xa(this,"bounds",null);this.onBoundsChange=t,window.addEventListener("resize",this.onSizeChange),document.addEventListener("scroll",this.onSizeChange,!0),this.mutationObs.observe(document.body,{childList:!0,subtree:!0})}dispose(){this.resizeObs.disconnect(),this.mutationObs.disconnect(),window.removeEventListener("resize",this.onSizeChange),document.removeEventListener("scroll",this.onSizeChange,!0)}setTracked(t){const n=new Set(t),r=[...n].filter(c=>!this.selectors.has(c)),s=[...this.selectors].filter(c=>!n.has(c));let a=!1;if(r.length>0){const c=r.map(u=>`[data-onboarding="${u}"]`).join(","),l=document.body.querySelectorAll(c);l.forEach(u=>{this.elements.add(u),this.resizeObs.observe(u)}),a||(a=l.length>0)}if(s.length>0){const c=s.map(u=>`[data-onboarding="${u}"]`).join(","),l=document.body.querySelectorAll(c);l.forEach(u=>{this.elements.delete(u),this.resizeObs.unobserve(u)}),a||(a=l.length>0)}a&&Sa(this,pi,cg).call(this),this.selectors=n}onMutation(t){if(this.selectors.size===0)return;const n=Array.from(this.selectors,s=>`[data-onboarding="${s}"]`).join(",");let r=!1;for(const s of t){for(const a of s.addedNodes)a instanceof Element&&(a.matches(n)&&(this.elements.add(a),this.resizeObs.observe(a),r=!0),a.querySelectorAll(n).forEach(c=>{this.elements.add(c),this.resizeObs.observe(c),r=!0}));for(const a of s.removedNodes)a instanceof Element&&(a.matches(n)&&(this.elements.delete(a),this.resizeObs.unobserve(a),r=!0),a.querySelectorAll(n).forEach(c=>{this.elements.delete(c),this.resizeObs.unobserve(c),r=!0}))}r&&Sa(this,pi,lg).call(this)}}pi=new WeakSet,lg=function(){const t=Sa(this,pi,ug).call(this);Sa(this,pi,cg).call(this),t!==Sa(this,pi,ug).call(this)&&this.onBoundsChange()},cg=function(){if(this.elements.size===0){this.bounds=null;return}const t=Array.from(this.elements,c=>c.getBoundingClientRect()).filter(c=>c.width>0&&c.height>0);if(t.length===0){this.bounds=null;return}const n=Math.min(...t.map(c=>c.left)),r=Math.min(...t.map(c=>c.top)),s=Math.max(...t.map(c=>c.right)),a=Math.max(...t.map(c=>c.bottom));this.bounds={x:n,y:r,width:s-n,height:a-r}},ug=function(){return this.bounds?[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height].join(","):"null"};function xw(){const[e,t]=P.useState(0),[n,r]=P.useState(0);return{ref:P.useCallback(a=>{if(!a)return;function c(){t(a.offsetWidth),r(a.offsetHeight)}const l=new ResizeObserver(c),u=new MutationObserver(c);return l.observe(a),u.observe(a,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),c(),()=>{l.disconnect(),u.disconnect()}},[]),offsetWidth:e,offsetHeight:n}}const W0=8;function Sw(e,t){const{offsetWidth:n,offsetHeight:r}=t,[{viewHeight:s,viewWidth:a},c]=P.useState({viewWidth:0,viewHeight:0});P.useEffect(()=>{function p(){c({viewWidth:window.innerWidth,viewHeight:window.innerHeight})}return window.addEventListener("resize",p),p(),()=>window.removeEventListener("resize",p)},[]);let l=0,u=0,h=0;if(e){const{distance:p}=e;switch(e.anchor){case"left":l=e.x-n-p,u=e.y+e.height/2-r/2;break;case"right":l=e.x+e.width+p,u=e.y+e.height/2-r/2;break;case"below":l=e.x+e.width/2-n/2,u=e.y+e.height+p;break;case"above":l=e.x+e.width/2-n/2,u=e.y-r-p;break}const f=l,g=u;l=Math.min(Math.max(l,W0),a-n-W0),u=Math.min(Math.max(u,W0),s-r-W0),h=e.anchor==="left"||e.anchor==="right"?g-u:f-l}return{x:l,y:u,arrowAdjustment:h}}const a6="orx:tour-done",Gs=8,HU=20,zh=[{focus:null,anchor:null,title:"Welcome to OpenResearch",description:"OpenResearch is your home for autoresearch. Spawn and coordinate research agents in one workspace."},{focus:["composer"],anchor:"above",title:"Talk to your research agent",description:"Prompt your research agents to replicate a paper, create a baseline experiment, run an eval, or investigate any research question. Type / for skills like /reproduce-paper."},{focus:["model-picker"],anchor:"above",title:"Pick your model",description:"Choose a model from any harness you've connected: Claude Code, Codex, or OpenCode. New sessions start with whatever you pick here, and each session keeps its harness."},{focus:["nav-files"],anchor:"right",title:"Reports and outputs",description:"The agent writes its reports, figures, and other outputs here, and anything you drop in is visible to it too. Check Files after a run to see what came back."},{focus:["nav-compute"],anchor:"right",title:"Configure compute",description:"This is where compute is configured. Point runs at this machine, Modal, SSH boxes, Kubernetes, or Slurm. Set it up once and agents pick the right hardware per run."},{focus:["experiments"],anchor:"left",title:"Follow every experiment",description:"Runs land here as a tree of experiments. Branch variants off a baseline, compare results, and open any run's terminal or code changes in a tab."},{focus:["new-session"],anchor:"right",title:"Start a session",description:"Each session is its own agent working in its own worktree, so you can run several agents in parallel. Ask for your first experiment whenever you're ready."}];function FU({onClose:e}){const[t,n]=P.useState(0),r=zh[t],s=zU(r.focus??[]);P.useEffect(()=>{function c(l){l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())}return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[e]);const a=s?{left:s.x-Gs,top:s.y-Gs,width:s.width+Gs*2,height:s.height+Gs*2}:null;return _w.createPortal(m.jsxs("div",{className:"tour-overlay",children:[a?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"tour-spotlight",style:a}),m.jsx("div",{className:"tour-ring",style:a})]}):m.jsx("div",{className:"tour-dim"}),m.jsx(PU,{step:r,bounds:s,index:t,onBack:()=>n(c=>Math.max(0,c-1)),onNext:()=>t+1>=zh.length?e():n(t+1),onClose:e})]}),document.body)}function PU({step:e,bounds:t,index:n,onBack:r,onNext:s,onClose:a}){const c=xw(),l=Sw(t&&e.anchor?{x:t.x-Gs,y:t.y-Gs,width:t.width+Gs*2,height:t.height+Gs*2,anchor:e.anchor,distance:HU}:null,c),u=e.anchor!=null&&t!=null&&l.x>0,h=n+1===zh.length;return m.jsxs("div",{ref:c.ref,className:`tour-card ${u?"":"centered"}`,style:u?{left:l.x,top:l.y}:void 0,children:[u&&e.anchor&&m.jsx($U,{anchor:e.anchor,adjustment:l.arrowAdjustment}),m.jsx("button",{className:"icon-btn tour-close",title:"Skip tour",onClick:a,children:m.jsx(Ko,{size:15})}),m.jsx("h3",{children:e.title}),m.jsx("p",{children:e.description}),m.jsxs("div",{className:"tour-footer",children:[m.jsx("div",{className:"tour-footer-side",children:n>0&&m.jsx("button",{className:"btn ghost",onClick:r,children:"Back"})}),m.jsxs("span",{className:"tour-count",children:[n+1," / ",zh.length]}),m.jsx("div",{className:"tour-footer-side end",children:m.jsx("button",{className:"btn primary",onClick:s,children:h?"Done":"Next"})})]})]})}function $U({anchor:e,adjustment:t}){const n=e==="above"||e==="below"?`${t}px 0`:`0 ${t}px`;return m.jsx("div",{className:`tour-arrow ${e}`,style:{translate:n}})}function Nn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function Bd(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gh.prototype=Bd.prototype={constructor:gh,on:function(e,t){var n=this._,r=qU(e+"",n),s,a=-1,c=r.length;if(arguments.length<2){for(;++a0)for(var n=new Array(s),r=0,s,a;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),l6.hasOwnProperty(t)?{space:l6[t],local:e}:e}function VU(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===hg&&t.documentElement.namespaceURI===hg?t.createElement(e):t.createElementNS(n,e)}}function WU(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ww(e){var t=zd(e);return(t.local?WU:VU)(t)}function YU(){}function s2(e){return e==null?YU:function(){return this.querySelector(e)}}function XU(e){typeof e!="function"&&(e=s2(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=S&&(S=x+1);!(T=_[S])&&++S=0;)(c=r[s])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function _q(e){e||(e=xq);function t(f,g){return f&&g?e(f.__data__,g.__data__):!f-!g}for(var n=this._groups,r=n.length,s=new Array(r),a=0;at?1:e>=t?0:NaN}function Sq(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function wq(){return Array.from(this)}function Cq(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Oq:typeof t=="function"?zq:Bq)(e,t,n??"")):rl(this.node(),e)}function rl(e,t){return e.style.getPropertyValue(t)||Tw(e).getComputedStyle(e,null).getPropertyValue(t)}function Hq(e){return function(){delete this[e]}}function Fq(e,t){return function(){this[e]=t}}function Pq(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function $q(e,t){return arguments.length>1?this.each((t==null?Hq:typeof t=="function"?Pq:Fq)(e,t)):this.node()[e]}function Nw(e){return e.trim().split(/^|\s+/)}function a2(e){return e.classList||new Mw(e)}function Mw(e){this._node=e,this._names=Nw(e.getAttribute("class")||"")}Mw.prototype={add:function(e){var t=this._names.indexOf(e);t<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 Dw(e,t){for(var n=a2(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function gG(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,a;n()=>e;function dg(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:a,x:c,y:l,dx:u,dy:h,dispatch:p}){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:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}dg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function kG(e){return!e.ctrlKey&&!e.button}function AG(){return this.parentNode}function TG(e,t){return t??{x:e.x,y:e.y}}function NG(){return navigator.maxTouchPoints||"ontouchstart"in this}function zw(){var e=kG,t=AG,n=TG,r=NG,s={},a=Bd("start","drag","end"),c=0,l,u,h,p,f=0;function g(E){E.on("mousedown.drag",y).filter(r).on("touchstart.drag",_).on("touchmove.drag",b,EG).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(E,T){if(!(p||!e.call(this,E,T))){var A=S(this,t.call(this,E,T),E,T,"mouse");A&&(Nr(E.view).on("mousemove.drag",C,$c).on("mouseup.drag",w,$c),Ow(E.view),Xp(E),h=!1,l=E.clientX,u=E.clientY,A("start",E))}}function C(E){if(Yo(E),!h){var T=E.clientX-l,A=E.clientY-u;h=T*T+A*A>f}s.mouse("drag",E)}function w(E){Nr(E.view).on("mousemove.drag mouseup.drag",null),Bw(E.view,h),Yo(E),s.mouse("end",E)}function _(E,T){if(e.call(this,E,T)){var A=E.changedTouches,D=t.call(this,E,T),M=A.length,R,z;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?X0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?X0(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=DG.exec(e))?new br(t[1],t[2],t[3],1):(t=RG.exec(e))?new br(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=jG.exec(e))?X0(t[1],t[2],t[3],t[4]):(t=LG.exec(e))?X0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=OG.exec(e))?m6(t[1],t[2]/100,t[3]/100,1):(t=BG.exec(e))?m6(t[1],t[2]/100,t[3]/100,t[4]):c6.hasOwnProperty(e)?d6(c6[e]):e==="transparent"?new br(NaN,NaN,NaN,0):null}function d6(e){return new br(e>>16&255,e>>8&255,e&255,1)}function X0(e,t,n,r){return r<=0&&(e=t=n=NaN),new br(e,t,n,r)}function HG(e){return e instanceof hu||(e=Ba(e)),e?(e=e.rgb(),new br(e.r,e.g,e.b,e.opacity)):new br}function fg(e,t,n,r){return arguments.length===1?HG(e):new br(e,t,n,r??1)}function br(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}o2(br,fg,Iw(hu,{brighter(e){return e=e==null?Hh:Math.pow(Hh,e),new br(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Uc:Math.pow(Uc,e),new br(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new br(ja(this.r),ja(this.g),ja(this.b),Fh(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:f6,formatHex:f6,formatHex8:FG,formatRgb:p6,toString:p6}));function f6(){return`#${Da(this.r)}${Da(this.g)}${Da(this.b)}`}function FG(){return`#${Da(this.r)}${Da(this.g)}${Da(this.b)}${Da((isNaN(this.opacity)?1:this.opacity)*255)}`}function p6(){const e=Fh(this.opacity);return`${e===1?"rgb(":"rgba("}${ja(this.r)}, ${ja(this.g)}, ${ja(this.b)}${e===1?")":`, ${e})`}`}function Fh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ja(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Da(e){return e=ja(e),(e<16?"0":"")+e.toString(16)}function m6(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new li(e,t,n,r)}function Hw(e){if(e instanceof li)return new li(e.h,e.s,e.l,e.opacity);if(e instanceof hu||(e=Ba(e)),!e)return new li;if(e instanceof li)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),a=Math.max(t,n,r),c=NaN,l=a-s,u=(a+s)/2;return l?(t===a?c=(n-r)/l+(n0&&u<1?0:c,new li(c,l,u,e.opacity)}function PG(e,t,n,r){return arguments.length===1?Hw(e):new li(e,t,n,r??1)}function li(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}o2(li,PG,Iw(hu,{brighter(e){return e=e==null?Hh:Math.pow(Hh,e),new li(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Uc:Math.pow(Uc,e),new li(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,s=2*n-r;return new br(Kp(e>=240?e-240:e+120,s,r),Kp(e,s,r),Kp(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new li(g6(this.h),K0(this.s),K0(this.l),Fh(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(){const e=Fh(this.opacity);return`${e===1?"hsl(":"hsla("}${g6(this.h)}, ${K0(this.s)*100}%, ${K0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function g6(e){return e=(e||0)%360,e<0?e+360:e}function K0(e){return Math.max(0,Math.min(1,e||0))}function Kp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const l2=e=>()=>e;function $G(e,t){return function(n){return e+n*t}}function UG(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function qG(e){return(e=+e)==1?Fw:function(t,n){return n-t?UG(t,n,e):l2(isNaN(t)?n:t)}}function Fw(e,t){var n=t-e;return n?$G(e,n):l2(isNaN(e)?t:e)}const Ph=(function e(t){var n=qG(t);function r(s,a){var c=n((s=fg(s)).r,(a=fg(a)).r),l=n(s.g,a.g),u=n(s.b,a.b),h=Fw(s.opacity,a.opacity);return function(p){return s.r=c(p),s.g=l(p),s.b=u(p),s.opacity=h(p),s+""}}return r.gamma=e,r})(1);function GG(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(a){for(s=0;sn&&(a=t.slice(n,a),l[c]?l[c]+=a:l[++c]=a),(r=r[0])===(s=s[0])?l[c]?l[c]+=s:l[++c]=s:(l[++c]=null,u.push({i:c,x:wi(r,s)})),n=Zp.lastIndex;return n180?p+=360:p-h>180&&(h+=360),g.push({i:f.push(s(f)+"rotate(",null,r)-2,x:wi(h,p)})):p&&f.push(s(f)+"rotate("+p+r)}function l(h,p,f,g){h!==p?g.push({i:f.push(s(f)+"skewX(",null,r)-2,x:wi(h,p)}):p&&f.push(s(f)+"skewX("+p+r)}function u(h,p,f,g,y,C){if(h!==f||p!==g){var w=y.push(s(y)+"scale(",null,",",null,")");C.push({i:w-4,x:wi(h,f)},{i:w-2,x:wi(p,g)})}else(f!==1||g!==1)&&y.push(s(y)+"scale("+f+","+g+")")}return function(h,p){var f=[],g=[];return h=e(h),p=e(p),a(h.translateX,h.translateY,p.translateX,p.translateY,f,g),c(h.rotate,p.rotate,f,g),l(h.skewX,p.skewX,f,g),u(h.scaleX,h.scaleY,p.scaleX,p.scaleY,f,g),h=p=null,function(y){for(var C=-1,w=g.length,_;++C=0&&e._call.call(void 0,t),e=e._next;--il}function b6(){za=(Uh=Gc.now())+Id,il=_c=0;try{aV()}finally{il=0,lV(),za=0}}function oV(){var e=Gc.now(),t=e-Uh;t>qw&&(Id-=t,Uh=e)}function lV(){for(var e,t=$h,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:$h=n);xc=e,gg(r)}function gg(e){if(!il){_c&&(_c=clearTimeout(_c));var t=e-za;t>24?(e<1/0&&(_c=setTimeout(b6,e-Gc.now()-Id)),vc&&(vc=clearInterval(vc))):(vc||(Uh=Gc.now(),vc=setInterval(oV,qw)),il=1,Gw(b6))}}function _6(e,t,n){var r=new qh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var cV=Bd("start","end","cancel","interrupt"),uV=[],Ww=0,x6=1,vg=2,yh=3,S6=4,yg=5,bh=6;function Hd(e,t,n,r,s,a){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;hV(e,n,{name:t,index:r,group:s,on:cV,tween:uV,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Ww})}function u2(e,t){var n=mi(e,t);if(n.state>Ww)throw new Error("too late; already scheduled");return n}function Ri(e,t){var n=mi(e,t);if(n.state>yh)throw new Error("too late; already running");return n}function mi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function hV(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=Vw(a,0,n.time);function a(h){n.state=x6,n.timer.restart(c,n.delay,n.time),n.delay<=h&&c(h-n.delay)}function c(h){var p,f,g,y;if(n.state!==x6)return u();for(p in r)if(y=r[p],y.name===n.name){if(y.state===yh)return _6(c);y.state===S6?(y.state=bh,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+pvg&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function PV(e,t,n){var r,s,a=FV(t)?u2:Ri;return function(){var c=a(this,e),l=c.on;l!==r&&(s=(r=l).copy()).on(t,n),c.on=s}}function $V(e,t){var n=this._id;return arguments.length<2?mi(this.node(),n).on.on(e):this.each(PV(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 qV(){return this.on("end.remove",UV(this._id))}function GV(e){var t=this._name,n=this._id;typeof e!="function"&&(e=s2(e));for(var r=this._groups,s=r.length,a=new Array(s),c=0;c()=>e;function gW(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:s}})}function es(e,t,n){this.k=e,this.x=t,this.y=n}es.prototype={constructor:es,scale:function(e){return e===1?this:new es(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new es(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 Fd=new es(1,0,0);Zw.prototype=es.prototype;function Zw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fd;return e.__zoom}function Qp(e){e.stopImmediatePropagation()}function yc(e){e.preventDefault(),e.stopImmediatePropagation()}function vW(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function yW(){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 w6(){return this.__zoom||Fd}function bW(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function _W(){return navigator.maxTouchPoints||"ontouchstart"in this}function xW(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function Qw(){var e=vW,t=yW,n=xW,r=bW,s=_W,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,u=vh,h=Bd("start","zoom","end"),p,f,g,y=500,C=150,w=0,_=10;function b(U){U.property("__zoom",w6).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",H).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",$).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(U,K,Y,Q){var ee=U.selection?U.selection():U;ee.property("__zoom",w6),U!==ee?T(U,K,Y,Q):ee.interrupt().each(function(){A(this,arguments).event(Q).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},b.scaleBy=function(U,K,Y,Q){b.scaleTo(U,function(){var ee=this.__zoom.k,B=typeof K=="function"?K.apply(this,arguments):K;return ee*B},Y,Q)},b.scaleTo=function(U,K,Y,Q){b.transform(U,function(){var ee=t.apply(this,arguments),B=this.__zoom,L=Y==null?E(ee):typeof Y=="function"?Y.apply(this,arguments):Y,O=B.invert(L),W=typeof K=="function"?K.apply(this,arguments):K;return n(S(x(B,W),L,O),ee,c)},Y,Q)},b.translateBy=function(U,K,Y,Q){b.transform(U,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof Y=="function"?Y.apply(this,arguments):Y),t.apply(this,arguments),c)},null,Q)},b.translateTo=function(U,K,Y,Q,ee){b.transform(U,function(){var B=t.apply(this,arguments),L=this.__zoom,O=Q==null?E(B):typeof Q=="function"?Q.apply(this,arguments):Q;return n(Fd.translate(O[0],O[1]).scale(L.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof Y=="function"?-Y.apply(this,arguments):-Y),B,c)},Q,ee)};function x(U,K){return K=Math.max(a[0],Math.min(a[1],K)),K===U.k?U:new es(K,U.x,U.y)}function S(U,K,Y){var Q=K[0]-Y[0]*U.k,ee=K[1]-Y[1]*U.k;return Q===U.x&&ee===U.y?U:new es(U.k,Q,ee)}function E(U){return[(+U[0][0]+ +U[1][0])/2,(+U[0][1]+ +U[1][1])/2]}function T(U,K,Y,Q){U.on("start.zoom",function(){A(this,arguments).event(Q).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(Q).end()}).tween("zoom",function(){var ee=this,B=arguments,L=A(ee,B).event(Q),O=t.apply(ee,B),W=Y==null?E(O):typeof Y=="function"?Y.apply(ee,B):Y,G=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),ie=ee.__zoom,fe=typeof K=="function"?K.apply(ee,B):K,pe=u(ie.invert(W).concat(G/ie.k),fe.invert(W).concat(G/fe.k));return function(te){if(te===1)te=fe;else{var V=pe(te),ae=G/V[2];te=new es(ae,W[0]-V[0]*ae,W[1]-V[1]*ae)}L.zoom(null,te)}})}function A(U,K,Y){return!Y&&U.__zooming||new D(U,K)}function D(U,K){this.that=U,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(U,K),this.taps=0}D.prototype={event:function(U){return U&&(this.sourceEvent=U),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(U,K){return this.mouse&&U!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&U!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&U!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(U){var K=Nr(this.that).datum();h.call(U,this.that,new gW(U,{sourceEvent:this.sourceEvent,target:b,transform:this.that.__zoom,dispatch:h}),K)}};function M(U,...K){if(!e.apply(this,arguments))return;var Y=A(this,K).event(U),Q=this.__zoom,ee=Math.max(a[0],Math.min(a[1],Q.k*Math.pow(2,r.apply(this,arguments)))),B=oi(U);if(Y.wheel)(Y.mouse[0][0]!==B[0]||Y.mouse[0][1]!==B[1])&&(Y.mouse[1]=Q.invert(Y.mouse[0]=B)),clearTimeout(Y.wheel);else{if(Q.k===ee)return;Y.mouse=[B,Q.invert(B)],_h(this),Y.start()}yc(U),Y.wheel=setTimeout(L,C),Y.zoom("mouse",n(S(x(Q,ee),Y.mouse[0],Y.mouse[1]),Y.extent,c));function L(){Y.wheel=null,Y.end()}}function R(U,...K){if(g||!e.apply(this,arguments))return;var Y=U.currentTarget,Q=A(this,K,!0).event(U),ee=Nr(U.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",G,!0),B=oi(U,Y),L=U.clientX,O=U.clientY;Ow(U.view),Qp(U),Q.mouse=[B,this.__zoom.invert(B)],_h(this),Q.start();function W(ie){if(yc(ie),!Q.moved){var fe=ie.clientX-L,pe=ie.clientY-O;Q.moved=fe*fe+pe*pe>w}Q.event(ie).zoom("mouse",n(S(Q.that.__zoom,Q.mouse[0]=oi(ie,Y),Q.mouse[1]),Q.extent,c))}function G(ie){ee.on("mousemove.zoom mouseup.zoom",null),Bw(ie.view,Q.moved),yc(ie),Q.event(ie).end()}}function z(U,...K){if(e.apply(this,arguments)){var Y=this.__zoom,Q=oi(U.changedTouches?U.changedTouches[0]:U,this),ee=Y.invert(Q),B=Y.k*(U.shiftKey?.5:2),L=n(S(x(Y,B),Q,ee),t.apply(this,K),c);yc(U),l>0?Nr(this).transition().duration(l).call(T,L,Q,U):Nr(this).call(b.transform,L,Q,U)}}function H(U,...K){if(e.apply(this,arguments)){var Y=U.touches,Q=Y.length,ee=A(this,K,U.changedTouches.length===Q).event(U),B,L,O,W;for(Qp(U),L=0;L`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.`},Vc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jw=["Enter"," ","Escape"],e9={"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"};var sl;(function(e){e.Strict="strict",e.Loose="loose"})(sl||(sl={}));var La;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(La||(La={}));var Wc;(function(e){e.Partial="partial",e.Full="full"})(Wc||(Wc={}));const t9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Us;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Us||(Us={}));var Gh;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Gh||(Gh={}));var We;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(We||(We={}));const C6={[We.Left]:We.Right,[We.Right]:We.Left,[We.Top]:We.Bottom,[We.Bottom]:We.Top};function n9(e){return e===null?null:e?"valid":"invalid"}const r9=e=>"id"in e&&"source"in e&&"target"in e,SW=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),d2=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),du=(e,t=[0,0])=>{const{width:n,height:r}=hs(e),s=e.origin??t,a=n*s[0],c=r*s[1];return{x:e.position.x-a,y:e.position.y-c}},wW=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const a=typeof s=="string";let c=!t.nodeLookup&&!a?s:void 0;t.nodeLookup&&(c=a?t.nodeLookup.get(s):d2(s)?s:t.nodeLookup.get(s.id));const l=c?Vh(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Pd(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $d(n)},fu=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=Pd(n,Vh(s)),r=!0)}),r?$d(n):{x:0,y:0,width:0,height:0}},f2=(e,t,[n,r,s]=[0,0,1],a=!1,c=!1)=>{const l=(t.x-n)/s,u=(t.y-r)/s,h=t.width/s,p=t.height/s,f=[];for(const g of e.values()){const{measured:y,selectable:C=!0,hidden:w=!1}=g;if(c&&!C||w)continue;const _=y.width??g.width??g.initialWidth??0,b=y.height??g.height??g.initialHeight??0,{x,y:S}=g.internals.positionAbsolute,E=o9(l,u,h,p,x,S,_,b),T=_*b,A=a&&E>0;(!g.internals.handleBounds||A||E>=T||g.dragging)&&f.push(g)}return f},CW=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function EW(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function kW({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:a},c){if(e.size===0)return!0;const l=EW(e,c),u=fu(l),h=m2(u,t,n,(c==null?void 0:c.minZoom)??s,(c==null?void 0:c.maxZoom)??a,(c==null?void 0:c.padding)??.1);return await r.setViewport(h,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),!0}function i9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:a}){const c=n.get(e),l=c.parentId?n.get(c.parentId):void 0,{x:u,y:h}=l?l.internals.positionAbsolute:{x:0,y:0},p=c.origin??r;let f=c.extent||s;if(c.extent==="parent"&&!c.expandParent)if(!l)a==null||a("005",fi.error005());else{const y=l.measured.width,C=l.measured.height;y&&C&&(f=[[u,h],[u+y,h+C]])}else l&&Ha(c.extent)&&(f=[[c.extent[0][0]+u,c.extent[0][1]+h],[c.extent[1][0]+u,c.extent[1][1]+h]]);const g=Ha(f)?Ia(t,f,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(a==null||a("015",fi.error015())),{position:{x:g.x-u+(c.measured.width??0)*p[0],y:g.y-h+(c.measured.height??0)*p[1]},positionAbsolute:g}}async function AW({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const a=new Set(e.map(g=>g.id)),c=[];for(const g of n){if(g.deletable===!1)continue;const y=a.has(g.id),C=!y&&g.parentId&&c.find(w=>w.id===g.parentId);(y||C)&&c.push(g)}const l=new Set(t.map(g=>g.id)),u=r.filter(g=>g.deletable!==!1),p=CW(c,u);for(const g of u)l.has(g.id)&&!p.find(C=>C.id===g.id)&&p.push(g);if(!s)return{edges:p,nodes:c};const f=await s({nodes:c,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:c}:{edges:[],nodes:[]}:f}const al=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ia=(e={x:0,y:0},t,n)=>({x:al(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:al(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function s9(e,t,n){const{width:r,height:s}=hs(n),{x:a,y:c}=n.internals.positionAbsolute;return Ia(e,[[a,c],[a+r,c+s]],t)}const E6=(e,t,n)=>en?-al(Math.abs(e-n),1,t)/t:0,p2=(e,t,n=15,r=40)=>{const s=E6(e.x,r,t.width-r)*n,a=E6(e.y,r,t.height-r)*n;return[s,a]},Pd=(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)}),bg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),$d=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Yc=(e,t=[0,0])=>{var s,a;const{x:n,y:r}=d2(e)?e.internals.positionAbsolute:du(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Vh=(e,t=[0,0])=>{var s,a;const{x:n,y:r}=d2(e)?e.internals.positionAbsolute:du(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},a9=(e,t)=>$d(Pd(bg(e),bg(t))),o9=(e,t,n,r,s,a,c,l)=>{const u=Math.max(0,Math.min(e+n,s+c)-Math.max(e,s)),h=Math.max(0,Math.min(t+r,a+l)-Math.max(t,a));return Math.ceil(u*h)},Wh=(e,t)=>o9(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),k6=e=>ci(e.width)&&ci(e.height)&&ci(e.x)&&ci(e.y),ci=e=>!isNaN(e)&&isFinite(e),l9=(e,t)=>(n,r)=>{},pu=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),mu=({x:e,y:t},[n,r,s],a=!1,c=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return a?pu(l,c):l},ol=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Io(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const 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 TW(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Io(e,n),s=Io(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Io(e.top??e.y??0,n),s=Io(e.bottom??e.y??0,n),a=Io(e.left??e.x??0,t),c=Io(e.right??e.x??0,t);return{top:r,right:c,bottom:s,left:a,x:a+c,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function NW(e,t,n,r,s,a){const{x:c,y:l}=ol(e,[t,n,r]),{x:u,y:h}=ol({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-u,f=a-h;return{left:Math.floor(c),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const m2=(e,t,n,r,s,a)=>{const c=TW(a,t,n),l=(t-c.x)/e.width,u=(n-c.y)/e.height,h=Math.min(l,u),p=al(h,r,s),f=e.x+e.width/2,g=e.y+e.height/2,y=t/2-f*p,C=n/2-g*p,w=NW(e,y,C,p,t,n),_={left:Math.min(w.left-c.left,0),top:Math.min(w.top-c.top,0),right:Math.min(w.right-c.right,0),bottom:Math.min(w.bottom-c.bottom,0)};return{x:y-_.left+_.right,y:C-_.top+_.bottom,zoom:p}},Xc=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ha(e){return e!=null&&e!=="parent"}function hs(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function c9(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function u9(e,t={width:0,height:0},n,r,s){const a={...e},c=r.get(n);if(c){const l=c.origin||s;a.x+=c.internals.positionAbsolute.x-(t.width??0)*l[0],a.y+=c.internals.positionAbsolute.y-(t.height??0)*l[1]}return a}function A6(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function MW(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function DW(e){return{...e9,...e||{}}}function Nc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:a,y:c}=ui(e),l=mu({x:a-((s==null?void 0:s.left)??0),y:c-((s==null?void 0:s.top)??0)},r),{x:u,y:h}=n?pu(l,t):l;return{xSnapped:u,ySnapped:h,...l}}const g2=e=>({width:e.offsetWidth,height:e.offsetHeight}),h9=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},RW=["INPUT","SELECT","TEXTAREA"];function d9(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:RW.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const f9=e=>"clientX"in e,ui=(e,t)=>{var a,c;const n=f9(e),r=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,s=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},T6=(e,t,n,r,s)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(c=>{const l=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:s,position:c.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...g2(c)}})};function p9({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:l}){const u=e*.125+s*.375+c*.375+n*.125,h=t*.125+a*.375+l*.375+r*.125,p=Math.abs(u-e),f=Math.abs(h-t);return[u,h,p,f]}function J0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function N6({pos:e,x1:t,y1:n,x2:r,y2:s,c:a}){switch(e){case We.Left:return[t-J0(t-r,a),n];case We.Right:return[t+J0(r-t,a),n];case We.Top:return[t,n-J0(n-s,a)];case We.Bottom:return[t,n+J0(s-n,a)]}}function m9({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:a=We.Top,curvature:c=.25}){const[l,u]=N6({pos:n,x1:e,y1:t,x2:r,y2:s,c}),[h,p]=N6({pos:a,x1:r,y1:s,x2:e,y2:t,c}),[f,g,y,C]=p9({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${r},${s}`,f,g,y,C]}function g9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,a=n0}const OW=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,BW=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),zW=(e,t,n={})=>{var a;if(!e.source||!e.target)return(a=n.onError)==null||a.call(n,"006",fi.error006()),t;const r=n.getEdgeId||OW;let s;return r9(e)?s={...e}:s={...e,id:r(e)},BW(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function v9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,a,c,l]=g9({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,a,c,l]}const M6={[We.Left]:{x:-1,y:0},[We.Right]:{x:1,y:0},[We.Top]:{x:0,y:-1},[We.Bottom]:{x:0,y:1}},IW=({source:e,sourcePosition:t=We.Bottom,target:n})=>t===We.Left||t===We.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function HW({source:e,sourcePosition:t=We.Bottom,target:n,targetPosition:r=We.Top,center:s,offset:a,stepPosition:c}){const l=M6[t],u=M6[r],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=IW({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",y=f[g];let C=[],w,_;const b={x:0,y:0},x={x:0,y:0},[,,S,E]=g9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){g==="x"?(w=s.x??h.x+(p.x-h.x)*c,_=s.y??(h.y+p.y)/2):(w=s.x??(h.x+p.x)/2,_=s.y??h.y+(p.y-h.y)*c);const M=[{x:w,y:h.y},{x:w,y:p.y}],R=[{x:h.x,y:_},{x:p.x,y:_}];l[g]===y?C=g==="x"?M:R:C=g==="x"?R:M}else{const M=[{x:h.x,y:p.y}],R=[{x:p.x,y:h.y}];if(g==="x"?C=l.x===y?R:M:C=l.y===y?M:R,t===r){const U=Math.abs(e[g]-n[g]);if(U<=a){const K=Math.min(a-1,a-U);l[g]===y?b[g]=(h[g]>e[g]?-1:1)*K:x[g]=(p[g]>n[g]?-1:1)*K}}if(t!==r){const U=g==="x"?"y":"x",K=l[g]===u[U],Y=h[U]>p[U],Q=h[U]=$?(w=(z.x+H.x)/2,_=C[0].y):(w=C[0].x,_=(z.y+H.y)/2)}const T={x:h.x+b.x,y:h.y+b.y},A={x:p.x+x.x,y:p.y+x.y};return[[e,...T.x!==C[0].x||T.y!==C[0].y?[T]:[],...C,...A.x!==C[C.length-1].x||A.y!==C[C.length-1].y?[A]:[],n],w,_,S,E]}function FW(e,t,n,r){const s=Math.min(D6(e,t)/2,D6(t,n)/2,r),{x:a,y:c}=t;if(e.x===a&&a===n.x||e.y===c&&c===n.y)return`L${a} ${c}`;if(e.y===c){const h=e.xn.id===t):e[0])||null}function xg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function $W(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const a=new Set;return e.reduce((c,l)=>([l.markerStart||r,l.markerEnd||s].forEach(u=>{if(u&&typeof u=="object"){const h=xg(u,t);a.has(h)||(c.push({id:h,color:u.color||n,...u}),a.add(h))}}),c),[]).sort((c,l)=>c.id.localeCompare(l.id))}const y9=1e3,UW=10,v2={nodeOrigin:[0,0],nodeExtent:Vc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},qW={...v2,checkEquality:!0};function y2(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function GW(e,t,n){const r=y2(v2,n);for(const s of e.values())if(s.parentId)_2(s,e,t,r);else{const a=du(s,r.nodeOrigin),c=Ha(s.extent)?s.extent:r.nodeExtent,l=Ia(a,c,hs(s));s.internals.positionAbsolute=l}}function VW(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(a):s.type==="target"&&r.push(a)}return{source:n,target:r}}function b2(e){return e==="manual"}function Sg(e,t,n,r={}){var p,f;const s=y2(qW,r),a={i:0},c=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!b2(s.zIndexMode)?y9:0;let u=e.length>0,h=!1;t.clear(),n.clear();for(const g of e){let y=c.get(g.id);if(s.checkEquality&&g===(y==null?void 0:y.internals.userNode))t.set(g.id,y);else{const C=du(g,s.nodeOrigin),w=Ha(g.extent)?g.extent:s.nodeExtent,_=Ia(C,w,hs(g));y={...s.defaults,...g,measured:{width:(p=g.measured)==null?void 0:p.width,height:(f=g.measured)==null?void 0:f.height},internals:{positionAbsolute:_,handleBounds:VW(g,y),z:b9(g,l,s.zIndexMode),userNode:g}},t.set(g.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(u=!1),g.parentId&&_2(y,t,n,r,a),h||(h=g.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:h}}function WW(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function _2(e,t,n,r,s){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:l,zIndexMode:u}=y2(v2,r),h=e.parentId,p=t.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}WW(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*UW),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=a&&!b2(u)?y9:0,{x:g,y,z:C}=YW(e,p,c,l,f,u),{positionAbsolute:w}=e.internals,_=g!==w.x||y!==w.y;(_||C!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:_?{x:g,y}:w,z:C}})}function b9(e,t,n){const r=ci(e.zIndex)?e.zIndex:0;return b2(n)?r:r+(e.selected?t:0)}function YW(e,t,n,r,s,a){const{x:c,y:l}=t.internals.positionAbsolute,u=hs(e),h=du(e,n),p=Ha(e.extent)?Ia(h,e.extent,u):h;let f=Ia({x:c+p.x,y:l+p.y},r,u);e.extent==="parent"&&(f=s9(f,u,t));const g=b9(e,s,a),y=t.internals.z??0;return{x:f.x,y:f.y,z:y>=g?y+1:g}}function x2(e,t,n,r=[0,0]){var c;const s=[],a=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const h=((c=a.get(l.parentId))==null?void 0:c.expandedRect)??Yc(u),p=a9(h,l.rect);a.set(l.parentId,{expandedRect:p,parent:u})}return a.size>0&&a.forEach(({expandedRect:l,parent:u},h)=>{var S;const p=u.internals.positionAbsolute,f=hs(u),g=u.origin??r,y=l.x0||C>0||b||x)&&(s.push({id:h,type:"position",position:{x:u.position.x-y+b,y:u.position.y-C+x}}),(S=n.get(h))==null||S.forEach(E=>{e.some(T=>T.id===E.id)||s.push({id:E.id,type:"position",position:{x:E.position.x+y,y:E.position.y+C}})})),(f.width0){const y=x2(g,t,n,s);h.push(...y)}return{changes:h,updatedInternals:u}}async function KW({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:a}){if(!t||!e.x&&!e.y)return!1;const c=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,a]],r);return!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2])}function O6(e,t,n,r,s,a){let c=s;const l=r.get(c)||new Map;r.set(c,l.set(n,t)),c=`${s}-${e}`;const u=r.get(c)||new Map;if(r.set(c,u.set(n,t)),a){c=`${s}-${e}-${a}`;const h=r.get(c)||new Map;r.set(c,h.set(n,t))}}function _9(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:a,sourceHandle:c=null,targetHandle:l=null}=r,u={edgeId:r.id,source:s,target:a,sourceHandle:c,targetHandle:l},h=`${s}-${c}--${a}-${l}`,p=`${a}-${l}--${s}-${c}`;O6("source",u,p,e,s,c),O6("target",u,h,e,a,l),t.set(r.id,r)}}function x9(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:x9(n,t):!1}function B6(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function ZW(e,t,n,r){const s=new Map;for(const[a,c]of e)if((c.selected||c.id===r)&&(!c.parentId||!x9(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const l=e.get(a);l&&s.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function Jp({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var c,l,u;const s=[];for(const[h,p]of t){const f=(c=n.get(h))==null?void 0:c.internals.userNode;f&&s.push({...f,position:p.position,dragging:r})}if(!e)return[s[0],s];const a=(l=n.get(e))==null?void 0:l.internals.userNode;return[a?{...a,position:((u=t.get(e))==null?void 0:u.position)||a.position,dragging:r}:s[0],s]}function QW({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const a={x:n-s.distance.x,y:r-s.distance.y},c=pu(a,t);return{x:c.x-a.x,y:c.y-a.y}}function JW({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let a={x:null,y:null},c=0,l=new Map,u=!1,h={x:0,y:0},p=null,f=!1,g=null,y=!1,C=!1,w=null;function _({noDragClassName:x,handleSelector:S,domNode:E,isSelectable:T,nodeId:A,nodeClickDistance:D=0}){g=Nr(E);function M({x:q,y:$}){const{nodeLookup:U,nodeExtent:K,snapGrid:Y,snapToGrid:Q,nodeOrigin:ee,onNodeDrag:B,onSelectionDrag:L,onError:O,updateNodePositions:W}=t();a={x:q,y:$};let G=!1;const ie=l.size>1,fe=ie&&K?bg(fu(l)):null,pe=ie&&Q?QW({dragItems:l,snapGrid:Y,x:q,y:$}):null;for(const[te,V]of l){if(!U.has(te))continue;let ae={x:q-V.distance.x,y:$-V.distance.y};Q&&(ae=pe?{x:Math.round(ae.x+pe.x),y:Math.round(ae.y+pe.y)}:pu(ae,Y));let oe=null;if(ie&&K&&!V.extent&&fe){const{positionAbsolute:Se}=V.internals,Te=Se.x-fe.x+K[0][0],Re=Se.x+V.measured.width-fe.x2+K[1][0],He=Se.y-fe.y+K[0][1],ze=Se.y+V.measured.height-fe.y2+K[1][1];oe=[[Te,He],[Re,ze]]}const{position:be,positionAbsolute:he}=i9({nodeId:te,nextPosition:ae,nodeLookup:U,nodeExtent:oe||K,nodeOrigin:ee,onError:O});G=G||V.position.x!==be.x||V.position.y!==be.y,V.position=be,V.internals.positionAbsolute=he}if(C=C||G,!!G&&(W(l,!0),w&&(r||B||!A&&L))){const[te,V]=Jp({nodeId:A,dragItems:l,nodeLookup:U});r==null||r(w,l,te,V),B==null||B(w,te,V),A||L==null||L(w,V)}}async function R(){if(!p)return;const{transform:q,panBy:$,autoPanSpeed:U,autoPanOnNodeDrag:K}=t();if(!K){u=!1,cancelAnimationFrame(c);return}const[Y,Q]=p2(h,p,U);(Y!==0||Q!==0)&&(a.x=(a.x??0)-Y/q[2],a.y=(a.y??0)-Q/q[2],await $({x:Y,y:Q})&&M(a)),c=requestAnimationFrame(R)}function z(q){var ie;const{nodeLookup:$,multiSelectionActive:U,nodesDraggable:K,transform:Y,snapGrid:Q,snapToGrid:ee,selectNodesOnDrag:B,onNodeDragStart:L,onSelectionDragStart:O,unselectNodesAndEdges:W}=t();f=!0,(!B||!T)&&!U&&A&&((ie=$.get(A))!=null&&ie.selected||W()),T&&B&&A&&(e==null||e(A));const G=Nc(q.sourceEvent,{transform:Y,snapGrid:Q,snapToGrid:ee,containerBounds:p});if(a=G,l=ZW($,K,G,A),l.size>0&&(n||L||!A&&O)){const[fe,pe]=Jp({nodeId:A,dragItems:l,nodeLookup:$});n==null||n(q.sourceEvent,l,fe,pe),L==null||L(q.sourceEvent,fe,pe),A||O==null||O(q.sourceEvent,pe)}}const H=zw().clickDistance(D).on("start",q=>{const{domNode:$,nodeDragThreshold:U,transform:K,snapGrid:Y,snapToGrid:Q}=t();p=($==null?void 0:$.getBoundingClientRect())||null,y=!1,C=!1,w=q.sourceEvent,U===0&&z(q),a=Nc(q.sourceEvent,{transform:K,snapGrid:Y,snapToGrid:Q,containerBounds:p}),h=ui(q.sourceEvent,p)}).on("drag",q=>{const{autoPanOnNodeDrag:$,transform:U,snapGrid:K,snapToGrid:Y,nodeDragThreshold:Q,nodeLookup:ee}=t(),B=Nc(q.sourceEvent,{transform:U,snapGrid:K,snapToGrid:Y,containerBounds:p});if(w=q.sourceEvent,(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1||A&&!ee.has(A))&&(y=!0),!y){if(!u&&$&&f&&(u=!0,R()),!f){const L=ui(q.sourceEvent,p),O=L.x-h.x,W=L.y-h.y;Math.sqrt(O*O+W*W)>Q&&z(q)}(a.x!==B.xSnapped||a.y!==B.ySnapped)&&l&&f&&(h=ui(q.sourceEvent,p),M(B))}}).on("end",q=>{if(!f||y){y&&l.size>0&&t().updateNodePositions(l,!1);return}if(u=!1,f=!1,cancelAnimationFrame(c),l.size>0){const{nodeLookup:$,updateNodePositions:U,onNodeDragStop:K,onSelectionDragStop:Y}=t();if(C&&(U(l,!1),C=!1),s||K||!A&&Y){const[Q,ee]=Jp({nodeId:A,dragItems:l,nodeLookup:$,dragging:!1});s==null||s(q.sourceEvent,l,Q,ee),K==null||K(q.sourceEvent,Q,ee),A||Y==null||Y(q.sourceEvent,ee)}}}).filter(q=>{const $=q.target;return!q.button&&(!x||!B6($,`.${x}`,E))&&(!S||B6($,S,E))});g.call(H)}function b(){g==null||g.on(".drag",null)}return{update:_,destroy:b}}function eY(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())Wh(s,Yc(a))>0&&r.push(a);return r}const tY=250;function nY(e,t,n,r){var l,u;let s=[],a=1/0;const c=eY(e,n,t+tY);for(const h of c){const p=[...((l=h.internals.handleBounds)==null?void 0:l.source)??[],...((u=h.internals.handleBounds)==null?void 0:u.target)??[]];for(const f of p){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:g,y}=Fa(h,f,f.position,!0),C=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(y-e.y,2));C>t||(C1){const h=r.type==="source"?"target":"source";return s.find(p=>p.type===h)??s[0]}return s[0]}function S9(e,t,n,r,s,a=!1){var h,p,f;const c=r.get(e);if(!c)return null;const l=s==="strict"?(h=c.internals.handleBounds)==null?void 0:h[t]:[...((p=c.internals.handleBounds)==null?void 0:p.source)??[],...((f=c.internals.handleBounds)==null?void 0:f.target)??[]],u=(n?l==null?void 0:l.find(g=>g.id===n):l==null?void 0:l[0])??null;return u&&a?{...u,...Fa(c,u,u.position,!0)}:u}function w9(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function rY(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const C9=()=>!0;function iY(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:a,isTarget:c,domNode:l,nodeLookup:u,lib:h,autoPanOnConnect:p,flowId:f,panBy:g,cancelConnection:y,onConnectStart:C,onConnect:w,onConnectEnd:_,isValidConnection:b=C9,onReconnectEnd:x,updateConnection:S,getTransform:E,getFromHandle:T,autoPanSpeed:A,dragThreshold:D=1,handleDomNode:M}){const R=h9(e.target);let z=0,H;const{x:q,y:$}=ui(e),U=w9(a,M),K=l==null?void 0:l.getBoundingClientRect();let Y=!1;if(!K||!U)return;const Q=S9(s,U,r,u,t);if(!Q)return;let ee=ui(e,K),B=!1,L=null,O=!1,W=null;function G(){if(!p||!K)return;const[be,he]=p2(ee,K,A);g({x:be,y:he}),z=requestAnimationFrame(G)}const ie={...Q,nodeId:s,type:U,position:Q.position},fe=u.get(s);let te={inProgress:!0,isValid:null,from:Fa(fe,ie,We.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:fe,to:ee,toHandle:null,toPosition:C6[ie.position],toNode:null,pointer:ee};function V(){Y=!0,S(te),C==null||C(e,{nodeId:s,handleId:r,handleType:U})}D===0&&V();function ae(be){if(!Y){const{x:ze,y:zt}=ui(be),At=ze-q,Tt=zt-$;if(!(At*At+Tt*Tt>D*D))return;V()}if(!T()||!ie){oe(be);return}const he=E();ee=ui(be,K),H=nY(mu(ee,he,!1,[1,1]),n,u,ie),B||(G(),B=!0);const Se=E9(be,{handle:H,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:c?"target":"source",isValidConnection:b,doc:R,lib:h,flowId:f,nodeLookup:u});W=Se.handleDomNode,L=Se.connection,O=rY(!!H,Se.isValid);const Te=u.get(s),Re=Te?Fa(Te,ie,We.Left,!0):te.from,He={...te,from:Re,isValid:O,to:Se.toHandle&&O?ol({x:Se.toHandle.x,y:Se.toHandle.y},he):ee,toHandle:Se.toHandle,toPosition:O&&Se.toHandle?Se.toHandle.position:C6[ie.position],toNode:Se.toHandle?u.get(Se.toHandle.nodeId):null,pointer:ee};S(He),te=He}function oe(be){if(!("touches"in be&&be.touches.length>0)){if(Y){(H||W)&&L&&O&&(w==null||w(L));const{inProgress:he,...Se}=te,Te={...Se,toPosition:te.toHandle?te.toPosition:null};_==null||_(be,Te),a&&(x==null||x(be,Te))}y(),cancelAnimationFrame(z),B=!1,O=!1,L=null,W=null,R.removeEventListener("mousemove",ae),R.removeEventListener("mouseup",oe),R.removeEventListener("touchmove",ae),R.removeEventListener("touchend",oe)}}R.addEventListener("mousemove",ae),R.addEventListener("mouseup",oe),R.addEventListener("touchmove",ae),R.addEventListener("touchend",oe)}function E9(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:a,doc:c,lib:l,flowId:u,isValidConnection:h=C9,nodeLookup:p}){const f=a==="target",g=t?c.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:C}=ui(e),w=c.elementFromPoint(y,C),_=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:g,b={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const x=w9(void 0,_),S=_.getAttribute("data-nodeid"),E=_.getAttribute("data-handleid"),T=_.classList.contains("connectable"),A=_.classList.contains("connectableend");if(!S||!x)return b;const D={source:f?S:r,sourceHandle:f?E:s,target:f?r:S,targetHandle:f?s:E};b.connection=D;const R=T&&A&&(n===sl.Strict?f&&x==="source"||!f&&x==="target":S!==r||E!==s);b.isValid=R&&h(D),b.toHandle=S9(S,x,E,p,n,!0)}return b}const wg={onPointerDown:iY,isValid:E9};function sY({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Nr(e);function a({translateExtent:l,width:u,height:h,zoomStep:p=1,pannable:f=!0,zoomable:g=!0,inversePan:y=!1}){const C=S=>{if(S.sourceEvent.type!=="wheel"||!t)return;const E=n(),T=S.sourceEvent.ctrlKey&&Xc()?10:1,A=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*p,D=E[2]*Math.pow(2,A*T);t.scaleTo(D)};let w=[0,0];const _=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(w=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},b=S=>{const E=n();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const T=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],A=[T[0]-w[0],T[1]-w[1]];w=T;const D=r()*Math.max(E[2],Math.log(E[2]))*(y?-1:1),M={x:E[0]-A[0]*D,y:E[1]-A[1]*D},R=[[0,0],[u,h]];t.setViewportConstrained({x:M.x,y:M.y,zoom:E[2]},R,l)},x=Qw().on("start",_).on("zoom",f?b:null).on("zoom.wheel",g?C:null);s.call(x,{})}function c(){s.on("zoom",null)}return{update:a,destroy:c,pointer:oi}}const Ud=e=>({x:e.x,y:e.y,zoom:e.k}),em=({x:e,y:t,zoom:n})=>Fd.translate(e,t).scale(n),Go=(e,t)=>e.target.closest(`.${t}`),k9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),aY=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,tm=(e,t=0,n=aY,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},A9=e=>{const t=e.ctrlKey&&Xc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function oY({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:h}){return p=>{if(Go(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(p.ctrlKey&&c){const _=oi(p),b=A9(p),x=f*Math.pow(2,b);r.scaleTo(n,x,_,p);return}const g=p.deltaMode===1?20:1;let y=s===La.Vertical?0:p.deltaX*g,C=s===La.Horizontal?0:p.deltaY*g;!Xc()&&p.shiftKey&&s!==La.Vertical&&(y=p.deltaY*g,C=0),r.translateBy(n,-(y/f)*a,-(C/f)*a,{internal:!0});const w=Ud(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,w),e.panScrollTimeout=setTimeout(()=>{h==null||h(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,w))}}function lY({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const a=r.type==="wheel",c=!t&&a&&!r.ctrlKey,l=Go(r,e);if(r.ctrlKey&&a&&l&&r.preventDefault(),c||l)return null;r.preventDefault(),n.call(this,r,s)}}function cY({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var a,c,l;if((a=r.sourceEvent)!=null&&a.internal)return;const s=Ud(r.transform);e.mouseButton=((c=r.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function uY({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return a=>{var c,l;e.usedRightMouseButton=!!(n&&k9(t,e.mouseButton??0)),(c=a.sourceEvent)!=null&&c.sync||r([a.transform.x,a.transform.y,a.transform.k]),s&&!((l=a.sourceEvent)!=null&&l.internal)&&(s==null||s(a.sourceEvent,Ud(a.transform)))}}function hY({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:a}){return c=>{var l;if(!((l=c.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,a&&k9(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const u=Ud(c.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(c.sourceEvent,u)},n?150:0)}}}function dY({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:l,noPanClassName:u,lib:h,connectionInProgress:p}){return f=>{var _;const g=e||t,y=n&&f.ctrlKey,C=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Go(f,`${h}-flow__node`)||Go(f,`${h}-flow__edge`)))return!0;if(!r&&!g&&!s&&!a&&!n||c||p&&!C||Go(f,l)&&C||Go(f,u)&&(!C||s&&C&&!e)||!n&&f.ctrlKey&&C)return!1;if(!n&&f.type==="touchstart"&&((_=f.touches)==null?void 0:_.length)>1)return f.preventDefault(),!1;if(!g&&!s&&!y&&C||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||C)&&w}}function fY({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:l,onDraggingChange:u}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=Qw().scaleExtent([t,n]).translateExtent(r),g=Nr(e).call(f);x({x:s.x,y:s.y,zoom:al(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const y=g.on("wheel.zoom"),C=g.on("dblclick.zoom");f.wheelDelta(A9);async function w(H,q){return g?new Promise($=>{f==null||f.interpolate((q==null?void 0:q.interpolate)==="linear"?Tc:vh).transform(tm(g,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>$(!0)),H)}):!1}function _({noWheelClassName:H,noPanClassName:q,onPaneContextMenu:$,userSelectionActive:U,panOnScroll:K,panOnDrag:Y,panOnScrollMode:Q,panOnScrollSpeed:ee,preventScrolling:B,zoomOnPinch:L,zoomOnScroll:O,zoomOnDoubleClick:W,zoomActivationKeyPressed:G,lib:ie,onTransformChange:fe,connectionInProgress:pe,paneClickDistance:te,selectionOnDrag:V}){U&&!h.isZoomingOrPanning&&b();const ae=K&&!G&&!U;f.clickDistance(V?1/0:!ci(te)||te<0?0:te);const oe=ae?oY({zoomPanValues:h,noWheelClassName:H,d3Selection:g,d3Zoom:f,panOnScrollMode:Q,panOnScrollSpeed:ee,zoomOnPinch:L,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}):lY({noWheelClassName:H,preventScrolling:B,d3ZoomHandler:y});g.on("wheel.zoom",oe,{passive:!1});const be=cY({zoomPanValues:h,onDraggingChange:u,onPanZoomStart:c});f.on("start",be);const he=uY({zoomPanValues:h,panOnDrag:Y,onPaneContextMenu:!!$,onPanZoom:a,onTransformChange:fe});f.on("zoom",he);const Se=hY({zoomPanValues:h,panOnDrag:Y,panOnScroll:K,onPaneContextMenu:$,onPanZoomEnd:l,onDraggingChange:u});f.on("end",Se);const Te=dY({zoomActivationKeyPressed:G,panOnDrag:Y,zoomOnScroll:O,panOnScroll:K,zoomOnDoubleClick:W,zoomOnPinch:L,userSelectionActive:U,noPanClassName:q,noWheelClassName:H,lib:ie,connectionInProgress:pe});f.filter(Te),W?g.on("dblclick.zoom",C):g.on("dblclick.zoom",null)}function b(){f.on("zoom",null)}async function x(H,q,$){const U=em(H),K=f==null?void 0:f.constrain()(U,q,$);return K&&await w(K),K}async function S(H,q){const $=em(H);return await w($,q),$}function E(H){if(g){const q=em(H),$=g.property("__zoom");($.k!==H.zoom||$.x!==H.x||$.y!==H.y)&&(f==null||f.transform(g,q,null,{sync:!0}))}}function T(){const H=g?Zw(g.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}async function A(H,q){return g?new Promise($=>{f==null||f.interpolate((q==null?void 0:q.interpolate)==="linear"?Tc:vh).scaleTo(tm(g,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>$(!0)),H)}):!1}async function D(H,q){return g?new Promise($=>{f==null||f.interpolate((q==null?void 0:q.interpolate)==="linear"?Tc:vh).scaleBy(tm(g,q==null?void 0:q.duration,q==null?void 0:q.ease,()=>$(!0)),H)}):!1}function M(H){f==null||f.scaleExtent(H)}function R(H){f==null||f.translateExtent(H)}function z(H){const q=!ci(H)||H<0?0:H;f==null||f.clickDistance(q)}return{update:_,destroy:b,setViewport:S,setViewportConstrained:x,getViewport:T,scaleTo:A,scaleBy:D,setScaleExtent:M,setTranslateExtent:R,syncViewport:E,setClickDistance:z}}var ll;(function(e){e.Line="line",e.Handle="handle"})(ll||(ll={}));function pY({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:a}){const c=e-t,l=n-r,u=[c>0?1:c<0?-1:0,l>0?1:l<0?-1:0];return c&&s&&(u[0]=u[0]*-1),l&&a&&(u[1]=u[1]*-1),u}function z6(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Ps(e,t){return Math.max(0,t-e)}function $s(e,t){return Math.max(0,e-t)}function eh(e,t,n){return Math.max(0,t-e,e-n)}function I6(e,t){return e?!t:t}function mY(e,t,n,r,s,a,c,l){let{affectsX:u,affectsY:h}=t;const{isHorizontal:p,isVertical:f}=t,g=p&&f,{xSnapped:y,ySnapped:C}=n,{minWidth:w,maxWidth:_,minHeight:b,maxHeight:x}=r,{x:S,y:E,width:T,height:A,aspectRatio:D}=e;let M=Math.floor(p?y-e.pointerX:0),R=Math.floor(f?C-e.pointerY:0);const z=T+(u?-M:M),H=A+(h?-R:R),q=-a[0]*T,$=-a[1]*A;let U=eh(z,w,_),K=eh(H,b,x);if(c){let ee=0,B=0;u&&M<0?ee=Ps(S+M+q,c[0][0]):!u&&M>0&&(ee=$s(S+z+q,c[1][0])),h&&R<0?B=Ps(E+R+$,c[0][1]):!h&&R>0&&(B=$s(E+H+$,c[1][1])),U=Math.max(U,ee),K=Math.max(K,B)}if(l){let ee=0,B=0;u&&M>0?ee=$s(S+M,l[0][0]):!u&&M<0&&(ee=Ps(S+z,l[1][0])),h&&R>0?B=$s(E+R,l[0][1]):!h&&R<0&&(B=Ps(E+H,l[1][1])),U=Math.max(U,ee),K=Math.max(K,B)}if(s){if(p){const ee=eh(z/D,b,x)*D;if(U=Math.max(U,ee),c){let B=0;!u&&!h||u&&!h&&g?B=$s(E+$+z/D,c[1][1])*D:B=Ps(E+$+(u?M:-M)/D,c[0][1])*D,U=Math.max(U,B)}if(l){let B=0;!u&&!h||u&&!h&&g?B=Ps(E+z/D,l[1][1])*D:B=$s(E+(u?M:-M)/D,l[0][1])*D,U=Math.max(U,B)}}if(f){const ee=eh(H*D,w,_)/D;if(K=Math.max(K,ee),c){let B=0;!u&&!h||h&&!u&&g?B=$s(S+H*D+q,c[1][0])/D:B=Ps(S+(h?R:-R)*D+q,c[0][0])/D,K=Math.max(K,B)}if(l){let B=0;!u&&!h||h&&!u&&g?B=Ps(S+H*D,l[1][0])/D:B=$s(S+(h?R:-R)*D,l[0][0])/D,K=Math.max(K,B)}}}R=R+(R<0?K:-K),M=M+(M<0?U:-U),s&&(g?z>H*D?R=(I6(u,h)?-M:M)/D:M=(I6(u,h)?-R:R)*D:p?(R=M/D,h=u):(M=R*D,u=h));const Y=u?S+M:S,Q=h?E+R:E;return{width:T+(u?-M:M),height:A+(h?-R:R),x:a[0]*M*(u?-1:1)+Y,y:a[1]*R*(h?-1:1)+Q}}const T9={width:0,height:0,x:0,y:0},gY={...T9,pointerX:0,pointerY:0,aspectRatio:1};function vY(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,a=e.measured.width??0,c=e.measured.height??0,l=n[0]*a,u=n[1]*c;return[[r-l,s-u],[r+a-l,s+c-u]]}function yY({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const a=Nr(e);let c={controlDirection:z6("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:h,boundaries:p,keepAspectRatio:f,resizeDirection:g,onResizeStart:y,onResize:C,onResizeEnd:w,shouldResize:_}){let b={...T9},x={...gY};c={boundaries:p,resizeDirection:g,keepAspectRatio:f,controlDirection:z6(h)};let S,E=null,T=[],A,D,M,R=!1;const z=zw().on("start",H=>{const{nodeLookup:q,transform:$,snapGrid:U,snapToGrid:K,nodeOrigin:Y,paneDomNode:Q}=n();if(S=q.get(t),!S)return;E=(Q==null?void 0:Q.getBoundingClientRect())??null;const{xSnapped:ee,ySnapped:B}=Nc(H.sourceEvent,{transform:$,snapGrid:U,snapToGrid:K,containerBounds:E});b={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},x={...b,pointerX:ee,pointerY:B,aspectRatio:b.width/b.height},A=void 0,D=Ha(S.extent)?S.extent:void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(A=q.get(S.parentId)),A&&S.extent==="parent"&&(D=[[0,0],[A.measured.width,A.measured.height]]),T=[],M=void 0;for(const[L,O]of q)if(O.parentId===t&&(T.push({id:L,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const W=vY(O,S,O.origin??Y);M?M=[[Math.min(W[0][0],M[0][0]),Math.min(W[0][1],M[0][1])],[Math.max(W[1][0],M[1][0]),Math.max(W[1][1],M[1][1])]]:M=W}y==null||y(H,{...b})}).on("drag",H=>{const{transform:q,snapGrid:$,snapToGrid:U,nodeOrigin:K}=n(),Y=Nc(H.sourceEvent,{transform:q,snapGrid:$,snapToGrid:U,containerBounds:E}),Q=[];if(!S)return;const{x:ee,y:B,width:L,height:O}=b,W={},G=S.origin??K,{width:ie,height:fe,x:pe,y:te}=mY(x,c.controlDirection,Y,c.boundaries,c.keepAspectRatio,G,D,M),V=ie!==L,ae=fe!==O,oe=pe!==ee&&V,be=te!==B&&ae;if(!oe&&!be&&!V&&!ae)return;if((oe||be||G[0]===1||G[1]===1)&&(W.x=oe?pe:b.x,W.y=be?te:b.y,b.x=W.x,b.y=W.y,T.length>0)){const Re=pe-ee,He=te-B;for(const ze of T)ze.position={x:ze.position.x-Re+G[0]*(ie-L),y:ze.position.y-He+G[1]*(fe-O)},Q.push(ze)}if((V||ae)&&(W.width=V&&(!c.resizeDirection||c.resizeDirection==="horizontal")?ie:b.width,W.height=ae&&(!c.resizeDirection||c.resizeDirection==="vertical")?fe:b.height,b.width=W.width,b.height=W.height),A&&S.expandParent){const Re=G[0]*(W.width??0);W.x&&W.x{R&&(w==null||w(H,{...b}),s==null||s({...b}),R=!1)});a.call(z)}function u(){a.on(".drag",null)}return{update:l,destroy:u}}var nm={exports:{}},rm={},im={exports:{}},sm={};/** +Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githubOwner}/${f.githubRepo}) is kept.`)){h(f.id);try{await XA(f.id),r(f.id)}catch(y){window.alert(y instanceof Error?y.message:String(y))}finally{h(null)}}}return m.jsxs("div",{className:"home",children:[m.jsxs("div",{className:"home-inner",children:[m.jsx("div",{className:"home-brand",children:m.jsx(Sc,{})}),m.jsxs("div",{className:"home-head",children:[m.jsx("h2",{children:"Projects"}),m.jsxs("button",{className:"btn sm",onClick:()=>l(!0),children:[m.jsx(Rg,{size:13})," New project"]})]}),m.jsx("div",{className:"home-list",children:e.length===0?m.jsx("div",{className:"changes-note",children:"No projects yet — create one to get started."}):[...e].sort((f,g)=>g.updatedAt-f.updatedAt).map(f=>m.jsxs("div",{className:"project-card",role:"button",tabIndex:0,onClick:()=>t(f.id),onKeyDown:g=>{(g.key==="Enter"||g.key===" ")&&t(f.id)},children:[m.jsx("span",{className:"name",children:f.name}),m.jsxs("span",{className:"repo mono",children:[f.githubOwner,"/",f.githubRepo," · ",f.baselineBranch]}),f.paperId&&m.jsxs("span",{className:"paper mono",children:["arXiv ",f.paperId]}),m.jsxs("span",{className:"time",children:["created ",Ua(f.createdAt)]}),m.jsx("button",{className:"project-delete",title:`Delete ${f.name}`,disabled:u===f.id,onClick:g=>{g.stopPropagation(),p(f)},children:m.jsx(Qh,{size:14})})]},f.id))})]}),c&&m.jsx("div",{className:"modal-backdrop",onClick:()=>l(!1),children:m.jsxs("div",{className:"modal",onClick:f=>f.stopPropagation(),children:[m.jsx("h2",{children:"New project"}),m.jsx(jU,{onCancel:()=>l(!1),onCreated:f=>{l(!1),n(f)}})]})})]})}function LU(e){const t=Jh(e.backend);return t?[t,Hx(e.backend)].filter(Boolean).join(" · "):"—"}function OU({runs:e,experiments:t,emptyHint:n,onOpen:r,onOpenChanges:s,onCancel:a}){const c=new Map(t.map(u=>[u.id,u.slug])),l=[...e].sort((u,h)=>h.createdAt-u.createdAt);return l.length===0?m.jsx("div",{className:"empty-state",children:m.jsx("p",{children:n??"No runs yet."})}):m.jsx("div",{className:"runs-table-wrap",children:m.jsxs("table",{className:"runs-table",children:[m.jsx("thead",{children:m.jsxs("tr",{children:[m.jsx("th",{children:"Run"}),m.jsx("th",{children:"Experiment"}),m.jsx("th",{children:"Status"}),m.jsx("th",{children:"Backend"}),m.jsx("th",{children:"Commit"}),m.jsx("th",{children:"Started"}),m.jsx("th",{children:"Exit"}),m.jsx("th",{})]})}),m.jsx("tbody",{children:l.map(u=>{const h=u.status==="running"||u.status==="starting";return m.jsxs("tr",{className:"clickable",onClick:()=>r(u),children:[m.jsx("td",{className:"mono",children:pm(u.id)}),m.jsx("td",{className:"mono",children:c.get(u.experimentId)??pm(u.experimentId)}),m.jsx("td",{children:m.jsx(tl,{status:u.status})}),m.jsx("td",{className:"mono",children:LU(u)}),m.jsx("td",{className:"mono",children:u.commitSha?u.commitSha.slice(0,7):"—"}),m.jsx("td",{children:Ua(u.createdAt)}),m.jsx("td",{className:"mono",children:u.exitCode??"—"}),m.jsx("td",{children:m.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[m.jsx("button",{className:"icon-btn",title:"Open changes",onClick:p=>{p.stopPropagation(),s(u.experimentId)},children:m.jsx(cl,{size:14})}),h&&m.jsx("button",{className:"btn sm danger",onClick:p=>{p.stopPropagation(),a(u.id)},children:"Cancel"})]})})]},u.id)})})]})})}var bw=vx();function BU(e){const[t,n]=P.useState(null),[,r]=P.useState({});return t==null||t.setTracked(e),P.useEffect(()=>{const s=new zU(()=>r({}));return s.setTracked(e),n(s),()=>s.dispose()},[]),(t==null?void 0:t.bounds)??null}var pi,cg,ug,hg;class zU{constructor(t){a3(this,pi);xa(this,"selectors",new Set);xa(this,"elements",new Set);xa(this,"onSizeChange",()=>Sa(this,pi,cg).call(this));xa(this,"resizeObs",new ResizeObserver(this.onSizeChange));xa(this,"mutationObs",new MutationObserver(t=>this.onMutation(t)));xa(this,"bounds",null);this.onBoundsChange=t,window.addEventListener("resize",this.onSizeChange),document.addEventListener("scroll",this.onSizeChange,!0),this.mutationObs.observe(document.body,{childList:!0,subtree:!0})}dispose(){this.resizeObs.disconnect(),this.mutationObs.disconnect(),window.removeEventListener("resize",this.onSizeChange),document.removeEventListener("scroll",this.onSizeChange,!0)}setTracked(t){const n=new Set(t),r=[...n].filter(c=>!this.selectors.has(c)),s=[...this.selectors].filter(c=>!n.has(c));let a=!1;if(r.length>0){const c=r.map(u=>`[data-onboarding="${u}"]`).join(","),l=document.body.querySelectorAll(c);l.forEach(u=>{this.elements.add(u),this.resizeObs.observe(u)}),a||(a=l.length>0)}if(s.length>0){const c=s.map(u=>`[data-onboarding="${u}"]`).join(","),l=document.body.querySelectorAll(c);l.forEach(u=>{this.elements.delete(u),this.resizeObs.unobserve(u)}),a||(a=l.length>0)}a&&Sa(this,pi,ug).call(this),this.selectors=n}onMutation(t){if(this.selectors.size===0)return;const n=Array.from(this.selectors,s=>`[data-onboarding="${s}"]`).join(",");let r=!1;for(const s of t){for(const a of s.addedNodes)a instanceof Element&&(a.matches(n)&&(this.elements.add(a),this.resizeObs.observe(a),r=!0),a.querySelectorAll(n).forEach(c=>{this.elements.add(c),this.resizeObs.observe(c),r=!0}));for(const a of s.removedNodes)a instanceof Element&&(a.matches(n)&&(this.elements.delete(a),this.resizeObs.unobserve(a),r=!0),a.querySelectorAll(n).forEach(c=>{this.elements.delete(c),this.resizeObs.unobserve(c),r=!0}))}r&&Sa(this,pi,cg).call(this)}}pi=new WeakSet,cg=function(){const t=Sa(this,pi,hg).call(this);Sa(this,pi,ug).call(this),t!==Sa(this,pi,hg).call(this)&&this.onBoundsChange()},ug=function(){if(this.elements.size===0){this.bounds=null;return}const t=Array.from(this.elements,c=>c.getBoundingClientRect()).filter(c=>c.width>0&&c.height>0);if(t.length===0){this.bounds=null;return}const n=Math.min(...t.map(c=>c.left)),r=Math.min(...t.map(c=>c.top)),s=Math.max(...t.map(c=>c.right)),a=Math.max(...t.map(c=>c.bottom));this.bounds={x:n,y:r,width:s-n,height:a-r}},hg=function(){return this.bounds?[this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height].join(","):"null"};function _w(){const[e,t]=P.useState(0),[n,r]=P.useState(0);return{ref:P.useCallback(a=>{if(!a)return;function c(){t(a.offsetWidth),r(a.offsetHeight)}const l=new ResizeObserver(c),u=new MutationObserver(c);return l.observe(a),u.observe(a,{childList:!0,subtree:!0,characterData:!0,attributes:!0}),c(),()=>{l.disconnect(),u.disconnect()}},[]),offsetWidth:e,offsetHeight:n}}const W0=8;function xw(e,t){const{offsetWidth:n,offsetHeight:r}=t,[{viewHeight:s,viewWidth:a},c]=P.useState({viewWidth:0,viewHeight:0});P.useEffect(()=>{function p(){c({viewWidth:window.innerWidth,viewHeight:window.innerHeight})}return window.addEventListener("resize",p),p(),()=>window.removeEventListener("resize",p)},[]);let l=0,u=0,h=0;if(e){const{distance:p}=e;switch(e.anchor){case"left":l=e.x-n-p,u=e.y+e.height/2-r/2;break;case"right":l=e.x+e.width+p,u=e.y+e.height/2-r/2;break;case"below":l=e.x+e.width/2-n/2,u=e.y+e.height+p;break;case"above":l=e.x+e.width/2-n/2,u=e.y-r-p;break}const f=l,g=u;l=Math.min(Math.max(l,W0),a-n-W0),u=Math.min(Math.max(u,W0),s-r-W0),h=e.anchor==="left"||e.anchor==="right"?g-u:f-l}return{x:l,y:u,arrowAdjustment:h}}const a6="orx:tour-done",Gs=8,IU=20,zh=[{focus:null,anchor:null,title:"Welcome to OpenResearch",description:"OpenResearch is your home for autoresearch. Spawn and coordinate research agents in one workspace."},{focus:["composer"],anchor:"above",title:"Talk to your research agent",description:"Prompt your research agents to replicate a paper, create a baseline experiment, run an eval, or investigate any research question. Type / for skills like /reproduce-paper."},{focus:["model-picker"],anchor:"above",title:"Pick your model",description:"Choose a model from any harness you've connected: Claude Code, Codex, or OpenCode. New sessions start with whatever you pick here, and each session keeps its harness."},{focus:["nav-artifacts"],anchor:"right",title:"Project artifacts",description:"The agent writes its reports, figures, and other outputs here, and anything you drop in is visible to it too. Check Artifacts after a run to see what came back."},{focus:["nav-compute"],anchor:"right",title:"Configure compute",description:"This is where compute is configured. Point runs at this machine, Modal, SSH boxes, Kubernetes, or Slurm. Set it up once and agents pick the right hardware per run."},{focus:["experiments"],anchor:"left",title:"Follow every experiment",description:"Runs land here as a tree of experiments. Branch variants off a baseline, compare results, and open any run's terminal or code changes in a tab."},{focus:["new-session"],anchor:"right",title:"Start a session",description:"Each session is its own agent working in its own worktree, so you can run several agents in parallel. Ask for your first experiment whenever you're ready."}];function HU({onClose:e}){const[t,n]=P.useState(0),r=zh[t],s=BU(r.focus??[]);P.useEffect(()=>{function c(l){l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())}return document.addEventListener("keydown",c,!0),()=>document.removeEventListener("keydown",c,!0)},[e]);const a=s?{left:s.x-Gs,top:s.y-Gs,width:s.width+Gs*2,height:s.height+Gs*2}:null;return bw.createPortal(m.jsxs("div",{className:"tour-overlay",children:[a?m.jsxs(m.Fragment,{children:[m.jsx("div",{className:"tour-spotlight",style:a}),m.jsx("div",{className:"tour-ring",style:a})]}):m.jsx("div",{className:"tour-dim"}),m.jsx(FU,{step:r,bounds:s,index:t,onBack:()=>n(c=>Math.max(0,c-1)),onNext:()=>t+1>=zh.length?e():n(t+1),onClose:e})]}),document.body)}function FU({step:e,bounds:t,index:n,onBack:r,onNext:s,onClose:a}){const c=_w(),l=xw(t&&e.anchor?{x:t.x-Gs,y:t.y-Gs,width:t.width+Gs*2,height:t.height+Gs*2,anchor:e.anchor,distance:IU}:null,c),u=e.anchor!=null&&t!=null&&l.x>0,h=n+1===zh.length;return m.jsxs("div",{ref:c.ref,className:`tour-card ${u?"":"centered"}`,style:u?{left:l.x,top:l.y}:void 0,children:[u&&e.anchor&&m.jsx(PU,{anchor:e.anchor,adjustment:l.arrowAdjustment}),m.jsx("button",{className:"icon-btn tour-close",title:"Skip tour",onClick:a,children:m.jsx(Ko,{size:15})}),m.jsx("h3",{children:e.title}),m.jsx("p",{children:e.description}),m.jsxs("div",{className:"tour-footer",children:[m.jsx("div",{className:"tour-footer-side",children:n>0&&m.jsx("button",{className:"btn ghost",onClick:r,children:"Back"})}),m.jsxs("span",{className:"tour-count",children:[n+1," / ",zh.length]}),m.jsx("div",{className:"tour-footer-side end",children:m.jsx("button",{className:"btn primary",onClick:s,children:h?"Done":"Next"})})]})]})}function PU({anchor:e,adjustment:t}){const n=e==="above"||e==="below"?`${t}px 0`:`0 ${t}px`;return m.jsx("div",{className:`tour-arrow ${e}`,style:{translate:n}})}function Nn(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{}};function zd(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}gh.prototype=zd.prototype={constructor:gh,on:function(e,t){var n=this._,r=UU(e+"",n),s,a=-1,c=r.length;if(arguments.length<2){for(;++a0)for(var n=new Array(s),r=0,s,a;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),l6.hasOwnProperty(t)?{space:l6[t],local:e}:e}function GU(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===dg&&t.documentElement.namespaceURI===dg?t.createElement(e):t.createElementNS(n,e)}}function VU(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sw(e){var t=Id(e);return(t.local?VU:GU)(t)}function WU(){}function s2(e){return e==null?WU:function(){return this.querySelector(e)}}function YU(e){typeof e!="function"&&(e=s2(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s=S&&(S=x+1);!(T=b[S])&&++S=0;)(c=r[s])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function bq(e){e||(e=_q);function t(f,g){return f&&g?e(f.__data__,g.__data__):!f-!g}for(var n=this._groups,r=n.length,s=new Array(r),a=0;at?1:e>=t?0:NaN}function xq(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Sq(){return Array.from(this)}function wq(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?Lq:typeof t=="function"?Bq:Oq)(e,t,n??"")):rl(this.node(),e)}function rl(e,t){return e.style.getPropertyValue(t)||Aw(e).getComputedStyle(e,null).getPropertyValue(t)}function Iq(e){return function(){delete this[e]}}function Hq(e,t){return function(){this[e]=t}}function Fq(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Pq(e,t){return arguments.length>1?this.each((t==null?Iq:typeof t=="function"?Fq:Hq)(e,t)):this.node()[e]}function Tw(e){return e.trim().split(/^|\s+/)}function a2(e){return e.classList||new Nw(e)}function Nw(e){this._node=e,this._names=Tw(e.getAttribute("class")||"")}Nw.prototype={add:function(e){var t=this._names.indexOf(e);t<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 Mw(e,t){for(var n=a2(e),r=-1,s=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function mG(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,a;n()=>e;function fg(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:a,x:c,y:l,dx:u,dy:h,dispatch:p}){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:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}fg.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function EG(e){return!e.ctrlKey&&!e.button}function kG(){return this.parentNode}function AG(e,t){return t??{x:e.x,y:e.y}}function TG(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bw(){var e=EG,t=kG,n=AG,r=TG,s={},a=zd("start","drag","end"),c=0,l,u,h,p,f=0;function g(E){E.on("mousedown.drag",y).filter(r).on("touchstart.drag",b).on("touchmove.drag",_,CG).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(E,T){if(!(p||!e.call(this,E,T))){var A=S(this,t.call(this,E,T),E,T,"mouse");A&&(Nr(E.view).on("mousemove.drag",C,$c).on("mouseup.drag",w,$c),Lw(E.view),Kp(E),h=!1,l=E.clientX,u=E.clientY,A("start",E))}}function C(E){if(Yo(E),!h){var T=E.clientX-l,A=E.clientY-u;h=T*T+A*A>f}s.mouse("drag",E)}function w(E){Nr(E.view).on("mousemove.drag mouseup.drag",null),Ow(E.view,h),Yo(E),s.mouse("end",E)}function b(E,T){if(e.call(this,E,T)){var A=E.changedTouches,D=t.call(this,E,T),M=A.length,R,z;for(R=0;R>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?X0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?X0(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=MG.exec(e))?new br(t[1],t[2],t[3],1):(t=DG.exec(e))?new br(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=RG.exec(e))?X0(t[1],t[2],t[3],t[4]):(t=jG.exec(e))?X0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=LG.exec(e))?m6(t[1],t[2]/100,t[3]/100,1):(t=OG.exec(e))?m6(t[1],t[2]/100,t[3]/100,t[4]):c6.hasOwnProperty(e)?d6(c6[e]):e==="transparent"?new br(NaN,NaN,NaN,0):null}function d6(e){return new br(e>>16&255,e>>8&255,e&255,1)}function X0(e,t,n,r){return r<=0&&(e=t=n=NaN),new br(e,t,n,r)}function IG(e){return e instanceof hu||(e=Ba(e)),e?(e=e.rgb(),new br(e.r,e.g,e.b,e.opacity)):new br}function pg(e,t,n,r){return arguments.length===1?IG(e):new br(e,t,n,r??1)}function br(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}o2(br,pg,zw(hu,{brighter(e){return e=e==null?Hh:Math.pow(Hh,e),new br(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Uc:Math.pow(Uc,e),new br(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new br(ja(this.r),ja(this.g),ja(this.b),Fh(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:f6,formatHex:f6,formatHex8:HG,formatRgb:p6,toString:p6}));function f6(){return`#${Da(this.r)}${Da(this.g)}${Da(this.b)}`}function HG(){return`#${Da(this.r)}${Da(this.g)}${Da(this.b)}${Da((isNaN(this.opacity)?1:this.opacity)*255)}`}function p6(){const e=Fh(this.opacity);return`${e===1?"rgb(":"rgba("}${ja(this.r)}, ${ja(this.g)}, ${ja(this.b)}${e===1?")":`, ${e})`}`}function Fh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ja(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Da(e){return e=ja(e),(e<16?"0":"")+e.toString(16)}function m6(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new li(e,t,n,r)}function Iw(e){if(e instanceof li)return new li(e.h,e.s,e.l,e.opacity);if(e instanceof hu||(e=Ba(e)),!e)return new li;if(e instanceof li)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),a=Math.max(t,n,r),c=NaN,l=a-s,u=(a+s)/2;return l?(t===a?c=(n-r)/l+(n0&&u<1?0:c,new li(c,l,u,e.opacity)}function FG(e,t,n,r){return arguments.length===1?Iw(e):new li(e,t,n,r??1)}function li(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}o2(li,FG,zw(hu,{brighter(e){return e=e==null?Hh:Math.pow(Hh,e),new li(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Uc:Math.pow(Uc,e),new li(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,s=2*n-r;return new br(Zp(e>=240?e-240:e+120,s,r),Zp(e,s,r),Zp(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new li(g6(this.h),K0(this.s),K0(this.l),Fh(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(){const e=Fh(this.opacity);return`${e===1?"hsl(":"hsla("}${g6(this.h)}, ${K0(this.s)*100}%, ${K0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function g6(e){return e=(e||0)%360,e<0?e+360:e}function K0(e){return Math.max(0,Math.min(1,e||0))}function Zp(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const l2=e=>()=>e;function PG(e,t){return function(n){return e+n*t}}function $G(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function UG(e){return(e=+e)==1?Hw:function(t,n){return n-t?$G(t,n,e):l2(isNaN(t)?n:t)}}function Hw(e,t){var n=t-e;return n?PG(e,n):l2(isNaN(e)?t:e)}const Ph=(function e(t){var n=UG(t);function r(s,a){var c=n((s=pg(s)).r,(a=pg(a)).r),l=n(s.g,a.g),u=n(s.b,a.b),h=Hw(s.opacity,a.opacity);return function(p){return s.r=c(p),s.g=l(p),s.b=u(p),s.opacity=h(p),s+""}}return r.gamma=e,r})(1);function qG(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(a){for(s=0;sn&&(a=t.slice(n,a),l[c]?l[c]+=a:l[++c]=a),(r=r[0])===(s=s[0])?l[c]?l[c]+=s:l[++c]=s:(l[++c]=null,u.push({i:c,x:wi(r,s)})),n=Qp.lastIndex;return n180?p+=360:p-h>180&&(h+=360),g.push({i:f.push(s(f)+"rotate(",null,r)-2,x:wi(h,p)})):p&&f.push(s(f)+"rotate("+p+r)}function l(h,p,f,g){h!==p?g.push({i:f.push(s(f)+"skewX(",null,r)-2,x:wi(h,p)}):p&&f.push(s(f)+"skewX("+p+r)}function u(h,p,f,g,y,C){if(h!==f||p!==g){var w=y.push(s(y)+"scale(",null,",",null,")");C.push({i:w-4,x:wi(h,f)},{i:w-2,x:wi(p,g)})}else(f!==1||g!==1)&&y.push(s(y)+"scale("+f+","+g+")")}return function(h,p){var f=[],g=[];return h=e(h),p=e(p),a(h.translateX,h.translateY,p.translateX,p.translateY,f,g),c(h.rotate,p.rotate,f,g),l(h.skewX,p.skewX,f,g),u(h.scaleX,h.scaleY,p.scaleX,p.scaleY,f,g),h=p=null,function(y){for(var C=-1,w=g.length,b;++C=0&&e._call.call(void 0,t),e=e._next;--il}function b6(){za=(Uh=Gc.now())+Hd,il=_c=0;try{sV()}finally{il=0,oV(),za=0}}function aV(){var e=Gc.now(),t=e-Uh;t>Uw&&(Hd-=t,Uh=e)}function oV(){for(var e,t=$h,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:$h=n);xc=e,vg(r)}function vg(e){if(!il){_c&&(_c=clearTimeout(_c));var t=e-za;t>24?(e<1/0&&(_c=setTimeout(b6,e-Gc.now()-Hd)),vc&&(vc=clearInterval(vc))):(vc||(Uh=Gc.now(),vc=setInterval(aV,Uw)),il=1,qw(b6))}}function _6(e,t,n){var r=new qh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var lV=zd("start","end","cancel","interrupt"),cV=[],Vw=0,x6=1,yg=2,yh=3,S6=4,bg=5,bh=6;function Fd(e,t,n,r,s,a){var c=e.__transition;if(!c)e.__transition={};else if(n in c)return;uV(e,n,{name:t,index:r,group:s,on:lV,tween:cV,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Vw})}function u2(e,t){var n=mi(e,t);if(n.state>Vw)throw new Error("too late; already scheduled");return n}function Ri(e,t){var n=mi(e,t);if(n.state>yh)throw new Error("too late; already running");return n}function mi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function uV(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=Gw(a,0,n.time);function a(h){n.state=x6,n.timer.restart(c,n.delay,n.time),n.delay<=h&&c(h-n.delay)}function c(h){var p,f,g,y;if(n.state!==x6)return u();for(p in r)if(y=r[p],y.name===n.name){if(y.state===yh)return _6(c);y.state===S6?(y.state=bh,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete r[p]):+pyg&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function FV(e,t,n){var r,s,a=HV(t)?u2:Ri;return function(){var c=a(this,e),l=c.on;l!==r&&(s=(r=l).copy()).on(t,n),c.on=s}}function PV(e,t){var n=this._id;return arguments.length<2?mi(this.node(),n).on.on(e):this.each(FV(n,e,t))}function $V(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function UV(){return this.on("end.remove",$V(this._id))}function qV(e){var t=this._name,n=this._id;typeof e!="function"&&(e=s2(e));for(var r=this._groups,s=r.length,a=new Array(s),c=0;c()=>e;function mW(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){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:s}})}function es(e,t,n){this.k=e,this.x=t,this.y=n}es.prototype={constructor:es,scale:function(e){return e===1?this:new es(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new es(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 Pd=new es(1,0,0);Kw.prototype=es.prototype;function Kw(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Pd;return e.__zoom}function Jp(e){e.stopImmediatePropagation()}function yc(e){e.preventDefault(),e.stopImmediatePropagation()}function gW(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function vW(){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 w6(){return this.__zoom||Pd}function yW(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function bW(){return navigator.maxTouchPoints||"ontouchstart"in this}function _W(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],a=e.invertY(t[0][1])-n[0][1],c=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function Zw(){var e=gW,t=vW,n=_W,r=yW,s=bW,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,u=vh,h=zd("start","zoom","end"),p,f,g,y=500,C=150,w=0,b=10;function _(q){q.property("__zoom",w6).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",H).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",U).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}_.transform=function(q,K,Y,Q){var ee=q.selection?q.selection():q;ee.property("__zoom",w6),q!==ee?T(q,K,Y,Q):ee.interrupt().each(function(){A(this,arguments).event(Q).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},_.scaleBy=function(q,K,Y,Q){_.scaleTo(q,function(){var ee=this.__zoom.k,B=typeof K=="function"?K.apply(this,arguments):K;return ee*B},Y,Q)},_.scaleTo=function(q,K,Y,Q){_.transform(q,function(){var ee=t.apply(this,arguments),B=this.__zoom,L=Y==null?E(ee):typeof Y=="function"?Y.apply(this,arguments):Y,O=B.invert(L),W=typeof K=="function"?K.apply(this,arguments):K;return n(S(x(B,W),L,O),ee,c)},Y,Q)},_.translateBy=function(q,K,Y,Q){_.transform(q,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof Y=="function"?Y.apply(this,arguments):Y),t.apply(this,arguments),c)},null,Q)},_.translateTo=function(q,K,Y,Q,ee){_.transform(q,function(){var B=t.apply(this,arguments),L=this.__zoom,O=Q==null?E(B):typeof Q=="function"?Q.apply(this,arguments):Q;return n(Pd.translate(O[0],O[1]).scale(L.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof Y=="function"?-Y.apply(this,arguments):-Y),B,c)},Q,ee)};function x(q,K){return K=Math.max(a[0],Math.min(a[1],K)),K===q.k?q:new es(K,q.x,q.y)}function S(q,K,Y){var Q=K[0]-Y[0]*q.k,ee=K[1]-Y[1]*q.k;return Q===q.x&&ee===q.y?q:new es(q.k,Q,ee)}function E(q){return[(+q[0][0]+ +q[1][0])/2,(+q[0][1]+ +q[1][1])/2]}function T(q,K,Y,Q){q.on("start.zoom",function(){A(this,arguments).event(Q).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(Q).end()}).tween("zoom",function(){var ee=this,B=arguments,L=A(ee,B).event(Q),O=t.apply(ee,B),W=Y==null?E(O):typeof Y=="function"?Y.apply(ee,B):Y,G=Math.max(O[1][0]-O[0][0],O[1][1]-O[0][1]),ie=ee.__zoom,fe=typeof K=="function"?K.apply(ee,B):K,pe=u(ie.invert(W).concat(G/ie.k),fe.invert(W).concat(G/fe.k));return function(te){if(te===1)te=fe;else{var V=pe(te),ae=G/V[2];te=new es(ae,W[0]-V[0]*ae,W[1]-V[1]*ae)}L.zoom(null,te)}})}function A(q,K,Y){return!Y&&q.__zooming||new D(q,K)}function D(q,K){this.that=q,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(q,K),this.taps=0}D.prototype={event:function(q){return q&&(this.sourceEvent=q),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(q,K){return this.mouse&&q!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&q!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&q!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(q){var K=Nr(this.that).datum();h.call(q,this.that,new mW(q,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:h}),K)}};function M(q,...K){if(!e.apply(this,arguments))return;var Y=A(this,K).event(q),Q=this.__zoom,ee=Math.max(a[0],Math.min(a[1],Q.k*Math.pow(2,r.apply(this,arguments)))),B=oi(q);if(Y.wheel)(Y.mouse[0][0]!==B[0]||Y.mouse[0][1]!==B[1])&&(Y.mouse[1]=Q.invert(Y.mouse[0]=B)),clearTimeout(Y.wheel);else{if(Q.k===ee)return;Y.mouse=[B,Q.invert(B)],_h(this),Y.start()}yc(q),Y.wheel=setTimeout(L,C),Y.zoom("mouse",n(S(x(Q,ee),Y.mouse[0],Y.mouse[1]),Y.extent,c));function L(){Y.wheel=null,Y.end()}}function R(q,...K){if(g||!e.apply(this,arguments))return;var Y=q.currentTarget,Q=A(this,K,!0).event(q),ee=Nr(q.view).on("mousemove.zoom",W,!0).on("mouseup.zoom",G,!0),B=oi(q,Y),L=q.clientX,O=q.clientY;Lw(q.view),Jp(q),Q.mouse=[B,this.__zoom.invert(B)],_h(this),Q.start();function W(ie){if(yc(ie),!Q.moved){var fe=ie.clientX-L,pe=ie.clientY-O;Q.moved=fe*fe+pe*pe>w}Q.event(ie).zoom("mouse",n(S(Q.that.__zoom,Q.mouse[0]=oi(ie,Y),Q.mouse[1]),Q.extent,c))}function G(ie){ee.on("mousemove.zoom mouseup.zoom",null),Ow(ie.view,Q.moved),yc(ie),Q.event(ie).end()}}function z(q,...K){if(e.apply(this,arguments)){var Y=this.__zoom,Q=oi(q.changedTouches?q.changedTouches[0]:q,this),ee=Y.invert(Q),B=Y.k*(q.shiftKey?.5:2),L=n(S(x(Y,B),Q,ee),t.apply(this,K),c);yc(q),l>0?Nr(this).transition().duration(l).call(T,L,Q,q):Nr(this).call(_.transform,L,Q,q)}}function H(q,...K){if(e.apply(this,arguments)){var Y=q.touches,Q=Y.length,ee=A(this,K,q.changedTouches.length===Q).event(q),B,L,O,W;for(Jp(q),L=0;L`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.`},Vc=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qw=["Enter"," ","Escape"],Jw={"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"};var sl;(function(e){e.Strict="strict",e.Loose="loose"})(sl||(sl={}));var La;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(La||(La={}));var Wc;(function(e){e.Partial="partial",e.Full="full"})(Wc||(Wc={}));const e9={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Us;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Us||(Us={}));var Gh;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Gh||(Gh={}));var We;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(We||(We={}));const C6={[We.Left]:We.Right,[We.Right]:We.Left,[We.Top]:We.Bottom,[We.Bottom]:We.Top};function t9(e){return e===null?null:e?"valid":"invalid"}const n9=e=>"id"in e&&"source"in e&&"target"in e,xW=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),d2=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),du=(e,t=[0,0])=>{const{width:n,height:r}=hs(e),s=e.origin??t,a=n*s[0],c=r*s[1];return{x:e.position.x-a,y:e.position.y-c}},SW=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const a=typeof s=="string";let c=!t.nodeLookup&&!a?s:void 0;t.nodeLookup&&(c=a?t.nodeLookup.get(s):d2(s)?s:t.nodeLookup.get(s.id));const l=c?Vh(c,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return $d(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ud(n)},fu=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=$d(n,Vh(s)),r=!0)}),r?Ud(n):{x:0,y:0,width:0,height:0}},f2=(e,t,[n,r,s]=[0,0,1],a=!1,c=!1)=>{const l=(t.x-n)/s,u=(t.y-r)/s,h=t.width/s,p=t.height/s,f=[];for(const g of e.values()){const{measured:y,selectable:C=!0,hidden:w=!1}=g;if(c&&!C||w)continue;const b=y.width??g.width??g.initialWidth??0,_=y.height??g.height??g.initialHeight??0,{x,y:S}=g.internals.positionAbsolute,E=a9(l,u,h,p,x,S,b,_),T=b*_,A=a&&E>0;(!g.internals.handleBounds||A||E>=T||g.dragging)&&f.push(g)}return f},wW=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function CW(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(s=>s.id)):null;return e.forEach(s=>{s.measured.width&&s.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function EW({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:a},c){if(e.size===0)return!0;const l=CW(e,c),u=fu(l),h=m2(u,t,n,(c==null?void 0:c.minZoom)??s,(c==null?void 0:c.maxZoom)??a,(c==null?void 0:c.padding)??.1);return await r.setViewport(h,{duration:c==null?void 0:c.duration,ease:c==null?void 0:c.ease,interpolate:c==null?void 0:c.interpolate}),!0}function r9({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:a}){const c=n.get(e),l=c.parentId?n.get(c.parentId):void 0,{x:u,y:h}=l?l.internals.positionAbsolute:{x:0,y:0},p=c.origin??r;let f=c.extent||s;if(c.extent==="parent"&&!c.expandParent)if(!l)a==null||a("005",fi.error005());else{const y=l.measured.width,C=l.measured.height;y&&C&&(f=[[u,h],[u+y,h+C]])}else l&&Ha(c.extent)&&(f=[[c.extent[0][0]+u,c.extent[0][1]+h],[c.extent[1][0]+u,c.extent[1][1]+h]]);const g=Ha(f)?Ia(t,f,c.measured):t;return(c.measured.width===void 0||c.measured.height===void 0)&&(a==null||a("015",fi.error015())),{position:{x:g.x-u+(c.measured.width??0)*p[0],y:g.y-h+(c.measured.height??0)*p[1]},positionAbsolute:g}}async function kW({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const a=new Set(e.map(g=>g.id)),c=[];for(const g of n){if(g.deletable===!1)continue;const y=a.has(g.id),C=!y&&g.parentId&&c.find(w=>w.id===g.parentId);(y||C)&&c.push(g)}const l=new Set(t.map(g=>g.id)),u=r.filter(g=>g.deletable!==!1),p=wW(c,u);for(const g of u)l.has(g.id)&&!p.find(C=>C.id===g.id)&&p.push(g);if(!s)return{edges:p,nodes:c};const f=await s({nodes:c,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:c}:{edges:[],nodes:[]}:f}const al=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Ia=(e={x:0,y:0},t,n)=>({x:al(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:al(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function i9(e,t,n){const{width:r,height:s}=hs(n),{x:a,y:c}=n.internals.positionAbsolute;return Ia(e,[[a,c],[a+r,c+s]],t)}const E6=(e,t,n)=>en?-al(Math.abs(e-n),1,t)/t:0,p2=(e,t,n=15,r=40)=>{const s=E6(e.x,r,t.width-r)*n,a=E6(e.y,r,t.height-r)*n;return[s,a]},$d=(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)}),_g=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ud=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Yc=(e,t=[0,0])=>{var s,a;const{x:n,y:r}=d2(e)?e.internals.positionAbsolute:du(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0}},Vh=(e,t=[0,0])=>{var s,a;const{x:n,y:r}=d2(e)?e.internals.positionAbsolute:du(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((a=e.measured)==null?void 0:a.height)??e.height??e.initialHeight??0)}},s9=(e,t)=>Ud($d(_g(e),_g(t))),a9=(e,t,n,r,s,a,c,l)=>{const u=Math.max(0,Math.min(e+n,s+c)-Math.max(e,s)),h=Math.max(0,Math.min(t+r,a+l)-Math.max(t,a));return Math.ceil(u*h)},Wh=(e,t)=>a9(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),k6=e=>ci(e.width)&&ci(e.height)&&ci(e.x)&&ci(e.y),ci=e=>!isNaN(e)&&isFinite(e),o9=(e,t)=>(n,r)=>{},pu=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),mu=({x:e,y:t},[n,r,s],a=!1,c=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return a?pu(l,c):l},ol=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Io(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const 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 AW(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Io(e,n),s=Io(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Io(e.top??e.y??0,n),s=Io(e.bottom??e.y??0,n),a=Io(e.left??e.x??0,t),c=Io(e.right??e.x??0,t);return{top:r,right:c,bottom:s,left:a,x:a+c,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function TW(e,t,n,r,s,a){const{x:c,y:l}=ol(e,[t,n,r]),{x:u,y:h}=ol({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-u,f=a-h;return{left:Math.floor(c),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const m2=(e,t,n,r,s,a)=>{const c=AW(a,t,n),l=(t-c.x)/e.width,u=(n-c.y)/e.height,h=Math.min(l,u),p=al(h,r,s),f=e.x+e.width/2,g=e.y+e.height/2,y=t/2-f*p,C=n/2-g*p,w=TW(e,y,C,p,t,n),b={left:Math.min(w.left-c.left,0),top:Math.min(w.top-c.top,0),right:Math.min(w.right-c.right,0),bottom:Math.min(w.bottom-c.bottom,0)};return{x:y-b.left+b.right,y:C-b.top+b.bottom,zoom:p}},Xc=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ha(e){return e!=null&&e!=="parent"}function hs(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function l9(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function c9(e,t={width:0,height:0},n,r,s){const a={...e},c=r.get(n);if(c){const l=c.origin||s;a.x+=c.internals.positionAbsolute.x-(t.width??0)*l[0],a.y+=c.internals.positionAbsolute.y-(t.height??0)*l[1]}return a}function A6(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function NW(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function MW(e){return{...Jw,...e||{}}}function Nc(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:a,y:c}=ui(e),l=mu({x:a-((s==null?void 0:s.left)??0),y:c-((s==null?void 0:s.top)??0)},r),{x:u,y:h}=n?pu(l,t):l;return{xSnapped:u,ySnapped:h,...l}}const g2=e=>({width:e.offsetWidth,height:e.offsetHeight}),u9=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},DW=["INPUT","SELECT","TEXTAREA"];function h9(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:DW.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const d9=e=>"clientX"in e,ui=(e,t)=>{var a,c;const n=d9(e),r=n?e.clientX:(a=e.touches)==null?void 0:a[0].clientX,s=n?e.clientY:(c=e.touches)==null?void 0:c[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},T6=(e,t,n,r,s)=>{const a=t.querySelectorAll(`.${e}`);return!a||!a.length?null:Array.from(a).map(c=>{const l=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:e,nodeId:s,position:c.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...g2(c)}})};function f9({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:l}){const u=e*.125+s*.375+c*.375+n*.125,h=t*.125+a*.375+l*.375+r*.125,p=Math.abs(u-e),f=Math.abs(h-t);return[u,h,p,f]}function J0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function N6({pos:e,x1:t,y1:n,x2:r,y2:s,c:a}){switch(e){case We.Left:return[t-J0(t-r,a),n];case We.Right:return[t+J0(r-t,a),n];case We.Top:return[t,n-J0(n-s,a)];case We.Bottom:return[t,n+J0(s-n,a)]}}function p9({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:a=We.Top,curvature:c=.25}){const[l,u]=N6({pos:n,x1:e,y1:t,x2:r,y2:s,c}),[h,p]=N6({pos:a,x1:r,y1:s,x2:e,y2:t,c}),[f,g,y,C]=f9({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:h,targetControlY:p});return[`M${e},${t} C${l},${u} ${h},${p} ${r},${s}`,f,g,y,C]}function m9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,a=n0}const LW=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,OW=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),BW=(e,t,n={})=>{var a;if(!e.source||!e.target)return(a=n.onError)==null||a.call(n,"006",fi.error006()),t;const r=n.getEdgeId||LW;let s;return n9(e)?s={...e}:s={...e,id:r(e)},OW(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function g9({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,a,c,l]=m9({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,a,c,l]}const M6={[We.Left]:{x:-1,y:0},[We.Right]:{x:1,y:0},[We.Top]:{x:0,y:-1},[We.Bottom]:{x:0,y:1}},zW=({source:e,sourcePosition:t=We.Bottom,target:n})=>t===We.Left||t===We.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function IW({source:e,sourcePosition:t=We.Bottom,target:n,targetPosition:r=We.Top,center:s,offset:a,stepPosition:c}){const l=M6[t],u=M6[r],h={x:e.x+l.x*a,y:e.y+l.y*a},p={x:n.x+u.x*a,y:n.y+u.y*a},f=zW({source:h,sourcePosition:t,target:p}),g=f.x!==0?"x":"y",y=f[g];let C=[],w,b;const _={x:0,y:0},x={x:0,y:0},[,,S,E]=m9({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[g]*u[g]===-1){g==="x"?(w=s.x??h.x+(p.x-h.x)*c,b=s.y??(h.y+p.y)/2):(w=s.x??(h.x+p.x)/2,b=s.y??h.y+(p.y-h.y)*c);const M=[{x:w,y:h.y},{x:w,y:p.y}],R=[{x:h.x,y:b},{x:p.x,y:b}];l[g]===y?C=g==="x"?M:R:C=g==="x"?R:M}else{const M=[{x:h.x,y:p.y}],R=[{x:p.x,y:h.y}];if(g==="x"?C=l.x===y?R:M:C=l.y===y?M:R,t===r){const q=Math.abs(e[g]-n[g]);if(q<=a){const K=Math.min(a-1,a-q);l[g]===y?_[g]=(h[g]>e[g]?-1:1)*K:x[g]=(p[g]>n[g]?-1:1)*K}}if(t!==r){const q=g==="x"?"y":"x",K=l[g]===u[q],Y=h[q]>p[q],Q=h[q]=U?(w=(z.x+H.x)/2,b=C[0].y):(w=C[0].x,b=(z.y+H.y)/2)}const T={x:h.x+_.x,y:h.y+_.y},A={x:p.x+x.x,y:p.y+x.y};return[[e,...T.x!==C[0].x||T.y!==C[0].y?[T]:[],...C,...A.x!==C[C.length-1].x||A.y!==C[C.length-1].y?[A]:[],n],w,b,S,E]}function HW(e,t,n,r){const s=Math.min(D6(e,t)/2,D6(t,n)/2,r),{x:a,y:c}=t;if(e.x===a&&a===n.x||e.y===c&&c===n.y)return`L${a} ${c}`;if(e.y===c){const h=e.xn.id===t):e[0])||null}function Sg(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function PW(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const a=new Set;return e.reduce((c,l)=>([l.markerStart||r,l.markerEnd||s].forEach(u=>{if(u&&typeof u=="object"){const h=Sg(u,t);a.has(h)||(c.push({id:h,color:u.color||n,...u}),a.add(h))}}),c),[]).sort((c,l)=>c.id.localeCompare(l.id))}const v9=1e3,$W=10,v2={nodeOrigin:[0,0],nodeExtent:Vc,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},UW={...v2,checkEquality:!0};function y2(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function qW(e,t,n){const r=y2(v2,n);for(const s of e.values())if(s.parentId)_2(s,e,t,r);else{const a=du(s,r.nodeOrigin),c=Ha(s.extent)?s.extent:r.nodeExtent,l=Ia(a,c,hs(s));s.internals.positionAbsolute=l}}function GW(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(a):s.type==="target"&&r.push(a)}return{source:n,target:r}}function b2(e){return e==="manual"}function wg(e,t,n,r={}){var p,f;const s=y2(UW,r),a={i:0},c=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!b2(s.zIndexMode)?v9:0;let u=e.length>0,h=!1;t.clear(),n.clear();for(const g of e){let y=c.get(g.id);if(s.checkEquality&&g===(y==null?void 0:y.internals.userNode))t.set(g.id,y);else{const C=du(g,s.nodeOrigin),w=Ha(g.extent)?g.extent:s.nodeExtent,b=Ia(C,w,hs(g));y={...s.defaults,...g,measured:{width:(p=g.measured)==null?void 0:p.width,height:(f=g.measured)==null?void 0:f.height},internals:{positionAbsolute:b,handleBounds:GW(g,y),z:y9(g,l,s.zIndexMode),userNode:g}},t.set(g.id,y)}(y.measured===void 0||y.measured.width===void 0||y.measured.height===void 0)&&!y.hidden&&(u=!1),g.parentId&&_2(y,t,n,r,a),h||(h=g.selected??!1)}return{nodesInitialized:u,hasSelectedNodes:h}}function VW(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function _2(e,t,n,r,s){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:l,zIndexMode:u}=y2(v2,r),h=e.parentId,p=t.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}VW(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&u==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*$W),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=a&&!b2(u)?v9:0,{x:g,y,z:C}=WW(e,p,c,l,f,u),{positionAbsolute:w}=e.internals,b=g!==w.x||y!==w.y;(b||C!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:g,y}:w,z:C}})}function y9(e,t,n){const r=ci(e.zIndex)?e.zIndex:0;return b2(n)?r:r+(e.selected?t:0)}function WW(e,t,n,r,s,a){const{x:c,y:l}=t.internals.positionAbsolute,u=hs(e),h=du(e,n),p=Ha(e.extent)?Ia(h,e.extent,u):h;let f=Ia({x:c+p.x,y:l+p.y},r,u);e.extent==="parent"&&(f=i9(f,u,t));const g=y9(e,s,a),y=t.internals.z??0;return{x:f.x,y:f.y,z:y>=g?y+1:g}}function x2(e,t,n,r=[0,0]){var c;const s=[],a=new Map;for(const l of e){const u=t.get(l.parentId);if(!u)continue;const h=((c=a.get(l.parentId))==null?void 0:c.expandedRect)??Yc(u),p=s9(h,l.rect);a.set(l.parentId,{expandedRect:p,parent:u})}return a.size>0&&a.forEach(({expandedRect:l,parent:u},h)=>{var S;const p=u.internals.positionAbsolute,f=hs(u),g=u.origin??r,y=l.x0||C>0||_||x)&&(s.push({id:h,type:"position",position:{x:u.position.x-y+_,y:u.position.y-C+x}}),(S=n.get(h))==null||S.forEach(E=>{e.some(T=>T.id===E.id)||s.push({id:E.id,type:"position",position:{x:E.position.x+y,y:E.position.y+C}})})),(f.width0){const y=x2(g,t,n,s);h.push(...y)}return{changes:h,updatedInternals:u}}async function XW({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:a}){if(!t||!e.x&&!e.y)return!1;const c=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,a]],r);return!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2])}function O6(e,t,n,r,s,a){let c=s;const l=r.get(c)||new Map;r.set(c,l.set(n,t)),c=`${s}-${e}`;const u=r.get(c)||new Map;if(r.set(c,u.set(n,t)),a){c=`${s}-${e}-${a}`;const h=r.get(c)||new Map;r.set(c,h.set(n,t))}}function b9(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:a,sourceHandle:c=null,targetHandle:l=null}=r,u={edgeId:r.id,source:s,target:a,sourceHandle:c,targetHandle:l},h=`${s}-${c}--${a}-${l}`,p=`${a}-${l}--${s}-${c}`;O6("source",u,p,e,s,c),O6("target",u,h,e,a,l),t.set(r.id,r)}}function _9(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_9(n,t):!1}function B6(e,t,n){var s;let r=e;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function KW(e,t,n,r){const s=new Map;for(const[a,c]of e)if((c.selected||c.id===r)&&(!c.parentId||!_9(c,e))&&(c.draggable||t&&typeof c.draggable>"u")){const l=e.get(a);l&&s.set(a,{id:a,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function em({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var c,l,u;const s=[];for(const[h,p]of t){const f=(c=n.get(h))==null?void 0:c.internals.userNode;f&&s.push({...f,position:p.position,dragging:r})}if(!e)return[s[0],s];const a=(l=n.get(e))==null?void 0:l.internals.userNode;return[a?{...a,position:((u=t.get(e))==null?void 0:u.position)||a.position,dragging:r}:s[0],s]}function ZW({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const a={x:n-s.distance.x,y:r-s.distance.y},c=pu(a,t);return{x:c.x-a.x,y:c.y-a.y}}function QW({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let a={x:null,y:null},c=0,l=new Map,u=!1,h={x:0,y:0},p=null,f=!1,g=null,y=!1,C=!1,w=null;function b({noDragClassName:x,handleSelector:S,domNode:E,isSelectable:T,nodeId:A,nodeClickDistance:D=0}){g=Nr(E);function M({x:$,y:U}){const{nodeLookup:q,nodeExtent:K,snapGrid:Y,snapToGrid:Q,nodeOrigin:ee,onNodeDrag:B,onSelectionDrag:L,onError:O,updateNodePositions:W}=t();a={x:$,y:U};let G=!1;const ie=l.size>1,fe=ie&&K?_g(fu(l)):null,pe=ie&&Q?ZW({dragItems:l,snapGrid:Y,x:$,y:U}):null;for(const[te,V]of l){if(!q.has(te))continue;let ae={x:$-V.distance.x,y:U-V.distance.y};Q&&(ae=pe?{x:Math.round(ae.x+pe.x),y:Math.round(ae.y+pe.y)}:pu(ae,Y));let oe=null;if(ie&&K&&!V.extent&&fe){const{positionAbsolute:Se}=V.internals,Te=Se.x-fe.x+K[0][0],Re=Se.x+V.measured.width-fe.x2+K[1][0],He=Se.y-fe.y+K[0][1],ze=Se.y+V.measured.height-fe.y2+K[1][1];oe=[[Te,He],[Re,ze]]}const{position:be,positionAbsolute:he}=r9({nodeId:te,nextPosition:ae,nodeLookup:q,nodeExtent:oe||K,nodeOrigin:ee,onError:O});G=G||V.position.x!==be.x||V.position.y!==be.y,V.position=be,V.internals.positionAbsolute=he}if(C=C||G,!!G&&(W(l,!0),w&&(r||B||!A&&L))){const[te,V]=em({nodeId:A,dragItems:l,nodeLookup:q});r==null||r(w,l,te,V),B==null||B(w,te,V),A||L==null||L(w,V)}}async function R(){if(!p)return;const{transform:$,panBy:U,autoPanSpeed:q,autoPanOnNodeDrag:K}=t();if(!K){u=!1,cancelAnimationFrame(c);return}const[Y,Q]=p2(h,p,q);(Y!==0||Q!==0)&&(a.x=(a.x??0)-Y/$[2],a.y=(a.y??0)-Q/$[2],await U({x:Y,y:Q})&&M(a)),c=requestAnimationFrame(R)}function z($){var ie;const{nodeLookup:U,multiSelectionActive:q,nodesDraggable:K,transform:Y,snapGrid:Q,snapToGrid:ee,selectNodesOnDrag:B,onNodeDragStart:L,onSelectionDragStart:O,unselectNodesAndEdges:W}=t();f=!0,(!B||!T)&&!q&&A&&((ie=U.get(A))!=null&&ie.selected||W()),T&&B&&A&&(e==null||e(A));const G=Nc($.sourceEvent,{transform:Y,snapGrid:Q,snapToGrid:ee,containerBounds:p});if(a=G,l=KW(U,K,G,A),l.size>0&&(n||L||!A&&O)){const[fe,pe]=em({nodeId:A,dragItems:l,nodeLookup:U});n==null||n($.sourceEvent,l,fe,pe),L==null||L($.sourceEvent,fe,pe),A||O==null||O($.sourceEvent,pe)}}const H=Bw().clickDistance(D).on("start",$=>{const{domNode:U,nodeDragThreshold:q,transform:K,snapGrid:Y,snapToGrid:Q}=t();p=(U==null?void 0:U.getBoundingClientRect())||null,y=!1,C=!1,w=$.sourceEvent,q===0&&z($),a=Nc($.sourceEvent,{transform:K,snapGrid:Y,snapToGrid:Q,containerBounds:p}),h=ui($.sourceEvent,p)}).on("drag",$=>{const{autoPanOnNodeDrag:U,transform:q,snapGrid:K,snapToGrid:Y,nodeDragThreshold:Q,nodeLookup:ee}=t(),B=Nc($.sourceEvent,{transform:q,snapGrid:K,snapToGrid:Y,containerBounds:p});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||A&&!ee.has(A))&&(y=!0),!y){if(!u&&U&&f&&(u=!0,R()),!f){const L=ui($.sourceEvent,p),O=L.x-h.x,W=L.y-h.y;Math.sqrt(O*O+W*W)>Q&&z($)}(a.x!==B.xSnapped||a.y!==B.ySnapped)&&l&&f&&(h=ui($.sourceEvent,p),M(B))}}).on("end",$=>{if(!f||y){y&&l.size>0&&t().updateNodePositions(l,!1);return}if(u=!1,f=!1,cancelAnimationFrame(c),l.size>0){const{nodeLookup:U,updateNodePositions:q,onNodeDragStop:K,onSelectionDragStop:Y}=t();if(C&&(q(l,!1),C=!1),s||K||!A&&Y){const[Q,ee]=em({nodeId:A,dragItems:l,nodeLookup:U,dragging:!1});s==null||s($.sourceEvent,l,Q,ee),K==null||K($.sourceEvent,Q,ee),A||Y==null||Y($.sourceEvent,ee)}}}).filter($=>{const U=$.target;return!$.button&&(!x||!B6(U,`.${x}`,E))&&(!S||B6(U,S,E))});g.call(H)}function _(){g==null||g.on(".drag",null)}return{update:b,destroy:_}}function JW(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const a of t.values())Wh(s,Yc(a))>0&&r.push(a);return r}const eY=250;function tY(e,t,n,r){var l,u;let s=[],a=1/0;const c=JW(e,n,t+eY);for(const h of c){const p=[...((l=h.internals.handleBounds)==null?void 0:l.source)??[],...((u=h.internals.handleBounds)==null?void 0:u.target)??[]];for(const f of p){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:g,y}=Fa(h,f,f.position,!0),C=Math.sqrt(Math.pow(g-e.x,2)+Math.pow(y-e.y,2));C>t||(C1){const h=r.type==="source"?"target":"source";return s.find(p=>p.type===h)??s[0]}return s[0]}function x9(e,t,n,r,s,a=!1){var h,p,f;const c=r.get(e);if(!c)return null;const l=s==="strict"?(h=c.internals.handleBounds)==null?void 0:h[t]:[...((p=c.internals.handleBounds)==null?void 0:p.source)??[],...((f=c.internals.handleBounds)==null?void 0:f.target)??[]],u=(n?l==null?void 0:l.find(g=>g.id===n):l==null?void 0:l[0])??null;return u&&a?{...u,...Fa(c,u,u.position,!0)}:u}function S9(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function nY(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const w9=()=>!0;function rY(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:a,isTarget:c,domNode:l,nodeLookup:u,lib:h,autoPanOnConnect:p,flowId:f,panBy:g,cancelConnection:y,onConnectStart:C,onConnect:w,onConnectEnd:b,isValidConnection:_=w9,onReconnectEnd:x,updateConnection:S,getTransform:E,getFromHandle:T,autoPanSpeed:A,dragThreshold:D=1,handleDomNode:M}){const R=u9(e.target);let z=0,H;const{x:$,y:U}=ui(e),q=S9(a,M),K=l==null?void 0:l.getBoundingClientRect();let Y=!1;if(!K||!q)return;const Q=x9(s,q,r,u,t);if(!Q)return;let ee=ui(e,K),B=!1,L=null,O=!1,W=null;function G(){if(!p||!K)return;const[be,he]=p2(ee,K,A);g({x:be,y:he}),z=requestAnimationFrame(G)}const ie={...Q,nodeId:s,type:q,position:Q.position},fe=u.get(s);let te={inProgress:!0,isValid:null,from:Fa(fe,ie,We.Left,!0),fromHandle:ie,fromPosition:ie.position,fromNode:fe,to:ee,toHandle:null,toPosition:C6[ie.position],toNode:null,pointer:ee};function V(){Y=!0,S(te),C==null||C(e,{nodeId:s,handleId:r,handleType:q})}D===0&&V();function ae(be){if(!Y){const{x:ze,y:zt}=ui(be),At=ze-$,Tt=zt-U;if(!(At*At+Tt*Tt>D*D))return;V()}if(!T()||!ie){oe(be);return}const he=E();ee=ui(be,K),H=tY(mu(ee,he,!1,[1,1]),n,u,ie),B||(G(),B=!0);const Se=C9(be,{handle:H,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:c?"target":"source",isValidConnection:_,doc:R,lib:h,flowId:f,nodeLookup:u});W=Se.handleDomNode,L=Se.connection,O=nY(!!H,Se.isValid);const Te=u.get(s),Re=Te?Fa(Te,ie,We.Left,!0):te.from,He={...te,from:Re,isValid:O,to:Se.toHandle&&O?ol({x:Se.toHandle.x,y:Se.toHandle.y},he):ee,toHandle:Se.toHandle,toPosition:O&&Se.toHandle?Se.toHandle.position:C6[ie.position],toNode:Se.toHandle?u.get(Se.toHandle.nodeId):null,pointer:ee};S(He),te=He}function oe(be){if(!("touches"in be&&be.touches.length>0)){if(Y){(H||W)&&L&&O&&(w==null||w(L));const{inProgress:he,...Se}=te,Te={...Se,toPosition:te.toHandle?te.toPosition:null};b==null||b(be,Te),a&&(x==null||x(be,Te))}y(),cancelAnimationFrame(z),B=!1,O=!1,L=null,W=null,R.removeEventListener("mousemove",ae),R.removeEventListener("mouseup",oe),R.removeEventListener("touchmove",ae),R.removeEventListener("touchend",oe)}}R.addEventListener("mousemove",ae),R.addEventListener("mouseup",oe),R.addEventListener("touchmove",ae),R.addEventListener("touchend",oe)}function C9(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:a,doc:c,lib:l,flowId:u,isValidConnection:h=w9,nodeLookup:p}){const f=a==="target",g=t?c.querySelector(`.${l}-flow__handle[data-id="${u}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:y,y:C}=ui(e),w=c.elementFromPoint(y,C),b=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:g,_={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const x=S9(void 0,b),S=b.getAttribute("data-nodeid"),E=b.getAttribute("data-handleid"),T=b.classList.contains("connectable"),A=b.classList.contains("connectableend");if(!S||!x)return _;const D={source:f?S:r,sourceHandle:f?E:s,target:f?r:S,targetHandle:f?s:E};_.connection=D;const R=T&&A&&(n===sl.Strict?f&&x==="source"||!f&&x==="target":S!==r||E!==s);_.isValid=R&&h(D),_.toHandle=x9(S,x,E,p,n,!0)}return _}const Cg={onPointerDown:rY,isValid:C9};function iY({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Nr(e);function a({translateExtent:l,width:u,height:h,zoomStep:p=1,pannable:f=!0,zoomable:g=!0,inversePan:y=!1}){const C=S=>{if(S.sourceEvent.type!=="wheel"||!t)return;const E=n(),T=S.sourceEvent.ctrlKey&&Xc()?10:1,A=-S.sourceEvent.deltaY*(S.sourceEvent.deltaMode===1?.05:S.sourceEvent.deltaMode?1:.002)*p,D=E[2]*Math.pow(2,A*T);t.scaleTo(D)};let w=[0,0];const b=S=>{(S.sourceEvent.type==="mousedown"||S.sourceEvent.type==="touchstart")&&(w=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY])},_=S=>{const E=n();if(S.sourceEvent.type!=="mousemove"&&S.sourceEvent.type!=="touchmove"||!t)return;const T=[S.sourceEvent.clientX??S.sourceEvent.touches[0].clientX,S.sourceEvent.clientY??S.sourceEvent.touches[0].clientY],A=[T[0]-w[0],T[1]-w[1]];w=T;const D=r()*Math.max(E[2],Math.log(E[2]))*(y?-1:1),M={x:E[0]-A[0]*D,y:E[1]-A[1]*D},R=[[0,0],[u,h]];t.setViewportConstrained({x:M.x,y:M.y,zoom:E[2]},R,l)},x=Zw().on("start",b).on("zoom",f?_:null).on("zoom.wheel",g?C:null);s.call(x,{})}function c(){s.on("zoom",null)}return{update:a,destroy:c,pointer:oi}}const qd=e=>({x:e.x,y:e.y,zoom:e.k}),tm=({x:e,y:t,zoom:n})=>Pd.translate(e,t).scale(n),Go=(e,t)=>e.target.closest(`.${t}`),E9=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),sY=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,nm=(e,t=0,n=sY,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},k9=e=>{const t=e.ctrlKey&&Xc()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function aY({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:l,onPanZoom:u,onPanZoomEnd:h}){return p=>{if(Go(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(p.ctrlKey&&c){const b=oi(p),_=k9(p),x=f*Math.pow(2,_);r.scaleTo(n,x,b,p);return}const g=p.deltaMode===1?20:1;let y=s===La.Vertical?0:p.deltaX*g,C=s===La.Horizontal?0:p.deltaY*g;!Xc()&&p.shiftKey&&s!==La.Vertical&&(y=p.deltaY*g,C=0),r.translateBy(n,-(y/f)*a,-(C/f)*a,{internal:!0});const w=qd(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(u==null||u(p,w),e.panScrollTimeout=setTimeout(()=>{h==null||h(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,w))}}function oY({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const a=r.type==="wheel",c=!t&&a&&!r.ctrlKey,l=Go(r,e);if(r.ctrlKey&&a&&l&&r.preventDefault(),c||l)return null;r.preventDefault(),n.call(this,r,s)}}function lY({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var a,c,l;if((a=r.sourceEvent)!=null&&a.internal)return;const s=qd(r.transform);e.mouseButton=((c=r.sourceEvent)==null?void 0:c.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,s))}}function cY({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return a=>{var c,l;e.usedRightMouseButton=!!(n&&E9(t,e.mouseButton??0)),(c=a.sourceEvent)!=null&&c.sync||r([a.transform.x,a.transform.y,a.transform.k]),s&&!((l=a.sourceEvent)!=null&&l.internal)&&(s==null||s(a.sourceEvent,qd(a.transform)))}}function uY({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:a}){return c=>{var l;if(!((l=c.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,a&&E9(t,e.mouseButton??0)&&!e.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const u=qd(c.transform);e.prevViewport=u,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(c.sourceEvent,u)},n?150:0)}}}function hY({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:l,noPanClassName:u,lib:h,connectionInProgress:p}){return f=>{var b;const g=e||t,y=n&&f.ctrlKey,C=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Go(f,`${h}-flow__node`)||Go(f,`${h}-flow__edge`)))return!0;if(!r&&!g&&!s&&!a&&!n||c||p&&!C||Go(f,l)&&C||Go(f,u)&&(!C||s&&C&&!e)||!n&&f.ctrlKey&&C)return!1;if(!n&&f.type==="touchstart"&&((b=f.touches)==null?void 0:b.length)>1)return f.preventDefault(),!1;if(!g&&!s&&!y&&C||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||C)&&w}}function dY({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:l,onDraggingChange:u}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=Zw().scaleExtent([t,n]).translateExtent(r),g=Nr(e).call(f);x({x:s.x,y:s.y,zoom:al(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const y=g.on("wheel.zoom"),C=g.on("dblclick.zoom");f.wheelDelta(k9);async function w(H,$){return g?new Promise(U=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?Tc:vh).transform(nm(g,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),H)}):!1}function b({noWheelClassName:H,noPanClassName:$,onPaneContextMenu:U,userSelectionActive:q,panOnScroll:K,panOnDrag:Y,panOnScrollMode:Q,panOnScrollSpeed:ee,preventScrolling:B,zoomOnPinch:L,zoomOnScroll:O,zoomOnDoubleClick:W,zoomActivationKeyPressed:G,lib:ie,onTransformChange:fe,connectionInProgress:pe,paneClickDistance:te,selectionOnDrag:V}){q&&!h.isZoomingOrPanning&&_();const ae=K&&!G&&!q;f.clickDistance(V?1/0:!ci(te)||te<0?0:te);const oe=ae?aY({zoomPanValues:h,noWheelClassName:H,d3Selection:g,d3Zoom:f,panOnScrollMode:Q,panOnScrollSpeed:ee,zoomOnPinch:L,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:l}):oY({noWheelClassName:H,preventScrolling:B,d3ZoomHandler:y});g.on("wheel.zoom",oe,{passive:!1});const be=lY({zoomPanValues:h,onDraggingChange:u,onPanZoomStart:c});f.on("start",be);const he=cY({zoomPanValues:h,panOnDrag:Y,onPaneContextMenu:!!U,onPanZoom:a,onTransformChange:fe});f.on("zoom",he);const Se=uY({zoomPanValues:h,panOnDrag:Y,panOnScroll:K,onPaneContextMenu:U,onPanZoomEnd:l,onDraggingChange:u});f.on("end",Se);const Te=hY({zoomActivationKeyPressed:G,panOnDrag:Y,zoomOnScroll:O,panOnScroll:K,zoomOnDoubleClick:W,zoomOnPinch:L,userSelectionActive:q,noPanClassName:$,noWheelClassName:H,lib:ie,connectionInProgress:pe});f.filter(Te),W?g.on("dblclick.zoom",C):g.on("dblclick.zoom",null)}function _(){f.on("zoom",null)}async function x(H,$,U){const q=tm(H),K=f==null?void 0:f.constrain()(q,$,U);return K&&await w(K),K}async function S(H,$){const U=tm(H);return await w(U,$),U}function E(H){if(g){const $=tm(H),U=g.property("__zoom");(U.k!==H.zoom||U.x!==H.x||U.y!==H.y)&&(f==null||f.transform(g,$,null,{sync:!0}))}}function T(){const H=g?Kw(g.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}async function A(H,$){return g?new Promise(U=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?Tc:vh).scaleTo(nm(g,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),H)}):!1}async function D(H,$){return g?new Promise(U=>{f==null||f.interpolate(($==null?void 0:$.interpolate)==="linear"?Tc:vh).scaleBy(nm(g,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>U(!0)),H)}):!1}function M(H){f==null||f.scaleExtent(H)}function R(H){f==null||f.translateExtent(H)}function z(H){const $=!ci(H)||H<0?0:H;f==null||f.clickDistance($)}return{update:b,destroy:_,setViewport:S,setViewportConstrained:x,getViewport:T,scaleTo:A,scaleBy:D,setScaleExtent:M,setTranslateExtent:R,syncViewport:E,setClickDistance:z}}var ll;(function(e){e.Line="line",e.Handle="handle"})(ll||(ll={}));function fY({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:a}){const c=e-t,l=n-r,u=[c>0?1:c<0?-1:0,l>0?1:l<0?-1:0];return c&&s&&(u[0]=u[0]*-1),l&&a&&(u[1]=u[1]*-1),u}function z6(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),s=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:s}}function Ps(e,t){return Math.max(0,t-e)}function $s(e,t){return Math.max(0,e-t)}function eh(e,t,n){return Math.max(0,t-e,e-n)}function I6(e,t){return e?!t:t}function pY(e,t,n,r,s,a,c,l){let{affectsX:u,affectsY:h}=t;const{isHorizontal:p,isVertical:f}=t,g=p&&f,{xSnapped:y,ySnapped:C}=n,{minWidth:w,maxWidth:b,minHeight:_,maxHeight:x}=r,{x:S,y:E,width:T,height:A,aspectRatio:D}=e;let M=Math.floor(p?y-e.pointerX:0),R=Math.floor(f?C-e.pointerY:0);const z=T+(u?-M:M),H=A+(h?-R:R),$=-a[0]*T,U=-a[1]*A;let q=eh(z,w,b),K=eh(H,_,x);if(c){let ee=0,B=0;u&&M<0?ee=Ps(S+M+$,c[0][0]):!u&&M>0&&(ee=$s(S+z+$,c[1][0])),h&&R<0?B=Ps(E+R+U,c[0][1]):!h&&R>0&&(B=$s(E+H+U,c[1][1])),q=Math.max(q,ee),K=Math.max(K,B)}if(l){let ee=0,B=0;u&&M>0?ee=$s(S+M,l[0][0]):!u&&M<0&&(ee=Ps(S+z,l[1][0])),h&&R>0?B=$s(E+R,l[0][1]):!h&&R<0&&(B=Ps(E+H,l[1][1])),q=Math.max(q,ee),K=Math.max(K,B)}if(s){if(p){const ee=eh(z/D,_,x)*D;if(q=Math.max(q,ee),c){let B=0;!u&&!h||u&&!h&&g?B=$s(E+U+z/D,c[1][1])*D:B=Ps(E+U+(u?M:-M)/D,c[0][1])*D,q=Math.max(q,B)}if(l){let B=0;!u&&!h||u&&!h&&g?B=Ps(E+z/D,l[1][1])*D:B=$s(E+(u?M:-M)/D,l[0][1])*D,q=Math.max(q,B)}}if(f){const ee=eh(H*D,w,b)/D;if(K=Math.max(K,ee),c){let B=0;!u&&!h||h&&!u&&g?B=$s(S+H*D+$,c[1][0])/D:B=Ps(S+(h?R:-R)*D+$,c[0][0])/D,K=Math.max(K,B)}if(l){let B=0;!u&&!h||h&&!u&&g?B=Ps(S+H*D,l[1][0])/D:B=$s(S+(h?R:-R)*D,l[0][0])/D,K=Math.max(K,B)}}}R=R+(R<0?K:-K),M=M+(M<0?q:-q),s&&(g?z>H*D?R=(I6(u,h)?-M:M)/D:M=(I6(u,h)?-R:R)*D:p?(R=M/D,h=u):(M=R*D,u=h));const Y=u?S+M:S,Q=h?E+R:E;return{width:T+(u?-M:M),height:A+(h?-R:R),x:a[0]*M*(u?-1:1)+Y,y:a[1]*R*(h?-1:1)+Q}}const A9={width:0,height:0,x:0,y:0},mY={...A9,pointerX:0,pointerY:0,aspectRatio:1};function gY(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,a=e.measured.width??0,c=e.measured.height??0,l=n[0]*a,u=n[1]*c;return[[r-l,s-u],[r+a-l,s+c-u]]}function vY({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const a=Nr(e);let c={controlDirection:z6("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:h,boundaries:p,keepAspectRatio:f,resizeDirection:g,onResizeStart:y,onResize:C,onResizeEnd:w,shouldResize:b}){let _={...A9},x={...mY};c={boundaries:p,resizeDirection:g,keepAspectRatio:f,controlDirection:z6(h)};let S,E=null,T=[],A,D,M,R=!1;const z=Bw().on("start",H=>{const{nodeLookup:$,transform:U,snapGrid:q,snapToGrid:K,nodeOrigin:Y,paneDomNode:Q}=n();if(S=$.get(t),!S)return;E=(Q==null?void 0:Q.getBoundingClientRect())??null;const{xSnapped:ee,ySnapped:B}=Nc(H.sourceEvent,{transform:U,snapGrid:q,snapToGrid:K,containerBounds:E});_={width:S.measured.width??0,height:S.measured.height??0,x:S.position.x??0,y:S.position.y??0},x={..._,pointerX:ee,pointerY:B,aspectRatio:_.width/_.height},A=void 0,D=Ha(S.extent)?S.extent:void 0,S.parentId&&(S.extent==="parent"||S.expandParent)&&(A=$.get(S.parentId)),A&&S.extent==="parent"&&(D=[[0,0],[A.measured.width,A.measured.height]]),T=[],M=void 0;for(const[L,O]of $)if(O.parentId===t&&(T.push({id:L,position:{...O.position},extent:O.extent}),O.extent==="parent"||O.expandParent)){const W=gY(O,S,O.origin??Y);M?M=[[Math.min(W[0][0],M[0][0]),Math.min(W[0][1],M[0][1])],[Math.max(W[1][0],M[1][0]),Math.max(W[1][1],M[1][1])]]:M=W}y==null||y(H,{..._})}).on("drag",H=>{const{transform:$,snapGrid:U,snapToGrid:q,nodeOrigin:K}=n(),Y=Nc(H.sourceEvent,{transform:$,snapGrid:U,snapToGrid:q,containerBounds:E}),Q=[];if(!S)return;const{x:ee,y:B,width:L,height:O}=_,W={},G=S.origin??K,{width:ie,height:fe,x:pe,y:te}=pY(x,c.controlDirection,Y,c.boundaries,c.keepAspectRatio,G,D,M),V=ie!==L,ae=fe!==O,oe=pe!==ee&&V,be=te!==B&&ae;if(!oe&&!be&&!V&&!ae)return;if((oe||be||G[0]===1||G[1]===1)&&(W.x=oe?pe:_.x,W.y=be?te:_.y,_.x=W.x,_.y=W.y,T.length>0)){const Re=pe-ee,He=te-B;for(const ze of T)ze.position={x:ze.position.x-Re+G[0]*(ie-L),y:ze.position.y-He+G[1]*(fe-O)},Q.push(ze)}if((V||ae)&&(W.width=V&&(!c.resizeDirection||c.resizeDirection==="horizontal")?ie:_.width,W.height=ae&&(!c.resizeDirection||c.resizeDirection==="vertical")?fe:_.height,_.width=W.width,_.height=W.height),A&&S.expandParent){const Re=G[0]*(W.width??0);W.x&&W.x{R&&(w==null||w(H,{..._}),s==null||s({..._}),R=!1)});a.call(z)}function u(){a.on(".drag",null)}return{update:l,destroy:u}}var rm={exports:{}},im={},sm={exports:{}},am={};/** * @license React * use-sync-external-store-shim.production.js * @@ -646,7 +646,7 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var H6;function bY(){if(H6)return sm;H6=1;var e=Zc();function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,a=e.useLayoutEffect,c=e.useDebugValue;function l(f,g){var y=g(),C=r({inst:{value:y,getSnapshot:g}}),w=C[0].inst,_=C[1];return a(function(){w.value=y,w.getSnapshot=g,u(w)&&_({inst:w})},[f,y,g]),s(function(){return u(w)&&_({inst:w}),f(function(){u(w)&&_({inst:w})})},[f]),c(y),y}function u(f){var g=f.getSnapshot;f=f.value;try{var y=g();return!n(f,y)}catch{return!0}}function h(f,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:l;return sm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,sm}var F6;function _Y(){return F6||(F6=1,im.exports=bY()),im.exports}/** + */var H6;function yY(){if(H6)return am;H6=1;var e=Zc();function t(f,g){return f===g&&(f!==0||1/f===1/g)||f!==f&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,a=e.useLayoutEffect,c=e.useDebugValue;function l(f,g){var y=g(),C=r({inst:{value:y,getSnapshot:g}}),w=C[0].inst,b=C[1];return a(function(){w.value=y,w.getSnapshot=g,u(w)&&b({inst:w})},[f,y,g]),s(function(){return u(w)&&b({inst:w}),f(function(){u(w)&&b({inst:w})})},[f]),c(y),y}function u(f){var g=f.getSnapshot;f=f.value;try{var y=g();return!n(f,y)}catch{return!0}}function h(f,g){return g()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:l;return am.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,am}var F6;function bY(){return F6||(F6=1,sm.exports=yY()),sm.exports}/** * @license React * use-sync-external-store-shim/with-selector.production.js * @@ -654,12 +654,12 @@ Its experiments, runs and chats are removed from orx. The GitHub repo (${f.githu * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var P6;function xY(){if(P6)return rm;P6=1;var e=Zc(),t=_Y();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,a=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return rm.useSyncExternalStoreWithSelector=function(h,p,f,g,y){var C=a(null);if(C.current===null){var w={hasValue:!1,value:null};C.current=w}else w=C.current;C=l(function(){function b(A){if(!x){if(x=!0,S=A,A=g(A),y!==void 0&&w.hasValue){var D=w.value;if(y(D,A))return E=D}return E=A}if(D=E,r(S,A))return D;var M=g(A);return y!==void 0&&y(D,M)?(S=A,D):(S=A,E=M)}var x=!1,S,E,T=f===void 0?null:f;return[function(){return b(p())},T===null?void 0:function(){return b(T())}]},[p,f,g,y]);var _=s(h,C[0],C[1]);return c(function(){w.hasValue=!0,w.value=_},[_]),u(_),_},rm}var $6;function SY(){return $6||($6=1,nm.exports=xY()),nm.exports}var wY=SY();const CY=Kh(wY),EY={},U6=e=>{let t;const n=new Set,r=(p,f)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const y=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(C=>C(t,y))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(EY?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=t=e(r,s,u);return u},kY=e=>e?U6(e):U6,{useDebugValue:AY}=Sk,{useSyncExternalStoreWithSelector:TY}=CY,NY=e=>e;function N9(e,t=NY,n){const r=TY(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return AY(r),r}const q6=(e,t)=>{const n=kY(e),r=(s,a=t)=>N9(n,s,a);return Object.assign(r,n),r},MY=(e,t)=>e?q6(e,t):q6;function sn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const qd=P.createContext(null),DY=qd.Provider,M9=fi.error001("react");function kt(e,t){const n=P.useContext(qd);if(n===null)throw new Error(M9);return N9(n,e,t)}function on(){const e=P.useContext(qd);if(e===null)throw new Error(M9);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const G6={display:"none"},RY={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},D9="react-flow__node-desc",R9="react-flow__edge-desc",jY="react-flow__aria-live",LY=e=>e.ariaLiveMessage,OY=e=>e.ariaLabelConfig;function BY({rfId:e}){const t=kt(LY);return m.jsx("div",{id:`${jY}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:RY,children:t})}function zY({rfId:e,disableKeyboardA11y:t}){const n=kt(OY);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${D9}-${e}`,style:G6,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${R9}-${e}`,style:G6,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(BY,{rfId:e})]})}const Gd=P.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},a)=>{const c=`${e}`.split("-");return m.jsx("div",{className:Nn(["react-flow__panel",n,...c]),style:r,ref:a,...s,children:t})});Gd.displayName="Panel";const V6="https://reactflow.dev?utm_source=attribution";function IY({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Gd,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${V6}`,children:m.jsx("a",{href:V6,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const HY=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},th=e=>e.id;function FY(e,t){return sn(e.selectedNodes.map(th),t.selectedNodes.map(th))&&sn(e.selectedEdges.map(th),t.selectedEdges.map(th))}function PY({onSelectionChange:e}){const t=on(),{selectedNodes:n,selectedEdges:r}=kt(HY,FY);return P.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[n,r,e]),null}const $Y=e=>!!e.onSelectionChangeHandlers;function UY({onSelectionChange:e}){const t=kt($Y);return e||t?m.jsx(PY,{onSelectionChange:e}):null}const j9=[0,0],qY={x:0,y:0,zoom:1},GY=["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"],W6=[...GY,"rfId"],VY=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}),Y6={translateExtent:Vc,nodeOrigin:j9,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function WY(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:c,reset:l,setDefaultNodesAndEdges:u}=kt(VY,sn),h=on();P.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=Y6,l()}),[]);const p=P.useRef(Y6);return P.useEffect(()=>{for(const f of W6){const g=e[f],y=p.current[f];g!==y&&(typeof e[f]>"u"||(f==="nodes"?t(g):f==="edges"?n(g):f==="minZoom"?r(g):f==="maxZoom"?s(g):f==="translateExtent"?a(g):f==="nodeExtent"?c(g):f==="ariaLabelConfig"?h.setState({ariaLabelConfig:DW(g)}):f==="fitView"?h.setState({fitViewQueued:g}):f==="fitViewOptions"?h.setState({fitViewOptions:g}):h.setState({[f]:g})))}p.current=e},W6.map(f=>e[f])),null}function X6(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function YY(e){var r;const[t,n]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){n(e);return}const s=X6(),a=()=>n(s!=null&&s.matches?"dark":"light");return a(),s==null||s.addEventListener("change",a),()=>{s==null||s.removeEventListener("change",a)}},[e]),t!==null?t:(r=X6())!=null&&r.matches?"dark":"light"}const K6=typeof document<"u"?document:null;function Kc(e=null,t={target:K6,actInsideInputWithModifier:!0}){const[n,r]=P.useState(!1),s=P.useRef(!1),a=P.useRef(new Set([])),[c,l]=P.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` + */var P6;function _Y(){if(P6)return im;P6=1;var e=Zc(),t=bY();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,a=e.useRef,c=e.useEffect,l=e.useMemo,u=e.useDebugValue;return im.useSyncExternalStoreWithSelector=function(h,p,f,g,y){var C=a(null);if(C.current===null){var w={hasValue:!1,value:null};C.current=w}else w=C.current;C=l(function(){function _(A){if(!x){if(x=!0,S=A,A=g(A),y!==void 0&&w.hasValue){var D=w.value;if(y(D,A))return E=D}return E=A}if(D=E,r(S,A))return D;var M=g(A);return y!==void 0&&y(D,M)?(S=A,D):(S=A,E=M)}var x=!1,S,E,T=f===void 0?null:f;return[function(){return _(p())},T===null?void 0:function(){return _(T())}]},[p,f,g,y]);var b=s(h,C[0],C[1]);return c(function(){w.hasValue=!0,w.value=b},[b]),u(b),b},im}var $6;function xY(){return $6||($6=1,rm.exports=_Y()),rm.exports}var SY=xY();const wY=Kh(SY),CY={},U6=e=>{let t;const n=new Set,r=(p,f)=>{const g=typeof p=="function"?p(t):p;if(!Object.is(g,t)){const y=t;t=f??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(C=>C(t,y))}},s=()=>t,u={setState:r,getState:s,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(CY?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=t=e(r,s,u);return u},EY=e=>e?U6(e):U6,{useDebugValue:kY}=xk,{useSyncExternalStoreWithSelector:AY}=wY,TY=e=>e;function T9(e,t=TY,n){const r=AY(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return kY(r),r}const q6=(e,t)=>{const n=EY(e),r=(s,a=t)=>T9(n,s,a);return Object.assign(r,n),r},NY=(e,t)=>e?q6(e,t):q6;function sn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Gd=P.createContext(null),MY=Gd.Provider,N9=fi.error001("react");function Et(e,t){const n=P.useContext(Gd);if(n===null)throw new Error(N9);return T9(n,e,t)}function on(){const e=P.useContext(Gd);if(e===null)throw new Error(N9);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const G6={display:"none"},DY={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},M9="react-flow__node-desc",D9="react-flow__edge-desc",RY="react-flow__aria-live",jY=e=>e.ariaLiveMessage,LY=e=>e.ariaLabelConfig;function OY({rfId:e}){const t=Et(jY);return m.jsx("div",{id:`${RY}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:DY,children:t})}function BY({rfId:e,disableKeyboardA11y:t}){const n=Et(LY);return m.jsxs(m.Fragment,{children:[m.jsx("div",{id:`${M9}-${e}`,style:G6,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),m.jsx("div",{id:`${D9}-${e}`,style:G6,children:n["edge.a11yDescription.default"]}),!t&&m.jsx(OY,{rfId:e})]})}const Vd=P.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},a)=>{const c=`${e}`.split("-");return m.jsx("div",{className:Nn(["react-flow__panel",n,...c]),style:r,ref:a,...s,children:t})});Vd.displayName="Panel";const V6="https://reactflow.dev?utm_source=attribution";function zY({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:m.jsx(Vd,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${V6}`,children:m.jsx("a",{href:V6,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const IY=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},th=e=>e.id;function HY(e,t){return sn(e.selectedNodes.map(th),t.selectedNodes.map(th))&&sn(e.selectedEdges.map(th),t.selectedEdges.map(th))}function FY({onSelectionChange:e}){const t=on(),{selectedNodes:n,selectedEdges:r}=Et(IY,HY);return P.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[n,r,e]),null}const PY=e=>!!e.onSelectionChangeHandlers;function $Y({onSelectionChange:e}){const t=Et(PY);return e||t?m.jsx(FY,{onSelectionChange:e}):null}const R9=[0,0],UY={x:0,y:0,zoom:1},qY=["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"],W6=[...qY,"rfId"],GY=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}),Y6={translateExtent:Vc,nodeOrigin:R9,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function VY(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:c,reset:l,setDefaultNodesAndEdges:u}=Et(GY,sn),h=on();P.useEffect(()=>(u(e.defaultNodes,e.defaultEdges),()=>{p.current=Y6,l()}),[]);const p=P.useRef(Y6);return P.useEffect(()=>{for(const f of W6){const g=e[f],y=p.current[f];g!==y&&(typeof e[f]>"u"||(f==="nodes"?t(g):f==="edges"?n(g):f==="minZoom"?r(g):f==="maxZoom"?s(g):f==="translateExtent"?a(g):f==="nodeExtent"?c(g):f==="ariaLabelConfig"?h.setState({ariaLabelConfig:MW(g)}):f==="fitView"?h.setState({fitViewQueued:g}):f==="fitViewOptions"?h.setState({fitViewOptions:g}):h.setState({[f]:g})))}p.current=e},W6.map(f=>e[f])),null}function X6(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function WY(e){var r;const[t,n]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){n(e);return}const s=X6(),a=()=>n(s!=null&&s.matches?"dark":"light");return a(),s==null||s.addEventListener("change",a),()=>{s==null||s.removeEventListener("change",a)}},[e]),t!==null?t:(r=X6())!=null&&r.matches?"dark":"light"}const K6=typeof document<"u"?document:null;function Kc(e=null,t={target:K6,actInsideInputWithModifier:!0}){const[n,r]=P.useState(!1),s=P.useRef(!1),a=P.useRef(new Set([])),[c,l]=P.useMemo(()=>{if(e!==null){const h=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",` `).replace(` `,` +`).split(` -`)),p=h.reduce((f,g)=>f.concat(...g),[]);return[h,p]}return[[],[]]},[e]);return P.useEffect(()=>{const u=(t==null?void 0:t.target)??K6,h=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var _,b;if(s.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!s.current||s.current&&!h)&&d9(y))return!1;const w=Q6(y.code,l);if(a.current.add(y[w]),Z6(c,a.current,!1)){const x=((b=(_=y.composedPath)==null?void 0:_.call(y))==null?void 0:b[0])||y.target,S=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(s.current||!S)&&y.preventDefault(),r(!0)}},f=y=>{const C=Q6(y.code,l);Z6(c,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(y[C]),y.key==="Meta"&&a.current.clear(),s.current=!1},g=()=>{a.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function Z6(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function Q6(e,t){return t.includes(e)?"code":"key"}const XY=()=>{const e=on();return P.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,a],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{const[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)=>{const{width:r,height:s,minZoom:a,maxZoom:c,panZoom:l}=e.getState(),u=m2(t,r,s,a,c,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:a,domNode:c}=e.getState();if(!c)return t;const{x:l,y:u}=c.getBoundingClientRect(),h={x:t.x-l,y:t.y-u},p=n.snapGrid??s,f=n.snapToGrid??a;return mu(h,r,f,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:a}=r.getBoundingClientRect(),c=ol(t,n);return{x:c.x+s,y:c.y+a}}}),[])};function L9(e,t){const n=[],r=new Map,s=[];for(const a of e)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")r.set(a.id,[a]);else{const c=r.get(a.id);c?c.push(a):r.set(a.id,[a])}for(const a of t){const c=r.get(a.id);if(!c){n.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const l={...a};for(const u of c)KY(u,l);n.push(l)}return s.length&&s.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function KY(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(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 ZY(e,t){return L9(e,t)}function QY(e,t){return L9(e,t)}function Ta(e,t){return{id:e,type:"select",selected:t}}function Vo(e,t=new Set,n=!1){const r=[];for(const[s,a]of e){const c=t.has(s);!(a.selected===void 0&&!c)&&a.selected!==c&&(n&&(a.selected=c),r.push(Ta(a.id,c)))}return r}function J6({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,c]of e.entries()){const l=t.get(c.id),u=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;u!==void 0&&u!==c&&n.push({id:c.id,item:c,type:"replace"}),u===void 0&&n.push({item:c,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function ex(e){return{id:e.id,type:"remove"}}const JY=l9();function eX(e,t,n={}){return zW(e,t,{...n,onError:n.onError??JY})}const tx=e=>SW(e),tX=e=>r9(e);function O9(e){return P.forwardRef(e)}const nX=typeof window<"u"?P.useLayoutEffect:P.useEffect;function nx(e){const[t,n]=P.useState(BigInt(0)),[r]=P.useState(()=>rX(()=>n(s=>s+BigInt(1))));return nX(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function rX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const B9=P.createContext(null);function iX({children:e}){const t=on(),n=P.useCallback(l=>{const{nodes:u=[],setNodes:h,hasDefaultNodes:p,onNodesChange:f,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:C}=t.getState();let w=u;for(const b of l)w=typeof b=="function"?b(w):b;let _=J6({items:w,lookup:g});for(const b of C.values())_=b(_);p&&h(w),_.length>0?f==null||f(_):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:x,setNodes:S}=t.getState();b&&S(x)})},[]),r=nx(n),s=P.useCallback(l=>{const{edges:u=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:g}=t.getState();let y=u;for(const C of l)y=typeof C=="function"?C(y):C;p?h(y):f&&f(J6({items:y,lookup:g}))},[]),a=nx(s),c=P.useMemo(()=>({nodeQueue:r,edgeQueue:a}),[]);return m.jsx(B9.Provider,{value:c,children:e})}function sX(){const e=P.useContext(B9);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const aX=e=>!!e.panZoom;function S2(){const e=XY(),t=on(),n=sX(),r=kt(aX),s=P.useMemo(()=>{const a=f=>t.getState().nodeLookup.get(f),c=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},u=f=>{var b,x;const{nodeLookup:g,nodeOrigin:y}=t.getState(),C=tx(f)?f:g.get(f.id),w=C.parentId?u9(C.position,C.measured,C.parentId,g,y):C.position,_={...C,position:w,width:((b=C.measured)==null?void 0:b.width)??C.width,height:((x=C.measured)==null?void 0:x.height)??C.height};return Yc(_)},h=(f,g,y={replace:!1})=>{c(C=>C.map(w=>{if(w.id===f){const _=typeof g=="function"?g(w):g;return y.replace&&tx(_)?_:{...w,..._}}return w}))},p=(f,g,y={replace:!1})=>{l(C=>C.map(w=>{if(w.id===f){const _=typeof g=="function"?g(w):g;return y.replace&&tX(_)?_:{...w,..._}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var g;return(g=a(f))==null?void 0:g.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(g=>({...g}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:c,setEdges:l,addNodes:f=>{const g=Array.isArray(f)?f:[f];n.nodeQueue.push(y=>[...y,...g])},addEdges:f=>{const g=Array.isArray(f)?f:[f];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:f=[],edges:g=[],transform:y}=t.getState(),[C,w,_]=y;return{nodes:f.map(b=>({...b})),edges:g.map(b=>({...b})),viewport:{x:C,y:w,zoom:_}}},deleteElements:async({nodes:f=[],edges:g=[]})=>{const{nodes:y,edges:C,onNodesDelete:w,onEdgesDelete:_,triggerNodeChanges:b,triggerEdgeChanges:x,onDelete:S,onBeforeDelete:E}=t.getState(),{nodes:T,edges:A}=await AW({nodesToRemove:f,edgesToRemove:g,nodes:y,edges:C,onBeforeDelete:E}),D=A.length>0,M=T.length>0;if(D){const R=A.map(ex);_==null||_(A),x(R)}if(M){const R=T.map(ex);w==null||w(T),b(R)}return(M||D)&&(S==null||S({nodes:T,edges:A})),{deletedNodes:T,deletedEdges:A}},getIntersectingNodes:(f,g=!0,y)=>{const C=k6(f),w=C?f:u(f),_=y!==void 0;return w?(y||t.getState().nodes).filter(b=>{const x=t.getState().nodeLookup.get(b.id);if(x&&!C&&(b.id===f.id||!x.internals.positionAbsolute))return!1;const S=Yc(_?b:x),E=Wh(S,w);return g&&E>0||E>=S.width*S.height||E>=w.width*w.height}):[]},isNodeIntersecting:(f,g,y=!0)=>{const w=k6(f)?f:u(f);if(!w)return!1;const _=Wh(w,g);return y&&_>0||_>=g.width*g.height||_>=w.width*w.height},updateNode:h,updateNodeData:(f,g,y={replace:!1})=>{h(f,C=>{const w=typeof g=="function"?g(C):g;return y.replace?{...C,data:w}:{...C,data:{...C.data,...w}}},y)},updateEdge:p,updateEdgeData:(f,g,y={replace:!1})=>{p(f,C=>{const w=typeof g=="function"?g(C):g;return y.replace?{...C,data:w}:{...C,data:{...C.data,...w}}},y)},getNodesBounds:f=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return wW(f,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:f,id:g,nodeId:y})=>{var C;return Array.from(((C=t.getState().connectionLookup.get(`${y}-${f}${g?`-${g}`:""}`))==null?void 0:C.values())??[])},getNodeConnections:({type:f,handleId:g,nodeId:y})=>{var C;return Array.from(((C=t.getState().connectionLookup.get(`${y}${f?g?`-${f}-${g}`:`-${f}`:""}`))==null?void 0:C.values())??[])},fitView:async f=>{const g=t.getState().fitViewResolver??MW();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return P.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const rx=e=>e.selected,oX=typeof window<"u"?window:void 0;function lX({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=on(),{deleteElements:r}=S2(),s=Kc(e,{actInsideInputWithModifier:!1}),a=Kc(t,{target:oX});P.useEffect(()=>{if(s){const{edges:c,nodes:l}=n.getState();r({nodes:l.filter(rx),edges:c.filter(rx)}),n.setState({nodesSelectionActive:!1})}},[s]),P.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function cX(e){const t=on();P.useEffect(()=>{const n=()=>{var s,a,c,l;if(!e.current||!(((a=(s=e.current).checkVisibility)==null?void 0:a.call(s))??!0))return!1;const r=g2(e.current);(r.height===0||r.width===0)&&((l=(c=t.getState()).onError)==null||l.call(c,"004",fi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Vd={position:"absolute",width:"100%",height:"100%",top:0,left:0},uX=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function hX({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=La.Free,zoomOnDoubleClick:c=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:h,minZoom:p,maxZoom:f,zoomActivationKeyCode:g,preventScrolling:y=!0,children:C,noWheelClassName:w,noPanClassName:_,onViewportChange:b,isControlledViewport:x,paneClickDistance:S,selectionOnDrag:E}){const T=on(),A=P.useRef(null),{userSelectionActive:D,lib:M,connectionInProgress:R}=kt(uX,sn),z=Kc(g),H=P.useRef();cX(A);const q=P.useCallback($=>{b==null||b({x:$[0],y:$[1],zoom:$[2]}),x||T.setState({transform:$})},[b,x]);return P.useEffect(()=>{if(A.current){H.current=fY({domNode:A.current,minZoom:p,maxZoom:f,translateExtent:h,viewport:u,onDraggingChange:Y=>T.setState(Q=>Q.paneDragging===Y?Q:{paneDragging:Y}),onPanZoomStart:(Y,Q)=>{const{onViewportChangeStart:ee,onMoveStart:B}=T.getState();B==null||B(Y,Q),ee==null||ee(Q)},onPanZoom:(Y,Q)=>{const{onViewportChange:ee,onMove:B}=T.getState();B==null||B(Y,Q),ee==null||ee(Q)},onPanZoomEnd:(Y,Q)=>{const{onViewportChangeEnd:ee,onMoveEnd:B}=T.getState();B==null||B(Y,Q),ee==null||ee(Q)}});const{x:$,y:U,zoom:K}=H.current.getViewport();return T.setState({panZoom:H.current,transform:[$,U,K],domNode:A.current.closest(".react-flow")}),()=>{var Y;(Y=H.current)==null||Y.destroy()}}},[]),P.useEffect(()=>{var $;($=H.current)==null||$.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:l,zoomActivationKeyPressed:z,preventScrolling:y,noPanClassName:_,userSelectionActive:D,noWheelClassName:w,lib:M,onTransformChange:q,connectionInProgress:R,selectionOnDrag:E,paneClickDistance:S})},[e,t,n,r,s,a,c,l,z,y,_,D,w,M,q,R,E,S]),m.jsx("div",{className:"react-flow__renderer",ref:A,style:Vd,children:C})}const dX=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function fX(){const{userSelectionActive:e,userSelectionRect:t}=kt(dX,sn);return e&&t?m.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}const am=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},pX=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function mX({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Wc.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:a,selectionOnDrag:c,onSelectionStart:l,onSelectionEnd:u,onPaneClick:h,onPaneContextMenu:p,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:C,children:w}){const _=P.useRef(0),b=on(),{userSelectionActive:x,elementsSelectable:S,dragging:E,panBy:T,autoPanSpeed:A}=kt(pX,sn),D=S&&(e||x),M=P.useRef(null),R=P.useRef(),z=P.useRef(new Set),H=P.useRef(new Set),q=P.useRef(!1),$=P.useRef(!1),U=P.useRef({x:0,y:0}),K=P.useRef(!1),Y=V=>{if($.current||q.current||b.getState().connection.inProgress){$.current=!1,q.current=!1;return}h==null||h(V),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},Q=V=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){V.preventDefault();return}p==null||p(V)},ee=f?V=>f(V):void 0,B=V=>{$.current&&(V.stopPropagation(),$.current=!1)},L=V=>{var ze,zt;const{domNode:ae,transform:oe}=b.getState();if(R.current=ae==null?void 0:ae.getBoundingClientRect(),!R.current)return;const be=V.target===M.current;if(!be&&!!V.target.closest(".nokey")||!e||!(c&&be||t)||V.button!==0||!V.isPrimary)return;(zt=(ze=V.target)==null?void 0:ze.setPointerCapture)==null||zt.call(ze,V.pointerId),$.current=!1;const{x:Te,y:Re}=ui(V.nativeEvent,R.current),He=mu({x:Te,y:Re},oe);b.setState({userSelectionRect:{width:0,height:0,startX:He.x,startY:He.y,x:Te,y:Re}}),be||(V.stopPropagation(),V.preventDefault())};function O(V,ae){const{userSelectionRect:oe}=b.getState();if(!oe)return;const{transform:be,nodeLookup:he,edgeLookup:Se,connectionLookup:Te,triggerNodeChanges:Re,triggerEdgeChanges:He,defaultEdgeOptions:ze}=b.getState(),zt={x:oe.startX,y:oe.startY},{x:At,y:Tt}=ol(zt,be),Gt={startX:zt.x,startY:zt.y,x:Vxt.id)),H.current=new Set;const ct=(ze==null?void 0:ze.selectable)??!0;for(const xt of z.current){const _e=Te.get(xt);if(_e)for(const{edgeId:Ne}of _e.values()){const Pe=Se.get(Ne);Pe&&(Pe.selectable??ct)&&H.current.add(Ne)}}if(!A6(tn,z.current)){const xt=Vo(he,z.current,!0);Re(xt)}if(!A6(mt,H.current)){const xt=Vo(Se,H.current);He(xt)}b.setState({userSelectionRect:Gt,userSelectionActive:!0,nodesSelectionActive:!1})}function W(){if(!s||!R.current)return;const[V,ae]=p2(U.current,R.current,A);T({x:V,y:ae}).then(oe=>{if(!$.current||!oe){_.current=requestAnimationFrame(W);return}const{x:be,y:he}=U.current;O(be,he),_.current=requestAnimationFrame(W)})}const G=()=>{cancelAnimationFrame(_.current),_.current=0,K.current=!1};P.useEffect(()=>()=>G(),[]);const ie=V=>{const{userSelectionRect:ae,transform:oe,resetSelectedElements:be}=b.getState();if(!R.current||!ae)return;const{x:he,y:Se}=ui(V.nativeEvent,R.current);U.current={x:he,y:Se};const Te=ol({x:ae.startX,y:ae.startY},oe);if(!$.current){const Re=t?0:a;if(Math.hypot(he-Te.x,Se-Te.y)<=Re)return;be(),l==null||l(V)}$.current=!0,K.current||(W(),K.current=!0),O(he,Se)},fe=V=>{var ae,oe;if(!D){V.target===M.current&&b.getState().connection.inProgress&&(q.current=!0);return}V.button===0&&((oe=(ae=V.target)==null?void 0:ae.releasePointerCapture)==null||oe.call(ae,V.pointerId),!x&&V.target===M.current&&b.getState().userSelectionRect&&(Y==null||Y(V)),b.setState({userSelectionActive:!1,userSelectionRect:null}),$.current&&(u==null||u(V),b.setState({nodesSelectionActive:z.current.size>0})),G())},pe=V=>{var ae,oe;(oe=(ae=V.target)==null?void 0:ae.releasePointerCapture)==null||oe.call(ae,V.pointerId),G()},te=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Nn(["react-flow__pane",{draggable:te,dragging:E,selection:e}]),onClick:D?void 0:am(Y,M),onContextMenu:am(Q,M),onWheel:am(ee,M),onPointerEnter:D?void 0:g,onPointerMove:D?ie:y,onPointerUp:fe,onPointerCancel:D?pe:void 0,onPointerDownCapture:D?L:void 0,onClickCapture:D?B:void 0,onPointerLeave:C,ref:M,style:Vd,children:[w,m.jsx(fX,{})]})}function Cg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:l,onError:u}=t.getState(),h=l.get(e);if(!h){u==null||u("012",fi.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&c)&&(a({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function z9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:a,nodeClickDistance:c}){const l=on(),[u,h]=P.useState(!1),p=P.useRef();return P.useEffect(()=>{p.current=JW({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Cg({id:f,store:l,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),P.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:s,nodeClickDistance:c}),()=>{var f;(f=p.current)==null||f.destroy()}},[n,r,t,a,e,s,c]),u}const gX=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function I9(){const e=on();return P.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:a,nodesDraggable:c,onError:l,updateNodePositions:u,nodeLookup:h,nodeOrigin:p}=e.getState(),f=new Map,g=gX(c),y=s?a[0]:5,C=s?a[1]:5,w=n.direction.x*y*n.factor,_=n.direction.y*C*n.factor;for(const[,b]of h){if(!g(b))continue;let x={x:b.internals.positionAbsolute.x+w,y:b.internals.positionAbsolute.y+_};s&&(x=pu(x,a));const{position:S,positionAbsolute:E}=i9({nodeId:b.id,nextPosition:x,nodeLookup:h,nodeExtent:r,nodeOrigin:p,onError:l});b.position=S,b.internals.positionAbsolute=E,f.set(b.id,b)}u(f)},[])}const w2=P.createContext(null),vX=w2.Provider;w2.Consumer;const H9=()=>P.useContext(w2),yX=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),F9=P.createContext(null);function bX({children:e}){const t=kt(yX,sn);return m.jsx(F9.Provider,{value:t,children:e})}function _X(){const e=P.useContext(F9);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const xX={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},SX=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:a,connection:c}=r,{fromHandle:l,toHandle:u,isValid:h}=c;if(!l&&!s)return xX;const p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:a===sl.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&h}};function wX({type:e="source",position:t=We.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:c,onConnect:l,children:u,className:h,onMouseDown:p,onTouchStart:f,...g},y){var K,Y;const C=c||null,w=e==="target",_=on(),b=H9(),{connectOnClick:x,noPanClassName:S,rfId:E}=_X(),{connectingFrom:T,connectingTo:A,clickConnecting:D,isPossibleEndHandle:M,connectionInProcess:R,clickConnectionInProcess:z,valid:H}=kt(SX(b,C,e),sn);b||(Y=(K=_.getState()).onError)==null||Y.call(K,"010",fi.error010());const q=Q=>{const{defaultEdgeOptions:ee,onConnect:B,hasDefaultEdges:L}=_.getState(),O={...ee,...Q};if(L){const{edges:W,setEdges:G,onError:ie}=_.getState();G(eX(O,W,{onError:ie}))}B==null||B(O),l==null||l(O)},$=Q=>{if(!b)return;const ee=f9(Q.nativeEvent);if(s&&(ee&&Q.button===0||!ee)){const B=_.getState();wg.onPointerDown(Q.nativeEvent,{handleDomNode:Q.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:w,handleId:C,nodeId:b,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...L)=>{var O,W;return(W=(O=_.getState()).onConnectEnd)==null?void 0:W.call(O,...L)},updateConnection:B.updateConnection,onConnect:q,isValidConnection:n||((...L)=>{var O,W;return((W=(O=_.getState()).isValidConnection)==null?void 0:W.call(O,...L))??!0}),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}ee?p==null||p(Q):f==null||f(Q)},U=Q=>{const{onClickConnectStart:ee,onClickConnectEnd:B,connectionClickStartHandle:L,connectionMode:O,isValidConnection:W,lib:G,rfId:ie,nodeLookup:fe,connection:pe}=_.getState();if(!b||!L&&!s)return;if(!L){ee==null||ee(Q.nativeEvent,{nodeId:b,handleId:C,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:b,type:e,id:C}});return}const te=h9(Q.target),V=n||W,{connection:ae,isValid:oe}=wg.isValid(Q.nativeEvent,{handle:{nodeId:b,id:C,type:e},connectionMode:O,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:V,flowId:ie,doc:te,lib:G,nodeLookup:fe});oe&&ae&&q(ae);const be=structuredClone(pe);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,B==null||B(Q,be),_.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":C,"data-nodeid":b,"data-handlepos":t,"data-id":`${E}-${b}-${C}-${e}`,className:Nn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:a,clickconnecting:D,connectingfrom:T,connectingto:A,valid:H,connectionindicator:r&&(!R||M)&&(R||z?a:s)}]),onMouseDown:$,onTouchStart:$,onClick:x?U:void 0,ref:y,...g,children:u})}const Qs=P.memo(O9(wX));function CX({data:e,isConnectable:t,sourcePosition:n=We.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(Qs,{type:"source",position:n,isConnectable:t})]})}function EX({data:e,isConnectable:t,targetPosition:n=We.Top,sourcePosition:r=We.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(Qs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(Qs,{type:"source",position:r,isConnectable:t})]})}function kX(){return null}function AX({data:e,isConnectable:t,targetPosition:n=We.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(Qs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Yh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ix={input:CX,default:EX,output:AX,group:kX};function TX(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const NX=e=>{const{width:t,height:n,x:r,y:s}=fu(e.nodeLookup,{filter:a=>!!a.selected});return{width:ci(t)?t:null,height:ci(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function MX({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=on(),{width:s,height:a,transformString:c,userSelectionActive:l}=kt(NX,sn),u=I9(),h=P.useRef(null);P.useEffect(()=>{var y;n||(y=h.current)==null||y.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&a!==null;if(z9({nodeRef:h,disabled:!p}),!p)return null;const f=e?y=>{const C=r.getState().nodes.filter(w=>w.selected);e(y,C)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Yh,y.key)&&(y.preventDefault(),u({direction:Yh[y.key],factor:y.shiftKey?4:1}))};return m.jsx("div",{className:Nn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:m.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:s,height:a}})})}const sx=typeof window<"u"?window:void 0,DX=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function P9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:h,selectionOnDrag:p,selectionMode:f,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:C,panActivationKeyCode:w,zoomActivationKeyCode:_,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:S,panOnScroll:E,panOnScrollSpeed:T,panOnScrollMode:A,zoomOnDoubleClick:D,panOnDrag:M,autoPanOnSelection:R,defaultViewport:z,translateExtent:H,minZoom:q,maxZoom:$,preventScrolling:U,onSelectionContextMenu:K,noWheelClassName:Y,noPanClassName:Q,disableKeyboardA11y:ee,onViewportChange:B,isControlledViewport:L}){const{nodesSelectionActive:O,userSelectionActive:W}=kt(DX,sn),G=Kc(h,{target:sx}),ie=Kc(w,{target:sx}),fe=ie||M,pe=ie||E,te=p&&fe!==!0,V=G||W||te;return lX({deleteKeyCode:u,multiSelectionKeyCode:C}),m.jsx(hX,{onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:S,panOnScroll:pe,panOnScrollSpeed:T,panOnScrollMode:A,zoomOnDoubleClick:D,panOnDrag:!G&&fe,defaultViewport:z,translateExtent:H,minZoom:q,maxZoom:$,zoomActivationKeyCode:_,preventScrolling:U,noWheelClassName:Y,noPanClassName:Q,onViewportChange:B,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:te,children:m.jsxs(mX,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:fe,autoPanOnSelection:R,isSelecting:!!V,selectionMode:f,selectionKeyPressed:G,paneClickDistance:l,selectionOnDrag:te,children:[e,O&&m.jsx(MX,{onSelectionContextMenu:K,noPanClassName:Q,disableKeyboardA11y:ee})]})})}P9.displayName="FlowRenderer";const RX=P.memo(P9),jX=e=>t=>e?f2(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function LX(e){return kt(P.useCallback(jX(e),[e]),sn)}const OX=e=>e.updateNodeInternals;function BX(){const e=kt(OX),[t]=P.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const a=s.target.getAttribute("data-id");r.set(a,{id:a,nodeElement:s.target,force:!0})}),e(r)}));return P.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function zX({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=on(),a=P.useRef(null),c=P.useRef(null),l=P.useRef(e.sourcePosition),u=P.useRef(e.targetPosition),h=P.useRef(t),p=n&&!!e.internals.handleBounds;return P.useEffect(()=>{a.current&&!e.hidden&&(!p||c.current!==a.current)&&(c.current&&(r==null||r.unobserve(c.current)),r==null||r.observe(a.current),c.current=a.current)},[p,e.hidden]),P.useEffect(()=>()=>{c.current&&(r==null||r.unobserve(c.current),c.current=null)},[]),P.useEffect(()=>{if(a.current){const f=h.current!==t,g=l.current!==e.sourcePosition,y=u.current!==e.targetPosition;(f||g||y)&&(h.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function IX({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:a,onDoubleClick:c,nodesDraggable:l,elementsSelectable:u,nodesConnectable:h,nodesFocusable:p,resizeObserver:f,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:C,rfId:w,nodeTypes:_,nodeClickDistance:b,onError:x}){const{node:S,internals:E,isParent:T}=kt(V=>{const ae=V.nodeLookup.get(e),oe=V.parentLookup.has(e);return{node:ae,internals:ae.internals,isParent:oe}},sn);let A=S.type||"default",D=(_==null?void 0:_[A])||ix[A];D===void 0&&(x==null||x("003",fi.error003(A)),A="default",D=(_==null?void 0:_.default)||ix.default);const M=!!(S.draggable||l&&typeof S.draggable>"u"),R=!!(S.selectable||u&&typeof S.selectable>"u"),z=!!(S.connectable||h&&typeof S.connectable>"u"),H=!!(S.focusable||p&&typeof S.focusable>"u"),q=on(),$=c9(S),U=zX({node:S,nodeType:A,hasDimensions:$,resizeObserver:f}),K=z9({nodeRef:U,disabled:S.hidden||!M,noDragClassName:g,handleSelector:S.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:b}),Y=I9();if(S.hidden)return null;const Q=hs(S),ee=TX(S),B=R||M||t||n||r||s,L=n?V=>n(V,{...E.userNode}):void 0,O=r?V=>r(V,{...E.userNode}):void 0,W=s?V=>s(V,{...E.userNode}):void 0,G=a?V=>a(V,{...E.userNode}):void 0,ie=c?V=>c(V,{...E.userNode}):void 0,fe=V=>{const{selectNodesOnDrag:ae,nodeDragThreshold:oe}=q.getState();R&&(!ae||!M||oe>0)&&Cg({id:e,store:q,nodeRef:U}),t&&t(V,{...E.userNode})},pe=V=>{if(!(d9(V.nativeEvent)||C)){if(Jw.includes(V.key)&&R){const ae=V.key==="Escape";Cg({id:e,store:q,unselect:ae,nodeRef:U})}else if(M&&S.selected&&Object.prototype.hasOwnProperty.call(Yh,V.key)){V.preventDefault();const{ariaLabelConfig:ae}=q.getState();q.setState({ariaLiveMessage:ae["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),Y({direction:Yh[V.key],factor:V.shiftKey?4:1})}}},te=()=>{var Te;if(C||!((Te=U.current)!=null&&Te.matches(":focus-visible")))return;const{transform:V,width:ae,height:oe,autoPanOnNodeFocus:be,setCenter:he}=q.getState();if(!be)return;f2(new Map([[e,S]]),{x:0,y:0,width:ae,height:oe},V,!0).length>0||he(S.position.x+Q.width/2,S.position.y+Q.height/2,{zoom:V[2]})};return m.jsx("div",{className:Nn(["react-flow__node",`react-flow__node-${A}`,{[y]:M},S.className,{selected:S.selected,selectable:R,parent:T,draggable:M,dragging:K}]),ref:U,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:$?"visible":"hidden",...S.style,...ee},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:O,onMouseLeave:W,onContextMenu:G,onClick:fe,onDoubleClick:ie,onKeyDown:H?pe:void 0,tabIndex:H?0:void 0,onFocus:H?te:void 0,role:S.ariaRole??(H?"group":void 0),"aria-roledescription":"node","aria-describedby":C?void 0:`${D9}-${w}`,"aria-label":S.ariaLabel,...S.domAttributes,children:m.jsx(vX,{value:e,children:m.jsx(D,{id:e,data:S.data,type:A,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:S.selected??!1,selectable:R,draggable:M,deletable:S.deletable??!0,isConnectable:z,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:K,dragHandle:S.dragHandle,zIndex:E.z,parentId:S.parentId,...Q})})})}var HX=P.memo(IX);const FX=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function $9(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:a}=kt(FX,sn),c=LX(e.onlyRenderVisibleElements),l=BX();return m.jsx("div",{className:"react-flow__nodes",style:Vd,children:c.map(u=>m.jsx(HX,{id:u,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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},u))})}$9.displayName="NodeRenderer";const PX=P.memo($9);function $X(e){return kt(P.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const a=n.nodeLookup.get(s.source),c=n.nodeLookup.get(s.target);a&&c&&LW({sourceNode:a,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),sn)}const UX=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},qX=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ax={[Gh.Arrow]:UX,[Gh.ArrowClosed]:qX};function GX(e){const t=on();return P.useMemo(()=>{var s,a;return Object.prototype.hasOwnProperty.call(ax,e)?ax[e]:((a=(s=t.getState()).onError)==null||a.call(s,"009",fi.error009(e)),null)},[e])}const VX=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:l="auto-start-reverse"})=>{const u=GX(t);return u?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:l,refX:"0",refY:"0",children:m.jsx(u,{color:n,strokeWidth:c})}):null},U9=({defaultColor:e,rfId:t})=>{const n=kt(a=>a.edges),r=kt(a=>a.defaultEdgeOptions),s=P.useMemo(()=>$W(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:s.map(a=>m.jsx(VX,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};U9.displayName="MarkerDefinitions";var WX=P.memo(U9);function q9({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:l=2,children:u,className:h,...p}){const[f,g]=P.useState({x:1,y:0,width:0,height:0}),y=Nn(["react-flow__edge-textwrapper",h]),C=P.useRef(null);return P.useEffect(()=>{if(C.current){const w=C.current.getBBox();g({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:y,visibility:f.width?"visible":"hidden",...p,children:[s&&m.jsx("rect",{width:f.width+2*c[0],x:-c[0],y:-c[1],height:f.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:l,ry:l}),m.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:C,style:r,children:n}),u]}):null}q9.displayName="EdgeText";const YX=P.memo(q9);function Wd({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:h=20,...p}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...p,d:e,fill:"none",className:Nn(["react-flow__edge-path",p.className])}),h?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,r&&ci(t)&&ci(n)?m.jsx(YX,{x:t,y:n,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function ox({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===We.Left||e===We.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function G9({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:a=We.Top}){const[c,l]=ox({pos:n,x1:e,y1:t,x2:r,y2:s}),[u,h]=ox({pos:a,x1:r,y1:s,x2:e,y2:t}),[p,f,g,y]=p9({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:h});return[`M${e},${t} C${c},${l} ${u},${h} ${r},${s}`,p,f,g,y]}function V9(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,sourcePosition:c,targetPosition:l,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:_,interactionWidth:b})=>{const[x,S,E]=G9({sourceX:n,sourceY:r,sourcePosition:c,targetX:s,targetY:a,targetPosition:l}),T=e.isInternal?void 0:t;return m.jsx(Wd,{id:T,path:x,labelX:S,labelY:E,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:_,interactionWidth:b})})}const XX=V9({isInternal:!1}),W9=V9({isInternal:!0});XX.displayName="SimpleBezierEdge";W9.displayName="SimpleBezierEdgeInternal";function Y9(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,sourcePosition:y=We.Bottom,targetPosition:C=We.Top,markerEnd:w,markerStart:_,pathOptions:b,interactionWidth:x})=>{const[S,E,T]=_g({sourceX:n,sourceY:r,sourcePosition:y,targetX:s,targetY:a,targetPosition:C,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),A=e.isInternal?void 0:t;return m.jsx(Wd,{id:A,path:S,labelX:E,labelY:T,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:w,markerStart:_,interactionWidth:x})})}const X9=Y9({isInternal:!1}),K9=Y9({isInternal:!0});X9.displayName="SmoothStepEdge";K9.displayName="SmoothStepEdgeInternal";function Z9(e){return P.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return m.jsx(X9,{...n,id:r,pathOptions:P.useMemo(()=>{var a;return{borderRadius:0,offset:(a=n.pathOptions)==null?void 0:a.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const KX=Z9({isInternal:!1}),Q9=Z9({isInternal:!0});KX.displayName="StepEdge";Q9.displayName="StepEdgeInternal";function J9(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:y,markerStart:C,interactionWidth:w})=>{const[_,b,x]=v9({sourceX:n,sourceY:r,targetX:s,targetY:a}),S=e.isInternal?void 0:t;return m.jsx(Wd,{id:S,path:_,labelX:b,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:y,markerStart:C,interactionWidth:w})})}const ZX=J9({isInternal:!1}),eC=J9({isInternal:!0});ZX.displayName="StraightEdge";eC.displayName="StraightEdgeInternal";function tC(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,sourcePosition:c=We.Bottom,targetPosition:l=We.Top,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:_,pathOptions:b,interactionWidth:x})=>{const[S,E,T]=m9({sourceX:n,sourceY:r,sourcePosition:c,targetX:s,targetY:a,targetPosition:l,curvature:b==null?void 0:b.curvature}),A=e.isInternal?void 0:t;return m.jsx(Wd,{id:A,path:S,labelX:E,labelY:T,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:_,interactionWidth:x})})}const QX=tC({isInternal:!1}),nC=tC({isInternal:!0});QX.displayName="BezierEdge";nC.displayName="BezierEdgeInternal";const lx={default:nC,straight:eC,step:Q9,smoothstep:K9,simplebezier:W9},cx={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},JX=(e,t,n)=>n===We.Left?e-t:n===We.Right?e+t:e,eK=(e,t,n)=>n===We.Top?e-t:n===We.Bottom?e+t:e,ux="react-flow__edgeupdater";function hx({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:a,onMouseOut:c,type:l}){return m.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:c,className:Nn([ux,`${ux}-${l}`]),cx:JX(t,r,e),cy:eK(n,r,e),r,stroke:"transparent",fill:"transparent"})}function tK({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:a,targetY:c,sourcePosition:l,targetPosition:u,onReconnect:h,onReconnectStart:p,onReconnectEnd:f,setReconnecting:g,setUpdateHover:y}){const C=on(),w=(E,T)=>{if(E.button!==0)return;const{autoPanOnConnect:A,domNode:D,connectionMode:M,connectionRadius:R,lib:z,onConnectStart:H,cancelConnection:q,nodeLookup:$,rfId:U,panBy:K,updateConnection:Y}=C.getState(),Q=T.type==="target",ee=(O,W)=>{g(!1),f==null||f(O,n,T.type,W)},B=O=>h==null?void 0:h(n,O),L=(O,W)=>{g(!0),p==null||p(E,n,T.type),H==null||H(O,W)};wg.onPointerDown(E.nativeEvent,{autoPanOnConnect:A,connectionMode:M,connectionRadius:R,domNode:D,handleId:T.id,nodeId:T.nodeId,nodeLookup:$,isTarget:Q,edgeUpdaterType:T.type,lib:z,flowId:U,cancelConnection:q,panBy:K,isValidConnection:(...O)=>{var W,G;return((G=(W=C.getState()).isValidConnection)==null?void 0:G.call(W,...O))??!0},onConnect:B,onConnectStart:L,onConnectEnd:(...O)=>{var W,G;return(G=(W=C.getState()).onConnectEnd)==null?void 0:G.call(W,...O)},onReconnectEnd:ee,updateConnection:Y,getTransform:()=>C.getState().transform,getFromHandle:()=>C.getState().connection.fromHandle,dragThreshold:C.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},_=E=>w(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),b=E=>w(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>y(!0),S=()=>y(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(hx,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:_,onMouseEnter:x,onMouseOut:S,type:"source"}),(e===!0||e==="target")&&m.jsx(hx,{position:u,centerX:a,centerY:c,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:S,type:"target"})]})}function nK({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:a,onContextMenu:c,onMouseEnter:l,onMouseMove:u,onMouseLeave:h,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:y,rfId:C,edgeTypes:w,noPanClassName:_,onError:b,disableKeyboardA11y:x}){let S=kt(he=>he.edgeLookup.get(e));const E=kt(he=>he.defaultEdgeOptions);S=E?{...E,...S}:S;let T=S.type||"default",A=(w==null?void 0:w[T])||lx[T];A===void 0&&(b==null||b("011",fi.error011(T)),T="default",A=(w==null?void 0:w.default)||lx.default);const D=!!(S.focusable||t&&typeof S.focusable>"u"),M=typeof f<"u"&&(S.reconnectable||n&&typeof S.reconnectable>"u"),R=!!(S.selectable||r&&typeof S.selectable>"u"),z=P.useRef(null),[H,q]=P.useState(!1),[$,U]=P.useState(!1),K=on(),{zIndex:Y=S.zIndex,sourceX:Q,sourceY:ee,targetX:B,targetY:L,sourcePosition:O,targetPosition:W}=kt(P.useCallback(he=>{const Se=he.nodeLookup.get(S.source),Te=he.nodeLookup.get(S.target);if(!Se||!Te)return cx;const Re=PW({id:e,sourceNode:Se,targetNode:Te,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:he.connectionMode,onError:b}),He=jW({selected:S.selected,zIndex:S.zIndex,sourceNode:Se,targetNode:Te,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...Re||cx,zIndex:He}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),sn),G=P.useMemo(()=>S.markerStart?`url('#${xg(S.markerStart,C)}')`:void 0,[S.markerStart,C]),ie=P.useMemo(()=>S.markerEnd?`url('#${xg(S.markerEnd,C)}')`:void 0,[S.markerEnd,C]);if(S.hidden||Q===null||ee===null||B===null||L===null)return null;const fe=he=>{var He;const{addSelectedEdges:Se,unselectNodesAndEdges:Te,multiSelectionActive:Re}=K.getState();R&&(K.setState({nodesSelectionActive:!1}),S.selected&&Re?(Te({nodes:[],edges:[S]}),(He=z.current)==null||He.blur()):Se([e])),s&&s(he,S)},pe=a?he=>{a(he,{...S})}:void 0,te=c?he=>{c(he,{...S})}:void 0,V=l?he=>{l(he,{...S})}:void 0,ae=u?he=>{u(he,{...S})}:void 0,oe=h?he=>{h(he,{...S})}:void 0,be=he=>{var Se;if(!x&&Jw.includes(he.key)&&R){const{unselectNodesAndEdges:Te,addSelectedEdges:Re}=K.getState();he.key==="Escape"?((Se=z.current)==null||Se.blur(),Te({edges:[S]})):Re([e])}};return m.jsx("svg",{style:{zIndex:Y},children:m.jsxs("g",{className:Nn(["react-flow__edge",`react-flow__edge-${T}`,S.className,_,{selected:S.selected,animated:S.animated,inactive:!R&&!s,updating:H,selectable:R}]),onClick:fe,onDoubleClick:pe,onContextMenu:te,onMouseEnter:V,onMouseMove:ae,onMouseLeave:oe,onKeyDown:D?be:void 0,tabIndex:D?0:void 0,role:S.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":S.ariaLabel===null?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":D?`${R9}-${C}`:void 0,ref:z,...S.domAttributes,children:[!$&&m.jsx(A,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:R,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:Q,sourceY:ee,targetX:B,targetY:L,sourcePosition:O,targetPosition:W,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:G,markerEnd:ie,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),M&&m.jsx(tK,{edge:S,isReconnectable:M,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:y,sourceX:Q,sourceY:ee,targetX:B,targetY:L,sourcePosition:O,targetPosition:W,setUpdateHover:q,setReconnecting:U})]})})}var rK=P.memo(nK);const iK=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function rC({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:C,disableKeyboardA11y:w}){const{edgesFocusable:_,edgesReconnectable:b,elementsSelectable:x,onError:S}=kt(iK,sn),E=$X(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(WX,{defaultColor:e,rfId:n}),E.map(T=>m.jsx(rK,{id:T,edgesFocusable:_,edgesReconnectable:b,elementsSelectable:x,noPanClassName:s,onReconnect:a,onContextMenu:c,onMouseEnter:l,onMouseMove:u,onMouseLeave:h,onClick:p,reconnectRadius:f,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:C,rfId:n,onError:S,edgeTypes:r,disableKeyboardA11y:w},T))]})}rC.displayName="EdgeRenderer";const sK=P.memo(rC),aK=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function oK({children:e}){const t=kt(aK);return m.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function lK(e){const t=S2(),n=P.useRef(!1);P.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const cK=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function uK(e){const t=kt(cK),n=on();return P.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function hK(e){return e.connection.inProgress?{...e.connection,to:mu(e.connection.to,e.transform)}:{...e.connection}}function dK(e){return hK}function fK(e){const t=dK();return kt(t,sn)}const pK=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function mK({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:a,height:c,isValid:l,inProgress:u}=kt(pK,sn);return!(a&&s&&u)?null:m.jsx("svg",{style:e,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Nn(["react-flow__connection",n9(l)]),children:m.jsx(iC,{style:t,type:n,CustomComponent:r,isValid:l})})})}const iC=({style:e,type:t=Us.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:a,fromNode:c,fromHandle:l,fromPosition:u,to:h,toNode:p,toHandle:f,toPosition:g,pointer:y}=fK();if(!s)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:l,fromX:a.x,fromY:a.y,toX:h.x,toY:h.y,fromPosition:u,toPosition:g,connectionStatus:n9(r),toNode:p,toHandle:f,pointer:y});let C="";const w={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:h.x,targetY:h.y,targetPosition:g};switch(t){case Us.Bezier:[C]=m9(w);break;case Us.SimpleBezier:[C]=G9(w);break;case Us.Step:[C]=_g({...w,borderRadius:0});break;case Us.SmoothStep:[C]=_g(w);break;default:[C]=v9(w)}return m.jsx("path",{d:C,fill:"none",className:"react-flow__connection-path",style:e})};iC.displayName="ConnectionLine";const gK={};function dx(e=gK){P.useRef(e),on(),P.useEffect(()=>{},[e])}function vK(){on(),P.useRef(!1),P.useEffect(()=>{},[])}function sC({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:y,connectionLineType:C,connectionLineStyle:w,connectionLineComponent:_,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:S,selectionMode:E,multiSelectionKeyCode:T,panActivationKeyCode:A,zoomActivationKeyCode:D,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:z,defaultViewport:H,translateExtent:q,minZoom:$,maxZoom:U,preventScrolling:K,defaultMarkerColor:Y,zoomOnScroll:Q,zoomOnPinch:ee,panOnScroll:B,panOnScrollSpeed:L,panOnScrollMode:O,zoomOnDoubleClick:W,panOnDrag:G,autoPanOnSelection:ie,onPaneClick:fe,onPaneMouseEnter:pe,onPaneMouseMove:te,onPaneMouseLeave:V,onPaneScroll:ae,onPaneContextMenu:oe,paneClickDistance:be,nodeClickDistance:he,onEdgeContextMenu:Se,onEdgeMouseEnter:Te,onEdgeMouseMove:Re,onEdgeMouseLeave:He,reconnectRadius:ze,onReconnect:zt,onReconnectStart:At,onReconnectEnd:Tt,noDragClassName:Gt,noWheelClassName:tn,noPanClassName:mt,disableKeyboardA11y:ct,nodeExtent:xt,rfId:_e,viewport:Ne,onViewportChange:Pe}){return dx(e),dx(t),vK(),lK(n),uK(Ne),m.jsx(RX,{onPaneClick:fe,onPaneMouseEnter:pe,onPaneMouseMove:te,onPaneMouseLeave:V,onPaneContextMenu:oe,onPaneScroll:ae,paneClickDistance:be,deleteKeyCode:M,selectionKeyCode:x,selectionOnDrag:S,selectionMode:E,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:T,panActivationKeyCode:A,zoomActivationKeyCode:D,elementsSelectable:z,zoomOnScroll:Q,zoomOnPinch:ee,zoomOnDoubleClick:W,panOnScroll:B,panOnScrollSpeed:L,panOnScrollMode:O,panOnDrag:G,autoPanOnSelection:ie,defaultViewport:H,translateExtent:q,minZoom:$,maxZoom:U,onSelectionContextMenu:f,preventScrolling:K,noDragClassName:Gt,noWheelClassName:tn,noPanClassName:mt,disableKeyboardA11y:ct,onViewportChange:Pe,isControlledViewport:!!Ne,children:m.jsxs(oK,{children:[m.jsx(sK,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:c,onReconnect:zt,onReconnectStart:At,onReconnectEnd:Tt,onlyRenderVisibleElements:R,onEdgeContextMenu:Se,onEdgeMouseEnter:Te,onEdgeMouseMove:Re,onEdgeMouseLeave:He,reconnectRadius:ze,defaultMarkerColor:Y,noPanClassName:mt,disableKeyboardA11y:ct,rfId:_e}),m.jsx(mK,{style:w,type:C,component:_,containerStyle:b}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(PX,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:he,onlyRenderVisibleElements:R,noPanClassName:mt,noDragClassName:Gt,disableKeyboardA11y:ct,nodeExtent:xt,rfId:_e}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}sC.displayName="GraphView";const yK=P.memo(sC),bK=l9(),fx=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:c,fitViewOptions:l,minZoom:u=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:f,zIndexMode:g="basic"}={})=>{const y=new Map,C=new Map,w=new Map,_=new Map,b=r??t??[],x=n??e??[],S=p??[0,0],E=f??Vc;_9(w,_,b);const{nodesInitialized:T}=Sg(x,y,C,{nodeOrigin:S,nodeExtent:E,zIndexMode:g});let A=[0,0,1];if(c&&s&&a){const D=fu(y,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:M,y:R,zoom:z}=m2(D,s,a,u,h,(l==null?void 0:l.padding)??.1);A=[M,R,z]}return{rfId:"1",width:s??0,height:a??0,transform:A,nodes:x,nodesInitialized:T,nodeLookup:y,parentLookup:C,edges:b,edgeLookup:_,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:h,translateExtent:Vc,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:sl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:S,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:c??!1,fitViewOptions:l,fitViewResolver:null,connection:{...t9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:bK,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:e9,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},_K=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:c,fitViewOptions:l,minZoom:u,maxZoom:h,nodeOrigin:p,nodeExtent:f,zIndexMode:g})=>MY((y,C)=>{async function w(){const{nodeLookup:_,panZoom:b,fitViewOptions:x,fitViewResolver:S,width:E,height:T,minZoom:A,maxZoom:D}=C();b&&(await kW({nodes:_,width:E,height:T,panZoom:b,minZoom:A,maxZoom:D},x),S==null||S.resolve(!0),y({fitViewResolver:null}))}return{...fx({nodes:e,edges:t,width:s,height:a,fitView:c,fitViewOptions:l,minZoom:u,maxZoom:h,nodeOrigin:p,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:_=>{const{nodeLookup:b,parentLookup:x,nodeOrigin:S,elevateNodesOnSelect:E,fitViewQueued:T,zIndexMode:A,nodesSelectionActive:D}=C(),{nodesInitialized:M,hasSelectedNodes:R}=Sg(_,b,x,{nodeOrigin:S,nodeExtent:f,elevateNodesOnSelect:E,checkEquality:!0,zIndexMode:A}),z=D&&R;T&&M?(w(),y({nodes:_,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:z})):y({nodes:_,nodesInitialized:M,nodesSelectionActive:z})},setEdges:_=>{const{connectionLookup:b,edgeLookup:x}=C();_9(b,x,_),y({edges:_})},setDefaultNodesAndEdges:(_,b)=>{if(_){const{setNodes:x}=C();x(_),y({hasDefaultNodes:!0})}if(b){const{setEdges:x}=C();x(b),y({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:b,nodeLookup:x,parentLookup:S,domNode:E,nodeOrigin:T,nodeExtent:A,debug:D,fitViewQueued:M,zIndexMode:R}=C(),{changes:z,updatedInternals:H}=XW(_,x,S,E,T,A,R);H&&(GW(x,S,{nodeOrigin:T,nodeExtent:A,zIndexMode:R}),M?(w(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(z==null?void 0:z.length)>0&&(D&&console.log("React Flow: trigger node changes",z),b==null||b(z)))},updateNodePositions:(_,b=!1)=>{const x=[];let S=[];const{nodeLookup:E,triggerNodeChanges:T,connection:A,updateConnection:D,onNodesChangeMiddlewareMap:M}=C();for(const[R,z]of _){const H=E.get(R),q=!!(H!=null&&H.expandParent&&(H!=null&&H.parentId)&&(z!=null&&z.position)),$={id:R,type:"position",position:q?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:b};if(H&&A.inProgress&&A.fromNode.id===H.id){const U=Fa(H,A.fromHandle,We.Left,!0);D({...A,from:U})}q&&H.parentId&&x.push({id:R,parentId:H.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),S.push($)}if(x.length>0){const{parentLookup:R,nodeOrigin:z}=C(),H=x2(x,E,R,z);S.push(...H)}for(const R of M.values())S=R(S);T(S)},triggerNodeChanges:_=>{const{onNodesChange:b,setNodes:x,nodes:S,hasDefaultNodes:E,debug:T}=C();if(_!=null&&_.length){if(E){const A=ZY(_,S);x(A)}T&&console.log("React Flow: trigger node changes",_),b==null||b(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:b,setEdges:x,edges:S,hasDefaultEdges:E,debug:T}=C();if(_!=null&&_.length){if(E){const A=QY(_,S);x(A)}T&&console.log("React Flow: trigger edge changes",_),b==null||b(_)}},addSelectedNodes:_=>{const{multiSelectionActive:b,edgeLookup:x,nodeLookup:S,triggerNodeChanges:E,triggerEdgeChanges:T}=C();if(b){const A=_.map(D=>Ta(D,!0));E(A);return}E(Vo(S,new Set([..._]),!0)),T(Vo(x))},addSelectedEdges:_=>{const{multiSelectionActive:b,edgeLookup:x,nodeLookup:S,triggerNodeChanges:E,triggerEdgeChanges:T}=C();if(b){const A=_.map(D=>Ta(D,!0));T(A);return}T(Vo(x,new Set([..._]))),E(Vo(S,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:b}={})=>{const{edges:x,nodes:S,nodeLookup:E,triggerNodeChanges:T,triggerEdgeChanges:A}=C(),D=_||S,M=b||x,R=[];for(const H of D){if(!H.selected)continue;const q=E.get(H.id);q&&(q.selected=!1),R.push(Ta(H.id,!1))}const z=[];for(const H of M)H.selected&&z.push(Ta(H.id,!1));T(R),A(z)},setMinZoom:_=>{const{panZoom:b,maxZoom:x}=C();b==null||b.setScaleExtent([_,x]),y({minZoom:_})},setMaxZoom:_=>{const{panZoom:b,minZoom:x}=C();b==null||b.setScaleExtent([x,_]),y({maxZoom:_})},setTranslateExtent:_=>{var b;(b=C().panZoom)==null||b.setTranslateExtent(_),y({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:b,triggerNodeChanges:x,triggerEdgeChanges:S,elementsSelectable:E}=C();if(!E)return;const T=b.reduce((D,M)=>M.selected?[...D,Ta(M.id,!1)]:D,[]),A=_.reduce((D,M)=>M.selected?[...D,Ta(M.id,!1)]:D,[]);x(T),S(A)},setNodeExtent:_=>{const{nodes:b,nodeLookup:x,parentLookup:S,nodeOrigin:E,elevateNodesOnSelect:T,nodeExtent:A,zIndexMode:D}=C();_[0][0]===A[0][0]&&_[0][1]===A[0][1]&&_[1][0]===A[1][0]&&_[1][1]===A[1][1]||(Sg(b,x,S,{nodeOrigin:E,nodeExtent:_,elevateNodesOnSelect:T,checkEquality:!1,zIndexMode:D}),y({nodeExtent:_}))},panBy:_=>{const{transform:b,width:x,height:S,panZoom:E,translateExtent:T}=C();return KW({delta:_,panZoom:E,transform:b,translateExtent:T,width:x,height:S})},setCenter:async(_,b,x)=>{const{width:S,height:E,maxZoom:T,panZoom:A}=C();if(!A)return!1;const D=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:T;return await A.setViewport({x:S/2-_*D,y:E/2-b*D,zoom:D},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{y({connection:{...t9}})},updateConnection:_=>{y({connection:_})},reset:()=>y({...fx()})}},Object.is);function xK({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:a,initialMinZoom:c,initialMaxZoom:l,initialFitViewOptions:u,fitView:h,nodeOrigin:p,nodeExtent:f,zIndexMode:g,children:y}){const[C]=P.useState(()=>_K({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:h,minZoom:c,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:f,zIndexMode:g}));return m.jsx(DY,{value:C,children:m.jsx(iX,{children:m.jsx(bX,{children:y})})})}function SK({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:a,height:c,fitView:l,fitViewOptions:u,minZoom:h,maxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:y}){return P.useContext(qd)?m.jsx(m.Fragment,{children:e}):m.jsx(xK,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:a,initialHeight:c,fitView:l,initialFitViewOptions:u,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:y,children:e})}const wK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function CK({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:a,edgeTypes:c,onNodeClick:l,onEdgeClick:u,onInit:h,onMove:p,onMoveStart:f,onMoveEnd:g,onConnect:y,onConnectStart:C,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:S,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:A,onNodeDragStart:D,onNodeDrag:M,onNodeDragStop:R,onNodesDelete:z,onEdgesDelete:H,onDelete:q,onSelectionChange:$,onSelectionDragStart:U,onSelectionDrag:K,onSelectionDragStop:Y,onSelectionContextMenu:Q,onSelectionStart:ee,onSelectionEnd:B,onBeforeDelete:L,connectionMode:O,connectionLineType:W=Us.Bezier,connectionLineStyle:G,connectionLineComponent:ie,connectionLineContainerStyle:fe,deleteKeyCode:pe="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:V=!1,selectionMode:ae=Wc.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:be=Xc()?"Meta":"Control",zoomActivationKeyCode:he=Xc()?"Meta":"Control",snapToGrid:Se,snapGrid:Te,onlyRenderVisibleElements:Re=!1,selectNodesOnDrag:He,nodesDraggable:ze,autoPanOnNodeFocus:zt,nodesConnectable:At,nodesFocusable:Tt,nodeOrigin:Gt=j9,edgesFocusable:tn,edgesReconnectable:mt,elementsSelectable:ct=!0,defaultViewport:xt=qY,minZoom:_e=.5,maxZoom:Ne=2,translateExtent:Pe=Vc,preventScrolling:Qe=!0,nodeExtent:Ye,defaultMarkerColor:Rt="#b1b1b7",zoomOnScroll:lt=!0,zoomOnPinch:Pt=!0,panOnScroll:ft=!1,panOnScrollSpeed:pn=.5,panOnScrollMode:St=La.Free,zoomOnDoubleClick:Kn=!0,panOnDrag:On=!0,onPaneClick:Fn,onPaneMouseEnter:Zt,onPaneMouseMove:bn,onPaneMouseLeave:Pn,onPaneScroll:Zn,onPaneContextMenu:Jr,paneClickDistance:It=1,nodeClickDistance:ji=0,children:Mn,onReconnect:sr,onReconnectStart:Dn,onReconnectEnd:ye,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ke,onEdgeMouseEnter:rt,onEdgeMouseMove:Nt,onEdgeMouseLeave:mn,reconnectRadius:Qn=10,onNodesChange:Hr,onEdgesChange:ar,noDragClassName:gn="nodrag",noWheelClassName:Bn="nowheel",noPanClassName:ei="nopan",fitView:Fr,fitViewOptions:na,connectOnClick:Xa,attributionPosition:ra,proOptions:gi,defaultEdgeOptions:ds,elevateNodesOnSelect:ti=!0,elevateEdgesOnSelect:ni=!1,disableKeyboardA11y:ue=!1,autoPanOnConnect:ke,autoPanOnNodeDrag:De,autoPanOnSelection:Fe=!0,autoPanSpeed:Je,connectionRadius:Vt,isValidConnection:zn,onError:_n,style:or,id:fs,nodeDragThreshold:yl,connectionDragThreshold:Ka,viewport:Za,onViewportChange:ri,width:lr,height:gu,colorMode:Yd="light",debug:bl,onScroll:ia,ariaLabelConfig:Qa,zIndexMode:vu="basic",...cr},_l){const Ja=fs||"1",xl=YY(Yd),ps=P.useCallback(Sl=>{Sl.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ia==null||ia(Sl)},[ia]);return m.jsx("div",{"data-testid":"rf__wrapper",...cr,onScroll:ps,style:{...or,...wK},ref:_l,className:Nn(["react-flow",s,xl]),id:fs,role:"application",children:m.jsxs(SK,{nodes:e,edges:t,width:lr,height:gu,fitView:Fr,fitViewOptions:na,minZoom:_e,maxZoom:Ne,nodeOrigin:Gt,nodeExtent:Ye,zIndexMode:vu,children:[m.jsx(WY,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:C,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:b,nodesDraggable:ze,autoPanOnNodeFocus:zt,nodesConnectable:At,nodesFocusable:Tt,edgesFocusable:tn,edgesReconnectable:mt,elementsSelectable:ct,elevateNodesOnSelect:ti,elevateEdgesOnSelect:ni,minZoom:_e,maxZoom:Ne,nodeExtent:Ye,onNodesChange:Hr,onEdgesChange:ar,snapToGrid:Se,snapGrid:Te,connectionMode:O,translateExtent:Pe,connectOnClick:Xa,defaultEdgeOptions:ds,fitView:Fr,fitViewOptions:na,onNodesDelete:z,onEdgesDelete:H,onDelete:q,onNodeDragStart:D,onNodeDrag:M,onNodeDragStop:R,onSelectionDrag:K,onSelectionDragStart:U,onSelectionDragStop:Y,onMove:p,onMoveStart:f,onMoveEnd:g,noPanClassName:ei,nodeOrigin:Gt,rfId:Ja,autoPanOnConnect:ke,autoPanOnNodeDrag:De,autoPanSpeed:Je,onError:_n,connectionRadius:Vt,isValidConnection:zn,selectNodesOnDrag:He,nodeDragThreshold:yl,connectionDragThreshold:Ka,onBeforeDelete:L,debug:bl,ariaLabelConfig:Qa,zIndexMode:vu}),m.jsx(yK,{onInit:h,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:x,onNodeMouseMove:S,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:A,nodeTypes:a,edgeTypes:c,connectionLineType:W,connectionLineStyle:G,connectionLineComponent:ie,connectionLineContainerStyle:fe,selectionKeyCode:te,selectionOnDrag:V,selectionMode:ae,deleteKeyCode:pe,multiSelectionKeyCode:be,panActivationKeyCode:oe,zoomActivationKeyCode:he,onlyRenderVisibleElements:Re,defaultViewport:xt,translateExtent:Pe,minZoom:_e,maxZoom:Ne,preventScrolling:Qe,zoomOnScroll:lt,zoomOnPinch:Pt,zoomOnDoubleClick:Kn,panOnScroll:ft,panOnScrollSpeed:pn,panOnScrollMode:St,panOnDrag:On,autoPanOnSelection:Fe,onPaneClick:Fn,onPaneMouseEnter:Zt,onPaneMouseMove:bn,onPaneMouseLeave:Pn,onPaneScroll:Zn,onPaneContextMenu:Jr,paneClickDistance:It,nodeClickDistance:ji,onSelectionContextMenu:Q,onSelectionStart:ee,onSelectionEnd:B,onReconnect:sr,onReconnectStart:Dn,onReconnectEnd:ye,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ke,onEdgeMouseEnter:rt,onEdgeMouseMove:Nt,onEdgeMouseLeave:mn,reconnectRadius:Qn,defaultMarkerColor:Rt,noDragClassName:gn,noWheelClassName:Bn,noPanClassName:ei,rfId:Ja,disableKeyboardA11y:ue,nodeExtent:Ye,viewport:Za,onViewportChange:ri}),m.jsx(UY,{onSelectionChange:$}),Mn,m.jsx(IY,{proOptions:gi,position:ra}),m.jsx(zY,{rfId:Ja,disableKeyboardA11y:ue})]})})}var EK=O9(CK);function kK({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Nn(["react-flow__background-pattern",n,r])})}function AK({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Nn(["react-flow__background-pattern","dots",t])})}var ns;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ns||(ns={}));const TK={[ns.Dots]:1,[ns.Lines]:1,[ns.Cross]:6},NK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function aC({id:e,variant:t=ns.Dots,gap:n=20,size:r,lineWidth:s=1,offset:a=0,color:c,bgColor:l,style:u,className:h,patternClassName:p}){const f=P.useRef(null),{transform:g,patternId:y}=kt(NK,sn),C=r||TK[t],w=t===ns.Dots,_=t===ns.Cross,b=Array.isArray(n)?n:[n,n],x=[b[0]*g[2]||1,b[1]*g[2]||1],S=C*g[2],E=Array.isArray(a)?a:[a,a],T=_?[S,S]:x,A=[E[0]*g[2]||1+T[0]/2,E[1]*g[2]||1+T[1]/2],D=`${y}${e||""}`;return m.jsxs("svg",{className:Nn(["react-flow__background",h]),style:{...u,...Vd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":c},ref:f,"data-testid":"rf__background",children:[m.jsx("pattern",{id:D,x:g[0]%x[0],y:g[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:w?m.jsx(AK,{radius:S/2,className:p}):m.jsx(kK,{dimensions:T,lineWidth:s,variant:t,className:p})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}aC.displayName="Background";const MK=P.memo(aC);function DK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function RK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function jK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.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 LK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.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 OK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.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 nh({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Nn(["react-flow__controls-button",t]),...n,children:e})}const BK=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function oC({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:c,onFitView:l,onInteractiveChange:u,className:h,children:p,position:f="bottom-left",orientation:g="vertical","aria-label":y}){const C=on(),{isInteractive:w,minZoomReached:_,maxZoomReached:b,ariaLabelConfig:x}=kt(BK,sn),{zoomIn:S,zoomOut:E,fitView:T}=S2(),A=()=>{S(),a==null||a()},D=()=>{E(),c==null||c()},M=()=>{T(s),l==null||l()},R=()=>{C.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u==null||u(!w)},z=g==="horizontal"?"horizontal":"vertical";return m.jsxs(Gd,{className:Nn(["react-flow__controls",z,h]),position:f,style:e,"data-testid":"rf__controls","aria-label":y??x["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(nh,{onClick:A,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:b,children:m.jsx(DK,{})}),m.jsx(nh,{onClick:D,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:_,children:m.jsx(RK,{})})]}),n&&m.jsx(nh,{className:"react-flow__controls-fitview",onClick:M,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:m.jsx(jK,{})}),r&&m.jsx(nh,{className:"react-flow__controls-interactive",onClick:R,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:w?m.jsx(OK,{}):m.jsx(LK,{})}),p]})}oC.displayName="Controls";P.memo(oC);function zK({id:e,x:t,y:n,width:r,height:s,style:a,color:c,strokeColor:l,strokeWidth:u,className:h,borderRadius:p,shapeRendering:f,selected:g,onClick:y}){const{background:C,backgroundColor:w}=a||{},_=c||C||w;return m.jsx("rect",{className:Nn(["react-flow__minimap-node",{selected:g},h]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:_,stroke:l,strokeWidth:u},shapeRendering:f,onClick:y?b=>y(b,e):void 0})}const IK=P.memo(zK),HK=e=>e.nodes.map(t=>t.id),om=e=>e instanceof Function?e:()=>e;function FK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:a=IK,onClick:c}){const l=kt(HK,sn),u=om(t),h=om(e),p=om(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:l.map(g=>m.jsx($K,{id:g,nodeColorFunc:u,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:a,onClick:c,shapeRendering:f},g))})}function PK({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:l,onClick:u}){const{node:h,x:p,y:f,width:g,height:y}=kt(C=>{const w=C.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const _=w.internals.userNode,{x:b,y:x}=w.internals.positionAbsolute,{width:S,height:E}=hs(_);return{node:_,x:b,y:x,width:S,height:E}},sn);return!h||h.hidden||!c9(h)?null:m.jsx(l,{x:p,y:f,width:g,height:y,style:h.style,selected:!!h.selected,className:r(h),color:t(h),borderRadius:s,strokeColor:n(h),strokeWidth:a,shapeRendering:c,onClick:u,id:h.id})}const $K=P.memo(PK);var UK=P.memo(FK);const qK=200,GK=150,VK=e=>!e.hidden,WK=e=>{const 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?a9(fu(e.nodeLookup,{filter:VK}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},YK="react-flow__minimap-desc";function lC({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:l,bgColor:u,maskColor:h,maskStrokeColor:p,maskStrokeWidth:f,position:g="bottom-right",onClick:y,onNodeClick:C,pannable:w=!1,zoomable:_=!1,ariaLabel:b,inversePan:x,zoomStep:S=1,offsetScale:E=5}){const T=on(),A=P.useRef(null),{boundingRect:D,viewBB:M,rfId:R,panZoom:z,translateExtent:H,flowWidth:q,flowHeight:$,ariaLabelConfig:U}=kt(WK,sn),K=(e==null?void 0:e.width)??qK,Y=(e==null?void 0:e.height)??GK,Q=D.width/K,ee=D.height/Y,B=Math.max(Q,ee),L=B*K,O=B*Y,W=E*B,G=D.x-(L-D.width)/2-W,ie=D.y-(O-D.height)/2-W,fe=L+W*2,pe=O+W*2,te=`${YK}-${R}`,V=P.useRef(0),ae=P.useRef();V.current=B,P.useEffect(()=>{if(A.current&&z)return ae.current=sY({domNode:A.current,panZoom:z,getTransform:()=>T.getState().transform,getViewScale:()=>V.current}),()=>{var Se;(Se=ae.current)==null||Se.destroy()}},[z]),P.useEffect(()=>{var Se;(Se=ae.current)==null||Se.update({translateExtent:H,width:q,height:$,inversePan:x,pannable:w,zoomStep:S,zoomable:_})},[w,_,x,S,H,q,$]);const oe=y?Se=>{var He;const[Te,Re]=((He=ae.current)==null?void 0:He.pointer(Se))||[0,0];y(Se,{x:Te,y:Re})}:void 0,be=C?P.useCallback((Se,Te)=>{const Re=T.getState().nodeLookup.get(Te).internals.userNode;C(Se,Re)},[]):void 0,he=b??U["minimap.ariaLabel"];return m.jsx(Gd,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*B: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 c=="number"?c:void 0},className:Nn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:K,height:Y,viewBox:`${G} ${ie} ${fe} ${pe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":te,ref:A,onClick:oe,children:[he&&m.jsx("title",{id:te,children:he}),m.jsx(UK,{onClick:be,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:l}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-W},${ie-W}h${fe+W*2}v${pe+W*2}h${-fe-W*2}z - M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}lC.displayName="MiniMap";P.memo(lC);const XK=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,KK={[ll.Line]:"right",[ll.Handle]:"bottom-right"};function ZK({nodeId:e,position:t,variant:n=ll.Handle,className:r,style:s=void 0,children:a,color:c,minWidth:l=10,minHeight:u=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:g,autoScale:y=!0,shouldResize:C,onResizeStart:w,onResize:_,onResizeEnd:b}){const x=H9(),S=typeof e=="string"?e:x,E=on(),T=P.useRef(null),A=n===ll.Handle,D=kt(P.useCallback(XK(A&&y),[A,y]),sn),M=P.useRef(null),R=t??KK[n];P.useEffect(()=>{if(!(!T.current||!S))return M.current||(M.current=yY({domNode:T.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:H,transform:q,snapGrid:$,snapToGrid:U,nodeOrigin:K,domNode:Y}=E.getState();return{nodeLookup:H,transform:q,snapGrid:$,snapToGrid:U,nodeOrigin:K,paneDomNode:Y}},onChange:(H,q)=>{const{triggerNodeChanges:$,nodeLookup:U,parentLookup:K,nodeOrigin:Y}=E.getState(),Q=[],ee={x:H.x,y:H.y},B=U.get(S);if(B&&B.expandParent&&B.parentId){const L=B.origin??Y,O=H.width??B.measured.width??0,W=H.height??B.measured.height??0,G={id:B.id,parentId:B.parentId,rect:{width:O,height:W,...u9({x:H.x??B.position.x,y:H.y??B.position.y},{width:O,height:W},B.parentId,U,L)}},ie=x2([G],U,K,Y);Q.push(...ie),ee.x=H.x?Math.max(L[0]*O,H.x):void 0,ee.y=H.y?Math.max(L[1]*W,H.y):void 0}if(ee.x!==void 0&&ee.y!==void 0){const L={id:S,type:"position",position:{...ee}};Q.push(L)}if(H.width!==void 0&&H.height!==void 0){const O={id:S,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:H.width,height:H.height}};Q.push(O)}for(const L of q){const O={...L,type:"position"};Q.push(O)}$(Q)},onEnd:({width:H,height:q})=>{const $={id:S,type:"dimensions",resizing:!1,dimensions:{width:H,height:q}};E.getState().triggerNodeChanges([$])}})),M.current.update({controlPosition:R,boundaries:{minWidth:l,minHeight:u,maxWidth:h,maxHeight:p},keepAspectRatio:f,resizeDirection:g,onResizeStart:w,onResize:_,onResizeEnd:b,shouldResize:C}),()=>{var H;(H=M.current)==null||H.destroy()}},[R,l,u,h,p,f,w,_,b,C]);const z=R.split("-");return m.jsx("div",{className:Nn(["react-flow__resize-control","nodrag",...z,n,r]),ref:T,style:{...s,scale:D,...c&&{[A?"backgroundColor":"borderColor"]:c}},children:a})}P.memo(ZK);const lm=380,cm=12,QK=350,JK=150,Eg=new EventTarget;function eZ(){Eg.dispatchEvent(new Event("move"))}function tZ(e,t){const[n,r]=P.useState(null),s=P.useRef(void 0),a=P.useRef(void 0);P.useEffect(()=>{const h=()=>{window.clearTimeout(s.current),window.clearTimeout(a.current),r(null)};return Eg.addEventListener("move",h),()=>{Eg.removeEventListener("move",h),window.clearTimeout(s.current),window.clearTimeout(a.current)}},[]),P.useEffect(()=>{r(h=>{var f;if(!h)return h;const p=((f=e.current)==null?void 0:f.getBoundingClientRect())??null;return p&&h.x===p.x&&h.y===p.y&&h.width===p.width&&h.height===p.height?h:p})},[e,t]);const c=P.useCallback(()=>{window.clearTimeout(a.current),window.clearTimeout(s.current),s.current=window.setTimeout(()=>{var h;r(((h=e.current)==null?void 0:h.getBoundingClientRect())??null)},QK)},[e]),l=P.useCallback(()=>{window.clearTimeout(s.current),window.clearTimeout(a.current),a.current=window.setTimeout(()=>r(null),JK)},[]),u=P.useCallback(()=>window.clearTimeout(a.current),[]);return{rect:n,onMouseEnter:c,onMouseLeave:l,keepOpen:u}}function nZ(e){const t=new Date(e),n=t.getFullYear()===new Date().getFullYear()?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"};return t.toLocaleDateString(void 0,n)}function rZ({exp:e,runs:t,latestRun:n,parentSlug:r,anchor:s,onMouseEnter:a,onMouseLeave:c}){const l=xw(),u=s.right+cm+lm<=window.innerWidth,h=s.x-cm-lm>=0,p=u?"right":h?"left":s.y>window.innerHeight/2?"above":"below",{x:f,y:g}=Sw({x:s.x,y:s.y,width:s.width,height:s.height,anchor:p,distance:cm},l),[y,C]=P.useState(null),w=e.parentExperimentId&&(n!=null&&n.commitSha)?n.id:null;P.useEffect(()=>{if(C(null),!w)return;let R=!1;return tT(w).then(z=>{let H=z.diff;if(z.truncated){const K=H.lastIndexOf(` +`)),p=h.reduce((f,g)=>f.concat(...g),[]);return[h,p]}return[[],[]]},[e]);return P.useEffect(()=>{const u=(t==null?void 0:t.target)??K6,h=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=y=>{var b,_;if(s.current=y.ctrlKey||y.metaKey||y.shiftKey||y.altKey,(!s.current||s.current&&!h)&&h9(y))return!1;const w=Q6(y.code,l);if(a.current.add(y[w]),Z6(c,a.current,!1)){const x=((_=(b=y.composedPath)==null?void 0:b.call(y))==null?void 0:_[0])||y.target,S=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";t.preventDefault!==!1&&(s.current||!S)&&y.preventDefault(),r(!0)}},f=y=>{const C=Q6(y.code,l);Z6(c,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(y[C]),y.key==="Meta"&&a.current.clear(),s.current=!1},g=()=>{a.current.clear(),r(!1)};return u==null||u.addEventListener("keydown",p),u==null||u.addEventListener("keyup",f),window.addEventListener("blur",g),window.addEventListener("contextmenu",g),()=>{u==null||u.removeEventListener("keydown",p),u==null||u.removeEventListener("keyup",f),window.removeEventListener("blur",g),window.removeEventListener("contextmenu",g)}}},[e,r]),n}function Z6(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function Q6(e,t){return t.includes(e)?"code":"key"}const YY=()=>{const e=on();return P.useMemo(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):!1},zoomOut:async t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):!1},zoomTo:async(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):!1},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,a],panZoom:c}=e.getState();return c?(await c.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??a},n),!0):!1},getViewport:()=>{const[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)=>{const{width:r,height:s,minZoom:a,maxZoom:c,panZoom:l}=e.getState(),u=m2(t,r,s,a,c,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(u,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:a,domNode:c}=e.getState();if(!c)return t;const{x:l,y:u}=c.getBoundingClientRect(),h={x:t.x-l,y:t.y-u},p=n.snapGrid??s,f=n.snapToGrid??a;return mu(h,r,f,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:a}=r.getBoundingClientRect(),c=ol(t,n);return{x:c.x+s,y:c.y+a}}}),[])};function j9(e,t){const n=[],r=new Map,s=[];for(const a of e)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")r.set(a.id,[a]);else{const c=r.get(a.id);c?c.push(a):r.set(a.id,[a])}for(const a of t){const c=r.get(a.id);if(!c){n.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const l={...a};for(const u of c)XY(u,l);n.push(l)}return s.length&&s.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function XY(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(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 KY(e,t){return j9(e,t)}function ZY(e,t){return j9(e,t)}function Ta(e,t){return{id:e,type:"select",selected:t}}function Vo(e,t=new Set,n=!1){const r=[];for(const[s,a]of e){const c=t.has(s);!(a.selected===void 0&&!c)&&a.selected!==c&&(n&&(a.selected=c),r.push(Ta(a.id,c)))}return r}function J6({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(a=>[a.id,a]));for(const[a,c]of e.entries()){const l=t.get(c.id),u=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;u!==void 0&&u!==c&&n.push({id:c.id,item:c,type:"replace"}),u===void 0&&n.push({item:c,type:"add",index:a})}for(const[a]of t)r.get(a)===void 0&&n.push({id:a,type:"remove"});return n}function ex(e){return{id:e.id,type:"remove"}}const QY=o9();function JY(e,t,n={}){return BW(e,t,{...n,onError:n.onError??QY})}const tx=e=>xW(e),eX=e=>n9(e);function L9(e){return P.forwardRef(e)}const tX=typeof window<"u"?P.useLayoutEffect:P.useEffect;function nx(e){const[t,n]=P.useState(BigInt(0)),[r]=P.useState(()=>nX(()=>n(s=>s+BigInt(1))));return tX(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function nX(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const O9=P.createContext(null);function rX({children:e}){const t=on(),n=P.useCallback(l=>{const{nodes:u=[],setNodes:h,hasDefaultNodes:p,onNodesChange:f,nodeLookup:g,fitViewQueued:y,onNodesChangeMiddlewareMap:C}=t.getState();let w=u;for(const _ of l)w=typeof _=="function"?_(w):_;let b=J6({items:w,lookup:g});for(const _ of C.values())b=_(b);p&&h(w),b.length>0?f==null||f(b):y&&window.requestAnimationFrame(()=>{const{fitViewQueued:_,nodes:x,setNodes:S}=t.getState();_&&S(x)})},[]),r=nx(n),s=P.useCallback(l=>{const{edges:u=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:g}=t.getState();let y=u;for(const C of l)y=typeof C=="function"?C(y):C;p?h(y):f&&f(J6({items:y,lookup:g}))},[]),a=nx(s),c=P.useMemo(()=>({nodeQueue:r,edgeQueue:a}),[]);return m.jsx(O9.Provider,{value:c,children:e})}function iX(){const e=P.useContext(O9);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const sX=e=>!!e.panZoom;function S2(){const e=YY(),t=on(),n=iX(),r=Et(sX),s=P.useMemo(()=>{const a=f=>t.getState().nodeLookup.get(f),c=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},u=f=>{var _,x;const{nodeLookup:g,nodeOrigin:y}=t.getState(),C=tx(f)?f:g.get(f.id),w=C.parentId?c9(C.position,C.measured,C.parentId,g,y):C.position,b={...C,position:w,width:((_=C.measured)==null?void 0:_.width)??C.width,height:((x=C.measured)==null?void 0:x.height)??C.height};return Yc(b)},h=(f,g,y={replace:!1})=>{c(C=>C.map(w=>{if(w.id===f){const b=typeof g=="function"?g(w):g;return y.replace&&tx(b)?b:{...w,...b}}return w}))},p=(f,g,y={replace:!1})=>{l(C=>C.map(w=>{if(w.id===f){const b=typeof g=="function"?g(w):g;return y.replace&&eX(b)?b:{...w,...b}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var g;return(g=a(f))==null?void 0:g.internals.userNode},getInternalNode:a,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(g=>({...g}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:c,setEdges:l,addNodes:f=>{const g=Array.isArray(f)?f:[f];n.nodeQueue.push(y=>[...y,...g])},addEdges:f=>{const g=Array.isArray(f)?f:[f];n.edgeQueue.push(y=>[...y,...g])},toObject:()=>{const{nodes:f=[],edges:g=[],transform:y}=t.getState(),[C,w,b]=y;return{nodes:f.map(_=>({..._})),edges:g.map(_=>({..._})),viewport:{x:C,y:w,zoom:b}}},deleteElements:async({nodes:f=[],edges:g=[]})=>{const{nodes:y,edges:C,onNodesDelete:w,onEdgesDelete:b,triggerNodeChanges:_,triggerEdgeChanges:x,onDelete:S,onBeforeDelete:E}=t.getState(),{nodes:T,edges:A}=await kW({nodesToRemove:f,edgesToRemove:g,nodes:y,edges:C,onBeforeDelete:E}),D=A.length>0,M=T.length>0;if(D){const R=A.map(ex);b==null||b(A),x(R)}if(M){const R=T.map(ex);w==null||w(T),_(R)}return(M||D)&&(S==null||S({nodes:T,edges:A})),{deletedNodes:T,deletedEdges:A}},getIntersectingNodes:(f,g=!0,y)=>{const C=k6(f),w=C?f:u(f),b=y!==void 0;return w?(y||t.getState().nodes).filter(_=>{const x=t.getState().nodeLookup.get(_.id);if(x&&!C&&(_.id===f.id||!x.internals.positionAbsolute))return!1;const S=Yc(b?_:x),E=Wh(S,w);return g&&E>0||E>=S.width*S.height||E>=w.width*w.height}):[]},isNodeIntersecting:(f,g,y=!0)=>{const w=k6(f)?f:u(f);if(!w)return!1;const b=Wh(w,g);return y&&b>0||b>=g.width*g.height||b>=w.width*w.height},updateNode:h,updateNodeData:(f,g,y={replace:!1})=>{h(f,C=>{const w=typeof g=="function"?g(C):g;return y.replace?{...C,data:w}:{...C,data:{...C.data,...w}}},y)},updateEdge:p,updateEdgeData:(f,g,y={replace:!1})=>{p(f,C=>{const w=typeof g=="function"?g(C):g;return y.replace?{...C,data:w}:{...C,data:{...C.data,...w}}},y)},getNodesBounds:f=>{const{nodeLookup:g,nodeOrigin:y}=t.getState();return SW(f,{nodeLookup:g,nodeOrigin:y})},getHandleConnections:({type:f,id:g,nodeId:y})=>{var C;return Array.from(((C=t.getState().connectionLookup.get(`${y}-${f}${g?`-${g}`:""}`))==null?void 0:C.values())??[])},getNodeConnections:({type:f,handleId:g,nodeId:y})=>{var C;return Array.from(((C=t.getState().connectionLookup.get(`${y}${f?g?`-${f}-${g}`:`-${f}`:""}`))==null?void 0:C.values())??[])},fitView:async f=>{const g=t.getState().fitViewResolver??NW();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:g}),n.nodeQueue.push(y=>[...y]),g.promise}}},[]);return P.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const rx=e=>e.selected,aX=typeof window<"u"?window:void 0;function oX({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=on(),{deleteElements:r}=S2(),s=Kc(e,{actInsideInputWithModifier:!1}),a=Kc(t,{target:aX});P.useEffect(()=>{if(s){const{edges:c,nodes:l}=n.getState();r({nodes:l.filter(rx),edges:c.filter(rx)}),n.setState({nodesSelectionActive:!1})}},[s]),P.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function lX(e){const t=on();P.useEffect(()=>{const n=()=>{var s,a,c,l;if(!e.current||!(((a=(s=e.current).checkVisibility)==null?void 0:a.call(s))??!0))return!1;const r=g2(e.current);(r.height===0||r.width===0)&&((l=(c=t.getState()).onError)==null||l.call(c,"004",fi.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const Wd={position:"absolute",width:"100%",height:"100%",top:0,left:0},cX=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function uX({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=La.Free,zoomOnDoubleClick:c=!0,panOnDrag:l=!0,defaultViewport:u,translateExtent:h,minZoom:p,maxZoom:f,zoomActivationKeyCode:g,preventScrolling:y=!0,children:C,noWheelClassName:w,noPanClassName:b,onViewportChange:_,isControlledViewport:x,paneClickDistance:S,selectionOnDrag:E}){const T=on(),A=P.useRef(null),{userSelectionActive:D,lib:M,connectionInProgress:R}=Et(cX,sn),z=Kc(g),H=P.useRef();lX(A);const $=P.useCallback(U=>{_==null||_({x:U[0],y:U[1],zoom:U[2]}),x||T.setState({transform:U})},[_,x]);return P.useEffect(()=>{if(A.current){H.current=dY({domNode:A.current,minZoom:p,maxZoom:f,translateExtent:h,viewport:u,onDraggingChange:Y=>T.setState(Q=>Q.paneDragging===Y?Q:{paneDragging:Y}),onPanZoomStart:(Y,Q)=>{const{onViewportChangeStart:ee,onMoveStart:B}=T.getState();B==null||B(Y,Q),ee==null||ee(Q)},onPanZoom:(Y,Q)=>{const{onViewportChange:ee,onMove:B}=T.getState();B==null||B(Y,Q),ee==null||ee(Q)},onPanZoomEnd:(Y,Q)=>{const{onViewportChangeEnd:ee,onMoveEnd:B}=T.getState();B==null||B(Y,Q),ee==null||ee(Q)}});const{x:U,y:q,zoom:K}=H.current.getViewport();return T.setState({panZoom:H.current,transform:[U,q,K],domNode:A.current.closest(".react-flow")}),()=>{var Y;(Y=H.current)==null||Y.destroy()}}},[]),P.useEffect(()=>{var U;(U=H.current)==null||U.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:l,zoomActivationKeyPressed:z,preventScrolling:y,noPanClassName:b,userSelectionActive:D,noWheelClassName:w,lib:M,onTransformChange:$,connectionInProgress:R,selectionOnDrag:E,paneClickDistance:S})},[e,t,n,r,s,a,c,l,z,y,b,D,w,M,$,R,E,S]),m.jsx("div",{className:"react-flow__renderer",ref:A,style:Wd,children:C})}const hX=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function dX(){const{userSelectionActive:e,userSelectionRect:t}=Et(hX,sn);return e&&t?m.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}const om=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},fX=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function pX({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Wc.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:a,selectionOnDrag:c,onSelectionStart:l,onSelectionEnd:u,onPaneClick:h,onPaneContextMenu:p,onPaneScroll:f,onPaneMouseEnter:g,onPaneMouseMove:y,onPaneMouseLeave:C,children:w}){const b=P.useRef(0),_=on(),{userSelectionActive:x,elementsSelectable:S,dragging:E,panBy:T,autoPanSpeed:A}=Et(fX,sn),D=S&&(e||x),M=P.useRef(null),R=P.useRef(),z=P.useRef(new Set),H=P.useRef(new Set),$=P.useRef(!1),U=P.useRef(!1),q=P.useRef({x:0,y:0}),K=P.useRef(!1),Y=V=>{if(U.current||$.current||_.getState().connection.inProgress){U.current=!1,$.current=!1;return}h==null||h(V),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},Q=V=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){V.preventDefault();return}p==null||p(V)},ee=f?V=>f(V):void 0,B=V=>{U.current&&(V.stopPropagation(),U.current=!1)},L=V=>{var ze,zt;const{domNode:ae,transform:oe}=_.getState();if(R.current=ae==null?void 0:ae.getBoundingClientRect(),!R.current)return;const be=V.target===M.current;if(!be&&!!V.target.closest(".nokey")||!e||!(c&&be||t)||V.button!==0||!V.isPrimary)return;(zt=(ze=V.target)==null?void 0:ze.setPointerCapture)==null||zt.call(ze,V.pointerId),U.current=!1;const{x:Te,y:Re}=ui(V.nativeEvent,R.current),He=mu({x:Te,y:Re},oe);_.setState({userSelectionRect:{width:0,height:0,startX:He.x,startY:He.y,x:Te,y:Re}}),be||(V.stopPropagation(),V.preventDefault())};function O(V,ae){const{userSelectionRect:oe}=_.getState();if(!oe)return;const{transform:be,nodeLookup:he,edgeLookup:Se,connectionLookup:Te,triggerNodeChanges:Re,triggerEdgeChanges:He,defaultEdgeOptions:ze}=_.getState(),zt={x:oe.startX,y:oe.startY},{x:At,y:Tt}=ol(zt,be),Gt={startX:zt.x,startY:zt.y,x:Vxt.id)),H.current=new Set;const ct=(ze==null?void 0:ze.selectable)??!0;for(const xt of z.current){const _e=Te.get(xt);if(_e)for(const{edgeId:Ne}of _e.values()){const Pe=Se.get(Ne);Pe&&(Pe.selectable??ct)&&H.current.add(Ne)}}if(!A6(tn,z.current)){const xt=Vo(he,z.current,!0);Re(xt)}if(!A6(mt,H.current)){const xt=Vo(Se,H.current);He(xt)}_.setState({userSelectionRect:Gt,userSelectionActive:!0,nodesSelectionActive:!1})}function W(){if(!s||!R.current)return;const[V,ae]=p2(q.current,R.current,A);T({x:V,y:ae}).then(oe=>{if(!U.current||!oe){b.current=requestAnimationFrame(W);return}const{x:be,y:he}=q.current;O(be,he),b.current=requestAnimationFrame(W)})}const G=()=>{cancelAnimationFrame(b.current),b.current=0,K.current=!1};P.useEffect(()=>()=>G(),[]);const ie=V=>{const{userSelectionRect:ae,transform:oe,resetSelectedElements:be}=_.getState();if(!R.current||!ae)return;const{x:he,y:Se}=ui(V.nativeEvent,R.current);q.current={x:he,y:Se};const Te=ol({x:ae.startX,y:ae.startY},oe);if(!U.current){const Re=t?0:a;if(Math.hypot(he-Te.x,Se-Te.y)<=Re)return;be(),l==null||l(V)}U.current=!0,K.current||(W(),K.current=!0),O(he,Se)},fe=V=>{var ae,oe;if(!D){V.target===M.current&&_.getState().connection.inProgress&&($.current=!0);return}V.button===0&&((oe=(ae=V.target)==null?void 0:ae.releasePointerCapture)==null||oe.call(ae,V.pointerId),!x&&V.target===M.current&&_.getState().userSelectionRect&&(Y==null||Y(V)),_.setState({userSelectionActive:!1,userSelectionRect:null}),U.current&&(u==null||u(V),_.setState({nodesSelectionActive:z.current.size>0})),G())},pe=V=>{var ae,oe;(oe=(ae=V.target)==null?void 0:ae.releasePointerCapture)==null||oe.call(ae,V.pointerId),G()},te=r===!0||Array.isArray(r)&&r.includes(0);return m.jsxs("div",{className:Nn(["react-flow__pane",{draggable:te,dragging:E,selection:e}]),onClick:D?void 0:om(Y,M),onContextMenu:om(Q,M),onWheel:om(ee,M),onPointerEnter:D?void 0:g,onPointerMove:D?ie:y,onPointerUp:fe,onPointerCancel:D?pe:void 0,onPointerDownCapture:D?L:void 0,onClickCapture:D?B:void 0,onPointerLeave:C,ref:M,style:Wd,children:[w,m.jsx(dX,{})]})}function Eg({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:l,onError:u}=t.getState(),h=l.get(e);if(!h){u==null||u("012",fi.error012(e));return}t.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&c)&&(a({nodes:[h],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function B9({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:a,nodeClickDistance:c}){const l=on(),[u,h]=P.useState(!1),p=P.useRef();return P.useEffect(()=>{p.current=QW({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Eg({id:f,store:l,nodeRef:e})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),P.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:s,nodeClickDistance:c}),()=>{var f;(f=p.current)==null||f.destroy()}},[n,r,t,a,e,s,c]),u}const mX=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function z9(){const e=on();return P.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:a,nodesDraggable:c,onError:l,updateNodePositions:u,nodeLookup:h,nodeOrigin:p}=e.getState(),f=new Map,g=mX(c),y=s?a[0]:5,C=s?a[1]:5,w=n.direction.x*y*n.factor,b=n.direction.y*C*n.factor;for(const[,_]of h){if(!g(_))continue;let x={x:_.internals.positionAbsolute.x+w,y:_.internals.positionAbsolute.y+b};s&&(x=pu(x,a));const{position:S,positionAbsolute:E}=r9({nodeId:_.id,nextPosition:x,nodeLookup:h,nodeExtent:r,nodeOrigin:p,onError:l});_.position=S,_.internals.positionAbsolute=E,f.set(_.id,_)}u(f)},[])}const w2=P.createContext(null),gX=w2.Provider;w2.Consumer;const I9=()=>P.useContext(w2),vX=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),H9=P.createContext(null);function yX({children:e}){const t=Et(vX,sn);return m.jsx(H9.Provider,{value:t,children:e})}function bX(){const e=P.useContext(H9);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}const _X={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},xX=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:a,connection:c}=r,{fromHandle:l,toHandle:u,isValid:h}=c;if(!l&&!s)return _X;const p=(u==null?void 0:u.nodeId)===e&&(u==null?void 0:u.id)===t&&(u==null?void 0:u.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:a===sl.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&h}};function SX({type:e="source",position:t=We.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:c,onConnect:l,children:u,className:h,onMouseDown:p,onTouchStart:f,...g},y){var K,Y;const C=c||null,w=e==="target",b=on(),_=I9(),{connectOnClick:x,noPanClassName:S,rfId:E}=bX(),{connectingFrom:T,connectingTo:A,clickConnecting:D,isPossibleEndHandle:M,connectionInProcess:R,clickConnectionInProcess:z,valid:H}=Et(xX(_,C,e),sn);_||(Y=(K=b.getState()).onError)==null||Y.call(K,"010",fi.error010());const $=Q=>{const{defaultEdgeOptions:ee,onConnect:B,hasDefaultEdges:L}=b.getState(),O={...ee,...Q};if(L){const{edges:W,setEdges:G,onError:ie}=b.getState();G(JY(O,W,{onError:ie}))}B==null||B(O),l==null||l(O)},U=Q=>{if(!_)return;const ee=d9(Q.nativeEvent);if(s&&(ee&&Q.button===0||!ee)){const B=b.getState();Cg.onPointerDown(Q.nativeEvent,{handleDomNode:Q.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:w,handleId:C,nodeId:_,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(...L)=>{var O,W;return(W=(O=b.getState()).onConnectEnd)==null?void 0:W.call(O,...L)},updateConnection:B.updateConnection,onConnect:$,isValidConnection:n||((...L)=>{var O,W;return((W=(O=b.getState()).isValidConnection)==null?void 0:W.call(O,...L))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}ee?p==null||p(Q):f==null||f(Q)},q=Q=>{const{onClickConnectStart:ee,onClickConnectEnd:B,connectionClickStartHandle:L,connectionMode:O,isValidConnection:W,lib:G,rfId:ie,nodeLookup:fe,connection:pe}=b.getState();if(!_||!L&&!s)return;if(!L){ee==null||ee(Q.nativeEvent,{nodeId:_,handleId:C,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:_,type:e,id:C}});return}const te=u9(Q.target),V=n||W,{connection:ae,isValid:oe}=Cg.isValid(Q.nativeEvent,{handle:{nodeId:_,id:C,type:e},connectionMode:O,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:V,flowId:ie,doc:te,lib:G,nodeLookup:fe});oe&&ae&&$(ae);const be=structuredClone(pe);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,B==null||B(Q,be),b.setState({connectionClickStartHandle:null})};return m.jsx("div",{"data-handleid":C,"data-nodeid":_,"data-handlepos":t,"data-id":`${E}-${_}-${C}-${e}`,className:Nn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",S,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:a,clickconnecting:D,connectingfrom:T,connectingto:A,valid:H,connectionindicator:r&&(!R||M)&&(R||z?a:s)}]),onMouseDown:U,onTouchStart:U,onClick:x?q:void 0,ref:y,...g,children:u})}const Qs=P.memo(L9(SX));function wX({data:e,isConnectable:t,sourcePosition:n=We.Bottom}){return m.jsxs(m.Fragment,{children:[e==null?void 0:e.label,m.jsx(Qs,{type:"source",position:n,isConnectable:t})]})}function CX({data:e,isConnectable:t,targetPosition:n=We.Top,sourcePosition:r=We.Bottom}){return m.jsxs(m.Fragment,{children:[m.jsx(Qs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,m.jsx(Qs,{type:"source",position:r,isConnectable:t})]})}function EX(){return null}function kX({data:e,isConnectable:t,targetPosition:n=We.Top}){return m.jsxs(m.Fragment,{children:[m.jsx(Qs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Yh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ix={input:wX,default:CX,output:kX,group:EX};function AX(e){var t,n,r,s;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((s=e.style)==null?void 0:s.height)}}const TX=e=>{const{width:t,height:n,x:r,y:s}=fu(e.nodeLookup,{filter:a=>!!a.selected});return{width:ci(t)?t:null,height:ci(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function NX({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=on(),{width:s,height:a,transformString:c,userSelectionActive:l}=Et(TX,sn),u=z9(),h=P.useRef(null);P.useEffect(()=>{var y;n||(y=h.current)==null||y.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&a!==null;if(B9({nodeRef:h,disabled:!p}),!p)return null;const f=e?y=>{const C=r.getState().nodes.filter(w=>w.selected);e(y,C)}:void 0,g=y=>{Object.prototype.hasOwnProperty.call(Yh,y.key)&&(y.preventDefault(),u({direction:Yh[y.key],factor:y.shiftKey?4:1}))};return m.jsx("div",{className:Nn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:c},children:m.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:g,style:{width:s,height:a}})})}const sx=typeof window<"u"?window:void 0,MX=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function F9({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:l,deleteKeyCode:u,selectionKeyCode:h,selectionOnDrag:p,selectionMode:f,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:C,panActivationKeyCode:w,zoomActivationKeyCode:b,elementsSelectable:_,zoomOnScroll:x,zoomOnPinch:S,panOnScroll:E,panOnScrollSpeed:T,panOnScrollMode:A,zoomOnDoubleClick:D,panOnDrag:M,autoPanOnSelection:R,defaultViewport:z,translateExtent:H,minZoom:$,maxZoom:U,preventScrolling:q,onSelectionContextMenu:K,noWheelClassName:Y,noPanClassName:Q,disableKeyboardA11y:ee,onViewportChange:B,isControlledViewport:L}){const{nodesSelectionActive:O,userSelectionActive:W}=Et(MX,sn),G=Kc(h,{target:sx}),ie=Kc(w,{target:sx}),fe=ie||M,pe=ie||E,te=p&&fe!==!0,V=G||W||te;return oX({deleteKeyCode:u,multiSelectionKeyCode:C}),m.jsx(uX,{onPaneContextMenu:a,elementsSelectable:_,zoomOnScroll:x,zoomOnPinch:S,panOnScroll:pe,panOnScrollSpeed:T,panOnScrollMode:A,zoomOnDoubleClick:D,panOnDrag:!G&&fe,defaultViewport:z,translateExtent:H,minZoom:$,maxZoom:U,zoomActivationKeyCode:b,preventScrolling:q,noWheelClassName:Y,noPanClassName:Q,onViewportChange:B,isControlledViewport:L,paneClickDistance:l,selectionOnDrag:te,children:m.jsxs(pX,{onSelectionStart:g,onSelectionEnd:y,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:fe,autoPanOnSelection:R,isSelecting:!!V,selectionMode:f,selectionKeyPressed:G,paneClickDistance:l,selectionOnDrag:te,children:[e,O&&m.jsx(NX,{onSelectionContextMenu:K,noPanClassName:Q,disableKeyboardA11y:ee})]})})}F9.displayName="FlowRenderer";const DX=P.memo(F9),RX=e=>t=>e?f2(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function jX(e){return Et(P.useCallback(RX(e),[e]),sn)}const LX=e=>e.updateNodeInternals;function OX(){const e=Et(LX),[t]=P.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const a=s.target.getAttribute("data-id");r.set(a,{id:a,nodeElement:s.target,force:!0})}),e(r)}));return P.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function BX({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=on(),a=P.useRef(null),c=P.useRef(null),l=P.useRef(e.sourcePosition),u=P.useRef(e.targetPosition),h=P.useRef(t),p=n&&!!e.internals.handleBounds;return P.useEffect(()=>{a.current&&!e.hidden&&(!p||c.current!==a.current)&&(c.current&&(r==null||r.unobserve(c.current)),r==null||r.observe(a.current),c.current=a.current)},[p,e.hidden]),P.useEffect(()=>()=>{c.current&&(r==null||r.unobserve(c.current),c.current=null)},[]),P.useEffect(()=>{if(a.current){const f=h.current!==t,g=l.current!==e.sourcePosition,y=u.current!==e.targetPosition;(f||g||y)&&(h.current=t,l.current=e.sourcePosition,u.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),a}function zX({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:a,onDoubleClick:c,nodesDraggable:l,elementsSelectable:u,nodesConnectable:h,nodesFocusable:p,resizeObserver:f,noDragClassName:g,noPanClassName:y,disableKeyboardA11y:C,rfId:w,nodeTypes:b,nodeClickDistance:_,onError:x}){const{node:S,internals:E,isParent:T}=Et(V=>{const ae=V.nodeLookup.get(e),oe=V.parentLookup.has(e);return{node:ae,internals:ae.internals,isParent:oe}},sn);let A=S.type||"default",D=(b==null?void 0:b[A])||ix[A];D===void 0&&(x==null||x("003",fi.error003(A)),A="default",D=(b==null?void 0:b.default)||ix.default);const M=!!(S.draggable||l&&typeof S.draggable>"u"),R=!!(S.selectable||u&&typeof S.selectable>"u"),z=!!(S.connectable||h&&typeof S.connectable>"u"),H=!!(S.focusable||p&&typeof S.focusable>"u"),$=on(),U=l9(S),q=BX({node:S,nodeType:A,hasDimensions:U,resizeObserver:f}),K=B9({nodeRef:q,disabled:S.hidden||!M,noDragClassName:g,handleSelector:S.dragHandle,nodeId:e,isSelectable:R,nodeClickDistance:_}),Y=z9();if(S.hidden)return null;const Q=hs(S),ee=AX(S),B=R||M||t||n||r||s,L=n?V=>n(V,{...E.userNode}):void 0,O=r?V=>r(V,{...E.userNode}):void 0,W=s?V=>s(V,{...E.userNode}):void 0,G=a?V=>a(V,{...E.userNode}):void 0,ie=c?V=>c(V,{...E.userNode}):void 0,fe=V=>{const{selectNodesOnDrag:ae,nodeDragThreshold:oe}=$.getState();R&&(!ae||!M||oe>0)&&Eg({id:e,store:$,nodeRef:q}),t&&t(V,{...E.userNode})},pe=V=>{if(!(h9(V.nativeEvent)||C)){if(Qw.includes(V.key)&&R){const ae=V.key==="Escape";Eg({id:e,store:$,unselect:ae,nodeRef:q})}else if(M&&S.selected&&Object.prototype.hasOwnProperty.call(Yh,V.key)){V.preventDefault();const{ariaLabelConfig:ae}=$.getState();$.setState({ariaLiveMessage:ae["node.a11yDescription.ariaLiveMessage"]({direction:V.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),Y({direction:Yh[V.key],factor:V.shiftKey?4:1})}}},te=()=>{var Te;if(C||!((Te=q.current)!=null&&Te.matches(":focus-visible")))return;const{transform:V,width:ae,height:oe,autoPanOnNodeFocus:be,setCenter:he}=$.getState();if(!be)return;f2(new Map([[e,S]]),{x:0,y:0,width:ae,height:oe},V,!0).length>0||he(S.position.x+Q.width/2,S.position.y+Q.height/2,{zoom:V[2]})};return m.jsx("div",{className:Nn(["react-flow__node",`react-flow__node-${A}`,{[y]:M},S.className,{selected:S.selected,selectable:R,parent:T,draggable:M,dragging:K}]),ref:q,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:U?"visible":"hidden",...S.style,...ee},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:O,onMouseLeave:W,onContextMenu:G,onClick:fe,onDoubleClick:ie,onKeyDown:H?pe:void 0,tabIndex:H?0:void 0,onFocus:H?te:void 0,role:S.ariaRole??(H?"group":void 0),"aria-roledescription":"node","aria-describedby":C?void 0:`${M9}-${w}`,"aria-label":S.ariaLabel,...S.domAttributes,children:m.jsx(gX,{value:e,children:m.jsx(D,{id:e,data:S.data,type:A,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:S.selected??!1,selectable:R,draggable:M,deletable:S.deletable??!0,isConnectable:z,sourcePosition:S.sourcePosition,targetPosition:S.targetPosition,dragging:K,dragHandle:S.dragHandle,zIndex:E.z,parentId:S.parentId,...Q})})})}var IX=P.memo(zX);const HX=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function P9(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:a}=Et(HX,sn),c=jX(e.onlyRenderVisibleElements),l=OX();return m.jsx("div",{className:"react-flow__nodes",style:Wd,children:c.map(u=>m.jsx(IX,{id:u,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:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:a},u))})}P9.displayName="NodeRenderer";const FX=P.memo(P9);function PX(e){return Et(P.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const a=n.nodeLookup.get(s.source),c=n.nodeLookup.get(s.target);a&&c&&jW({sourceNode:a,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),sn)}const $X=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return m.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},UX=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return m.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},ax={[Gh.Arrow]:$X,[Gh.ArrowClosed]:UX};function qX(e){const t=on();return P.useMemo(()=>{var s,a;return Object.prototype.hasOwnProperty.call(ax,e)?ax[e]:((a=(s=t.getState()).onError)==null||a.call(s,"009",fi.error009(e)),null)},[e])}const GX=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:l="auto-start-reverse"})=>{const u=qX(t);return u?m.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:l,refX:"0",refY:"0",children:m.jsx(u,{color:n,strokeWidth:c})}):null},$9=({defaultColor:e,rfId:t})=>{const n=Et(a=>a.edges),r=Et(a=>a.defaultEdgeOptions),s=P.useMemo(()=>PW(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?m.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:m.jsx("defs",{children:s.map(a=>m.jsx(GX,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};$9.displayName="MarkerDefinitions";var VX=P.memo($9);function U9({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:l=2,children:u,className:h,...p}){const[f,g]=P.useState({x:1,y:0,width:0,height:0}),y=Nn(["react-flow__edge-textwrapper",h]),C=P.useRef(null);return P.useEffect(()=>{if(C.current){const w=C.current.getBBox();g({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?m.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:y,visibility:f.width?"visible":"hidden",...p,children:[s&&m.jsx("rect",{width:f.width+2*c[0],x:-c[0],y:-c[1],height:f.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:l,ry:l}),m.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:C,style:r,children:n}),u]}):null}U9.displayName="EdgeText";const WX=P.memo(U9);function Yd({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u,interactionWidth:h=20,...p}){return m.jsxs(m.Fragment,{children:[m.jsx("path",{...p,d:e,fill:"none",className:Nn(["react-flow__edge-path",p.className])}),h?m.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,r&&ci(t)&&ci(n)?m.jsx(WX,{x:t,y:n,label:r,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:u}):null]})}function ox({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===We.Left||e===We.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function q9({sourceX:e,sourceY:t,sourcePosition:n=We.Bottom,targetX:r,targetY:s,targetPosition:a=We.Top}){const[c,l]=ox({pos:n,x1:e,y1:t,x2:r,y2:s}),[u,h]=ox({pos:a,x1:r,y1:s,x2:e,y2:t}),[p,f,g,y]=f9({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:c,sourceControlY:l,targetControlX:u,targetControlY:h});return[`M${e},${t} C${c},${l} ${u},${h} ${r},${s}`,p,f,g,y]}function G9(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,sourcePosition:c,targetPosition:l,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:b,interactionWidth:_})=>{const[x,S,E]=q9({sourceX:n,sourceY:r,sourcePosition:c,targetX:s,targetY:a,targetPosition:l}),T=e.isInternal?void 0:t;return m.jsx(Yd,{id:T,path:x,labelX:S,labelY:E,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:b,interactionWidth:_})})}const YX=G9({isInternal:!1}),V9=G9({isInternal:!0});YX.displayName="SimpleBezierEdge";V9.displayName="SimpleBezierEdgeInternal";function W9(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,sourcePosition:y=We.Bottom,targetPosition:C=We.Top,markerEnd:w,markerStart:b,pathOptions:_,interactionWidth:x})=>{const[S,E,T]=xg({sourceX:n,sourceY:r,sourcePosition:y,targetX:s,targetY:a,targetPosition:C,borderRadius:_==null?void 0:_.borderRadius,offset:_==null?void 0:_.offset,stepPosition:_==null?void 0:_.stepPosition}),A=e.isInternal?void 0:t;return m.jsx(Yd,{id:A,path:S,labelX:E,labelY:T,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:w,markerStart:b,interactionWidth:x})})}const Y9=W9({isInternal:!1}),X9=W9({isInternal:!0});Y9.displayName="SmoothStepEdge";X9.displayName="SmoothStepEdgeInternal";function K9(e){return P.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return m.jsx(Y9,{...n,id:r,pathOptions:P.useMemo(()=>{var a;return{borderRadius:0,offset:(a=n.pathOptions)==null?void 0:a.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const XX=K9({isInternal:!1}),Z9=K9({isInternal:!0});XX.displayName="StepEdge";Z9.displayName="StepEdgeInternal";function Q9(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:y,markerStart:C,interactionWidth:w})=>{const[b,_,x]=g9({sourceX:n,sourceY:r,targetX:s,targetY:a}),S=e.isInternal?void 0:t;return m.jsx(Yd,{id:S,path:b,labelX:_,labelY:x,label:c,labelStyle:l,labelShowBg:u,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:f,style:g,markerEnd:y,markerStart:C,interactionWidth:w})})}const KX=Q9({isInternal:!1}),J9=Q9({isInternal:!0});KX.displayName="StraightEdge";J9.displayName="StraightEdgeInternal";function eC(e){return P.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:a,sourcePosition:c=We.Bottom,targetPosition:l=We.Top,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:b,pathOptions:_,interactionWidth:x})=>{const[S,E,T]=p9({sourceX:n,sourceY:r,sourcePosition:c,targetX:s,targetY:a,targetPosition:l,curvature:_==null?void 0:_.curvature}),A=e.isInternal?void 0:t;return m.jsx(Yd,{id:A,path:S,labelX:E,labelY:T,label:u,labelStyle:h,labelShowBg:p,labelBgStyle:f,labelBgPadding:g,labelBgBorderRadius:y,style:C,markerEnd:w,markerStart:b,interactionWidth:x})})}const ZX=eC({isInternal:!1}),tC=eC({isInternal:!0});ZX.displayName="BezierEdge";tC.displayName="BezierEdgeInternal";const lx={default:tC,straight:J9,step:Z9,smoothstep:X9,simplebezier:V9},cx={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},QX=(e,t,n)=>n===We.Left?e-t:n===We.Right?e+t:e,JX=(e,t,n)=>n===We.Top?e-t:n===We.Bottom?e+t:e,ux="react-flow__edgeupdater";function hx({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:a,onMouseOut:c,type:l}){return m.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:c,className:Nn([ux,`${ux}-${l}`]),cx:QX(t,r,e),cy:JX(n,r,e),r,stroke:"transparent",fill:"transparent"})}function eK({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:a,targetY:c,sourcePosition:l,targetPosition:u,onReconnect:h,onReconnectStart:p,onReconnectEnd:f,setReconnecting:g,setUpdateHover:y}){const C=on(),w=(E,T)=>{if(E.button!==0)return;const{autoPanOnConnect:A,domNode:D,connectionMode:M,connectionRadius:R,lib:z,onConnectStart:H,cancelConnection:$,nodeLookup:U,rfId:q,panBy:K,updateConnection:Y}=C.getState(),Q=T.type==="target",ee=(O,W)=>{g(!1),f==null||f(O,n,T.type,W)},B=O=>h==null?void 0:h(n,O),L=(O,W)=>{g(!0),p==null||p(E,n,T.type),H==null||H(O,W)};Cg.onPointerDown(E.nativeEvent,{autoPanOnConnect:A,connectionMode:M,connectionRadius:R,domNode:D,handleId:T.id,nodeId:T.nodeId,nodeLookup:U,isTarget:Q,edgeUpdaterType:T.type,lib:z,flowId:q,cancelConnection:$,panBy:K,isValidConnection:(...O)=>{var W,G;return((G=(W=C.getState()).isValidConnection)==null?void 0:G.call(W,...O))??!0},onConnect:B,onConnectStart:L,onConnectEnd:(...O)=>{var W,G;return(G=(W=C.getState()).onConnectEnd)==null?void 0:G.call(W,...O)},onReconnectEnd:ee,updateConnection:Y,getTransform:()=>C.getState().transform,getFromHandle:()=>C.getState().connection.fromHandle,dragThreshold:C.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},b=E=>w(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),_=E=>w(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>y(!0),S=()=>y(!1);return m.jsxs(m.Fragment,{children:[(e===!0||e==="source")&&m.jsx(hx,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:b,onMouseEnter:x,onMouseOut:S,type:"source"}),(e===!0||e==="target")&&m.jsx(hx,{position:u,centerX:a,centerY:c,radius:t,onMouseDown:_,onMouseEnter:x,onMouseOut:S,type:"target"})]})}function tK({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:a,onContextMenu:c,onMouseEnter:l,onMouseMove:u,onMouseLeave:h,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:y,rfId:C,edgeTypes:w,noPanClassName:b,onError:_,disableKeyboardA11y:x}){let S=Et(he=>he.edgeLookup.get(e));const E=Et(he=>he.defaultEdgeOptions);S=E?{...E,...S}:S;let T=S.type||"default",A=(w==null?void 0:w[T])||lx[T];A===void 0&&(_==null||_("011",fi.error011(T)),T="default",A=(w==null?void 0:w.default)||lx.default);const D=!!(S.focusable||t&&typeof S.focusable>"u"),M=typeof f<"u"&&(S.reconnectable||n&&typeof S.reconnectable>"u"),R=!!(S.selectable||r&&typeof S.selectable>"u"),z=P.useRef(null),[H,$]=P.useState(!1),[U,q]=P.useState(!1),K=on(),{zIndex:Y=S.zIndex,sourceX:Q,sourceY:ee,targetX:B,targetY:L,sourcePosition:O,targetPosition:W}=Et(P.useCallback(he=>{const Se=he.nodeLookup.get(S.source),Te=he.nodeLookup.get(S.target);if(!Se||!Te)return cx;const Re=FW({id:e,sourceNode:Se,targetNode:Te,sourceHandle:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:he.connectionMode,onError:_}),He=RW({selected:S.selected,zIndex:S.zIndex,sourceNode:Se,targetNode:Te,elevateOnSelect:he.elevateEdgesOnSelect,zIndexMode:he.zIndexMode});return{...Re||cx,zIndex:He}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),sn),G=P.useMemo(()=>S.markerStart?`url('#${Sg(S.markerStart,C)}')`:void 0,[S.markerStart,C]),ie=P.useMemo(()=>S.markerEnd?`url('#${Sg(S.markerEnd,C)}')`:void 0,[S.markerEnd,C]);if(S.hidden||Q===null||ee===null||B===null||L===null)return null;const fe=he=>{var He;const{addSelectedEdges:Se,unselectNodesAndEdges:Te,multiSelectionActive:Re}=K.getState();R&&(K.setState({nodesSelectionActive:!1}),S.selected&&Re?(Te({nodes:[],edges:[S]}),(He=z.current)==null||He.blur()):Se([e])),s&&s(he,S)},pe=a?he=>{a(he,{...S})}:void 0,te=c?he=>{c(he,{...S})}:void 0,V=l?he=>{l(he,{...S})}:void 0,ae=u?he=>{u(he,{...S})}:void 0,oe=h?he=>{h(he,{...S})}:void 0,be=he=>{var Se;if(!x&&Qw.includes(he.key)&&R){const{unselectNodesAndEdges:Te,addSelectedEdges:Re}=K.getState();he.key==="Escape"?((Se=z.current)==null||Se.blur(),Te({edges:[S]})):Re([e])}};return m.jsx("svg",{style:{zIndex:Y},children:m.jsxs("g",{className:Nn(["react-flow__edge",`react-flow__edge-${T}`,S.className,b,{selected:S.selected,animated:S.animated,inactive:!R&&!s,updating:H,selectable:R}]),onClick:fe,onDoubleClick:pe,onContextMenu:te,onMouseEnter:V,onMouseMove:ae,onMouseLeave:oe,onKeyDown:D?be:void 0,tabIndex:D?0:void 0,role:S.ariaRole??(D?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":S.ariaLabel===null?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":D?`${D9}-${C}`:void 0,ref:z,...S.domAttributes,children:[!U&&m.jsx(A,{id:e,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:R,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:Q,sourceY:ee,targetX:B,targetY:L,sourcePosition:O,targetPosition:W,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:G,markerEnd:ie,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),M&&m.jsx(eK,{edge:S,isReconnectable:M,reconnectRadius:p,onReconnect:f,onReconnectStart:g,onReconnectEnd:y,sourceX:Q,sourceY:ee,targetX:B,targetY:L,sourcePosition:O,targetPosition:W,setUpdateHover:$,setReconnecting:q})]})})}var nK=P.memo(tK);const rK=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function nC({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:g,onReconnectStart:y,onReconnectEnd:C,disableKeyboardA11y:w}){const{edgesFocusable:b,edgesReconnectable:_,elementsSelectable:x,onError:S}=Et(rK,sn),E=PX(t);return m.jsxs("div",{className:"react-flow__edges",children:[m.jsx(VX,{defaultColor:e,rfId:n}),E.map(T=>m.jsx(nK,{id:T,edgesFocusable:b,edgesReconnectable:_,elementsSelectable:x,noPanClassName:s,onReconnect:a,onContextMenu:c,onMouseEnter:l,onMouseMove:u,onMouseLeave:h,onClick:p,reconnectRadius:f,onDoubleClick:g,onReconnectStart:y,onReconnectEnd:C,rfId:n,onError:S,edgeTypes:r,disableKeyboardA11y:w},T))]})}nC.displayName="EdgeRenderer";const iK=P.memo(nC),sK=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function aK({children:e}){const t=Et(sK);return m.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function oK(e){const t=S2(),n=P.useRef(!1);P.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const lK=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function cK(e){const t=Et(lK),n=on();return P.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function uK(e){return e.connection.inProgress?{...e.connection,to:mu(e.connection.to,e.transform)}:{...e.connection}}function hK(e){return uK}function dK(e){const t=hK();return Et(t,sn)}const fK=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function pK({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:a,height:c,isValid:l,inProgress:u}=Et(fK,sn);return!(a&&s&&u)?null:m.jsx("svg",{style:e,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:m.jsx("g",{className:Nn(["react-flow__connection",t9(l)]),children:m.jsx(rC,{style:t,type:n,CustomComponent:r,isValid:l})})})}const rC=({style:e,type:t=Us.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:a,fromNode:c,fromHandle:l,fromPosition:u,to:h,toNode:p,toHandle:f,toPosition:g,pointer:y}=dK();if(!s)return;if(n)return m.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:c,fromHandle:l,fromX:a.x,fromY:a.y,toX:h.x,toY:h.y,fromPosition:u,toPosition:g,connectionStatus:t9(r),toNode:p,toHandle:f,pointer:y});let C="";const w={sourceX:a.x,sourceY:a.y,sourcePosition:u,targetX:h.x,targetY:h.y,targetPosition:g};switch(t){case Us.Bezier:[C]=p9(w);break;case Us.SimpleBezier:[C]=q9(w);break;case Us.Step:[C]=xg({...w,borderRadius:0});break;case Us.SmoothStep:[C]=xg(w);break;default:[C]=g9(w)}return m.jsx("path",{d:C,fill:"none",className:"react-flow__connection-path",style:e})};rC.displayName="ConnectionLine";const mK={};function dx(e=mK){P.useRef(e),on(),P.useEffect(()=>{},[e])}function gK(){on(),P.useRef(!1),P.useEffect(()=>{},[])}function iC({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:g,onSelectionEnd:y,connectionLineType:C,connectionLineStyle:w,connectionLineComponent:b,connectionLineContainerStyle:_,selectionKeyCode:x,selectionOnDrag:S,selectionMode:E,multiSelectionKeyCode:T,panActivationKeyCode:A,zoomActivationKeyCode:D,deleteKeyCode:M,onlyRenderVisibleElements:R,elementsSelectable:z,defaultViewport:H,translateExtent:$,minZoom:U,maxZoom:q,preventScrolling:K,defaultMarkerColor:Y,zoomOnScroll:Q,zoomOnPinch:ee,panOnScroll:B,panOnScrollSpeed:L,panOnScrollMode:O,zoomOnDoubleClick:W,panOnDrag:G,autoPanOnSelection:ie,onPaneClick:fe,onPaneMouseEnter:pe,onPaneMouseMove:te,onPaneMouseLeave:V,onPaneScroll:ae,onPaneContextMenu:oe,paneClickDistance:be,nodeClickDistance:he,onEdgeContextMenu:Se,onEdgeMouseEnter:Te,onEdgeMouseMove:Re,onEdgeMouseLeave:He,reconnectRadius:ze,onReconnect:zt,onReconnectStart:At,onReconnectEnd:Tt,noDragClassName:Gt,noWheelClassName:tn,noPanClassName:mt,disableKeyboardA11y:ct,nodeExtent:xt,rfId:_e,viewport:Ne,onViewportChange:Pe}){return dx(e),dx(t),gK(),oK(n),cK(Ne),m.jsx(DX,{onPaneClick:fe,onPaneMouseEnter:pe,onPaneMouseMove:te,onPaneMouseLeave:V,onPaneContextMenu:oe,onPaneScroll:ae,paneClickDistance:be,deleteKeyCode:M,selectionKeyCode:x,selectionOnDrag:S,selectionMode:E,onSelectionStart:g,onSelectionEnd:y,multiSelectionKeyCode:T,panActivationKeyCode:A,zoomActivationKeyCode:D,elementsSelectable:z,zoomOnScroll:Q,zoomOnPinch:ee,zoomOnDoubleClick:W,panOnScroll:B,panOnScrollSpeed:L,panOnScrollMode:O,panOnDrag:G,autoPanOnSelection:ie,defaultViewport:H,translateExtent:$,minZoom:U,maxZoom:q,onSelectionContextMenu:f,preventScrolling:K,noDragClassName:Gt,noWheelClassName:tn,noPanClassName:mt,disableKeyboardA11y:ct,onViewportChange:Pe,isControlledViewport:!!Ne,children:m.jsxs(aK,{children:[m.jsx(iK,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:c,onReconnect:zt,onReconnectStart:At,onReconnectEnd:Tt,onlyRenderVisibleElements:R,onEdgeContextMenu:Se,onEdgeMouseEnter:Te,onEdgeMouseMove:Re,onEdgeMouseLeave:He,reconnectRadius:ze,defaultMarkerColor:Y,noPanClassName:mt,disableKeyboardA11y:ct,rfId:_e}),m.jsx(pK,{style:w,type:C,component:b,containerStyle:_}),m.jsx("div",{className:"react-flow__edgelabel-renderer"}),m.jsx(FX,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:u,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:he,onlyRenderVisibleElements:R,noPanClassName:mt,noDragClassName:Gt,disableKeyboardA11y:ct,nodeExtent:xt,rfId:_e}),m.jsx("div",{className:"react-flow__viewport-portal"})]})})}iC.displayName="GraphView";const vK=P.memo(iC),yK=o9(),fx=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:c,fitViewOptions:l,minZoom:u=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:f,zIndexMode:g="basic"}={})=>{const y=new Map,C=new Map,w=new Map,b=new Map,_=r??t??[],x=n??e??[],S=p??[0,0],E=f??Vc;b9(w,b,_);const{nodesInitialized:T}=wg(x,y,C,{nodeOrigin:S,nodeExtent:E,zIndexMode:g});let A=[0,0,1];if(c&&s&&a){const D=fu(y,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:M,y:R,zoom:z}=m2(D,s,a,u,h,(l==null?void 0:l.padding)??.1);A=[M,R,z]}return{rfId:"1",width:s??0,height:a??0,transform:A,nodes:x,nodesInitialized:T,nodeLookup:y,parentLookup:C,edges:_,edgeLookup:b,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:u,maxZoom:h,translateExtent:Vc,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:sl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:S,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:c??!1,fitViewOptions:l,fitViewResolver:null,connection:{...e9},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:yK,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Jw,zIndexMode:g,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},bK=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:c,fitViewOptions:l,minZoom:u,maxZoom:h,nodeOrigin:p,nodeExtent:f,zIndexMode:g})=>NY((y,C)=>{async function w(){const{nodeLookup:b,panZoom:_,fitViewOptions:x,fitViewResolver:S,width:E,height:T,minZoom:A,maxZoom:D}=C();_&&(await EW({nodes:b,width:E,height:T,panZoom:_,minZoom:A,maxZoom:D},x),S==null||S.resolve(!0),y({fitViewResolver:null}))}return{...fx({nodes:e,edges:t,width:s,height:a,fitView:c,fitViewOptions:l,minZoom:u,maxZoom:h,nodeOrigin:p,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:g}),setNodes:b=>{const{nodeLookup:_,parentLookup:x,nodeOrigin:S,elevateNodesOnSelect:E,fitViewQueued:T,zIndexMode:A,nodesSelectionActive:D}=C(),{nodesInitialized:M,hasSelectedNodes:R}=wg(b,_,x,{nodeOrigin:S,nodeExtent:f,elevateNodesOnSelect:E,checkEquality:!0,zIndexMode:A}),z=D&&R;T&&M?(w(),y({nodes:b,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:z})):y({nodes:b,nodesInitialized:M,nodesSelectionActive:z})},setEdges:b=>{const{connectionLookup:_,edgeLookup:x}=C();b9(_,x,b),y({edges:b})},setDefaultNodesAndEdges:(b,_)=>{if(b){const{setNodes:x}=C();x(b),y({hasDefaultNodes:!0})}if(_){const{setEdges:x}=C();x(_),y({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:_,nodeLookup:x,parentLookup:S,domNode:E,nodeOrigin:T,nodeExtent:A,debug:D,fitViewQueued:M,zIndexMode:R}=C(),{changes:z,updatedInternals:H}=YW(b,x,S,E,T,A,R);H&&(qW(x,S,{nodeOrigin:T,nodeExtent:A,zIndexMode:R}),M?(w(),y({fitViewQueued:!1,fitViewOptions:void 0})):y({}),(z==null?void 0:z.length)>0&&(D&&console.log("React Flow: trigger node changes",z),_==null||_(z)))},updateNodePositions:(b,_=!1)=>{const x=[];let S=[];const{nodeLookup:E,triggerNodeChanges:T,connection:A,updateConnection:D,onNodesChangeMiddlewareMap:M}=C();for(const[R,z]of b){const H=E.get(R),$=!!(H!=null&&H.expandParent&&(H!=null&&H.parentId)&&(z!=null&&z.position)),U={id:R,type:"position",position:$?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:_};if(H&&A.inProgress&&A.fromNode.id===H.id){const q=Fa(H,A.fromHandle,We.Left,!0);D({...A,from:q})}$&&H.parentId&&x.push({id:R,parentId:H.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),S.push(U)}if(x.length>0){const{parentLookup:R,nodeOrigin:z}=C(),H=x2(x,E,R,z);S.push(...H)}for(const R of M.values())S=R(S);T(S)},triggerNodeChanges:b=>{const{onNodesChange:_,setNodes:x,nodes:S,hasDefaultNodes:E,debug:T}=C();if(b!=null&&b.length){if(E){const A=KY(b,S);x(A)}T&&console.log("React Flow: trigger node changes",b),_==null||_(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:_,setEdges:x,edges:S,hasDefaultEdges:E,debug:T}=C();if(b!=null&&b.length){if(E){const A=ZY(b,S);x(A)}T&&console.log("React Flow: trigger edge changes",b),_==null||_(b)}},addSelectedNodes:b=>{const{multiSelectionActive:_,edgeLookup:x,nodeLookup:S,triggerNodeChanges:E,triggerEdgeChanges:T}=C();if(_){const A=b.map(D=>Ta(D,!0));E(A);return}E(Vo(S,new Set([...b]),!0)),T(Vo(x))},addSelectedEdges:b=>{const{multiSelectionActive:_,edgeLookup:x,nodeLookup:S,triggerNodeChanges:E,triggerEdgeChanges:T}=C();if(_){const A=b.map(D=>Ta(D,!0));T(A);return}T(Vo(x,new Set([...b]))),E(Vo(S,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:_}={})=>{const{edges:x,nodes:S,nodeLookup:E,triggerNodeChanges:T,triggerEdgeChanges:A}=C(),D=b||S,M=_||x,R=[];for(const H of D){if(!H.selected)continue;const $=E.get(H.id);$&&($.selected=!1),R.push(Ta(H.id,!1))}const z=[];for(const H of M)H.selected&&z.push(Ta(H.id,!1));T(R),A(z)},setMinZoom:b=>{const{panZoom:_,maxZoom:x}=C();_==null||_.setScaleExtent([b,x]),y({minZoom:b})},setMaxZoom:b=>{const{panZoom:_,minZoom:x}=C();_==null||_.setScaleExtent([x,b]),y({maxZoom:b})},setTranslateExtent:b=>{var _;(_=C().panZoom)==null||_.setTranslateExtent(b),y({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:_,triggerNodeChanges:x,triggerEdgeChanges:S,elementsSelectable:E}=C();if(!E)return;const T=_.reduce((D,M)=>M.selected?[...D,Ta(M.id,!1)]:D,[]),A=b.reduce((D,M)=>M.selected?[...D,Ta(M.id,!1)]:D,[]);x(T),S(A)},setNodeExtent:b=>{const{nodes:_,nodeLookup:x,parentLookup:S,nodeOrigin:E,elevateNodesOnSelect:T,nodeExtent:A,zIndexMode:D}=C();b[0][0]===A[0][0]&&b[0][1]===A[0][1]&&b[1][0]===A[1][0]&&b[1][1]===A[1][1]||(wg(_,x,S,{nodeOrigin:E,nodeExtent:b,elevateNodesOnSelect:T,checkEquality:!1,zIndexMode:D}),y({nodeExtent:b}))},panBy:b=>{const{transform:_,width:x,height:S,panZoom:E,translateExtent:T}=C();return XW({delta:b,panZoom:E,transform:_,translateExtent:T,width:x,height:S})},setCenter:async(b,_,x)=>{const{width:S,height:E,maxZoom:T,panZoom:A}=C();if(!A)return!1;const D=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:T;return await A.setViewport({x:S/2-b*D,y:E/2-_*D,zoom:D},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{y({connection:{...e9}})},updateConnection:b=>{y({connection:b})},reset:()=>y({...fx()})}},Object.is);function _K({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:a,initialMinZoom:c,initialMaxZoom:l,initialFitViewOptions:u,fitView:h,nodeOrigin:p,nodeExtent:f,zIndexMode:g,children:y}){const[C]=P.useState(()=>bK({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:a,fitView:h,minZoom:c,maxZoom:l,fitViewOptions:u,nodeOrigin:p,nodeExtent:f,zIndexMode:g}));return m.jsx(MY,{value:C,children:m.jsx(rX,{children:m.jsx(yX,{children:y})})})}function xK({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:a,height:c,fitView:l,fitViewOptions:u,minZoom:h,maxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:y}){return P.useContext(Gd)?m.jsx(m.Fragment,{children:e}):m.jsx(_K,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:a,initialHeight:c,fitView:l,initialFitViewOptions:u,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:f,nodeExtent:g,zIndexMode:y,children:e})}const SK={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function wK({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:a,edgeTypes:c,onNodeClick:l,onEdgeClick:u,onInit:h,onMove:p,onMoveStart:f,onMoveEnd:g,onConnect:y,onConnectStart:C,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:_,onNodeMouseEnter:x,onNodeMouseMove:S,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:A,onNodeDragStart:D,onNodeDrag:M,onNodeDragStop:R,onNodesDelete:z,onEdgesDelete:H,onDelete:$,onSelectionChange:U,onSelectionDragStart:q,onSelectionDrag:K,onSelectionDragStop:Y,onSelectionContextMenu:Q,onSelectionStart:ee,onSelectionEnd:B,onBeforeDelete:L,connectionMode:O,connectionLineType:W=Us.Bezier,connectionLineStyle:G,connectionLineComponent:ie,connectionLineContainerStyle:fe,deleteKeyCode:pe="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:V=!1,selectionMode:ae=Wc.Full,panActivationKeyCode:oe="Space",multiSelectionKeyCode:be=Xc()?"Meta":"Control",zoomActivationKeyCode:he=Xc()?"Meta":"Control",snapToGrid:Se,snapGrid:Te,onlyRenderVisibleElements:Re=!1,selectNodesOnDrag:He,nodesDraggable:ze,autoPanOnNodeFocus:zt,nodesConnectable:At,nodesFocusable:Tt,nodeOrigin:Gt=R9,edgesFocusable:tn,edgesReconnectable:mt,elementsSelectable:ct=!0,defaultViewport:xt=UY,minZoom:_e=.5,maxZoom:Ne=2,translateExtent:Pe=Vc,preventScrolling:Qe=!0,nodeExtent:Ye,defaultMarkerColor:Rt="#b1b1b7",zoomOnScroll:lt=!0,zoomOnPinch:Pt=!0,panOnScroll:ft=!1,panOnScrollSpeed:pn=.5,panOnScrollMode:St=La.Free,zoomOnDoubleClick:Kn=!0,panOnDrag:On=!0,onPaneClick:Fn,onPaneMouseEnter:Zt,onPaneMouseMove:bn,onPaneMouseLeave:Pn,onPaneScroll:Zn,onPaneContextMenu:Jr,paneClickDistance:It=1,nodeClickDistance:ji=0,children:Mn,onReconnect:sr,onReconnectStart:Dn,onReconnectEnd:ye,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ke,onEdgeMouseEnter:nt,onEdgeMouseMove:Nt,onEdgeMouseLeave:mn,reconnectRadius:Qn=10,onNodesChange:Hr,onEdgesChange:ar,noDragClassName:gn="nodrag",noWheelClassName:Bn="nowheel",noPanClassName:ei="nopan",fitView:Fr,fitViewOptions:na,connectOnClick:Xa,attributionPosition:ra,proOptions:gi,defaultEdgeOptions:ds,elevateNodesOnSelect:ti=!0,elevateEdgesOnSelect:ni=!1,disableKeyboardA11y:ue=!1,autoPanOnConnect:ke,autoPanOnNodeDrag:De,autoPanOnSelection:Fe=!0,autoPanSpeed:Je,connectionRadius:Vt,isValidConnection:zn,onError:_n,style:or,id:fs,nodeDragThreshold:yl,connectionDragThreshold:Ka,viewport:Za,onViewportChange:ri,width:lr,height:gu,colorMode:Xd="light",debug:bl,onScroll:ia,ariaLabelConfig:Qa,zIndexMode:vu="basic",...cr},_l){const Ja=fs||"1",xl=WY(Xd),ps=P.useCallback(Sl=>{Sl.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ia==null||ia(Sl)},[ia]);return m.jsx("div",{"data-testid":"rf__wrapper",...cr,onScroll:ps,style:{...or,...SK},ref:_l,className:Nn(["react-flow",s,xl]),id:fs,role:"application",children:m.jsxs(xK,{nodes:e,edges:t,width:lr,height:gu,fitView:Fr,fitViewOptions:na,minZoom:_e,maxZoom:Ne,nodeOrigin:Gt,nodeExtent:Ye,zIndexMode:vu,children:[m.jsx(VY,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:y,onConnectStart:C,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:_,nodesDraggable:ze,autoPanOnNodeFocus:zt,nodesConnectable:At,nodesFocusable:Tt,edgesFocusable:tn,edgesReconnectable:mt,elementsSelectable:ct,elevateNodesOnSelect:ti,elevateEdgesOnSelect:ni,minZoom:_e,maxZoom:Ne,nodeExtent:Ye,onNodesChange:Hr,onEdgesChange:ar,snapToGrid:Se,snapGrid:Te,connectionMode:O,translateExtent:Pe,connectOnClick:Xa,defaultEdgeOptions:ds,fitView:Fr,fitViewOptions:na,onNodesDelete:z,onEdgesDelete:H,onDelete:$,onNodeDragStart:D,onNodeDrag:M,onNodeDragStop:R,onSelectionDrag:K,onSelectionDragStart:q,onSelectionDragStop:Y,onMove:p,onMoveStart:f,onMoveEnd:g,noPanClassName:ei,nodeOrigin:Gt,rfId:Ja,autoPanOnConnect:ke,autoPanOnNodeDrag:De,autoPanSpeed:Je,onError:_n,connectionRadius:Vt,isValidConnection:zn,selectNodesOnDrag:He,nodeDragThreshold:yl,connectionDragThreshold:Ka,onBeforeDelete:L,debug:bl,ariaLabelConfig:Qa,zIndexMode:vu}),m.jsx(vK,{onInit:h,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:x,onNodeMouseMove:S,onNodeMouseLeave:E,onNodeContextMenu:T,onNodeDoubleClick:A,nodeTypes:a,edgeTypes:c,connectionLineType:W,connectionLineStyle:G,connectionLineComponent:ie,connectionLineContainerStyle:fe,selectionKeyCode:te,selectionOnDrag:V,selectionMode:ae,deleteKeyCode:pe,multiSelectionKeyCode:be,panActivationKeyCode:oe,zoomActivationKeyCode:he,onlyRenderVisibleElements:Re,defaultViewport:xt,translateExtent:Pe,minZoom:_e,maxZoom:Ne,preventScrolling:Qe,zoomOnScroll:lt,zoomOnPinch:Pt,zoomOnDoubleClick:Kn,panOnScroll:ft,panOnScrollSpeed:pn,panOnScrollMode:St,panOnDrag:On,autoPanOnSelection:Fe,onPaneClick:Fn,onPaneMouseEnter:Zt,onPaneMouseMove:bn,onPaneMouseLeave:Pn,onPaneScroll:Zn,onPaneContextMenu:Jr,paneClickDistance:It,nodeClickDistance:ji,onSelectionContextMenu:Q,onSelectionStart:ee,onSelectionEnd:B,onReconnect:sr,onReconnectStart:Dn,onReconnectEnd:ye,onEdgeContextMenu:Ie,onEdgeDoubleClick:Ke,onEdgeMouseEnter:nt,onEdgeMouseMove:Nt,onEdgeMouseLeave:mn,reconnectRadius:Qn,defaultMarkerColor:Rt,noDragClassName:gn,noWheelClassName:Bn,noPanClassName:ei,rfId:Ja,disableKeyboardA11y:ue,nodeExtent:Ye,viewport:Za,onViewportChange:ri}),m.jsx($Y,{onSelectionChange:U}),Mn,m.jsx(zY,{proOptions:gi,position:ra}),m.jsx(BY,{rfId:Ja,disableKeyboardA11y:ue})]})})}var CK=L9(wK);function EK({dimensions:e,lineWidth:t,variant:n,className:r}){return m.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Nn(["react-flow__background-pattern",n,r])})}function kK({radius:e,className:t}){return m.jsx("circle",{cx:e,cy:e,r:e,className:Nn(["react-flow__background-pattern","dots",t])})}var ns;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(ns||(ns={}));const AK={[ns.Dots]:1,[ns.Lines]:1,[ns.Cross]:6},TK=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function sC({id:e,variant:t=ns.Dots,gap:n=20,size:r,lineWidth:s=1,offset:a=0,color:c,bgColor:l,style:u,className:h,patternClassName:p}){const f=P.useRef(null),{transform:g,patternId:y}=Et(TK,sn),C=r||AK[t],w=t===ns.Dots,b=t===ns.Cross,_=Array.isArray(n)?n:[n,n],x=[_[0]*g[2]||1,_[1]*g[2]||1],S=C*g[2],E=Array.isArray(a)?a:[a,a],T=b?[S,S]:x,A=[E[0]*g[2]||1+T[0]/2,E[1]*g[2]||1+T[1]/2],D=`${y}${e||""}`;return m.jsxs("svg",{className:Nn(["react-flow__background",h]),style:{...u,...Wd,"--xy-background-color-props":l,"--xy-background-pattern-color-props":c},ref:f,"data-testid":"rf__background",children:[m.jsx("pattern",{id:D,x:g[0]%x[0],y:g[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:w?m.jsx(kK,{radius:S/2,className:p}):m.jsx(EK,{dimensions:T,lineWidth:s,variant:t,className:p})}),m.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${D})`})]})}sC.displayName="Background";const NK=P.memo(sC);function MK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:m.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function DK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:m.jsx("path",{d:"M0 0h32v4.2H0z"})})}function RK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:m.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 jK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.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 LK(){return m.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:m.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 nh({children:e,className:t,...n}){return m.jsx("button",{type:"button",className:Nn(["react-flow__controls-button",t]),...n,children:e})}const OK=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function aC({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:c,onFitView:l,onInteractiveChange:u,className:h,children:p,position:f="bottom-left",orientation:g="vertical","aria-label":y}){const C=on(),{isInteractive:w,minZoomReached:b,maxZoomReached:_,ariaLabelConfig:x}=Et(OK,sn),{zoomIn:S,zoomOut:E,fitView:T}=S2(),A=()=>{S(),a==null||a()},D=()=>{E(),c==null||c()},M=()=>{T(s),l==null||l()},R=()=>{C.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),u==null||u(!w)},z=g==="horizontal"?"horizontal":"vertical";return m.jsxs(Vd,{className:Nn(["react-flow__controls",z,h]),position:f,style:e,"data-testid":"rf__controls","aria-label":y??x["controls.ariaLabel"],children:[t&&m.jsxs(m.Fragment,{children:[m.jsx(nh,{onClick:A,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:_,children:m.jsx(MK,{})}),m.jsx(nh,{onClick:D,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:m.jsx(DK,{})})]}),n&&m.jsx(nh,{className:"react-flow__controls-fitview",onClick:M,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:m.jsx(RK,{})}),r&&m.jsx(nh,{className:"react-flow__controls-interactive",onClick:R,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:w?m.jsx(LK,{}):m.jsx(jK,{})}),p]})}aC.displayName="Controls";P.memo(aC);function BK({id:e,x:t,y:n,width:r,height:s,style:a,color:c,strokeColor:l,strokeWidth:u,className:h,borderRadius:p,shapeRendering:f,selected:g,onClick:y}){const{background:C,backgroundColor:w}=a||{},b=c||C||w;return m.jsx("rect",{className:Nn(["react-flow__minimap-node",{selected:g},h]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:b,stroke:l,strokeWidth:u},shapeRendering:f,onClick:y?_=>y(_,e):void 0})}const zK=P.memo(BK),IK=e=>e.nodes.map(t=>t.id),lm=e=>e instanceof Function?e:()=>e;function HK({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:a=zK,onClick:c}){const l=Et(IK,sn),u=lm(t),h=lm(e),p=lm(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return m.jsx(m.Fragment,{children:l.map(g=>m.jsx(PK,{id:g,nodeColorFunc:u,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:a,onClick:c,shapeRendering:f},g))})}function FK({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:l,onClick:u}){const{node:h,x:p,y:f,width:g,height:y}=Et(C=>{const w=C.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const b=w.internals.userNode,{x:_,y:x}=w.internals.positionAbsolute,{width:S,height:E}=hs(b);return{node:b,x:_,y:x,width:S,height:E}},sn);return!h||h.hidden||!l9(h)?null:m.jsx(l,{x:p,y:f,width:g,height:y,style:h.style,selected:!!h.selected,className:r(h),color:t(h),borderRadius:s,strokeColor:n(h),strokeWidth:a,shapeRendering:c,onClick:u,id:h.id})}const PK=P.memo(FK);var $K=P.memo(HK);const UK=200,qK=150,GK=e=>!e.hidden,VK=e=>{const 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?s9(fu(e.nodeLookup,{filter:GK}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},WK="react-flow__minimap-desc";function oC({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:l,bgColor:u,maskColor:h,maskStrokeColor:p,maskStrokeWidth:f,position:g="bottom-right",onClick:y,onNodeClick:C,pannable:w=!1,zoomable:b=!1,ariaLabel:_,inversePan:x,zoomStep:S=1,offsetScale:E=5}){const T=on(),A=P.useRef(null),{boundingRect:D,viewBB:M,rfId:R,panZoom:z,translateExtent:H,flowWidth:$,flowHeight:U,ariaLabelConfig:q}=Et(VK,sn),K=(e==null?void 0:e.width)??UK,Y=(e==null?void 0:e.height)??qK,Q=D.width/K,ee=D.height/Y,B=Math.max(Q,ee),L=B*K,O=B*Y,W=E*B,G=D.x-(L-D.width)/2-W,ie=D.y-(O-D.height)/2-W,fe=L+W*2,pe=O+W*2,te=`${WK}-${R}`,V=P.useRef(0),ae=P.useRef();V.current=B,P.useEffect(()=>{if(A.current&&z)return ae.current=iY({domNode:A.current,panZoom:z,getTransform:()=>T.getState().transform,getViewScale:()=>V.current}),()=>{var Se;(Se=ae.current)==null||Se.destroy()}},[z]),P.useEffect(()=>{var Se;(Se=ae.current)==null||Se.update({translateExtent:H,width:$,height:U,inversePan:x,pannable:w,zoomStep:S,zoomable:b})},[w,b,x,S,H,$,U]);const oe=y?Se=>{var He;const[Te,Re]=((He=ae.current)==null?void 0:He.pointer(Se))||[0,0];y(Se,{x:Te,y:Re})}:void 0,be=C?P.useCallback((Se,Te)=>{const Re=T.getState().nodeLookup.get(Te).internals.userNode;C(Se,Re)},[]):void 0,he=_??q["minimap.ariaLabel"];return m.jsx(Vd,{position:g,style:{...e,"--xy-minimap-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*B: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 c=="number"?c:void 0},className:Nn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:m.jsxs("svg",{width:K,height:Y,viewBox:`${G} ${ie} ${fe} ${pe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":te,ref:A,onClick:oe,children:[he&&m.jsx("title",{id:te,children:he}),m.jsx($K,{onClick:be,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:l}),m.jsx("path",{className:"react-flow__minimap-mask",d:`M${G-W},${ie-W}h${fe+W*2}v${pe+W*2}h${-fe-W*2}z + M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}oC.displayName="MiniMap";P.memo(oC);const YK=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,XK={[ll.Line]:"right",[ll.Handle]:"bottom-right"};function KK({nodeId:e,position:t,variant:n=ll.Handle,className:r,style:s=void 0,children:a,color:c,minWidth:l=10,minHeight:u=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:g,autoScale:y=!0,shouldResize:C,onResizeStart:w,onResize:b,onResizeEnd:_}){const x=I9(),S=typeof e=="string"?e:x,E=on(),T=P.useRef(null),A=n===ll.Handle,D=Et(P.useCallback(YK(A&&y),[A,y]),sn),M=P.useRef(null),R=t??XK[n];P.useEffect(()=>{if(!(!T.current||!S))return M.current||(M.current=vY({domNode:T.current,nodeId:S,getStoreItems:()=>{const{nodeLookup:H,transform:$,snapGrid:U,snapToGrid:q,nodeOrigin:K,domNode:Y}=E.getState();return{nodeLookup:H,transform:$,snapGrid:U,snapToGrid:q,nodeOrigin:K,paneDomNode:Y}},onChange:(H,$)=>{const{triggerNodeChanges:U,nodeLookup:q,parentLookup:K,nodeOrigin:Y}=E.getState(),Q=[],ee={x:H.x,y:H.y},B=q.get(S);if(B&&B.expandParent&&B.parentId){const L=B.origin??Y,O=H.width??B.measured.width??0,W=H.height??B.measured.height??0,G={id:B.id,parentId:B.parentId,rect:{width:O,height:W,...c9({x:H.x??B.position.x,y:H.y??B.position.y},{width:O,height:W},B.parentId,q,L)}},ie=x2([G],q,K,Y);Q.push(...ie),ee.x=H.x?Math.max(L[0]*O,H.x):void 0,ee.y=H.y?Math.max(L[1]*W,H.y):void 0}if(ee.x!==void 0&&ee.y!==void 0){const L={id:S,type:"position",position:{...ee}};Q.push(L)}if(H.width!==void 0&&H.height!==void 0){const O={id:S,type:"dimensions",resizing:!0,setAttributes:g?g==="horizontal"?"width":"height":!0,dimensions:{width:H.width,height:H.height}};Q.push(O)}for(const L of $){const O={...L,type:"position"};Q.push(O)}U(Q)},onEnd:({width:H,height:$})=>{const U={id:S,type:"dimensions",resizing:!1,dimensions:{width:H,height:$}};E.getState().triggerNodeChanges([U])}})),M.current.update({controlPosition:R,boundaries:{minWidth:l,minHeight:u,maxWidth:h,maxHeight:p},keepAspectRatio:f,resizeDirection:g,onResizeStart:w,onResize:b,onResizeEnd:_,shouldResize:C}),()=>{var H;(H=M.current)==null||H.destroy()}},[R,l,u,h,p,f,w,b,_,C]);const z=R.split("-");return m.jsx("div",{className:Nn(["react-flow__resize-control","nodrag",...z,n,r]),ref:T,style:{...s,scale:D,...c&&{[A?"backgroundColor":"borderColor"]:c}},children:a})}P.memo(KK);const cm=380,um=12,ZK=350,QK=150,kg=new EventTarget;function JK(){kg.dispatchEvent(new Event("move"))}function eZ(e,t){const[n,r]=P.useState(null),s=P.useRef(void 0),a=P.useRef(void 0);P.useEffect(()=>{const h=()=>{window.clearTimeout(s.current),window.clearTimeout(a.current),r(null)};return kg.addEventListener("move",h),()=>{kg.removeEventListener("move",h),window.clearTimeout(s.current),window.clearTimeout(a.current)}},[]),P.useEffect(()=>{r(h=>{var f;if(!h)return h;const p=((f=e.current)==null?void 0:f.getBoundingClientRect())??null;return p&&h.x===p.x&&h.y===p.y&&h.width===p.width&&h.height===p.height?h:p})},[e,t]);const c=P.useCallback(()=>{window.clearTimeout(a.current),window.clearTimeout(s.current),s.current=window.setTimeout(()=>{var h;r(((h=e.current)==null?void 0:h.getBoundingClientRect())??null)},ZK)},[e]),l=P.useCallback(()=>{window.clearTimeout(s.current),window.clearTimeout(a.current),a.current=window.setTimeout(()=>r(null),QK)},[]),u=P.useCallback(()=>window.clearTimeout(a.current),[]);return{rect:n,onMouseEnter:c,onMouseLeave:l,keepOpen:u}}function tZ(e){const t=new Date(e),n=t.getFullYear()===new Date().getFullYear()?{month:"short",day:"numeric"}:{month:"short",day:"numeric",year:"numeric"};return t.toLocaleDateString(void 0,n)}function nZ({exp:e,runs:t,latestRun:n,parentSlug:r,anchor:s,onMouseEnter:a,onMouseLeave:c}){const l=_w(),u=s.right+um+cm<=window.innerWidth,h=s.x-um-cm>=0,p=u?"right":h?"left":s.y>window.innerHeight/2?"above":"below",{x:f,y:g}=xw({x:s.x,y:s.y,width:s.width,height:s.height,anchor:p,distance:um},l),[y,C]=P.useState(null),w=e.parentExperimentId&&(n!=null&&n.commitSha)?n.id:null;P.useEffect(()=>{if(C(null),!w)return;let R=!1;return eT(w).then(z=>{let H=z.diff;if(z.truncated){const K=H.lastIndexOf(` diff --git `);H=K!==-1?H.slice(0,K+1):H.slice(0,H.lastIndexOf(` -`)+1)}let q=[];try{q=H.trim()?j8(H):[]}catch{return}if(z.truncated&&q.every(K=>K.hunks.length===0))return;let $=0,U=0;for(const K of q){const Y=cw(K);$+=Y.additions,U+=Y.deletions}R||C({fileCount:q.length,additions:$,deletions:U,truncated:z.truncated})}).catch(()=>{}),()=>{R=!0}},[w]);const _={done:0,failed:0,cancelled:0,live:0};for(const R of t)R.status==="done"?_.done+=1:R.status==="failed"?_.failed+=1:R.status==="cancelled"?_.cancelled+=1:_.live+=1;const b=n?dm((n.endedAt??Date.now())-n.createdAt):null,x=(n==null?void 0:n.status)==="failed"&&n.resultMarkdown?n.resultMarkdown:null,S=e.description||(x?null:n==null?void 0:n.resultMarkdown)||null,E=P.useRef(null),[T,A]=P.useState(!1),[D,M]=P.useState(!1);return P.useEffect(()=>{A(!1)},[S]),P.useEffect(()=>{const R=E.current;R&&M(R.scrollHeight>R.clientHeight+1)},[S,T]),_w.createPortal(m.jsxs("div",{ref:l.ref,className:"exp-hover-card",style:{width:lm,left:f,top:g,visibility:l.offsetHeight===0?"hidden":void 0},onMouseEnter:a,onMouseLeave:c,children:[m.jsxs("div",{className:"hc-head",children:[m.jsx("span",{className:"hc-slug",children:e.slug}),m.jsx(tl,{status:(n==null?void 0:n.status)??"idle"})]}),e.title&&m.jsx("div",{className:"hc-title",children:e.title}),S&&m.jsx("div",{className:`hc-body${T?" expanded":""}`,ref:E,children:S}),S&&(D||T)&&m.jsx("button",{type:"button",className:"hc-toggle",onClick:()=>A(R=>!R),children:T?"Show less":"Show more"}),x&&m.jsx("div",{className:"hc-failure",children:x}),m.jsxs("div",{className:"hc-stats",children:[m.jsxs("span",{children:[t.length===1?"1 run":`${t.length} runs`,_.done>0&&` · ${_.done} done`,_.failed>0&&` · ${_.failed} failed`,_.cancelled>0&&` · ${_.cancelled} cancelled`,_.live>0&&` · ${_.live} live`]}),n&&Qh(n.backend)&&m.jsx(g8,{backend:n.backend}),b&&m.jsx("span",{children:b}),n&&m.jsx("span",{children:Ua(n.createdAt)})]}),m.jsxs("div",{className:"hc-git",children:[m.jsxs("div",{className:"hc-git-row",children:[m.jsxs("span",{className:"hc-branch",title:e.branchName,children:[m.jsx(cl,{size:12}),e.branchName]}),r&&m.jsxs("span",{children:["from ",m.jsx("span",{className:"hc-mono",children:r})]})]}),y&&y.fileCount>0&&m.jsx("div",{className:"hc-git-row",title:`Committed changes vs ${r??"parent"}${y.truncated?" (diff truncated — counts are lower bounds)":""}`,children:m.jsxs("span",{children:[y.truncated&&"≥ ",m.jsxs("span",{className:"diff-stat-add",children:["+",y.additions]})," ",m.jsxs("span",{className:"diff-stat-del",children:["−",y.deletions]})," · ",y.fileCount===1&&!y.truncated?"1 file":`${y.fileCount}${y.truncated?"+":""} files`]})})]}),m.jsxs("div",{className:"hc-foot",children:[m.jsxs("span",{className:"hc-mono",children:["$ ",e.runCommand]}),m.jsxs("span",{children:["created ",nZ(e.createdAt)]})]})]}),document.body)}const iZ=264,px=132,xh=44,sZ=72,aZ=148,oZ=44;function lZ(e){const t=new Map(e.map(a=>[a.id,{exp:a,children:[]}])),n=[];for(const a of e){const c=t.get(a.id),l=a.parentExperimentId?t.get(a.parentExperimentId):void 0;l?l.children.push(c):n.push(c)}const r=(a,c)=>a.exp.createdAt-c.exp.createdAt,s=a=>{a.children.sort(r),a.children.forEach(s)};return n.sort(r),n.forEach(s),n}function cZ(e,t){const n=new Map,r=l=>{const u=n.get(l)??1+l.children.reduce((h,p)=>h+r(p),0);return n.set(l,u),u},s=new Map,a=l=>{const u=s.get(l)??(t(l)||l.children.some(a));return s.set(l,u),u};function c(l){if(t(l)){const p=[];let f=0;for(const g of l.children)a(g)?p.push(...c(g)):f+=r(g);return f>0&&p.push({kind:"elided",id:`el-${l.exp.id}`,count:f,children:[]}),[{kind:"exp",exp:l.exp,children:p}]}if(!a(l))return[];let u=0;const h=[];return(function p(f){u+=1;for(const g of f.children)t(g)?h.push(...c(g)):a(g)?p(g):u+=r(g)})(l),[{kind:"elided",id:`el-${l.exp.id}`,count:u,children:h}]}return e.flatMap(c)}function kg(e){return e.kind==="exp"?iZ:aZ}function rh(e){return e.kind==="exp"?e.exp.id:e.id}function Sh(e){if(e.children.length===0)return kg(e);const t=e.children.reduce((n,r)=>n+Sh(r),0)+xh*(e.children.length-1);return Math.max(kg(e),t)}function uZ(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const hZ=P.memo(function({data:t}){const{exp:n,latestRun:r,runs:s,isBaseline:a,parentSlug:c,githubOwner:l,githubRepo:u,onOpenView:h,onOpenCodeBranch:p}=t,f=r==null?void 0:r.status,g=f==="running"||f==="starting",y=a?"Baseline":g?"Running":"Experiment",C=s.slice(-8),w=P.useRef(null),_=tZ(w,t);return m.jsxs("div",{ref:w,className:`exp-node ${g?"live":""}`,onMouseEnter:_.onMouseEnter,onMouseLeave:_.onMouseLeave,children:[m.jsx(Qs,{type:"target",position:We.Top}),m.jsxs("div",{className:"node-eyebrow",children:[m.jsx("span",{children:y}),m.jsx(tl,{status:f??"idle"})]}),m.jsx("div",{className:"node-head",children:m.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&m.jsx("div",{className:"node-title",children:n.title||n.description}),m.jsxs("div",{className:"node-meta",children:[m.jsx("span",{children:"Runs"}),C.length>0?m.jsx("span",{className:"run-squares",children:C.map(b=>m.jsx("span",{className:`run-sq ${uZ(b.status)}`,title:b.status},b.id))}):m.jsx("span",{children:"no runs"}),m.jsx("span",{style:{flex:1}}),r&&m.jsx("span",{children:Ua(r.createdAt)})]}),m.jsxs("div",{className:"node-actions",onClick:b=>b.stopPropagation(),children:[m.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>h(n.id,"changes"),children:[m.jsx(cl,{size:13}),"Changes"]}),s.length>0&&m.jsxs("button",{className:"node-action",title:"Open logs",onClick:()=>h(n.id,"terminal"),children:[m.jsx(Tx,{size:13}),"Logs"]}),m.jsxs("button",{className:"node-action",title:`Browse code on ${n.branchName}`,onClick:()=>p(n.branchName),children:[m.jsx(Ex,{size:13}),"Code"]}),m.jsx("a",{className:"node-action node-action-ext",title:`Open ${n.branchName} on GitHub`,"aria-label":`Open ${n.branchName} on GitHub`,href:jg(l,u,n.branchName),target:"_blank",rel:"noopener noreferrer",onClick:b=>b.stopPropagation(),children:m.jsx(qv,{size:13})})]}),m.jsx(Qs,{type:"source",position:We.Bottom}),_.rect&&m.jsx(rZ,{exp:n,runs:s,latestRun:r,parentSlug:c,anchor:_.rect,onMouseEnter:_.keepOpen,onMouseLeave:_.onMouseLeave})]})}),dZ=P.memo(function({data:t}){const{count:n,onShowProjectScope:r}=t;return m.jsxs("div",{className:"elided-node",role:"button",tabIndex:0,title:"Switch to Project to see all experiments",onClick:r,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())},children:[m.jsx(Qs,{type:"target",position:We.Top}),m.jsx(xx,{size:14}),m.jsxs("span",{className:"elided-node-label",children:[n," ",n===1?"experiment":"experiments",m.jsx("span",{className:"elided-node-sub",children:"other agents"})]}),m.jsx(Qs,{type:"source",position:We.Bottom})]})}),fZ={exp:hZ,elided:dZ},cC={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}},pZ={...cC.style,strokeDasharray:"4 4"};function mZ({experiments:e,runs:t,project:n,onOpenView:r,onOpenCodeBranch:s,agentSessionId:a,onShowProjectScope:c}){const{nodes:l,edges:u}=P.useMemo(()=>{const h=new Map;for(const b of t){const x=h.get(b.experimentId);x?x.push(b):h.set(b.experimentId,[b])}for(const b of h.values())b.sort((x,S)=>x.createdAt-S.createdAt);const p=[],f=[],g=b=>!a||b.exp.chatSessionId===a,y=cZ(lZ(e),g),C=new Map(e.map(b=>[b.id,b.slug]));function w(b,x,S){const E=x-kg(b)/2;if(b.kind==="exp"){const D=h.get(b.exp.id)??[];p.push({id:b.exp.id,type:"exp",position:{x:E,y:S},data:{exp:b.exp,latestRun:D[D.length-1]??null,runs:D,isBaseline:!b.exp.parentExperimentId,parentSlug:b.exp.parentExperimentId?C.get(b.exp.parentExperimentId)??null:null,githubOwner:n.githubOwner,githubRepo:n.githubRepo,onOpenView:r,onOpenCodeBranch:s}})}else p.push({id:b.id,type:"elided",position:{x:E,y:S+(px-oZ)/2},data:{count:b.count,onShowProjectScope:c}});if(b.children.length===0)return;const T=b.children.reduce((D,M)=>D+Sh(M),0)+xh*(b.children.length-1);let A=x-T/2;for(const D of b.children){const M=Sh(D),R=b.kind==="elided"||D.kind==="elided";f.push({id:`e-${rh(b)}-${rh(D)}`,source:rh(b),target:rh(D),...R?{style:pZ}:{}}),w(D,A+M/2,S+px+sZ),A+=M+xh}}let _=0;for(const b of y){const x=Sh(b);w(b,_+x/2,0),_+=x+xh}return{nodes:p,edges:f}},[e,t,r,s,n.githubOwner,n.githubRepo,a,c]);return e.length===0?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):l.length===0&&a?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments from this agent yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask this agent to create one, or switch to Project to see all experiments."})]}):m.jsx(EK,{nodes:l,edges:u,nodeTypes:fZ,defaultEdgeOptions:cC,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,onMoveStart:eZ,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},children:m.jsx(MK,{variant:ns.Dots,color:"var(--dots-strong)",gap:28,size:1.6})},a??"project")}const ih=(e,t)=>e.id===t.id&&e.view===t.view,sh=(e,t)=>e.path===t.path&&(e.source??"repo")===(t.source??"repo")&&e.sessionId===t.sessionId&&e.ref===t.ref,mx=e=>`${e.source??"repo"}:${e.sessionId??""}:${e.ref??""}:${e.path}`;function gZ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function vZ(e,t,n,r,s){let a=e,c;const l=t==null?void 0:t.replace(/\/+$/,""),u=r==null?void 0:r.replace(/\/+$/,"");if(!a.startsWith("/"))c=n;else if(u&&(a===u||a.startsWith(`${u}/`))){const h=a.slice(u.length).replace(/^\/+/,"");return h?{path:h,source:"files"}:null}else if(l&&(a===l||a.startsWith(`${l}/`)))a=a.slice(l.length).replace(/^\/+/,"");else{const h=s?gZ(s):"[^/]+",p=a.match(new RegExp(`/files/${h}/(.+)$`)),f=p?null:a.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),g=p||f?null:a.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);if(p)return{path:p[1],source:"files"};f?(c=f[1],a=f[2]):g&&(a=g[1])}return a?{path:a,sessionId:c}:null}const gx="orx:onboarded",uC="orx:panel-width",Xh=360,yZ=10,bZ=232,_Z=380,xZ=bZ+56,SZ=80;function Ag(){return Math.max(Xh,window.innerWidth-xZ-_Z)}function wZ(){const e=Ag();try{const t=Number(localStorage.getItem(uC));if(Number.isFinite(t)&&t>=Xh)return Math.min(t,e)}catch{}return Math.max(Xh,Math.min(760,e,Math.round(window.innerWidth*.42)))}function ah(e,t){const n=e.findIndex(s=>s.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function CZ(){var sr,Dn;const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState([]),[c,l]=P.useState([]),[u,h]=P.useState(null),[p,f]=P.useState("tree"),[g,y]=P.useState("project"),[C,w]=P.useState(null),_=s.length>0&&s.every(ye=>ye.chatSessionId),b=C&&_?g:"project",x=P.useMemo(()=>{if(b!=="agent")return c;const ye=new Set(s.filter(Ie=>Ie.chatSessionId===C).map(Ie=>Ie.id));return c.filter(Ie=>ye.has(Ie.experimentId))},[c,s,b,C]),[S,E]=P.useState(null),[T,A]=P.useState("experiments"),[D,M]=P.useState([]),[R,z]=P.useState([]),[H,q]=P.useState([]),[$,U]=P.useState([]),[K,Y]=P.useState(null),[Q,ee]=P.useState(null),[B,L]=P.useState(!0),[O,W]=P.useState(!1),[G,ie]=P.useState(wZ),[fe,pe]=P.useState(!0),[te,V]=P.useState(!1),[ae,oe]=P.useState("chat"),[be,he]=P.useState(()=>{try{return localStorage.getItem(gx)==="1"}catch{return!0}}),[Se,Te]=P.useState(!1),[Re,He]=P.useState(!1),ze=P.useCallback(()=>{oe("chat"),pe(!0),L(!0),W(!1),He(!0)},[]),zt=P.useCallback(()=>{try{localStorage.setItem(a6,"1")}catch{}He(!1)},[]);P.useEffect(()=>{if(!(!n||te||!be)){try{if(localStorage.getItem(a6)==="1")return}catch{return}ze()}},[n,te,be,ze]);const At=P.useRef(n);At.current=n,P.useEffect(()=>{UA().then(ye=>{t(ye),r(Ie=>{var Ke;return Ie??((Ke=ye[0])==null?void 0:Ke.id)??null})}).catch(()=>t([]))},[]),P.useEffect(()=>{const ye=()=>ie(Ie=>Math.min(Ie,Ag()));return window.addEventListener("resize",ye),()=>window.removeEventListener("resize",ye)},[]),P.useEffect(()=>{n&&(XA(n).catch(()=>{}),a([]),l([]),h(null),E(null),M([]),z([]),q([]),U([]),Y(null),ee(null),A("experiments"),y("project"),ZA(n).then(a).catch(()=>{}),QA(n).then(l).catch(()=>{}),b3(n).then(h).catch(()=>{}))},[n]);const Tt=P.useCallback(()=>{const ye=At.current;ye&&b3(ye).then(h).catch(()=>{})},[]);YT({onRun:ye=>{ye.projectId===At.current&&l(Ie=>ah(Ie,ye))},onExperiment:ye=>{ye.projectId===At.current&&a(Ie=>ah(Ie,ye))},onProject:ye=>{t(Ie=>Ie?ah(Ie,ye):[ye])},onFiles:ye=>{ye===At.current&&Tt()}});const Gt=P.useCallback(()=>y("project"),[]),tn=P.useCallback((ye,Ie="changes")=>{const Ke={id:ye,view:Ie};M(rt=>rt.some(Nt=>ih(Nt,Ke))?rt:[...rt,Ke]),A(Ke),L(!0)},[]),mt=P.useCallback(ye=>{const Ie=D.findIndex(rt=>ih(rt,ye));if(Ie===-1)return;const Ke=D.filter((rt,Nt)=>Nt!==Ie);M(Ke),typeof T=="object"&&"id"in T&&ih(T,ye)&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[D,T]),ct=P.useCallback((ye,Ie,Ke)=>{const rt=e==null?void 0:e.find(mn=>mn.id===n),Nt=vZ(ye,rt==null?void 0:rt.repoPath,Ie,rt==null?void 0:rt.filesDir,rt==null?void 0:rt.slug);Nt&&(Ke&&Nt.source!=="files"&&(Nt.ref=Ke),z(mn=>mn.some(Qn=>sh(Qn,Nt))?mn:[...mn,Nt]),A(Nt),L(!0))},[e,n]),xt=P.useCallback(ye=>{const Ie=R.findIndex(rt=>sh(rt,ye));if(Ie===-1)return;const Ke=R.filter((rt,Nt)=>Nt!==Ie);z(Ke),typeof T=="object"&&"path"in T&&sh(T,ye)&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[R,T]),_e=P.useCallback((ye,Ie,Ke)=>{const rt={kind:"plan",sessionId:Ie,promptId:Ke,plan:ye};q(Nt=>{const mn=Nt.findIndex(Hr=>Hr.promptId===Ke);if(mn===-1)return[...Nt,rt];const Qn=Nt.slice();return Qn[mn]=rt,Qn}),A(rt),L(!0)},[]),Ne=P.useCallback(ye=>{const Ie=H.findIndex(rt=>rt.promptId===ye.promptId);if(Ie===-1)return;const Ke=H.filter((rt,Nt)=>Nt!==Ie);q(Ke),typeof T=="object"&&"kind"in T&&T.kind==="plan"&&T.promptId===ye.promptId&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[H,T]),Pe=P.useCallback((ye,Ie)=>{const Ke={kind:"subagent",sessionId:ye,spawnPartId:Ie};U(rt=>rt.some(Nt=>Nt.spawnPartId===Ie)?rt:[...rt,Ke]),A(Ke),L(!0)},[]),Qe=P.useCallback(ye=>{const Ie=$.findIndex(rt=>rt.spawnPartId===ye.spawnPartId);if(Ie===-1)return;const Ke=$.filter((rt,Nt)=>Nt!==Ie);U(Ke),typeof T=="object"&&"kind"in T&&T.kind==="subagent"&&T.spawnPartId===ye.spawnPartId&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[$,T]),Ye=P.useCallback(ye=>{const Ie={code:!0,sel:ye,toggled:new Set};Y(Ke=>Ke?{...Ke,sel:ye}:Ie),A(Ie),L(!0)},[]),Rt=P.useCallback(ye=>{Y(Ie=>Ie&&{...Ie,...ye})},[]),lt=P.useCallback(()=>{Y(null),A(ye=>typeof ye=="object"&&"code"in ye?"experiments":ye)},[]),Pt=P.useCallback(ye=>{ee(Ie=>Ie&&Ie.sessionId===ye?Ie:{wt:!0,sessionId:ye,view:"changes",toggled:new Set}),A({wt:!0,sessionId:ye,view:"changes",toggled:new Set}),L(!0)},[]),ft=P.useCallback(ye=>{ee(Ie=>Ie&&{...Ie,...ye})},[]),pn=P.useCallback(()=>{ee(null),A(ye=>typeof ye=="object"&&"wt"in ye?"experiments":ye)},[]);P.useEffect(()=>Mc(ye=>{ye.type==="sessionDeleted"&&ee(Ie=>!Ie||Ie.sessionId!==ye.sessionId?Ie:(A(Ke=>typeof Ke=="object"&&"wt"in Ke?"experiments":Ke),null))}),[]);const St=ye=>{ye.preventDefault(),ye.currentTarget.setPointerCapture(ye.pointerId);const Ie=document.body.style.userSelect;document.body.style.userSelect="none";const Ke=Nt=>{const mn=Math.round(window.innerWidth-Nt.clientX-yZ),Qn=Ag();if(mn>Qn+SZ){W(!0);return}W(!1);const Hr=Math.min(Math.max(mn,Xh),Qn);ie(Hr);try{localStorage.setItem(uC,String(Hr))}catch{}},rt=()=>{window.removeEventListener("pointermove",Ke),window.removeEventListener("pointerup",rt),window.removeEventListener("pointercancel",rt),document.body.style.userSelect=Ie};window.addEventListener("pointermove",Ke),window.addEventListener("pointerup",rt),window.addEventListener("pointercancel",rt)},Kn=ye=>{t(Ie=>Ie?ah(Ie,ye):[ye]),r(ye.id),V(!1)},On=ye=>{t(Ie=>Ie&&Ie.filter(Ke=>Ke.id!==ye)),n===ye&&r(null)},Fn=typeof T=="object"&&"id"in T?T:null,Zt=typeof T=="object"&&"path"in T?T:null,bn=typeof T=="object"&&"kind"in T&&T.kind==="plan"?T:null,Pn=typeof T=="object"&&"kind"in T&&T.kind==="subagent"?T:null,Zn=typeof T=="object"&&"code"in T,Jr=typeof T=="object"&&"wt"in T,It=(e==null?void 0:e.find(ye=>ye.id===n))??null,ji=Fn?s.find(ye=>ye.id===Fn.id)??null:null;if(e===null)return m.jsx("div",{className:"app",children:m.jsx("div",{className:"empty-state",children:m.jsx("span",{className:"spinner"})})});if(e.length===0)return m.jsx("div",{className:"app",children:be?m.jsx(s6,{projects:e,onOpen:r,onCreated:Kn,onDeleted:On,openNewProject:Se,onNewProjectOpened:()=>Te(!1)}):m.jsx(kU,{onDone:()=>{try{localStorage.setItem(gx,"1")}catch{}Te(!0),he(!0)}})});const Mn=m.jsx(EU,{projectName:((sr=e.find(ye=>ye.id===n))==null?void 0:sr.name)??"",onHome:()=>V(!0),onCollapse:()=>pe(!1)});return m.jsxs("div",{className:"app",children:[te?m.jsx(s6,{projects:e,onOpen:ye=>{r(ye),V(!1)},onCreated:Kn,onDeleted:On}):m.jsxs("div",{className:"app-body",children:[n&&m.jsx(BH,{projectId:n,paperId:(Dn=e.find(ye=>ye.id===n))==null?void 0:Dn.paperId,railHeader:Mn,railOpen:fe,onShowRail:()=>pe(!0),mainView:ae,onSelectMainView:oe,panelOpen:B,onTogglePanel:()=>{B&&W(!1),L(!B)},onOpenFile:ct,onOpenPlan:_e,onOpenSubagent:Pe,onOpenWorktree:Pt,onStartTour:ze,onActiveSessionChange:w,children:ae==="files"?(()=>{const ye=e.find(Ie=>Ie.id===n);return ye?m.jsx(fU,{project:ye,files:u,onChanged:Tt,onOpenStorage:()=>oe("storage")},ye.id):null})():ae!=="chat"?m.jsx(fH,{tab:ae}):null}),ae==="chat"&&B&&m.jsxs("aside",{className:`right-pane floating-panel ${O?"max":""}`,style:O?void 0:{width:G},"data-onboarding":"experiments",children:[!O&&m.jsx("div",{className:"panel-resizer",onPointerDown:St}),m.jsxs("div",{className:"tabs",children:[m.jsxs("div",{className:"tab-strip",children:[m.jsx("button",{className:`tab ${T==="experiments"?"active":""}`,onClick:()=>A("experiments"),children:"Experiments"}),D.map(ye=>{const Ie=s.find(Ke=>Ke.id===ye.id);return m.jsx(Bo,{active:Fn!==null&&ih(Fn,ye),label:Ie?Ie.title||Ie.slug:"…",icon:ye.view==="terminal"?m.jsx(Tx,{size:12,style:{flexShrink:0}}):m.jsx(cl,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>mt(ye)},`${ye.id}:${ye.view}`)}),R.map(ye=>m.jsx(Bo,{active:Zt!==null&&sh(Zt,ye),label:ye.path.split("/").pop()||ye.path,icon:m.jsx(wx,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>xt(ye)},`file:${mx(ye)}`)),H.map(ye=>m.jsx(Bo,{active:bn!==null&&bn.promptId===ye.promptId,label:"Plan",icon:m.jsx(Ax,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>Ne(ye)},`plan:${ye.promptId}`)),$.map(ye=>m.jsx(Bo,{active:Pn!==null&&Pn.spawnPartId===ye.spawnPartId,label:"Sub-agent",icon:m.jsx(Nx,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>Qe(ye)},`subagent:${ye.spawnPartId}`)),K&&m.jsx(Bo,{active:Zn,label:"Code",icon:m.jsx(Ex,{size:12,style:{flexShrink:0}}),onSelect:()=>A(K),onClose:lt},"code"),Q&&m.jsx(Bo,{active:Jr,label:"Worktree",icon:m.jsx(Ng,{size:12,style:{flexShrink:0}}),onSelect:()=>A(Q),onClose:pn},"worktree")]}),m.jsxs("div",{className:"panel-controls",children:[m.jsx("button",{className:"icon-btn",title:O?"Restore panel":"Expand panel","aria-label":O?"Restore panel":"Expand panel",onClick:()=>W(ye=>!ye),children:O?m.jsx(CA,{size:14}):m.jsx(SA,{size:14})}),m.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{L(!1),W(!1)},children:m.jsx(Ko,{size:14})})]})]}),T==="experiments"?m.jsxs("div",{className:"tab-body",children:[m.jsxs("div",{className:"pane-toolbar",children:[_&&m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:b==="agent"?"active":"",disabled:!C,title:C?void 0:"Open a chat session to filter to its experiments",onClick:()=>y("agent"),children:"Agent"}),m.jsx("button",{className:b==="project"?"active":"",onClick:()=>y("project"),children:"Project"})]}),m.jsx("span",{style:{flex:1}}),m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:p==="tree"?"active":"",onClick:()=>f("tree"),children:"Tree"}),m.jsx("button",{className:p==="table"?"active":"",onClick:()=>f("table"),children:"Table"})]})]}),m.jsx("div",{className:"pane-content",children:p==="tree"?It&&m.jsx(mZ,{experiments:s,runs:x,project:It,onOpenView:tn,onOpenCodeBranch:Ye,agentSessionId:b==="agent"?C:null,onShowProjectScope:Gt}):m.jsx(BU,{runs:x,emptyHint:b==="agent"&&c.length>0?"No runs from this agent's experiments yet. Switch to Project to see all runs.":void 0,experiments:s,onOpen:ye=>{E(ye.id),tn(ye.experimentId,"terminal")},onOpenChanges:ye=>tn(ye,"changes"),onCancel:ye=>void Dx(ye).catch(()=>{})})})]}):Zt?m.jsx("div",{className:"tab-body",children:n&&m.jsx(CU,{projectId:n,path:Zt.path,source:Zt.source,sessionId:Zt.sessionId,gitRef:Zt.ref,onOpenFile:ct},mx(Zt))}):bn?m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content plan-tab-content",children:m.jsx(zc,{text:bn.plan,onOpenFile:ye=>ct(ye,bn.sessionId)})})}):Pn?m.jsx(zH,{sessionId:Pn.sessionId,spawnPartId:Pn.spawnPartId,onOpenFile:ye=>ct(ye,Pn.sessionId),onOpenSubagent:ye=>Pe(Pn.sessionId,ye)},Pn.spawnPartId):Zn?m.jsx("div",{className:"tab-body",children:n&&It&&K&&m.jsx(HH,{projectId:n,project:It,experiments:s,sel:K.sel,toggled:K.toggled,onSelChange:ye=>Rt({sel:ye}),onToggledChange:ye=>Rt({toggled:ye}),onOpenFile:ct},"code")}):Jr?m.jsx("div",{className:"tab-body",children:n&&Q&&m.jsx(tU,{sessionId:Q.sessionId,projectId:n,view:Q.view,toggled:Q.toggled,onViewChange:ye=>ft({view:ye}),onToggledChange:ye=>ft({toggled:ye}),onOpenFile:ct},`wt:${Q.sessionId}`)}):m.jsx("div",{className:"tab-body",children:Fn&&ji&&It&&m.jsx(xU,{experiment:ji,project:It,view:Fn.view,runs:c,selectedRunId:S,onSelectRun:E},`${Fn.id}:${Fn.view}`)})]})]}),Re&&!te&&n&&m.jsx(FU,{onClose:zt})]})}Tk.createRoot(document.getElementById("root")).render(m.jsx(P.StrictMode,{children:m.jsx(CZ,{})})); +`)+1)}let $=[];try{$=H.trim()?R8(H):[]}catch{return}if(z.truncated&&$.every(K=>K.hunks.length===0))return;let U=0,q=0;for(const K of $){const Y=lw(K);U+=Y.additions,q+=Y.deletions}R||C({fileCount:$.length,additions:U,deletions:q,truncated:z.truncated})}).catch(()=>{}),()=>{R=!0}},[w]);const b={done:0,failed:0,cancelled:0,live:0};for(const R of t)R.status==="done"?b.done+=1:R.status==="failed"?b.failed+=1:R.status==="cancelled"?b.cancelled+=1:b.live+=1;const _=n?fm((n.endedAt??Date.now())-n.createdAt):null,x=(n==null?void 0:n.status)==="failed"&&n.resultMarkdown?n.resultMarkdown:null,S=e.description||(x?null:n==null?void 0:n.resultMarkdown)||null,E=P.useRef(null),[T,A]=P.useState(!1),[D,M]=P.useState(!1);return P.useEffect(()=>{A(!1)},[S]),P.useEffect(()=>{const R=E.current;R&&M(R.scrollHeight>R.clientHeight+1)},[S,T]),bw.createPortal(m.jsxs("div",{ref:l.ref,className:"exp-hover-card",style:{width:cm,left:f,top:g,visibility:l.offsetHeight===0?"hidden":void 0},onMouseEnter:a,onMouseLeave:c,children:[m.jsxs("div",{className:"hc-head",children:[m.jsx("span",{className:"hc-slug",children:e.slug}),m.jsx(tl,{status:(n==null?void 0:n.status)??"idle"})]}),e.title&&m.jsx("div",{className:"hc-title",children:e.title}),S&&m.jsx("div",{className:`hc-body${T?" expanded":""}`,ref:E,children:S}),S&&(D||T)&&m.jsx("button",{type:"button",className:"hc-toggle",onClick:()=>A(R=>!R),children:T?"Show less":"Show more"}),x&&m.jsx("div",{className:"hc-failure",children:x}),m.jsxs("div",{className:"hc-stats",children:[m.jsxs("span",{children:[t.length===1?"1 run":`${t.length} runs`,b.done>0&&` · ${b.done} done`,b.failed>0&&` · ${b.failed} failed`,b.cancelled>0&&` · ${b.cancelled} cancelled`,b.live>0&&` · ${b.live} live`]}),n&&Jh(n.backend)&&m.jsx(m8,{backend:n.backend}),_&&m.jsx("span",{children:_}),n&&m.jsx("span",{children:Ua(n.createdAt)})]}),m.jsxs("div",{className:"hc-git",children:[m.jsxs("div",{className:"hc-git-row",children:[m.jsxs("span",{className:"hc-branch",title:e.branchName,children:[m.jsx(cl,{size:12}),e.branchName]}),r&&m.jsxs("span",{children:["from ",m.jsx("span",{className:"hc-mono",children:r})]})]}),y&&y.fileCount>0&&m.jsx("div",{className:"hc-git-row",title:`Committed changes vs ${r??"parent"}${y.truncated?" (diff truncated — counts are lower bounds)":""}`,children:m.jsxs("span",{children:[y.truncated&&"≥ ",m.jsxs("span",{className:"diff-stat-add",children:["+",y.additions]})," ",m.jsxs("span",{className:"diff-stat-del",children:["−",y.deletions]})," · ",y.fileCount===1&&!y.truncated?"1 file":`${y.fileCount}${y.truncated?"+":""} files`]})})]}),m.jsxs("div",{className:"hc-foot",children:[m.jsxs("span",{className:"hc-mono",children:["$ ",e.runCommand]}),m.jsxs("span",{children:["created ",tZ(e.createdAt)]})]})]}),document.body)}const rZ=264,px=132,xh=44,iZ=72,sZ=148,aZ=44;function oZ(e){const t=new Map(e.map(a=>[a.id,{exp:a,children:[]}])),n=[];for(const a of e){const c=t.get(a.id),l=a.parentExperimentId?t.get(a.parentExperimentId):void 0;l?l.children.push(c):n.push(c)}const r=(a,c)=>a.exp.createdAt-c.exp.createdAt,s=a=>{a.children.sort(r),a.children.forEach(s)};return n.sort(r),n.forEach(s),n}function lZ(e,t){const n=new Map,r=l=>{const u=n.get(l)??1+l.children.reduce((h,p)=>h+r(p),0);return n.set(l,u),u},s=new Map,a=l=>{const u=s.get(l)??(t(l)||l.children.some(a));return s.set(l,u),u};function c(l){if(t(l)){const p=[];let f=0;for(const g of l.children)a(g)?p.push(...c(g)):f+=r(g);return f>0&&p.push({kind:"elided",id:`el-${l.exp.id}`,count:f,children:[]}),[{kind:"exp",exp:l.exp,children:p}]}if(!a(l))return[];let u=0;const h=[];return(function p(f){u+=1;for(const g of f.children)t(g)?h.push(...c(g)):a(g)?p(g):u+=r(g)})(l),[{kind:"elided",id:`el-${l.exp.id}`,count:u,children:h}]}return e.flatMap(c)}function Ag(e){return e.kind==="exp"?rZ:sZ}function rh(e){return e.kind==="exp"?e.exp.id:e.id}function Sh(e){if(e.children.length===0)return Ag(e);const t=e.children.reduce((n,r)=>n+Sh(r),0)+xh*(e.children.length-1);return Math.max(Ag(e),t)}function cZ(e){return e==="done"?"pass":e==="failed"?"fail":e==="running"||e==="starting"?"live":"other"}const uZ=P.memo(function({data:t}){const{exp:n,latestRun:r,runs:s,isBaseline:a,parentSlug:c,githubOwner:l,githubRepo:u,onOpenView:h,onOpenCodeBranch:p}=t,f=r==null?void 0:r.status,g=f==="running"||f==="starting",y=a?"Baseline":g?"Running":"Experiment",C=s.slice(-8),w=P.useRef(null),b=eZ(w,t);return m.jsxs("div",{ref:w,className:`exp-node ${g?"live":""}`,onMouseEnter:b.onMouseEnter,onMouseLeave:b.onMouseLeave,children:[m.jsx(Qs,{type:"target",position:We.Top}),m.jsxs("div",{className:"node-eyebrow",children:[m.jsx("span",{children:y}),m.jsx(tl,{status:f??"idle"})]}),m.jsx("div",{className:"node-head",children:m.jsx("span",{className:"node-slug",children:n.slug})}),(n.title||n.description)&&m.jsx("div",{className:"node-title",children:n.title||n.description}),m.jsxs("div",{className:"node-meta",children:[m.jsx("span",{children:"Runs"}),C.length>0?m.jsx("span",{className:"run-squares",children:C.map(_=>m.jsx("span",{className:`run-sq ${cZ(_.status)}`,title:_.status},_.id))}):m.jsx("span",{children:"no runs"}),m.jsx("span",{style:{flex:1}}),r&&m.jsx("span",{children:Ua(r.createdAt)})]}),m.jsxs("div",{className:"node-actions",onClick:_=>_.stopPropagation(),children:[m.jsxs("button",{className:"node-action",title:"Open changes",onClick:()=>h(n.id,"changes"),children:[m.jsx(cl,{size:13}),"Changes"]}),s.length>0&&m.jsxs("button",{className:"node-action",title:"Open logs",onClick:()=>h(n.id,"terminal"),children:[m.jsx(Tx,{size:13}),"Logs"]}),m.jsxs("button",{className:"node-action",title:`Browse code on ${n.branchName}`,onClick:()=>p(n.branchName),children:[m.jsx(Ex,{size:13}),"Code"]}),m.jsx("a",{className:"node-action node-action-ext",title:`Open ${n.branchName} on GitHub`,"aria-label":`Open ${n.branchName} on GitHub`,href:jg(l,u,n.branchName),target:"_blank",rel:"noopener noreferrer",onClick:_=>_.stopPropagation(),children:m.jsx(qv,{size:13})})]}),m.jsx(Qs,{type:"source",position:We.Bottom}),b.rect&&m.jsx(nZ,{exp:n,runs:s,latestRun:r,parentSlug:c,anchor:b.rect,onMouseEnter:b.keepOpen,onMouseLeave:b.onMouseLeave})]})}),hZ=P.memo(function({data:t}){const{count:n,onShowProjectScope:r}=t;return m.jsxs("div",{className:"elided-node",role:"button",tabIndex:0,title:"Switch to Project to see all experiments",onClick:r,onKeyDown:s=>{(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),r())},children:[m.jsx(Qs,{type:"target",position:We.Top}),m.jsx(xx,{size:14}),m.jsxs("span",{className:"elided-node-label",children:[n," ",n===1?"experiment":"experiments",m.jsx("span",{className:"elided-node-sub",children:"other agents"})]}),m.jsx(Qs,{type:"source",position:We.Bottom})]})}),dZ={exp:uZ,elided:hZ},lC={type:"default",style:{stroke:"var(--text)",strokeWidth:1.5,opacity:.3}},fZ={...lC.style,strokeDasharray:"4 4"};function pZ({experiments:e,runs:t,project:n,onOpenView:r,onOpenCodeBranch:s,agentSessionId:a,onShowProjectScope:c}){const{nodes:l,edges:u}=P.useMemo(()=>{const h=new Map;for(const _ of t){const x=h.get(_.experimentId);x?x.push(_):h.set(_.experimentId,[_])}for(const _ of h.values())_.sort((x,S)=>x.createdAt-S.createdAt);const p=[],f=[],g=_=>!a||_.exp.chatSessionId===a,y=lZ(oZ(e),g),C=new Map(e.map(_=>[_.id,_.slug]));function w(_,x,S){const E=x-Ag(_)/2;if(_.kind==="exp"){const D=h.get(_.exp.id)??[];p.push({id:_.exp.id,type:"exp",position:{x:E,y:S},data:{exp:_.exp,latestRun:D[D.length-1]??null,runs:D,isBaseline:!_.exp.parentExperimentId,parentSlug:_.exp.parentExperimentId?C.get(_.exp.parentExperimentId)??null:null,githubOwner:n.githubOwner,githubRepo:n.githubRepo,onOpenView:r,onOpenCodeBranch:s}})}else p.push({id:_.id,type:"elided",position:{x:E,y:S+(px-aZ)/2},data:{count:_.count,onShowProjectScope:c}});if(_.children.length===0)return;const T=_.children.reduce((D,M)=>D+Sh(M),0)+xh*(_.children.length-1);let A=x-T/2;for(const D of _.children){const M=Sh(D),R=_.kind==="elided"||D.kind==="elided";f.push({id:`e-${rh(_)}-${rh(D)}`,source:rh(_),target:rh(D),...R?{style:fZ}:{}}),w(D,A+M/2,S+px+iZ),A+=M+xh}}let b=0;for(const _ of y){const x=Sh(_);w(_,b+x/2,0),b+=x+xh}return{nodes:p,edges:f}},[e,t,r,s,n.githubOwner,n.githubRepo,a,c]);return e.length===0?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask the agent in chat to create and run your first experiment."})]}):l.length===0&&a?m.jsxs("div",{className:"empty-state empty-state-cta",children:[m.jsx("p",{className:"empty-state-title",children:"No experiments from this agent yet"}),m.jsx("p",{className:"empty-state-hint",children:"Ask this agent to create one, or switch to Project to see all experiments."})]}):m.jsx(CK,{nodes:l,edges:u,nodeTypes:dZ,defaultEdgeOptions:lC,nodesDraggable:!1,nodesConnectable:!1,nodesFocusable:!1,onMoveStart:JK,minZoom:.15,fitView:!0,fitViewOptions:{padding:.25,maxZoom:1},children:m.jsx(NK,{variant:ns.Dots,color:"var(--dots-strong)",gap:28,size:1.6})},a??"project")}const ih=(e,t)=>e.id===t.id&&e.view===t.view,sh=(e,t)=>e.path===t.path&&(e.source??"repo")===(t.source??"repo")&&e.sessionId===t.sessionId&&e.ref===t.ref,mx=e=>`${e.source??"repo"}:${e.sessionId??""}:${e.ref??""}:${e.path}`;function mZ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gZ(e,t,n,r,s){let a=e,c;const l=t==null?void 0:t.replace(/\/+$/,""),u=r==null?void 0:r.replace(/\/+$/,"");if(!a.startsWith("/"))c=n;else if(u&&(a===u||a.startsWith(`${u}/`))){const h=a.slice(u.length).replace(/^\/+/,"");return h?{path:h,source:"artifacts"}:null}else if(l&&(a===l||a.startsWith(`${l}/`)))a=a.slice(l.length).replace(/^\/+/,"");else{const h=s?mZ(s):"[^/]+",p=a.match(new RegExp(`/files/${h}/(.+)$`)),f=p?null:a.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/),g=p||f?null:a.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/);if(p)return{path:p[1],source:"artifacts"};f?(c=f[1],a=f[2]):g&&(a=g[1])}return a?{path:a,sessionId:c}:null}const gx="orx:onboarded",cC="orx:panel-width",Xh=360,vZ=10,yZ=232,bZ=380,_Z=yZ+56,xZ=80;function Tg(){return Math.max(Xh,window.innerWidth-_Z-bZ)}function SZ(){const e=Tg();try{const t=Number(localStorage.getItem(cC));if(Number.isFinite(t)&&t>=Xh)return Math.min(t,e)}catch{}return Math.max(Xh,Math.min(760,e,Math.round(window.innerWidth*.42)))}function ah(e,t){const n=e.findIndex(s=>s.id===t.id);if(n<0)return[...e,t];const r=e.slice();return r[n]=t,r}function wZ(){var sr,Dn;const[e,t]=P.useState(null),[n,r]=P.useState(null),[s,a]=P.useState([]),[c,l]=P.useState([]),[u,h]=P.useState(null),[p,f]=P.useState("tree"),[g,y]=P.useState("project"),[C,w]=P.useState(null),b=s.length>0&&s.every(ye=>ye.chatSessionId),_=C&&b?g:"project",x=P.useMemo(()=>{if(_!=="agent")return c;const ye=new Set(s.filter(Ie=>Ie.chatSessionId===C).map(Ie=>Ie.id));return c.filter(Ie=>ye.has(Ie.experimentId))},[c,s,_,C]),[S,E]=P.useState(null),[T,A]=P.useState("experiments"),[D,M]=P.useState([]),[R,z]=P.useState([]),[H,$]=P.useState([]),[U,q]=P.useState([]),[K,Y]=P.useState(null),[Q,ee]=P.useState(null),[B,L]=P.useState(!0),[O,W]=P.useState(!1),[G,ie]=P.useState(SZ),[fe,pe]=P.useState(!0),[te,V]=P.useState(!1),[ae,oe]=P.useState("chat"),[be,he]=P.useState(()=>{try{return localStorage.getItem(gx)==="1"}catch{return!0}}),[Se,Te]=P.useState(!1),[Re,He]=P.useState(!1),ze=P.useCallback(()=>{oe("chat"),pe(!0),L(!0),W(!1),He(!0)},[]),zt=P.useCallback(()=>{try{localStorage.setItem(a6,"1")}catch{}He(!1)},[]);P.useEffect(()=>{if(!(!n||te||!be)){try{if(localStorage.getItem(a6)==="1")return}catch{return}ze()}},[n,te,be,ze]);const At=P.useRef(n);At.current=n,P.useEffect(()=>{$A().then(ye=>{t(ye),r(Ie=>{var Ke;return Ie??((Ke=ye[0])==null?void 0:Ke.id)??null})}).catch(()=>t([]))},[]),P.useEffect(()=>{const ye=()=>ie(Ie=>Math.min(Ie,Tg()));return window.addEventListener("resize",ye),()=>window.removeEventListener("resize",ye)},[]),P.useEffect(()=>{n&&(YA(n).catch(()=>{}),a([]),l([]),h(null),E(null),M([]),z([]),$([]),q([]),Y(null),ee(null),A("experiments"),y("project"),KA(n).then(a).catch(()=>{}),ZA(n).then(l).catch(()=>{}),b3(n).then(h).catch(()=>{}))},[n]);const Tt=P.useCallback(()=>{const ye=At.current;ye&&b3(ye).then(h).catch(()=>{})},[]);WT({onRun:ye=>{ye.projectId===At.current&&l(Ie=>ah(Ie,ye))},onExperiment:ye=>{ye.projectId===At.current&&a(Ie=>ah(Ie,ye))},onProject:ye=>{t(Ie=>Ie?ah(Ie,ye):[ye])},onArtifacts:ye=>{ye===At.current&&Tt()}});const Gt=P.useCallback(()=>y("project"),[]),tn=P.useCallback((ye,Ie="changes")=>{const Ke={id:ye,view:Ie};M(nt=>nt.some(Nt=>ih(Nt,Ke))?nt:[...nt,Ke]),A(Ke),L(!0)},[]),mt=P.useCallback(ye=>{const Ie=D.findIndex(nt=>ih(nt,ye));if(Ie===-1)return;const Ke=D.filter((nt,Nt)=>Nt!==Ie);M(Ke),typeof T=="object"&&"id"in T&&ih(T,ye)&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[D,T]),ct=P.useCallback((ye,Ie,Ke)=>{const nt=e==null?void 0:e.find(mn=>mn.id===n),Nt=gZ(ye,nt==null?void 0:nt.repoPath,Ie,(nt==null?void 0:nt.artifactsDir)??(nt==null?void 0:nt.filesDir),nt==null?void 0:nt.slug);Nt&&(Ke&&Nt.source!=="artifacts"&&(Nt.ref=Ke),z(mn=>mn.some(Qn=>sh(Qn,Nt))?mn:[...mn,Nt]),A(Nt),L(!0))},[e,n]),xt=P.useCallback(ye=>{const Ie=R.findIndex(nt=>sh(nt,ye));if(Ie===-1)return;const Ke=R.filter((nt,Nt)=>Nt!==Ie);z(Ke),typeof T=="object"&&"path"in T&&sh(T,ye)&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[R,T]),_e=P.useCallback((ye,Ie,Ke)=>{const nt={kind:"plan",sessionId:Ie,promptId:Ke,plan:ye};$(Nt=>{const mn=Nt.findIndex(Hr=>Hr.promptId===Ke);if(mn===-1)return[...Nt,nt];const Qn=Nt.slice();return Qn[mn]=nt,Qn}),A(nt),L(!0)},[]),Ne=P.useCallback(ye=>{const Ie=H.findIndex(nt=>nt.promptId===ye.promptId);if(Ie===-1)return;const Ke=H.filter((nt,Nt)=>Nt!==Ie);$(Ke),typeof T=="object"&&"kind"in T&&T.kind==="plan"&&T.promptId===ye.promptId&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[H,T]),Pe=P.useCallback((ye,Ie)=>{const Ke={kind:"subagent",sessionId:ye,spawnPartId:Ie};q(nt=>nt.some(Nt=>Nt.spawnPartId===Ie)?nt:[...nt,Ke]),A(Ke),L(!0)},[]),Qe=P.useCallback(ye=>{const Ie=U.findIndex(nt=>nt.spawnPartId===ye.spawnPartId);if(Ie===-1)return;const Ke=U.filter((nt,Nt)=>Nt!==Ie);q(Ke),typeof T=="object"&&"kind"in T&&T.kind==="subagent"&&T.spawnPartId===ye.spawnPartId&&A(Ke[Math.min(Ie,Ke.length-1)]??"experiments")},[U,T]),Ye=P.useCallback(ye=>{const Ie={code:!0,sel:ye,toggled:new Set};Y(Ke=>Ke?{...Ke,sel:ye}:Ie),A(Ie),L(!0)},[]),Rt=P.useCallback(ye=>{Y(Ie=>Ie&&{...Ie,...ye})},[]),lt=P.useCallback(()=>{Y(null),A(ye=>typeof ye=="object"&&"code"in ye?"experiments":ye)},[]),Pt=P.useCallback(ye=>{ee(Ie=>Ie&&Ie.sessionId===ye?Ie:{wt:!0,sessionId:ye,view:"changes",toggled:new Set}),A({wt:!0,sessionId:ye,view:"changes",toggled:new Set}),L(!0)},[]),ft=P.useCallback(ye=>{ee(Ie=>Ie&&{...Ie,...ye})},[]),pn=P.useCallback(()=>{ee(null),A(ye=>typeof ye=="object"&&"wt"in ye?"experiments":ye)},[]);P.useEffect(()=>Mc(ye=>{ye.type==="sessionDeleted"&&ee(Ie=>!Ie||Ie.sessionId!==ye.sessionId?Ie:(A(Ke=>typeof Ke=="object"&&"wt"in Ke?"experiments":Ke),null))}),[]);const St=ye=>{ye.preventDefault(),ye.currentTarget.setPointerCapture(ye.pointerId);const Ie=document.body.style.userSelect;document.body.style.userSelect="none";const Ke=Nt=>{const mn=Math.round(window.innerWidth-Nt.clientX-vZ),Qn=Tg();if(mn>Qn+xZ){W(!0);return}W(!1);const Hr=Math.min(Math.max(mn,Xh),Qn);ie(Hr);try{localStorage.setItem(cC,String(Hr))}catch{}},nt=()=>{window.removeEventListener("pointermove",Ke),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),document.body.style.userSelect=Ie};window.addEventListener("pointermove",Ke),window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt)},Kn=ye=>{t(Ie=>Ie?ah(Ie,ye):[ye]),r(ye.id),V(!1)},On=ye=>{t(Ie=>Ie&&Ie.filter(Ke=>Ke.id!==ye)),n===ye&&r(null)},Fn=typeof T=="object"&&"id"in T?T:null,Zt=typeof T=="object"&&"path"in T?T:null,bn=typeof T=="object"&&"kind"in T&&T.kind==="plan"?T:null,Pn=typeof T=="object"&&"kind"in T&&T.kind==="subagent"?T:null,Zn=typeof T=="object"&&"code"in T,Jr=typeof T=="object"&&"wt"in T,It=(e==null?void 0:e.find(ye=>ye.id===n))??null,ji=Fn?s.find(ye=>ye.id===Fn.id)??null:null;if(e===null)return m.jsx("div",{className:"app",children:m.jsx("div",{className:"empty-state",children:m.jsx("span",{className:"spinner"})})});if(e.length===0)return m.jsx("div",{className:"app",children:be?m.jsx(s6,{projects:e,onOpen:r,onCreated:Kn,onDeleted:On,openNewProject:Se,onNewProjectOpened:()=>Te(!1)}):m.jsx(EU,{onDone:()=>{try{localStorage.setItem(gx,"1")}catch{}Te(!0),he(!0)}})});const Mn=m.jsx(CU,{projectName:((sr=e.find(ye=>ye.id===n))==null?void 0:sr.name)??"",onHome:()=>V(!0),onCollapse:()=>pe(!1)});return m.jsxs("div",{className:"app",children:[te?m.jsx(s6,{projects:e,onOpen:ye=>{r(ye),V(!1)},onCreated:Kn,onDeleted:On}):m.jsxs("div",{className:"app-body",children:[n&&m.jsx(OH,{projectId:n,paperId:(Dn=e.find(ye=>ye.id===n))==null?void 0:Dn.paperId,railHeader:Mn,railOpen:fe,onShowRail:()=>pe(!0),mainView:ae,onSelectMainView:oe,panelOpen:B,onTogglePanel:()=>{B&&W(!1),L(!B)},onOpenFile:ct,onOpenPlan:_e,onOpenSubagent:Pe,onOpenWorktree:Pt,onStartTour:ze,onActiveSessionChange:w,children:ae==="artifacts"?(()=>{const ye=e.find(Ie=>Ie.id===n);return ye?m.jsx(dU,{project:ye,artifacts:u,onChanged:Tt,onOpenStorage:()=>oe("storage")},ye.id):null})():ae!=="chat"?m.jsx(dH,{tab:ae}):null}),ae==="chat"&&B&&m.jsxs("aside",{className:`right-pane floating-panel ${O?"max":""}`,style:O?void 0:{width:G},"data-onboarding":"experiments",children:[!O&&m.jsx("div",{className:"panel-resizer",onPointerDown:St}),m.jsxs("div",{className:"tabs",children:[m.jsxs("div",{className:"tab-strip",children:[m.jsx("button",{className:`tab ${T==="experiments"?"active":""}`,onClick:()=>A("experiments"),children:"Experiments"}),D.map(ye=>{const Ie=s.find(Ke=>Ke.id===ye.id);return m.jsx(Bo,{active:Fn!==null&&ih(Fn,ye),label:Ie?Ie.title||Ie.slug:"…",icon:ye.view==="terminal"?m.jsx(Tx,{size:12,style:{flexShrink:0}}):m.jsx(cl,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>mt(ye)},`${ye.id}:${ye.view}`)}),R.map(ye=>m.jsx(Bo,{active:Zt!==null&&sh(Zt,ye),label:ye.path.split("/").pop()||ye.path,icon:m.jsx(wx,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>xt(ye)},`file:${mx(ye)}`)),H.map(ye=>m.jsx(Bo,{active:bn!==null&&bn.promptId===ye.promptId,label:"Plan",icon:m.jsx(Ax,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>Ne(ye)},`plan:${ye.promptId}`)),U.map(ye=>m.jsx(Bo,{active:Pn!==null&&Pn.spawnPartId===ye.spawnPartId,label:"Sub-agent",icon:m.jsx(Nx,{size:12,style:{flexShrink:0}}),onSelect:()=>A(ye),onClose:()=>Qe(ye)},`subagent:${ye.spawnPartId}`)),K&&m.jsx(Bo,{active:Zn,label:"Code",icon:m.jsx(Ex,{size:12,style:{flexShrink:0}}),onSelect:()=>A(K),onClose:lt},"code"),Q&&m.jsx(Bo,{active:Jr,label:"Worktree",icon:m.jsx(Mg,{size:12,style:{flexShrink:0}}),onSelect:()=>A(Q),onClose:pn},"worktree")]}),m.jsxs("div",{className:"panel-controls",children:[m.jsx("button",{className:"icon-btn",title:O?"Restore panel":"Expand panel","aria-label":O?"Restore panel":"Expand panel",onClick:()=>W(ye=>!ye),children:O?m.jsx(wA,{size:14}):m.jsx(xA,{size:14})}),m.jsx("button",{className:"icon-btn",title:"Close panel","aria-label":"Close panel",onClick:()=>{L(!1),W(!1)},children:m.jsx(Ko,{size:14})})]})]}),T==="experiments"?m.jsxs("div",{className:"tab-body",children:[m.jsxs("div",{className:"pane-toolbar",children:[b&&m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:_==="agent"?"active":"",disabled:!C,title:C?void 0:"Open a chat session to filter to its experiments",onClick:()=>y("agent"),children:"Agent"}),m.jsx("button",{className:_==="project"?"active":"",onClick:()=>y("project"),children:"Project"})]}),m.jsx("span",{style:{flex:1}}),m.jsxs("div",{className:"seg",children:[m.jsx("button",{className:p==="tree"?"active":"",onClick:()=>f("tree"),children:"Tree"}),m.jsx("button",{className:p==="table"?"active":"",onClick:()=>f("table"),children:"Table"})]})]}),m.jsx("div",{className:"pane-content",children:p==="tree"?It&&m.jsx(pZ,{experiments:s,runs:x,project:It,onOpenView:tn,onOpenCodeBranch:Ye,agentSessionId:_==="agent"?C:null,onShowProjectScope:Gt}):m.jsx(OU,{runs:x,emptyHint:_==="agent"&&c.length>0?"No runs from this agent's experiments yet. Switch to Project to see all runs.":void 0,experiments:s,onOpen:ye=>{E(ye.id),tn(ye.experimentId,"terminal")},onOpenChanges:ye=>tn(ye,"changes"),onCancel:ye=>void Dx(ye).catch(()=>{})})})]}):Zt?m.jsx("div",{className:"tab-body",children:n&&m.jsx(wU,{projectId:n,path:Zt.path,source:Zt.source,sessionId:Zt.sessionId,gitRef:Zt.ref,onOpenFile:ct},mx(Zt))}):bn?m.jsx("div",{className:"tab-body",children:m.jsx("div",{className:"pane-content plan-tab-content",children:m.jsx(zc,{text:bn.plan,onOpenFile:ye=>ct(ye,bn.sessionId)})})}):Pn?m.jsx(BH,{sessionId:Pn.sessionId,spawnPartId:Pn.spawnPartId,onOpenFile:ye=>ct(ye,Pn.sessionId),onOpenSubagent:ye=>Pe(Pn.sessionId,ye)},Pn.spawnPartId):Zn?m.jsx("div",{className:"tab-body",children:n&&It&&K&&m.jsx(IH,{projectId:n,project:It,experiments:s,sel:K.sel,toggled:K.toggled,onSelChange:ye=>Rt({sel:ye}),onToggledChange:ye=>Rt({toggled:ye}),onOpenFile:ct},"code")}):Jr?m.jsx("div",{className:"tab-body",children:n&&Q&&m.jsx(eU,{sessionId:Q.sessionId,projectId:n,view:Q.view,toggled:Q.toggled,onViewChange:ye=>ft({view:ye}),onToggledChange:ye=>ft({toggled:ye}),onOpenFile:ct},`wt:${Q.sessionId}`)}):m.jsx("div",{className:"tab-body",children:Fn&&ji&&It&&m.jsx(_U,{experiment:ji,project:It,view:Fn.view,runs:c,selectedRunId:S,onSelectRun:E},`${Fn.id}:${Fn.view}`)})]})]}),Re&&!te&&n&&m.jsx(HU,{onClose:zt})]})}Ak.createRoot(document.getElementById("root")).render(m.jsx(P.StrictMode,{children:m.jsx(wZ,{})})); diff --git a/ui/dist/assets/index-CT4HATHy.css b/ui/dist/assets/index-txo-Py33.css similarity index 63% rename from ui/dist/assets/index-CT4HATHy.css rename to ui/dist/assets/index-txo-Py33.css index 8e8dc2c0..99dd5d95 100644 --- a/ui/dist/assets/index-CT4HATHy.css +++ b/ui/dist/assets/index-txo-Py33.css @@ -1,4 +1,4 @@ -@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;position:relative;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.47"}.katex .katex-mathml{border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .smash{display:inline;line-height:0}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--fs-2xs: 10px;--fs-xs: 11px;--fs-sm: 13px;--fs-md: 14px;--fs-base: 15px;--fs-lg: 16px;--fs-xl: 16px;--fs-2xl: 18px;--fs-3xl: 22px;--fs-4xl: 28px;--fs-5xl: 34px;--fw-regular: 400;--fw-medium: 500;--fw-semibold: 600;--fw-display: 700;--radius-xs: 4px;--radius-sm: 6px;--radius-md: 8px;--radius-lg: 10px;--radius-xl: 12px;--radius-full: 999px;--modal-top: min(30vh, 260px);--term-bg: #1a1a1a;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:var(--fs-base);line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:var(--radius-md);padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:var(--radius-sm);border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.wordmark{display:inline-flex;align-items:center;gap:.4em;color:var(--text)}.wordmark svg{width:1em;height:1em;flex-shrink:0}.home-brand{font-weight:var(--fw-display);font-size:var(--fs-4xl);letter-spacing:-.02em;margin-bottom:36px}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:var(--fs-2xl);letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:var(--radius-sm);color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:var(--fw-semibold);font-size:var(--fs-base)}.project-card .repo{color:var(--text)}.project-card .paper,.project-card .time{font-size:var(--fs-xs);color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:var(--fw-semibold);font-size:var(--fs-base);color:var(--text);padding:4px 6px 4px 0;border-radius:var(--radius-sm)}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}[data-tip]{position:relative}[data-tip]:after{content:attr(data-tip);position:absolute;top:calc(100% + 6px);right:-4px;background:var(--text);color:var(--base);font-size:var(--fs-xs);font-weight:var(--fw-medium);line-height:1;padding:5px 8px;border-radius:var(--radius-sm);white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .1s ease .3s,visibility 0s linear .4s;z-index:60}[data-tip]:hover:after{opacity:1;visibility:visible}.tip-up[data-tip]:after{top:auto;bottom:calc(100% + 6px)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--text)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:var(--fs-xs);border-radius:var(--radius-sm)}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:var(--fs-sm);font-weight:var(--fw-medium);color:var(--text);white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot,.st-done>svg{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:var(--fs-base);color:var(--text);border-radius:var(--radius-md);text-align:left}.rail-nav-item:hover{background:var(--surface)}.rail-nav-item.active{background:var(--panel);font-weight:var(--fw-semibold)}.rail-section-label{padding:10px 10px 6px;font-size:var(--fs-md);font-weight:var(--fw-medium);color:var(--subtext)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:var(--radius-sm)}.rail-empty{padding:6px 10px;font-size:var(--fs-md);color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:var(--radius-xs);color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);border-radius:var(--radius-sm);white-space:nowrap;flex-shrink:0}.tab.active{background:var(--surface)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.plan-tab-content{overflow-y:auto;background:var(--base);padding:18px 24px}.plan-tab-content .md{max-width:var(--readable-col)}.subagent-tab-content{overflow-y:auto;background:var(--base);padding:12px 16px}.subagent-tab-header{display:flex;align-items:center;gap:8px;padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid var(--border-variant)}.subagent-live{flex-shrink:0;font-size:var(--fs-xs);color:var(--accent-amber)}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:var(--radius-md);background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);border-radius:var(--radius-sm)}.seg button:not(:disabled):hover{color:var(--text)}.seg button.active{background:var(--base);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.seg button:disabled{color:var(--muted);cursor:default}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:var(--fs-base);font-weight:var(--fw-semibold);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:var(--radius-md);font-size:var(--fs-md);color:var(--text);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface)}.session-row.active{background:var(--surface);font-weight:var(--fw-medium)}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.title-reveal-char{display:inline-block;animation:title-char-in .24s ease-out both}@keyframes title-char-in{0%{opacity:0;filter:blur(4px);transform:translateY(.15em)}}@media(prefers-reduced-motion:reduce){.title-reveal-char{animation:none}}.session-row .session-time{font-size:var(--fs-2xs);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:var(--radius-sm);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .busy-dot.waiting{animation:none}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:var(--radius-sm);outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--text);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:var(--fs-5xl);font-weight:var(--fw-display);letter-spacing:-.02em;color:var(--text)}.chat-empty .chat-empty-hint{font-size:var(--fs-md);color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:var(--fs-base);max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:var(--fs-md);color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-full);padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.chat-loading{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;color:var(--subtext);font-size:var(--fs-xl);padding:20px}.chat-loading .spinner{width:22px;height:22px;border-width:3px}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:var(--fs-base);white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:var(--radius-xs);display:block}.msg-assistant{font-size:var(--fs-lg);line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:var(--fs-md);margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:var(--fw-semibold)}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:var(--fs-md);text-align:left;border-radius:var(--radius-sm)}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-group.has-error>.tool-row .tool-line{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.subagent-row{display:flex;align-items:center;gap:8px;width:100%;margin:2px 0;padding:3px 4px;cursor:pointer;color:var(--text);font-size:var(--fs-base);text-align:left;border-radius:var(--radius-sm)}.subagent-row:hover:not(:disabled){background:var(--surface)}.subagent-row:disabled{cursor:default}.subagent-row.has-error{color:var(--accent-red)}.subagent-row .tool-line{font-size:var(--fs-base);color:var(--text)}.subagent-row-chevron,.subagent-icon{flex-shrink:0;color:var(--muted)}.subagent-empty{padding:3px 4px;font-size:var(--fs-md);color:var(--muted)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:var(--radius-sm)}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-md);color:var(--subtext)}.tool-open{flex-shrink:0;font-size:var(--fs-xs);color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:var(--fs-xs);color:var(--text);background:var(--surface);border-radius:var(--radius-sm);white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:var(--fs-xs);color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:var(--radius-sm)}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:var(--fs-md);padding:2px 0 8px}.working.awaiting{font-style:italic}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:var(--fs-base);field-sizing:content;min-height:52px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:var(--radius-sm);display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--radius-md);background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:var(--fw-semibold)}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:var(--radius-md);padding:8px 12px;overflow-x:auto;font-size:var(--fs-sm);color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:var(--fw-medium);color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-xs);padding:1px 5px}.md .katex{font-size:1.05em}.md .katex-display{margin:12px 0;overflow-x:auto;overflow-y:hidden;padding:2px 0}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:var(--fw-medium);color:var(--text);background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-xs);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:var(--fw-regular)}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:var(--radius-sm);opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:var(--fw-semibold);margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;display:block;width:max-content;max-width:100%;font-size:var(--fs-md);margin:10px 0;border:1px solid var(--border);border-radius:var(--radius-md);overflow-x:auto}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text);word-break:normal;overflow-wrap:break-word}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:var(--fw-medium);color:var(--text);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.react-flow__node.react-flow__node-exp.selectable{cursor:default}.exp-node{width:264px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base);padding:10px 12px;box-shadow:0 1px 2px #0000000a;font-size:var(--fs-md);transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:var(--fs-2xs);font-weight:var(--fw-medium);color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--text);font-size:var(--fs-sm);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:var(--fs-2xs);color:var(--muted)}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:3px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 6px;font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--text);border-radius:var(--radius-sm);text-decoration:none}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.exp-node .node-action-ext{margin-left:auto;padding:3px 5px}.react-flow__node.react-flow__node-elided.selectable{cursor:pointer}.elided-node{width:148px;height:44px;display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px dashed var(--border);border-radius:var(--radius-md);background:color-mix(in oklab,var(--text) 3%,transparent);color:var(--muted);font-size:var(--fs-2xs);font-weight:var(--fw-medium);text-align:left;transition:border-color .12s ease,color .12s ease}.elided-node:hover{border-color:var(--text);color:var(--text)}.elided-node .elided-node-label{display:flex;flex-direction:column;line-height:1.3}.elided-node .elided-node-sub{color:var(--muted)}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.exp-hover-card{position:fixed;z-index:60;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;padding:14px 16px;font-size:var(--fs-sm);color:var(--text)}.exp-hover-card .hc-mono{font-family:var(--mono)}.exp-hover-card .hc-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}.exp-hover-card .hc-slug{font-family:var(--mono);font-size:var(--fs-md);font-weight:var(--fw-semibold);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-hover-card .hc-title{margin-top:3px;color:var(--text)}.exp-hover-card .hc-body{margin-top:10px;border-top:1px solid var(--border-variant);padding-top:10px;line-height:1.6;white-space:pre-line;display:-webkit-box;-webkit-line-clamp:10;-webkit-box-orient:vertical;overflow:hidden}.exp-hover-card .hc-body.expanded{display:block;-webkit-line-clamp:unset;max-height:45vh;overflow-y:auto;padding-bottom:4px}.exp-hover-card .hc-toggle{margin-top:4px;font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--muted)}.exp-hover-card .hc-toggle:hover{color:var(--text)}.exp-hover-card .hc-failure{margin-top:8px;color:var(--accent-red);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.exp-hover-card .hc-stats{margin-top:10px;border-top:1px solid var(--border-variant);padding-top:10px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:var(--fs-xs);color:var(--text)}.exp-hover-card .hc-git{margin-top:10px;padding-top:8px;border-top:1px solid var(--border-variant);font-size:var(--fs-xs);color:var(--text);display:flex;flex-direction:column;gap:4px}.exp-hover-card .hc-git-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.exp-hover-card .hc-branch{display:inline-flex;align-items:center;gap:4px;font-family:var(--mono);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-hover-card .hc-foot{margin-top:8px;display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:var(--fs-2xs);color:var(--muted)}.exp-hover-card .hc-foot .hc-mono{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:var(--fs-md);background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}.runs-table th{text-align:left;color:var(--text);font-size:var(--fs-xs);font-weight:var(--fw-semibold);padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:var(--fs-sm)}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:var(--radius-md);background:var(--canvas);border:1px solid var(--border);font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--base);color:var(--subtext);font-size:var(--fs-md)}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:var(--fw-medium)}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:var(--fs-md)}.kv .k{color:var(--subtext)}.kv .v{font-family:var(--mono);font-size:var(--fs-sm);word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:var(--fs-sm);color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:var(--term-bg);padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:var(--fs-md);color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:var(--fs-sm);font-weight:var(--fw-semibold)}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:var(--fs-sm);border-radius:var(--radius-sm)}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:var(--fw-semibold)}.history-item .when{margin-left:auto;font-size:var(--fs-xs);color:var(--muted)}.changes-branch{display:flex;align-items:center;gap:8px;margin-bottom:10px}.commit-picker{display:flex;align-items:center;gap:8px}.ctl-label{flex-shrink:0;font-size:var(--fs-2xs);font-weight:var(--fw-medium);color:var(--subtext)}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:var(--fs-sm)}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:var(--fs-sm);color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:var(--fs-md);line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:var(--fs-2xl);font-weight:var(--fw-regular);color:var(--text)}.empty-state p.empty-state-hint{font-size:var(--fs-lg);color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-size:var(--fs-xl);font-weight:var(--fw-semibold);color:var(--muted);margin-bottom:18px}.onb-title{margin:0 0 6px;font-size:var(--fs-3xl);letter-spacing:-.01em}.onb-sub{color:var(--text);font-size:var(--fs-base);line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:var(--fw-semibold);font-size:var(--fs-base)}.onb-card-detail{font-size:var(--fs-sm)}.onb-card-meta{font-size:var(--fs-sm);color:var(--subtext)}.onb-card-meta code,.model-more code{font-family:var(--mono);font-size:var(--fs-xs);background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-xs);padding:1px 5px;white-space:nowrap}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:var(--fs-md);padding:8px 0}.onb-fix{display:flex;align-items:baseline;flex-wrap:wrap;gap:10px;margin:6px 0 9px}.onb-aside{display:flex;flex-direction:column;align-items:flex-start;gap:7px;margin-top:12px;padding-top:10px;border-top:1px solid var(--border-variant)}.onb-aside-text{font-size:var(--fs-xs);color:var(--muted);line-height:1.5}.onb-aside .onb-cmd-chip{max-width:100%}.onb-aside .onb-cmd-chip code{font-size:var(--fs-xs);white-space:normal;word-break:break-word}.onb-fix-label{font-size:var(--fs-md);font-weight:var(--fw-regular);color:var(--text)}.onb-fix-alt{margin-left:auto;padding:0;border:0;background:none;color:var(--muted);font-size:var(--fs-xs);text-decoration:underline;cursor:pointer}.onb-fix-alt:hover{color:var(--text)}.onb-cmd-chip{display:inline-flex;align-items:stretch;align-self:flex-start;max-width:100%;background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-sm);overflow:hidden}.onb-cmd-chip code{font-family:var(--mono);font-size:var(--fs-sm);padding:4px 9px}.onb-cmd-copy{display:inline-flex;align-items:center;flex-shrink:0;padding:0 8px;border:0;border-left:1px solid var(--border-variant);background:none;color:var(--muted);cursor:pointer}.onb-cmd-copy:hover{background:var(--surface);color:var(--text)}.onb-gate-hint{margin:18px 0 0;font-size:var(--fs-base);font-weight:var(--fw-semibold);line-height:1.5;color:var(--text)}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:var(--fs-sm)}.onb-token-form a{font-size:var(--fs-sm);color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:var(--fs-md);white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:var(--fw-regular);font-size:var(--fs-xs);color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius-md);max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:var(--fs-md);font-weight:var(--fw-medium)}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:var(--fs-xs);color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:var(--fs-md);font-weight:var(--fw-semibold)}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:var(--fs-xs);color:var(--text);font-weight:var(--fw-medium)}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.settings-card>.error{color:var(--accent-red);font-size:var(--fs-md);white-space:pre-wrap}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:flex-start;justify-content:center;padding:var(--modal-top) 16px 24px;overflow-y:auto;z-index:100}.modal{width:480px;max-width:94vw;max-height:calc(100vh - var(--modal-top) - 48px);overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:var(--fs-xl)}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:var(--fs-md);padding:4px 0}.settings-note{margin:10px 0 0;font-size:var(--fs-sm);padding:8px 10px;border:1px solid var(--accent-amber);border-radius:var(--radius-md);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:var(--fw-medium)}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:var(--radius-full);background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:var(--radius-full);transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:var(--fs-sm);color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-family:var(--sans);font-size:var(--fs-xs);font-weight:var(--fw-medium);padding:1px 7px;border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;min-height:0;display:flex;background:var(--base)}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:var(--radius-md);padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:var(--fs-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.ftree-pane{position:relative;flex-shrink:0;display:flex;flex-direction:column;min-height:0;border-left:1px solid var(--border-variant);border-right:1px solid var(--border-variant);background:var(--base)}.ftree-resizer{position:absolute;right:-3px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.ftree-resizer:hover,.ftree-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.ftree-scroll{flex:1;min-height:0;overflow-y:auto;padding:10px 8px}.ft-row{display:flex;align-items:center;gap:6px;padding:5px 8px;border-radius:var(--radius-sm);cursor:pointer}.ft-row:hover{background:var(--surface)}.ft-row.selected,.ft-row.selected:hover{background:var(--panel)}.ft-chevron{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ft-chevron.open{transform:rotate(90deg)}.ft-chevron.spacer{visibility:hidden}.ft-title{flex:1;min-width:0;font-size:var(--fs-md);font-weight:var(--fw-medium);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ft-dirname,.ft-name{flex:1;min-width:0;font-family:var(--mono);font-size:var(--fs-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ft-dirname{color:var(--text)}.ft-thumb{width:18px;height:18px;object-fit:cover;border-radius:var(--radius-xs);border:1px solid var(--border-variant);flex-shrink:0}.ft-divider{padding:12px 8px 4px;font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--muted)}.ftree-footer{flex-shrink:0;display:flex;align-items:center;gap:2px;padding:5px 8px;border-top:1px solid var(--border-variant)}.ftree-footer code{flex:1;min-width:0;direction:rtl;text-align:left;font-family:var(--mono);font-size:var(--fs-xs);color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-footer .icon-btn{width:22px;height:22px}.fpreview{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0;background:var(--base)}.fpreview-none{align-items:center;justify-content:center;gap:8px;font-size:var(--fs-md);color:var(--muted)}.fpreview-head{height:40px;display:flex;align-items:center;gap:8px;padding:0 14px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.fpreview-path{font-family:var(--mono);font-size:var(--fs-sm);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fpreview-date,.fpreview-size{font-size:var(--fs-xs);color:var(--muted);white-space:nowrap;flex-shrink:0}.fpreview-body{flex:1;min-height:0;overflow:auto}.fpreview-body.doc{padding:18px 28px 48px}.fpreview-body.doc .report-md{max-width:var(--readable-col);margin:0 auto}.fpreview-image{display:flex;align-items:flex-start;justify-content:center;padding:24px}.fpreview-image img{max-width:100%;height:auto;border:1px solid var(--border);border-radius:var(--radius-sm)}.fpreview-pdf{display:block;width:100%;height:100%;border:0}.files-empty-state{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:24px;text-align:center;color:var(--muted)}.files-empty-state h3{margin:6px 0 0;font-size:var(--fs-base);font-weight:var(--fw-semibold);color:var(--text)}.files-empty-state p{margin:0;max-width:420px;font-size:var(--fs-md);line-height:1.55;color:var(--subtext)}.files-empty-state .ftree-footer{margin-top:10px;max-width:100%;border:1px solid var(--border);border-radius:var(--radius-md);padding:6px 10px;background:var(--base)}.files-empty-state .ftree-footer code{max-width:380px}.files-truncated{margin:0;padding:8px 14px;font-size:var(--fs-xs);color:var(--muted)}.report-md{font-size:var(--fs-lg)}.report-md h1{font-size:2em;line-height:1.18;margin:28px 0 14px}.report-md h2{font-size:1.5em;line-height:1.25;margin:28px 0 10px}.report-md h3{font-size:1.2em;line-height:1.35;margin:22px 0 8px}.report-md h4{font-size:1em;line-height:1.4;margin:18px 0 6px}.report-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.report-md .report-img{display:block;margin:12px 0}.report-md .report-img img{max-width:100%;height:auto;border:1px solid var(--border);border-radius:var(--radius-sm)}.report-md .report-img-caption{display:block;margin-top:4px;text-align:center;font-size:var(--fs-sm);color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:var(--radius-md) var(--radius-md) 0 0}.diff-file-header .chev{color:var(--muted);font-size:var(--fs-2xs);flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:var(--fs-xs);font-weight:var(--fw-semibold);color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:var(--fs-2xs);font-weight:var(--fw-medium);font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:var(--fs-md)}.truncated-notice{border:1px solid var(--accent-amber);border-radius:var(--radius-md);background:var(--accent-amber-subtle);padding:12px 14px;font-size:var(--fs-md)}.truncated-notice h4{margin:0 0 4px;font-size:var(--fs-md);color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:var(--fs-sm);line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:var(--fs-3xl)}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:var(--fs-md);white-space:pre-wrap;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--text);font-size:var(--fs-md)}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:var(--fs-md);margin:4px 0 0}.muted{color:var(--muted)}.compute-list{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}.compute-row{background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg)}.compute-row-head{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;-webkit-user-select:none;user-select:none}.compute-row-head:hover{background:var(--surface);border-radius:var(--radius-lg)}.compute-row.open .compute-row-head:hover{border-radius:var(--radius-lg) var(--radius-lg) 0 0}.compute-row-logo{display:inline-flex;align-items:center;flex:none}.compute-row-name{font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);flex:none}.compute-row-summary{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:var(--fs-sm)}.compute-row-head .badge,.compute-make-default,.compute-default-pill{flex:none}.compute-default-pill{color:var(--primary);border-color:var(--primary)}.compute-chevron-btn{flex:none;display:inline-flex;align-items:center;padding:2px;border-radius:var(--radius-sm)}.compute-chevron-btn:hover{background:var(--panel)}.compute-chevron{color:var(--muted);transition:transform .12s ease}.compute-row.open .compute-chevron{transform:rotate(180deg)}.compute-row-body{border-top:1px solid var(--border);padding:14px}.compute-row-body .settings-card{margin-bottom:0;margin-top:14px}.compute-default-note{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.compute-flavor-form{margin-bottom:14px}.compute-flavor-form label{max-width:320px}.compute-flavor-hint{font-size:var(--fs-sm)}.compute-footnote{display:flex;align-items:flex-start;gap:6px;margin:2px 0 0;font-size:var(--fs-sm);color:var(--muted)}.compute-footnote svg{flex:none;margin-top:1px}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:var(--fs-md);table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:var(--fs-md)}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:var(--fw-medium);color:var(--text)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:var(--fs-xs)}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-size:var(--fs-md);color:var(--text);padding:5px 8px;border-radius:var(--radius-sm)}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:var(--fs-md);color:var(--text);padding:5px 4px;border-radius:var(--radius-sm)}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.composer-bare.context-ring{display:inline-flex;align-items:center;margin-right:8px}.context-meter-menu{width:280px;padding:10px 12px 12px}.context-meter-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:var(--fs-sm);color:var(--muted)}.context-meter-value{color:var(--text);font-variant-numeric:tabular-nums}.context-meter-menu .progress{margin:8px 0 0}.context-meter-menu .progress-track{height:5px;border:none;background:var(--border)}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:var(--fw-regular)}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:var(--fs-md);outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:var(--fs-md);border-radius:var(--radius-sm)}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:var(--fs-2xs);color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:var(--fs-xs);color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:var(--fs-xs);color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:var(--radius-sm)}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-size:var(--fs-md)}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:var(--fs-sm);color:var(--subtext)}.skill-chip{display:inline-flex;align-items:center;padding:1px 7px;font-family:var(--mono);font-size:var(--fs-md);font-weight:var(--fw-medium);color:var(--primary);background:var(--primary-subtle);border:1px solid var(--border-variant);border-radius:var(--radius-sm)}.composer-input{position:relative;display:flex;overflow:hidden}.composer-input textarea{flex:1}.composer-chip{position:absolute;top:9px;left:12px;z-index:1;pointer-events:none}.msg-user .skill-chip{margin-right:2px;vertical-align:baseline}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);color:var(--text);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:var(--fs-sm);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-ref{font-family:var(--mono);font-size:var(--fs-xs);color:var(--muted);border:1px solid var(--border-variant);border-radius:var(--radius-sm);padding:1px 6px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-codewrap{display:flex;align-items:flex-start;min-width:max-content}.file-view-gutter,.file-view-code{margin:0;padding-top:14px;padding-bottom:14px;font-family:var(--mono);font-size:var(--fs-sm);line-height:1.55}.file-view-gutter{padding-left:14px;padding-right:10px;text-align:right;color:var(--muted);-webkit-user-select:none;user-select:none;position:sticky;left:0;background:var(--base);border-right:1px solid var(--border-variant);flex-shrink:0}.file-view-code{padding-left:16px;padding-right:16px;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:var(--fs-sm);color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:var(--fs-base)}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.readonly{opacity:.6}.prompt-head{font-size:var(--fs-xs);font-weight:var(--fw-semibold);color:var(--text)}.prompt-head code{font-family:var(--mono);font-size:var(--fs-sm);color:var(--text)}.prompt-sub{font-size:var(--fs-sm);color:var(--subtext);word-break:break-word}.prompt-q{font-size:var(--fs-base);font-weight:var(--fw-semibold);line-height:1.5;color:var(--text)}.prompt-plan{font-size:var(--fs-base);line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:var(--fs-md);font-weight:var(--fw-semibold)}.prompt-option-desc{display:block;font-size:var(--fs-sm);font-weight:var(--fw-regular);line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:var(--fs-sm);font-weight:var(--fw-semibold);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-collapsed{color:var(--muted);font-size:var(--fs-md);margin:4px 0}.prompt-collapsed summary{display:flex;align-items:baseline;gap:8px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none}.prompt-collapsed summary::-webkit-details-marker{display:none}.prompt-collapsed summary:after{content:"›";color:var(--muted);transition:transform 80ms ease}.prompt-collapsed[open] summary:after{transform:rotate(90deg)}.prompt-collapsed-title{font-weight:var(--fw-semibold);word-break:break-word}.prompt-outcome{font-size:var(--fs-sm);color:var(--subtext);word-break:break-word}.prompt-outcome.approved,.prompt-outcome.chosen{color:var(--accent-green)}.prompt-outcome.approved:before,.prompt-outcome.chosen:before{content:"✓ "}.prompt-outcome.revised,.prompt-outcome.rejected{color:var(--accent-amber)}.prompt-collapsed-body{margin-top:6px;padding-left:12px;border-left:2px solid var(--border);font-size:var(--fs-md);color:var(--subtext)}.prompt-collapsed-options{margin:6px 0 0;padding-left:18px}.prompt-collapsed-options .sel{color:var(--text);font-weight:var(--fw-semibold)}.prompt-collapsed-note{margin-top:6px;font-style:italic}.plan-strip{position:relative;width:100%;margin:0 0 10px;padding:11px 13px;display:flex;flex-direction:column;align-items:stretch;gap:10px;border:1px solid var(--border);border-left:3px solid var(--accent-blue);border-radius:var(--radius-md);background:var(--surface);box-shadow:0 2px 10px #0000000f}.plan-strip-info{display:flex;align-items:baseline;gap:8px;min-width:0}.plan-strip-open{margin-left:auto;padding:0;border:none;background:none;color:var(--accent-blue);font-size:var(--fs-md);cursor:pointer;white-space:nowrap;flex-shrink:0}.plan-strip-open:hover{text-decoration:underline}.plan-strip-spacer{flex:1}.plan-strip-revise-input{width:100%;resize:none;border:1px solid var(--border);border-radius:var(--radius-md);padding:9px 11px;font-size:var(--fs-md);font-family:inherit;background:var(--base);color:var(--text)}.plan-strip-revise-input:focus{border-color:var(--accent-blue)}.plan-strip-icon{color:var(--accent-blue);flex-shrink:0;align-self:center}.plan-strip-title{font-size:var(--fs-md);font-weight:var(--fw-semibold);white-space:nowrap}.plan-strip-actions{gap:6px 8px;justify-content:flex-end}.plan-strip-actions .btn-primary,.plan-strip-actions .btn-ghost{background:transparent;border:1px solid var(--text);color:var(--text)}.plan-strip-actions .btn-primary:hover:not(:disabled),.plan-strip-actions .btn-ghost:hover:not(:disabled){background:var(--surface-2, rgb(0 0 0 / 5%));border-color:var(--text);color:var(--text);opacity:1}.plan-strip-actions .plan-strip-primary{background:var(--text);border-color:var(--text);color:var(--base)}.plan-strip-actions .plan-strip-primary:hover:not(:disabled){background:color-mix(in oklab,var(--text) 85%,var(--base));border-color:var(--text);color:var(--base)}.plan-strip-approve{position:relative;display:flex}.plan-strip-approve .btn-primary:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.plan-strip-actions .plan-strip-caret{border-top-left-radius:0;border-bottom-left-radius:0;padding:0 6px;display:flex;align-items:center;border-left:1px solid color-mix(in oklab,var(--base) 35%,var(--text))}.plan-strip-menu{position:absolute;right:0;bottom:calc(100% + 4px);display:flex;flex-direction:column;min-width:190px;padding:4px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface);box-shadow:0 6px 20px #0000001f;z-index:6}.plan-strip-menu button{text-align:left;padding:7px 9px;border:none;border-radius:var(--radius-sm);background:transparent;color:var(--text);font-size:var(--fs-md);cursor:pointer}.plan-strip-menu button:hover{background:var(--surface-2, rgb(0 0 0 / 5%))}.prompt-plan.clamped{max-height:9.5em;overflow:hidden;position:relative}.prompt-plan.clamped:after{content:"";position:absolute;inset:auto 0 0 0;height:34px;background:linear-gradient(to bottom,transparent,var(--surface));pointer-events:none}.prompt-plan-open{align-self:flex-start;border:none;background:transparent;color:var(--accent-blue);font-size:var(--fs-sm);padding:0;cursor:pointer}.prompt-plan-open:hover{text-decoration:underline}.code-tab{display:flex;flex-direction:column;height:100%;min-height:0}.code-tab-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-select{max-width:280px;min-width:0;padding:3px 8px;font-size:var(--fs-sm)}.code-tab-note{padding:8px 16px;font-size:var(--fs-sm);color:var(--muted);border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.code-tree{padding:6px 0;font-size:var(--fs-md)}.code-tree-row{display:flex;align-items:center;gap:6px;width:100%;padding:3px 10px;border:none;background:transparent;color:var(--text);text-align:left;cursor:pointer;font-family:inherit;font-size:inherit}.code-tree-row:hover{background:var(--panel)}.code-tree-row>svg{flex-shrink:0;color:var(--subtext)}.code-tree-row>svg.code-tree-chev{color:var(--muted)}.code-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wt-branch-chip{display:inline-flex;align-items:center;gap:4px;min-width:0;padding:2px 8px;border-radius:var(--radius-full);background:color-mix(in oklab,var(--text) 8%,transparent);color:var(--subtext);font-size:var(--fs-xs)}.wt-branch-chip>svg{flex-shrink:0}.wt-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono)}.wt-count{padding:0;border:none}.wt-changes{padding:0 16px 24px}.wt-changes>:first-child{margin-top:14px}.wt-empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:48px 24px;text-align:center;color:var(--muted)}.wt-empty>svg{color:var(--subtext)}.wt-empty p{margin:0;max-width:320px;font-size:var(--fs-sm)}.tour-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:200}.tour-dim{position:absolute;top:0;right:0;bottom:0;left:0;background:#0000008c}.tour-spotlight{position:absolute;border-radius:var(--radius-lg);box-shadow:0 0 0 9999px #0000008c;transition:all .3s ease}.tour-ring{position:absolute;border-radius:var(--radius-lg);border:2px solid var(--primary);transition:all .3s ease}.tour-card{position:absolute;width:390px;max-width:calc(100vw - 32px);background:var(--base);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:0 24px 60px #00000038;padding:21px 23px 0;transition:left .2s ease,top .2s ease}.tour-card.centered{left:50%;top:50%;transform:translate(-50%,-50%);transition:none}.tour-card h3{margin:0 26px 7px 0;font-size:var(--fs-lg);font-weight:var(--fw-semibold)}.tour-card p{margin:0;font-size:var(--fs-base);line-height:1.55;color:var(--text)}.tour-card .tour-close{position:absolute;top:12px;right:12px}.tour-footer{display:flex;align-items:center;border-top:1px solid var(--border-variant);margin-top:16px;padding:11px 0}.tour-footer-side{flex:1;display:flex}.tour-footer-side.end{justify-content:flex-end}.tour-count{font-size:var(--fs-sm);color:var(--muted);font-variant-numeric:tabular-nums}.tour-arrow{position:absolute;width:12px;height:12px;background:var(--base);rotate:45deg;pointer-events:none}.tour-arrow.above{bottom:-6.5px;left:calc(50% - 6px);border-right:1px solid var(--border);border-bottom:1px solid var(--border)}.tour-arrow.below{top:-6.5px;left:calc(50% - 6px);border-left:1px solid var(--border);border-top:1px solid var(--border)}.tour-arrow.left{right:-6.5px;top:calc(50% - 6px);border-top:1px solid var(--border);border-right:1px solid var(--border)}.tour-arrow.right{left:-6.5px;top:calc(50% - 6px);border-bottom:1px solid var(--border);border-left:1px solid var(--border)}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** +@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;position:relative;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.47"}.katex .katex-mathml{border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .smash{display:inline;line-height:0}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}:root{--diff-background-color:initial;--diff-text-color:initial;--diff-font-family:Consolas,Courier,monospace;--diff-selection-background-color:#b3d7ff;--diff-selection-text-color:var(--diff-text-color);--diff-gutter-insert-background-color:#d6fedb;--diff-gutter-insert-text-color:var(--diff-text-color);--diff-gutter-delete-background-color:#fadde0;--diff-gutter-delete-text-color:var(--diff-text-color);--diff-gutter-selected-background-color:#fffce0;--diff-gutter-selected-text-color:var(--diff-text-color);--diff-code-insert-background-color:#eaffee;--diff-code-insert-text-color:var(--diff-text-color);--diff-code-delete-background-color:#fdeff0;--diff-code-delete-text-color:var(--diff-text-color);--diff-code-insert-edit-background-color:#c0dc91;--diff-code-insert-edit-text-color:var(--diff-text-color);--diff-code-delete-edit-background-color:#f39ea2;--diff-code-delete-edit-text-color:var(--diff-text-color);--diff-code-selected-background-color:#fffce0;--diff-code-selected-text-color:var(--diff-text-color);--diff-omit-gutter-line-color:#cb2a1d}.diff{background-color:var(--diff-background-color);border-collapse:collapse;color:var(--diff-text-color);table-layout:fixed;width:100%}.diff::-moz-selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff::selection{background-color:#b3d7ff;background-color:var(--diff-selection-background-color);color:var(--diff-text-color);color:var(--diff-selection-text-color)}.diff td{padding-bottom:0;padding-top:0;vertical-align:top}.diff-line{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);line-height:1.5}.diff-gutter>a{color:inherit;display:block}.diff-gutter{cursor:pointer;padding:0 1ch;text-align:right;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-gutter-insert{background-color:#d6fedb;background-color:var(--diff-gutter-insert-background-color);color:var(--diff-text-color);color:var(--diff-gutter-insert-text-color)}.diff-gutter-delete{background-color:#fadde0;background-color:var(--diff-gutter-delete-background-color);color:var(--diff-text-color);color:var(--diff-gutter-delete-text-color)}.diff-gutter-omit{cursor:default}.diff-gutter-selected{background-color:#fffce0;background-color:var(--diff-gutter-selected-background-color);color:var(--diff-text-color);color:var(--diff-gutter-selected-text-color)}.diff-code{word-wrap:break-word;padding:0 0 0 .5em;white-space:pre-wrap;word-break:break-all}.diff-code-edit{color:inherit}.diff-code-insert{background-color:#eaffee;background-color:var(--diff-code-insert-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-text-color)}.diff-code-insert .diff-code-edit{background-color:#c0dc91;background-color:var(--diff-code-insert-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-insert-edit-text-color)}.diff-code-delete{background-color:#fdeff0;background-color:var(--diff-code-delete-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-text-color)}.diff-code-delete .diff-code-edit{background-color:#f39ea2;background-color:var(--diff-code-delete-edit-background-color);color:var(--diff-text-color);color:var(--diff-code-delete-edit-text-color)}.diff-code-selected{background-color:#fffce0;background-color:var(--diff-code-selected-background-color);color:var(--diff-text-color);color:var(--diff-code-selected-text-color)}.diff-widget-content{vertical-align:top}.diff-gutter-col{width:7ch}.diff-gutter-omit{height:0}.diff-gutter-omit:before{background-color:#cb2a1d;background-color:var(--diff-omit-gutter-line-color);content:" ";display:block;height:100%;margin-left:4.6ch;overflow:hidden;white-space:pre;width:2px}.diff-decoration{line-height:1.5;-webkit-user-select:none;-moz-user-select:none;user-select:none}.diff-decoration-content{font-family:Consolas,Courier,monospace;font-family:var(--diff-font-family);padding:0}:root{--base: #ffffff;--canvas: #faf8f4;--panel: #f3f0ea;--surface: #faf7f2;--surface-bright: #fdfbfb;--highlight: #fdf3f1;--text: #1d1b1a;--subtext: #737373;--muted: #a1a1a1;--primary: #9a2036;--primary-subtle: #f7e9ec;--secondary: #4a90e2;--error: #e2a100;--border: #d4d4d4;--border-variant: #e5e5e5;--accent-orange: #da642c;--accent-red: #d94654;--accent-teal: #209a84;--accent-blue: #3a8dff;--accent-pink: #ff2b90;--accent-amber: #da9100;--accent-green: #5eb64c;--accent-purple: #9c5cff;--accent-green-subtle: #e7f4e5;--accent-amber-subtle: #fff3e1;--accent-teal-subtle: #e1f3f0;--accent-red-subtle: #fbe9ea;--accent-blue-subtle: #e5f0ff;--accent-purple-subtle: #f1e8ff;--dots-muted: #e3ded5;--dots-strong: #bdb6a8;--mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;--sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;--fs-2xs: 10px;--fs-xs: 11px;--fs-sm: 13px;--fs-md: 14px;--fs-base: 15px;--fs-lg: 16px;--fs-xl: 16px;--fs-2xl: 18px;--fs-3xl: 22px;--fs-4xl: 28px;--fs-5xl: 34px;--fw-regular: 400;--fw-medium: 500;--fw-semibold: 600;--fw-display: 700;--radius-xs: 4px;--radius-sm: 6px;--radius-md: 8px;--radius-lg: 10px;--radius-xl: 12px;--radius-full: 999px;--modal-top: min(30vh, 260px);--term-bg: #1a1a1a;--readable-col: 760px;--bg: var(--base);--bg-canvas: var(--canvas);--surface-2: var(--panel);--border-strong: var(--border);--accent: var(--primary);--teal: var(--accent-teal);--green: var(--accent-green);--red: var(--accent-red);--amber: var(--accent-amber);--purple: var(--accent-purple);color-scheme:light}@media(prefers-color-scheme:dark){:root{--base: #0e0c0c;--canvas: #141110;--panel: #221f1e;--surface: #1d1b1a;--surface-bright: #130f0f;--highlight: #393433;--text: #e6e1e0;--subtext: #a68e8b;--muted: #737373;--primary: #ffb3ad;--primary-subtle: #33191b;--secondary: #3e7fcf;--error: #ffb951;--border: #525252;--border-variant: #404040;--accent-amber: #e67e22;--accent-green-subtle: #1c2b18;--accent-amber-subtle: #33260f;--accent-teal-subtle: #12332d;--accent-red-subtle: #331418;--accent-blue-subtle: #10233a;--accent-purple-subtle: #251933;--dots-muted: #2a2523;--dots-strong: #555555;color-scheme:dark}}*{box-sizing:border-box}html,body,#root{height:100%;margin:0}body{background:var(--base);color:var(--text);font-family:var(--sans);font-size:var(--fs-base);line-height:1.45;overflow:hidden}::selection{background:var(--highlight)}button{font:inherit;color:inherit;background:none;border:none;cursor:pointer;padding:0}input,textarea,select{font:inherit;color:var(--text);background:var(--base);border:1px solid var(--border);border-radius:var(--radius-md);padding:6px 10px;outline:none}input:focus,textarea:focus,select:focus{border-color:var(--text)}input::placeholder,textarea::placeholder{color:var(--muted);opacity:1}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-thumb{background:var(--border);border-radius:var(--radius-sm);border:2px solid transparent;background-clip:padding-box}::-webkit-scrollbar-track{background:transparent}@keyframes pulse{50%{opacity:.35}}@keyframes spin{to{transform:rotate(360deg)}}.app{display:flex;flex-direction:column;height:100%}.app-body{display:flex;flex:1;min-height:0;padding:0 14px}.home{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges;background:var(--canvas)}.home-inner{max-width:620px;margin:0 auto;padding:48px 24px 64px}.wordmark{display:inline-flex;align-items:center;gap:.4em;color:var(--text)}.wordmark svg{width:1em;height:1em;flex-shrink:0}.home-brand{font-weight:var(--fw-display);font-size:var(--fs-4xl);letter-spacing:-.02em;margin-bottom:36px}.home-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:18px}.home-head h2{margin:0;font-size:var(--fs-2xl);letter-spacing:-.01em}.home-list{display:flex;flex-direction:column;gap:10px}.project-card{position:relative;display:flex;flex-direction:column;gap:4px;text-align:left;padding:14px 16px;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);cursor:pointer;transition:border-color .12s ease,box-shadow .12s ease}.project-card:hover{border-color:var(--text);box-shadow:0 2px 10px #0000000f}.project-delete{position:absolute;top:10px;right:10px;display:none;padding:5px;border-radius:var(--radius-sm);color:var(--muted);line-height:0}.project-card:hover .project-delete{display:block}.project-delete:hover{color:var(--danger, #d33);background:var(--overlay, rgba(0, 0, 0, .05))}.project-card .name{font-weight:var(--fw-semibold);font-size:var(--fs-base)}.project-card .repo{color:var(--text)}.project-card .paper,.project-card .time{font-size:var(--fs-xs);color:var(--muted)}.rail-brand{display:flex;align-items:center;gap:4px;height:48px;padding:0 8px 0 12px;border-bottom:1px solid var(--border);flex-shrink:0}.rail-brand .brand{display:flex;align-items:center;gap:8px;flex:1;min-width:0;font-weight:var(--fw-semibold);font-size:var(--fs-base);color:var(--text);padding:4px 6px 4px 0;border-radius:var(--radius-sm)}.rail-brand .brand:hover{color:var(--subtext)}.rail-brand .brand svg{flex-shrink:0}.rail-brand .brand .brand-project{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-btn{position:relative;display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;color:var(--subtext)}.icon-btn:hover{color:var(--text);background:var(--surface)}[data-tip]{position:relative}[data-tip]:after{content:attr(data-tip);position:absolute;top:calc(100% + 6px);right:-4px;background:var(--text);color:var(--base);font-size:var(--fs-xs);font-weight:var(--fw-medium);line-height:1;padding:5px 8px;border-radius:var(--radius-sm);white-space:nowrap;opacity:0;visibility:hidden;pointer-events:none;transition:opacity .1s ease .3s,visibility 0s linear .4s;z-index:60}[data-tip]:hover:after{opacity:1;visibility:visible}.tip-up[data-tip]:after{top:auto;bottom:calc(100% + 6px)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;padding:6px 14px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base);color:var(--text);white-space:nowrap;transition:background .12s ease,border-color .12s ease,color .12s ease}.btn:hover:not(:disabled){background:var(--surface)}.btn:active:not(:disabled){background:var(--highlight)}.btn:disabled{opacity:.45;cursor:default}.btn.primary{background:var(--primary);border-color:var(--primary);color:var(--base)}.btn.primary:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text));border-color:color-mix(in oklab,var(--primary) 88%,var(--text))}.btn.primary:active:not(:disabled){background:color-mix(in oklab,var(--primary) 80%,var(--text));border-color:color-mix(in oklab,var(--primary) 80%,var(--text))}.btn.danger{color:var(--accent-red)}.btn.danger:hover:not(:disabled){background:color-mix(in oklab,var(--accent-red) 8%,transparent)}.btn.danger:active:not(:disabled){background:color-mix(in oklab,var(--accent-red) 14%,transparent)}.btn.ghost{border-color:transparent;color:var(--text)}.btn.ghost:hover:not(:disabled){color:var(--text);background:var(--surface)}.btn.sm{padding:3px 9px;font-size:var(--fs-xs);border-radius:var(--radius-sm)}.status-badge{display:inline-flex;align-items:center;gap:6px;font-size:var(--fs-sm);font-weight:var(--fw-medium);color:var(--text);white-space:nowrap}.status-badge .dot{width:7px;height:7px;border-radius:50%;background:currentColor;flex-shrink:0}.status-badge.live .dot{animation:pulse 1.2s ease-in-out infinite}.st-done .dot,.st-done>svg{color:var(--accent-green)}.st-failed .dot{color:var(--accent-red)}.st-running .dot{color:var(--accent-teal)}.st-starting .dot{color:var(--accent-amber)}.st-cancelled .dot{color:var(--accent-orange)}.st-editing .dot{color:var(--accent-purple)}.st-idle .dot{color:var(--muted)}.floating-panel{border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 6px 24px color-mix(in oklab,var(--text) 5%,transparent),0 1px 4px color-mix(in oklab,var(--text) 4%,transparent);overflow:hidden}.session-rail{width:232px;flex-shrink:0;display:flex;flex-direction:column;margin:10px 14px 10px 0;background:var(--base);min-height:0}.rail-nav{display:flex;flex-direction:column;gap:2px;padding:8px;flex-shrink:0}.rail-nav-item{display:flex;align-items:center;gap:10px;padding:7px 10px;font-size:var(--fs-base);color:var(--text);border-radius:var(--radius-md);text-align:left}.rail-nav-item:hover{background:var(--surface)}.rail-nav-item.active{background:var(--panel);font-weight:var(--fw-semibold)}.rail-section-label{padding:10px 10px 6px;font-size:var(--fs-md);font-weight:var(--fw-medium);color:var(--subtext)}.rail-section-head{display:flex;align-items:center;justify-content:space-between}.rail-filter{position:relative;display:inline-flex;margin-right:2px}.rail-filter-btn{width:24px;height:24px;border-radius:var(--radius-sm)}.rail-empty{padding:6px 10px;font-size:var(--fs-md);color:var(--muted)}.session-rail .rail-body{flex:1;min-height:0;overflow-y:auto;padding:4px 8px}.chat-pane{flex:1;min-width:0;display:flex;flex-direction:column;background:var(--base);min-height:0}.right-pane{position:relative;flex-shrink:0;min-width:0;display:flex;flex-direction:column;margin:10px 0 10px 14px;background:var(--canvas)}.right-pane.max{position:fixed;top:10px;right:10px;bottom:10px;left:10px;margin:0;z-index:60;box-shadow:0 12px 40px color-mix(in oklab,var(--text) 22%,transparent)}.panel-resizer{position:absolute;left:0;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.panel-resizer:hover,.panel-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.panel-controls{display:inline-flex;align-items:center;gap:2px;flex-shrink:0}.tabs{display:flex;align-items:center;gap:4px;padding:0 10px;height:40px;border-bottom:1px solid var(--border);background:var(--base);flex-shrink:0}.tab-strip{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow-x:auto;scrollbar-width:none}.tab-strip::-webkit-scrollbar{display:none}.tab.closable{max-width:176px;padding-right:4px}.tab .tab-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tab .tab-close{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;border-radius:var(--radius-xs);color:var(--muted);flex-shrink:0}.tab .tab-close:hover{background:color-mix(in oklab,var(--text) 15%,transparent);color:var(--text)}.tab{display:inline-flex;align-items:center;gap:6px;padding:5px 12px;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);border-radius:var(--radius-sm);white-space:nowrap;flex-shrink:0}.tab.active{background:var(--surface)}.tab-body{flex:1;min-height:0;position:relative;display:flex;flex-direction:column}.pane-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:10px 12px 0;flex-shrink:0}.pane-content{flex:1;min-height:0;position:relative}.plan-tab-content{overflow-y:auto;background:var(--base);padding:18px 24px}.plan-tab-content .md{max-width:var(--readable-col)}.subagent-tab-content{overflow-y:auto;background:var(--base);padding:12px 16px}.subagent-tab-header{display:flex;align-items:center;gap:8px;padding-bottom:8px;margin-bottom:8px;border-bottom:1px solid var(--border-variant)}.subagent-live{flex-shrink:0;font-size:var(--fs-xs);color:var(--accent-amber)}.seg{display:inline-flex;align-items:center;gap:2px;padding:3px;border-radius:var(--radius-md);background:color-mix(in oklab,var(--text) 10%,transparent)}.seg button{padding:3px 12px;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);border-radius:var(--radius-sm)}.seg button:not(:disabled):hover{color:var(--text)}.seg button.active{background:var(--base);box-shadow:0 1px 3px color-mix(in oklab,var(--text) 25%,transparent)}.seg button:disabled{color:var(--muted);cursor:default}.chat-header{display:flex;align-items:center;gap:8px;padding:0 16px;background:var(--base);flex-shrink:0;height:48px;position:relative;z-index:4;width:100%;max-width:var(--readable-col);margin:0 auto}.chat-header.rail-hidden{max-width:none;padding:0 2px}.chat-header.rail-hidden>.icon-btn:first-child{margin-right:12px}.chat-header:after{content:"";position:absolute;top:100%;left:0;right:0;height:24px;background:linear-gradient(to bottom,var(--base),transparent);pointer-events:none}.chat-header .title{font-size:var(--fs-base);font-weight:var(--fw-semibold);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.session-row{position:relative;display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:7px 10px;border-radius:var(--radius-md);font-size:var(--fs-md);color:var(--text);cursor:pointer;-webkit-user-select:none;user-select:none}.session-row:hover{background:var(--surface)}.session-row.active{background:var(--surface);font-weight:var(--fw-medium)}.session-row .session-dot{width:14px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0}.session-row .session-title{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.title-reveal-char{display:inline-block;animation:title-char-in .24s ease-out both}@keyframes title-char-in{0%{opacity:0;filter:blur(4px);transform:translateY(.15em)}}@media(prefers-reduced-motion:reduce){.title-reveal-char{animation:none}}.session-row .session-time{font-size:var(--fs-2xs);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn{display:none;align-items:center;justify-content:center;width:18px;height:18px;margin:-2px 0;border-radius:var(--radius-sm);color:var(--muted);flex-shrink:0}.session-row .session-menu-btn:hover{color:var(--text);background:var(--panel)}.session-row:hover .session-menu-btn,.session-row:focus-within .session-menu-btn,.session-row.menu-open .session-menu-btn{display:inline-flex}.session-row:hover .session-time,.session-row:focus-within .session-time,.session-row.menu-open .session-time{display:none}.session-row .busy-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);animation:pulse 1.2s infinite;flex-shrink:0}.session-row .busy-dot.waiting{animation:none}.session-row .session-title-input{flex:1;min-width:0;padding:1px 5px;margin:-2px 0;font:inherit;color:var(--text);background:var(--base);border:1px solid var(--primary);border-radius:var(--radius-sm);outline:none}.session-row.editing{background:var(--surface);cursor:default}.session-row.editing .session-menu-btn,.session-row.editing .session-time{display:none}.chat-thread{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.chat-thread-inner{max-width:var(--readable-col);margin:0 auto;padding:16px 16px 32px;display:flex;flex-direction:column;gap:16px}.chat-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;color:var(--text);padding:20px;text-align:center}.chat-empty h2{margin:0;font-size:var(--fs-5xl);font-weight:var(--fw-display);letter-spacing:-.02em;color:var(--text)}.chat-empty .chat-empty-hint{font-size:var(--fs-md);color:var(--muted);max-width:340px;text-align:center}.chat-empty p{margin:0;font-size:var(--fs-base);max-width:320px}.chat-empty .chat-suggest{font-family:var(--mono);font-size:var(--fs-md);color:var(--text);background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-full);padding:6px 14px;cursor:pointer;transition:border-color .12s ease}.chat-empty .chat-suggest:hover{border-color:var(--text)}.chat-loading{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;color:var(--subtext);font-size:var(--fs-xl);padding:20px}.chat-loading .spinner{width:22px;height:22px;border-width:3px}.msg-user{align-self:flex-end;max-width:88%;background:var(--surface);border-radius:16px;padding:10px 15px;font-size:var(--fs-base);white-space:pre-wrap;word-break:break-word}.msg-images{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}.msg-images img{max-width:220px;max-height:160px;border:1px solid var(--border-variant);border-radius:var(--radius-xs);display:block}.msg-assistant{font-size:var(--fs-lg);line-height:1.62;color:var(--text);min-width:0}.reasoning{color:var(--muted);font-size:var(--fs-md);margin:2px 0}.reasoning summary{cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;font-weight:var(--fw-semibold)}.reasoning[open]{white-space:pre-wrap}.tool-group{margin:2px 0}.tool-group-summary{display:flex;align-items:center;gap:8px;width:100%;padding:3px 2px;cursor:pointer;color:var(--muted);font-size:var(--fs-md);text-align:left;border-radius:var(--radius-sm)}.tool-group-summary:hover{color:var(--subtext);background:var(--surface)}.tool-group.has-error .tool-group-summary{color:var(--accent-red)}.tool-group.has-error>.tool-row .tool-line{color:var(--accent-red)}.tool-chevron{flex-shrink:0;color:var(--muted);transition:transform .12s ease}.tool-chevron.open{transform:rotate(90deg)}.tool-group-rows{display:flex;flex-direction:column;gap:1px;margin:2px 0 4px 7px;padding-left:10px;border-left:1px solid var(--border-variant)}.subagent-row{display:flex;align-items:center;gap:8px;width:100%;margin:2px 0;padding:3px 4px;cursor:pointer;color:var(--text);font-size:var(--fs-base);text-align:left;border-radius:var(--radius-sm)}.subagent-row:hover:not(:disabled){background:var(--surface)}.subagent-row:disabled{cursor:default}.subagent-row.has-error{color:var(--accent-red)}.subagent-row .tool-line{font-size:var(--fs-base);color:var(--text)}.subagent-row-chevron,.subagent-icon{flex-shrink:0;color:var(--muted)}.subagent-empty{padding:3px 4px;font-size:var(--fs-md);color:var(--muted)}.tool-row{display:flex;flex-direction:column}.tool-row summary{display:flex;align-items:center;gap:8px;padding:3px 4px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none;min-width:0;border-radius:var(--radius-sm)}.tool-row summary:hover{background:var(--surface)}.tool-row summary::-webkit-details-marker{display:none}.tool-line{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-md);color:var(--subtext)}.tool-open{flex-shrink:0;font-size:var(--fs-xs);color:var(--primary)}.tool-open:hover{text-decoration:underline}.tool-status{width:6px;height:6px;border-radius:50%;flex-shrink:0;background:var(--muted)}.tool-status.running{background:var(--accent-amber);animation:pulse 1.2s ease-in-out infinite}.tool-status.error{background:var(--accent-red)}.tool-detail{margin:2px 0 4px 14px}.tool-cmd-full{padding:6px 10px;font-family:var(--mono);font-size:var(--fs-xs);color:var(--text);background:var(--surface);border-radius:var(--radius-sm);white-space:pre-wrap;word-break:break-word}.tool-output{margin-top:3px;padding:6px 10px;font-family:var(--mono);font-size:var(--fs-xs);color:var(--subtext);white-space:pre-wrap;word-break:break-word;max-height:260px;overflow-y:auto;background:var(--base);border:1px solid var(--border-variant);border-radius:var(--radius-sm)}.working{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:var(--fs-md);padding:2px 0 8px}.working.awaiting{font-style:italic}.spinner{width:13px;height:13px;border:2px solid var(--border);border-top-color:var(--primary);border-radius:50%;animation:spin .8s linear infinite;flex-shrink:0}.composer{padding:0 12px 12px;flex-shrink:0;position:relative;z-index:4;background:var(--base);width:100%;max-width:var(--readable-col);margin:0 auto}.composer:before{content:"";position:absolute;bottom:100%;left:0;right:0;height:24px;background:linear-gradient(to top,var(--base),transparent);pointer-events:none}.composer-box{position:relative;display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base)}.composer textarea{border:none;background:none;resize:none;padding:10px 12px 4px;font-size:var(--fs-base);field-sizing:content;min-height:52px;max-height:180px}.composer-attachments{display:flex;flex-wrap:wrap;gap:6px;padding:8px 12px 0}.attachment-thumb{position:relative}.attachment-thumb img{width:52px;height:52px;object-fit:cover;border:1px solid var(--border);border-radius:var(--radius-sm);display:block}.attachment-thumb button{position:absolute;top:-5px;right:-5px;display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;padding:0;border:1px solid var(--border);border-radius:50%;background:var(--surface);color:var(--text);cursor:pointer}.attachment-thumb button:hover{background:var(--text);color:var(--base)}.composer-actions{display:flex;justify-content:flex-end;align-items:center;gap:8px;padding:6px 8px 8px}.send-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:var(--radius-md);background:var(--primary);color:var(--base);transition:background .1s ease,opacity .1s ease}.send-btn:hover:not(:disabled){background:color-mix(in oklab,var(--primary) 88%,var(--text))}.send-btn:disabled{opacity:.4;cursor:default}.send-btn.stop{background:var(--surface);color:var(--text)}.send-btn.stop:hover:not(:disabled){background:color-mix(in oklab,var(--surface) 88%,var(--text))}.md{min-width:0;word-break:break-word;color:var(--text);line-height:1.62}.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p{margin:10px 0}.md strong{color:var(--text);font-weight:var(--fw-semibold)}.md pre{background:var(--surface);border:1px solid color-mix(in oklab,var(--border) 50%,transparent);border-radius:var(--radius-md);padding:8px 12px;overflow-x:auto;font-size:var(--fs-sm);color:var(--text)}.md code{font-family:var(--mono);font-size:.9em;font-weight:var(--fw-medium);color:var(--primary);background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-xs);padding:1px 5px}.md .katex{font-size:1.05em}.md .katex-display{margin:12px 0;overflow-x:auto;overflow-y:hidden;padding:2px 0}.md .file-chip{display:inline-flex;align-items:center;gap:4px;max-width:100%;margin:0 1px;padding:0 6px;vertical-align:baseline;font-family:var(--mono);font-size:.9em;font-weight:var(--fw-medium);color:var(--text);background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-xs);cursor:pointer}.md .file-chip:hover:not(:disabled){background:var(--surface);color:var(--primary)}.md .file-chip svg{flex:none;opacity:.6}.md .file-chip-label{max-width:260px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.md pre code{background:none;border:none;color:inherit;padding:0;font-weight:var(--fw-regular)}.md-code{position:relative;margin:10px 0}.md-code pre{margin:0}.md-code-copy{position:absolute;top:6px;right:6px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;color:var(--muted);background:var(--base);border:1px solid var(--border-variant);border-radius:var(--radius-sm);opacity:0;transition:opacity .12s ease,color .12s ease}.md-code:hover .md-code-copy{opacity:1}.md-code-copy:hover{color:var(--text);border-color:var(--muted)}.md h1,.md h2,.md h3,.md h4{color:var(--text);font-size:1.05em;font-weight:var(--fw-semibold);margin:12px 0 6px}.md ul,.md ol{margin:6px 0;padding-left:22px}.md li::marker{color:var(--primary)}.md a{color:var(--primary)}.md table{border-collapse:collapse;display:block;width:max-content;max-width:100%;font-size:var(--fs-md);margin:10px 0;border:1px solid var(--border);border-radius:var(--radius-md);overflow-x:auto}.md th,.md td{border-bottom:1px solid var(--border-variant);padding:8px 14px;text-align:left;color:var(--text);word-break:normal;overflow-wrap:break-word}.md tr:last-child td{border-bottom:none}.md thead th{background:var(--surface);font-weight:var(--fw-medium);color:var(--text);border-bottom:1px solid var(--border)}.md tbody tr:hover td{background:var(--surface-bright)}.md blockquote{margin:6px 0;padding:2px 0 2px 10px;border-left:3px solid var(--border);color:var(--subtext)}.react-flow__node.react-flow__node-exp.selectable{cursor:default}.exp-node{width:264px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base);padding:10px 12px;box-shadow:0 1px 2px #0000000a;font-size:var(--fs-md);transition:box-shadow .12s ease}.exp-node:hover{box-shadow:0 2px 8px #00000014}.exp-node.live{border-color:var(--accent-teal);box-shadow:0 2px 12px #209a8433}.exp-node .node-eyebrow{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:var(--fs-2xs);font-weight:var(--fw-medium);color:var(--muted)}.exp-node .node-head{display:flex;align-items:center;gap:7px;min-width:0}.exp-node .node-status{width:8px;height:8px;border-radius:50%;flex-shrink:0}.exp-node .node-slug{font-family:var(--mono);font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-node .node-title{margin-top:4px;color:var(--text);font-size:var(--fs-sm);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.exp-node .node-meta{margin-top:8px;display:flex;align-items:center;gap:8px;font-size:var(--fs-2xs);color:var(--muted)}.exp-node .node-actions{margin-top:8px;padding-top:6px;border-top:1px solid var(--border-variant);display:flex;align-items:center;gap:3px}.exp-node .node-action{display:inline-flex;align-items:center;gap:5px;padding:3px 6px;font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--text);border-radius:var(--radius-sm);text-decoration:none}.exp-node .node-action:hover{color:var(--text);background:var(--surface)}.exp-node .node-action-ext{margin-left:auto;padding:3px 5px}.react-flow__node.react-flow__node-elided.selectable{cursor:pointer}.elided-node{width:148px;height:44px;display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px dashed var(--border);border-radius:var(--radius-md);background:color-mix(in oklab,var(--text) 3%,transparent);color:var(--muted);font-size:var(--fs-2xs);font-weight:var(--fw-medium);text-align:left;transition:border-color .12s ease,color .12s ease}.elided-node:hover{border-color:var(--text);color:var(--text)}.elided-node .elided-node-label{display:flex;flex-direction:column;line-height:1.3}.elided-node .elided-node-sub{color:var(--muted)}.run-squares{display:flex;align-items:center;gap:3px}.run-sq{width:9px;height:9px;flex-shrink:0}.run-sq.pass{background:var(--accent-green)}.run-sq.fail{border:1.5px solid color-mix(in oklab,var(--accent-red) 55%,transparent)}.run-sq.live{background:var(--accent-teal);animation:pulse 1.2s ease-in-out infinite}.run-sq.other{border:1.5px solid var(--border)}.exp-hover-card{position:fixed;z-index:60;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;padding:14px 16px;font-size:var(--fs-sm);color:var(--text)}.exp-hover-card .hc-mono{font-family:var(--mono)}.exp-hover-card .hc-head{display:flex;align-items:baseline;justify-content:space-between;gap:10px}.exp-hover-card .hc-slug{font-family:var(--mono);font-size:var(--fs-md);font-weight:var(--fw-semibold);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-hover-card .hc-title{margin-top:3px;color:var(--text)}.exp-hover-card .hc-body{margin-top:10px;border-top:1px solid var(--border-variant);padding-top:10px;line-height:1.6;white-space:pre-line;display:-webkit-box;-webkit-line-clamp:10;-webkit-box-orient:vertical;overflow:hidden}.exp-hover-card .hc-body.expanded{display:block;-webkit-line-clamp:unset;max-height:45vh;overflow-y:auto;padding-bottom:4px}.exp-hover-card .hc-toggle{margin-top:4px;font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--muted)}.exp-hover-card .hc-toggle:hover{color:var(--text)}.exp-hover-card .hc-failure{margin-top:8px;color:var(--accent-red);display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.exp-hover-card .hc-stats{margin-top:10px;border-top:1px solid var(--border-variant);padding-top:10px;display:flex;align-items:center;gap:12px;flex-wrap:wrap;font-size:var(--fs-xs);color:var(--text)}.exp-hover-card .hc-git{margin-top:10px;padding-top:8px;border-top:1px solid var(--border-variant);font-size:var(--fs-xs);color:var(--text);display:flex;flex-direction:column;gap:4px}.exp-hover-card .hc-git-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.exp-hover-card .hc-branch{display:inline-flex;align-items:center;gap:4px;font-family:var(--mono);min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.exp-hover-card .hc-foot{margin-top:8px;display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:var(--fs-2xs);color:var(--muted)}.exp-hover-card .hc-foot .hc-mono{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.react-flow__handle{opacity:0;pointer-events:none}.react-flow__attribution{display:none!important}.runs-table-wrap{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto;padding:12px}.runs-table{width:100%;border-collapse:separate;border-spacing:0;font-size:var(--fs-md);background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);overflow:hidden}.runs-table th{text-align:left;color:var(--text);font-size:var(--fs-xs);font-weight:var(--fw-semibold);padding:8px 12px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--base);z-index:1}.runs-table td{padding:8px 12px;border-bottom:1px solid color-mix(in oklab,var(--text) 6%,transparent);white-space:nowrap}.runs-table tr:last-child td{border-bottom:none}.runs-table tr.clickable{cursor:pointer}.runs-table tr.clickable:hover td{background:var(--canvas)}.mono{font-family:var(--mono);font-size:var(--fs-sm)}.instances-section-title{display:flex;align-items:center;gap:8px;margin:22px 0 10px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.instances-section-title .count-badge{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border-radius:var(--radius-md);background:var(--canvas);border:1px solid var(--border);font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--text)}.instances-table-wrap{overflow-x:auto}.instances-empty{margin:0;padding:14px 16px;border:1px solid var(--border);border-radius:var(--radius-lg);background:var(--base);color:var(--subtext);font-size:var(--fs-md)}.backend-cell{display:inline-flex;align-items:center;gap:2px}.backend-cell .icon-btn{width:22px;height:22px}.backend-badge{display:inline-flex;align-items:center;gap:7px}.backend-badge svg{flex:none;display:block}.backend-badge .backend-name{font-weight:var(--fw-medium)}.backend-badge .backend-detail,.backend-badge.muted{color:var(--muted)}.drawer{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--base);display:flex;flex-direction:column;z-index:20}.drawer-body{flex:1;min-height:0;overflow-y:auto;padding:0 16px 24px;display:flex;flex-direction:column;gap:22px}.drawer-body>:first-child{margin-top:18px}.drawer-section h3{margin:0 0 10px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.kv{display:grid;grid-template-columns:auto 1fr;gap:3px 14px;font-size:var(--fs-md)}.kv .k{color:var(--subtext)}.kv .v{font-family:var(--mono);font-size:var(--fs-sm);word-break:break-all}.term-view{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;background:var(--base);z-index:20}.term-bar{display:flex;align-items:center;gap:8px;height:40px;padding:0 10px;border-bottom:1px solid var(--border);flex-shrink:0}.term-title{min-width:0;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.term-bar .error{font-size:var(--fs-sm);color:var(--accent-red)}.term-bar .btn{display:inline-flex;align-items:center;gap:5px}.term-fill{flex:1;min-height:0;background:var(--term-bg);padding:4px 0 4px 6px}.term-empty{height:100%;display:flex;align-items:center;justify-content:center;padding:24px;text-align:center;font-size:var(--fs-md);color:var(--muted)}.run-history{position:relative;flex-shrink:0}.run-picker{display:inline-flex;align-items:center;gap:8px;padding:4px 6px 4px 10px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base);color:var(--text)}.run-picker:hover{background:var(--surface)}.run-picker .run-label{font-size:var(--fs-sm);font-weight:var(--fw-semibold)}.run-picker-chev{color:var(--muted);flex-shrink:0}.history-menu{position:absolute;top:calc(100% + 6px);right:0;min-width:230px;max-height:320px;overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;padding:5px;z-index:50}.history-item{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:var(--fs-sm);border-radius:var(--radius-sm)}.history-item:hover,.history-item.active{background:var(--surface)}.history-item .run-label{font-weight:var(--fw-semibold)}.history-item .when{margin-left:auto;font-size:var(--fs-xs);color:var(--muted)}.changes-branch{display:flex;align-items:center;gap:8px;margin-bottom:10px}.commit-picker{display:flex;align-items:center;gap:8px}.ctl-label{flex-shrink:0;font-size:var(--fs-2xs);font-weight:var(--fw-medium);color:var(--subtext)}.commit-picker select{flex:1;min-width:0;font-family:var(--mono);font-size:var(--fs-sm)}.uncommitted-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--accent-purple);flex-shrink:0}.changes-note{font-size:var(--fs-sm);color:var(--muted)}.empty-state{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:24px;text-align:center;color:var(--subtext)}.empty-state p{max-width:46ch;margin:0;font-size:var(--fs-md);line-height:1.5;text-wrap:balance}.empty-state-cta{gap:6px}.empty-state p.empty-state-title{font-size:var(--fs-2xl);font-weight:var(--fw-regular);color:var(--text)}.empty-state p.empty-state-hint{font-size:var(--fs-lg);color:var(--subtext)}.onboarding .home-inner{max-width:560px;padding-top:96px}.onb-eyebrow{font-size:var(--fs-xl);font-weight:var(--fw-semibold);color:var(--muted);margin-bottom:18px}.onb-title{margin:0 0 6px;font-size:var(--fs-3xl);letter-spacing:-.01em}.onb-sub{color:var(--text);font-size:var(--fs-base);line-height:1.55;margin:0 0 22px;max-width:480px}.onb-cards{display:flex;flex-direction:column;gap:10px}.onb-card{display:flex;flex-direction:column;gap:5px;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);padding:18px 20px}.onb-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.onb-card-name{font-weight:var(--fw-semibold);font-size:var(--fs-base)}.onb-card-detail{font-size:var(--fs-sm)}.onb-card-meta{font-size:var(--fs-sm);color:var(--subtext)}.onb-card-meta code,.model-more code{font-family:var(--mono);font-size:var(--fs-xs);background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-xs);padding:1px 5px;white-space:nowrap}.onb-card-row{display:grid;grid-template-columns:56px 1fr auto;align-items:baseline;gap:12px;padding:3px 0}.onb-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:var(--fs-md);padding:8px 0}.onb-fix{display:flex;align-items:baseline;flex-wrap:wrap;gap:10px;margin:6px 0 9px}.onb-aside{display:flex;flex-direction:column;align-items:flex-start;gap:7px;margin-top:12px;padding-top:10px;border-top:1px solid var(--border-variant)}.onb-aside-text{font-size:var(--fs-xs);color:var(--muted);line-height:1.5}.onb-aside .onb-cmd-chip{max-width:100%}.onb-aside .onb-cmd-chip code{font-size:var(--fs-xs);white-space:normal;word-break:break-word}.onb-fix-label{font-size:var(--fs-md);font-weight:var(--fw-regular);color:var(--text)}.onb-fix-alt{margin-left:auto;padding:0;border:0;background:none;color:var(--muted);font-size:var(--fs-xs);text-decoration:underline;cursor:pointer}.onb-fix-alt:hover{color:var(--text)}.onb-cmd-chip{display:inline-flex;align-items:stretch;align-self:flex-start;max-width:100%;background:var(--panel);border:1px solid var(--border-variant);border-radius:var(--radius-sm);overflow:hidden}.onb-cmd-chip code{font-family:var(--mono);font-size:var(--fs-sm);padding:4px 9px}.onb-cmd-copy{display:inline-flex;align-items:center;flex-shrink:0;padding:0 8px;border:0;border-left:1px solid var(--border-variant);background:none;color:var(--muted);cursor:pointer}.onb-cmd-copy:hover{background:var(--surface);color:var(--text)}.onb-gate-hint{margin:18px 0 0;font-size:var(--fs-base);font-weight:var(--fw-semibold);line-height:1.5;color:var(--text)}.onb-token-form{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin-top:8px}.onb-token-form input{flex:1;min-width:220px;font-family:var(--mono);font-size:var(--fs-sm)}.onb-token-form a{font-size:var(--fs-sm);color:var(--subtext);white-space:nowrap}.onb-token-form .error{flex-basis:100%;color:var(--accent-red);font-size:var(--fs-md);white-space:pre-wrap}.onb-actions{display:flex;align-items:center;gap:10px;margin-top:22px}.form .form-seg{align-self:flex-start;margin-bottom:2px}.form .form-seg button{padding:5px 12px}.form .repo-hint{font-family:var(--mono);font-weight:var(--fw-regular);font-size:var(--fs-xs);color:var(--muted)}.form .repo-hint.ok{color:var(--accent-teal)}.form .paper-results{display:flex;flex-direction:column;border:1px solid var(--border);border-radius:var(--radius-md);max-height:240px;overflow-y:auto}.form .paper-results button{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:8px 10px;background:none;border:none;border-bottom:1px solid var(--border-variant);text-align:left;font:inherit;color:var(--text);cursor:pointer}.form .paper-results button:last-child{border-bottom:none}.form .paper-results button:hover{background:var(--surface)}.form .paper-results .title{font-size:var(--fs-md);font-weight:var(--fw-medium)}.form .paper-results .id,.form .paper-pick .id{font-family:var(--mono);font-size:var(--fs-xs);color:var(--muted)}.form .paper-pick{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 12px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.form .paper-pick .meta{min-width:0}.form .paper-pick .title{font-size:var(--fs-md);font-weight:var(--fw-semibold)}.form{display:flex;flex-direction:column;gap:10px}.form label{display:flex;flex-direction:column;gap:4px;font-size:var(--fs-xs);color:var(--text);font-weight:var(--fw-medium)}.form .row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}.form .actions{display:flex;justify-content:flex-end;gap:10px;margin-top:6px}.form .error,.settings-card>.error{color:var(--accent-red);font-size:var(--fs-md);white-space:pre-wrap}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;background:#1d1b1a66;display:flex;align-items:flex-start;justify-content:center;padding:var(--modal-top) 16px 24px;overflow-y:auto;z-index:100}.modal{width:480px;max-width:94vw;max-height:calc(100vh - var(--modal-top) - 48px);overflow-y:auto;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:0 24px 60px #00000038;padding:24px}.modal h2{margin:0 0 14px;font-size:var(--fs-xl)}.settings-section+.settings-section{margin-top:18px;padding-top:16px;border-top:1px solid var(--border)}.settings-section h3{margin:0 0 8px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.settings-loading{display:flex;align-items:center;gap:8px;color:var(--subtext);font-size:var(--fs-md);padding:4px 0}.settings-note{margin:10px 0 0;font-size:var(--fs-sm);padding:8px 10px;border:1px solid var(--accent-amber);border-radius:var(--radius-md);background:var(--accent-amber-subtle);color:var(--accent-amber);font-weight:var(--fw-medium)}.progress{margin:12px 0 4px}.progress-track{height:8px;border-radius:var(--radius-full);background:var(--surface);border:1px solid var(--border);overflow:hidden}.progress-fill{height:100%;background:var(--accent);border-radius:var(--radius-full);transition:width .2s ease}.progress-caption{display:flex;justify-content:space-between;margin-top:6px;font-size:var(--fs-sm);color:var(--muted)}.settings-form{margin-top:14px;padding-top:14px;border-top:1px solid var(--border)}.badge{display:inline-flex;align-items:center;font-family:var(--sans);font-size:var(--fs-xs);font-weight:var(--fw-medium);padding:1px 7px;border:1px solid var(--border);border-radius:var(--radius-sm);color:var(--text)}.badge.ok{color:var(--accent-green);border-color:var(--accent-green);background:var(--accent-green-subtle)}.badge.err{color:var(--accent-red);border-color:var(--accent-red);background:var(--accent-red-subtle)}.badge.warn{color:var(--accent-amber);border-color:var(--accent-amber);background:var(--accent-amber-subtle)}.files-tab{height:100%;min-height:0;display:flex;background:var(--base)}.files-pill{display:inline-flex;align-items:center;gap:8px;min-width:0;border:1px solid var(--border);border-radius:var(--radius-md);padding:7px 11px;background:var(--base);color:var(--text);text-decoration:none}.files-pill code{font-family:var(--mono);font-size:var(--fs-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.files-pill>svg{flex-shrink:0;color:var(--muted)}a.files-pill:hover{border-color:var(--muted)}.ftree-pane{position:relative;flex-shrink:0;display:flex;flex-direction:column;min-height:0;border-left:1px solid var(--border-variant);border-right:1px solid var(--border-variant);background:var(--base)}.ftree-resizer{position:absolute;right:-3px;top:0;bottom:0;width:6px;cursor:col-resize;z-index:30}.ftree-resizer:hover,.ftree-resizer:active{background:color-mix(in oklab,var(--text) 12%,transparent)}.ftree-scroll{flex:1;min-height:0;overflow-y:auto;padding:10px 8px}.ft-row{display:flex;align-items:center;gap:6px;padding:5px 8px;border-radius:var(--radius-sm);cursor:pointer}.ft-row:hover{background:var(--surface)}.ft-row.selected,.ft-row.selected:hover{background:var(--panel)}.ft-chevron{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex-shrink:0;color:var(--muted);transition:transform .12s ease}.ft-chevron.open{transform:rotate(90deg)}.ft-chevron.spacer{visibility:hidden}.ft-dirname,.ft-name{flex:1;min-width:0;font-family:var(--mono);font-size:var(--fs-sm);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ft-dirname{color:var(--text)}.ft-row-delete{opacity:.35}.ft-row:hover .ft-row-delete,.ft-row-delete:focus-visible{opacity:1}.ft-thumb{width:18px;height:18px;object-fit:cover;border-radius:var(--radius-xs);border:1px solid var(--border-variant);flex-shrink:0}.ftree-footer{flex-shrink:0;display:flex;align-items:center;gap:2px;padding:5px 8px;border-top:1px solid var(--border-variant)}.ftree-footer code{flex:1;min-width:0;direction:rtl;text-align:left;font-family:var(--mono);font-size:var(--fs-xs);color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftree-footer .icon-btn{width:22px;height:22px}.fpreview{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0;background:var(--base)}.fpreview-none{align-items:center;justify-content:center;gap:8px;font-size:var(--fs-md);color:var(--muted)}.fpreview-head{height:40px;display:flex;align-items:center;gap:8px;padding:0 14px;border-bottom:1px solid var(--border-variant);color:var(--subtext);flex-shrink:0}.fpreview-path{font-family:var(--mono);font-size:var(--fs-sm);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fpreview-date,.fpreview-size{font-size:var(--fs-xs);color:var(--muted);white-space:nowrap;flex-shrink:0}.fpreview-body{flex:1;min-height:0;overflow:auto}.fpreview-body.doc{padding:18px 28px 48px}.fpreview-body.doc .artifact-md{max-width:var(--readable-col);margin:0 auto}.fpreview-image{display:flex;align-items:flex-start;justify-content:center;padding:24px}.fpreview-image img{max-width:100%;height:auto;border:1px solid var(--border);border-radius:var(--radius-sm)}.fpreview-pdf{display:block;width:100%;height:100%;border:0}.files-empty-state{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:24px;text-align:center;color:var(--muted)}.files-empty-state h3{margin:6px 0 0;font-size:var(--fs-base);font-weight:var(--fw-semibold);color:var(--text)}.files-empty-state p{margin:0;max-width:420px;font-size:var(--fs-md);line-height:1.55;color:var(--subtext)}.files-empty-state .ftree-footer{margin-top:10px;max-width:100%;border:1px solid var(--border);border-radius:var(--radius-md);padding:6px 10px;background:var(--base)}.files-empty-state .ftree-footer code{max-width:380px}.files-truncated{margin:0;padding:8px 14px;font-size:var(--fs-xs);color:var(--muted)}.artifact-md{font-size:var(--fs-lg)}.artifact-md h1{font-size:2em;line-height:1.18;margin:28px 0 14px}.artifact-md h2{font-size:1.5em;line-height:1.25;margin:28px 0 10px}.artifact-md h3{font-size:1.2em;line-height:1.35;margin:22px 0 8px}.artifact-md h4{font-size:1em;line-height:1.4;margin:18px 0 6px}.artifact-md table{display:block;width:max-content;max-width:100%;overflow-x:auto}.artifact-md .artifact-img{display:block;margin:12px 0}.artifact-md .artifact-img img{max-width:100%;height:auto;border:1px solid var(--border);border-radius:var(--radius-sm)}.artifact-md .artifact-img-caption{display:block;margin-top:4px;text-align:center;font-size:var(--fs-sm);color:var(--subtext)}.openresearch-diff{display:flex;flex-direction:column;gap:16px}.diff-file-card{border:1px solid var(--border);border-radius:var(--radius-md);background:var(--base)}.diff-file-header{position:sticky;top:0;z-index:10;display:flex;align-items:center;justify-content:space-between;gap:12px;margin:-1px -1px 0;width:calc(100% + 2px);text-align:left;padding:8px 12px;cursor:pointer}.diff-file-header:before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-2;background:var(--base)}.diff-file-header:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;background:var(--canvas);border:1px solid var(--border);border-radius:var(--radius-md) var(--radius-md) 0 0}.diff-file-header .chev{color:var(--muted);font-size:var(--fs-2xs);flex-shrink:0;width:12px}.diff-file-header .path{display:flex;align-items:center;gap:8px;min-width:0;flex:1}.diff-file-header .path code{min-width:0;flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono);font-size:var(--fs-xs);font-weight:var(--fw-semibold);color:var(--text)}.diff-file-header .stats{display:flex;align-items:center;gap:8px;flex-shrink:0;font-family:var(--mono);font-size:var(--fs-2xs);font-weight:var(--fw-medium);font-variant-numeric:tabular-nums}.diff-stat-add{color:var(--accent-green)}.diff-stat-del{color:var(--accent-red)}.diff-empty{padding:8px 12px;color:var(--muted);font-size:var(--fs-md)}.truncated-notice{border:1px solid var(--accent-amber);border-radius:var(--radius-md);background:var(--accent-amber-subtle);padding:12px 14px;font-size:var(--fs-md)}.truncated-notice h4{margin:0 0 4px;font-size:var(--fs-md);color:var(--accent-amber)}.truncated-notice p{margin:0;color:var(--subtext)}.openresearch-diff .openresearch-diff-file{--openresearch-diff-selection-background-color: color-mix( in oklab, var(--surface) 76%, var(--primary) );--openresearch-diff-gutter-selection-background-color: color-mix( in oklab, var(--surface) 68%, var(--primary) );--openresearch-diff-insert-gutter-background-color: color-mix( in oklab, var(--base) 84%, var(--accent-green) );--openresearch-diff-delete-gutter-background-color: color-mix( in oklab, var(--base) 86%, var(--accent-red) );--openresearch-diff-insert-code-background-color: color-mix( in oklab, var(--base) 91%, var(--accent-green) );--openresearch-diff-delete-code-background-color: color-mix( in oklab, var(--base) 92%, var(--accent-red) );--openresearch-diff-insert-edit-background-color: color-mix( in oklab, var(--base) 72%, var(--accent-green) );--openresearch-diff-delete-edit-background-color: color-mix( in oklab, var(--base) 78%, var(--accent-red) );--openresearch-diff-divider-color: var(--border);--openresearch-diff-omit-gutter-line-color: color-mix(in oklab, var(--base) 86%, var(--text));--openresearch-diff-unified-gutter-text-color: color-mix(in oklab, var(--text) 45%, var(--base));--diff-background-color: var(--base);--diff-text-color: var(--text);--diff-font-family: var(--mono);--diff-selection-text-color: var(--primary);--diff-selection-background-color: var(--openresearch-diff-selection-background-color);--diff-gutter-selected-text-color: var(--diff-selection-text-color);--diff-gutter-selected-background-color: var( --openresearch-diff-gutter-selection-background-color );--diff-code-selected-text-color: var(--diff-selection-text-color);--diff-code-selected-background-color: var(--diff-selection-background-color);--diff-gutter-insert-text-color: var(--accent-green);--diff-gutter-insert-background-color: var(--openresearch-diff-insert-gutter-background-color);--diff-gutter-delete-text-color: var(--accent-red);--diff-gutter-delete-background-color: var(--openresearch-diff-delete-gutter-background-color);--diff-code-insert-text-color: var(--diff-text-color);--diff-code-insert-background-color: var(--openresearch-diff-insert-code-background-color);--diff-code-delete-text-color: var(--diff-text-color);--diff-code-delete-background-color: var(--openresearch-diff-delete-code-background-color);--diff-code-insert-edit-text-color: var(--diff-text-color);--diff-code-insert-edit-background-color: var(--openresearch-diff-insert-edit-background-color);--diff-code-delete-edit-text-color: var(--diff-text-color);--diff-code-delete-edit-background-color: var(--openresearch-diff-delete-edit-background-color);--diff-omit-gutter-line-color: var(--openresearch-diff-omit-gutter-line-color);width:100%;font-size:var(--fs-sm);line-height:1.5}.openresearch-diff .openresearch-diff-file.diff-unified{table-layout:auto}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:first-child{display:none}.openresearch-diff .openresearch-diff-file.diff-unified .diff-line>td:nth-child(2){width:0%;padding:0 .5rem 0 .625rem;white-space:nowrap;text-align:right;color:var(--openresearch-diff-unified-gutter-text-color);border-right:1px solid var(--openresearch-diff-divider-color);-webkit-user-select:none;user-select:none;cursor:default}.openresearch-diff .openresearch-diff-file .diff-line{line-height:1.5}.openresearch-diff .openresearch-diff-file .diff-hunk+.diff-hunk .diff-line:first-child>td{border-top:1px solid var(--openresearch-diff-divider-color)}:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#a0a1a7}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#383a42}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#986801}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#a626a4}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#4078f2}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#c18401}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#50a14f}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e45649}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#383a42}@media(prefers-color-scheme:dark){:is(.md,.openresearch-diff,.file-view) .token.comment,:is(.md,.openresearch-diff,.file-view) .token.prolog,:is(.md,.openresearch-diff,.file-view) .token.cdata{font-style:italic;color:#7f848e}:is(.md,.openresearch-diff,.file-view) .token.punctuation{color:#abb2bf}:is(.md,.openresearch-diff,.file-view) .token.property,:is(.md,.openresearch-diff,.file-view) .token.tag,:is(.md,.openresearch-diff,.file-view) .token.deleted{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.constant,:is(.md,.openresearch-diff,.file-view) .token.symbol,:is(.md,.openresearch-diff,.file-view) .token.boolean,:is(.md,.openresearch-diff,.file-view) .token.number{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.selector,:is(.md,.openresearch-diff,.file-view) .token.attr-name,:is(.md,.openresearch-diff,.file-view) .token.char,:is(.md,.openresearch-diff,.file-view) .token.inserted,:is(.md,.openresearch-diff,.file-view) .token.string{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.builtin{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.operator,:is(.md,.openresearch-diff,.file-view) .token.entity,:is(.md,.openresearch-diff,.file-view) .token.url{color:#56b6c2}:is(.md,.openresearch-diff,.file-view) .token.atrule,:is(.md,.openresearch-diff,.file-view) .token.attr-value{color:#d19a66}:is(.md,.openresearch-diff,.file-view) .token.keyword{color:#c678dd}:is(.md,.openresearch-diff,.file-view) .token.function,:is(.md,.openresearch-diff,.file-view) .token.decorator,:is(.md,.openresearch-diff,.file-view) .token.def{color:#61afef}:is(.md,.openresearch-diff,.file-view) .token.class-name,:is(.md,.openresearch-diff,.file-view) .token.namespace{color:#e5c07b}:is(.md,.openresearch-diff,.file-view) .token.regex{color:#98c379}:is(.md,.openresearch-diff,.file-view) .token.important,:is(.md,.openresearch-diff,.file-view) .token.variable{color:#e06c75}:is(.md,.openresearch-diff,.file-view) .token.parameter{color:#abb2bf}}.settings-view-scroll{flex:1;min-height:0;overflow-y:auto;scrollbar-gutter:stable both-edges}.settings-view{max-width:var(--readable-col);margin:0 auto;padding:24px 32px 60px}.settings-view h1{margin:0 0 6px;font-size:var(--fs-3xl)}.settings-head-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-head-row h1{margin:0}.settings-view>.error{color:var(--accent-red);font-size:var(--fs-md);white-space:pre-wrap;margin:0 0 12px}.settings-sub{margin:0 0 18px;color:var(--text);font-size:var(--fs-md)}.settings-card{background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);padding:16px 18px;margin-bottom:16px}.settings-card h3{margin:0 0 10px;font-size:var(--fs-sm);font-weight:var(--fw-semibold);color:var(--text)}.settings-card .settings-sub{margin-bottom:12px}.settings-card-head{display:flex;align-items:center;gap:10px;margin-bottom:12px}.settings-card .kv{gap:6px 18px}.settings-empty{color:var(--muted);font-size:var(--fs-md);margin:4px 0 0}.muted{color:var(--muted)}.compute-list{display:flex;flex-direction:column;gap:10px;margin-bottom:14px}.compute-row{background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg)}.compute-row-head{display:flex;align-items:center;gap:10px;padding:12px 14px;cursor:pointer;-webkit-user-select:none;user-select:none}.compute-row-head:hover{background:var(--surface);border-radius:var(--radius-lg)}.compute-row.open .compute-row-head:hover{border-radius:var(--radius-lg) var(--radius-lg) 0 0}.compute-row-logo{display:inline-flex;align-items:center;flex:none}.compute-row-name{font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);flex:none}.compute-row-summary{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted);font-size:var(--fs-sm)}.compute-row-head .badge,.compute-make-default,.compute-default-pill{flex:none}.compute-default-pill{color:var(--primary);border-color:var(--primary)}.compute-chevron-btn{flex:none;display:inline-flex;align-items:center;padding:2px;border-radius:var(--radius-sm)}.compute-chevron-btn:hover{background:var(--panel)}.compute-chevron{color:var(--muted);transition:transform .12s ease}.compute-row.open .compute-chevron{transform:rotate(180deg)}.compute-row-body{border-top:1px solid var(--border);padding:14px}.compute-row-body .settings-card{margin-bottom:0;margin-top:14px}.compute-default-note{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.compute-flavor-form{margin-bottom:14px}.compute-flavor-form label{max-width:320px}.compute-flavor-hint{font-size:var(--fs-sm)}.compute-footnote{display:flex;align-items:flex-start;gap:6px;margin:2px 0 0;font-size:var(--fs-sm);color:var(--muted)}.compute-footnote svg{flex:none;margin-top:1px}.harness-tabs{display:flex;gap:4px;margin-bottom:14px;border-bottom:1px solid var(--border-variant)}.harness-tabs button{display:inline-flex;align-items:center;gap:7px;padding:7px 12px;font-size:var(--fs-md);font-weight:var(--fw-semibold);color:var(--text);border-bottom:2px solid transparent;margin-bottom:-1px}.harness-tabs button:hover{color:var(--text)}.harness-tabs button.active{border-bottom-color:var(--primary)}.harness-dot{width:7px;height:7px;border-radius:50%;background:var(--muted)}.harness-dot.ok{background:var(--accent-green)}.harness-dot.err{background:var(--accent-red)}.harness-dot.warn{background:var(--accent-amber)}.env-table{width:100%;border-collapse:collapse;font-size:var(--fs-md);table-layout:fixed}.env-table td:first-child{width:32%;overflow-wrap:anywhere}.env-table .badge{margin-left:8px}.env-table input{width:100%;border:none;background:transparent;padding:0}.env-table input:focus{box-shadow:0 1px 0 0 var(--text)}.env-table td{height:36px;padding:0 10px 0 0;vertical-align:middle;border-bottom:1px solid var(--border-variant)}.env-table td:last-child{width:116px;white-space:nowrap;text-align:right}.env-table td[colspan]{white-space:normal;text-align:left}.env-table .icon-btn{margin-left:8px;vertical-align:middle}.env-table .icon-btn:hover{color:var(--accent-red)}.flavor-table{width:100%;border-collapse:collapse;font-size:var(--fs-md)}.flavor-table th{padding:5px 10px 5px 0;border-bottom:1px solid var(--border);text-align:left;font-weight:var(--fw-medium);color:var(--text)}.flavor-table td{padding:5px 10px 5px 0;border-bottom:1px solid var(--border-variant)}.ssh-table{table-layout:fixed}.ssh-table th:nth-child(1){width:20%}.ssh-table th:nth-child(2){width:26%}.ssh-table th:nth-child(4){width:108px}.ssh-table th:nth-child(5){width:52px}.ssh-table td{overflow-wrap:anywhere}.ssh-table td:last-child{padding-right:0;text-align:right}.ssh-tested-at{display:block;margin-top:2px;color:var(--muted);font-size:var(--fs-xs)}@keyframes settings-spin{to{transform:rotate(360deg)}}.spin{animation:settings-spin .9s linear infinite}.model-picker,.option-picker{position:relative;display:inline-flex}.composer-pill{display:inline-flex;align-items:center;gap:5px;font-size:var(--fs-md);color:var(--text);padding:5px 8px;border-radius:var(--radius-sm)}.composer-pill:hover{background:var(--surface);color:var(--text)}.composer-bare{display:inline-flex;align-items:center;gap:3px;font-size:var(--fs-md);color:var(--text);padding:5px 4px;border-radius:var(--radius-sm)}.composer-bare:hover{color:var(--text)}.model-menu,.option-menu{position:absolute;bottom:calc(100% + 8px);left:0;max-height:380px;display:flex;flex-direction:column;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.model-menu{width:320px}.option-menu{min-width:190px;padding:6px}.composer-bare.context-ring{display:inline-flex;align-items:center;margin-right:8px}.context-meter-menu{width:280px;padding:10px 12px 12px}.context-meter-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:var(--fs-sm);color:var(--muted)}.context-meter-value{color:var(--text);font-variant-numeric:tabular-nums}.context-meter-menu .progress{margin:8px 0 0}.context-meter-menu .progress-track{height:5px;border:none;background:var(--border)}.model-menu.align-right,.option-menu.align-right{left:auto;right:0}.option-menu.drop-down{bottom:auto;top:calc(100% + 4px)}.option-menu.session-menu{left:auto;right:6px;top:calc(100% - 2px);min-width:140px}.model-item.danger,.model-item.danger:hover{color:var(--accent-red)}.option-default{color:var(--muted);font-weight:var(--fw-regular)}.option-sep{height:1px;margin:5px 4px;background:var(--border-variant)}.option-num{color:var(--muted);font-size:var(--fs-xs);font-variant-numeric:tabular-nums}.model-menu input{border:none;border-bottom:1px solid var(--border-variant);background:none;padding:9px 12px;font-size:var(--fs-md);outline:none}.model-menu-list{overflow-y:auto;padding:6px}.model-group{font-size:var(--fs-xs);font-weight:var(--fw-medium);color:var(--muted);padding:8px 8px 4px}.model-item{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;text-align:left;padding:6px 8px;font-size:var(--fs-md);border-radius:var(--radius-sm)}.model-item:hover{background:var(--surface)}.model-item .model-id{display:block;font-family:var(--mono);font-size:var(--fs-2xs);color:var(--muted)}.model-more{padding:4px 8px 8px;font-size:var(--fs-xs);color:var(--muted)}.model-locked-note{display:flex;align-items:center;gap:6px;padding:7px 12px;font-size:var(--fs-xs);color:var(--muted);border-top:1px solid var(--border-variant)}.model-locked-note svg{flex-shrink:0}.skill-menu{position:absolute;bottom:calc(100% + 8px);left:0;min-width:340px;max-width:100%;padding:6px;background:var(--base);border:1px solid var(--border);border-radius:var(--radius-lg);box-shadow:0 12px 32px #0000002e;z-index:50;overflow:hidden}.skill-item{display:flex;flex-direction:column;gap:2px;width:100%;text-align:left;padding:7px 8px;border-radius:var(--radius-sm)}.skill-item.active{background:var(--surface)}.skill-item .skill-name{font-size:var(--fs-md)}.skill-item .skill-hint{color:var(--muted)}.skill-item .skill-desc{font-size:var(--fs-sm);color:var(--subtext)}.skill-chip{display:inline-flex;align-items:center;padding:1px 7px;font-family:var(--mono);font-size:var(--fs-md);font-weight:var(--fw-medium);color:var(--primary);background:var(--primary-subtle);border:1px solid var(--border-variant);border-radius:var(--radius-sm)}.composer-input{position:relative;display:flex;overflow:hidden}.composer-input textarea{flex:1}.composer-chip{position:absolute;top:9px;left:12px;z-index:1;pointer-events:none}.msg-user .skill-chip{margin-right:2px;vertical-align:baseline}.file-view{display:flex;flex-direction:column;height:100%;min-height:0}.file-view-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);color:var(--text);flex-shrink:0}.file-view-path{font-family:var(--mono);font-size:var(--fs-sm);color:var(--text);flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.file-view-ref{font-family:var(--mono);font-size:var(--fs-xs);color:var(--muted);border:1px solid var(--border-variant);border-radius:var(--radius-sm);padding:1px 6px;max-width:180px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-shrink:0}.file-view-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.file-view-codewrap{display:flex;align-items:flex-start;min-width:max-content}.file-view-gutter,.file-view-code{margin:0;padding-top:14px;padding-bottom:14px;font-family:var(--mono);font-size:var(--fs-sm);line-height:1.55}.file-view-gutter{padding-left:14px;padding-right:10px;text-align:right;color:var(--muted);-webkit-user-select:none;user-select:none;position:sticky;left:0;background:var(--base);border-right:1px solid var(--border-variant);flex-shrink:0}.file-view-code{padding-left:16px;padding-right:16px;-moz-tab-size:4;tab-size:4;min-width:max-content}.file-view-note{padding:10px 16px;font-size:var(--fs-sm);color:var(--muted)}.file-view-md{max-width:var(--readable-col);padding:18px 20px 32px}.file-view-md .md{font-size:var(--fs-base)}.file-view-md .md h1{font-size:1.5em;margin:18px 0 8px}.file-view-md .md h2{font-size:1.25em;margin:16px 0 8px}.file-view-md .md h3{font-size:1.1em}.icon-btn.active{color:var(--primary);background:var(--surface)}.prompt-card{margin:8px 0;padding:12px 14px;border:1px solid var(--border);border-left:3px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);display:flex;flex-direction:column;gap:9px}.prompt-card.plan{border-left-color:var(--accent-blue)}.prompt-card.permission{border-left-color:var(--accent-amber)}.prompt-card.question{border-left-color:var(--accent-purple)}.prompt-card.readonly{opacity:.6}.prompt-head{font-size:var(--fs-xs);font-weight:var(--fw-semibold);color:var(--text)}.prompt-head code{font-family:var(--mono);font-size:var(--fs-sm);color:var(--text)}.prompt-sub{font-size:var(--fs-sm);color:var(--subtext);word-break:break-word}.prompt-q{font-size:var(--fs-base);font-weight:var(--fw-semibold);line-height:1.5;color:var(--text)}.prompt-plan{font-size:var(--fs-base);line-height:1.6;color:var(--text);max-height:340px;overflow-y:auto}.prompt-options{display:flex;flex-direction:column;gap:6px}.prompt-option{display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;padding:8px 11px;text-align:left;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--base);color:var(--text);cursor:pointer;transition:border-color 80ms ease,background 80ms ease}.prompt-option:hover:not(:disabled){border-color:var(--border-strong);background:var(--surface)}.prompt-option.sel{border-color:var(--primary);background:var(--primary-subtle)}.prompt-option:disabled{cursor:default}.prompt-option-label{display:block;font-size:var(--fs-md);font-weight:var(--fw-semibold)}.prompt-option-desc{display:block;font-size:var(--fs-sm);font-weight:var(--fw-regular);line-height:1.45;color:var(--subtext)}.prompt-actions{display:flex;flex-wrap:wrap;gap:8px}.prompt-actions .btn-primary,.prompt-actions .btn-ghost{display:inline-flex;align-items:center;gap:6px;padding:6px 13px;font-family:inherit;font-size:var(--fs-sm);font-weight:var(--fw-semibold);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer;transition:background 80ms ease,border-color 80ms ease}.prompt-actions .btn-primary{background:var(--primary);color:var(--base)}.prompt-actions .btn-primary:hover:not(:disabled){opacity:.9}.prompt-actions .btn-ghost{background:transparent;border-color:var(--border);color:var(--subtext)}.prompt-actions .btn-ghost:hover:not(:disabled){border-color:var(--border-strong);color:var(--text);background:var(--surface)}.prompt-actions button:disabled{opacity:.5;cursor:default}.prompt-collapsed{color:var(--muted);font-size:var(--fs-md);margin:4px 0}.prompt-collapsed summary{display:flex;align-items:baseline;gap:8px;cursor:pointer;list-style:none;-webkit-user-select:none;user-select:none}.prompt-collapsed summary::-webkit-details-marker{display:none}.prompt-collapsed summary:after{content:"›";color:var(--muted);transition:transform 80ms ease}.prompt-collapsed[open] summary:after{transform:rotate(90deg)}.prompt-collapsed-title{font-weight:var(--fw-semibold);word-break:break-word}.prompt-outcome{font-size:var(--fs-sm);color:var(--subtext);word-break:break-word}.prompt-outcome.approved,.prompt-outcome.chosen{color:var(--accent-green)}.prompt-outcome.approved:before,.prompt-outcome.chosen:before{content:"✓ "}.prompt-outcome.revised,.prompt-outcome.rejected{color:var(--accent-amber)}.prompt-collapsed-body{margin-top:6px;padding-left:12px;border-left:2px solid var(--border);font-size:var(--fs-md);color:var(--subtext)}.prompt-collapsed-options{margin:6px 0 0;padding-left:18px}.prompt-collapsed-options .sel{color:var(--text);font-weight:var(--fw-semibold)}.prompt-collapsed-note{margin-top:6px;font-style:italic}.plan-strip{position:relative;width:100%;margin:0 0 10px;padding:11px 13px;display:flex;flex-direction:column;align-items:stretch;gap:10px;border:1px solid var(--border);border-left:3px solid var(--accent-blue);border-radius:var(--radius-md);background:var(--surface);box-shadow:0 2px 10px #0000000f}.plan-strip-info{display:flex;align-items:baseline;gap:8px;min-width:0}.plan-strip-open{margin-left:auto;padding:0;border:none;background:none;color:var(--accent-blue);font-size:var(--fs-md);cursor:pointer;white-space:nowrap;flex-shrink:0}.plan-strip-open:hover{text-decoration:underline}.plan-strip-spacer{flex:1}.plan-strip-revise-input{width:100%;resize:none;border:1px solid var(--border);border-radius:var(--radius-md);padding:9px 11px;font-size:var(--fs-md);font-family:inherit;background:var(--base);color:var(--text)}.plan-strip-revise-input:focus{border-color:var(--accent-blue)}.plan-strip-icon{color:var(--accent-blue);flex-shrink:0;align-self:center}.plan-strip-title{font-size:var(--fs-md);font-weight:var(--fw-semibold);white-space:nowrap}.plan-strip-actions{gap:6px 8px;justify-content:flex-end}.plan-strip-actions .btn-primary,.plan-strip-actions .btn-ghost{background:transparent;border:1px solid var(--text);color:var(--text)}.plan-strip-actions .btn-primary:hover:not(:disabled),.plan-strip-actions .btn-ghost:hover:not(:disabled){background:var(--surface-2, rgb(0 0 0 / 5%));border-color:var(--text);color:var(--text);opacity:1}.plan-strip-actions .plan-strip-primary{background:var(--text);border-color:var(--text);color:var(--base)}.plan-strip-actions .plan-strip-primary:hover:not(:disabled){background:color-mix(in oklab,var(--text) 85%,var(--base));border-color:var(--text);color:var(--base)}.plan-strip-approve{position:relative;display:flex}.plan-strip-approve .btn-primary:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.plan-strip-actions .plan-strip-caret{border-top-left-radius:0;border-bottom-left-radius:0;padding:0 6px;display:flex;align-items:center;border-left:1px solid color-mix(in oklab,var(--base) 35%,var(--text))}.plan-strip-menu{position:absolute;right:0;bottom:calc(100% + 4px);display:flex;flex-direction:column;min-width:190px;padding:4px;border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface);box-shadow:0 6px 20px #0000001f;z-index:6}.plan-strip-menu button{text-align:left;padding:7px 9px;border:none;border-radius:var(--radius-sm);background:transparent;color:var(--text);font-size:var(--fs-md);cursor:pointer}.plan-strip-menu button:hover{background:var(--surface-2, rgb(0 0 0 / 5%))}.prompt-plan.clamped{max-height:9.5em;overflow:hidden;position:relative}.prompt-plan.clamped:after{content:"";position:absolute;inset:auto 0 0 0;height:34px;background:linear-gradient(to bottom,transparent,var(--surface));pointer-events:none}.prompt-plan-open{align-self:flex-start;border:none;background:transparent;color:var(--accent-blue);font-size:var(--fs-sm);padding:0;cursor:pointer}.prompt-plan-open:hover{text-decoration:underline}.code-tab{display:flex;flex-direction:column;height:100%;min-height:0}.code-tab-header{display:flex;align-items:center;gap:8px;padding:4px 12px;border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-select{max-width:280px;min-width:0;padding:3px 8px;font-size:var(--fs-sm)}.code-tab-note{padding:8px 16px;font-size:var(--fs-sm);color:var(--muted);border-bottom:1px solid var(--border-variant);flex-shrink:0}.code-tab-body{flex:1;min-height:0;overflow:auto;background:var(--base)}.code-tree{padding:6px 0;font-size:var(--fs-md)}.code-tree-row{display:flex;align-items:center;gap:6px;width:100%;padding:3px 10px;border:none;background:transparent;color:var(--text);text-align:left;cursor:pointer;font-family:inherit;font-size:inherit}.code-tree-row:hover{background:var(--panel)}.code-tree-row>svg{flex-shrink:0;color:var(--subtext)}.code-tree-row>svg.code-tree-chev{color:var(--muted)}.code-tree-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.wt-branch-chip{display:inline-flex;align-items:center;gap:4px;min-width:0;padding:2px 8px;border-radius:var(--radius-full);background:color-mix(in oklab,var(--text) 8%,transparent);color:var(--subtext);font-size:var(--fs-xs)}.wt-branch-chip>svg{flex-shrink:0}.wt-branch-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:var(--mono)}.wt-count{padding:0;border:none}.wt-changes{padding:0 16px 24px}.wt-changes>:first-child{margin-top:14px}.wt-empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:48px 24px;text-align:center;color:var(--muted)}.wt-empty>svg{color:var(--subtext)}.wt-empty p{margin:0;max-width:320px;font-size:var(--fs-sm)}.tour-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:200}.tour-dim{position:absolute;top:0;right:0;bottom:0;left:0;background:#0000008c}.tour-spotlight{position:absolute;border-radius:var(--radius-lg);box-shadow:0 0 0 9999px #0000008c;transition:all .3s ease}.tour-ring{position:absolute;border-radius:var(--radius-lg);border:2px solid var(--primary);transition:all .3s ease}.tour-card{position:absolute;width:390px;max-width:calc(100vw - 32px);background:var(--base);border:1px solid var(--border);border-radius:var(--radius-xl);box-shadow:0 24px 60px #00000038;padding:21px 23px 0;transition:left .2s ease,top .2s ease}.tour-card.centered{left:50%;top:50%;transform:translate(-50%,-50%);transition:none}.tour-card h3{margin:0 26px 7px 0;font-size:var(--fs-lg);font-weight:var(--fw-semibold)}.tour-card p{margin:0;font-size:var(--fs-base);line-height:1.55;color:var(--text)}.tour-card .tour-close{position:absolute;top:12px;right:12px}.tour-footer{display:flex;align-items:center;border-top:1px solid var(--border-variant);margin-top:16px;padding:11px 0}.tour-footer-side{flex:1;display:flex}.tour-footer-side.end{justify-content:flex-end}.tour-count{font-size:var(--fs-sm);color:var(--muted);font-variant-numeric:tabular-nums}.tour-arrow{position:absolute;width:12px;height:12px;background:var(--base);rotate:45deg;pointer-events:none}.tour-arrow.above{bottom:-6.5px;left:calc(50% - 6px);border-right:1px solid var(--border);border-bottom:1px solid var(--border)}.tour-arrow.below{top:-6.5px;left:calc(50% - 6px);border-left:1px solid var(--border);border-top:1px solid var(--border)}.tour-arrow.left{right:-6.5px;top:calc(50% - 6px);border-top:1px solid var(--border);border-right:1px solid var(--border)}.tour-arrow.right{left:-6.5px;top:calc(50% - 6px);border-bottom:1px solid var(--border);border-left:1px solid var(--border)}.react-flow{direction:ltr;--xy-edge-stroke-default: #b1b1b7;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #555;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(255, 255, 255, .5);--xy-minimap-background-color-default: #fff;--xy-minimap-mask-background-color-default: rgba(240, 240, 240, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #e2e2e2;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: transparent;--xy-background-pattern-dots-color-default: #91919a;--xy-background-pattern-lines-color-default: #eee;--xy-background-pattern-cross-color-default: #e2e2e2;background-color:var(--xy-background-color, var(--xy-background-color-default));--xy-node-color-default: inherit;--xy-node-border-default: 1px solid #1a192b;--xy-node-background-color-default: #fff;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #1a192b;--xy-node-border-radius-default: 3px;--xy-handle-background-color-default: #1a192b;--xy-handle-border-color-default: #fff;--xy-selection-background-color-default: rgba(0, 89, 220, .08);--xy-selection-border-default: 1px dotted rgba(0, 89, 220, .8);--xy-controls-button-background-color-default: #fefefe;--xy-controls-button-background-color-hover-default: #f4f4f4;--xy-controls-button-color-default: inherit;--xy-controls-button-color-hover-default: inherit;--xy-controls-button-border-color-default: #eee;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #ffffff;--xy-edge-label-color-default: inherit;--xy-resize-background-color-default: #3367d9}.react-flow.dark{--xy-edge-stroke-default: #3e3e3e;--xy-edge-stroke-width-default: 1;--xy-edge-stroke-selected-default: #727272;--xy-connectionline-stroke-default: #b1b1b7;--xy-connectionline-stroke-width-default: 1;--xy-attribution-background-color-default: rgba(150, 150, 150, .25);--xy-minimap-background-color-default: #141414;--xy-minimap-mask-background-color-default: rgba(60, 60, 60, .6);--xy-minimap-mask-stroke-color-default: transparent;--xy-minimap-mask-stroke-width-default: 1;--xy-minimap-node-background-color-default: #2b2b2b;--xy-minimap-node-stroke-color-default: transparent;--xy-minimap-node-stroke-width-default: 2;--xy-background-color-default: #141414;--xy-background-pattern-dots-color-default: #777;--xy-background-pattern-lines-color-default: #777;--xy-background-pattern-cross-color-default: #777;--xy-node-color-default: #f8f8f8;--xy-node-border-default: 1px solid #3c3c3c;--xy-node-background-color-default: #1e1e1e;--xy-node-group-background-color-default: rgba(240, 240, 240, .25);--xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, .08);--xy-node-boxshadow-selected-default: 0 0 0 .5px #999;--xy-handle-background-color-default: #bebebe;--xy-handle-border-color-default: #1e1e1e;--xy-selection-background-color-default: rgba(200, 200, 220, .08);--xy-selection-border-default: 1px dotted rgba(200, 200, 220, .8);--xy-controls-button-background-color-default: #2b2b2b;--xy-controls-button-background-color-hover-default: #3e3e3e;--xy-controls-button-color-default: #f8f8f8;--xy-controls-button-color-hover-default: #fff;--xy-controls-button-border-color-default: #5b5b5b;--xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, .08);--xy-edge-label-background-color-default: #141414;--xy-edge-label-color-default: #f8f8f8}.react-flow__background{background-color:var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));pointer-events:none;z-index:-1}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;touch-action:none}.react-flow__pane.draggable{cursor:grab}.react-flow__pane.dragging{cursor:grabbing}.react-flow__pane.selection{cursor:pointer}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow__edge-path{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default));stroke-width:var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));fill:none}.react-flow__connection-path{stroke:var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));stroke-width:var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));fill:none}.react-flow .react-flow__edges{position:absolute}.react-flow .react-flow__edges svg{overflow:visible;position:absolute;pointer-events:none}.react-flow__edge{pointer-events:visibleStroke}.react-flow__edge.selectable{cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge.selectable:focus .react-flow__edge-path,.react-flow__edge.selectable:focus-visible .react-flow__edge-path{stroke:var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default))}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__arrowhead polyline{stroke:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__arrowhead polyline.arrowclosed{fill:var(--xy-edge-stroke, var(--xy-edge-stroke-default))}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}svg.react-flow__connectionline{z-index:1001;overflow:visible;position:absolute}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:default}.react-flow__node.selectable{cursor:pointer}.react-flow__node.draggable{cursor:grab;pointer-events:all}.react-flow__node.draggable.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background-color:var(--xy-handle-background-color, var(--xy-handle-background-color-default));border:1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));border-radius:100%}.react-flow__handle.connectingfrom{pointer-events:all}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:0;transform:translate(-50%,50%)}.react-flow__handle-top{top:0;left:50%;transform:translate(-50%,-50%)}.react-flow__handle-left{top:50%;left:0;transform:translate(-50%,-50%)}.react-flow__handle-right{top:50%;right:0;transform:translate(50%,-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__pane.selection .react-flow__panel{pointer-events:none}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.top.center,.react-flow__panel.bottom.center{left:50%;transform:translate(-15px) translate(-50%)}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.left.center,.react-flow__panel.right.center{top:50%;transform:translateY(-15px) translateY(-50%)}.react-flow__attribution{font-size:10px;background:var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;left:0;top:0}.react-flow__viewport-portal{position:absolute;width:100%;height:100%;left:0;top:0;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__minimap{background:var( --xy-minimap-background-color-props, var(--xy-minimap-background-color, var(--xy-minimap-background-color-default)) )}.react-flow__minimap-svg{display:block}.react-flow__minimap-mask{fill:var( --xy-minimap-mask-background-color-props, var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default)) );stroke:var( --xy-minimap-mask-stroke-color-props, var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default)) );stroke-width:var( --xy-minimap-mask-stroke-width-props, var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default)) )}.react-flow__minimap-node{fill:var( --xy-minimap-node-background-color-props, var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default)) );stroke:var( --xy-minimap-node-stroke-color-props, var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default)) );stroke-width:var( --xy-minimap-node-stroke-width-props, var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default)) )}.react-flow__background-pattern.dots{fill:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default)) )}.react-flow__background-pattern.lines{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default)) )}.react-flow__background-pattern.cross{stroke:var( --xy-background-pattern-color-props, var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default)) )}.react-flow__controls{display:flex;flex-direction:column;box-shadow:var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default))}.react-flow__controls.horizontal{flex-direction:row}.react-flow__controls-button{display:flex;justify-content:center;align-items:center;height:26px;width:26px;padding:4px;border:none;background:var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));border-bottom:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) );color:var( --xy-controls-button-color-props, var(--xy-controls-button-color, var(--xy-controls-button-color-default)) );cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px;fill:currentColor}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-input,.react-flow__node-default,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:var(--xy-node-border-radius, var(--xy-node-border-radius-default));width:150px;font-size:12px;color:var(--xy-node-color, var(--xy-node-color-default));text-align:center;border:var(--xy-node-border, var(--xy-node-border-default));background-color:var(--xy-node-background-color, var(--xy-node-background-color-default))}.react-flow__node-input.selectable:hover,.react-flow__node-default.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default))}.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default))}.react-flow__node-group{background-color:var(--xy-node-group-background-color, var(--xy-node-group-background-color-default))}.react-flow__nodesselection-rect,.react-flow__selection{background:var(--xy-selection-background-color, var(--xy-selection-background-color-default));border:var(--xy-selection-border, var(--xy-selection-border-default))}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls-button:hover{background:var( --xy-controls-button-background-color-hover-props, var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default)) );color:var( --xy-controls-button-color-hover-props, var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default)) )}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__controls-button:last-child{border-bottom:none}.react-flow__controls.horizontal .react-flow__controls-button{border-bottom:none;border-right:1px solid var( --xy-controls-button-border-color-props, var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default)) )}.react-flow__controls.horizontal .react-flow__controls-button:last-child{border-right:none}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:5px;height:5px;border:1px solid #fff;border-radius:1px;background-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));translate:-50% -50%}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:var(--xy-resize-background-color, var(--xy-resize-background-color-default));border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%}.react-flow__edge-textbg{fill:var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default))}.react-flow__edge-text{fill:var(--xy-edge-label-color, var(--xy-edge-label-color-default))}/** * Copyright (c) 2014 The xterm.js authors. All rights reserved. * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) * https://github.com/chjj/term.js diff --git a/ui/dist/index.html b/ui/dist/index.html index 501342a7..59dd46aa 100644 --- a/ui/dist/index.html +++ b/ui/dist/index.html @@ -9,8 +9,8 @@ html { background: #ffffff; } @media (prefers-color-scheme: dark) { html { background: #0e0c0c; } } - - + +
diff --git a/ui/src/App.tsx b/ui/src/App.tsx index 03268afa..a5efc025 100644 --- a/ui/src/App.tsx +++ b/ui/src/App.tsx @@ -13,13 +13,13 @@ import { import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { cancelRun, - getFiles, + getArtifacts, listExperiments, listProjects, listRuns, openProject, type Experiment, - type ProjectFiles, + type ProjectArtifacts, type Project, type Run, } from "./api"; @@ -27,7 +27,7 @@ import { ChatPanel } from "./components/ChatPanel"; import { SubagentTab } from "./components/SubagentTab"; import { CodeTab } from "./components/CodeTab"; import { WorktreeTab, type WorktreeView } from "./components/WorktreeTab"; -import { FilesTab } from "./components/FilesTab"; +import { ArtifactsTab } from "./components/ArtifactsTab"; import { ClosableTab } from "./components/ClosableTab"; import { DetailDrawer, type ExperimentView } from "./components/DetailDrawer"; import { FileViewer } from "./components/FileViewer"; @@ -54,12 +54,12 @@ const sameExpTab = (a: ExpViewDef, b: ExpViewDef) => a.id === b.id && a.view === interface FileViewDef { path: string; /** Which backend serves this file. Absent/"repo" → the repo `/file` - * endpoint (worktree/clone/branch), falling back to the files dir when a - * non-ref path misses the checkout; "files" → the project's files dir - * (`/files/report` + `/files/file`). */ - source?: "repo" | "files"; + * endpoint (worktree/clone/branch), falling back to artifacts when a + * non-ref path misses the checkout; "artifacts" → the project's durable + * output directory through the compatibility `/files/file` endpoint. */ + source?: "repo" | "artifacts"; /** Chat session whose worktree holds the file (absent → hub clone). - * Files-dir tabs never carry this. */ + * Artifact tabs never carry this. */ sessionId?: string; /** Branch whose committed copy to show (code browser in branch mode); * overrides the live checkout. */ @@ -130,10 +130,9 @@ function escapeRegExp(s: string): string { return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); } -// Map a path an agent reported to a right-pane file tab. A files-dir path -// (a report/figure the agent wrote under /files//…) is stripped -// to a files-dir-relative path and tagged source:"files" so FileViewer reads it -// from the /files endpoints. Otherwise it's a repo/worktree path stripped to +// Map a path an agent reported to a right-pane file tab. An artifact path under +// the compatibility /files// layout is stripped to a relative +// path and tagged source:"artifacts". Otherwise it's a repo/worktree path stripped to // repo-relative, keeping the session id when it points into a per-session // worktree. Relative paths name files in the click context's checkout and // inherit `contextSessionId`; the regex fallbacks encode the @@ -143,24 +142,24 @@ function parseFilePath( rawPath: string, repoPath?: string, contextSessionId?: string, - filesDir?: string, + artifactsDir?: string, slug?: string, ): FileViewDef | null { let path = rawPath; let sessionId: string | undefined; const clone = repoPath?.replace(/\/+$/, ""); - const files = filesDir?.replace(/\/+$/, ""); + const artifacts = artifactsDir?.replace(/\/+$/, ""); if (!path.startsWith("/")) { sessionId = contextSessionId; - } else if (files && (path === files || path.startsWith(`${files}/`))) { - // Files-dir file — exact prefix match against the (non-canonical) dir the + } else if (artifacts && (path === artifacts || path.startsWith(`${artifacts}/`))) { + // Artifact — exact prefix match against the non-canonical dir the // backend surfaced, which mirrors what the agent inlines. - const rel = path.slice(files.length).replace(/^\/+/, ""); - return rel ? { path: rel, source: "files" } : null; + const rel = path.slice(artifacts.length).replace(/^\/+/, ""); + return rel ? { path: rel, source: "artifacts" } : null; } else if (clone && (path === clone || path.startsWith(`${clone}/`))) { path = path.slice(clone.length).replace(/^\/+/, ""); } else { - // Files-dir fallback for a symlink-divergent path (e.g. /tmp vs + // Artifact fallback for a symlink-divergent path (e.g. /tmp vs // /private/tmp) where the exact prefix missed: match the …/files// // layout, requiring the slug segment when we know it. (Legacy artifacts/ is // migrated to files/ in place, so it never appears in a live path.) @@ -169,7 +168,7 @@ function parseFilePath( const wt = fd ? null : path.match(/\/openresearch\/worktrees\/[^/]+\/[^/]+\/([^/]+)\/(.+)$/); const hub = fd || wt ? null : path.match(/\/openresearch\/repos\/[^/]+\/[^/]+\/(.+)$/); if (fd) { - return { path: fd[1], source: "files" }; + return { path: fd[1], source: "artifacts" }; } else if (wt) { sessionId = wt[1]; path = wt[2]; @@ -225,7 +224,7 @@ export default function App() { const [projectId, setProjectId] = useState(null); const [experiments, setExperiments] = useState([]); const [runs, setRuns] = useState([]); - const [files, setFiles] = useState(null); + const [artifacts, setArtifacts] = useState(null); const [view, setView] = useState<"tree" | "table">("tree"); // Experiments pane scope: "agent" narrows to the open chat session's work. // Falls back to "project" whenever there's no session to scope to. The @@ -276,9 +275,9 @@ export default function App() { // The agents rail is a floating panel too: fixed-width, collapsible. const [railOpen, setRailOpen] = useState(true); const [homeOpen, setHomeOpen] = useState(false); - // What the middle pane shows: the agent chat, the project's files, or + // What the middle pane shows: the agent chat, project artifacts, or // one settings section (picked from the rail nav — no separate pages). - const [mainView, setMainView] = useState<"chat" | "files" | SettingsTab>("chat"); + const [mainView, setMainView] = useState<"chat" | "artifacts" | SettingsTab>("chat"); const [onboarded, setOnboarded] = useState(() => { try { return localStorage.getItem(ONBOARDED_KEY) === "1"; @@ -351,7 +350,7 @@ export default function App() { openProject(projectId).catch(() => {}); setExperiments([]); setRuns([]); - setFiles(null); + setArtifacts(null); setSelectedRunId(null); setExpTabs([]); setFileTabs([]); @@ -367,13 +366,13 @@ export default function App() { setScope("project"); listExperiments(projectId).then(setExperiments).catch(() => {}); listRuns(projectId).then(setRuns).catch(() => {}); - getFiles(projectId).then(setFiles).catch(() => {}); + getArtifacts(projectId).then(setArtifacts).catch(() => {}); }, [projectId]); - // Refetch the files listing (on open and whenever the dir changes). - const refreshFiles = useCallback(() => { + // Refetch artifacts on open and whenever the directory changes. + const refreshArtifacts = useCallback(() => { const id = projectIdRef.current; - if (id) getFiles(id).then(setFiles).catch(() => {}); + if (id) getArtifacts(id).then(setArtifacts).catch(() => {}); }, []); // Live store updates. @@ -388,8 +387,8 @@ export default function App() { onProject: (project) => { setProjects((cur) => (cur ? upsert(cur, project) : [project])); }, - onFiles: (pid) => { - if (pid === projectIdRef.current) refreshFiles(); + onArtifacts: (pid) => { + if (pid === projectIdRef.current) refreshArtifacts(); }, }); @@ -429,13 +428,12 @@ export default function App() { rawPath, project?.repoPath, contextSessionId, - project?.filesDir, + project?.artifactsDir ?? project?.filesDir, project?.slug, ); if (!tab) return; - // A branch ref only applies to repo files; never stamp it onto a - // files-dir tab (it has no branch, and would fragment the tab identity). - if (ref && tab.source !== "files") tab.ref = ref; + // A branch ref only applies to repo files; artifacts have no branch. + if (ref && tab.source !== "artifacts") tab.ref = ref; setFileTabs((prev) => (prev.some((t) => sameFileTab(t, tab)) ? prev : [...prev, tab])); setRightTab(tab); setPanelOpen(true); @@ -737,17 +735,17 @@ export default function App() { onStartTour={startTour} onActiveSessionChange={setActiveSessionId} > - {mainView === "files" ? ( + {mainView === "artifacts" ? ( (() => { const project = projects.find((p) => p.id === projectId); return project ? ( - setMainView("storage")} /> ) : null; diff --git a/ui/src/api.ts b/ui/src/api.ts index 057334a1..a770bf8b 100644 --- a/ui/src/api.ts +++ b/ui/src/api.ts @@ -8,10 +8,11 @@ export interface Project { githubRepo: string; baselineBranch: string; repoPath: string; - /** Absolute path of the project's files dir (`/files/`), - * non-canonical to match the paths agents inline into chat. Lets the UI - * recognize a files-dir link and route it to the files endpoints. */ - filesDir: string; + /** Absolute path of the project's artifacts directory, non-canonical to + * match paths agents inline into chat. */ + artifactsDir: string; + /** Compatibility alias returned by older/newer mixed local clients. */ + filesDir?: string; runCommand?: string | null; /** arXiv id the project starts from (versionless). */ paperId?: string | null; @@ -622,63 +623,44 @@ export interface OpenResearchSettings { export const getOpenResearchSettings = () => get("/api/settings/openresearch"); -/** The experiment a top-level files folder is named for (folder == slug). */ -export interface FileExperiment { - id: string; - slug: string; - title?: string; - branchName: string; - /** The experiment's most recent run status, if it has ever run. */ - latestRunStatus?: string; -} - -/** One node of the files tree: a file, or a directory with children. */ -export interface FileEntry { +/** One node of the artifacts tree: a file, or a directory with children. */ +export interface ArtifactEntry { name: string; - /** Dir-relative `/`-joined path — the id for file/report/delete endpoints. */ + /** Directory-relative `/`-joined path — the id for read/delete endpoints. */ path: string; isDir: boolean; /** 0 for directories. */ size: number; modifiedAt: number; - /** Set when the dir holds a top-level report.md — renders as a report. */ - reportTitle?: string; - /** Top-level dirs only: the experiment this folder corresponds to. */ - experiment?: FileExperiment; - children?: FileEntry[]; + children?: ArtifactEntry[]; } -/** Listing of the project's on-disk files directory. */ -export interface ProjectFiles { +/** Listing of the project's on-disk artifacts directory. */ +export interface ProjectArtifacts { dir: string; - entries: FileEntry[]; + entries: ArtifactEntry[]; truncated: boolean; } -export const getFiles = (projectId: string) => - get(`/api/projects/${projectId}/files`); +export const getArtifacts = (projectId: string) => + get(`/api/projects/${projectId}/files`); -export const getFileReport = (projectId: string, name: string) => - get<{ markdown: string }>( - `/api/projects/${projectId}/files/report?path=${encodeURIComponent(name)}`, - ); - -/** Delete a file or report folder in the files dir. */ -export const deleteFile = (projectId: string, path: string) => +/** Delete a file or folder in the artifacts directory. */ +export const deleteArtifact = (projectId: string, path: string) => fetch(`/api/projects/${projectId}/files?path=${encodeURIComponent(path)}`, { method: "DELETE", }).then((r) => json<{ ok: boolean }>(r)); -/** Raw file (images, CSVs, report figures) served by the API. */ -export const fileUrl = (projectId: string, path: string) => +/** Raw artifact bytes served by the compatibility `/files` API. */ +export const artifactUrl = (projectId: string, path: string) => `/api/projects/${projectId}/files/file?path=${encodeURIComponent(path)}`; -/** Text body of a files-dir file (raw bytes decoded as UTF-8), or `null` when +/** Text body of an artifact (raw bytes decoded as UTF-8), or `null` when * the file is missing (404). The endpoint returns bytes, not JSON, so this * bypasses the `get`/`json` helpers; a 404 is a normal "not found", not an * error to surface. */ -export const getFilesDirFileText = (projectId: string, path: string): Promise => - fetch(fileUrl(projectId, path)).then((r) => { +export const getArtifactFileText = (projectId: string, path: string): Promise => + fetch(artifactUrl(projectId, path)).then((r) => { if (r.status === 404) return null; // Bare message — the viewer prefixes "Failed to load file:" itself. if (!r.ok) throw new Error(`HTTP ${r.status}`); diff --git a/ui/src/components/FilesTab.tsx b/ui/src/components/ArtifactsTab.tsx similarity index 65% rename from ui/src/components/FilesTab.tsx rename to ui/src/components/ArtifactsTab.tsx index 38dd0d99..acd27d06 100644 --- a/ui/src/components/FilesTab.tsx +++ b/ui/src/components/ArtifactsTab.tsx @@ -16,26 +16,53 @@ import rehypeKatex from "rehype-katex"; import remarkGfm from "remark-gfm"; import remarkMath from "remark-math"; import { - deleteFile, - fileUrl, + artifactUrl, + deleteArtifact, fmtBytes, - getFileReport, - type FileEntry, + type ArtifactEntry, type Project, - type ProjectFiles, + type ProjectArtifacts, } from "../api"; import { CodeView } from "./CodeView"; import { mdCodeComponents, normalizeMathDelimiters, remarkMathOptions } from "./Md"; -/** Top-level folder reserved for project-wide reports (mirrors the backend). */ -const PROJECT_NAMESPACE = "project"; - /** Any href with a URI scheme (https:, mailto:, data:, …) or a - * protocol-relative // — i.e. not a report-relative path to resolve. */ + * protocol-relative // — i.e. not an artifact-relative path to resolve. */ function isExternalSrc(src: string): boolean { return /^[a-z][a-z0-9+.-]*:/i.test(src) || src.startsWith("//"); } +/** Resolve a Markdown target within the artifacts root. URL suffixes stay + * outside the encoded filesystem path, and upward escapes are rejected. */ +function artifactTargetUrl(projectId: string, folder: string, src: string): string | null { + const hashAt = src.indexOf("#"); + const beforeHash = hashAt === -1 ? src : src.slice(0, hashAt); + const hash = hashAt === -1 ? "" : src.slice(hashAt); + const queryAt = beforeHash.indexOf("?"); + const pathname = queryAt === -1 ? beforeHash : beforeHash.slice(0, queryAt); + const query = queryAt === -1 ? "" : beforeHash.slice(queryAt + 1); + const parts = pathname.startsWith("/") + ? [] + : folder.split("/").filter((part) => part.length > 0); + + for (const part of pathname.split("/")) { + if (!part || part === ".") continue; + if (part === "..") { + if (parts.length === 0) return null; + parts.pop(); + } else { + parts.push(part); + } + } + + const path = parts.join("/"); + if (!path) return null; + const queryParams = new URLSearchParams(query); + queryParams.delete("path"); + const querySuffix = queryParams.toString(); + return `${artifactUrl(projectId, path)}${querySuffix ? `&${querySuffix}` : ""}${hash}`; +} + /** Drop a leading YAML frontmatter block so it doesn't render as markdown. */ function stripFrontmatter(md: string): string { if (!md.startsWith("---")) return md; @@ -50,6 +77,7 @@ const MAX_TEXT_PREVIEW = 512 * 1024; /** Tree pane width: draggable divider, persisted across reloads. */ const TREE_WIDTH_KEY = "orx:files-tree-width"; +const COLLAPSED_DIRS_KEY_PREFIX = "orx:artifacts-collapsed:"; const TREE_MIN_WIDTH = 180; const TREE_MAX_WIDTH = 560; const TREE_DEFAULT_WIDTH = 280; @@ -64,8 +92,20 @@ function initialTreeWidth(): number { return TREE_DEFAULT_WIDTH; } -/** Depth-first lookup of a tree entry by its dir-relative path. */ -function findEntry(entries: FileEntry[], path: string): FileEntry | null { +function initialCollapsed(projectId: string): Set { + try { + const raw = localStorage.getItem(`${COLLAPSED_DIRS_KEY_PREFIX}${projectId}`); + if (!raw) return new Set(); + const value: unknown = JSON.parse(raw); + if (!Array.isArray(value)) return new Set(); + return new Set(value.filter((path): path is string => typeof path === "string")); + } catch { + return new Set(); + } +} + +/** Depth-first lookup of a tree entry by its directory-relative path. */ +function findEntry(entries: ArtifactEntry[], path: string): ArtifactEntry | null { for (const e of entries) { if (e.path === path) return e; if (e.isDir && path.startsWith(e.path + "/")) { @@ -76,22 +116,9 @@ function findEntry(entries: FileEntry[], path: string): FileEntry | null { return null; } -/** Every report folder in the tree, for the initial auto-selection. */ -function collectReports(entries: FileEntry[]): FileEntry[] { - const out: FileEntry[] = []; - for (const e of entries) { - if (!e.isDir) continue; - if (e.reportTitle !== undefined) out.push(e); - out.push(...collectReports(e.children ?? [])); - } - return out; -} - -/** Report markdown with report-relative image/link paths (`images/...`) - * rewritten to the file endpoint, scoped to the report's folder. Exported so - * the chat file viewer can render files-dir reports with the same image - * resolution (a bare would 404 the figures). */ -export function ReportMd({ +/** Artifact markdown with relative image/link paths rewritten to the raw + * artifact endpoint, scoped to the markdown file's parent directory. */ +export function ArtifactMarkdown({ projectId, folder, markdown, @@ -102,11 +129,10 @@ export function ReportMd({ }) { const resolve = (src: string) => { if (isExternalSrc(src)) return src; - const rel = src.replace(/^\.?\//, ""); - return fileUrl(projectId, folder ? `${folder}/${rel}` : rel); + return artifactTargetUrl(projectId, folder, src); }; return ( -
+
{ const isHash = !href || href.startsWith("#"); + const resolved = isHash ? href : resolve(href); + if (!resolved) return {children}; return ( {children} @@ -128,10 +156,11 @@ export function ReportMd({ img: ({ src, alt }) => { if (!src || typeof src !== "string") return null; const url = resolve(src); + if (!url) return null; return ( - + {alt - {alt && {alt}} + {alt && {alt}} ); }, @@ -144,27 +173,23 @@ export function ReportMd({ ); } -type PreviewKind = "report" | "markdown" | "image" | "pdf" | "text"; +type PreviewKind = "markdown" | "image" | "pdf" | "text"; -function previewKind(entry: FileEntry): PreviewKind { - // Only report folders are selectable (plain dirs merely toggle open), so - // a dir here always has a report.md to render. - if (entry.isDir) return "report"; +function previewKind(entry: ArtifactEntry): PreviewKind { if (MD_RE.test(entry.name)) return "markdown"; if (IMAGE_RE.test(entry.name)) return "image"; if (/\.pdf$/i.test(entry.name)) return "pdf"; return "text"; } -/** Fetched body for kinds that need text: report md, file md, or raw text. +/** Fetched body for kinds that need text: markdown or raw text. * `binary` flags NUL bytes so we don't dump garbage into a
. */
-function useTextBody(projectId: string, entry: FileEntry, kind: PreviewKind) {
+function useTextBody(projectId: string, entry: ArtifactEntry, kind: PreviewKind) {
   const [text, setText] = useState(null);
   const [binary, setBinary] = useState(false);
   const [error, setError] = useState(null);
 
-  const wantsText =
-    kind === "report" || kind === "markdown" || (kind === "text" && entry.size <= MAX_TEXT_PREVIEW);
+  const wantsText = kind === "markdown" || (kind === "text" && entry.size <= MAX_TEXT_PREVIEW);
 
   useEffect(() => {
     // Reset before the wantsText guard: a refire on the same mounted entry
@@ -175,13 +200,10 @@ function useTextBody(projectId: string, entry: FileEntry, kind: PreviewKind) {
     setError(null);
     if (!wantsText) return;
     let cancelled = false;
-    const load =
-      kind === "report"
-        ? getFileReport(projectId, entry.path).then((r) => r.markdown)
-        : fetch(fileUrl(projectId, entry.path)).then((r) => {
-            if (!r.ok) throw new Error(`Failed to load file (${r.status})`);
-            return r.text();
-          });
+    const load = fetch(artifactUrl(projectId, entry.path)).then((r) => {
+      if (!r.ok) throw new Error(`Failed to load artifact (${r.status})`);
+      return r.text();
+    });
     load
       .then((body) => {
         if (cancelled) return;
@@ -199,25 +221,23 @@ function useTextBody(projectId: string, entry: FileEntry, kind: PreviewKind) {
   return { text, binary, error, wantsText };
 }
 
-/** Right pane: the selected entry rendered inline — report folders and
- * markdown as documents, images/PDFs directly, everything else as code. */
+/** Right pane: the selected artifact rendered inline — markdown as a document,
+ * images/PDFs directly, and everything else as code. */
 function PreviewPane({
   projectId,
   entry,
   onDelete,
 }: {
   projectId: string;
-  entry: FileEntry;
+  entry: ArtifactEntry;
   onDelete: (path: string) => void;
 }) {
   const kind = previewKind(entry);
   const { text, binary, error, wantsText } = useTextBody(projectId, entry, kind);
   const [showSource, setShowSource] = useState(false);
-  const isDoc = kind === "report" || kind === "markdown";
-  // Reports resolve images relative to their folder; a bare .md file
-  // resolves relative to its parent directory.
-  const mdFolder = entry.isDir ? entry.path : entry.path.split("/").slice(0, -1).join("/");
-  const rawUrl = fileUrl(projectId, entry.isDir ? `${entry.path}/report.md` : entry.path);
+  const isDoc = kind === "markdown";
+  const mdFolder = entry.path.split("/").slice(0, -1).join("/");
+  const rawUrl = artifactUrl(projectId, entry.path);
 
   let body: ReactNode;
   if (kind === "image") {
@@ -246,9 +266,9 @@ function PreviewPane({
       
); } else if (isDoc && !showSource) { - body = ; + body = ; } else { - body = ; + body = ; } return ( @@ -257,7 +277,7 @@ function PreviewPane({
- {entry.isDir ? `${entry.path}/report.md` : entry.path} + {entry.path} Modified{" "} @@ -266,7 +286,7 @@ function PreviewPane({ timeStyle: "short", })} - {!entry.isDir && kind === "text" && ( + {kind === "text" && ( {fmtBytes(entry.size)} )} {isDoc && ( @@ -291,10 +311,10 @@ function PreviewPane({ - {label} + {e.name}/ +
{open && (e.children?.length ?? 0) > 0 && ( )}
@@ -381,7 +404,7 @@ function TreeRows({ > {IMAGE_RE.test(e.name) && ( - + )} {e.name} @@ -391,26 +414,7 @@ function TreeRows({ ); } -/** Top-level ordering that mirrors the layout convention: the reserved - * `project/` namespace first, then experiment folders, then everything else - * (which keeps its dirs-then-files explorer order). */ -function groupTopLevel(entries: FileEntry[]): { - project: FileEntry[]; - experiments: FileEntry[]; - other: FileEntry[]; -} { - const project: FileEntry[] = []; - const experiments: FileEntry[] = []; - const other: FileEntry[] = []; - for (const e of entries) { - if (e.isDir && e.name === PROJECT_NAMESPACE) project.push(e); - else if (e.isDir && e.experiment) experiments.push(e); - else other.push(e); - } - return { project, experiments, other }; -} - -/** The files dir path, copyable — demoted to a footer under the tree. */ +/** The artifacts directory path, copyable in the tree footer. */ function DirFooter({ dir, onOpenStorage }: { dir: string; onOpenStorage: () => void }) { const [copied, setCopied] = useState(false); return ( @@ -419,7 +423,7 @@ function DirFooter({ dir, onOpenStorage }: { dir: string; onOpenStorage: () => v {SETTINGS_NAV.map((item) => (