@minimax-ai/code 0.4.2 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/CHANGELOG.zh-CN.md +18 -0
- package/chunks/{chunk-BEUVALD2.js → chunk-LBDCGSPW.js} +289 -289
- package/chunks/{chunk-BEBFQY6O.js → chunk-R7KEYFVA.js} +1 -1
- package/chunks/{chunk-VFMQBQ74.js → chunk-WOISMRTU.js} +395 -395
- package/chunks/{launcher-TUY2TFYJ.js → launcher-2GOTCBNH.js} +3 -3
- package/chunks/{lifecycle-6JTTIEH2.js → lifecycle-I4FKLUH5.js} +1 -1
- package/chunks/{main-RHDM3DSB.js → main-ATLGUB2N.js} +1 -1
- package/chunks/{plugin-command-34BQGAX4.js → plugin-command-37F33YBS.js} +1 -1
- package/chunks/{provider-command-XOI6VZ4Z.js → provider-command-QXHFS5QQ.js} +1 -1
- package/chunks/{run-acp-command-BH3V7PS6.js → run-acp-command-I4VY32ZG.js} +1 -1
- package/chunks/{run-exec-command-FMHHG5HZ.js → run-exec-command-TJEUBFQ5.js} +1 -1
- package/cli.js +1 -1
- package/package.json +1 -2
- package/matrix-mcp-stdio.js +0 -127
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __mavis_cR } from "module"; import { basename as __mavis_basename, dirname as __mavis_dirname, join as __mavis_join } from "path"; import { fileURLToPath as __mavis_fileURLToPath, pathToFileURL as __mavis_pathToFileURL } from "url"; const __mavis_tuiCurrentModuleDir = __mavis_dirname(__mavis_fileURLToPath(import.meta.url)); const __mavis_tuiPackageRoot = __mavis_basename(__mavis_tuiCurrentModuleDir) === "chunks" ? __mavis_dirname(__mavis_tuiCurrentModuleDir) : __mavis_tuiCurrentModuleDir; const __mavis_tuiPackageEntryUrl = __mavis_pathToFileURL(__mavis_join(__mavis_tuiPackageRoot, "cli.js")).href; const require = __mavis_cR(__mavis_tuiPackageEntryUrl); const __dirname = __mavis_tuiPackageRoot;
|
|
2
|
-
import{a as Gg}from"./chunk-JCDDI4WJ.js";import{a as zg}from"./chunk-ZQPXBOPP.js";import{c as Fh,d as Mg,e as Eg}from"./chunk-U62SRHG3.js";import"./chunk-I3GV76MP.js";import{a as x,b as Bh,c as oo,d as Pg,e as _g,f as Lg,h as qh}from"./chunk-BEBFQY6O.js";import{Se as iT,d as kt,f as Dg,g as Fg,h as $g,i as Bg,j as Mn,k as vi,l as Vg,m as Qg,ne as eT,oe as tT,pe as nT,q as Yg}from"./chunk-VFMQBQ74.js";import{a as ro,b as L,c as ot,d as Xa}from"./chunk-A2CQYOXE.js";import{a as qt,b as qg,c as Kg}from"./chunk-HEAI577S.js";import{a as Ug,b as Si,c as tu,e as Wg,f as jg}from"./chunk-SLRPB56L.js";import{a as wn,b as Ag,c as Ja,f as Rg,j as kg,k as Yi,m as In,n as Za,o as eu,p as Ng,q as Hg}from"./chunk-XYXCVIX2.js";import{a as Qi,b as Xg,c as rT}from"./chunk-NF72FWAW.js";import{a as sT}from"./chunk-4NX3LPKA.js";import{a as $h,b as eA}from"./chunk-OJA2IAQ6.js";import{b as Jg,c as Zg}from"./chunk-NP5G53PV.js";import{a as Og}from"./chunk-YPMJNO4T.js";import"./chunk-PPIEC7ZM.js";import{a as bi}from"./chunk-C3JRMX7L.js";import{a as tA}from"./chunk-L5D56V5D.js";import"./chunk-75PL5LYJ.js";import"./chunk-AABEG2OJ.js";import{c as wg}from"./chunk-FLEWADRD.js";import{b as Sg,d as Cg,e as xg}from"./chunk-MNN6EKX3.js";import"./chunk-O6RIRKRN.js";import"./chunk-HQ2U4QVQ.js";import{d as Ig}from"./chunk-V7D3N7GI.js";import{a as pg,e as mg,k as yg,p as bg,q as vg}from"./chunk-AAJMOWWM.js";import{e as fg,ra as gg}from"./chunk-6BYKHQOV.js";import"./chunk-2ZG44JU6.js";import{h as Tg}from"./chunk-ZITT4GJK.js";import"./chunk-Y27DNFV2.js";import"./chunk-CWWDVX6C.js";import"./chunk-RPO5CDCP.js";import"./chunk-LOQ4VVEN.js";import"./chunk-SD6SJL3L.js";import"./chunk-PWQHCWDV.js";import"./chunk-2UWBSJDH.js";import"./chunk-GUFBGYOC.js";import"./chunk-CK62QLTS.js";import"./chunk-WFWSBUYD.js";import{a as hg,c as ue,e as ZE}from"./chunk-D76SO2ME.js";var Qu=ue(zn=>{"use strict";var $5=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];zn.REPLACEMENT_CHARACTER="\uFFFD";zn.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533};zn.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]};zn.isSurrogate=function(n){return n>=55296&&n<=57343};zn.isSurrogatePair=function(n){return n>=56320&&n<=57343};zn.getSurrogatePairCodePoint=function(n,e){return(n-55296)*1024+9216+e};zn.isControlCodePoint=function(n){return n!==32&&n!==10&&n!==13&&n!==9&&n!==12&&n>=1&&n<=31||n>=127&&n<=159};zn.isUndefinedCodePoint=function(n){return n>=64976&&n<=65007||$5.indexOf(n)>-1}});var Yu=ue((jW,Tb)=>{"use strict";Tb.exports={controlCharacterInInputStream:"control-character-in-input-stream",noncharacterInInputStream:"noncharacter-in-input-stream",surrogateInInputStream:"surrogate-in-input-stream",nonVoidHtmlElementStartTagWithTrailingSolidus:"non-void-html-element-start-tag-with-trailing-solidus",endTagWithAttributes:"end-tag-with-attributes",endTagWithTrailingSolidus:"end-tag-with-trailing-solidus",unexpectedSolidusInTag:"unexpected-solidus-in-tag",unexpectedNullCharacter:"unexpected-null-character",unexpectedQuestionMarkInsteadOfTagName:"unexpected-question-mark-instead-of-tag-name",invalidFirstCharacterOfTagName:"invalid-first-character-of-tag-name",unexpectedEqualsSignBeforeAttributeName:"unexpected-equals-sign-before-attribute-name",missingEndTagName:"missing-end-tag-name",unexpectedCharacterInAttributeName:"unexpected-character-in-attribute-name",unknownNamedCharacterReference:"unknown-named-character-reference",missingSemicolonAfterCharacterReference:"missing-semicolon-after-character-reference",unexpectedCharacterAfterDoctypeSystemIdentifier:"unexpected-character-after-doctype-system-identifier",unexpectedCharacterInUnquotedAttributeValue:"unexpected-character-in-unquoted-attribute-value",eofBeforeTagName:"eof-before-tag-name",eofInTag:"eof-in-tag",missingAttributeValue:"missing-attribute-value",missingWhitespaceBetweenAttributes:"missing-whitespace-between-attributes",missingWhitespaceAfterDoctypePublicKeyword:"missing-whitespace-after-doctype-public-keyword",missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:"missing-whitespace-between-doctype-public-and-system-identifiers",missingWhitespaceAfterDoctypeSystemKeyword:"missing-whitespace-after-doctype-system-keyword",missingQuoteBeforeDoctypePublicIdentifier:"missing-quote-before-doctype-public-identifier",missingQuoteBeforeDoctypeSystemIdentifier:"missing-quote-before-doctype-system-identifier",missingDoctypePublicIdentifier:"missing-doctype-public-identifier",missingDoctypeSystemIdentifier:"missing-doctype-system-identifier",abruptDoctypePublicIdentifier:"abrupt-doctype-public-identifier",abruptDoctypeSystemIdentifier:"abrupt-doctype-system-identifier",cdataInHtmlContent:"cdata-in-html-content",incorrectlyOpenedComment:"incorrectly-opened-comment",eofInScriptHtmlCommentLikeText:"eof-in-script-html-comment-like-text",eofInDoctype:"eof-in-doctype",nestedComment:"nested-comment",abruptClosingOfEmptyComment:"abrupt-closing-of-empty-comment",eofInComment:"eof-in-comment",incorrectlyClosedComment:"incorrectly-closed-comment",eofInCdata:"eof-in-cdata",absenceOfDigitsInNumericCharacterReference:"absence-of-digits-in-numeric-character-reference",nullCharacterReference:"null-character-reference",surrogateCharacterReference:"surrogate-character-reference",characterReferenceOutsideUnicodeRange:"character-reference-outside-unicode-range",controlCharacterReference:"control-character-reference",noncharacterCharacterReference:"noncharacter-character-reference",missingWhitespaceBeforeDoctypeName:"missing-whitespace-before-doctype-name",missingDoctypeName:"missing-doctype-name",invalidCharacterSequenceAfterDoctypeName:"invalid-character-sequence-after-doctype-name",duplicateAttribute:"duplicate-attribute",nonConformingDoctype:"non-conforming-doctype",missingDoctype:"missing-doctype",misplacedDoctype:"misplaced-doctype",endTagWithoutMatchingOpenElement:"end-tag-without-matching-open-element",closingOfElementWithOpenChildElements:"closing-of-element-with-open-child-elements",disallowedContentInNoscriptInHead:"disallowed-content-in-noscript-in-head",openElementsLeftAfterEof:"open-elements-left-after-eof",abandonedHeadElementChild:"abandoned-head-element-child",misplacedStartTagForHeadElement:"misplaced-start-tag-for-head-element",nestedNoscriptInHead:"nested-noscript-in-head",eofInElementThatCanContainOnlyText:"eof-in-element-that-can-contain-only-text"}});var bb=ue((VW,yb)=>{"use strict";var ar=Qu(),Hp=Yu(),ms=ar.CODE_POINTS,B5=65536,Up=class{constructor(){this.html=null,this.pos=-1,this.lastGapPos=-1,this.lastCharPos=-1,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=B5}_err(){}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.lastCharPos){let t=this.html.charCodeAt(this.pos+1);if(ar.isSurrogatePair(t))return this.pos++,this._addGap(),ar.getSurrogatePairCodePoint(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,ms.EOF;return this._err(Hp.surrogateInInputStream),e}dropParsedChunk(){this.pos>this.bufferWaterline&&(this.lastCharPos-=this.pos,this.html=this.html.substring(this.pos),this.pos=0,this.lastGapPos=-1,this.gapStack=[])}write(e,t){this.html?this.html+=e:this.html=e,this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length),this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1}advance(){if(this.pos++,this.pos>this.lastCharPos)return this.endOfChunkHit=!this.lastChunkWritten,ms.EOF;let e=this.html.charCodeAt(this.pos);return this.skipNextNewLine&&e===ms.LINE_FEED?(this.skipNextNewLine=!1,this._addGap(),this.advance()):e===ms.CARRIAGE_RETURN?(this.skipNextNewLine=!0,ms.LINE_FEED):(this.skipNextNewLine=!1,ar.isSurrogate(e)&&(e=this._processSurrogate(e)),e>31&&e<127||e===ms.LINE_FEED||e===ms.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){ar.isControlCodePoint(e)?this._err(Hp.controlCharacterInInputStream):ar.isUndefinedCodePoint(e)&&this._err(Hp.noncharacterInInputStream)}retreat(){this.pos===this.lastGapPos&&(this.lastGapPos=this.gapStack.pop(),this.pos--),this.pos--}};yb.exports=Up});var Sb=ue((GW,vb)=>{"use strict";vb.exports=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204])});var Ho=ue((zW,b0)=>{"use strict";var q5=bb(),Me=Qu(),Ts=Sb(),O=Yu(),w=Me.CODE_POINTS,fs=Me.CODE_POINT_SEQUENCES,H5={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},p0=1,m0=2,f0=4,U5=p0|m0|f0,le="DATA_STATE",lr="RCDATA_STATE",Bo="RAWTEXT_STATE",Xn="SCRIPT_DATA_STATE",g0="PLAINTEXT_STATE",Cb="TAG_OPEN_STATE",xb="END_TAG_OPEN_STATE",Kp="TAG_NAME_STATE",wb="RCDATA_LESS_THAN_SIGN_STATE",Ib="RCDATA_END_TAG_OPEN_STATE",Mb="RCDATA_END_TAG_NAME_STATE",Eb="RAWTEXT_LESS_THAN_SIGN_STATE",Ab="RAWTEXT_END_TAG_OPEN_STATE",Rb="RAWTEXT_END_TAG_NAME_STATE",kb="SCRIPT_DATA_LESS_THAN_SIGN_STATE",Pb="SCRIPT_DATA_END_TAG_OPEN_STATE",_b="SCRIPT_DATA_END_TAG_NAME_STATE",Lb="SCRIPT_DATA_ESCAPE_START_STATE",Ob="SCRIPT_DATA_ESCAPE_START_DASH_STATE",hn="SCRIPT_DATA_ESCAPED_STATE",Nb="SCRIPT_DATA_ESCAPED_DASH_STATE",Wp="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE",Xu="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE",Db="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE",Fb="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE",$b="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE",Qn="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",Bb="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",qb="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",Ju="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",Hb="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",Rn="BEFORE_ATTRIBUTE_NAME_STATE",Zu="ATTRIBUTE_NAME_STATE",jp="AFTER_ATTRIBUTE_NAME_STATE",Vp="BEFORE_ATTRIBUTE_VALUE_STATE",el="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",tl="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",nl="ATTRIBUTE_VALUE_UNQUOTED_STATE",Gp="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE",Ai="SELF_CLOSING_START_TAG_STATE",No="BOGUS_COMMENT_STATE",Ub="MARKUP_DECLARATION_OPEN_STATE",Kb="COMMENT_START_STATE",Wb="COMMENT_START_DASH_STATE",Ri="COMMENT_STATE",jb="COMMENT_LESS_THAN_SIGN_STATE",Vb="COMMENT_LESS_THAN_SIGN_BANG_STATE",Gb="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE",zb="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE",il="COMMENT_END_DASH_STATE",sl="COMMENT_END_STATE",Qb="COMMENT_END_BANG_STATE",Yb="DOCTYPE_STATE",rl="BEFORE_DOCTYPE_NAME_STATE",ol="DOCTYPE_NAME_STATE",Xb="AFTER_DOCTYPE_NAME_STATE",Jb="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE",Zb="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE",zp="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE",Qp="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE",Yp="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE",e0="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE",t0="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE",n0="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE",Do="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE",Fo="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE",Xp="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE",Yn="BOGUS_DOCTYPE_STATE",al="CDATA_SECTION_STATE",i0="CDATA_SECTION_BRACKET_STATE",s0="CDATA_SECTION_END_STATE",ur="CHARACTER_REFERENCE_STATE",r0="NAMED_CHARACTER_REFERENCE_STATE",o0="AMBIGUOS_AMPERSAND_STATE",a0="NUMERIC_CHARACTER_REFERENCE_STATE",u0="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE",l0="DECIMAL_CHARACTER_REFERENCE_START_STATE",c0="HEXADEMICAL_CHARACTER_REFERENCE_STATE",d0="DECIMAL_CHARACTER_REFERENCE_STATE",$o="NUMERIC_CHARACTER_REFERENCE_END_STATE";function Pe(n){return n===w.SPACE||n===w.LINE_FEED||n===w.TABULATION||n===w.FORM_FEED}function qo(n){return n>=w.DIGIT_0&&n<=w.DIGIT_9}function pn(n){return n>=w.LATIN_CAPITAL_A&&n<=w.LATIN_CAPITAL_Z}function gs(n){return n>=w.LATIN_SMALL_A&&n<=w.LATIN_SMALL_Z}function Pi(n){return gs(n)||pn(n)}function Jp(n){return Pi(n)||qo(n)}function T0(n){return n>=w.LATIN_CAPITAL_A&&n<=w.LATIN_CAPITAL_F}function y0(n){return n>=w.LATIN_SMALL_A&&n<=w.LATIN_SMALL_F}function K5(n){return qo(n)||T0(n)||y0(n)}function ul(n){return n+32}function qe(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode(n>>>10&1023|55296)+String.fromCharCode(56320|n&1023))}function ki(n){return String.fromCharCode(ul(n))}function h0(n,e){let t=Ts[++n],i=++n,s=i+t-1;for(;i<=s;){let r=i+s>>>1,o=Ts[r];if(o<e)i=r+1;else if(o>e)s=r-1;else return Ts[r+t]}return-1}var Ct=class n{constructor(){this.preprocessor=new q5,this.tokenQueue=[],this.allowCDATA=!1,this.state=le,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this[this.state](e)}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t)}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:n.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(e){this.state=e,this._unconsume()}_consumeSequenceIfMatch(e,t,i){let s=0,r=!0,o=e.length,a=0,u=t,l;for(;a<o;a++){if(a>0&&(u=this._consume(),s++),u===w.EOF){r=!1;break}if(l=e[a],u!==l&&(i||u!==ul(l))){r=!1;break}}if(!r)for(;s--;)this._unconsume();return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==fs.SCRIPT_STRING.length)return!1;for(let e=0;e<this.tempBuff.length;e++)if(this.tempBuff[e]!==fs.SCRIPT_STRING[e])return!1;return!0}_createStartTagToken(){this.currentToken={type:n.START_TAG_TOKEN,tagName:"",selfClosing:!1,ackSelfClosing:!1,attrs:[]}}_createEndTagToken(){this.currentToken={type:n.END_TAG_TOKEN,tagName:"",selfClosing:!1,attrs:[]}}_createCommentToken(){this.currentToken={type:n.COMMENT_TOKEN,data:""}}_createDoctypeToken(e){this.currentToken={type:n.DOCTYPE_TOKEN,name:e,forceQuirks:!1,publicId:null,systemId:null}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t}}_createEOFToken(){this.currentToken={type:n.EOF_TOKEN}}_createAttr(e){this.currentAttr={name:e,value:""}}_leaveAttrName(e){n.getTokenAttr(this.currentToken,this.currentAttr.name)===null?this.currentToken.attrs.push(this.currentAttr):this._err(O.duplicateAttribute),this.state=e}_leaveAttrValue(e){this.state=e}_emitCurrentToken(){this._emitCurrentCharacterToken();let e=this.currentToken;this.currentToken=null,e.type===n.START_TAG_TOKEN?this.lastStartTagName=e.tagName:e.type===n.END_TAG_TOKEN&&(e.attrs.length>0&&this._err(O.endTagWithAttributes),e.selfClosing&&this._err(O.endTagWithTrailingSolidus)),this.tokenQueue.push(e)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t)}_emitCodePoint(e){let t=n.CHARACTER_TOKEN;Pe(e)?t=n.WHITESPACE_CHARACTER_TOKEN:e===w.NULL&&(t=n.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,qe(e))}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++)this._emitCodePoint(e[t])}_emitChars(e){this._appendCharToCurrentCharacterToken(n.CHARACTER_TOKEN,e)}_matchNamedCharacterReference(e){let t=null,i=1,s=h0(0,e);for(this.tempBuff.push(e);s>-1;){let r=Ts[s],o=r<U5;o&&r&p0&&(t=r&m0?[Ts[++s],Ts[++s]]:[Ts[++s]],i=0);let u=this._consume();if(this.tempBuff.push(u),i++,u===w.EOF)break;o?s=r&f0?h0(s,u):-1:s=u===r?++s:-1}for(;i--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return this.returnState===el||this.returnState===tl||this.returnState===nl}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){let t=this._consume();return this._unconsume(),t===w.EQUALS_SIGN||Jp(t)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e<this.tempBuff.length;e++)this.currentAttr.value+=qe(this.tempBuff[e]);else this._emitSeveralCodePoints(this.tempBuff);this.tempBuff=[]}[le](e){this.preprocessor.dropParsedChunk(),e===w.LESS_THAN_SIGN?this.state=Cb:e===w.AMPERSAND?(this.returnState=le,this.state=ur):e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitCodePoint(e)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[lr](e){this.preprocessor.dropParsedChunk(),e===w.AMPERSAND?(this.returnState=lr,this.state=ur):e===w.LESS_THAN_SIGN?this.state=wb:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[Bo](e){this.preprocessor.dropParsedChunk(),e===w.LESS_THAN_SIGN?this.state=Eb:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[Xn](e){this.preprocessor.dropParsedChunk(),e===w.LESS_THAN_SIGN?this.state=kb:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[g0](e){this.preprocessor.dropParsedChunk(),e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[Cb](e){e===w.EXCLAMATION_MARK?this.state=Ub:e===w.SOLIDUS?this.state=xb:Pi(e)?(this._createStartTagToken(),this._reconsumeInState(Kp)):e===w.QUESTION_MARK?(this._err(O.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(),this._reconsumeInState(No)):e===w.EOF?(this._err(O.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken()):(this._err(O.invalidFirstCharacterOfTagName),this._emitChars("<"),this._reconsumeInState(le))}[xb](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Kp)):e===w.GREATER_THAN_SIGN?(this._err(O.missingEndTagName),this.state=le):e===w.EOF?(this._err(O.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken()):(this._err(O.invalidFirstCharacterOfTagName),this._createCommentToken(),this._reconsumeInState(No))}[Kp](e){Pe(e)?this.state=Rn:e===w.SOLIDUS?this.state=Ai:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):pn(e)?this.currentToken.tagName+=ki(e):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.tagName+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentToken.tagName+=qe(e)}[wb](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Ib):(this._emitChars("<"),this._reconsumeInState(lr))}[Ib](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Mb)):(this._emitChars("</"),this._reconsumeInState(lr))}[Mb](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}if(e===w.SOLIDUS){this.state=Ai;return}if(e===w.GREATER_THAN_SIGN){this.state=le,this._emitCurrentToken();return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(lr)}}[Eb](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Ab):(this._emitChars("<"),this._reconsumeInState(Bo))}[Ab](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Rb)):(this._emitChars("</"),this._reconsumeInState(Bo))}[Rb](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}if(e===w.SOLIDUS){this.state=Ai;return}if(e===w.GREATER_THAN_SIGN){this._emitCurrentToken(),this.state=le;return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Bo)}}[kb](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Pb):e===w.EXCLAMATION_MARK?(this.state=Lb,this._emitChars("<!")):(this._emitChars("<"),this._reconsumeInState(Xn))}[Pb](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(_b)):(this._emitChars("</"),this._reconsumeInState(Xn))}[_b](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}else if(e===w.SOLIDUS){this.state=Ai;return}else if(e===w.GREATER_THAN_SIGN){this._emitCurrentToken(),this.state=le;return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Xn)}}[Lb](e){e===w.HYPHEN_MINUS?(this.state=Ob,this._emitChars("-")):this._reconsumeInState(Xn)}[Ob](e){e===w.HYPHEN_MINUS?(this.state=Wp,this._emitChars("-")):this._reconsumeInState(Xn)}[hn](e){e===w.HYPHEN_MINUS?(this.state=Nb,this._emitChars("-")):e===w.LESS_THAN_SIGN?this.state=Xu:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(e)}[Nb](e){e===w.HYPHEN_MINUS?(this.state=Wp,this._emitChars("-")):e===w.LESS_THAN_SIGN?this.state=Xu:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=hn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=hn,this._emitCodePoint(e))}[Wp](e){e===w.HYPHEN_MINUS?this._emitChars("-"):e===w.LESS_THAN_SIGN?this.state=Xu:e===w.GREATER_THAN_SIGN?(this.state=Xn,this._emitChars(">")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=hn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=hn,this._emitCodePoint(e))}[Xu](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Db):Pi(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState($b)):(this._emitChars("<"),this._reconsumeInState(hn))}[Db](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Fb)):(this._emitChars("</"),this._reconsumeInState(hn))}[Fb](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}if(e===w.SOLIDUS){this.state=Ai;return}if(e===w.GREATER_THAN_SIGN){this._emitCurrentToken(),this.state=le;return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(hn)}}[$b](e){Pe(e)||e===w.SOLIDUS||e===w.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?Qn:hn,this._emitCodePoint(e)):pn(e)?(this.tempBuff.push(ul(e)),this._emitCodePoint(e)):gs(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(hn)}[Qn](e){e===w.HYPHEN_MINUS?(this.state=Bb,this._emitChars("-")):e===w.LESS_THAN_SIGN?(this.state=Ju,this._emitChars("<")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(e)}[Bb](e){e===w.HYPHEN_MINUS?(this.state=qb,this._emitChars("-")):e===w.LESS_THAN_SIGN?(this.state=Ju,this._emitChars("<")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=Qn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=Qn,this._emitCodePoint(e))}[qb](e){e===w.HYPHEN_MINUS?this._emitChars("-"):e===w.LESS_THAN_SIGN?(this.state=Ju,this._emitChars("<")):e===w.GREATER_THAN_SIGN?(this.state=Xn,this._emitChars(">")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=Qn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=Qn,this._emitCodePoint(e))}[Ju](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Hb,this._emitChars("/")):this._reconsumeInState(Qn)}[Hb](e){Pe(e)||e===w.SOLIDUS||e===w.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?hn:Qn,this._emitCodePoint(e)):pn(e)?(this.tempBuff.push(ul(e)),this._emitCodePoint(e)):gs(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(Qn)}[Rn](e){Pe(e)||(e===w.SOLIDUS||e===w.GREATER_THAN_SIGN||e===w.EOF?this._reconsumeInState(jp):e===w.EQUALS_SIGN?(this._err(O.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=Zu):(this._createAttr(""),this._reconsumeInState(Zu)))}[Zu](e){Pe(e)||e===w.SOLIDUS||e===w.GREATER_THAN_SIGN||e===w.EOF?(this._leaveAttrName(jp),this._unconsume()):e===w.EQUALS_SIGN?this._leaveAttrName(Vp):pn(e)?this.currentAttr.name+=ki(e):e===w.QUOTATION_MARK||e===w.APOSTROPHE||e===w.LESS_THAN_SIGN?(this._err(O.unexpectedCharacterInAttributeName),this.currentAttr.name+=qe(e)):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.name+=Me.REPLACEMENT_CHARACTER):this.currentAttr.name+=qe(e)}[jp](e){Pe(e)||(e===w.SOLIDUS?this.state=Ai:e===w.EQUALS_SIGN?this.state=Vp:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(Zu)))}[Vp](e){Pe(e)||(e===w.QUOTATION_MARK?this.state=el:e===w.APOSTROPHE?this.state=tl:e===w.GREATER_THAN_SIGN?(this._err(O.missingAttributeValue),this.state=le,this._emitCurrentToken()):this._reconsumeInState(nl))}[el](e){e===w.QUOTATION_MARK?this.state=Gp:e===w.AMPERSAND?(this.returnState=el,this.state=ur):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentAttr.value+=qe(e)}[tl](e){e===w.APOSTROPHE?this.state=Gp:e===w.AMPERSAND?(this.returnState=tl,this.state=ur):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentAttr.value+=qe(e)}[nl](e){Pe(e)?this._leaveAttrValue(Rn):e===w.AMPERSAND?(this.returnState=nl,this.state=ur):e===w.GREATER_THAN_SIGN?(this._leaveAttrValue(le),this._emitCurrentToken()):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Me.REPLACEMENT_CHARACTER):e===w.QUOTATION_MARK||e===w.APOSTROPHE||e===w.LESS_THAN_SIGN||e===w.EQUALS_SIGN||e===w.GRAVE_ACCENT?(this._err(O.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=qe(e)):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentAttr.value+=qe(e)}[Gp](e){Pe(e)?this._leaveAttrValue(Rn):e===w.SOLIDUS?this._leaveAttrValue(Ai):e===w.GREATER_THAN_SIGN?(this._leaveAttrValue(le),this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):(this._err(O.missingWhitespaceBetweenAttributes),this._reconsumeInState(Rn))}[Ai](e){e===w.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):(this._err(O.unexpectedSolidusInTag),this._reconsumeInState(Rn))}[No](e){e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.data+=Me.REPLACEMENT_CHARACTER):this.currentToken.data+=qe(e)}[Ub](e){this._consumeSequenceIfMatch(fs.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state=Kb):this._consumeSequenceIfMatch(fs.DOCTYPE_STRING,e,!1)?this.state=Yb:this._consumeSequenceIfMatch(fs.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state=al:(this._err(O.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=No):this._ensureHibernation()||(this._err(O.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState(No))}[Kb](e){e===w.HYPHEN_MINUS?this.state=Wb:e===w.GREATER_THAN_SIGN?(this._err(O.abruptClosingOfEmptyComment),this.state=le,this._emitCurrentToken()):this._reconsumeInState(Ri)}[Wb](e){e===w.HYPHEN_MINUS?this.state=sl:e===w.GREATER_THAN_SIGN?(this._err(O.abruptClosingOfEmptyComment),this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Ri))}[Ri](e){e===w.HYPHEN_MINUS?this.state=il:e===w.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=jb):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.data+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=qe(e)}[jb](e){e===w.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=Vb):e===w.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(Ri)}[Vb](e){e===w.HYPHEN_MINUS?this.state=Gb:this._reconsumeInState(Ri)}[Gb](e){e===w.HYPHEN_MINUS?this.state=zb:this._reconsumeInState(il)}[zb](e){e!==w.GREATER_THAN_SIGN&&e!==w.EOF&&this._err(O.nestedComment),this._reconsumeInState(sl)}[il](e){e===w.HYPHEN_MINUS?this.state=sl:e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Ri))}[sl](e){e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EXCLAMATION_MARK?this.state=Qb:e===w.HYPHEN_MINUS?this.currentToken.data+="-":e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(Ri))}[Qb](e){e===w.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=il):e===w.GREATER_THAN_SIGN?(this._err(O.incorrectlyClosedComment),this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(Ri))}[Yb](e){Pe(e)?this.state=rl:e===w.GREATER_THAN_SIGN?this._reconsumeInState(rl):e===w.EOF?(this._err(O.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingWhitespaceBeforeDoctypeName),this._reconsumeInState(rl))}[rl](e){Pe(e)||(pn(e)?(this._createDoctypeToken(ki(e)),this.state=ol):e===w.NULL?(this._err(O.unexpectedNullCharacter),this._createDoctypeToken(Me.REPLACEMENT_CHARACTER),this.state=ol):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(qe(e)),this.state=ol))}[ol](e){Pe(e)?this.state=Xb:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):pn(e)?this.currentToken.name+=ki(e):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.name+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=qe(e)}[Xb](e){Pe(e)||(e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(fs.PUBLIC_STRING,e,!1)?this.state=Jb:this._consumeSequenceIfMatch(fs.SYSTEM_STRING,e,!1)?this.state=t0:this._ensureHibernation()||(this._err(O.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[Jb](e){Pe(e)?this.state=Zb:e===w.QUOTATION_MARK?(this._err(O.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=zp):e===w.APOSTROPHE?(this._err(O.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=Qp):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn))}[Zb](e){Pe(e)||(e===w.QUOTATION_MARK?(this.currentToken.publicId="",this.state=zp):e===w.APOSTROPHE?(this.currentToken.publicId="",this.state=Qp):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[zp](e){e===w.QUOTATION_MARK?this.state=Yp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.publicId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=qe(e)}[Qp](e){e===w.APOSTROPHE?this.state=Yp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.publicId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=qe(e)}[Yp](e){Pe(e)?this.state=e0:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.QUOTATION_MARK?(this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=Fo):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn))}[e0](e){Pe(e)||(e===w.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=le):e===w.QUOTATION_MARK?(this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this.currentToken.systemId="",this.state=Fo):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[t0](e){Pe(e)?this.state=n0:e===w.QUOTATION_MARK?(this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=Fo):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn))}[n0](e){Pe(e)||(e===w.QUOTATION_MARK?(this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this.currentToken.systemId="",this.state=Fo):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[Do](e){e===w.QUOTATION_MARK?this.state=Xp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.systemId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=qe(e)}[Fo](e){e===w.APOSTROPHE?this.state=Xp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.systemId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=qe(e)}[Xp](e){Pe(e)||(e===w.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState(Yn)))}[Yn](e){e===w.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=le):e===w.NULL?this._err(O.unexpectedNullCharacter):e===w.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}[al](e){e===w.RIGHT_SQUARE_BRACKET?this.state=i0:e===w.EOF?(this._err(O.eofInCdata),this._emitEOFToken()):this._emitCodePoint(e)}[i0](e){e===w.RIGHT_SQUARE_BRACKET?this.state=s0:(this._emitChars("]"),this._reconsumeInState(al))}[s0](e){e===w.GREATER_THAN_SIGN?this.state=le:e===w.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(al))}[ur](e){this.tempBuff=[w.AMPERSAND],e===w.NUMBER_SIGN?(this.tempBuff.push(e),this.state=a0):Jp(e)?this._reconsumeInState(r0):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[r0](e){let t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[w.AMPERSAND];else if(t){let i=this.tempBuff[this.tempBuff.length-1]===w.SEMICOLON;this._isCharacterReferenceAttributeQuirk(i)||(i||this._errOnNextCodePoint(O.missingSemicolonAfterCharacterReference),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state=o0}[o0](e){Jp(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=qe(e):this._emitCodePoint(e):(e===w.SEMICOLON&&this._err(O.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}[a0](e){this.charRefCode=0,e===w.LATIN_SMALL_X||e===w.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state=u0):this._reconsumeInState(l0)}[u0](e){K5(e)?this._reconsumeInState(c0):(this._err(O.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[l0](e){qo(e)?this._reconsumeInState(d0):(this._err(O.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[c0](e){T0(e)?this.charRefCode=this.charRefCode*16+e-55:y0(e)?this.charRefCode=this.charRefCode*16+e-87:qo(e)?this.charRefCode=this.charRefCode*16+e-48:e===w.SEMICOLON?this.state=$o:(this._err(O.missingSemicolonAfterCharacterReference),this._reconsumeInState($o))}[d0](e){qo(e)?this.charRefCode=this.charRefCode*10+e-48:e===w.SEMICOLON?this.state=$o:(this._err(O.missingSemicolonAfterCharacterReference),this._reconsumeInState($o))}[$o](){if(this.charRefCode===w.NULL)this._err(O.nullCharacterReference),this.charRefCode=w.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(O.characterReferenceOutsideUnicodeRange),this.charRefCode=w.REPLACEMENT_CHARACTER;else if(Me.isSurrogate(this.charRefCode))this._err(O.surrogateCharacterReference),this.charRefCode=w.REPLACEMENT_CHARACTER;else if(Me.isUndefinedCodePoint(this.charRefCode))this._err(O.noncharacterCharacterReference);else if(Me.isControlCodePoint(this.charRefCode)||this.charRefCode===w.CARRIAGE_RETURN){this._err(O.controlCharacterReference);let e=H5[this.charRefCode];e&&(this.charRefCode=e)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}};Ct.CHARACTER_TOKEN="CHARACTER_TOKEN";Ct.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN";Ct.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN";Ct.START_TAG_TOKEN="START_TAG_TOKEN";Ct.END_TAG_TOKEN="END_TAG_TOKEN";Ct.COMMENT_TOKEN="COMMENT_TOKEN";Ct.DOCTYPE_TOKEN="DOCTYPE_TOKEN";Ct.EOF_TOKEN="EOF_TOKEN";Ct.HIBERNATION_TOKEN="HIBERNATION_TOKEN";Ct.MODE={DATA:le,RCDATA:lr,RAWTEXT:Bo,SCRIPT_DATA:Xn,PLAINTEXT:g0};Ct.getTokenAttr=function(n,e){for(let t=n.attrs.length-1;t>=0;t--)if(n.attrs[t].name===e)return n.attrs[t].value;return null};b0.exports=Ct});var _i=ue(cr=>{"use strict";var Zp=cr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};cr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};cr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var q=cr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};cr.SPECIAL_ELEMENTS={[Zp.HTML]:{[q.ADDRESS]:!0,[q.APPLET]:!0,[q.AREA]:!0,[q.ARTICLE]:!0,[q.ASIDE]:!0,[q.BASE]:!0,[q.BASEFONT]:!0,[q.BGSOUND]:!0,[q.BLOCKQUOTE]:!0,[q.BODY]:!0,[q.BR]:!0,[q.BUTTON]:!0,[q.CAPTION]:!0,[q.CENTER]:!0,[q.COL]:!0,[q.COLGROUP]:!0,[q.DD]:!0,[q.DETAILS]:!0,[q.DIR]:!0,[q.DIV]:!0,[q.DL]:!0,[q.DT]:!0,[q.EMBED]:!0,[q.FIELDSET]:!0,[q.FIGCAPTION]:!0,[q.FIGURE]:!0,[q.FOOTER]:!0,[q.FORM]:!0,[q.FRAME]:!0,[q.FRAMESET]:!0,[q.H1]:!0,[q.H2]:!0,[q.H3]:!0,[q.H4]:!0,[q.H5]:!0,[q.H6]:!0,[q.HEAD]:!0,[q.HEADER]:!0,[q.HGROUP]:!0,[q.HR]:!0,[q.HTML]:!0,[q.IFRAME]:!0,[q.IMG]:!0,[q.INPUT]:!0,[q.LI]:!0,[q.LINK]:!0,[q.LISTING]:!0,[q.MAIN]:!0,[q.MARQUEE]:!0,[q.MENU]:!0,[q.META]:!0,[q.NAV]:!0,[q.NOEMBED]:!0,[q.NOFRAMES]:!0,[q.NOSCRIPT]:!0,[q.OBJECT]:!0,[q.OL]:!0,[q.P]:!0,[q.PARAM]:!0,[q.PLAINTEXT]:!0,[q.PRE]:!0,[q.SCRIPT]:!0,[q.SECTION]:!0,[q.SELECT]:!0,[q.SOURCE]:!0,[q.STYLE]:!0,[q.SUMMARY]:!0,[q.TABLE]:!0,[q.TBODY]:!0,[q.TD]:!0,[q.TEMPLATE]:!0,[q.TEXTAREA]:!0,[q.TFOOT]:!0,[q.TH]:!0,[q.THEAD]:!0,[q.TITLE]:!0,[q.TR]:!0,[q.TRACK]:!0,[q.UL]:!0,[q.WBR]:!0,[q.XMP]:!0},[Zp.MATHML]:{[q.MI]:!0,[q.MO]:!0,[q.MN]:!0,[q.MS]:!0,[q.MTEXT]:!0,[q.ANNOTATION_XML]:!0},[Zp.SVG]:{[q.TITLE]:!0,[q.FOREIGN_OBJECT]:!0,[q.DESC]:!0}}});var x0=ue((YW,C0)=>{"use strict";var S0=_i(),K=S0.TAG_NAMES,Ee=S0.NAMESPACES;function v0(n){switch(n.length){case 1:return n===K.P;case 2:return n===K.RB||n===K.RP||n===K.RT||n===K.DD||n===K.DT||n===K.LI;case 3:return n===K.RTC;case 6:return n===K.OPTION;case 8:return n===K.OPTGROUP}return!1}function W5(n){switch(n.length){case 1:return n===K.P;case 2:return n===K.RB||n===K.RP||n===K.RT||n===K.DD||n===K.DT||n===K.LI||n===K.TD||n===K.TH||n===K.TR;case 3:return n===K.RTC;case 5:return n===K.TBODY||n===K.TFOOT||n===K.THEAD;case 6:return n===K.OPTION;case 7:return n===K.CAPTION;case 8:return n===K.OPTGROUP||n===K.COLGROUP}return!1}function ll(n,e){switch(n.length){case 2:if(n===K.TD||n===K.TH)return e===Ee.HTML;if(n===K.MI||n===K.MO||n===K.MN||n===K.MS)return e===Ee.MATHML;break;case 4:if(n===K.HTML)return e===Ee.HTML;if(n===K.DESC)return e===Ee.SVG;break;case 5:if(n===K.TABLE)return e===Ee.HTML;if(n===K.MTEXT)return e===Ee.MATHML;if(n===K.TITLE)return e===Ee.SVG;break;case 6:return(n===K.APPLET||n===K.OBJECT)&&e===Ee.HTML;case 7:return(n===K.CAPTION||n===K.MARQUEE)&&e===Ee.HTML;case 8:return n===K.TEMPLATE&&e===Ee.HTML;case 13:return n===K.FOREIGN_OBJECT&&e===Ee.SVG;case 14:return n===K.ANNOTATION_XML&&e===Ee.MATHML}return!1}var em=class{constructor(e,t){this.stackTop=-1,this.items=[],this.current=e,this.currentTagName=null,this.currentTmplContent=null,this.tmplCount=0,this.treeAdapter=t}_indexOf(e){let t=-1;for(let i=this.stackTop;i>=0;i--)if(this.items[i]===e){t=i;break}return t}_isInTemplate(){return this.currentTagName===K.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Ee.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current),this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null}push(e){this.items[++this.stackTop]=e,this._updateCurrentElement(),this._isInTemplate()&&this.tmplCount++}pop(){this.stackTop--,this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this._updateCurrentElement()}replace(e,t){let i=this._indexOf(e);this.items[i]=t,i===this.stackTop&&this._updateCurrentElement()}insertAfter(e,t){let i=this._indexOf(e)+1;this.items.splice(i,0,t),i===++this.stackTop&&this._updateCurrentElement()}popUntilTagNamePopped(e){for(;this.stackTop>-1;){let t=this.currentTagName,i=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),t===e&&i===Ee.HTML)break}}popUntilElementPopped(e){for(;this.stackTop>-1;){let t=this.current;if(this.pop(),t===e)break}}popUntilNumberedHeaderPopped(){for(;this.stackTop>-1;){let e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===K.H1||e===K.H2||e===K.H3||e===K.H4||e===K.H5||e===K.H6&&t===Ee.HTML)break}}popUntilTableCellPopped(){for(;this.stackTop>-1;){let e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===K.TD||e===K.TH&&t===Ee.HTML)break}}popAllUpToHtmlElement(){this.stackTop=0,this._updateCurrentElement()}clearBackToTableContext(){for(;this.currentTagName!==K.TABLE&&this.currentTagName!==K.TEMPLATE&&this.currentTagName!==K.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Ee.HTML;)this.pop()}clearBackToTableBodyContext(){for(;this.currentTagName!==K.TBODY&&this.currentTagName!==K.TFOOT&&this.currentTagName!==K.THEAD&&this.currentTagName!==K.TEMPLATE&&this.currentTagName!==K.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Ee.HTML;)this.pop()}clearBackToTableRowContext(){for(;this.currentTagName!==K.TR&&this.currentTagName!==K.TEMPLATE&&this.currentTagName!==K.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Ee.HTML;)this.pop()}remove(e){for(let t=this.stackTop;t>=0;t--)if(this.items[t]===e){this.items.splice(t,1),this.stackTop--,this._updateCurrentElement();break}}tryPeekProperlyNestedBodyElement(){let e=this.items[1];return e&&this.treeAdapter.getTagName(e)===K.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return--t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.currentTagName===K.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Ee.HTML)return!0;if(ll(i,s))return!1}return!0}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.treeAdapter.getTagName(this.items[e]),i=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===K.H1||t===K.H2||t===K.H3||t===K.H4||t===K.H5||t===K.H6)&&i===Ee.HTML)return!0;if(ll(t,i))return!1}return!0}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Ee.HTML)return!0;if((i===K.UL||i===K.OL)&&s===Ee.HTML||ll(i,s))return!1}return!0}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Ee.HTML)return!0;if(i===K.BUTTON&&s===Ee.HTML||ll(i,s))return!1}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===Ee.HTML){if(i===e)return!0;if(i===K.TABLE||i===K.TEMPLATE||i===K.HTML)return!1}}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){let t=this.treeAdapter.getTagName(this.items[e]);if(this.treeAdapter.getNamespaceURI(this.items[e])===Ee.HTML){if(t===K.TBODY||t===K.THEAD||t===K.TFOOT)return!0;if(t===K.TABLE||t===K.HTML)return!1}}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===Ee.HTML){if(i===e)return!0;if(i!==K.OPTION&&i!==K.OPTGROUP)return!1}}return!0}generateImpliedEndTags(){for(;v0(this.currentTagName);)this.pop()}generateImpliedEndTagsThoroughly(){for(;W5(this.currentTagName);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;v0(this.currentTagName)&&this.currentTagName!==e;)this.pop()}};C0.exports=em});var I0=ue((XW,w0)=>{"use strict";var Uo=class n{constructor(e){this.length=0,this.entries=[],this.treeAdapter=e,this.bookmark=null}_getNoahArkConditionCandidates(e){let t=[];if(this.length>=3){let i=this.treeAdapter.getAttrList(e).length,s=this.treeAdapter.getTagName(e),r=this.treeAdapter.getNamespaceURI(e);for(let o=this.length-1;o>=0;o--){let a=this.entries[o];if(a.type===n.MARKER_ENTRY)break;let u=a.element,l=this.treeAdapter.getAttrList(u);this.treeAdapter.getTagName(u)===s&&this.treeAdapter.getNamespaceURI(u)===r&&l.length===i&&t.push({idx:o,attrs:l})}}return t.length<3?[]:t}_ensureNoahArkCondition(e){let t=this._getNoahArkConditionCandidates(e),i=t.length;if(i){let s=this.treeAdapter.getAttrList(e),r=s.length,o=Object.create(null);for(let a=0;a<r;a++){let u=s[a];o[u.name]=u.value}for(let a=0;a<r;a++)for(let u=0;u<i;u++){let l=t[u].attrs[a];if(o[l.name]!==l.value&&(t.splice(u,1),i--),t.length<3)return}for(let a=i-1;a>=2;a--)this.entries.splice(t[a].idx,1),this.length--}}insertMarker(){this.entries.push({type:n.MARKER_ENTRY}),this.length++}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.push({type:n.ELEMENT_ENTRY,element:e,token:t}),this.length++}insertElementAfterBookmark(e,t){let i=this.length-1;for(;i>=0&&this.entries[i]!==this.bookmark;i--);this.entries.splice(i+1,0,{type:n.ELEMENT_ENTRY,element:e,token:t}),this.length++}removeEntry(e){for(let t=this.length-1;t>=0;t--)if(this.entries[t]===e){this.entries.splice(t,1),this.length--;break}}clearToLastMarker(){for(;this.length;){let e=this.entries.pop();if(this.length--,e.type===n.MARKER_ENTRY)break}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){let i=this.entries[t];if(i.type===n.MARKER_ENTRY)return null;if(this.treeAdapter.getTagName(i.element)===e)return i}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){let i=this.entries[t];if(i.type===n.ELEMENT_ENTRY&&i.element===e)return i}return null}};Uo.MARKER_ENTRY="MARKER_ENTRY";Uo.ELEMENT_ENTRY="ELEMENT_ENTRY";w0.exports=Uo});var kn=ue((JW,M0)=>{"use strict";var cl=class{constructor(e){let t={},i=this._getOverriddenMethods(this,t);for(let s of Object.keys(i))typeof i[s]=="function"&&(t[s]=e[s],e[s]=i[s])}_getOverriddenMethods(){throw new Error("Not implemented")}};cl.install=function(n,e,t){n.__mixins||(n.__mixins=[]);for(let s=0;s<n.__mixins.length;s++)if(n.__mixins[s].constructor===e)return n.__mixins[s];let i=new e(n,t);return n.__mixins.push(i),i};M0.exports=cl});var nm=ue((ZW,E0)=>{"use strict";var j5=kn(),tm=class extends j5{constructor(e){super(e),this.preprocessor=e,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.offset=0,this.col=0,this.line=1}_getOverriddenMethods(e,t){return{advance(){let i=this.pos+1,s=this.html[i];return e.isEol&&(e.isEol=!1,e.line++,e.lineStartPos=i),(s===`
|
|
2
|
+
import{a as Gg}from"./chunk-JCDDI4WJ.js";import{a as zg}from"./chunk-ZQPXBOPP.js";import{c as Fh,d as Mg,e as Eg}from"./chunk-U62SRHG3.js";import"./chunk-I3GV76MP.js";import{a as x,b as Bh,c as oo,d as Pg,e as _g,f as Lg,h as qh}from"./chunk-R7KEYFVA.js";import{Se as iT,d as kt,f as Dg,g as Fg,h as $g,i as Bg,j as Mn,k as vi,l as Vg,m as Qg,ne as eT,oe as tT,pe as nT,q as Yg}from"./chunk-WOISMRTU.js";import{a as ro,b as L,c as ot,d as Xa}from"./chunk-A2CQYOXE.js";import{a as qt,b as qg,c as Kg}from"./chunk-HEAI577S.js";import{a as Ug,b as Si,c as tu,e as Wg,f as jg}from"./chunk-SLRPB56L.js";import{a as wn,b as Ag,c as Ja,f as Rg,j as kg,k as Yi,m as In,n as Za,o as eu,p as Ng,q as Hg}from"./chunk-XYXCVIX2.js";import{a as Qi,b as Xg,c as rT}from"./chunk-NF72FWAW.js";import{a as sT}from"./chunk-4NX3LPKA.js";import{a as $h,b as eA}from"./chunk-OJA2IAQ6.js";import{b as Jg,c as Zg}from"./chunk-NP5G53PV.js";import{a as Og}from"./chunk-YPMJNO4T.js";import"./chunk-PPIEC7ZM.js";import{a as bi}from"./chunk-C3JRMX7L.js";import{a as tA}from"./chunk-L5D56V5D.js";import"./chunk-75PL5LYJ.js";import"./chunk-AABEG2OJ.js";import{c as wg}from"./chunk-FLEWADRD.js";import{b as Sg,d as Cg,e as xg}from"./chunk-MNN6EKX3.js";import"./chunk-O6RIRKRN.js";import"./chunk-HQ2U4QVQ.js";import{d as Ig}from"./chunk-V7D3N7GI.js";import{a as pg,e as mg,k as yg,p as bg,q as vg}from"./chunk-AAJMOWWM.js";import{e as fg,ra as gg}from"./chunk-6BYKHQOV.js";import"./chunk-2ZG44JU6.js";import{h as Tg}from"./chunk-ZITT4GJK.js";import"./chunk-Y27DNFV2.js";import"./chunk-CWWDVX6C.js";import"./chunk-RPO5CDCP.js";import"./chunk-LOQ4VVEN.js";import"./chunk-SD6SJL3L.js";import"./chunk-PWQHCWDV.js";import"./chunk-2UWBSJDH.js";import"./chunk-GUFBGYOC.js";import"./chunk-CK62QLTS.js";import"./chunk-WFWSBUYD.js";import{a as hg,c as ue,e as ZE}from"./chunk-D76SO2ME.js";var Qu=ue(zn=>{"use strict";var $5=[65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];zn.REPLACEMENT_CHARACTER="\uFFFD";zn.CODE_POINTS={EOF:-1,NULL:0,TABULATION:9,CARRIAGE_RETURN:13,LINE_FEED:10,FORM_FEED:12,SPACE:32,EXCLAMATION_MARK:33,QUOTATION_MARK:34,NUMBER_SIGN:35,AMPERSAND:38,APOSTROPHE:39,HYPHEN_MINUS:45,SOLIDUS:47,DIGIT_0:48,DIGIT_9:57,SEMICOLON:59,LESS_THAN_SIGN:60,EQUALS_SIGN:61,GREATER_THAN_SIGN:62,QUESTION_MARK:63,LATIN_CAPITAL_A:65,LATIN_CAPITAL_F:70,LATIN_CAPITAL_X:88,LATIN_CAPITAL_Z:90,RIGHT_SQUARE_BRACKET:93,GRAVE_ACCENT:96,LATIN_SMALL_A:97,LATIN_SMALL_F:102,LATIN_SMALL_X:120,LATIN_SMALL_Z:122,REPLACEMENT_CHARACTER:65533};zn.CODE_POINT_SEQUENCES={DASH_DASH_STRING:[45,45],DOCTYPE_STRING:[68,79,67,84,89,80,69],CDATA_START_STRING:[91,67,68,65,84,65,91],SCRIPT_STRING:[115,99,114,105,112,116],PUBLIC_STRING:[80,85,66,76,73,67],SYSTEM_STRING:[83,89,83,84,69,77]};zn.isSurrogate=function(n){return n>=55296&&n<=57343};zn.isSurrogatePair=function(n){return n>=56320&&n<=57343};zn.getSurrogatePairCodePoint=function(n,e){return(n-55296)*1024+9216+e};zn.isControlCodePoint=function(n){return n!==32&&n!==10&&n!==13&&n!==9&&n!==12&&n>=1&&n<=31||n>=127&&n<=159};zn.isUndefinedCodePoint=function(n){return n>=64976&&n<=65007||$5.indexOf(n)>-1}});var Yu=ue((jW,Tb)=>{"use strict";Tb.exports={controlCharacterInInputStream:"control-character-in-input-stream",noncharacterInInputStream:"noncharacter-in-input-stream",surrogateInInputStream:"surrogate-in-input-stream",nonVoidHtmlElementStartTagWithTrailingSolidus:"non-void-html-element-start-tag-with-trailing-solidus",endTagWithAttributes:"end-tag-with-attributes",endTagWithTrailingSolidus:"end-tag-with-trailing-solidus",unexpectedSolidusInTag:"unexpected-solidus-in-tag",unexpectedNullCharacter:"unexpected-null-character",unexpectedQuestionMarkInsteadOfTagName:"unexpected-question-mark-instead-of-tag-name",invalidFirstCharacterOfTagName:"invalid-first-character-of-tag-name",unexpectedEqualsSignBeforeAttributeName:"unexpected-equals-sign-before-attribute-name",missingEndTagName:"missing-end-tag-name",unexpectedCharacterInAttributeName:"unexpected-character-in-attribute-name",unknownNamedCharacterReference:"unknown-named-character-reference",missingSemicolonAfterCharacterReference:"missing-semicolon-after-character-reference",unexpectedCharacterAfterDoctypeSystemIdentifier:"unexpected-character-after-doctype-system-identifier",unexpectedCharacterInUnquotedAttributeValue:"unexpected-character-in-unquoted-attribute-value",eofBeforeTagName:"eof-before-tag-name",eofInTag:"eof-in-tag",missingAttributeValue:"missing-attribute-value",missingWhitespaceBetweenAttributes:"missing-whitespace-between-attributes",missingWhitespaceAfterDoctypePublicKeyword:"missing-whitespace-after-doctype-public-keyword",missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:"missing-whitespace-between-doctype-public-and-system-identifiers",missingWhitespaceAfterDoctypeSystemKeyword:"missing-whitespace-after-doctype-system-keyword",missingQuoteBeforeDoctypePublicIdentifier:"missing-quote-before-doctype-public-identifier",missingQuoteBeforeDoctypeSystemIdentifier:"missing-quote-before-doctype-system-identifier",missingDoctypePublicIdentifier:"missing-doctype-public-identifier",missingDoctypeSystemIdentifier:"missing-doctype-system-identifier",abruptDoctypePublicIdentifier:"abrupt-doctype-public-identifier",abruptDoctypeSystemIdentifier:"abrupt-doctype-system-identifier",cdataInHtmlContent:"cdata-in-html-content",incorrectlyOpenedComment:"incorrectly-opened-comment",eofInScriptHtmlCommentLikeText:"eof-in-script-html-comment-like-text",eofInDoctype:"eof-in-doctype",nestedComment:"nested-comment",abruptClosingOfEmptyComment:"abrupt-closing-of-empty-comment",eofInComment:"eof-in-comment",incorrectlyClosedComment:"incorrectly-closed-comment",eofInCdata:"eof-in-cdata",absenceOfDigitsInNumericCharacterReference:"absence-of-digits-in-numeric-character-reference",nullCharacterReference:"null-character-reference",surrogateCharacterReference:"surrogate-character-reference",characterReferenceOutsideUnicodeRange:"character-reference-outside-unicode-range",controlCharacterReference:"control-character-reference",noncharacterCharacterReference:"noncharacter-character-reference",missingWhitespaceBeforeDoctypeName:"missing-whitespace-before-doctype-name",missingDoctypeName:"missing-doctype-name",invalidCharacterSequenceAfterDoctypeName:"invalid-character-sequence-after-doctype-name",duplicateAttribute:"duplicate-attribute",nonConformingDoctype:"non-conforming-doctype",missingDoctype:"missing-doctype",misplacedDoctype:"misplaced-doctype",endTagWithoutMatchingOpenElement:"end-tag-without-matching-open-element",closingOfElementWithOpenChildElements:"closing-of-element-with-open-child-elements",disallowedContentInNoscriptInHead:"disallowed-content-in-noscript-in-head",openElementsLeftAfterEof:"open-elements-left-after-eof",abandonedHeadElementChild:"abandoned-head-element-child",misplacedStartTagForHeadElement:"misplaced-start-tag-for-head-element",nestedNoscriptInHead:"nested-noscript-in-head",eofInElementThatCanContainOnlyText:"eof-in-element-that-can-contain-only-text"}});var bb=ue((VW,yb)=>{"use strict";var ar=Qu(),Hp=Yu(),ms=ar.CODE_POINTS,B5=65536,Up=class{constructor(){this.html=null,this.pos=-1,this.lastGapPos=-1,this.lastCharPos=-1,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=B5}_err(){}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.lastCharPos){let t=this.html.charCodeAt(this.pos+1);if(ar.isSurrogatePair(t))return this.pos++,this._addGap(),ar.getSurrogatePairCodePoint(e,t)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,ms.EOF;return this._err(Hp.surrogateInInputStream),e}dropParsedChunk(){this.pos>this.bufferWaterline&&(this.lastCharPos-=this.pos,this.html=this.html.substring(this.pos),this.pos=0,this.lastGapPos=-1,this.gapStack=[])}write(e,t){this.html?this.html+=e:this.html=e,this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1,this.lastChunkWritten=t}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1,this.html.length),this.lastCharPos=this.html.length-1,this.endOfChunkHit=!1}advance(){if(this.pos++,this.pos>this.lastCharPos)return this.endOfChunkHit=!this.lastChunkWritten,ms.EOF;let e=this.html.charCodeAt(this.pos);return this.skipNextNewLine&&e===ms.LINE_FEED?(this.skipNextNewLine=!1,this._addGap(),this.advance()):e===ms.CARRIAGE_RETURN?(this.skipNextNewLine=!0,ms.LINE_FEED):(this.skipNextNewLine=!1,ar.isSurrogate(e)&&(e=this._processSurrogate(e)),e>31&&e<127||e===ms.LINE_FEED||e===ms.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){ar.isControlCodePoint(e)?this._err(Hp.controlCharacterInInputStream):ar.isUndefinedCodePoint(e)&&this._err(Hp.noncharacterInInputStream)}retreat(){this.pos===this.lastGapPos&&(this.lastGapPos=this.gapStack.pop(),this.pos--),this.pos--}};yb.exports=Up});var Sb=ue((GW,vb)=>{"use strict";vb.exports=new Uint16Array([4,52,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,106,303,412,810,1432,1701,1796,1987,2114,2360,2420,2484,3170,3251,4140,4393,4575,4610,5106,5512,5728,6117,6274,6315,6345,6427,6516,7002,7910,8733,9323,9870,10170,10631,10893,11318,11386,11467,12773,13092,14474,14922,15448,15542,16419,17666,18166,18611,19004,19095,19298,19397,4,16,69,77,97,98,99,102,103,108,109,110,111,112,114,115,116,117,140,150,158,169,176,194,199,210,216,222,226,242,256,266,283,294,108,105,103,5,198,1,59,148,1,198,80,5,38,1,59,156,1,38,99,117,116,101,5,193,1,59,167,1,193,114,101,118,101,59,1,258,4,2,105,121,182,191,114,99,5,194,1,59,189,1,194,59,1,1040,114,59,3,55349,56580,114,97,118,101,5,192,1,59,208,1,192,112,104,97,59,1,913,97,99,114,59,1,256,100,59,1,10835,4,2,103,112,232,237,111,110,59,1,260,102,59,3,55349,56632,112,108,121,70,117,110,99,116,105,111,110,59,1,8289,105,110,103,5,197,1,59,264,1,197,4,2,99,115,272,277,114,59,3,55349,56476,105,103,110,59,1,8788,105,108,100,101,5,195,1,59,292,1,195,109,108,5,196,1,59,301,1,196,4,8,97,99,101,102,111,114,115,117,321,350,354,383,388,394,400,405,4,2,99,114,327,336,107,115,108,97,115,104,59,1,8726,4,2,118,119,342,345,59,1,10983,101,100,59,1,8966,121,59,1,1041,4,3,99,114,116,362,369,379,97,117,115,101,59,1,8757,110,111,117,108,108,105,115,59,1,8492,97,59,1,914,114,59,3,55349,56581,112,102,59,3,55349,56633,101,118,101,59,1,728,99,114,59,1,8492,109,112,101,113,59,1,8782,4,14,72,79,97,99,100,101,102,104,105,108,111,114,115,117,442,447,456,504,542,547,569,573,577,616,678,784,790,796,99,121,59,1,1063,80,89,5,169,1,59,454,1,169,4,3,99,112,121,464,470,497,117,116,101,59,1,262,4,2,59,105,476,478,1,8914,116,97,108,68,105,102,102,101,114,101,110,116,105,97,108,68,59,1,8517,108,101,121,115,59,1,8493,4,4,97,101,105,111,514,520,530,535,114,111,110,59,1,268,100,105,108,5,199,1,59,528,1,199,114,99,59,1,264,110,105,110,116,59,1,8752,111,116,59,1,266,4,2,100,110,553,560,105,108,108,97,59,1,184,116,101,114,68,111,116,59,1,183,114,59,1,8493,105,59,1,935,114,99,108,101,4,4,68,77,80,84,591,596,603,609,111,116,59,1,8857,105,110,117,115,59,1,8854,108,117,115,59,1,8853,105,109,101,115,59,1,8855,111,4,2,99,115,623,646,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8754,101,67,117,114,108,121,4,2,68,81,658,671,111,117,98,108,101,81,117,111,116,101,59,1,8221,117,111,116,101,59,1,8217,4,4,108,110,112,117,688,701,736,753,111,110,4,2,59,101,696,698,1,8759,59,1,10868,4,3,103,105,116,709,717,722,114,117,101,110,116,59,1,8801,110,116,59,1,8751,111,117,114,73,110,116,101,103,114,97,108,59,1,8750,4,2,102,114,742,745,59,1,8450,111,100,117,99,116,59,1,8720,110,116,101,114,67,108,111,99,107,119,105,115,101,67,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8755,111,115,115,59,1,10799,99,114,59,3,55349,56478,112,4,2,59,67,803,805,1,8915,97,112,59,1,8781,4,11,68,74,83,90,97,99,101,102,105,111,115,834,850,855,860,865,888,903,916,921,1011,1415,4,2,59,111,840,842,1,8517,116,114,97,104,100,59,1,10513,99,121,59,1,1026,99,121,59,1,1029,99,121,59,1,1039,4,3,103,114,115,873,879,883,103,101,114,59,1,8225,114,59,1,8609,104,118,59,1,10980,4,2,97,121,894,900,114,111,110,59,1,270,59,1,1044,108,4,2,59,116,910,912,1,8711,97,59,1,916,114,59,3,55349,56583,4,2,97,102,927,998,4,2,99,109,933,992,114,105,116,105,99,97,108,4,4,65,68,71,84,950,957,978,985,99,117,116,101,59,1,180,111,4,2,116,117,964,967,59,1,729,98,108,101,65,99,117,116,101,59,1,733,114,97,118,101,59,1,96,105,108,100,101,59,1,732,111,110,100,59,1,8900,102,101,114,101,110,116,105,97,108,68,59,1,8518,4,4,112,116,117,119,1021,1026,1048,1249,102,59,3,55349,56635,4,3,59,68,69,1034,1036,1041,1,168,111,116,59,1,8412,113,117,97,108,59,1,8784,98,108,101,4,6,67,68,76,82,85,86,1065,1082,1101,1189,1211,1236,111,110,116,111,117,114,73,110,116,101,103,114,97,108,59,1,8751,111,4,2,116,119,1089,1092,59,1,168,110,65,114,114,111,119,59,1,8659,4,2,101,111,1107,1141,102,116,4,3,65,82,84,1117,1124,1136,114,114,111,119,59,1,8656,105,103,104,116,65,114,114,111,119,59,1,8660,101,101,59,1,10980,110,103,4,2,76,82,1149,1177,101,102,116,4,2,65,82,1158,1165,114,114,111,119,59,1,10232,105,103,104,116,65,114,114,111,119,59,1,10234,105,103,104,116,65,114,114,111,119,59,1,10233,105,103,104,116,4,2,65,84,1199,1206,114,114,111,119,59,1,8658,101,101,59,1,8872,112,4,2,65,68,1218,1225,114,114,111,119,59,1,8657,111,119,110,65,114,114,111,119,59,1,8661,101,114,116,105,99,97,108,66,97,114,59,1,8741,110,4,6,65,66,76,82,84,97,1264,1292,1299,1352,1391,1408,114,114,111,119,4,3,59,66,85,1276,1278,1283,1,8595,97,114,59,1,10515,112,65,114,114,111,119,59,1,8693,114,101,118,101,59,1,785,101,102,116,4,3,82,84,86,1310,1323,1334,105,103,104,116,86,101,99,116,111,114,59,1,10576,101,101,86,101,99,116,111,114,59,1,10590,101,99,116,111,114,4,2,59,66,1345,1347,1,8637,97,114,59,1,10582,105,103,104,116,4,2,84,86,1362,1373,101,101,86,101,99,116,111,114,59,1,10591,101,99,116,111,114,4,2,59,66,1384,1386,1,8641,97,114,59,1,10583,101,101,4,2,59,65,1399,1401,1,8868,114,114,111,119,59,1,8615,114,114,111,119,59,1,8659,4,2,99,116,1421,1426,114,59,3,55349,56479,114,111,107,59,1,272,4,16,78,84,97,99,100,102,103,108,109,111,112,113,115,116,117,120,1466,1470,1478,1489,1515,1520,1525,1536,1544,1593,1609,1617,1650,1664,1668,1677,71,59,1,330,72,5,208,1,59,1476,1,208,99,117,116,101,5,201,1,59,1487,1,201,4,3,97,105,121,1497,1503,1512,114,111,110,59,1,282,114,99,5,202,1,59,1510,1,202,59,1,1069,111,116,59,1,278,114,59,3,55349,56584,114,97,118,101,5,200,1,59,1534,1,200,101,109,101,110,116,59,1,8712,4,2,97,112,1550,1555,99,114,59,1,274,116,121,4,2,83,86,1563,1576,109,97,108,108,83,113,117,97,114,101,59,1,9723,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9643,4,2,103,112,1599,1604,111,110,59,1,280,102,59,3,55349,56636,115,105,108,111,110,59,1,917,117,4,2,97,105,1624,1640,108,4,2,59,84,1631,1633,1,10869,105,108,100,101,59,1,8770,108,105,98,114,105,117,109,59,1,8652,4,2,99,105,1656,1660,114,59,1,8496,109,59,1,10867,97,59,1,919,109,108,5,203,1,59,1675,1,203,4,2,105,112,1683,1689,115,116,115,59,1,8707,111,110,101,110,116,105,97,108,69,59,1,8519,4,5,99,102,105,111,115,1713,1717,1722,1762,1791,121,59,1,1060,114,59,3,55349,56585,108,108,101,100,4,2,83,86,1732,1745,109,97,108,108,83,113,117,97,114,101,59,1,9724,101,114,121,83,109,97,108,108,83,113,117,97,114,101,59,1,9642,4,3,112,114,117,1770,1775,1781,102,59,3,55349,56637,65,108,108,59,1,8704,114,105,101,114,116,114,102,59,1,8497,99,114,59,1,8497,4,12,74,84,97,98,99,100,102,103,111,114,115,116,1822,1827,1834,1848,1855,1877,1882,1887,1890,1896,1978,1984,99,121,59,1,1027,5,62,1,59,1832,1,62,109,109,97,4,2,59,100,1843,1845,1,915,59,1,988,114,101,118,101,59,1,286,4,3,101,105,121,1863,1869,1874,100,105,108,59,1,290,114,99,59,1,284,59,1,1043,111,116,59,1,288,114,59,3,55349,56586,59,1,8921,112,102,59,3,55349,56638,101,97,116,101,114,4,6,69,70,71,76,83,84,1915,1933,1944,1953,1959,1971,113,117,97,108,4,2,59,76,1925,1927,1,8805,101,115,115,59,1,8923,117,108,108,69,113,117,97,108,59,1,8807,114,101,97,116,101,114,59,1,10914,101,115,115,59,1,8823,108,97,110,116,69,113,117,97,108,59,1,10878,105,108,100,101,59,1,8819,99,114,59,3,55349,56482,59,1,8811,4,8,65,97,99,102,105,111,115,117,2005,2012,2026,2032,2036,2049,2073,2089,82,68,99,121,59,1,1066,4,2,99,116,2018,2023,101,107,59,1,711,59,1,94,105,114,99,59,1,292,114,59,1,8460,108,98,101,114,116,83,112,97,99,101,59,1,8459,4,2,112,114,2055,2059,102,59,1,8461,105,122,111,110,116,97,108,76,105,110,101,59,1,9472,4,2,99,116,2079,2083,114,59,1,8459,114,111,107,59,1,294,109,112,4,2,68,69,2097,2107,111,119,110,72,117,109,112,59,1,8782,113,117,97,108,59,1,8783,4,14,69,74,79,97,99,100,102,103,109,110,111,115,116,117,2144,2149,2155,2160,2171,2189,2194,2198,2209,2245,2307,2329,2334,2341,99,121,59,1,1045,108,105,103,59,1,306,99,121,59,1,1025,99,117,116,101,5,205,1,59,2169,1,205,4,2,105,121,2177,2186,114,99,5,206,1,59,2184,1,206,59,1,1048,111,116,59,1,304,114,59,1,8465,114,97,118,101,5,204,1,59,2207,1,204,4,3,59,97,112,2217,2219,2238,1,8465,4,2,99,103,2225,2229,114,59,1,298,105,110,97,114,121,73,59,1,8520,108,105,101,115,59,1,8658,4,2,116,118,2251,2281,4,2,59,101,2257,2259,1,8748,4,2,103,114,2265,2271,114,97,108,59,1,8747,115,101,99,116,105,111,110,59,1,8898,105,115,105,98,108,101,4,2,67,84,2293,2300,111,109,109,97,59,1,8291,105,109,101,115,59,1,8290,4,3,103,112,116,2315,2320,2325,111,110,59,1,302,102,59,3,55349,56640,97,59,1,921,99,114,59,1,8464,105,108,100,101,59,1,296,4,2,107,109,2347,2352,99,121,59,1,1030,108,5,207,1,59,2358,1,207,4,5,99,102,111,115,117,2372,2386,2391,2397,2414,4,2,105,121,2378,2383,114,99,59,1,308,59,1,1049,114,59,3,55349,56589,112,102,59,3,55349,56641,4,2,99,101,2403,2408,114,59,3,55349,56485,114,99,121,59,1,1032,107,99,121,59,1,1028,4,7,72,74,97,99,102,111,115,2436,2441,2446,2452,2467,2472,2478,99,121,59,1,1061,99,121,59,1,1036,112,112,97,59,1,922,4,2,101,121,2458,2464,100,105,108,59,1,310,59,1,1050,114,59,3,55349,56590,112,102,59,3,55349,56642,99,114,59,3,55349,56486,4,11,74,84,97,99,101,102,108,109,111,115,116,2508,2513,2520,2562,2585,2981,2986,3004,3011,3146,3167,99,121,59,1,1033,5,60,1,59,2518,1,60,4,5,99,109,110,112,114,2532,2538,2544,2548,2558,117,116,101,59,1,313,98,100,97,59,1,923,103,59,1,10218,108,97,99,101,116,114,102,59,1,8466,114,59,1,8606,4,3,97,101,121,2570,2576,2582,114,111,110,59,1,317,100,105,108,59,1,315,59,1,1051,4,2,102,115,2591,2907,116,4,10,65,67,68,70,82,84,85,86,97,114,2614,2663,2672,2728,2735,2760,2820,2870,2888,2895,4,2,110,114,2620,2633,103,108,101,66,114,97,99,107,101,116,59,1,10216,114,111,119,4,3,59,66,82,2644,2646,2651,1,8592,97,114,59,1,8676,105,103,104,116,65,114,114,111,119,59,1,8646,101,105,108,105,110,103,59,1,8968,111,4,2,117,119,2679,2692,98,108,101,66,114,97,99,107,101,116,59,1,10214,110,4,2,84,86,2699,2710,101,101,86,101,99,116,111,114,59,1,10593,101,99,116,111,114,4,2,59,66,2721,2723,1,8643,97,114,59,1,10585,108,111,111,114,59,1,8970,105,103,104,116,4,2,65,86,2745,2752,114,114,111,119,59,1,8596,101,99,116,111,114,59,1,10574,4,2,101,114,2766,2792,101,4,3,59,65,86,2775,2777,2784,1,8867,114,114,111,119,59,1,8612,101,99,116,111,114,59,1,10586,105,97,110,103,108,101,4,3,59,66,69,2806,2808,2813,1,8882,97,114,59,1,10703,113,117,97,108,59,1,8884,112,4,3,68,84,86,2829,2841,2852,111,119,110,86,101,99,116,111,114,59,1,10577,101,101,86,101,99,116,111,114,59,1,10592,101,99,116,111,114,4,2,59,66,2863,2865,1,8639,97,114,59,1,10584,101,99,116,111,114,4,2,59,66,2881,2883,1,8636,97,114,59,1,10578,114,114,111,119,59,1,8656,105,103,104,116,97,114,114,111,119,59,1,8660,115,4,6,69,70,71,76,83,84,2922,2936,2947,2956,2962,2974,113,117,97,108,71,114,101,97,116,101,114,59,1,8922,117,108,108,69,113,117,97,108,59,1,8806,114,101,97,116,101,114,59,1,8822,101,115,115,59,1,10913,108,97,110,116,69,113,117,97,108,59,1,10877,105,108,100,101,59,1,8818,114,59,3,55349,56591,4,2,59,101,2992,2994,1,8920,102,116,97,114,114,111,119,59,1,8666,105,100,111,116,59,1,319,4,3,110,112,119,3019,3110,3115,103,4,4,76,82,108,114,3030,3058,3070,3098,101,102,116,4,2,65,82,3039,3046,114,114,111,119,59,1,10229,105,103,104,116,65,114,114,111,119,59,1,10231,105,103,104,116,65,114,114,111,119,59,1,10230,101,102,116,4,2,97,114,3079,3086,114,114,111,119,59,1,10232,105,103,104,116,97,114,114,111,119,59,1,10234,105,103,104,116,97,114,114,111,119,59,1,10233,102,59,3,55349,56643,101,114,4,2,76,82,3123,3134,101,102,116,65,114,114,111,119,59,1,8601,105,103,104,116,65,114,114,111,119,59,1,8600,4,3,99,104,116,3154,3158,3161,114,59,1,8466,59,1,8624,114,111,107,59,1,321,59,1,8810,4,8,97,99,101,102,105,111,115,117,3188,3192,3196,3222,3227,3237,3243,3248,112,59,1,10501,121,59,1,1052,4,2,100,108,3202,3213,105,117,109,83,112,97,99,101,59,1,8287,108,105,110,116,114,102,59,1,8499,114,59,3,55349,56592,110,117,115,80,108,117,115,59,1,8723,112,102,59,3,55349,56644,99,114,59,1,8499,59,1,924,4,9,74,97,99,101,102,111,115,116,117,3271,3276,3283,3306,3422,3427,4120,4126,4137,99,121,59,1,1034,99,117,116,101,59,1,323,4,3,97,101,121,3291,3297,3303,114,111,110,59,1,327,100,105,108,59,1,325,59,1,1053,4,3,103,115,119,3314,3380,3415,97,116,105,118,101,4,3,77,84,86,3327,3340,3365,101,100,105,117,109,83,112,97,99,101,59,1,8203,104,105,4,2,99,110,3348,3357,107,83,112,97,99,101,59,1,8203,83,112,97,99,101,59,1,8203,101,114,121,84,104,105,110,83,112,97,99,101,59,1,8203,116,101,100,4,2,71,76,3389,3405,114,101,97,116,101,114,71,114,101,97,116,101,114,59,1,8811,101,115,115,76,101,115,115,59,1,8810,76,105,110,101,59,1,10,114,59,3,55349,56593,4,4,66,110,112,116,3437,3444,3460,3464,114,101,97,107,59,1,8288,66,114,101,97,107,105,110,103,83,112,97,99,101,59,1,160,102,59,1,8469,4,13,59,67,68,69,71,72,76,78,80,82,83,84,86,3492,3494,3517,3536,3578,3657,3685,3784,3823,3860,3915,4066,4107,1,10988,4,2,111,117,3500,3510,110,103,114,117,101,110,116,59,1,8802,112,67,97,112,59,1,8813,111,117,98,108,101,86,101,114,116,105,99,97,108,66,97,114,59,1,8742,4,3,108,113,120,3544,3552,3571,101,109,101,110,116,59,1,8713,117,97,108,4,2,59,84,3561,3563,1,8800,105,108,100,101,59,3,8770,824,105,115,116,115,59,1,8708,114,101,97,116,101,114,4,7,59,69,70,71,76,83,84,3600,3602,3609,3621,3631,3637,3650,1,8815,113,117,97,108,59,1,8817,117,108,108,69,113,117,97,108,59,3,8807,824,114,101,97,116,101,114,59,3,8811,824,101,115,115,59,1,8825,108,97,110,116,69,113,117,97,108,59,3,10878,824,105,108,100,101,59,1,8821,117,109,112,4,2,68,69,3666,3677,111,119,110,72,117,109,112,59,3,8782,824,113,117,97,108,59,3,8783,824,101,4,2,102,115,3692,3724,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3709,3711,3717,1,8938,97,114,59,3,10703,824,113,117,97,108,59,1,8940,115,4,6,59,69,71,76,83,84,3739,3741,3748,3757,3764,3777,1,8814,113,117,97,108,59,1,8816,114,101,97,116,101,114,59,1,8824,101,115,115,59,3,8810,824,108,97,110,116,69,113,117,97,108,59,3,10877,824,105,108,100,101,59,1,8820,101,115,116,101,100,4,2,71,76,3795,3812,114,101,97,116,101,114,71,114,101,97,116,101,114,59,3,10914,824,101,115,115,76,101,115,115,59,3,10913,824,114,101,99,101,100,101,115,4,3,59,69,83,3838,3840,3848,1,8832,113,117,97,108,59,3,10927,824,108,97,110,116,69,113,117,97,108,59,1,8928,4,2,101,105,3866,3881,118,101,114,115,101,69,108,101,109,101,110,116,59,1,8716,103,104,116,84,114,105,97,110,103,108,101,4,3,59,66,69,3900,3902,3908,1,8939,97,114,59,3,10704,824,113,117,97,108,59,1,8941,4,2,113,117,3921,3973,117,97,114,101,83,117,4,2,98,112,3933,3952,115,101,116,4,2,59,69,3942,3945,3,8847,824,113,117,97,108,59,1,8930,101,114,115,101,116,4,2,59,69,3963,3966,3,8848,824,113,117,97,108,59,1,8931,4,3,98,99,112,3981,4e3,4045,115,101,116,4,2,59,69,3990,3993,3,8834,8402,113,117,97,108,59,1,8840,99,101,101,100,115,4,4,59,69,83,84,4015,4017,4025,4037,1,8833,113,117,97,108,59,3,10928,824,108,97,110,116,69,113,117,97,108,59,1,8929,105,108,100,101,59,3,8831,824,101,114,115,101,116,4,2,59,69,4056,4059,3,8835,8402,113,117,97,108,59,1,8841,105,108,100,101,4,4,59,69,70,84,4080,4082,4089,4100,1,8769,113,117,97,108,59,1,8772,117,108,108,69,113,117,97,108,59,1,8775,105,108,100,101,59,1,8777,101,114,116,105,99,97,108,66,97,114,59,1,8740,99,114,59,3,55349,56489,105,108,100,101,5,209,1,59,4135,1,209,59,1,925,4,14,69,97,99,100,102,103,109,111,112,114,115,116,117,118,4170,4176,4187,4205,4212,4217,4228,4253,4259,4292,4295,4316,4337,4346,108,105,103,59,1,338,99,117,116,101,5,211,1,59,4185,1,211,4,2,105,121,4193,4202,114,99,5,212,1,59,4200,1,212,59,1,1054,98,108,97,99,59,1,336,114,59,3,55349,56594,114,97,118,101,5,210,1,59,4226,1,210,4,3,97,101,105,4236,4241,4246,99,114,59,1,332,103,97,59,1,937,99,114,111,110,59,1,927,112,102,59,3,55349,56646,101,110,67,117,114,108,121,4,2,68,81,4272,4285,111,117,98,108,101,81,117,111,116,101,59,1,8220,117,111,116,101,59,1,8216,59,1,10836,4,2,99,108,4301,4306,114,59,3,55349,56490,97,115,104,5,216,1,59,4314,1,216,105,4,2,108,109,4323,4332,100,101,5,213,1,59,4330,1,213,101,115,59,1,10807,109,108,5,214,1,59,4344,1,214,101,114,4,2,66,80,4354,4380,4,2,97,114,4360,4364,114,59,1,8254,97,99,4,2,101,107,4372,4375,59,1,9182,101,116,59,1,9140,97,114,101,110,116,104,101,115,105,115,59,1,9180,4,9,97,99,102,104,105,108,111,114,115,4413,4422,4426,4431,4435,4438,4448,4471,4561,114,116,105,97,108,68,59,1,8706,121,59,1,1055,114,59,3,55349,56595,105,59,1,934,59,1,928,117,115,77,105,110,117,115,59,1,177,4,2,105,112,4454,4467,110,99,97,114,101,112,108,97,110,101,59,1,8460,102,59,1,8473,4,4,59,101,105,111,4481,4483,4526,4531,1,10939,99,101,100,101,115,4,4,59,69,83,84,4498,4500,4507,4519,1,8826,113,117,97,108,59,1,10927,108,97,110,116,69,113,117,97,108,59,1,8828,105,108,100,101,59,1,8830,109,101,59,1,8243,4,2,100,112,4537,4543,117,99,116,59,1,8719,111,114,116,105,111,110,4,2,59,97,4555,4557,1,8759,108,59,1,8733,4,2,99,105,4567,4572,114,59,3,55349,56491,59,1,936,4,4,85,102,111,115,4585,4594,4599,4604,79,84,5,34,1,59,4592,1,34,114,59,3,55349,56596,112,102,59,1,8474,99,114,59,3,55349,56492,4,12,66,69,97,99,101,102,104,105,111,114,115,117,4636,4642,4650,4681,4704,4763,4767,4771,5047,5069,5081,5094,97,114,114,59,1,10512,71,5,174,1,59,4648,1,174,4,3,99,110,114,4658,4664,4668,117,116,101,59,1,340,103,59,1,10219,114,4,2,59,116,4675,4677,1,8608,108,59,1,10518,4,3,97,101,121,4689,4695,4701,114,111,110,59,1,344,100,105,108,59,1,342,59,1,1056,4,2,59,118,4710,4712,1,8476,101,114,115,101,4,2,69,85,4722,4748,4,2,108,113,4728,4736,101,109,101,110,116,59,1,8715,117,105,108,105,98,114,105,117,109,59,1,8651,112,69,113,117,105,108,105,98,114,105,117,109,59,1,10607,114,59,1,8476,111,59,1,929,103,104,116,4,8,65,67,68,70,84,85,86,97,4792,4840,4849,4905,4912,4972,5022,5040,4,2,110,114,4798,4811,103,108,101,66,114,97,99,107,101,116,59,1,10217,114,111,119,4,3,59,66,76,4822,4824,4829,1,8594,97,114,59,1,8677,101,102,116,65,114,114,111,119,59,1,8644,101,105,108,105,110,103,59,1,8969,111,4,2,117,119,4856,4869,98,108,101,66,114,97,99,107,101,116,59,1,10215,110,4,2,84,86,4876,4887,101,101,86,101,99,116,111,114,59,1,10589,101,99,116,111,114,4,2,59,66,4898,4900,1,8642,97,114,59,1,10581,108,111,111,114,59,1,8971,4,2,101,114,4918,4944,101,4,3,59,65,86,4927,4929,4936,1,8866,114,114,111,119,59,1,8614,101,99,116,111,114,59,1,10587,105,97,110,103,108,101,4,3,59,66,69,4958,4960,4965,1,8883,97,114,59,1,10704,113,117,97,108,59,1,8885,112,4,3,68,84,86,4981,4993,5004,111,119,110,86,101,99,116,111,114,59,1,10575,101,101,86,101,99,116,111,114,59,1,10588,101,99,116,111,114,4,2,59,66,5015,5017,1,8638,97,114,59,1,10580,101,99,116,111,114,4,2,59,66,5033,5035,1,8640,97,114,59,1,10579,114,114,111,119,59,1,8658,4,2,112,117,5053,5057,102,59,1,8477,110,100,73,109,112,108,105,101,115,59,1,10608,105,103,104,116,97,114,114,111,119,59,1,8667,4,2,99,104,5087,5091,114,59,1,8475,59,1,8625,108,101,68,101,108,97,121,101,100,59,1,10740,4,13,72,79,97,99,102,104,105,109,111,113,115,116,117,5134,5150,5157,5164,5198,5203,5259,5265,5277,5283,5374,5380,5385,4,2,67,99,5140,5146,72,99,121,59,1,1065,121,59,1,1064,70,84,99,121,59,1,1068,99,117,116,101,59,1,346,4,5,59,97,101,105,121,5176,5178,5184,5190,5195,1,10940,114,111,110,59,1,352,100,105,108,59,1,350,114,99,59,1,348,59,1,1057,114,59,3,55349,56598,111,114,116,4,4,68,76,82,85,5216,5227,5238,5250,111,119,110,65,114,114,111,119,59,1,8595,101,102,116,65,114,114,111,119,59,1,8592,105,103,104,116,65,114,114,111,119,59,1,8594,112,65,114,114,111,119,59,1,8593,103,109,97,59,1,931,97,108,108,67,105,114,99,108,101,59,1,8728,112,102,59,3,55349,56650,4,2,114,117,5289,5293,116,59,1,8730,97,114,101,4,4,59,73,83,85,5306,5308,5322,5367,1,9633,110,116,101,114,115,101,99,116,105,111,110,59,1,8851,117,4,2,98,112,5329,5347,115,101,116,4,2,59,69,5338,5340,1,8847,113,117,97,108,59,1,8849,101,114,115,101,116,4,2,59,69,5358,5360,1,8848,113,117,97,108,59,1,8850,110,105,111,110,59,1,8852,99,114,59,3,55349,56494,97,114,59,1,8902,4,4,98,99,109,112,5395,5420,5475,5478,4,2,59,115,5401,5403,1,8912,101,116,4,2,59,69,5411,5413,1,8912,113,117,97,108,59,1,8838,4,2,99,104,5426,5468,101,101,100,115,4,4,59,69,83,84,5440,5442,5449,5461,1,8827,113,117,97,108,59,1,10928,108,97,110,116,69,113,117,97,108,59,1,8829,105,108,100,101,59,1,8831,84,104,97,116,59,1,8715,59,1,8721,4,3,59,101,115,5486,5488,5507,1,8913,114,115,101,116,4,2,59,69,5498,5500,1,8835,113,117,97,108,59,1,8839,101,116,59,1,8913,4,11,72,82,83,97,99,102,104,105,111,114,115,5536,5546,5552,5567,5579,5602,5607,5655,5695,5701,5711,79,82,78,5,222,1,59,5544,1,222,65,68,69,59,1,8482,4,2,72,99,5558,5563,99,121,59,1,1035,121,59,1,1062,4,2,98,117,5573,5576,59,1,9,59,1,932,4,3,97,101,121,5587,5593,5599,114,111,110,59,1,356,100,105,108,59,1,354,59,1,1058,114,59,3,55349,56599,4,2,101,105,5613,5631,4,2,114,116,5619,5627,101,102,111,114,101,59,1,8756,97,59,1,920,4,2,99,110,5637,5647,107,83,112,97,99,101,59,3,8287,8202,83,112,97,99,101,59,1,8201,108,100,101,4,4,59,69,70,84,5668,5670,5677,5688,1,8764,113,117,97,108,59,1,8771,117,108,108,69,113,117,97,108,59,1,8773,105,108,100,101,59,1,8776,112,102,59,3,55349,56651,105,112,108,101,68,111,116,59,1,8411,4,2,99,116,5717,5722,114,59,3,55349,56495,114,111,107,59,1,358,4,14,97,98,99,100,102,103,109,110,111,112,114,115,116,117,5758,5789,5805,5823,5830,5835,5846,5852,5921,5937,6089,6095,6101,6108,4,2,99,114,5764,5774,117,116,101,5,218,1,59,5772,1,218,114,4,2,59,111,5781,5783,1,8607,99,105,114,59,1,10569,114,4,2,99,101,5796,5800,121,59,1,1038,118,101,59,1,364,4,2,105,121,5811,5820,114,99,5,219,1,59,5818,1,219,59,1,1059,98,108,97,99,59,1,368,114,59,3,55349,56600,114,97,118,101,5,217,1,59,5844,1,217,97,99,114,59,1,362,4,2,100,105,5858,5905,101,114,4,2,66,80,5866,5892,4,2,97,114,5872,5876,114,59,1,95,97,99,4,2,101,107,5884,5887,59,1,9183,101,116,59,1,9141,97,114,101,110,116,104,101,115,105,115,59,1,9181,111,110,4,2,59,80,5913,5915,1,8899,108,117,115,59,1,8846,4,2,103,112,5927,5932,111,110,59,1,370,102,59,3,55349,56652,4,8,65,68,69,84,97,100,112,115,5955,5985,5996,6009,6026,6033,6044,6075,114,114,111,119,4,3,59,66,68,5967,5969,5974,1,8593,97,114,59,1,10514,111,119,110,65,114,114,111,119,59,1,8645,111,119,110,65,114,114,111,119,59,1,8597,113,117,105,108,105,98,114,105,117,109,59,1,10606,101,101,4,2,59,65,6017,6019,1,8869,114,114,111,119,59,1,8613,114,114,111,119,59,1,8657,111,119,110,97,114,114,111,119,59,1,8661,101,114,4,2,76,82,6052,6063,101,102,116,65,114,114,111,119,59,1,8598,105,103,104,116,65,114,114,111,119,59,1,8599,105,4,2,59,108,6082,6084,1,978,111,110,59,1,933,105,110,103,59,1,366,99,114,59,3,55349,56496,105,108,100,101,59,1,360,109,108,5,220,1,59,6115,1,220,4,9,68,98,99,100,101,102,111,115,118,6137,6143,6148,6152,6166,6250,6255,6261,6267,97,115,104,59,1,8875,97,114,59,1,10987,121,59,1,1042,97,115,104,4,2,59,108,6161,6163,1,8873,59,1,10982,4,2,101,114,6172,6175,59,1,8897,4,3,98,116,121,6183,6188,6238,97,114,59,1,8214,4,2,59,105,6194,6196,1,8214,99,97,108,4,4,66,76,83,84,6209,6214,6220,6231,97,114,59,1,8739,105,110,101,59,1,124,101,112,97,114,97,116,111,114,59,1,10072,105,108,100,101,59,1,8768,84,104,105,110,83,112,97,99,101,59,1,8202,114,59,3,55349,56601,112,102,59,3,55349,56653,99,114,59,3,55349,56497,100,97,115,104,59,1,8874,4,5,99,101,102,111,115,6286,6292,6298,6303,6309,105,114,99,59,1,372,100,103,101,59,1,8896,114,59,3,55349,56602,112,102,59,3,55349,56654,99,114,59,3,55349,56498,4,4,102,105,111,115,6325,6330,6333,6339,114,59,3,55349,56603,59,1,926,112,102,59,3,55349,56655,99,114,59,3,55349,56499,4,9,65,73,85,97,99,102,111,115,117,6365,6370,6375,6380,6391,6405,6410,6416,6422,99,121,59,1,1071,99,121,59,1,1031,99,121,59,1,1070,99,117,116,101,5,221,1,59,6389,1,221,4,2,105,121,6397,6402,114,99,59,1,374,59,1,1067,114,59,3,55349,56604,112,102,59,3,55349,56656,99,114,59,3,55349,56500,109,108,59,1,376,4,8,72,97,99,100,101,102,111,115,6445,6450,6457,6472,6477,6501,6505,6510,99,121,59,1,1046,99,117,116,101,59,1,377,4,2,97,121,6463,6469,114,111,110,59,1,381,59,1,1047,111,116,59,1,379,4,2,114,116,6483,6497,111,87,105,100,116,104,83,112,97,99,101,59,1,8203,97,59,1,918,114,59,1,8488,112,102,59,1,8484,99,114,59,3,55349,56501,4,16,97,98,99,101,102,103,108,109,110,111,112,114,115,116,117,119,6550,6561,6568,6612,6622,6634,6645,6672,6699,6854,6870,6923,6933,6963,6974,6983,99,117,116,101,5,225,1,59,6559,1,225,114,101,118,101,59,1,259,4,6,59,69,100,105,117,121,6582,6584,6588,6591,6600,6609,1,8766,59,3,8766,819,59,1,8767,114,99,5,226,1,59,6598,1,226,116,101,5,180,1,59,6607,1,180,59,1,1072,108,105,103,5,230,1,59,6620,1,230,4,2,59,114,6628,6630,1,8289,59,3,55349,56606,114,97,118,101,5,224,1,59,6643,1,224,4,2,101,112,6651,6667,4,2,102,112,6657,6663,115,121,109,59,1,8501,104,59,1,8501,104,97,59,1,945,4,2,97,112,6678,6692,4,2,99,108,6684,6688,114,59,1,257,103,59,1,10815,5,38,1,59,6697,1,38,4,2,100,103,6705,6737,4,5,59,97,100,115,118,6717,6719,6724,6727,6734,1,8743,110,100,59,1,10837,59,1,10844,108,111,112,101,59,1,10840,59,1,10842,4,7,59,101,108,109,114,115,122,6753,6755,6758,6762,6814,6835,6848,1,8736,59,1,10660,101,59,1,8736,115,100,4,2,59,97,6770,6772,1,8737,4,8,97,98,99,100,101,102,103,104,6790,6793,6796,6799,6802,6805,6808,6811,59,1,10664,59,1,10665,59,1,10666,59,1,10667,59,1,10668,59,1,10669,59,1,10670,59,1,10671,116,4,2,59,118,6821,6823,1,8735,98,4,2,59,100,6830,6832,1,8894,59,1,10653,4,2,112,116,6841,6845,104,59,1,8738,59,1,197,97,114,114,59,1,9084,4,2,103,112,6860,6865,111,110,59,1,261,102,59,3,55349,56658,4,7,59,69,97,101,105,111,112,6886,6888,6891,6897,6900,6904,6908,1,8776,59,1,10864,99,105,114,59,1,10863,59,1,8778,100,59,1,8779,115,59,1,39,114,111,120,4,2,59,101,6917,6919,1,8776,113,59,1,8778,105,110,103,5,229,1,59,6931,1,229,4,3,99,116,121,6941,6946,6949,114,59,3,55349,56502,59,1,42,109,112,4,2,59,101,6957,6959,1,8776,113,59,1,8781,105,108,100,101,5,227,1,59,6972,1,227,109,108,5,228,1,59,6981,1,228,4,2,99,105,6989,6997,111,110,105,110,116,59,1,8755,110,116,59,1,10769,4,16,78,97,98,99,100,101,102,105,107,108,110,111,112,114,115,117,7036,7041,7119,7135,7149,7155,7219,7224,7347,7354,7463,7489,7786,7793,7814,7866,111,116,59,1,10989,4,2,99,114,7047,7094,107,4,4,99,101,112,115,7058,7064,7073,7080,111,110,103,59,1,8780,112,115,105,108,111,110,59,1,1014,114,105,109,101,59,1,8245,105,109,4,2,59,101,7088,7090,1,8765,113,59,1,8909,4,2,118,119,7100,7105,101,101,59,1,8893,101,100,4,2,59,103,7113,7115,1,8965,101,59,1,8965,114,107,4,2,59,116,7127,7129,1,9141,98,114,107,59,1,9142,4,2,111,121,7141,7146,110,103,59,1,8780,59,1,1073,113,117,111,59,1,8222,4,5,99,109,112,114,116,7167,7181,7188,7193,7199,97,117,115,4,2,59,101,7176,7178,1,8757,59,1,8757,112,116,121,118,59,1,10672,115,105,59,1,1014,110,111,117,59,1,8492,4,3,97,104,119,7207,7210,7213,59,1,946,59,1,8502,101,101,110,59,1,8812,114,59,3,55349,56607,103,4,7,99,111,115,116,117,118,119,7241,7262,7288,7305,7328,7335,7340,4,3,97,105,117,7249,7253,7258,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,4,3,100,112,116,7270,7275,7281,111,116,59,1,10752,108,117,115,59,1,10753,105,109,101,115,59,1,10754,4,2,113,116,7294,7300,99,117,112,59,1,10758,97,114,59,1,9733,114,105,97,110,103,108,101,4,2,100,117,7318,7324,111,119,110,59,1,9661,112,59,1,9651,112,108,117,115,59,1,10756,101,101,59,1,8897,101,100,103,101,59,1,8896,97,114,111,119,59,1,10509,4,3,97,107,111,7362,7436,7458,4,2,99,110,7368,7432,107,4,3,108,115,116,7377,7386,7394,111,122,101,110,103,101,59,1,10731,113,117,97,114,101,59,1,9642,114,105,97,110,103,108,101,4,4,59,100,108,114,7411,7413,7419,7425,1,9652,111,119,110,59,1,9662,101,102,116,59,1,9666,105,103,104,116,59,1,9656,107,59,1,9251,4,2,49,51,7442,7454,4,2,50,52,7448,7451,59,1,9618,59,1,9617,52,59,1,9619,99,107,59,1,9608,4,2,101,111,7469,7485,4,2,59,113,7475,7478,3,61,8421,117,105,118,59,3,8801,8421,116,59,1,8976,4,4,112,116,119,120,7499,7504,7517,7523,102,59,3,55349,56659,4,2,59,116,7510,7512,1,8869,111,109,59,1,8869,116,105,101,59,1,8904,4,12,68,72,85,86,98,100,104,109,112,116,117,118,7549,7571,7597,7619,7655,7660,7682,7708,7715,7721,7728,7750,4,4,76,82,108,114,7559,7562,7565,7568,59,1,9559,59,1,9556,59,1,9558,59,1,9555,4,5,59,68,85,100,117,7583,7585,7588,7591,7594,1,9552,59,1,9574,59,1,9577,59,1,9572,59,1,9575,4,4,76,82,108,114,7607,7610,7613,7616,59,1,9565,59,1,9562,59,1,9564,59,1,9561,4,7,59,72,76,82,104,108,114,7635,7637,7640,7643,7646,7649,7652,1,9553,59,1,9580,59,1,9571,59,1,9568,59,1,9579,59,1,9570,59,1,9567,111,120,59,1,10697,4,4,76,82,108,114,7670,7673,7676,7679,59,1,9557,59,1,9554,59,1,9488,59,1,9484,4,5,59,68,85,100,117,7694,7696,7699,7702,7705,1,9472,59,1,9573,59,1,9576,59,1,9516,59,1,9524,105,110,117,115,59,1,8863,108,117,115,59,1,8862,105,109,101,115,59,1,8864,4,4,76,82,108,114,7738,7741,7744,7747,59,1,9563,59,1,9560,59,1,9496,59,1,9492,4,7,59,72,76,82,104,108,114,7766,7768,7771,7774,7777,7780,7783,1,9474,59,1,9578,59,1,9569,59,1,9566,59,1,9532,59,1,9508,59,1,9500,114,105,109,101,59,1,8245,4,2,101,118,7799,7804,118,101,59,1,728,98,97,114,5,166,1,59,7812,1,166,4,4,99,101,105,111,7824,7829,7834,7846,114,59,3,55349,56503,109,105,59,1,8271,109,4,2,59,101,7841,7843,1,8765,59,1,8909,108,4,3,59,98,104,7855,7857,7860,1,92,59,1,10693,115,117,98,59,1,10184,4,2,108,109,7872,7885,108,4,2,59,101,7879,7881,1,8226,116,59,1,8226,112,4,3,59,69,101,7894,7896,7899,1,8782,59,1,10926,4,2,59,113,7905,7907,1,8783,59,1,8783,4,15,97,99,100,101,102,104,105,108,111,114,115,116,117,119,121,7942,8021,8075,8080,8121,8126,8157,8279,8295,8430,8446,8485,8491,8707,8726,4,3,99,112,114,7950,7956,8007,117,116,101,59,1,263,4,6,59,97,98,99,100,115,7970,7972,7977,7984,7998,8003,1,8745,110,100,59,1,10820,114,99,117,112,59,1,10825,4,2,97,117,7990,7994,112,59,1,10827,112,59,1,10823,111,116,59,1,10816,59,3,8745,65024,4,2,101,111,8013,8017,116,59,1,8257,110,59,1,711,4,4,97,101,105,117,8031,8046,8056,8061,4,2,112,114,8037,8041,115,59,1,10829,111,110,59,1,269,100,105,108,5,231,1,59,8054,1,231,114,99,59,1,265,112,115,4,2,59,115,8069,8071,1,10828,109,59,1,10832,111,116,59,1,267,4,3,100,109,110,8088,8097,8104,105,108,5,184,1,59,8095,1,184,112,116,121,118,59,1,10674,116,5,162,2,59,101,8112,8114,1,162,114,100,111,116,59,1,183,114,59,3,55349,56608,4,3,99,101,105,8134,8138,8154,121,59,1,1095,99,107,4,2,59,109,8146,8148,1,10003,97,114,107,59,1,10003,59,1,967,114,4,7,59,69,99,101,102,109,115,8174,8176,8179,8258,8261,8268,8273,1,9675,59,1,10691,4,3,59,101,108,8187,8189,8193,1,710,113,59,1,8791,101,4,2,97,100,8200,8223,114,114,111,119,4,2,108,114,8210,8216,101,102,116,59,1,8634,105,103,104,116,59,1,8635,4,5,82,83,97,99,100,8235,8238,8241,8246,8252,59,1,174,59,1,9416,115,116,59,1,8859,105,114,99,59,1,8858,97,115,104,59,1,8861,59,1,8791,110,105,110,116,59,1,10768,105,100,59,1,10991,99,105,114,59,1,10690,117,98,115,4,2,59,117,8288,8290,1,9827,105,116,59,1,9827,4,4,108,109,110,112,8305,8326,8376,8400,111,110,4,2,59,101,8313,8315,1,58,4,2,59,113,8321,8323,1,8788,59,1,8788,4,2,109,112,8332,8344,97,4,2,59,116,8339,8341,1,44,59,1,64,4,3,59,102,108,8352,8354,8358,1,8705,110,59,1,8728,101,4,2,109,120,8365,8371,101,110,116,59,1,8705,101,115,59,1,8450,4,2,103,105,8382,8395,4,2,59,100,8388,8390,1,8773,111,116,59,1,10861,110,116,59,1,8750,4,3,102,114,121,8408,8412,8417,59,3,55349,56660,111,100,59,1,8720,5,169,2,59,115,8424,8426,1,169,114,59,1,8471,4,2,97,111,8436,8441,114,114,59,1,8629,115,115,59,1,10007,4,2,99,117,8452,8457,114,59,3,55349,56504,4,2,98,112,8463,8474,4,2,59,101,8469,8471,1,10959,59,1,10961,4,2,59,101,8480,8482,1,10960,59,1,10962,100,111,116,59,1,8943,4,7,100,101,108,112,114,118,119,8507,8522,8536,8550,8600,8697,8702,97,114,114,4,2,108,114,8516,8519,59,1,10552,59,1,10549,4,2,112,115,8528,8532,114,59,1,8926,99,59,1,8927,97,114,114,4,2,59,112,8545,8547,1,8630,59,1,10557,4,6,59,98,99,100,111,115,8564,8566,8573,8587,8592,8596,1,8746,114,99,97,112,59,1,10824,4,2,97,117,8579,8583,112,59,1,10822,112,59,1,10826,111,116,59,1,8845,114,59,1,10821,59,3,8746,65024,4,4,97,108,114,118,8610,8623,8663,8672,114,114,4,2,59,109,8618,8620,1,8631,59,1,10556,121,4,3,101,118,119,8632,8651,8656,113,4,2,112,115,8639,8645,114,101,99,59,1,8926,117,99,99,59,1,8927,101,101,59,1,8910,101,100,103,101,59,1,8911,101,110,5,164,1,59,8670,1,164,101,97,114,114,111,119,4,2,108,114,8684,8690,101,102,116,59,1,8630,105,103,104,116,59,1,8631,101,101,59,1,8910,101,100,59,1,8911,4,2,99,105,8713,8721,111,110,105,110,116,59,1,8754,110,116,59,1,8753,108,99,116,121,59,1,9005,4,19,65,72,97,98,99,100,101,102,104,105,106,108,111,114,115,116,117,119,122,8773,8778,8783,8821,8839,8854,8887,8914,8930,8944,9036,9041,9058,9197,9227,9258,9281,9297,9305,114,114,59,1,8659,97,114,59,1,10597,4,4,103,108,114,115,8793,8799,8805,8809,103,101,114,59,1,8224,101,116,104,59,1,8504,114,59,1,8595,104,4,2,59,118,8816,8818,1,8208,59,1,8867,4,2,107,108,8827,8834,97,114,111,119,59,1,10511,97,99,59,1,733,4,2,97,121,8845,8851,114,111,110,59,1,271,59,1,1076,4,3,59,97,111,8862,8864,8880,1,8518,4,2,103,114,8870,8876,103,101,114,59,1,8225,114,59,1,8650,116,115,101,113,59,1,10871,4,3,103,108,109,8895,8902,8907,5,176,1,59,8900,1,176,116,97,59,1,948,112,116,121,118,59,1,10673,4,2,105,114,8920,8926,115,104,116,59,1,10623,59,3,55349,56609,97,114,4,2,108,114,8938,8941,59,1,8643,59,1,8642,4,5,97,101,103,115,118,8956,8986,8989,8996,9001,109,4,3,59,111,115,8965,8967,8983,1,8900,110,100,4,2,59,115,8975,8977,1,8900,117,105,116,59,1,9830,59,1,9830,59,1,168,97,109,109,97,59,1,989,105,110,59,1,8946,4,3,59,105,111,9009,9011,9031,1,247,100,101,5,247,2,59,111,9020,9022,1,247,110,116,105,109,101,115,59,1,8903,110,120,59,1,8903,99,121,59,1,1106,99,4,2,111,114,9048,9053,114,110,59,1,8990,111,112,59,1,8973,4,5,108,112,116,117,119,9070,9076,9081,9130,9144,108,97,114,59,1,36,102,59,3,55349,56661,4,5,59,101,109,112,115,9093,9095,9109,9116,9122,1,729,113,4,2,59,100,9102,9104,1,8784,111,116,59,1,8785,105,110,117,115,59,1,8760,108,117,115,59,1,8724,113,117,97,114,101,59,1,8865,98,108,101,98,97,114,119,101,100,103,101,59,1,8966,110,4,3,97,100,104,9153,9160,9172,114,114,111,119,59,1,8595,111,119,110,97,114,114,111,119,115,59,1,8650,97,114,112,111,111,110,4,2,108,114,9184,9190,101,102,116,59,1,8643,105,103,104,116,59,1,8642,4,2,98,99,9203,9211,107,97,114,111,119,59,1,10512,4,2,111,114,9217,9222,114,110,59,1,8991,111,112,59,1,8972,4,3,99,111,116,9235,9248,9252,4,2,114,121,9241,9245,59,3,55349,56505,59,1,1109,108,59,1,10742,114,111,107,59,1,273,4,2,100,114,9264,9269,111,116,59,1,8945,105,4,2,59,102,9276,9278,1,9663,59,1,9662,4,2,97,104,9287,9292,114,114,59,1,8693,97,114,59,1,10607,97,110,103,108,101,59,1,10662,4,2,99,105,9311,9315,121,59,1,1119,103,114,97,114,114,59,1,10239,4,18,68,97,99,100,101,102,103,108,109,110,111,112,113,114,115,116,117,120,9361,9376,9398,9439,9444,9447,9462,9495,9531,9585,9598,9614,9659,9755,9771,9792,9808,9826,4,2,68,111,9367,9372,111,116,59,1,10871,116,59,1,8785,4,2,99,115,9382,9392,117,116,101,5,233,1,59,9390,1,233,116,101,114,59,1,10862,4,4,97,105,111,121,9408,9414,9430,9436,114,111,110,59,1,283,114,4,2,59,99,9421,9423,1,8790,5,234,1,59,9428,1,234,108,111,110,59,1,8789,59,1,1101,111,116,59,1,279,59,1,8519,4,2,68,114,9453,9458,111,116,59,1,8786,59,3,55349,56610,4,3,59,114,115,9470,9472,9482,1,10906,97,118,101,5,232,1,59,9480,1,232,4,2,59,100,9488,9490,1,10902,111,116,59,1,10904,4,4,59,105,108,115,9505,9507,9515,9518,1,10905,110,116,101,114,115,59,1,9191,59,1,8467,4,2,59,100,9524,9526,1,10901,111,116,59,1,10903,4,3,97,112,115,9539,9544,9564,99,114,59,1,275,116,121,4,3,59,115,118,9554,9556,9561,1,8709,101,116,59,1,8709,59,1,8709,112,4,2,49,59,9571,9583,4,2,51,52,9577,9580,59,1,8196,59,1,8197,1,8195,4,2,103,115,9591,9594,59,1,331,112,59,1,8194,4,2,103,112,9604,9609,111,110,59,1,281,102,59,3,55349,56662,4,3,97,108,115,9622,9635,9640,114,4,2,59,115,9629,9631,1,8917,108,59,1,10723,117,115,59,1,10865,105,4,3,59,108,118,9649,9651,9656,1,949,111,110,59,1,949,59,1,1013,4,4,99,115,117,118,9669,9686,9716,9747,4,2,105,111,9675,9680,114,99,59,1,8790,108,111,110,59,1,8789,4,2,105,108,9692,9696,109,59,1,8770,97,110,116,4,2,103,108,9705,9710,116,114,59,1,10902,101,115,115,59,1,10901,4,3,97,101,105,9724,9729,9734,108,115,59,1,61,115,116,59,1,8799,118,4,2,59,68,9741,9743,1,8801,68,59,1,10872,112,97,114,115,108,59,1,10725,4,2,68,97,9761,9766,111,116,59,1,8787,114,114,59,1,10609,4,3,99,100,105,9779,9783,9788,114,59,1,8495,111,116,59,1,8784,109,59,1,8770,4,2,97,104,9798,9801,59,1,951,5,240,1,59,9806,1,240,4,2,109,114,9814,9822,108,5,235,1,59,9820,1,235,111,59,1,8364,4,3,99,105,112,9834,9838,9843,108,59,1,33,115,116,59,1,8707,4,2,101,111,9849,9859,99,116,97,116,105,111,110,59,1,8496,110,101,110,116,105,97,108,101,59,1,8519,4,12,97,99,101,102,105,106,108,110,111,112,114,115,9896,9910,9914,9921,9954,9960,9967,9989,9994,10027,10036,10164,108,108,105,110,103,100,111,116,115,101,113,59,1,8786,121,59,1,1092,109,97,108,101,59,1,9792,4,3,105,108,114,9929,9935,9950,108,105,103,59,1,64259,4,2,105,108,9941,9945,103,59,1,64256,105,103,59,1,64260,59,3,55349,56611,108,105,103,59,1,64257,108,105,103,59,3,102,106,4,3,97,108,116,9975,9979,9984,116,59,1,9837,105,103,59,1,64258,110,115,59,1,9649,111,102,59,1,402,4,2,112,114,1e4,10005,102,59,3,55349,56663,4,2,97,107,10011,10016,108,108,59,1,8704,4,2,59,118,10022,10024,1,8916,59,1,10969,97,114,116,105,110,116,59,1,10765,4,2,97,111,10042,10159,4,2,99,115,10048,10155,4,6,49,50,51,52,53,55,10062,10102,10114,10135,10139,10151,4,6,50,51,52,53,54,56,10076,10083,10086,10093,10096,10099,5,189,1,59,10081,1,189,59,1,8531,5,188,1,59,10091,1,188,59,1,8533,59,1,8537,59,1,8539,4,2,51,53,10108,10111,59,1,8532,59,1,8534,4,3,52,53,56,10122,10129,10132,5,190,1,59,10127,1,190,59,1,8535,59,1,8540,53,59,1,8536,4,2,54,56,10145,10148,59,1,8538,59,1,8541,56,59,1,8542,108,59,1,8260,119,110,59,1,8994,99,114,59,3,55349,56507,4,17,69,97,98,99,100,101,102,103,105,106,108,110,111,114,115,116,118,10206,10217,10247,10254,10268,10273,10358,10363,10374,10380,10385,10406,10458,10464,10470,10497,10610,4,2,59,108,10212,10214,1,8807,59,1,10892,4,3,99,109,112,10225,10231,10244,117,116,101,59,1,501,109,97,4,2,59,100,10239,10241,1,947,59,1,989,59,1,10886,114,101,118,101,59,1,287,4,2,105,121,10260,10265,114,99,59,1,285,59,1,1075,111,116,59,1,289,4,4,59,108,113,115,10283,10285,10288,10308,1,8805,59,1,8923,4,3,59,113,115,10296,10298,10301,1,8805,59,1,8807,108,97,110,116,59,1,10878,4,4,59,99,100,108,10318,10320,10324,10345,1,10878,99,59,1,10921,111,116,4,2,59,111,10332,10334,1,10880,4,2,59,108,10340,10342,1,10882,59,1,10884,4,2,59,101,10351,10354,3,8923,65024,115,59,1,10900,114,59,3,55349,56612,4,2,59,103,10369,10371,1,8811,59,1,8921,109,101,108,59,1,8503,99,121,59,1,1107,4,4,59,69,97,106,10395,10397,10400,10403,1,8823,59,1,10898,59,1,10917,59,1,10916,4,4,69,97,101,115,10416,10419,10434,10453,59,1,8809,112,4,2,59,112,10426,10428,1,10890,114,111,120,59,1,10890,4,2,59,113,10440,10442,1,10888,4,2,59,113,10448,10450,1,10888,59,1,8809,105,109,59,1,8935,112,102,59,3,55349,56664,97,118,101,59,1,96,4,2,99,105,10476,10480,114,59,1,8458,109,4,3,59,101,108,10489,10491,10494,1,8819,59,1,10894,59,1,10896,5,62,6,59,99,100,108,113,114,10512,10514,10527,10532,10538,10545,1,62,4,2,99,105,10520,10523,59,1,10919,114,59,1,10874,111,116,59,1,8919,80,97,114,59,1,10645,117,101,115,116,59,1,10876,4,5,97,100,101,108,115,10557,10574,10579,10599,10605,4,2,112,114,10563,10570,112,114,111,120,59,1,10886,114,59,1,10616,111,116,59,1,8919,113,4,2,108,113,10586,10592,101,115,115,59,1,8923,108,101,115,115,59,1,10892,101,115,115,59,1,8823,105,109,59,1,8819,4,2,101,110,10616,10626,114,116,110,101,113,113,59,3,8809,65024,69,59,3,8809,65024,4,10,65,97,98,99,101,102,107,111,115,121,10653,10658,10713,10718,10724,10760,10765,10786,10850,10875,114,114,59,1,8660,4,4,105,108,109,114,10668,10674,10678,10684,114,115,112,59,1,8202,102,59,1,189,105,108,116,59,1,8459,4,2,100,114,10690,10695,99,121,59,1,1098,4,3,59,99,119,10703,10705,10710,1,8596,105,114,59,1,10568,59,1,8621,97,114,59,1,8463,105,114,99,59,1,293,4,3,97,108,114,10732,10748,10754,114,116,115,4,2,59,117,10741,10743,1,9829,105,116,59,1,9829,108,105,112,59,1,8230,99,111,110,59,1,8889,114,59,3,55349,56613,115,4,2,101,119,10772,10779,97,114,111,119,59,1,10533,97,114,111,119,59,1,10534,4,5,97,109,111,112,114,10798,10803,10809,10839,10844,114,114,59,1,8703,116,104,116,59,1,8763,107,4,2,108,114,10816,10827,101,102,116,97,114,114,111,119,59,1,8617,105,103,104,116,97,114,114,111,119,59,1,8618,102,59,3,55349,56665,98,97,114,59,1,8213,4,3,99,108,116,10858,10863,10869,114,59,3,55349,56509,97,115,104,59,1,8463,114,111,107,59,1,295,4,2,98,112,10881,10887,117,108,108,59,1,8259,104,101,110,59,1,8208,4,15,97,99,101,102,103,105,106,109,110,111,112,113,115,116,117,10925,10936,10958,10977,10990,11001,11039,11045,11101,11192,11220,11226,11237,11285,11299,99,117,116,101,5,237,1,59,10934,1,237,4,3,59,105,121,10944,10946,10955,1,8291,114,99,5,238,1,59,10953,1,238,59,1,1080,4,2,99,120,10964,10968,121,59,1,1077,99,108,5,161,1,59,10975,1,161,4,2,102,114,10983,10986,59,1,8660,59,3,55349,56614,114,97,118,101,5,236,1,59,10999,1,236,4,4,59,105,110,111,11011,11013,11028,11034,1,8520,4,2,105,110,11019,11024,110,116,59,1,10764,116,59,1,8749,102,105,110,59,1,10716,116,97,59,1,8489,108,105,103,59,1,307,4,3,97,111,112,11053,11092,11096,4,3,99,103,116,11061,11065,11088,114,59,1,299,4,3,101,108,112,11073,11076,11082,59,1,8465,105,110,101,59,1,8464,97,114,116,59,1,8465,104,59,1,305,102,59,1,8887,101,100,59,1,437,4,5,59,99,102,111,116,11113,11115,11121,11136,11142,1,8712,97,114,101,59,1,8453,105,110,4,2,59,116,11129,11131,1,8734,105,101,59,1,10717,100,111,116,59,1,305,4,5,59,99,101,108,112,11154,11156,11161,11179,11186,1,8747,97,108,59,1,8890,4,2,103,114,11167,11173,101,114,115,59,1,8484,99,97,108,59,1,8890,97,114,104,107,59,1,10775,114,111,100,59,1,10812,4,4,99,103,112,116,11202,11206,11211,11216,121,59,1,1105,111,110,59,1,303,102,59,3,55349,56666,97,59,1,953,114,111,100,59,1,10812,117,101,115,116,5,191,1,59,11235,1,191,4,2,99,105,11243,11248,114,59,3,55349,56510,110,4,5,59,69,100,115,118,11261,11263,11266,11271,11282,1,8712,59,1,8953,111,116,59,1,8949,4,2,59,118,11277,11279,1,8948,59,1,8947,59,1,8712,4,2,59,105,11291,11293,1,8290,108,100,101,59,1,297,4,2,107,109,11305,11310,99,121,59,1,1110,108,5,239,1,59,11316,1,239,4,6,99,102,109,111,115,117,11332,11346,11351,11357,11363,11380,4,2,105,121,11338,11343,114,99,59,1,309,59,1,1081,114,59,3,55349,56615,97,116,104,59,1,567,112,102,59,3,55349,56667,4,2,99,101,11369,11374,114,59,3,55349,56511,114,99,121,59,1,1112,107,99,121,59,1,1108,4,8,97,99,102,103,104,106,111,115,11404,11418,11433,11438,11445,11450,11455,11461,112,112,97,4,2,59,118,11413,11415,1,954,59,1,1008,4,2,101,121,11424,11430,100,105,108,59,1,311,59,1,1082,114,59,3,55349,56616,114,101,101,110,59,1,312,99,121,59,1,1093,99,121,59,1,1116,112,102,59,3,55349,56668,99,114,59,3,55349,56512,4,23,65,66,69,72,97,98,99,100,101,102,103,104,106,108,109,110,111,112,114,115,116,117,118,11515,11538,11544,11555,11560,11721,11780,11818,11868,12136,12160,12171,12203,12208,12246,12275,12327,12509,12523,12569,12641,12732,12752,4,3,97,114,116,11523,11528,11532,114,114,59,1,8666,114,59,1,8656,97,105,108,59,1,10523,97,114,114,59,1,10510,4,2,59,103,11550,11552,1,8806,59,1,10891,97,114,59,1,10594,4,9,99,101,103,109,110,112,113,114,116,11580,11586,11594,11600,11606,11624,11627,11636,11694,117,116,101,59,1,314,109,112,116,121,118,59,1,10676,114,97,110,59,1,8466,98,100,97,59,1,955,103,4,3,59,100,108,11615,11617,11620,1,10216,59,1,10641,101,59,1,10216,59,1,10885,117,111,5,171,1,59,11634,1,171,114,4,8,59,98,102,104,108,112,115,116,11655,11657,11669,11673,11677,11681,11685,11690,1,8592,4,2,59,102,11663,11665,1,8676,115,59,1,10527,115,59,1,10525,107,59,1,8617,112,59,1,8619,108,59,1,10553,105,109,59,1,10611,108,59,1,8610,4,3,59,97,101,11702,11704,11709,1,10923,105,108,59,1,10521,4,2,59,115,11715,11717,1,10925,59,3,10925,65024,4,3,97,98,114,11729,11734,11739,114,114,59,1,10508,114,107,59,1,10098,4,2,97,107,11745,11758,99,4,2,101,107,11752,11755,59,1,123,59,1,91,4,2,101,115,11764,11767,59,1,10635,108,4,2,100,117,11774,11777,59,1,10639,59,1,10637,4,4,97,101,117,121,11790,11796,11811,11815,114,111,110,59,1,318,4,2,100,105,11802,11807,105,108,59,1,316,108,59,1,8968,98,59,1,123,59,1,1083,4,4,99,113,114,115,11828,11832,11845,11864,97,59,1,10550,117,111,4,2,59,114,11840,11842,1,8220,59,1,8222,4,2,100,117,11851,11857,104,97,114,59,1,10599,115,104,97,114,59,1,10571,104,59,1,8626,4,5,59,102,103,113,115,11880,11882,12008,12011,12031,1,8804,116,4,5,97,104,108,114,116,11895,11913,11935,11947,11996,114,114,111,119,4,2,59,116,11905,11907,1,8592,97,105,108,59,1,8610,97,114,112,111,111,110,4,2,100,117,11925,11931,111,119,110,59,1,8637,112,59,1,8636,101,102,116,97,114,114,111,119,115,59,1,8647,105,103,104,116,4,3,97,104,115,11959,11974,11984,114,114,111,119,4,2,59,115,11969,11971,1,8596,59,1,8646,97,114,112,111,111,110,115,59,1,8651,113,117,105,103,97,114,114,111,119,59,1,8621,104,114,101,101,116,105,109,101,115,59,1,8907,59,1,8922,4,3,59,113,115,12019,12021,12024,1,8804,59,1,8806,108,97,110,116,59,1,10877,4,5,59,99,100,103,115,12043,12045,12049,12070,12083,1,10877,99,59,1,10920,111,116,4,2,59,111,12057,12059,1,10879,4,2,59,114,12065,12067,1,10881,59,1,10883,4,2,59,101,12076,12079,3,8922,65024,115,59,1,10899,4,5,97,100,101,103,115,12095,12103,12108,12126,12131,112,112,114,111,120,59,1,10885,111,116,59,1,8918,113,4,2,103,113,12115,12120,116,114,59,1,8922,103,116,114,59,1,10891,116,114,59,1,8822,105,109,59,1,8818,4,3,105,108,114,12144,12150,12156,115,104,116,59,1,10620,111,111,114,59,1,8970,59,3,55349,56617,4,2,59,69,12166,12168,1,8822,59,1,10897,4,2,97,98,12177,12198,114,4,2,100,117,12184,12187,59,1,8637,4,2,59,108,12193,12195,1,8636,59,1,10602,108,107,59,1,9604,99,121,59,1,1113,4,5,59,97,99,104,116,12220,12222,12227,12235,12241,1,8810,114,114,59,1,8647,111,114,110,101,114,59,1,8990,97,114,100,59,1,10603,114,105,59,1,9722,4,2,105,111,12252,12258,100,111,116,59,1,320,117,115,116,4,2,59,97,12267,12269,1,9136,99,104,101,59,1,9136,4,4,69,97,101,115,12285,12288,12303,12322,59,1,8808,112,4,2,59,112,12295,12297,1,10889,114,111,120,59,1,10889,4,2,59,113,12309,12311,1,10887,4,2,59,113,12317,12319,1,10887,59,1,8808,105,109,59,1,8934,4,8,97,98,110,111,112,116,119,122,12345,12359,12364,12421,12446,12467,12474,12490,4,2,110,114,12351,12355,103,59,1,10220,114,59,1,8701,114,107,59,1,10214,103,4,3,108,109,114,12373,12401,12409,101,102,116,4,2,97,114,12382,12389,114,114,111,119,59,1,10229,105,103,104,116,97,114,114,111,119,59,1,10231,97,112,115,116,111,59,1,10236,105,103,104,116,97,114,114,111,119,59,1,10230,112,97,114,114,111,119,4,2,108,114,12433,12439,101,102,116,59,1,8619,105,103,104,116,59,1,8620,4,3,97,102,108,12454,12458,12462,114,59,1,10629,59,3,55349,56669,117,115,59,1,10797,105,109,101,115,59,1,10804,4,2,97,98,12480,12485,115,116,59,1,8727,97,114,59,1,95,4,3,59,101,102,12498,12500,12506,1,9674,110,103,101,59,1,9674,59,1,10731,97,114,4,2,59,108,12517,12519,1,40,116,59,1,10643,4,5,97,99,104,109,116,12535,12540,12548,12561,12564,114,114,59,1,8646,111,114,110,101,114,59,1,8991,97,114,4,2,59,100,12556,12558,1,8651,59,1,10605,59,1,8206,114,105,59,1,8895,4,6,97,99,104,105,113,116,12583,12589,12594,12597,12614,12635,113,117,111,59,1,8249,114,59,3,55349,56513,59,1,8624,109,4,3,59,101,103,12606,12608,12611,1,8818,59,1,10893,59,1,10895,4,2,98,117,12620,12623,59,1,91,111,4,2,59,114,12630,12632,1,8216,59,1,8218,114,111,107,59,1,322,5,60,8,59,99,100,104,105,108,113,114,12660,12662,12675,12680,12686,12692,12698,12705,1,60,4,2,99,105,12668,12671,59,1,10918,114,59,1,10873,111,116,59,1,8918,114,101,101,59,1,8907,109,101,115,59,1,8905,97,114,114,59,1,10614,117,101,115,116,59,1,10875,4,2,80,105,12711,12716,97,114,59,1,10646,4,3,59,101,102,12724,12726,12729,1,9667,59,1,8884,59,1,9666,114,4,2,100,117,12739,12746,115,104,97,114,59,1,10570,104,97,114,59,1,10598,4,2,101,110,12758,12768,114,116,110,101,113,113,59,3,8808,65024,69,59,3,8808,65024,4,14,68,97,99,100,101,102,104,105,108,110,111,112,115,117,12803,12809,12893,12908,12914,12928,12933,12937,13011,13025,13032,13049,13052,13069,68,111,116,59,1,8762,4,4,99,108,112,114,12819,12827,12849,12887,114,5,175,1,59,12825,1,175,4,2,101,116,12833,12836,59,1,9794,4,2,59,101,12842,12844,1,10016,115,101,59,1,10016,4,2,59,115,12855,12857,1,8614,116,111,4,4,59,100,108,117,12869,12871,12877,12883,1,8614,111,119,110,59,1,8615,101,102,116,59,1,8612,112,59,1,8613,107,101,114,59,1,9646,4,2,111,121,12899,12905,109,109,97,59,1,10793,59,1,1084,97,115,104,59,1,8212,97,115,117,114,101,100,97,110,103,108,101,59,1,8737,114,59,3,55349,56618,111,59,1,8487,4,3,99,100,110,12945,12954,12985,114,111,5,181,1,59,12952,1,181,4,4,59,97,99,100,12964,12966,12971,12976,1,8739,115,116,59,1,42,105,114,59,1,10992,111,116,5,183,1,59,12983,1,183,117,115,4,3,59,98,100,12995,12997,13e3,1,8722,59,1,8863,4,2,59,117,13006,13008,1,8760,59,1,10794,4,2,99,100,13017,13021,112,59,1,10971,114,59,1,8230,112,108,117,115,59,1,8723,4,2,100,112,13038,13044,101,108,115,59,1,8871,102,59,3,55349,56670,59,1,8723,4,2,99,116,13058,13063,114,59,3,55349,56514,112,111,115,59,1,8766,4,3,59,108,109,13077,13079,13087,1,956,116,105,109,97,112,59,1,8888,97,112,59,1,8888,4,24,71,76,82,86,97,98,99,100,101,102,103,104,105,106,108,109,111,112,114,115,116,117,118,119,13142,13165,13217,13229,13247,13330,13359,13414,13420,13508,13513,13579,13602,13626,13631,13762,13767,13855,13936,13995,14214,14285,14312,14432,4,2,103,116,13148,13152,59,3,8921,824,4,2,59,118,13158,13161,3,8811,8402,59,3,8811,824,4,3,101,108,116,13173,13200,13204,102,116,4,2,97,114,13181,13188,114,114,111,119,59,1,8653,105,103,104,116,97,114,114,111,119,59,1,8654,59,3,8920,824,4,2,59,118,13210,13213,3,8810,8402,59,3,8810,824,105,103,104,116,97,114,114,111,119,59,1,8655,4,2,68,100,13235,13241,97,115,104,59,1,8879,97,115,104,59,1,8878,4,5,98,99,110,112,116,13259,13264,13270,13275,13308,108,97,59,1,8711,117,116,101,59,1,324,103,59,3,8736,8402,4,5,59,69,105,111,112,13287,13289,13293,13298,13302,1,8777,59,3,10864,824,100,59,3,8779,824,115,59,1,329,114,111,120,59,1,8777,117,114,4,2,59,97,13316,13318,1,9838,108,4,2,59,115,13325,13327,1,9838,59,1,8469,4,2,115,117,13336,13344,112,5,160,1,59,13342,1,160,109,112,4,2,59,101,13352,13355,3,8782,824,59,3,8783,824,4,5,97,101,111,117,121,13371,13385,13391,13407,13411,4,2,112,114,13377,13380,59,1,10819,111,110,59,1,328,100,105,108,59,1,326,110,103,4,2,59,100,13399,13401,1,8775,111,116,59,3,10861,824,112,59,1,10818,59,1,1085,97,115,104,59,1,8211,4,7,59,65,97,100,113,115,120,13436,13438,13443,13466,13472,13478,13494,1,8800,114,114,59,1,8663,114,4,2,104,114,13450,13454,107,59,1,10532,4,2,59,111,13460,13462,1,8599,119,59,1,8599,111,116,59,3,8784,824,117,105,118,59,1,8802,4,2,101,105,13484,13489,97,114,59,1,10536,109,59,3,8770,824,105,115,116,4,2,59,115,13503,13505,1,8708,59,1,8708,114,59,3,55349,56619,4,4,69,101,115,116,13523,13527,13563,13568,59,3,8807,824,4,3,59,113,115,13535,13537,13559,1,8817,4,3,59,113,115,13545,13547,13551,1,8817,59,3,8807,824,108,97,110,116,59,3,10878,824,59,3,10878,824,105,109,59,1,8821,4,2,59,114,13574,13576,1,8815,59,1,8815,4,3,65,97,112,13587,13592,13597,114,114,59,1,8654,114,114,59,1,8622,97,114,59,1,10994,4,3,59,115,118,13610,13612,13623,1,8715,4,2,59,100,13618,13620,1,8956,59,1,8954,59,1,8715,99,121,59,1,1114,4,7,65,69,97,100,101,115,116,13647,13652,13656,13661,13665,13737,13742,114,114,59,1,8653,59,3,8806,824,114,114,59,1,8602,114,59,1,8229,4,4,59,102,113,115,13675,13677,13703,13725,1,8816,116,4,2,97,114,13684,13691,114,114,111,119,59,1,8602,105,103,104,116,97,114,114,111,119,59,1,8622,4,3,59,113,115,13711,13713,13717,1,8816,59,3,8806,824,108,97,110,116,59,3,10877,824,4,2,59,115,13731,13734,3,10877,824,59,1,8814,105,109,59,1,8820,4,2,59,114,13748,13750,1,8814,105,4,2,59,101,13757,13759,1,8938,59,1,8940,105,100,59,1,8740,4,2,112,116,13773,13778,102,59,3,55349,56671,5,172,3,59,105,110,13787,13789,13829,1,172,110,4,4,59,69,100,118,13800,13802,13806,13812,1,8713,59,3,8953,824,111,116,59,3,8949,824,4,3,97,98,99,13820,13823,13826,59,1,8713,59,1,8951,59,1,8950,105,4,2,59,118,13836,13838,1,8716,4,3,97,98,99,13846,13849,13852,59,1,8716,59,1,8958,59,1,8957,4,3,97,111,114,13863,13892,13899,114,4,4,59,97,115,116,13874,13876,13883,13888,1,8742,108,108,101,108,59,1,8742,108,59,3,11005,8421,59,3,8706,824,108,105,110,116,59,1,10772,4,3,59,99,101,13907,13909,13914,1,8832,117,101,59,1,8928,4,2,59,99,13920,13923,3,10927,824,4,2,59,101,13929,13931,1,8832,113,59,3,10927,824,4,4,65,97,105,116,13946,13951,13971,13982,114,114,59,1,8655,114,114,4,3,59,99,119,13961,13963,13967,1,8603,59,3,10547,824,59,3,8605,824,103,104,116,97,114,114,111,119,59,1,8603,114,105,4,2,59,101,13990,13992,1,8939,59,1,8941,4,7,99,104,105,109,112,113,117,14011,14036,14060,14080,14085,14090,14106,4,4,59,99,101,114,14021,14023,14028,14032,1,8833,117,101,59,1,8929,59,3,10928,824,59,3,55349,56515,111,114,116,4,2,109,112,14045,14050,105,100,59,1,8740,97,114,97,108,108,101,108,59,1,8742,109,4,2,59,101,14067,14069,1,8769,4,2,59,113,14075,14077,1,8772,59,1,8772,105,100,59,1,8740,97,114,59,1,8742,115,117,4,2,98,112,14098,14102,101,59,1,8930,101,59,1,8931,4,3,98,99,112,14114,14157,14171,4,4,59,69,101,115,14124,14126,14130,14133,1,8836,59,3,10949,824,59,1,8840,101,116,4,2,59,101,14141,14144,3,8834,8402,113,4,2,59,113,14151,14153,1,8840,59,3,10949,824,99,4,2,59,101,14164,14166,1,8833,113,59,3,10928,824,4,4,59,69,101,115,14181,14183,14187,14190,1,8837,59,3,10950,824,59,1,8841,101,116,4,2,59,101,14198,14201,3,8835,8402,113,4,2,59,113,14208,14210,1,8841,59,3,10950,824,4,4,103,105,108,114,14224,14228,14238,14242,108,59,1,8825,108,100,101,5,241,1,59,14236,1,241,103,59,1,8824,105,97,110,103,108,101,4,2,108,114,14254,14269,101,102,116,4,2,59,101,14263,14265,1,8938,113,59,1,8940,105,103,104,116,4,2,59,101,14279,14281,1,8939,113,59,1,8941,4,2,59,109,14291,14293,1,957,4,3,59,101,115,14301,14303,14308,1,35,114,111,59,1,8470,112,59,1,8199,4,9,68,72,97,100,103,105,108,114,115,14332,14338,14344,14349,14355,14369,14376,14408,14426,97,115,104,59,1,8877,97,114,114,59,1,10500,112,59,3,8781,8402,97,115,104,59,1,8876,4,2,101,116,14361,14365,59,3,8805,8402,59,3,62,8402,110,102,105,110,59,1,10718,4,3,65,101,116,14384,14389,14393,114,114,59,1,10498,59,3,8804,8402,4,2,59,114,14399,14402,3,60,8402,105,101,59,3,8884,8402,4,2,65,116,14414,14419,114,114,59,1,10499,114,105,101,59,3,8885,8402,105,109,59,3,8764,8402,4,3,65,97,110,14440,14445,14468,114,114,59,1,8662,114,4,2,104,114,14452,14456,107,59,1,10531,4,2,59,111,14462,14464,1,8598,119,59,1,8598,101,97,114,59,1,10535,4,18,83,97,99,100,101,102,103,104,105,108,109,111,112,114,115,116,117,118,14512,14515,14535,14560,14597,14603,14618,14643,14657,14662,14701,14741,14747,14769,14851,14877,14907,14916,59,1,9416,4,2,99,115,14521,14531,117,116,101,5,243,1,59,14529,1,243,116,59,1,8859,4,2,105,121,14541,14557,114,4,2,59,99,14548,14550,1,8858,5,244,1,59,14555,1,244,59,1,1086,4,5,97,98,105,111,115,14572,14577,14583,14587,14591,115,104,59,1,8861,108,97,99,59,1,337,118,59,1,10808,116,59,1,8857,111,108,100,59,1,10684,108,105,103,59,1,339,4,2,99,114,14609,14614,105,114,59,1,10687,59,3,55349,56620,4,3,111,114,116,14626,14630,14640,110,59,1,731,97,118,101,5,242,1,59,14638,1,242,59,1,10689,4,2,98,109,14649,14654,97,114,59,1,10677,59,1,937,110,116,59,1,8750,4,4,97,99,105,116,14672,14677,14693,14698,114,114,59,1,8634,4,2,105,114,14683,14687,114,59,1,10686,111,115,115,59,1,10683,110,101,59,1,8254,59,1,10688,4,3,97,101,105,14709,14714,14719,99,114,59,1,333,103,97,59,1,969,4,3,99,100,110,14727,14733,14736,114,111,110,59,1,959,59,1,10678,117,115,59,1,8854,112,102,59,3,55349,56672,4,3,97,101,108,14755,14759,14764,114,59,1,10679,114,112,59,1,10681,117,115,59,1,8853,4,7,59,97,100,105,111,115,118,14785,14787,14792,14831,14837,14841,14848,1,8744,114,114,59,1,8635,4,4,59,101,102,109,14802,14804,14817,14824,1,10845,114,4,2,59,111,14811,14813,1,8500,102,59,1,8500,5,170,1,59,14822,1,170,5,186,1,59,14829,1,186,103,111,102,59,1,8886,114,59,1,10838,108,111,112,101,59,1,10839,59,1,10843,4,3,99,108,111,14859,14863,14873,114,59,1,8500,97,115,104,5,248,1,59,14871,1,248,108,59,1,8856,105,4,2,108,109,14884,14893,100,101,5,245,1,59,14891,1,245,101,115,4,2,59,97,14901,14903,1,8855,115,59,1,10806,109,108,5,246,1,59,14914,1,246,98,97,114,59,1,9021,4,12,97,99,101,102,104,105,108,109,111,114,115,117,14948,14992,14996,15033,15038,15068,15090,15189,15192,15222,15427,15441,114,4,4,59,97,115,116,14959,14961,14976,14989,1,8741,5,182,2,59,108,14968,14970,1,182,108,101,108,59,1,8741,4,2,105,108,14982,14986,109,59,1,10995,59,1,11005,59,1,8706,121,59,1,1087,114,4,5,99,105,109,112,116,15009,15014,15019,15024,15027,110,116,59,1,37,111,100,59,1,46,105,108,59,1,8240,59,1,8869,101,110,107,59,1,8241,114,59,3,55349,56621,4,3,105,109,111,15046,15057,15063,4,2,59,118,15052,15054,1,966,59,1,981,109,97,116,59,1,8499,110,101,59,1,9742,4,3,59,116,118,15076,15078,15087,1,960,99,104,102,111,114,107,59,1,8916,59,1,982,4,2,97,117,15096,15119,110,4,2,99,107,15103,15115,107,4,2,59,104,15110,15112,1,8463,59,1,8462,118,59,1,8463,115,4,9,59,97,98,99,100,101,109,115,116,15140,15142,15148,15151,15156,15168,15171,15179,15184,1,43,99,105,114,59,1,10787,59,1,8862,105,114,59,1,10786,4,2,111,117,15162,15165,59,1,8724,59,1,10789,59,1,10866,110,5,177,1,59,15177,1,177,105,109,59,1,10790,119,111,59,1,10791,59,1,177,4,3,105,112,117,15200,15208,15213,110,116,105,110,116,59,1,10773,102,59,3,55349,56673,110,100,5,163,1,59,15220,1,163,4,10,59,69,97,99,101,105,110,111,115,117,15244,15246,15249,15253,15258,15334,15347,15367,15416,15421,1,8826,59,1,10931,112,59,1,10935,117,101,59,1,8828,4,2,59,99,15264,15266,1,10927,4,6,59,97,99,101,110,115,15280,15282,15290,15299,15303,15329,1,8826,112,112,114,111,120,59,1,10935,117,114,108,121,101,113,59,1,8828,113,59,1,10927,4,3,97,101,115,15311,15319,15324,112,112,114,111,120,59,1,10937,113,113,59,1,10933,105,109,59,1,8936,105,109,59,1,8830,109,101,4,2,59,115,15342,15344,1,8242,59,1,8473,4,3,69,97,115,15355,15358,15362,59,1,10933,112,59,1,10937,105,109,59,1,8936,4,3,100,102,112,15375,15378,15404,59,1,8719,4,3,97,108,115,15386,15392,15398,108,97,114,59,1,9006,105,110,101,59,1,8978,117,114,102,59,1,8979,4,2,59,116,15410,15412,1,8733,111,59,1,8733,105,109,59,1,8830,114,101,108,59,1,8880,4,2,99,105,15433,15438,114,59,3,55349,56517,59,1,968,110,99,115,112,59,1,8200,4,6,102,105,111,112,115,117,15462,15467,15472,15478,15485,15491,114,59,3,55349,56622,110,116,59,1,10764,112,102,59,3,55349,56674,114,105,109,101,59,1,8279,99,114,59,3,55349,56518,4,3,97,101,111,15499,15520,15534,116,4,2,101,105,15506,15515,114,110,105,111,110,115,59,1,8461,110,116,59,1,10774,115,116,4,2,59,101,15528,15530,1,63,113,59,1,8799,116,5,34,1,59,15540,1,34,4,21,65,66,72,97,98,99,100,101,102,104,105,108,109,110,111,112,114,115,116,117,120,15586,15609,15615,15620,15796,15855,15893,15931,15977,16001,16039,16183,16204,16222,16228,16285,16312,16318,16363,16408,16416,4,3,97,114,116,15594,15599,15603,114,114,59,1,8667,114,59,1,8658,97,105,108,59,1,10524,97,114,114,59,1,10511,97,114,59,1,10596,4,7,99,100,101,110,113,114,116,15636,15651,15656,15664,15687,15696,15770,4,2,101,117,15642,15646,59,3,8765,817,116,101,59,1,341,105,99,59,1,8730,109,112,116,121,118,59,1,10675,103,4,4,59,100,101,108,15675,15677,15680,15683,1,10217,59,1,10642,59,1,10661,101,59,1,10217,117,111,5,187,1,59,15694,1,187,114,4,11,59,97,98,99,102,104,108,112,115,116,119,15721,15723,15727,15739,15742,15746,15750,15754,15758,15763,15767,1,8594,112,59,1,10613,4,2,59,102,15733,15735,1,8677,115,59,1,10528,59,1,10547,115,59,1,10526,107,59,1,8618,112,59,1,8620,108,59,1,10565,105,109,59,1,10612,108,59,1,8611,59,1,8605,4,2,97,105,15776,15781,105,108,59,1,10522,111,4,2,59,110,15788,15790,1,8758,97,108,115,59,1,8474,4,3,97,98,114,15804,15809,15814,114,114,59,1,10509,114,107,59,1,10099,4,2,97,107,15820,15833,99,4,2,101,107,15827,15830,59,1,125,59,1,93,4,2,101,115,15839,15842,59,1,10636,108,4,2,100,117,15849,15852,59,1,10638,59,1,10640,4,4,97,101,117,121,15865,15871,15886,15890,114,111,110,59,1,345,4,2,100,105,15877,15882,105,108,59,1,343,108,59,1,8969,98,59,1,125,59,1,1088,4,4,99,108,113,115,15903,15907,15914,15927,97,59,1,10551,100,104,97,114,59,1,10601,117,111,4,2,59,114,15922,15924,1,8221,59,1,8221,104,59,1,8627,4,3,97,99,103,15939,15966,15970,108,4,4,59,105,112,115,15950,15952,15957,15963,1,8476,110,101,59,1,8475,97,114,116,59,1,8476,59,1,8477,116,59,1,9645,5,174,1,59,15975,1,174,4,3,105,108,114,15985,15991,15997,115,104,116,59,1,10621,111,111,114,59,1,8971,59,3,55349,56623,4,2,97,111,16007,16028,114,4,2,100,117,16014,16017,59,1,8641,4,2,59,108,16023,16025,1,8640,59,1,10604,4,2,59,118,16034,16036,1,961,59,1,1009,4,3,103,110,115,16047,16167,16171,104,116,4,6,97,104,108,114,115,116,16063,16081,16103,16130,16143,16155,114,114,111,119,4,2,59,116,16073,16075,1,8594,97,105,108,59,1,8611,97,114,112,111,111,110,4,2,100,117,16093,16099,111,119,110,59,1,8641,112,59,1,8640,101,102,116,4,2,97,104,16112,16120,114,114,111,119,115,59,1,8644,97,114,112,111,111,110,115,59,1,8652,105,103,104,116,97,114,114,111,119,115,59,1,8649,113,117,105,103,97,114,114,111,119,59,1,8605,104,114,101,101,116,105,109,101,115,59,1,8908,103,59,1,730,105,110,103,100,111,116,115,101,113,59,1,8787,4,3,97,104,109,16191,16196,16201,114,114,59,1,8644,97,114,59,1,8652,59,1,8207,111,117,115,116,4,2,59,97,16214,16216,1,9137,99,104,101,59,1,9137,109,105,100,59,1,10990,4,4,97,98,112,116,16238,16252,16257,16278,4,2,110,114,16244,16248,103,59,1,10221,114,59,1,8702,114,107,59,1,10215,4,3,97,102,108,16265,16269,16273,114,59,1,10630,59,3,55349,56675,117,115,59,1,10798,105,109,101,115,59,1,10805,4,2,97,112,16291,16304,114,4,2,59,103,16298,16300,1,41,116,59,1,10644,111,108,105,110,116,59,1,10770,97,114,114,59,1,8649,4,4,97,99,104,113,16328,16334,16339,16342,113,117,111,59,1,8250,114,59,3,55349,56519,59,1,8625,4,2,98,117,16348,16351,59,1,93,111,4,2,59,114,16358,16360,1,8217,59,1,8217,4,3,104,105,114,16371,16377,16383,114,101,101,59,1,8908,109,101,115,59,1,8906,105,4,4,59,101,102,108,16394,16396,16399,16402,1,9657,59,1,8885,59,1,9656,116,114,105,59,1,10702,108,117,104,97,114,59,1,10600,59,1,8478,4,19,97,98,99,100,101,102,104,105,108,109,111,112,113,114,115,116,117,119,122,16459,16466,16472,16572,16590,16672,16687,16746,16844,16850,16924,16963,16988,17115,17121,17154,17206,17614,17656,99,117,116,101,59,1,347,113,117,111,59,1,8218,4,10,59,69,97,99,101,105,110,112,115,121,16494,16496,16499,16513,16518,16531,16536,16556,16564,16569,1,8827,59,1,10932,4,2,112,114,16505,16508,59,1,10936,111,110,59,1,353,117,101,59,1,8829,4,2,59,100,16524,16526,1,10928,105,108,59,1,351,114,99,59,1,349,4,3,69,97,115,16544,16547,16551,59,1,10934,112,59,1,10938,105,109,59,1,8937,111,108,105,110,116,59,1,10771,105,109,59,1,8831,59,1,1089,111,116,4,3,59,98,101,16582,16584,16587,1,8901,59,1,8865,59,1,10854,4,7,65,97,99,109,115,116,120,16606,16611,16634,16642,16646,16652,16668,114,114,59,1,8664,114,4,2,104,114,16618,16622,107,59,1,10533,4,2,59,111,16628,16630,1,8600,119,59,1,8600,116,5,167,1,59,16640,1,167,105,59,1,59,119,97,114,59,1,10537,109,4,2,105,110,16659,16665,110,117,115,59,1,8726,59,1,8726,116,59,1,10038,114,4,2,59,111,16679,16682,3,55349,56624,119,110,59,1,8994,4,4,97,99,111,121,16697,16702,16716,16739,114,112,59,1,9839,4,2,104,121,16708,16713,99,121,59,1,1097,59,1,1096,114,116,4,2,109,112,16724,16729,105,100,59,1,8739,97,114,97,108,108,101,108,59,1,8741,5,173,1,59,16744,1,173,4,2,103,109,16752,16770,109,97,4,3,59,102,118,16762,16764,16767,1,963,59,1,962,59,1,962,4,8,59,100,101,103,108,110,112,114,16788,16790,16795,16806,16817,16828,16832,16838,1,8764,111,116,59,1,10858,4,2,59,113,16801,16803,1,8771,59,1,8771,4,2,59,69,16812,16814,1,10910,59,1,10912,4,2,59,69,16823,16825,1,10909,59,1,10911,101,59,1,8774,108,117,115,59,1,10788,97,114,114,59,1,10610,97,114,114,59,1,8592,4,4,97,101,105,116,16860,16883,16891,16904,4,2,108,115,16866,16878,108,115,101,116,109,105,110,117,115,59,1,8726,104,112,59,1,10803,112,97,114,115,108,59,1,10724,4,2,100,108,16897,16900,59,1,8739,101,59,1,8995,4,2,59,101,16910,16912,1,10922,4,2,59,115,16918,16920,1,10924,59,3,10924,65024,4,3,102,108,112,16932,16938,16958,116,99,121,59,1,1100,4,2,59,98,16944,16946,1,47,4,2,59,97,16952,16954,1,10692,114,59,1,9023,102,59,3,55349,56676,97,4,2,100,114,16970,16985,101,115,4,2,59,117,16978,16980,1,9824,105,116,59,1,9824,59,1,8741,4,3,99,115,117,16996,17028,17089,4,2,97,117,17002,17015,112,4,2,59,115,17009,17011,1,8851,59,3,8851,65024,112,4,2,59,115,17022,17024,1,8852,59,3,8852,65024,117,4,2,98,112,17035,17062,4,3,59,101,115,17043,17045,17048,1,8847,59,1,8849,101,116,4,2,59,101,17056,17058,1,8847,113,59,1,8849,4,3,59,101,115,17070,17072,17075,1,8848,59,1,8850,101,116,4,2,59,101,17083,17085,1,8848,113,59,1,8850,4,3,59,97,102,17097,17099,17112,1,9633,114,4,2,101,102,17106,17109,59,1,9633,59,1,9642,59,1,9642,97,114,114,59,1,8594,4,4,99,101,109,116,17131,17136,17142,17148,114,59,3,55349,56520,116,109,110,59,1,8726,105,108,101,59,1,8995,97,114,102,59,1,8902,4,2,97,114,17160,17172,114,4,2,59,102,17167,17169,1,9734,59,1,9733,4,2,97,110,17178,17202,105,103,104,116,4,2,101,112,17188,17197,112,115,105,108,111,110,59,1,1013,104,105,59,1,981,115,59,1,175,4,5,98,99,109,110,112,17218,17351,17420,17423,17427,4,9,59,69,100,101,109,110,112,114,115,17238,17240,17243,17248,17261,17267,17279,17285,17291,1,8834,59,1,10949,111,116,59,1,10941,4,2,59,100,17254,17256,1,8838,111,116,59,1,10947,117,108,116,59,1,10945,4,2,69,101,17273,17276,59,1,10955,59,1,8842,108,117,115,59,1,10943,97,114,114,59,1,10617,4,3,101,105,117,17299,17335,17339,116,4,3,59,101,110,17308,17310,17322,1,8834,113,4,2,59,113,17317,17319,1,8838,59,1,10949,101,113,4,2,59,113,17330,17332,1,8842,59,1,10955,109,59,1,10951,4,2,98,112,17345,17348,59,1,10965,59,1,10963,99,4,6,59,97,99,101,110,115,17366,17368,17376,17385,17389,17415,1,8827,112,112,114,111,120,59,1,10936,117,114,108,121,101,113,59,1,8829,113,59,1,10928,4,3,97,101,115,17397,17405,17410,112,112,114,111,120,59,1,10938,113,113,59,1,10934,105,109,59,1,8937,105,109,59,1,8831,59,1,8721,103,59,1,9834,4,13,49,50,51,59,69,100,101,104,108,109,110,112,115,17455,17462,17469,17476,17478,17481,17496,17509,17524,17530,17536,17548,17554,5,185,1,59,17460,1,185,5,178,1,59,17467,1,178,5,179,1,59,17474,1,179,1,8835,59,1,10950,4,2,111,115,17487,17491,116,59,1,10942,117,98,59,1,10968,4,2,59,100,17502,17504,1,8839,111,116,59,1,10948,115,4,2,111,117,17516,17520,108,59,1,10185,98,59,1,10967,97,114,114,59,1,10619,117,108,116,59,1,10946,4,2,69,101,17542,17545,59,1,10956,59,1,8843,108,117,115,59,1,10944,4,3,101,105,117,17562,17598,17602,116,4,3,59,101,110,17571,17573,17585,1,8835,113,4,2,59,113,17580,17582,1,8839,59,1,10950,101,113,4,2,59,113,17593,17595,1,8843,59,1,10956,109,59,1,10952,4,2,98,112,17608,17611,59,1,10964,59,1,10966,4,3,65,97,110,17622,17627,17650,114,114,59,1,8665,114,4,2,104,114,17634,17638,107,59,1,10534,4,2,59,111,17644,17646,1,8601,119,59,1,8601,119,97,114,59,1,10538,108,105,103,5,223,1,59,17664,1,223,4,13,97,98,99,100,101,102,104,105,111,112,114,115,119,17694,17709,17714,17737,17742,17749,17754,17860,17905,17957,17964,18090,18122,4,2,114,117,17700,17706,103,101,116,59,1,8982,59,1,964,114,107,59,1,9140,4,3,97,101,121,17722,17728,17734,114,111,110,59,1,357,100,105,108,59,1,355,59,1,1090,111,116,59,1,8411,108,114,101,99,59,1,8981,114,59,3,55349,56625,4,4,101,105,107,111,17764,17805,17836,17851,4,2,114,116,17770,17786,101,4,2,52,102,17777,17780,59,1,8756,111,114,101,59,1,8756,97,4,3,59,115,118,17795,17797,17802,1,952,121,109,59,1,977,59,1,977,4,2,99,110,17811,17831,107,4,2,97,115,17818,17826,112,112,114,111,120,59,1,8776,105,109,59,1,8764,115,112,59,1,8201,4,2,97,115,17842,17846,112,59,1,8776,105,109,59,1,8764,114,110,5,254,1,59,17858,1,254,4,3,108,109,110,17868,17873,17901,100,101,59,1,732,101,115,5,215,3,59,98,100,17884,17886,17898,1,215,4,2,59,97,17892,17894,1,8864,114,59,1,10801,59,1,10800,116,59,1,8749,4,3,101,112,115,17913,17917,17953,97,59,1,10536,4,4,59,98,99,102,17927,17929,17934,17939,1,8868,111,116,59,1,9014,105,114,59,1,10993,4,2,59,111,17945,17948,3,55349,56677,114,107,59,1,10970,97,59,1,10537,114,105,109,101,59,1,8244,4,3,97,105,112,17972,17977,18082,100,101,59,1,8482,4,7,97,100,101,109,112,115,116,17993,18051,18056,18059,18066,18072,18076,110,103,108,101,4,5,59,100,108,113,114,18009,18011,18017,18032,18035,1,9653,111,119,110,59,1,9663,101,102,116,4,2,59,101,18026,18028,1,9667,113,59,1,8884,59,1,8796,105,103,104,116,4,2,59,101,18045,18047,1,9657,113,59,1,8885,111,116,59,1,9708,59,1,8796,105,110,117,115,59,1,10810,108,117,115,59,1,10809,98,59,1,10701,105,109,101,59,1,10811,101,122,105,117,109,59,1,9186,4,3,99,104,116,18098,18111,18116,4,2,114,121,18104,18108,59,3,55349,56521,59,1,1094,99,121,59,1,1115,114,111,107,59,1,359,4,2,105,111,18128,18133,120,116,59,1,8812,104,101,97,100,4,2,108,114,18143,18154,101,102,116,97,114,114,111,119,59,1,8606,105,103,104,116,97,114,114,111,119,59,1,8608,4,18,65,72,97,98,99,100,102,103,104,108,109,111,112,114,115,116,117,119,18204,18209,18214,18234,18250,18268,18292,18308,18319,18343,18379,18397,18413,18504,18547,18553,18584,18603,114,114,59,1,8657,97,114,59,1,10595,4,2,99,114,18220,18230,117,116,101,5,250,1,59,18228,1,250,114,59,1,8593,114,4,2,99,101,18241,18245,121,59,1,1118,118,101,59,1,365,4,2,105,121,18256,18265,114,99,5,251,1,59,18263,1,251,59,1,1091,4,3,97,98,104,18276,18281,18287,114,114,59,1,8645,108,97,99,59,1,369,97,114,59,1,10606,4,2,105,114,18298,18304,115,104,116,59,1,10622,59,3,55349,56626,114,97,118,101,5,249,1,59,18317,1,249,4,2,97,98,18325,18338,114,4,2,108,114,18332,18335,59,1,8639,59,1,8638,108,107,59,1,9600,4,2,99,116,18349,18374,4,2,111,114,18355,18369,114,110,4,2,59,101,18363,18365,1,8988,114,59,1,8988,111,112,59,1,8975,114,105,59,1,9720,4,2,97,108,18385,18390,99,114,59,1,363,5,168,1,59,18395,1,168,4,2,103,112,18403,18408,111,110,59,1,371,102,59,3,55349,56678,4,6,97,100,104,108,115,117,18427,18434,18445,18470,18475,18494,114,114,111,119,59,1,8593,111,119,110,97,114,114,111,119,59,1,8597,97,114,112,111,111,110,4,2,108,114,18457,18463,101,102,116,59,1,8639,105,103,104,116,59,1,8638,117,115,59,1,8846,105,4,3,59,104,108,18484,18486,18489,1,965,59,1,978,111,110,59,1,965,112,97,114,114,111,119,115,59,1,8648,4,3,99,105,116,18512,18537,18542,4,2,111,114,18518,18532,114,110,4,2,59,101,18526,18528,1,8989,114,59,1,8989,111,112,59,1,8974,110,103,59,1,367,114,105,59,1,9721,99,114,59,3,55349,56522,4,3,100,105,114,18561,18566,18572,111,116,59,1,8944,108,100,101,59,1,361,105,4,2,59,102,18579,18581,1,9653,59,1,9652,4,2,97,109,18590,18595,114,114,59,1,8648,108,5,252,1,59,18601,1,252,97,110,103,108,101,59,1,10663,4,15,65,66,68,97,99,100,101,102,108,110,111,112,114,115,122,18643,18648,18661,18667,18847,18851,18857,18904,18909,18915,18931,18937,18943,18949,18996,114,114,59,1,8661,97,114,4,2,59,118,18656,18658,1,10984,59,1,10985,97,115,104,59,1,8872,4,2,110,114,18673,18679,103,114,116,59,1,10652,4,7,101,107,110,112,114,115,116,18695,18704,18711,18720,18742,18754,18810,112,115,105,108,111,110,59,1,1013,97,112,112,97,59,1,1008,111,116,104,105,110,103,59,1,8709,4,3,104,105,114,18728,18732,18735,105,59,1,981,59,1,982,111,112,116,111,59,1,8733,4,2,59,104,18748,18750,1,8597,111,59,1,1009,4,2,105,117,18760,18766,103,109,97,59,1,962,4,2,98,112,18772,18791,115,101,116,110,101,113,4,2,59,113,18784,18787,3,8842,65024,59,3,10955,65024,115,101,116,110,101,113,4,2,59,113,18803,18806,3,8843,65024,59,3,10956,65024,4,2,104,114,18816,18822,101,116,97,59,1,977,105,97,110,103,108,101,4,2,108,114,18834,18840,101,102,116,59,1,8882,105,103,104,116,59,1,8883,121,59,1,1074,97,115,104,59,1,8866,4,3,101,108,114,18865,18884,18890,4,3,59,98,101,18873,18875,18880,1,8744,97,114,59,1,8891,113,59,1,8794,108,105,112,59,1,8942,4,2,98,116,18896,18901,97,114,59,1,124,59,1,124,114,59,3,55349,56627,116,114,105,59,1,8882,115,117,4,2,98,112,18923,18927,59,3,8834,8402,59,3,8835,8402,112,102,59,3,55349,56679,114,111,112,59,1,8733,116,114,105,59,1,8883,4,2,99,117,18955,18960,114,59,3,55349,56523,4,2,98,112,18966,18981,110,4,2,69,101,18973,18977,59,3,10955,65024,59,3,8842,65024,110,4,2,69,101,18988,18992,59,3,10956,65024,59,3,8843,65024,105,103,122,97,103,59,1,10650,4,7,99,101,102,111,112,114,115,19020,19026,19061,19066,19072,19075,19089,105,114,99,59,1,373,4,2,100,105,19032,19055,4,2,98,103,19038,19043,97,114,59,1,10847,101,4,2,59,113,19050,19052,1,8743,59,1,8793,101,114,112,59,1,8472,114,59,3,55349,56628,112,102,59,3,55349,56680,59,1,8472,4,2,59,101,19081,19083,1,8768,97,116,104,59,1,8768,99,114,59,3,55349,56524,4,14,99,100,102,104,105,108,109,110,111,114,115,117,118,119,19125,19146,19152,19157,19173,19176,19192,19197,19202,19236,19252,19269,19286,19291,4,3,97,105,117,19133,19137,19142,112,59,1,8898,114,99,59,1,9711,112,59,1,8899,116,114,105,59,1,9661,114,59,3,55349,56629,4,2,65,97,19163,19168,114,114,59,1,10234,114,114,59,1,10231,59,1,958,4,2,65,97,19182,19187,114,114,59,1,10232,114,114,59,1,10229,97,112,59,1,10236,105,115,59,1,8955,4,3,100,112,116,19210,19215,19230,111,116,59,1,10752,4,2,102,108,19221,19225,59,3,55349,56681,117,115,59,1,10753,105,109,101,59,1,10754,4,2,65,97,19242,19247,114,114,59,1,10233,114,114,59,1,10230,4,2,99,113,19258,19263,114,59,3,55349,56525,99,117,112,59,1,10758,4,2,112,116,19275,19281,108,117,115,59,1,10756,114,105,59,1,9651,101,101,59,1,8897,101,100,103,101,59,1,8896,4,8,97,99,101,102,105,111,115,117,19316,19335,19349,19357,19362,19367,19373,19379,99,4,2,117,121,19323,19332,116,101,5,253,1,59,19330,1,253,59,1,1103,4,2,105,121,19341,19346,114,99,59,1,375,59,1,1099,110,5,165,1,59,19355,1,165,114,59,3,55349,56630,99,121,59,1,1111,112,102,59,3,55349,56682,99,114,59,3,55349,56526,4,2,99,109,19385,19389,121,59,1,1102,108,5,255,1,59,19395,1,255,4,10,97,99,100,101,102,104,105,111,115,119,19419,19426,19441,19446,19462,19467,19472,19480,19486,19492,99,117,116,101,59,1,378,4,2,97,121,19432,19438,114,111,110,59,1,382,59,1,1079,111,116,59,1,380,4,2,101,116,19452,19458,116,114,102,59,1,8488,97,59,1,950,114,59,3,55349,56631,99,121,59,1,1078,103,114,97,114,114,59,1,8669,112,102,59,3,55349,56683,99,114,59,3,55349,56527,4,2,106,110,19498,19501,59,1,8205,106,59,1,8204])});var Ho=ue((zW,b0)=>{"use strict";var q5=bb(),Me=Qu(),Ts=Sb(),O=Yu(),w=Me.CODE_POINTS,fs=Me.CODE_POINT_SEQUENCES,H5={128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},p0=1,m0=2,f0=4,U5=p0|m0|f0,le="DATA_STATE",lr="RCDATA_STATE",Bo="RAWTEXT_STATE",Xn="SCRIPT_DATA_STATE",g0="PLAINTEXT_STATE",Cb="TAG_OPEN_STATE",xb="END_TAG_OPEN_STATE",Kp="TAG_NAME_STATE",wb="RCDATA_LESS_THAN_SIGN_STATE",Ib="RCDATA_END_TAG_OPEN_STATE",Mb="RCDATA_END_TAG_NAME_STATE",Eb="RAWTEXT_LESS_THAN_SIGN_STATE",Ab="RAWTEXT_END_TAG_OPEN_STATE",Rb="RAWTEXT_END_TAG_NAME_STATE",kb="SCRIPT_DATA_LESS_THAN_SIGN_STATE",Pb="SCRIPT_DATA_END_TAG_OPEN_STATE",_b="SCRIPT_DATA_END_TAG_NAME_STATE",Lb="SCRIPT_DATA_ESCAPE_START_STATE",Ob="SCRIPT_DATA_ESCAPE_START_DASH_STATE",hn="SCRIPT_DATA_ESCAPED_STATE",Nb="SCRIPT_DATA_ESCAPED_DASH_STATE",Wp="SCRIPT_DATA_ESCAPED_DASH_DASH_STATE",Xu="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN_STATE",Db="SCRIPT_DATA_ESCAPED_END_TAG_OPEN_STATE",Fb="SCRIPT_DATA_ESCAPED_END_TAG_NAME_STATE",$b="SCRIPT_DATA_DOUBLE_ESCAPE_START_STATE",Qn="SCRIPT_DATA_DOUBLE_ESCAPED_STATE",Bb="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_STATE",qb="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH_STATE",Ju="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN_STATE",Hb="SCRIPT_DATA_DOUBLE_ESCAPE_END_STATE",Rn="BEFORE_ATTRIBUTE_NAME_STATE",Zu="ATTRIBUTE_NAME_STATE",jp="AFTER_ATTRIBUTE_NAME_STATE",Vp="BEFORE_ATTRIBUTE_VALUE_STATE",el="ATTRIBUTE_VALUE_DOUBLE_QUOTED_STATE",tl="ATTRIBUTE_VALUE_SINGLE_QUOTED_STATE",nl="ATTRIBUTE_VALUE_UNQUOTED_STATE",Gp="AFTER_ATTRIBUTE_VALUE_QUOTED_STATE",Ai="SELF_CLOSING_START_TAG_STATE",No="BOGUS_COMMENT_STATE",Ub="MARKUP_DECLARATION_OPEN_STATE",Kb="COMMENT_START_STATE",Wb="COMMENT_START_DASH_STATE",Ri="COMMENT_STATE",jb="COMMENT_LESS_THAN_SIGN_STATE",Vb="COMMENT_LESS_THAN_SIGN_BANG_STATE",Gb="COMMENT_LESS_THAN_SIGN_BANG_DASH_STATE",zb="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH_STATE",il="COMMENT_END_DASH_STATE",sl="COMMENT_END_STATE",Qb="COMMENT_END_BANG_STATE",Yb="DOCTYPE_STATE",rl="BEFORE_DOCTYPE_NAME_STATE",ol="DOCTYPE_NAME_STATE",Xb="AFTER_DOCTYPE_NAME_STATE",Jb="AFTER_DOCTYPE_PUBLIC_KEYWORD_STATE",Zb="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER_STATE",zp="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED_STATE",Qp="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED_STATE",Yp="AFTER_DOCTYPE_PUBLIC_IDENTIFIER_STATE",e0="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS_STATE",t0="AFTER_DOCTYPE_SYSTEM_KEYWORD_STATE",n0="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER_STATE",Do="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED_STATE",Fo="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED_STATE",Xp="AFTER_DOCTYPE_SYSTEM_IDENTIFIER_STATE",Yn="BOGUS_DOCTYPE_STATE",al="CDATA_SECTION_STATE",i0="CDATA_SECTION_BRACKET_STATE",s0="CDATA_SECTION_END_STATE",ur="CHARACTER_REFERENCE_STATE",r0="NAMED_CHARACTER_REFERENCE_STATE",o0="AMBIGUOS_AMPERSAND_STATE",a0="NUMERIC_CHARACTER_REFERENCE_STATE",u0="HEXADEMICAL_CHARACTER_REFERENCE_START_STATE",l0="DECIMAL_CHARACTER_REFERENCE_START_STATE",c0="HEXADEMICAL_CHARACTER_REFERENCE_STATE",d0="DECIMAL_CHARACTER_REFERENCE_STATE",$o="NUMERIC_CHARACTER_REFERENCE_END_STATE";function Pe(n){return n===w.SPACE||n===w.LINE_FEED||n===w.TABULATION||n===w.FORM_FEED}function qo(n){return n>=w.DIGIT_0&&n<=w.DIGIT_9}function pn(n){return n>=w.LATIN_CAPITAL_A&&n<=w.LATIN_CAPITAL_Z}function gs(n){return n>=w.LATIN_SMALL_A&&n<=w.LATIN_SMALL_Z}function Pi(n){return gs(n)||pn(n)}function Jp(n){return Pi(n)||qo(n)}function T0(n){return n>=w.LATIN_CAPITAL_A&&n<=w.LATIN_CAPITAL_F}function y0(n){return n>=w.LATIN_SMALL_A&&n<=w.LATIN_SMALL_F}function K5(n){return qo(n)||T0(n)||y0(n)}function ul(n){return n+32}function qe(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode(n>>>10&1023|55296)+String.fromCharCode(56320|n&1023))}function ki(n){return String.fromCharCode(ul(n))}function h0(n,e){let t=Ts[++n],i=++n,s=i+t-1;for(;i<=s;){let r=i+s>>>1,o=Ts[r];if(o<e)i=r+1;else if(o>e)s=r-1;else return Ts[r+t]}return-1}var Ct=class n{constructor(){this.preprocessor=new q5,this.tokenQueue=[],this.allowCDATA=!1,this.state=le,this.returnState="",this.charRefCode=-1,this.tempBuff=[],this.lastStartTagName="",this.consumedAfterSnapshot=-1,this.active=!1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr=null}_err(){}_errOnNextCodePoint(e){this._consume(),this._err(e),this._unconsume()}getNextToken(){for(;!this.tokenQueue.length&&this.active;){this.consumedAfterSnapshot=0;let e=this._consume();this._ensureHibernation()||this[this.state](e)}return this.tokenQueue.shift()}write(e,t){this.active=!0,this.preprocessor.write(e,t)}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e)}_ensureHibernation(){if(this.preprocessor.endOfChunkHit){for(;this.consumedAfterSnapshot>0;this.consumedAfterSnapshot--)this.preprocessor.retreat();return this.active=!1,this.tokenQueue.push({type:n.HIBERNATION_TOKEN}),!0}return!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_unconsume(){this.consumedAfterSnapshot--,this.preprocessor.retreat()}_reconsumeInState(e){this.state=e,this._unconsume()}_consumeSequenceIfMatch(e,t,i){let s=0,r=!0,o=e.length,a=0,u=t,l;for(;a<o;a++){if(a>0&&(u=this._consume(),s++),u===w.EOF){r=!1;break}if(l=e[a],u!==l&&(i||u!==ul(l))){r=!1;break}}if(!r)for(;s--;)this._unconsume();return r}_isTempBufferEqualToScriptString(){if(this.tempBuff.length!==fs.SCRIPT_STRING.length)return!1;for(let e=0;e<this.tempBuff.length;e++)if(this.tempBuff[e]!==fs.SCRIPT_STRING[e])return!1;return!0}_createStartTagToken(){this.currentToken={type:n.START_TAG_TOKEN,tagName:"",selfClosing:!1,ackSelfClosing:!1,attrs:[]}}_createEndTagToken(){this.currentToken={type:n.END_TAG_TOKEN,tagName:"",selfClosing:!1,attrs:[]}}_createCommentToken(){this.currentToken={type:n.COMMENT_TOKEN,data:""}}_createDoctypeToken(e){this.currentToken={type:n.DOCTYPE_TOKEN,name:e,forceQuirks:!1,publicId:null,systemId:null}}_createCharacterToken(e,t){this.currentCharacterToken={type:e,chars:t}}_createEOFToken(){this.currentToken={type:n.EOF_TOKEN}}_createAttr(e){this.currentAttr={name:e,value:""}}_leaveAttrName(e){n.getTokenAttr(this.currentToken,this.currentAttr.name)===null?this.currentToken.attrs.push(this.currentAttr):this._err(O.duplicateAttribute),this.state=e}_leaveAttrValue(e){this.state=e}_emitCurrentToken(){this._emitCurrentCharacterToken();let e=this.currentToken;this.currentToken=null,e.type===n.START_TAG_TOKEN?this.lastStartTagName=e.tagName:e.type===n.END_TAG_TOKEN&&(e.attrs.length>0&&this._err(O.endTagWithAttributes),e.selfClosing&&this._err(O.endTagWithTrailingSolidus)),this.tokenQueue.push(e)}_emitCurrentCharacterToken(){this.currentCharacterToken&&(this.tokenQueue.push(this.currentCharacterToken),this.currentCharacterToken=null)}_emitEOFToken(){this._createEOFToken(),this._emitCurrentToken()}_appendCharToCurrentCharacterToken(e,t){this.currentCharacterToken&&this.currentCharacterToken.type!==e&&this._emitCurrentCharacterToken(),this.currentCharacterToken?this.currentCharacterToken.chars+=t:this._createCharacterToken(e,t)}_emitCodePoint(e){let t=n.CHARACTER_TOKEN;Pe(e)?t=n.WHITESPACE_CHARACTER_TOKEN:e===w.NULL&&(t=n.NULL_CHARACTER_TOKEN),this._appendCharToCurrentCharacterToken(t,qe(e))}_emitSeveralCodePoints(e){for(let t=0;t<e.length;t++)this._emitCodePoint(e[t])}_emitChars(e){this._appendCharToCurrentCharacterToken(n.CHARACTER_TOKEN,e)}_matchNamedCharacterReference(e){let t=null,i=1,s=h0(0,e);for(this.tempBuff.push(e);s>-1;){let r=Ts[s],o=r<U5;o&&r&p0&&(t=r&m0?[Ts[++s],Ts[++s]]:[Ts[++s]],i=0);let u=this._consume();if(this.tempBuff.push(u),i++,u===w.EOF)break;o?s=r&f0?h0(s,u):-1:s=u===r?++s:-1}for(;i--;)this.tempBuff.pop(),this._unconsume();return t}_isCharacterReferenceInAttribute(){return this.returnState===el||this.returnState===tl||this.returnState===nl}_isCharacterReferenceAttributeQuirk(e){if(!e&&this._isCharacterReferenceInAttribute()){let t=this._consume();return this._unconsume(),t===w.EQUALS_SIGN||Jp(t)}return!1}_flushCodePointsConsumedAsCharacterReference(){if(this._isCharacterReferenceInAttribute())for(let e=0;e<this.tempBuff.length;e++)this.currentAttr.value+=qe(this.tempBuff[e]);else this._emitSeveralCodePoints(this.tempBuff);this.tempBuff=[]}[le](e){this.preprocessor.dropParsedChunk(),e===w.LESS_THAN_SIGN?this.state=Cb:e===w.AMPERSAND?(this.returnState=le,this.state=ur):e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitCodePoint(e)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[lr](e){this.preprocessor.dropParsedChunk(),e===w.AMPERSAND?(this.returnState=lr,this.state=ur):e===w.LESS_THAN_SIGN?this.state=wb:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[Bo](e){this.preprocessor.dropParsedChunk(),e===w.LESS_THAN_SIGN?this.state=Eb:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[Xn](e){this.preprocessor.dropParsedChunk(),e===w.LESS_THAN_SIGN?this.state=kb:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[g0](e){this.preprocessor.dropParsedChunk(),e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?this._emitEOFToken():this._emitCodePoint(e)}[Cb](e){e===w.EXCLAMATION_MARK?this.state=Ub:e===w.SOLIDUS?this.state=xb:Pi(e)?(this._createStartTagToken(),this._reconsumeInState(Kp)):e===w.QUESTION_MARK?(this._err(O.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(),this._reconsumeInState(No)):e===w.EOF?(this._err(O.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken()):(this._err(O.invalidFirstCharacterOfTagName),this._emitChars("<"),this._reconsumeInState(le))}[xb](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Kp)):e===w.GREATER_THAN_SIGN?(this._err(O.missingEndTagName),this.state=le):e===w.EOF?(this._err(O.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken()):(this._err(O.invalidFirstCharacterOfTagName),this._createCommentToken(),this._reconsumeInState(No))}[Kp](e){Pe(e)?this.state=Rn:e===w.SOLIDUS?this.state=Ai:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):pn(e)?this.currentToken.tagName+=ki(e):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.tagName+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentToken.tagName+=qe(e)}[wb](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Ib):(this._emitChars("<"),this._reconsumeInState(lr))}[Ib](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Mb)):(this._emitChars("</"),this._reconsumeInState(lr))}[Mb](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}if(e===w.SOLIDUS){this.state=Ai;return}if(e===w.GREATER_THAN_SIGN){this.state=le,this._emitCurrentToken();return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(lr)}}[Eb](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Ab):(this._emitChars("<"),this._reconsumeInState(Bo))}[Ab](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Rb)):(this._emitChars("</"),this._reconsumeInState(Bo))}[Rb](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}if(e===w.SOLIDUS){this.state=Ai;return}if(e===w.GREATER_THAN_SIGN){this._emitCurrentToken(),this.state=le;return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Bo)}}[kb](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Pb):e===w.EXCLAMATION_MARK?(this.state=Lb,this._emitChars("<!")):(this._emitChars("<"),this._reconsumeInState(Xn))}[Pb](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(_b)):(this._emitChars("</"),this._reconsumeInState(Xn))}[_b](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}else if(e===w.SOLIDUS){this.state=Ai;return}else if(e===w.GREATER_THAN_SIGN){this._emitCurrentToken(),this.state=le;return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(Xn)}}[Lb](e){e===w.HYPHEN_MINUS?(this.state=Ob,this._emitChars("-")):this._reconsumeInState(Xn)}[Ob](e){e===w.HYPHEN_MINUS?(this.state=Wp,this._emitChars("-")):this._reconsumeInState(Xn)}[hn](e){e===w.HYPHEN_MINUS?(this.state=Nb,this._emitChars("-")):e===w.LESS_THAN_SIGN?this.state=Xu:e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(e)}[Nb](e){e===w.HYPHEN_MINUS?(this.state=Wp,this._emitChars("-")):e===w.LESS_THAN_SIGN?this.state=Xu:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=hn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=hn,this._emitCodePoint(e))}[Wp](e){e===w.HYPHEN_MINUS?this._emitChars("-"):e===w.LESS_THAN_SIGN?this.state=Xu:e===w.GREATER_THAN_SIGN?(this.state=Xn,this._emitChars(">")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=hn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=hn,this._emitCodePoint(e))}[Xu](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Db):Pi(e)?(this.tempBuff=[],this._emitChars("<"),this._reconsumeInState($b)):(this._emitChars("<"),this._reconsumeInState(hn))}[Db](e){Pi(e)?(this._createEndTagToken(),this._reconsumeInState(Fb)):(this._emitChars("</"),this._reconsumeInState(hn))}[Fb](e){if(pn(e))this.currentToken.tagName+=ki(e),this.tempBuff.push(e);else if(gs(e))this.currentToken.tagName+=qe(e),this.tempBuff.push(e);else{if(this.lastStartTagName===this.currentToken.tagName){if(Pe(e)){this.state=Rn;return}if(e===w.SOLIDUS){this.state=Ai;return}if(e===w.GREATER_THAN_SIGN){this._emitCurrentToken(),this.state=le;return}}this._emitChars("</"),this._emitSeveralCodePoints(this.tempBuff),this._reconsumeInState(hn)}}[$b](e){Pe(e)||e===w.SOLIDUS||e===w.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?Qn:hn,this._emitCodePoint(e)):pn(e)?(this.tempBuff.push(ul(e)),this._emitCodePoint(e)):gs(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(hn)}[Qn](e){e===w.HYPHEN_MINUS?(this.state=Bb,this._emitChars("-")):e===w.LESS_THAN_SIGN?(this.state=Ju,this._emitChars("<")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):this._emitCodePoint(e)}[Bb](e){e===w.HYPHEN_MINUS?(this.state=qb,this._emitChars("-")):e===w.LESS_THAN_SIGN?(this.state=Ju,this._emitChars("<")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=Qn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=Qn,this._emitCodePoint(e))}[qb](e){e===w.HYPHEN_MINUS?this._emitChars("-"):e===w.LESS_THAN_SIGN?(this.state=Ju,this._emitChars("<")):e===w.GREATER_THAN_SIGN?(this.state=Xn,this._emitChars(">")):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.state=Qn,this._emitChars(Me.REPLACEMENT_CHARACTER)):e===w.EOF?(this._err(O.eofInScriptHtmlCommentLikeText),this._emitEOFToken()):(this.state=Qn,this._emitCodePoint(e))}[Ju](e){e===w.SOLIDUS?(this.tempBuff=[],this.state=Hb,this._emitChars("/")):this._reconsumeInState(Qn)}[Hb](e){Pe(e)||e===w.SOLIDUS||e===w.GREATER_THAN_SIGN?(this.state=this._isTempBufferEqualToScriptString()?hn:Qn,this._emitCodePoint(e)):pn(e)?(this.tempBuff.push(ul(e)),this._emitCodePoint(e)):gs(e)?(this.tempBuff.push(e),this._emitCodePoint(e)):this._reconsumeInState(Qn)}[Rn](e){Pe(e)||(e===w.SOLIDUS||e===w.GREATER_THAN_SIGN||e===w.EOF?this._reconsumeInState(jp):e===w.EQUALS_SIGN?(this._err(O.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=Zu):(this._createAttr(""),this._reconsumeInState(Zu)))}[Zu](e){Pe(e)||e===w.SOLIDUS||e===w.GREATER_THAN_SIGN||e===w.EOF?(this._leaveAttrName(jp),this._unconsume()):e===w.EQUALS_SIGN?this._leaveAttrName(Vp):pn(e)?this.currentAttr.name+=ki(e):e===w.QUOTATION_MARK||e===w.APOSTROPHE||e===w.LESS_THAN_SIGN?(this._err(O.unexpectedCharacterInAttributeName),this.currentAttr.name+=qe(e)):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.name+=Me.REPLACEMENT_CHARACTER):this.currentAttr.name+=qe(e)}[jp](e){Pe(e)||(e===w.SOLIDUS?this.state=Ai:e===w.EQUALS_SIGN?this.state=Vp:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):(this._createAttr(""),this._reconsumeInState(Zu)))}[Vp](e){Pe(e)||(e===w.QUOTATION_MARK?this.state=el:e===w.APOSTROPHE?this.state=tl:e===w.GREATER_THAN_SIGN?(this._err(O.missingAttributeValue),this.state=le,this._emitCurrentToken()):this._reconsumeInState(nl))}[el](e){e===w.QUOTATION_MARK?this.state=Gp:e===w.AMPERSAND?(this.returnState=el,this.state=ur):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentAttr.value+=qe(e)}[tl](e){e===w.APOSTROPHE?this.state=Gp:e===w.AMPERSAND?(this.returnState=tl,this.state=ur):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentAttr.value+=qe(e)}[nl](e){Pe(e)?this._leaveAttrValue(Rn):e===w.AMPERSAND?(this.returnState=nl,this.state=ur):e===w.GREATER_THAN_SIGN?(this._leaveAttrValue(le),this._emitCurrentToken()):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentAttr.value+=Me.REPLACEMENT_CHARACTER):e===w.QUOTATION_MARK||e===w.APOSTROPHE||e===w.LESS_THAN_SIGN||e===w.EQUALS_SIGN||e===w.GRAVE_ACCENT?(this._err(O.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=qe(e)):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):this.currentAttr.value+=qe(e)}[Gp](e){Pe(e)?this._leaveAttrValue(Rn):e===w.SOLIDUS?this._leaveAttrValue(Ai):e===w.GREATER_THAN_SIGN?(this._leaveAttrValue(le),this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):(this._err(O.missingWhitespaceBetweenAttributes),this._reconsumeInState(Rn))}[Ai](e){e===w.GREATER_THAN_SIGN?(this.currentToken.selfClosing=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInTag),this._emitEOFToken()):(this._err(O.unexpectedSolidusInTag),this._reconsumeInState(Rn))}[No](e){e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EOF?(this._emitCurrentToken(),this._emitEOFToken()):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.data+=Me.REPLACEMENT_CHARACTER):this.currentToken.data+=qe(e)}[Ub](e){this._consumeSequenceIfMatch(fs.DASH_DASH_STRING,e,!0)?(this._createCommentToken(),this.state=Kb):this._consumeSequenceIfMatch(fs.DOCTYPE_STRING,e,!1)?this.state=Yb:this._consumeSequenceIfMatch(fs.CDATA_START_STRING,e,!0)?this.allowCDATA?this.state=al:(this._err(O.cdataInHtmlContent),this._createCommentToken(),this.currentToken.data="[CDATA[",this.state=No):this._ensureHibernation()||(this._err(O.incorrectlyOpenedComment),this._createCommentToken(),this._reconsumeInState(No))}[Kb](e){e===w.HYPHEN_MINUS?this.state=Wb:e===w.GREATER_THAN_SIGN?(this._err(O.abruptClosingOfEmptyComment),this.state=le,this._emitCurrentToken()):this._reconsumeInState(Ri)}[Wb](e){e===w.HYPHEN_MINUS?this.state=sl:e===w.GREATER_THAN_SIGN?(this._err(O.abruptClosingOfEmptyComment),this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Ri))}[Ri](e){e===w.HYPHEN_MINUS?this.state=il:e===w.LESS_THAN_SIGN?(this.currentToken.data+="<",this.state=jb):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.data+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.data+=qe(e)}[jb](e){e===w.EXCLAMATION_MARK?(this.currentToken.data+="!",this.state=Vb):e===w.LESS_THAN_SIGN?this.currentToken.data+="!":this._reconsumeInState(Ri)}[Vb](e){e===w.HYPHEN_MINUS?this.state=Gb:this._reconsumeInState(Ri)}[Gb](e){e===w.HYPHEN_MINUS?this.state=zb:this._reconsumeInState(il)}[zb](e){e!==w.GREATER_THAN_SIGN&&e!==w.EOF&&this._err(O.nestedComment),this._reconsumeInState(sl)}[il](e){e===w.HYPHEN_MINUS?this.state=sl:e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="-",this._reconsumeInState(Ri))}[sl](e){e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EXCLAMATION_MARK?this.state=Qb:e===w.HYPHEN_MINUS?this.currentToken.data+="-":e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--",this._reconsumeInState(Ri))}[Qb](e){e===w.HYPHEN_MINUS?(this.currentToken.data+="--!",this.state=il):e===w.GREATER_THAN_SIGN?(this._err(O.incorrectlyClosedComment),this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInComment),this._emitCurrentToken(),this._emitEOFToken()):(this.currentToken.data+="--!",this._reconsumeInState(Ri))}[Yb](e){Pe(e)?this.state=rl:e===w.GREATER_THAN_SIGN?this._reconsumeInState(rl):e===w.EOF?(this._err(O.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingWhitespaceBeforeDoctypeName),this._reconsumeInState(rl))}[rl](e){Pe(e)||(pn(e)?(this._createDoctypeToken(ki(e)),this.state=ol):e===w.NULL?(this._err(O.unexpectedNullCharacter),this._createDoctypeToken(Me.REPLACEMENT_CHARACTER),this.state=ol):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypeName),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this._createDoctypeToken(null),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._createDoctypeToken(qe(e)),this.state=ol))}[ol](e){Pe(e)?this.state=Xb:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):pn(e)?this.currentToken.name+=ki(e):e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.name+=Me.REPLACEMENT_CHARACTER):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.name+=qe(e)}[Xb](e){Pe(e)||(e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this._consumeSequenceIfMatch(fs.PUBLIC_STRING,e,!1)?this.state=Jb:this._consumeSequenceIfMatch(fs.SYSTEM_STRING,e,!1)?this.state=t0:this._ensureHibernation()||(this._err(O.invalidCharacterSequenceAfterDoctypeName),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[Jb](e){Pe(e)?this.state=Zb:e===w.QUOTATION_MARK?(this._err(O.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=zp):e===w.APOSTROPHE?(this._err(O.missingWhitespaceAfterDoctypePublicKeyword),this.currentToken.publicId="",this.state=Qp):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn))}[Zb](e){Pe(e)||(e===w.QUOTATION_MARK?(this.currentToken.publicId="",this.state=zp):e===w.APOSTROPHE?(this.currentToken.publicId="",this.state=Qp):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[zp](e){e===w.QUOTATION_MARK?this.state=Yp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.publicId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=qe(e)}[Qp](e){e===w.APOSTROPHE?this.state=Yp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.publicId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypePublicIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.publicId+=qe(e)}[Yp](e){Pe(e)?this.state=e0:e===w.GREATER_THAN_SIGN?(this.state=le,this._emitCurrentToken()):e===w.QUOTATION_MARK?(this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this._err(O.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),this.currentToken.systemId="",this.state=Fo):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn))}[e0](e){Pe(e)||(e===w.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=le):e===w.QUOTATION_MARK?(this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this.currentToken.systemId="",this.state=Fo):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[t0](e){Pe(e)?this.state=n0:e===w.QUOTATION_MARK?(this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this._err(O.missingWhitespaceAfterDoctypeSystemKeyword),this.currentToken.systemId="",this.state=Fo):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn))}[n0](e){Pe(e)||(e===w.QUOTATION_MARK?(this.currentToken.systemId="",this.state=Do):e===w.APOSTROPHE?(this.currentToken.systemId="",this.state=Fo):e===w.GREATER_THAN_SIGN?(this._err(O.missingDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this.state=le,this._emitCurrentToken()):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.missingQuoteBeforeDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._reconsumeInState(Yn)))}[Do](e){e===w.QUOTATION_MARK?this.state=Xp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.systemId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=qe(e)}[Fo](e){e===w.APOSTROPHE?this.state=Xp:e===w.NULL?(this._err(O.unexpectedNullCharacter),this.currentToken.systemId+=Me.REPLACEMENT_CHARACTER):e===w.GREATER_THAN_SIGN?(this._err(O.abruptDoctypeSystemIdentifier),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):this.currentToken.systemId+=qe(e)}[Xp](e){Pe(e)||(e===w.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=le):e===w.EOF?(this._err(O.eofInDoctype),this.currentToken.forceQuirks=!0,this._emitCurrentToken(),this._emitEOFToken()):(this._err(O.unexpectedCharacterAfterDoctypeSystemIdentifier),this._reconsumeInState(Yn)))}[Yn](e){e===w.GREATER_THAN_SIGN?(this._emitCurrentToken(),this.state=le):e===w.NULL?this._err(O.unexpectedNullCharacter):e===w.EOF&&(this._emitCurrentToken(),this._emitEOFToken())}[al](e){e===w.RIGHT_SQUARE_BRACKET?this.state=i0:e===w.EOF?(this._err(O.eofInCdata),this._emitEOFToken()):this._emitCodePoint(e)}[i0](e){e===w.RIGHT_SQUARE_BRACKET?this.state=s0:(this._emitChars("]"),this._reconsumeInState(al))}[s0](e){e===w.GREATER_THAN_SIGN?this.state=le:e===w.RIGHT_SQUARE_BRACKET?this._emitChars("]"):(this._emitChars("]]"),this._reconsumeInState(al))}[ur](e){this.tempBuff=[w.AMPERSAND],e===w.NUMBER_SIGN?(this.tempBuff.push(e),this.state=a0):Jp(e)?this._reconsumeInState(r0):(this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[r0](e){let t=this._matchNamedCharacterReference(e);if(this._ensureHibernation())this.tempBuff=[w.AMPERSAND];else if(t){let i=this.tempBuff[this.tempBuff.length-1]===w.SEMICOLON;this._isCharacterReferenceAttributeQuirk(i)||(i||this._errOnNextCodePoint(O.missingSemicolonAfterCharacterReference),this.tempBuff=t),this._flushCodePointsConsumedAsCharacterReference(),this.state=this.returnState}else this._flushCodePointsConsumedAsCharacterReference(),this.state=o0}[o0](e){Jp(e)?this._isCharacterReferenceInAttribute()?this.currentAttr.value+=qe(e):this._emitCodePoint(e):(e===w.SEMICOLON&&this._err(O.unknownNamedCharacterReference),this._reconsumeInState(this.returnState))}[a0](e){this.charRefCode=0,e===w.LATIN_SMALL_X||e===w.LATIN_CAPITAL_X?(this.tempBuff.push(e),this.state=u0):this._reconsumeInState(l0)}[u0](e){K5(e)?this._reconsumeInState(c0):(this._err(O.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[l0](e){qo(e)?this._reconsumeInState(d0):(this._err(O.absenceOfDigitsInNumericCharacterReference),this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState))}[c0](e){T0(e)?this.charRefCode=this.charRefCode*16+e-55:y0(e)?this.charRefCode=this.charRefCode*16+e-87:qo(e)?this.charRefCode=this.charRefCode*16+e-48:e===w.SEMICOLON?this.state=$o:(this._err(O.missingSemicolonAfterCharacterReference),this._reconsumeInState($o))}[d0](e){qo(e)?this.charRefCode=this.charRefCode*10+e-48:e===w.SEMICOLON?this.state=$o:(this._err(O.missingSemicolonAfterCharacterReference),this._reconsumeInState($o))}[$o](){if(this.charRefCode===w.NULL)this._err(O.nullCharacterReference),this.charRefCode=w.REPLACEMENT_CHARACTER;else if(this.charRefCode>1114111)this._err(O.characterReferenceOutsideUnicodeRange),this.charRefCode=w.REPLACEMENT_CHARACTER;else if(Me.isSurrogate(this.charRefCode))this._err(O.surrogateCharacterReference),this.charRefCode=w.REPLACEMENT_CHARACTER;else if(Me.isUndefinedCodePoint(this.charRefCode))this._err(O.noncharacterCharacterReference);else if(Me.isControlCodePoint(this.charRefCode)||this.charRefCode===w.CARRIAGE_RETURN){this._err(O.controlCharacterReference);let e=H5[this.charRefCode];e&&(this.charRefCode=e)}this.tempBuff=[this.charRefCode],this._flushCodePointsConsumedAsCharacterReference(),this._reconsumeInState(this.returnState)}};Ct.CHARACTER_TOKEN="CHARACTER_TOKEN";Ct.NULL_CHARACTER_TOKEN="NULL_CHARACTER_TOKEN";Ct.WHITESPACE_CHARACTER_TOKEN="WHITESPACE_CHARACTER_TOKEN";Ct.START_TAG_TOKEN="START_TAG_TOKEN";Ct.END_TAG_TOKEN="END_TAG_TOKEN";Ct.COMMENT_TOKEN="COMMENT_TOKEN";Ct.DOCTYPE_TOKEN="DOCTYPE_TOKEN";Ct.EOF_TOKEN="EOF_TOKEN";Ct.HIBERNATION_TOKEN="HIBERNATION_TOKEN";Ct.MODE={DATA:le,RCDATA:lr,RAWTEXT:Bo,SCRIPT_DATA:Xn,PLAINTEXT:g0};Ct.getTokenAttr=function(n,e){for(let t=n.attrs.length-1;t>=0;t--)if(n.attrs[t].name===e)return n.attrs[t].value;return null};b0.exports=Ct});var _i=ue(cr=>{"use strict";var Zp=cr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};cr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};cr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var q=cr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};cr.SPECIAL_ELEMENTS={[Zp.HTML]:{[q.ADDRESS]:!0,[q.APPLET]:!0,[q.AREA]:!0,[q.ARTICLE]:!0,[q.ASIDE]:!0,[q.BASE]:!0,[q.BASEFONT]:!0,[q.BGSOUND]:!0,[q.BLOCKQUOTE]:!0,[q.BODY]:!0,[q.BR]:!0,[q.BUTTON]:!0,[q.CAPTION]:!0,[q.CENTER]:!0,[q.COL]:!0,[q.COLGROUP]:!0,[q.DD]:!0,[q.DETAILS]:!0,[q.DIR]:!0,[q.DIV]:!0,[q.DL]:!0,[q.DT]:!0,[q.EMBED]:!0,[q.FIELDSET]:!0,[q.FIGCAPTION]:!0,[q.FIGURE]:!0,[q.FOOTER]:!0,[q.FORM]:!0,[q.FRAME]:!0,[q.FRAMESET]:!0,[q.H1]:!0,[q.H2]:!0,[q.H3]:!0,[q.H4]:!0,[q.H5]:!0,[q.H6]:!0,[q.HEAD]:!0,[q.HEADER]:!0,[q.HGROUP]:!0,[q.HR]:!0,[q.HTML]:!0,[q.IFRAME]:!0,[q.IMG]:!0,[q.INPUT]:!0,[q.LI]:!0,[q.LINK]:!0,[q.LISTING]:!0,[q.MAIN]:!0,[q.MARQUEE]:!0,[q.MENU]:!0,[q.META]:!0,[q.NAV]:!0,[q.NOEMBED]:!0,[q.NOFRAMES]:!0,[q.NOSCRIPT]:!0,[q.OBJECT]:!0,[q.OL]:!0,[q.P]:!0,[q.PARAM]:!0,[q.PLAINTEXT]:!0,[q.PRE]:!0,[q.SCRIPT]:!0,[q.SECTION]:!0,[q.SELECT]:!0,[q.SOURCE]:!0,[q.STYLE]:!0,[q.SUMMARY]:!0,[q.TABLE]:!0,[q.TBODY]:!0,[q.TD]:!0,[q.TEMPLATE]:!0,[q.TEXTAREA]:!0,[q.TFOOT]:!0,[q.TH]:!0,[q.THEAD]:!0,[q.TITLE]:!0,[q.TR]:!0,[q.TRACK]:!0,[q.UL]:!0,[q.WBR]:!0,[q.XMP]:!0},[Zp.MATHML]:{[q.MI]:!0,[q.MO]:!0,[q.MN]:!0,[q.MS]:!0,[q.MTEXT]:!0,[q.ANNOTATION_XML]:!0},[Zp.SVG]:{[q.TITLE]:!0,[q.FOREIGN_OBJECT]:!0,[q.DESC]:!0}}});var x0=ue((YW,C0)=>{"use strict";var S0=_i(),K=S0.TAG_NAMES,Ee=S0.NAMESPACES;function v0(n){switch(n.length){case 1:return n===K.P;case 2:return n===K.RB||n===K.RP||n===K.RT||n===K.DD||n===K.DT||n===K.LI;case 3:return n===K.RTC;case 6:return n===K.OPTION;case 8:return n===K.OPTGROUP}return!1}function W5(n){switch(n.length){case 1:return n===K.P;case 2:return n===K.RB||n===K.RP||n===K.RT||n===K.DD||n===K.DT||n===K.LI||n===K.TD||n===K.TH||n===K.TR;case 3:return n===K.RTC;case 5:return n===K.TBODY||n===K.TFOOT||n===K.THEAD;case 6:return n===K.OPTION;case 7:return n===K.CAPTION;case 8:return n===K.OPTGROUP||n===K.COLGROUP}return!1}function ll(n,e){switch(n.length){case 2:if(n===K.TD||n===K.TH)return e===Ee.HTML;if(n===K.MI||n===K.MO||n===K.MN||n===K.MS)return e===Ee.MATHML;break;case 4:if(n===K.HTML)return e===Ee.HTML;if(n===K.DESC)return e===Ee.SVG;break;case 5:if(n===K.TABLE)return e===Ee.HTML;if(n===K.MTEXT)return e===Ee.MATHML;if(n===K.TITLE)return e===Ee.SVG;break;case 6:return(n===K.APPLET||n===K.OBJECT)&&e===Ee.HTML;case 7:return(n===K.CAPTION||n===K.MARQUEE)&&e===Ee.HTML;case 8:return n===K.TEMPLATE&&e===Ee.HTML;case 13:return n===K.FOREIGN_OBJECT&&e===Ee.SVG;case 14:return n===K.ANNOTATION_XML&&e===Ee.MATHML}return!1}var em=class{constructor(e,t){this.stackTop=-1,this.items=[],this.current=e,this.currentTagName=null,this.currentTmplContent=null,this.tmplCount=0,this.treeAdapter=t}_indexOf(e){let t=-1;for(let i=this.stackTop;i>=0;i--)if(this.items[i]===e){t=i;break}return t}_isInTemplate(){return this.currentTagName===K.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===Ee.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagName=this.current&&this.treeAdapter.getTagName(this.current),this.currentTmplContent=this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):null}push(e){this.items[++this.stackTop]=e,this._updateCurrentElement(),this._isInTemplate()&&this.tmplCount++}pop(){this.stackTop--,this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this._updateCurrentElement()}replace(e,t){let i=this._indexOf(e);this.items[i]=t,i===this.stackTop&&this._updateCurrentElement()}insertAfter(e,t){let i=this._indexOf(e)+1;this.items.splice(i,0,t),i===++this.stackTop&&this._updateCurrentElement()}popUntilTagNamePopped(e){for(;this.stackTop>-1;){let t=this.currentTagName,i=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),t===e&&i===Ee.HTML)break}}popUntilElementPopped(e){for(;this.stackTop>-1;){let t=this.current;if(this.pop(),t===e)break}}popUntilNumberedHeaderPopped(){for(;this.stackTop>-1;){let e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===K.H1||e===K.H2||e===K.H3||e===K.H4||e===K.H5||e===K.H6&&t===Ee.HTML)break}}popUntilTableCellPopped(){for(;this.stackTop>-1;){let e=this.currentTagName,t=this.treeAdapter.getNamespaceURI(this.current);if(this.pop(),e===K.TD||e===K.TH&&t===Ee.HTML)break}}popAllUpToHtmlElement(){this.stackTop=0,this._updateCurrentElement()}clearBackToTableContext(){for(;this.currentTagName!==K.TABLE&&this.currentTagName!==K.TEMPLATE&&this.currentTagName!==K.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Ee.HTML;)this.pop()}clearBackToTableBodyContext(){for(;this.currentTagName!==K.TBODY&&this.currentTagName!==K.TFOOT&&this.currentTagName!==K.THEAD&&this.currentTagName!==K.TEMPLATE&&this.currentTagName!==K.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Ee.HTML;)this.pop()}clearBackToTableRowContext(){for(;this.currentTagName!==K.TR&&this.currentTagName!==K.TEMPLATE&&this.currentTagName!==K.HTML||this.treeAdapter.getNamespaceURI(this.current)!==Ee.HTML;)this.pop()}remove(e){for(let t=this.stackTop;t>=0;t--)if(this.items[t]===e){this.items.splice(t,1),this.stackTop--,this._updateCurrentElement();break}}tryPeekProperlyNestedBodyElement(){let e=this.items[1];return e&&this.treeAdapter.getTagName(e)===K.BODY?e:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){let t=this._indexOf(e);return--t>=0?this.items[t]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.currentTagName===K.HTML}hasInScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Ee.HTML)return!0;if(ll(i,s))return!1}return!0}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){let t=this.treeAdapter.getTagName(this.items[e]),i=this.treeAdapter.getNamespaceURI(this.items[e]);if((t===K.H1||t===K.H2||t===K.H3||t===K.H4||t===K.H5||t===K.H6)&&i===Ee.HTML)return!0;if(ll(t,i))return!1}return!0}hasInListItemScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Ee.HTML)return!0;if((i===K.UL||i===K.OL)&&s===Ee.HTML||ll(i,s))return!1}return!0}hasInButtonScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]),s=this.treeAdapter.getNamespaceURI(this.items[t]);if(i===e&&s===Ee.HTML)return!0;if(i===K.BUTTON&&s===Ee.HTML||ll(i,s))return!1}return!0}hasInTableScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===Ee.HTML){if(i===e)return!0;if(i===K.TABLE||i===K.TEMPLATE||i===K.HTML)return!1}}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--){let t=this.treeAdapter.getTagName(this.items[e]);if(this.treeAdapter.getNamespaceURI(this.items[e])===Ee.HTML){if(t===K.TBODY||t===K.THEAD||t===K.TFOOT)return!0;if(t===K.TABLE||t===K.HTML)return!1}}return!0}hasInSelectScope(e){for(let t=this.stackTop;t>=0;t--){let i=this.treeAdapter.getTagName(this.items[t]);if(this.treeAdapter.getNamespaceURI(this.items[t])===Ee.HTML){if(i===e)return!0;if(i!==K.OPTION&&i!==K.OPTGROUP)return!1}}return!0}generateImpliedEndTags(){for(;v0(this.currentTagName);)this.pop()}generateImpliedEndTagsThoroughly(){for(;W5(this.currentTagName);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;v0(this.currentTagName)&&this.currentTagName!==e;)this.pop()}};C0.exports=em});var I0=ue((XW,w0)=>{"use strict";var Uo=class n{constructor(e){this.length=0,this.entries=[],this.treeAdapter=e,this.bookmark=null}_getNoahArkConditionCandidates(e){let t=[];if(this.length>=3){let i=this.treeAdapter.getAttrList(e).length,s=this.treeAdapter.getTagName(e),r=this.treeAdapter.getNamespaceURI(e);for(let o=this.length-1;o>=0;o--){let a=this.entries[o];if(a.type===n.MARKER_ENTRY)break;let u=a.element,l=this.treeAdapter.getAttrList(u);this.treeAdapter.getTagName(u)===s&&this.treeAdapter.getNamespaceURI(u)===r&&l.length===i&&t.push({idx:o,attrs:l})}}return t.length<3?[]:t}_ensureNoahArkCondition(e){let t=this._getNoahArkConditionCandidates(e),i=t.length;if(i){let s=this.treeAdapter.getAttrList(e),r=s.length,o=Object.create(null);for(let a=0;a<r;a++){let u=s[a];o[u.name]=u.value}for(let a=0;a<r;a++)for(let u=0;u<i;u++){let l=t[u].attrs[a];if(o[l.name]!==l.value&&(t.splice(u,1),i--),t.length<3)return}for(let a=i-1;a>=2;a--)this.entries.splice(t[a].idx,1),this.length--}}insertMarker(){this.entries.push({type:n.MARKER_ENTRY}),this.length++}pushElement(e,t){this._ensureNoahArkCondition(e),this.entries.push({type:n.ELEMENT_ENTRY,element:e,token:t}),this.length++}insertElementAfterBookmark(e,t){let i=this.length-1;for(;i>=0&&this.entries[i]!==this.bookmark;i--);this.entries.splice(i+1,0,{type:n.ELEMENT_ENTRY,element:e,token:t}),this.length++}removeEntry(e){for(let t=this.length-1;t>=0;t--)if(this.entries[t]===e){this.entries.splice(t,1),this.length--;break}}clearToLastMarker(){for(;this.length;){let e=this.entries.pop();if(this.length--,e.type===n.MARKER_ENTRY)break}}getElementEntryInScopeWithTagName(e){for(let t=this.length-1;t>=0;t--){let i=this.entries[t];if(i.type===n.MARKER_ENTRY)return null;if(this.treeAdapter.getTagName(i.element)===e)return i}return null}getElementEntry(e){for(let t=this.length-1;t>=0;t--){let i=this.entries[t];if(i.type===n.ELEMENT_ENTRY&&i.element===e)return i}return null}};Uo.MARKER_ENTRY="MARKER_ENTRY";Uo.ELEMENT_ENTRY="ELEMENT_ENTRY";w0.exports=Uo});var kn=ue((JW,M0)=>{"use strict";var cl=class{constructor(e){let t={},i=this._getOverriddenMethods(this,t);for(let s of Object.keys(i))typeof i[s]=="function"&&(t[s]=e[s],e[s]=i[s])}_getOverriddenMethods(){throw new Error("Not implemented")}};cl.install=function(n,e,t){n.__mixins||(n.__mixins=[]);for(let s=0;s<n.__mixins.length;s++)if(n.__mixins[s].constructor===e)return n.__mixins[s];let i=new e(n,t);return n.__mixins.push(i),i};M0.exports=cl});var nm=ue((ZW,E0)=>{"use strict";var j5=kn(),tm=class extends j5{constructor(e){super(e),this.preprocessor=e,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.offset=0,this.col=0,this.line=1}_getOverriddenMethods(e,t){return{advance(){let i=this.pos+1,s=this.html[i];return e.isEol&&(e.isEol=!1,e.line++,e.lineStartPos=i),(s===`
|
|
3
3
|
`||s==="\r"&&this.html[i+1]!==`
|
|
4
4
|
`)&&(e.isEol=!0),e.col=i-e.lineStartPos+1,e.offset=e.droppedBufferSize+i,t.advance.call(this)},retreat(){t.retreat.call(this),e.isEol=!1,e.col=this.pos-e.lineStartPos+1},dropParsedChunk(){let i=this.pos;t.dropParsedChunk.call(this);let s=i-this.pos;e.lineStartPos-=s,e.droppedBufferSize+=s,e.offset=e.droppedBufferSize+this.pos}}}};E0.exports=tm});var rm=ue((ej,R0)=>{"use strict";var A0=kn(),im=Ho(),V5=nm(),sm=class extends A0{constructor(e){super(e),this.tokenizer=e,this.posTracker=A0.install(e.preprocessor,V5),this.currentAttrLocation=null,this.ctLoc=null}_getCurrentLocation(){return{startLine:this.posTracker.line,startCol:this.posTracker.col,startOffset:this.posTracker.offset,endLine:-1,endCol:-1,endOffset:-1}}_attachCurrentAttrLocationInfo(){this.currentAttrLocation.endLine=this.posTracker.line,this.currentAttrLocation.endCol=this.posTracker.col,this.currentAttrLocation.endOffset=this.posTracker.offset;let e=this.tokenizer.currentToken,t=this.tokenizer.currentAttr;e.location.attrs||(e.location.attrs=Object.create(null)),e.location.attrs[t.name]=this.currentAttrLocation}_getOverriddenMethods(e,t){let i={_createStartTagToken(){t._createStartTagToken.call(this),this.currentToken.location=e.ctLoc},_createEndTagToken(){t._createEndTagToken.call(this),this.currentToken.location=e.ctLoc},_createCommentToken(){t._createCommentToken.call(this),this.currentToken.location=e.ctLoc},_createDoctypeToken(s){t._createDoctypeToken.call(this,s),this.currentToken.location=e.ctLoc},_createCharacterToken(s,r){t._createCharacterToken.call(this,s,r),this.currentCharacterToken.location=e.ctLoc},_createEOFToken(){t._createEOFToken.call(this),this.currentToken.location=e._getCurrentLocation()},_createAttr(s){t._createAttr.call(this,s),e.currentAttrLocation=e._getCurrentLocation()},_leaveAttrName(s){t._leaveAttrName.call(this,s),e._attachCurrentAttrLocationInfo()},_leaveAttrValue(s){t._leaveAttrValue.call(this,s),e._attachCurrentAttrLocationInfo()},_emitCurrentToken(){let s=this.currentToken.location;this.currentCharacterToken&&(this.currentCharacterToken.location.endLine=s.startLine,this.currentCharacterToken.location.endCol=s.startCol,this.currentCharacterToken.location.endOffset=s.startOffset),this.currentToken.type===im.EOF_TOKEN?(s.endLine=s.startLine,s.endCol=s.startCol,s.endOffset=s.startOffset):(s.endLine=e.posTracker.line,s.endCol=e.posTracker.col+1,s.endOffset=e.posTracker.offset+1),t._emitCurrentToken.call(this)},_emitCurrentCharacterToken(){let s=this.currentCharacterToken&&this.currentCharacterToken.location;s&&s.endOffset===-1&&(s.endLine=e.posTracker.line,s.endCol=e.posTracker.col,s.endOffset=e.posTracker.offset),t._emitCurrentCharacterToken.call(this)}};return Object.keys(im.MODE).forEach(s=>{let r=im.MODE[s];i[r]=function(o){e.ctLoc=e._getCurrentLocation(),t[r].call(this,o)}}),i}};R0.exports=sm});var P0=ue((tj,k0)=>{"use strict";var G5=kn(),om=class extends G5{constructor(e,t){super(e),this.onItemPop=t.onItemPop}_getOverriddenMethods(e,t){return{pop(){e.onItemPop(this.current),t.pop.call(this)},popAllUpToHtmlElement(){for(let i=this.stackTop;i>0;i--)e.onItemPop(this.items[i]);t.popAllUpToHtmlElement.call(this)},remove(i){e.onItemPop(this.current),t.remove.call(this,i)}}}};k0.exports=om});var O0=ue((nj,L0)=>{"use strict";var am=kn(),_0=Ho(),z5=rm(),Q5=P0(),Y5=_i(),um=Y5.TAG_NAMES,lm=class extends am{constructor(e){super(e),this.parser=e,this.treeAdapter=this.parser.treeAdapter,this.posTracker=null,this.lastStartTagToken=null,this.lastFosterParentingLocation=null,this.currentToken=null}_setStartLocation(e){let t=null;this.lastStartTagToken&&(t=Object.assign({},this.lastStartTagToken.location),t.startTag=this.lastStartTagToken.location),this.treeAdapter.setNodeSourceCodeLocation(e,t)}_setEndLocation(e,t){let i=this.treeAdapter.getNodeSourceCodeLocation(e);if(i&&t.location){let s=t.location,r=this.treeAdapter.getTagName(e);t.type===_0.END_TAG_TOKEN&&r===t.tagName?(i.endTag=Object.assign({},s),i.endLine=s.endLine,i.endCol=s.endCol,i.endOffset=s.endOffset):(i.endLine=s.startLine,i.endCol=s.startCol,i.endOffset=s.startOffset)}}_getOverriddenMethods(e,t){return{_bootstrap(i,s){t._bootstrap.call(this,i,s),e.lastStartTagToken=null,e.lastFosterParentingLocation=null,e.currentToken=null;let r=am.install(this.tokenizer,z5);e.posTracker=r.posTracker,am.install(this.openElements,Q5,{onItemPop:function(o){e._setEndLocation(o,e.currentToken)}})},_runParsingLoop(i){t._runParsingLoop.call(this,i);for(let s=this.openElements.stackTop;s>=0;s--)e._setEndLocation(this.openElements.items[s],e.currentToken)},_processTokenInForeignContent(i){e.currentToken=i,t._processTokenInForeignContent.call(this,i)},_processToken(i){if(e.currentToken=i,t._processToken.call(this,i),i.type===_0.END_TAG_TOKEN&&(i.tagName===um.HTML||i.tagName===um.BODY&&this.openElements.hasInScope(um.BODY)))for(let r=this.openElements.stackTop;r>=0;r--){let o=this.openElements.items[r];if(this.treeAdapter.getTagName(o)===i.tagName){e._setEndLocation(o,i);break}}},_setDocumentType(i){t._setDocumentType.call(this,i);let s=this.treeAdapter.getChildNodes(this.document),r=s.length;for(let o=0;o<r;o++){let a=s[o];if(this.treeAdapter.isDocumentTypeNode(a)){this.treeAdapter.setNodeSourceCodeLocation(a,i.location);break}}},_attachElementToTree(i){e._setStartLocation(i),e.lastStartTagToken=null,t._attachElementToTree.call(this,i)},_appendElement(i,s){e.lastStartTagToken=i,t._appendElement.call(this,i,s)},_insertElement(i,s){e.lastStartTagToken=i,t._insertElement.call(this,i,s)},_insertTemplate(i){e.lastStartTagToken=i,t._insertTemplate.call(this,i);let s=this.treeAdapter.getTemplateContent(this.openElements.current);this.treeAdapter.setNodeSourceCodeLocation(s,null)},_insertFakeRootElement(){t._insertFakeRootElement.call(this),this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current,null)},_appendCommentNode(i,s){t._appendCommentNode.call(this,i,s);let r=this.treeAdapter.getChildNodes(s),o=r[r.length-1];this.treeAdapter.setNodeSourceCodeLocation(o,i.location)},_findFosterParentingLocation(){return e.lastFosterParentingLocation=t._findFosterParentingLocation.call(this),e.lastFosterParentingLocation},_insertCharacters(i){t._insertCharacters.call(this,i);let s=this._shouldFosterParentOnInsertion(),r=s&&e.lastFosterParentingLocation.parent||this.openElements.currentTmplContent||this.openElements.current,o=this.treeAdapter.getChildNodes(r),a=s&&e.lastFosterParentingLocation.beforeElement?o.indexOf(e.lastFosterParentingLocation.beforeElement)-1:o.length-1,u=o[a],l=this.treeAdapter.getNodeSourceCodeLocation(u);l?(l.endLine=i.location.endLine,l.endCol=i.location.endCol,l.endOffset=i.location.endOffset):this.treeAdapter.setNodeSourceCodeLocation(u,i.location)}}}};L0.exports=lm});var dl=ue((ij,N0)=>{"use strict";var X5=kn(),cm=class extends X5{constructor(e,t){super(e),this.posTracker=null,this.onParseError=t.onParseError}_setErrorLocation(e){e.startLine=e.endLine=this.posTracker.line,e.startCol=e.endCol=this.posTracker.col,e.startOffset=e.endOffset=this.posTracker.offset}_reportError(e){let t={code:e,startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1};this._setErrorLocation(t),this.onParseError(t)}_getOverriddenMethods(e){return{_err(t){e._reportError(t)}}}};N0.exports=cm});var F0=ue((sj,D0)=>{"use strict";var J5=dl(),Z5=nm(),eP=kn(),dm=class extends J5{constructor(e,t){super(e,t),this.posTracker=eP.install(e,Z5),this.lastErrOffset=-1}_reportError(e){this.lastErrOffset!==this.posTracker.offset&&(this.lastErrOffset=this.posTracker.offset,super._reportError(e))}};D0.exports=dm});var B0=ue((rj,$0)=>{"use strict";var tP=dl(),nP=F0(),iP=kn(),hm=class extends tP{constructor(e,t){super(e,t);let i=iP.install(e.preprocessor,nP,t);this.posTracker=i.posTracker}};$0.exports=hm});var U0=ue((oj,H0)=>{"use strict";var sP=dl(),rP=B0(),oP=rm(),q0=kn(),pm=class extends sP{constructor(e,t){super(e,t),this.opts=t,this.ctLoc=null,this.locBeforeToken=!1}_setErrorLocation(e){this.ctLoc&&(e.startLine=this.ctLoc.startLine,e.startCol=this.ctLoc.startCol,e.startOffset=this.ctLoc.startOffset,e.endLine=this.locBeforeToken?this.ctLoc.startLine:this.ctLoc.endLine,e.endCol=this.locBeforeToken?this.ctLoc.startCol:this.ctLoc.endCol,e.endOffset=this.locBeforeToken?this.ctLoc.startOffset:this.ctLoc.endOffset)}_getOverriddenMethods(e,t){return{_bootstrap(i,s){t._bootstrap.call(this,i,s),q0.install(this.tokenizer,rP,e.opts),q0.install(this.tokenizer,oP)},_processInputToken(i){e.ctLoc=i.location,t._processInputToken.call(this,i)},_err(i,s){e.locBeforeToken=s&&s.beforeToken,e._reportError(i)}}}};H0.exports=pm});var mm=ue(ye=>{"use strict";var{DOCUMENT_MODE:aP}=_i();ye.createDocument=function(){return{nodeName:"#document",mode:aP.NO_QUIRKS,childNodes:[]}};ye.createDocumentFragment=function(){return{nodeName:"#document-fragment",childNodes:[]}};ye.createElement=function(n,e,t){return{nodeName:n,tagName:n,attrs:t,namespaceURI:e,childNodes:[],parentNode:null}};ye.createCommentNode=function(n){return{nodeName:"#comment",data:n,parentNode:null}};var K0=function(n){return{nodeName:"#text",value:n,parentNode:null}},W0=ye.appendChild=function(n,e){n.childNodes.push(e),e.parentNode=n},uP=ye.insertBefore=function(n,e,t){let i=n.childNodes.indexOf(t);n.childNodes.splice(i,0,e),e.parentNode=n};ye.setTemplateContent=function(n,e){n.content=e};ye.getTemplateContent=function(n){return n.content};ye.setDocumentType=function(n,e,t,i){let s=null;for(let r=0;r<n.childNodes.length;r++)if(n.childNodes[r].nodeName==="#documentType"){s=n.childNodes[r];break}s?(s.name=e,s.publicId=t,s.systemId=i):W0(n,{nodeName:"#documentType",name:e,publicId:t,systemId:i})};ye.setDocumentMode=function(n,e){n.mode=e};ye.getDocumentMode=function(n){return n.mode};ye.detachNode=function(n){if(n.parentNode){let e=n.parentNode.childNodes.indexOf(n);n.parentNode.childNodes.splice(e,1),n.parentNode=null}};ye.insertText=function(n,e){if(n.childNodes.length){let t=n.childNodes[n.childNodes.length-1];if(t.nodeName==="#text"){t.value+=e;return}}W0(n,K0(e))};ye.insertTextBefore=function(n,e,t){let i=n.childNodes[n.childNodes.indexOf(t)-1];i&&i.nodeName==="#text"?i.value+=e:uP(n,K0(e),t)};ye.adoptAttributes=function(n,e){let t=[];for(let i=0;i<n.attrs.length;i++)t.push(n.attrs[i].name);for(let i=0;i<e.length;i++)t.indexOf(e[i].name)===-1&&n.attrs.push(e[i])};ye.getFirstChild=function(n){return n.childNodes[0]};ye.getChildNodes=function(n){return n.childNodes};ye.getParentNode=function(n){return n.parentNode};ye.getAttrList=function(n){return n.attrs};ye.getTagName=function(n){return n.tagName};ye.getNamespaceURI=function(n){return n.namespaceURI};ye.getTextNodeContent=function(n){return n.value};ye.getCommentNodeContent=function(n){return n.data};ye.getDocumentTypeNodeName=function(n){return n.name};ye.getDocumentTypeNodePublicId=function(n){return n.publicId};ye.getDocumentTypeNodeSystemId=function(n){return n.systemId};ye.isTextNode=function(n){return n.nodeName==="#text"};ye.isCommentNode=function(n){return n.nodeName==="#comment"};ye.isDocumentTypeNode=function(n){return n.nodeName==="#documentType"};ye.isElementNode=function(n){return!!n.tagName};ye.setNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=e};ye.getNodeSourceCodeLocation=function(n){return n.sourceCodeLocation}});var fm=ue((uj,j0)=>{"use strict";j0.exports=function(e,t){return t=t||Object.create(null),[e,t].reduce((i,s)=>(Object.keys(s).forEach(r=>{i[r]=s[r]}),i),Object.create(null))}});var gm=ue(hl=>{"use strict";var{DOCUMENT_MODE:dr}=_i(),z0="html",lP="about:legacy-compat",cP="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",Q0=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],dP=Q0.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]),hP=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"],Y0=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],pP=Y0.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function V0(n){let e=n.indexOf('"')!==-1?"'":'"';return e+n+e}function G0(n,e){for(let t=0;t<e.length;t++)if(n.indexOf(e[t])===0)return!0;return!1}hl.isConforming=function(n){return n.name===z0&&n.publicId===null&&(n.systemId===null||n.systemId===lP)};hl.getDocumentMode=function(n){if(n.name!==z0)return dr.QUIRKS;let e=n.systemId;if(e&&e.toLowerCase()===cP)return dr.QUIRKS;let t=n.publicId;if(t!==null){if(t=t.toLowerCase(),hP.indexOf(t)>-1)return dr.QUIRKS;let i=e===null?dP:Q0;if(G0(t,i))return dr.QUIRKS;if(i=e===null?Y0:pP,G0(t,i))return dr.LIMITED_QUIRKS}return dr.NO_QUIRKS};hl.serializeContent=function(n,e,t){let i="!DOCTYPE ";return n&&(i+=n),e?i+=" PUBLIC "+V0(e):t&&(i+=" SYSTEM"),t!==null&&(i+=" "+V0(t)),i}});var J0=ue(Li=>{"use strict";var Tm=Ho(),ym=_i(),J=ym.TAG_NAMES,tt=ym.NAMESPACES,pl=ym.ATTRS,X0={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},mP="definitionurl",fP="definitionURL",gP={attributename:"attributeName",attributetype:"attributeType",basefrequency:"baseFrequency",baseprofile:"baseProfile",calcmode:"calcMode",clippathunits:"clipPathUnits",diffuseconstant:"diffuseConstant",edgemode:"edgeMode",filterunits:"filterUnits",glyphref:"glyphRef",gradienttransform:"gradientTransform",gradientunits:"gradientUnits",kernelmatrix:"kernelMatrix",kernelunitlength:"kernelUnitLength",keypoints:"keyPoints",keysplines:"keySplines",keytimes:"keyTimes",lengthadjust:"lengthAdjust",limitingconeangle:"limitingConeAngle",markerheight:"markerHeight",markerunits:"markerUnits",markerwidth:"markerWidth",maskcontentunits:"maskContentUnits",maskunits:"maskUnits",numoctaves:"numOctaves",pathlength:"pathLength",patterncontentunits:"patternContentUnits",patterntransform:"patternTransform",patternunits:"patternUnits",pointsatx:"pointsAtX",pointsaty:"pointsAtY",pointsatz:"pointsAtZ",preservealpha:"preserveAlpha",preserveaspectratio:"preserveAspectRatio",primitiveunits:"primitiveUnits",refx:"refX",refy:"refY",repeatcount:"repeatCount",repeatdur:"repeatDur",requiredextensions:"requiredExtensions",requiredfeatures:"requiredFeatures",specularconstant:"specularConstant",specularexponent:"specularExponent",spreadmethod:"spreadMethod",startoffset:"startOffset",stddeviation:"stdDeviation",stitchtiles:"stitchTiles",surfacescale:"surfaceScale",systemlanguage:"systemLanguage",tablevalues:"tableValues",targetx:"targetX",targety:"targetY",textlength:"textLength",viewbox:"viewBox",viewtarget:"viewTarget",xchannelselector:"xChannelSelector",ychannelselector:"yChannelSelector",zoomandpan:"zoomAndPan"},TP={"xlink:actuate":{prefix:"xlink",name:"actuate",namespace:tt.XLINK},"xlink:arcrole":{prefix:"xlink",name:"arcrole",namespace:tt.XLINK},"xlink:href":{prefix:"xlink",name:"href",namespace:tt.XLINK},"xlink:role":{prefix:"xlink",name:"role",namespace:tt.XLINK},"xlink:show":{prefix:"xlink",name:"show",namespace:tt.XLINK},"xlink:title":{prefix:"xlink",name:"title",namespace:tt.XLINK},"xlink:type":{prefix:"xlink",name:"type",namespace:tt.XLINK},"xml:base":{prefix:"xml",name:"base",namespace:tt.XML},"xml:lang":{prefix:"xml",name:"lang",namespace:tt.XML},"xml:space":{prefix:"xml",name:"space",namespace:tt.XML},xmlns:{prefix:"",name:"xmlns",namespace:tt.XMLNS},"xmlns:xlink":{prefix:"xmlns",name:"xlink",namespace:tt.XMLNS}},yP=Li.SVG_TAG_NAMES_ADJUSTMENT_MAP={altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient",textpath:"textPath"},bP={[J.B]:!0,[J.BIG]:!0,[J.BLOCKQUOTE]:!0,[J.BODY]:!0,[J.BR]:!0,[J.CENTER]:!0,[J.CODE]:!0,[J.DD]:!0,[J.DIV]:!0,[J.DL]:!0,[J.DT]:!0,[J.EM]:!0,[J.EMBED]:!0,[J.H1]:!0,[J.H2]:!0,[J.H3]:!0,[J.H4]:!0,[J.H5]:!0,[J.H6]:!0,[J.HEAD]:!0,[J.HR]:!0,[J.I]:!0,[J.IMG]:!0,[J.LI]:!0,[J.LISTING]:!0,[J.MENU]:!0,[J.META]:!0,[J.NOBR]:!0,[J.OL]:!0,[J.P]:!0,[J.PRE]:!0,[J.RUBY]:!0,[J.S]:!0,[J.SMALL]:!0,[J.SPAN]:!0,[J.STRONG]:!0,[J.STRIKE]:!0,[J.SUB]:!0,[J.SUP]:!0,[J.TABLE]:!0,[J.TT]:!0,[J.U]:!0,[J.UL]:!0,[J.VAR]:!0};Li.causesExit=function(n){let e=n.tagName;return e===J.FONT&&(Tm.getTokenAttr(n,pl.COLOR)!==null||Tm.getTokenAttr(n,pl.SIZE)!==null||Tm.getTokenAttr(n,pl.FACE)!==null)?!0:bP[e]};Li.adjustTokenMathMLAttrs=function(n){for(let e=0;e<n.attrs.length;e++)if(n.attrs[e].name===mP){n.attrs[e].name=fP;break}};Li.adjustTokenSVGAttrs=function(n){for(let e=0;e<n.attrs.length;e++){let t=gP[n.attrs[e].name];t&&(n.attrs[e].name=t)}};Li.adjustTokenXMLAttrs=function(n){for(let e=0;e<n.attrs.length;e++){let t=TP[n.attrs[e].name];t&&(n.attrs[e].prefix=t.prefix,n.attrs[e].name=t.name,n.attrs[e].namespace=t.namespace)}};Li.adjustTokenSVGTagName=function(n){let e=yP[n.tagName];e&&(n.tagName=e)};function vP(n,e){return e===tt.MATHML&&(n===J.MI||n===J.MO||n===J.MN||n===J.MS||n===J.MTEXT)}function SP(n,e,t){if(e===tt.MATHML&&n===J.ANNOTATION_XML){for(let i=0;i<t.length;i++)if(t[i].name===pl.ENCODING){let s=t[i].value.toLowerCase();return s===X0.TEXT_HTML||s===X0.APPLICATION_XML}}return e===tt.SVG&&(n===J.FOREIGN_OBJECT||n===J.DESC||n===J.TITLE)}Li.isIntegrationPoint=function(n,e,t,i){return!!((!i||i===tt.HTML)&&SP(n,e,t)||(!i||i===tt.MATHML)&&vP(n,e))}});var xv=ue((dj,Cv)=>{"use strict";var I=Ho(),CP=x0(),Z0=I0(),xP=O0(),wP=U0(),ev=kn(),IP=mm(),MP=fm(),tv=gm(),Pn=J0(),nt=Yu(),EP=Qu(),bs=_i(),f=bs.TAG_NAMES,V=bs.NAMESPACES,dv=bs.ATTRS,AP={scriptingEnabled:!0,sourceCodeLocationInfo:!1,onParseError:null,treeAdapter:IP},hv="hidden",RP=8,kP=3,pv="INITIAL_MODE",vm="BEFORE_HTML_MODE",Sl="BEFORE_HEAD_MODE",mr="IN_HEAD_MODE",mv="IN_HEAD_NO_SCRIPT_MODE",Cl="AFTER_HEAD_MODE",_n="IN_BODY_MODE",Tl="TEXT_MODE",lt="IN_TABLE_MODE",fv="IN_TABLE_TEXT_MODE",xl="IN_CAPTION_MODE",Xo="IN_COLUMN_GROUP_MODE",Yt="IN_TABLE_BODY_MODE",ti="IN_ROW_MODE",wl="IN_CELL_MODE",Sm="IN_SELECT_MODE",Cm="IN_SELECT_IN_TABLE_MODE",yl="IN_TEMPLATE_MODE",xm="AFTER_BODY_MODE",Il="IN_FRAMESET_MODE",gv="AFTER_FRAMESET_MODE",Tv="AFTER_AFTER_BODY_MODE",yv="AFTER_AFTER_FRAMESET_MODE",PP={[f.TR]:ti,[f.TBODY]:Yt,[f.THEAD]:Yt,[f.TFOOT]:Yt,[f.CAPTION]:xl,[f.COLGROUP]:Xo,[f.TABLE]:lt,[f.BODY]:_n,[f.FRAMESET]:Il},_P={[f.CAPTION]:lt,[f.COLGROUP]:lt,[f.TBODY]:lt,[f.TFOOT]:lt,[f.THEAD]:lt,[f.COL]:Xo,[f.TR]:Yt,[f.TD]:ti,[f.TH]:ti},nv={[pv]:{[I.CHARACTER_TOKEN]:Wo,[I.NULL_CHARACTER_TOKEN]:Wo,[I.WHITESPACE_CHARACTER_TOKEN]:he,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:qP,[I.START_TAG_TOKEN]:Wo,[I.END_TAG_TOKEN]:Wo,[I.EOF_TOKEN]:Wo},[vm]:{[I.CHARACTER_TOKEN]:Vo,[I.NULL_CHARACTER_TOKEN]:Vo,[I.WHITESPACE_CHARACTER_TOKEN]:he,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:HP,[I.END_TAG_TOKEN]:UP,[I.EOF_TOKEN]:Vo},[Sl]:{[I.CHARACTER_TOKEN]:Go,[I.NULL_CHARACTER_TOKEN]:Go,[I.WHITESPACE_CHARACTER_TOKEN]:he,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:ml,[I.START_TAG_TOKEN]:KP,[I.END_TAG_TOKEN]:WP,[I.EOF_TOKEN]:Go},[mr]:{[I.CHARACTER_TOKEN]:zo,[I.NULL_CHARACTER_TOKEN]:zo,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:ml,[I.START_TAG_TOKEN]:Ye,[I.END_TAG_TOKEN]:vs,[I.EOF_TOKEN]:zo},[mv]:{[I.CHARACTER_TOKEN]:Qo,[I.NULL_CHARACTER_TOKEN]:Qo,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:ml,[I.START_TAG_TOKEN]:jP,[I.END_TAG_TOKEN]:VP,[I.EOF_TOKEN]:Qo},[Cl]:{[I.CHARACTER_TOKEN]:Yo,[I.NULL_CHARACTER_TOKEN]:Yo,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:ml,[I.START_TAG_TOKEN]:GP,[I.END_TAG_TOKEN]:zP,[I.EOF_TOKEN]:Yo},[_n]:{[I.CHARACTER_TOKEN]:fl,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:wt,[I.END_TAG_TOKEN]:wm,[I.EOF_TOKEN]:Zn},[Tl]:{[I.CHARACTER_TOKEN]:xt,[I.NULL_CHARACTER_TOKEN]:xt,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:he,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:he,[I.END_TAG_TOKEN]:I2,[I.EOF_TOKEN]:M2},[lt]:{[I.CHARACTER_TOKEN]:ei,[I.NULL_CHARACTER_TOKEN]:ei,[I.WHITESPACE_CHARACTER_TOKEN]:ei,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:Im,[I.END_TAG_TOKEN]:Mm,[I.EOF_TOKEN]:Zn},[fv]:{[I.CHARACTER_TOKEN]:D2,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:N2,[I.COMMENT_TOKEN]:jo,[I.DOCTYPE_TOKEN]:jo,[I.START_TAG_TOKEN]:jo,[I.END_TAG_TOKEN]:jo,[I.EOF_TOKEN]:jo},[xl]:{[I.CHARACTER_TOKEN]:fl,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:F2,[I.END_TAG_TOKEN]:$2,[I.EOF_TOKEN]:Zn},[Xo]:{[I.CHARACTER_TOKEN]:bl,[I.NULL_CHARACTER_TOKEN]:bl,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:B2,[I.END_TAG_TOKEN]:q2,[I.EOF_TOKEN]:Zn},[Yt]:{[I.CHARACTER_TOKEN]:ei,[I.NULL_CHARACTER_TOKEN]:ei,[I.WHITESPACE_CHARACTER_TOKEN]:ei,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:H2,[I.END_TAG_TOKEN]:U2,[I.EOF_TOKEN]:Zn},[ti]:{[I.CHARACTER_TOKEN]:ei,[I.NULL_CHARACTER_TOKEN]:ei,[I.WHITESPACE_CHARACTER_TOKEN]:ei,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:K2,[I.END_TAG_TOKEN]:W2,[I.EOF_TOKEN]:Zn},[wl]:{[I.CHARACTER_TOKEN]:fl,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:j2,[I.END_TAG_TOKEN]:V2,[I.EOF_TOKEN]:Zn},[Sm]:{[I.CHARACTER_TOKEN]:xt,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:bv,[I.END_TAG_TOKEN]:vv,[I.EOF_TOKEN]:Zn},[Cm]:{[I.CHARACTER_TOKEN]:xt,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:G2,[I.END_TAG_TOKEN]:z2,[I.EOF_TOKEN]:Zn},[yl]:{[I.CHARACTER_TOKEN]:fl,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:Q2,[I.END_TAG_TOKEN]:Y2,[I.EOF_TOKEN]:Sv},[xm]:{[I.CHARACTER_TOKEN]:vl,[I.NULL_CHARACTER_TOKEN]:vl,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:BP,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:X2,[I.END_TAG_TOKEN]:J2,[I.EOF_TOKEN]:Ko},[Il]:{[I.CHARACTER_TOKEN]:he,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:Z2,[I.END_TAG_TOKEN]:e4,[I.EOF_TOKEN]:Ko},[gv]:{[I.CHARACTER_TOKEN]:he,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:xt,[I.COMMENT_TOKEN]:Ge,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:t4,[I.END_TAG_TOKEN]:n4,[I.EOF_TOKEN]:Ko},[Tv]:{[I.CHARACTER_TOKEN]:gl,[I.NULL_CHARACTER_TOKEN]:gl,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:iv,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:i4,[I.END_TAG_TOKEN]:gl,[I.EOF_TOKEN]:Ko},[yv]:{[I.CHARACTER_TOKEN]:he,[I.NULL_CHARACTER_TOKEN]:he,[I.WHITESPACE_CHARACTER_TOKEN]:ys,[I.COMMENT_TOKEN]:iv,[I.DOCTYPE_TOKEN]:he,[I.START_TAG_TOKEN]:s4,[I.END_TAG_TOKEN]:he,[I.EOF_TOKEN]:Ko}},bm=class{constructor(e){this.options=MP(AP,e),this.treeAdapter=this.options.treeAdapter,this.pendingScript=null,this.options.sourceCodeLocationInfo&&ev.install(this,xP),this.options.onParseError&&ev.install(this,wP,{onParseError:this.options.onParseError})}parse(e){let t=this.treeAdapter.createDocument();return this._bootstrap(t,null),this.tokenizer.write(e,!0),this._runParsingLoop(null),t}parseFragment(e,t){t||(t=this.treeAdapter.createElement(f.TEMPLATE,V.HTML,[]));let i=this.treeAdapter.createElement("documentmock",V.HTML,[]);this._bootstrap(i,t),this.treeAdapter.getTagName(t)===f.TEMPLATE&&this._pushTmplInsertionMode(yl),this._initTokenizerForFragmentParsing(),this._insertFakeRootElement(),this._resetInsertionMode(),this._findFormInFragmentContext(),this.tokenizer.write(e,!0),this._runParsingLoop(null);let s=this.treeAdapter.getFirstChild(i),r=this.treeAdapter.createDocumentFragment();return this._adoptNodes(s,r),r}_bootstrap(e,t){this.tokenizer=new I(this.options),this.stopped=!1,this.insertionMode=pv,this.originalInsertionMode="",this.document=e,this.fragmentContext=t,this.headElement=null,this.formElement=null,this.openElements=new CP(this.document,this.treeAdapter),this.activeFormattingElements=new Z0(this.treeAdapter),this.tmplInsertionModeStack=[],this.tmplInsertionModeStackTop=-1,this.currentTmplInsertionMode=null,this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1}_err(){}_runParsingLoop(e){for(;!this.stopped;){this._setupTokenizerCDATAMode();let t=this.tokenizer.getNextToken();if(t.type===I.HIBERNATION_TOKEN)break;if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.type===I.WHITESPACE_CHARACTER_TOKEN&&t.chars[0]===`
|
|
5
5
|
`)){if(t.chars.length===1)continue;t.chars=t.chars.substr(1)}if(this._processInputToken(t),e&&this.pendingScript)break}}runParsingLoopForCurrentChunk(e,t){if(this._runParsingLoop(t),t&&this.pendingScript){let i=this.pendingScript;this.pendingScript=null,t(i);return}e&&e()}_setupTokenizerCDATAMode(){let e=this._getAdjustedCurrentElement();this.tokenizer.allowCDATA=e&&e!==this.document&&this.treeAdapter.getNamespaceURI(e)!==V.HTML&&!this._isIntegrationPoint(e)}_switchToTextParsing(e,t){this._insertElement(e,V.HTML),this.tokenizer.state=t,this.originalInsertionMode=this.insertionMode,this.insertionMode=Tl}switchToPlaintextParsing(){this.insertionMode=Tl,this.originalInsertionMode=_n,this.tokenizer.state=I.MODE.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;do{if(this.treeAdapter.getTagName(e)===f.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}while(e)}_initTokenizerForFragmentParsing(){if(this.treeAdapter.getNamespaceURI(this.fragmentContext)===V.HTML){let e=this.treeAdapter.getTagName(this.fragmentContext);e===f.TITLE||e===f.TEXTAREA?this.tokenizer.state=I.MODE.RCDATA:e===f.STYLE||e===f.XMP||e===f.IFRAME||e===f.NOEMBED||e===f.NOFRAMES||e===f.NOSCRIPT?this.tokenizer.state=I.MODE.RAWTEXT:e===f.SCRIPT?this.tokenizer.state=I.MODE.SCRIPT_DATA:e===f.PLAINTEXT&&(this.tokenizer.state=I.MODE.PLAINTEXT)}}_setDocumentType(e){let t=e.name||"",i=e.publicId||"",s=e.systemId||"";this.treeAdapter.setDocumentType(this.document,t,i,s)}_attachElementToTree(e){if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{let t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.appendChild(t,e)}}_appendElement(e,t){let i=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(i)}_insertElement(e,t){let i=this.treeAdapter.createElement(e.tagName,t,e.attrs);this._attachElementToTree(i),this.openElements.push(i)}_insertFakeElement(e){let t=this.treeAdapter.createElement(e,V.HTML,[]);this._attachElementToTree(t),this.openElements.push(t)}_insertTemplate(e){let t=this.treeAdapter.createElement(e.tagName,V.HTML,e.attrs),i=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(t,i),this._attachElementToTree(t),this.openElements.push(t)}_insertFakeRootElement(){let e=this.treeAdapter.createElement(f.HTML,V.HTML,[]);this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e)}_appendCommentNode(e,t){let i=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(t,i)}_insertCharacters(e){if(this._shouldFosterParentOnInsertion())this._fosterParentText(e.chars);else{let t=this.openElements.currentTmplContent||this.openElements.current;this.treeAdapter.insertText(t,e.chars)}}_adoptNodes(e,t){for(let i=this.treeAdapter.getFirstChild(e);i;i=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(i),this.treeAdapter.appendChild(t,i)}_shouldProcessTokenInForeignContent(e){let t=this._getAdjustedCurrentElement();if(!t||t===this.document)return!1;let i=this.treeAdapter.getNamespaceURI(t);if(i===V.HTML||this.treeAdapter.getTagName(t)===f.ANNOTATION_XML&&i===V.MATHML&&e.type===I.START_TAG_TOKEN&&e.tagName===f.SVG)return!1;let s=e.type===I.CHARACTER_TOKEN||e.type===I.NULL_CHARACTER_TOKEN||e.type===I.WHITESPACE_CHARACTER_TOKEN;return(e.type===I.START_TAG_TOKEN&&e.tagName!==f.MGLYPH&&e.tagName!==f.MALIGNMARK||s)&&this._isIntegrationPoint(t,V.MATHML)||(e.type===I.START_TAG_TOKEN||s)&&this._isIntegrationPoint(t,V.HTML)?!1:e.type!==I.EOF_TOKEN}_processToken(e){nv[this.insertionMode][e.type](this,e)}_processTokenInBodyMode(e){nv[_n][e.type](this,e)}_processTokenInForeignContent(e){e.type===I.CHARACTER_TOKEN?o4(this,e):e.type===I.NULL_CHARACTER_TOKEN?r4(this,e):e.type===I.WHITESPACE_CHARACTER_TOKEN?xt(this,e):e.type===I.COMMENT_TOKEN?Ge(this,e):e.type===I.START_TAG_TOKEN?a4(this,e):e.type===I.END_TAG_TOKEN&&u4(this,e)}_processInputToken(e){this._shouldProcessTokenInForeignContent(e)?this._processTokenInForeignContent(e):this._processToken(e),e.type===I.START_TAG_TOKEN&&e.selfClosing&&!e.ackSelfClosing&&this._err(nt.nonVoidHtmlElementStartTagWithTrailingSolidus)}_isIntegrationPoint(e,t){let i=this.treeAdapter.getTagName(e),s=this.treeAdapter.getNamespaceURI(e),r=this.treeAdapter.getAttrList(e);return Pn.isIntegrationPoint(i,s,r,t)}_reconstructActiveFormattingElements(){let e=this.activeFormattingElements.length;if(e){let t=e,i=null;do if(t--,i=this.activeFormattingElements.entries[t],i.type===Z0.MARKER_ENTRY||this.openElements.contains(i.element)){t++;break}while(t>0);for(let s=t;s<e;s++)i=this.activeFormattingElements.entries[s],this._insertElement(i.token,this.treeAdapter.getNamespaceURI(i.element)),i.element=this.openElements.current}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=ti}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(f.P),this.openElements.popUntilTagNamePopped(f.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop,t=!1;e>=0;e--){let i=this.openElements.items[e];e===0&&(t=!0,this.fragmentContext&&(i=this.fragmentContext));let s=this.treeAdapter.getTagName(i),r=PP[s];if(r){this.insertionMode=r;break}else if(!t&&(s===f.TD||s===f.TH)){this.insertionMode=wl;break}else if(!t&&s===f.HEAD){this.insertionMode=mr;break}else if(s===f.SELECT){this._resetInsertionModeForSelect(e);break}else if(s===f.TEMPLATE){this.insertionMode=this.currentTmplInsertionMode;break}else if(s===f.HTML){this.insertionMode=this.headElement?Cl:Sl;break}else if(t){this.insertionMode=_n;break}}}_resetInsertionModeForSelect(e){if(e>0)for(let t=e-1;t>0;t--){let i=this.openElements.items[t],s=this.treeAdapter.getTagName(i);if(s===f.TEMPLATE)break;if(s===f.TABLE){this.insertionMode=Cm;return}}this.insertionMode=Sm}_pushTmplInsertionMode(e){this.tmplInsertionModeStack.push(e),this.tmplInsertionModeStackTop++,this.currentTmplInsertionMode=e}_popTmplInsertionMode(){this.tmplInsertionModeStack.pop(),this.tmplInsertionModeStackTop--,this.currentTmplInsertionMode=this.tmplInsertionModeStack[this.tmplInsertionModeStackTop]}_isElementCausesFosterParenting(e){let t=this.treeAdapter.getTagName(e);return t===f.TABLE||t===f.TBODY||t===f.TFOOT||t===f.THEAD||t===f.TR}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this._isElementCausesFosterParenting(this.openElements.current)}_findFosterParentingLocation(){let e={parent:null,beforeElement:null};for(let t=this.openElements.stackTop;t>=0;t--){let i=this.openElements.items[t],s=this.treeAdapter.getTagName(i),r=this.treeAdapter.getNamespaceURI(i);if(s===f.TEMPLATE&&r===V.HTML){e.parent=this.treeAdapter.getTemplateContent(i);break}else if(s===f.TABLE){e.parent=this.treeAdapter.getParentNode(i),e.parent?e.beforeElement=i:e.parent=this.openElements.items[t-1];break}}return e.parent||(e.parent=this.openElements.items[0]),e}_fosterParentElement(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertBefore(t.parent,e,t.beforeElement):this.treeAdapter.appendChild(t.parent,e)}_fosterParentText(e){let t=this._findFosterParentingLocation();t.beforeElement?this.treeAdapter.insertTextBefore(t.parent,e,t.beforeElement):this.treeAdapter.insertText(t.parent,e)}_isSpecialElement(e){let t=this.treeAdapter.getTagName(e),i=this.treeAdapter.getNamespaceURI(e);return bs.SPECIAL_ELEMENTS[i][t]}};Cv.exports=bm;function LP(n,e){let t=n.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return t?n.openElements.contains(t.element)?n.openElements.hasInScope(e.tagName)||(t=null):(n.activeFormattingElements.removeEntry(t),t=null):mn(n,e),t}function OP(n,e){let t=null;for(let i=n.openElements.stackTop;i>=0;i--){let s=n.openElements.items[i];if(s===e.element)break;n._isSpecialElement(s)&&(t=s)}return t||(n.openElements.popUntilElementPopped(e.element),n.activeFormattingElements.removeEntry(e)),t}function NP(n,e,t){let i=e,s=n.openElements.getCommonAncestor(e);for(let r=0,o=s;o!==t;r++,o=s){s=n.openElements.getCommonAncestor(o);let a=n.activeFormattingElements.getElementEntry(o),u=a&&r>=kP;!a||u?(u&&n.activeFormattingElements.removeEntry(a),n.openElements.remove(o)):(o=DP(n,a),i===e&&(n.activeFormattingElements.bookmark=a),n.treeAdapter.detachNode(i),n.treeAdapter.appendChild(o,i),i=o)}return i}function DP(n,e){let t=n.treeAdapter.getNamespaceURI(e.element),i=n.treeAdapter.createElement(e.token.tagName,t,e.token.attrs);return n.openElements.replace(e.element,i),e.element=i,i}function FP(n,e,t){if(n._isElementCausesFosterParenting(e))n._fosterParentElement(t);else{let i=n.treeAdapter.getTagName(e),s=n.treeAdapter.getNamespaceURI(e);i===f.TEMPLATE&&s===V.HTML&&(e=n.treeAdapter.getTemplateContent(e)),n.treeAdapter.appendChild(e,t)}}function $P(n,e,t){let i=n.treeAdapter.getNamespaceURI(t.element),s=t.token,r=n.treeAdapter.createElement(s.tagName,i,s.attrs);n._adoptNodes(e,r),n.treeAdapter.appendChild(e,r),n.activeFormattingElements.insertElementAfterBookmark(r,t.token),n.activeFormattingElements.removeEntry(t),n.openElements.remove(t.element),n.openElements.insertAfter(e,r)}function Ni(n,e){let t;for(let i=0;i<RP&&(t=LP(n,e,t),!!t);i++){let s=OP(n,t);if(!s)break;n.activeFormattingElements.bookmark=t;let r=NP(n,s,t.element),o=n.openElements.getCommonAncestor(t.element);n.treeAdapter.detachNode(r),FP(n,o,r),$P(n,s,t)}}function he(){}function ml(n){n._err(nt.misplacedDoctype)}function Ge(n,e){n._appendCommentNode(e,n.openElements.currentTmplContent||n.openElements.current)}function BP(n,e){n._appendCommentNode(e,n.openElements.items[0])}function iv(n,e){n._appendCommentNode(e,n.document)}function xt(n,e){n._insertCharacters(e)}function Ko(n){n.stopped=!0}function qP(n,e){n._setDocumentType(e);let t=e.forceQuirks?bs.DOCUMENT_MODE.QUIRKS:tv.getDocumentMode(e);tv.isConforming(e)||n._err(nt.nonConformingDoctype),n.treeAdapter.setDocumentMode(n.document,t),n.insertionMode=vm}function Wo(n,e){n._err(nt.missingDoctype,{beforeToken:!0}),n.treeAdapter.setDocumentMode(n.document,bs.DOCUMENT_MODE.QUIRKS),n.insertionMode=vm,n._processToken(e)}function HP(n,e){e.tagName===f.HTML?(n._insertElement(e,V.HTML),n.insertionMode=Sl):Vo(n,e)}function UP(n,e){let t=e.tagName;(t===f.HTML||t===f.HEAD||t===f.BODY||t===f.BR)&&Vo(n,e)}function Vo(n,e){n._insertFakeRootElement(),n.insertionMode=Sl,n._processToken(e)}function KP(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.HEAD?(n._insertElement(e,V.HTML),n.headElement=n.openElements.current,n.insertionMode=mr):Go(n,e)}function WP(n,e){let t=e.tagName;t===f.HEAD||t===f.BODY||t===f.HTML||t===f.BR?Go(n,e):n._err(nt.endTagWithoutMatchingOpenElement)}function Go(n,e){n._insertFakeElement(f.HEAD),n.headElement=n.openElements.current,n.insertionMode=mr,n._processToken(e)}function Ye(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.BASE||t===f.BASEFONT||t===f.BGSOUND||t===f.LINK||t===f.META?(n._appendElement(e,V.HTML),e.ackSelfClosing=!0):t===f.TITLE?n._switchToTextParsing(e,I.MODE.RCDATA):t===f.NOSCRIPT?n.options.scriptingEnabled?n._switchToTextParsing(e,I.MODE.RAWTEXT):(n._insertElement(e,V.HTML),n.insertionMode=mv):t===f.NOFRAMES||t===f.STYLE?n._switchToTextParsing(e,I.MODE.RAWTEXT):t===f.SCRIPT?n._switchToTextParsing(e,I.MODE.SCRIPT_DATA):t===f.TEMPLATE?(n._insertTemplate(e,V.HTML),n.activeFormattingElements.insertMarker(),n.framesetOk=!1,n.insertionMode=yl,n._pushTmplInsertionMode(yl)):t===f.HEAD?n._err(nt.misplacedStartTagForHeadElement):zo(n,e)}function vs(n,e){let t=e.tagName;t===f.HEAD?(n.openElements.pop(),n.insertionMode=Cl):t===f.BODY||t===f.BR||t===f.HTML?zo(n,e):t===f.TEMPLATE&&n.openElements.tmplCount>0?(n.openElements.generateImpliedEndTagsThoroughly(),n.openElements.currentTagName!==f.TEMPLATE&&n._err(nt.closingOfElementWithOpenChildElements),n.openElements.popUntilTagNamePopped(f.TEMPLATE),n.activeFormattingElements.clearToLastMarker(),n._popTmplInsertionMode(),n._resetInsertionMode()):n._err(nt.endTagWithoutMatchingOpenElement)}function zo(n,e){n.openElements.pop(),n.insertionMode=Cl,n._processToken(e)}function jP(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.BASEFONT||t===f.BGSOUND||t===f.HEAD||t===f.LINK||t===f.META||t===f.NOFRAMES||t===f.STYLE?Ye(n,e):t===f.NOSCRIPT?n._err(nt.nestedNoscriptInHead):Qo(n,e)}function VP(n,e){let t=e.tagName;t===f.NOSCRIPT?(n.openElements.pop(),n.insertionMode=mr):t===f.BR?Qo(n,e):n._err(nt.endTagWithoutMatchingOpenElement)}function Qo(n,e){let t=e.type===I.EOF_TOKEN?nt.openElementsLeftAfterEof:nt.disallowedContentInNoscriptInHead;n._err(t),n.openElements.pop(),n.insertionMode=mr,n._processToken(e)}function GP(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.BODY?(n._insertElement(e,V.HTML),n.framesetOk=!1,n.insertionMode=_n):t===f.FRAMESET?(n._insertElement(e,V.HTML),n.insertionMode=Il):t===f.BASE||t===f.BASEFONT||t===f.BGSOUND||t===f.LINK||t===f.META||t===f.NOFRAMES||t===f.SCRIPT||t===f.STYLE||t===f.TEMPLATE||t===f.TITLE?(n._err(nt.abandonedHeadElementChild),n.openElements.push(n.headElement),Ye(n,e),n.openElements.remove(n.headElement)):t===f.HEAD?n._err(nt.misplacedStartTagForHeadElement):Yo(n,e)}function zP(n,e){let t=e.tagName;t===f.BODY||t===f.HTML||t===f.BR?Yo(n,e):t===f.TEMPLATE?vs(n,e):n._err(nt.endTagWithoutMatchingOpenElement)}function Yo(n,e){n._insertFakeElement(f.BODY),n.insertionMode=_n,n._processToken(e)}function ys(n,e){n._reconstructActiveFormattingElements(),n._insertCharacters(e)}function fl(n,e){n._reconstructActiveFormattingElements(),n._insertCharacters(e),n.framesetOk=!1}function QP(n,e){n.openElements.tmplCount===0&&n.treeAdapter.adoptAttributes(n.openElements.items[0],e.attrs)}function YP(n,e){let t=n.openElements.tryPeekProperlyNestedBodyElement();t&&n.openElements.tmplCount===0&&(n.framesetOk=!1,n.treeAdapter.adoptAttributes(t,e.attrs))}function XP(n,e){let t=n.openElements.tryPeekProperlyNestedBodyElement();n.framesetOk&&t&&(n.treeAdapter.detachNode(t),n.openElements.popAllUpToHtmlElement(),n._insertElement(e,V.HTML),n.insertionMode=Il)}function Jn(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML)}function JP(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement();let t=n.openElements.currentTagName;(t===f.H1||t===f.H2||t===f.H3||t===f.H4||t===f.H5||t===f.H6)&&n.openElements.pop(),n._insertElement(e,V.HTML)}function sv(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML),n.skipNextNewLine=!0,n.framesetOk=!1}function ZP(n,e){let t=n.openElements.tmplCount>0;(!n.formElement||t)&&(n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML),t||(n.formElement=n.openElements.current))}function e2(n,e){n.framesetOk=!1;let t=e.tagName;for(let i=n.openElements.stackTop;i>=0;i--){let s=n.openElements.items[i],r=n.treeAdapter.getTagName(s),o=null;if(t===f.LI&&r===f.LI?o=f.LI:(t===f.DD||t===f.DT)&&(r===f.DD||r===f.DT)&&(o=r),o){n.openElements.generateImpliedEndTagsWithExclusion(o),n.openElements.popUntilTagNamePopped(o);break}if(r!==f.ADDRESS&&r!==f.DIV&&r!==f.P&&n._isSpecialElement(s))break}n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML)}function t2(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML),n.tokenizer.state=I.MODE.PLAINTEXT}function n2(n,e){n.openElements.hasInScope(f.BUTTON)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(f.BUTTON)),n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML),n.framesetOk=!1}function i2(n,e){let t=n.activeFormattingElements.getElementEntryInScopeWithTagName(f.A);t&&(Ni(n,e),n.openElements.remove(t.element),n.activeFormattingElements.removeEntry(t)),n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML),n.activeFormattingElements.pushElement(n.openElements.current,e)}function hr(n,e){n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML),n.activeFormattingElements.pushElement(n.openElements.current,e)}function s2(n,e){n._reconstructActiveFormattingElements(),n.openElements.hasInScope(f.NOBR)&&(Ni(n,e),n._reconstructActiveFormattingElements()),n._insertElement(e,V.HTML),n.activeFormattingElements.pushElement(n.openElements.current,e)}function rv(n,e){n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML),n.activeFormattingElements.insertMarker(),n.framesetOk=!1}function r2(n,e){n.treeAdapter.getDocumentMode(n.document)!==bs.DOCUMENT_MODE.QUIRKS&&n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML),n.framesetOk=!1,n.insertionMode=lt}function pr(n,e){n._reconstructActiveFormattingElements(),n._appendElement(e,V.HTML),n.framesetOk=!1,e.ackSelfClosing=!0}function o2(n,e){n._reconstructActiveFormattingElements(),n._appendElement(e,V.HTML);let t=I.getTokenAttr(e,dv.TYPE);(!t||t.toLowerCase()!==hv)&&(n.framesetOk=!1),e.ackSelfClosing=!0}function ov(n,e){n._appendElement(e,V.HTML),e.ackSelfClosing=!0}function a2(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._appendElement(e,V.HTML),n.framesetOk=!1,n.ackSelfClosing=!0}function u2(n,e){e.tagName=f.IMG,pr(n,e)}function l2(n,e){n._insertElement(e,V.HTML),n.skipNextNewLine=!0,n.tokenizer.state=I.MODE.RCDATA,n.originalInsertionMode=n.insertionMode,n.framesetOk=!1,n.insertionMode=Tl}function c2(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._reconstructActiveFormattingElements(),n.framesetOk=!1,n._switchToTextParsing(e,I.MODE.RAWTEXT)}function d2(n,e){n.framesetOk=!1,n._switchToTextParsing(e,I.MODE.RAWTEXT)}function av(n,e){n._switchToTextParsing(e,I.MODE.RAWTEXT)}function h2(n,e){n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML),n.framesetOk=!1,n.insertionMode===lt||n.insertionMode===xl||n.insertionMode===Yt||n.insertionMode===ti||n.insertionMode===wl?n.insertionMode=Cm:n.insertionMode=Sm}function uv(n,e){n.openElements.currentTagName===f.OPTION&&n.openElements.pop(),n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML)}function lv(n,e){n.openElements.hasInScope(f.RUBY)&&n.openElements.generateImpliedEndTags(),n._insertElement(e,V.HTML)}function p2(n,e){n.openElements.hasInScope(f.RUBY)&&n.openElements.generateImpliedEndTagsWithExclusion(f.RTC),n._insertElement(e,V.HTML)}function m2(n,e){n.openElements.hasInButtonScope(f.P)&&n._closePElement(),n._insertElement(e,V.HTML)}function f2(n,e){n._reconstructActiveFormattingElements(),Pn.adjustTokenMathMLAttrs(e),Pn.adjustTokenXMLAttrs(e),e.selfClosing?n._appendElement(e,V.MATHML):n._insertElement(e,V.MATHML),e.ackSelfClosing=!0}function g2(n,e){n._reconstructActiveFormattingElements(),Pn.adjustTokenSVGAttrs(e),Pn.adjustTokenXMLAttrs(e),e.selfClosing?n._appendElement(e,V.SVG):n._insertElement(e,V.SVG),e.ackSelfClosing=!0}function zt(n,e){n._reconstructActiveFormattingElements(),n._insertElement(e,V.HTML)}function wt(n,e){let t=e.tagName;switch(t.length){case 1:t===f.I||t===f.S||t===f.B||t===f.U?hr(n,e):t===f.P?Jn(n,e):t===f.A?i2(n,e):zt(n,e);break;case 2:t===f.DL||t===f.OL||t===f.UL?Jn(n,e):t===f.H1||t===f.H2||t===f.H3||t===f.H4||t===f.H5||t===f.H6?JP(n,e):t===f.LI||t===f.DD||t===f.DT?e2(n,e):t===f.EM||t===f.TT?hr(n,e):t===f.BR?pr(n,e):t===f.HR?a2(n,e):t===f.RB?lv(n,e):t===f.RT||t===f.RP?p2(n,e):t!==f.TH&&t!==f.TD&&t!==f.TR&&zt(n,e);break;case 3:t===f.DIV||t===f.DIR||t===f.NAV?Jn(n,e):t===f.PRE?sv(n,e):t===f.BIG?hr(n,e):t===f.IMG||t===f.WBR?pr(n,e):t===f.XMP?c2(n,e):t===f.SVG?g2(n,e):t===f.RTC?lv(n,e):t!==f.COL&&zt(n,e);break;case 4:t===f.HTML?QP(n,e):t===f.BASE||t===f.LINK||t===f.META?Ye(n,e):t===f.BODY?YP(n,e):t===f.MAIN||t===f.MENU?Jn(n,e):t===f.FORM?ZP(n,e):t===f.CODE||t===f.FONT?hr(n,e):t===f.NOBR?s2(n,e):t===f.AREA?pr(n,e):t===f.MATH?f2(n,e):t===f.MENU?m2(n,e):t!==f.HEAD&&zt(n,e);break;case 5:t===f.STYLE||t===f.TITLE?Ye(n,e):t===f.ASIDE?Jn(n,e):t===f.SMALL?hr(n,e):t===f.TABLE?r2(n,e):t===f.EMBED?pr(n,e):t===f.INPUT?o2(n,e):t===f.PARAM||t===f.TRACK?ov(n,e):t===f.IMAGE?u2(n,e):t!==f.FRAME&&t!==f.TBODY&&t!==f.TFOOT&&t!==f.THEAD&&zt(n,e);break;case 6:t===f.SCRIPT?Ye(n,e):t===f.CENTER||t===f.FIGURE||t===f.FOOTER||t===f.HEADER||t===f.HGROUP||t===f.DIALOG?Jn(n,e):t===f.BUTTON?n2(n,e):t===f.STRIKE||t===f.STRONG?hr(n,e):t===f.APPLET||t===f.OBJECT?rv(n,e):t===f.KEYGEN?pr(n,e):t===f.SOURCE?ov(n,e):t===f.IFRAME?d2(n,e):t===f.SELECT?h2(n,e):t===f.OPTION?uv(n,e):zt(n,e);break;case 7:t===f.BGSOUND?Ye(n,e):t===f.DETAILS||t===f.ADDRESS||t===f.ARTICLE||t===f.SECTION||t===f.SUMMARY?Jn(n,e):t===f.LISTING?sv(n,e):t===f.MARQUEE?rv(n,e):t===f.NOEMBED?av(n,e):t!==f.CAPTION&&zt(n,e);break;case 8:t===f.BASEFONT?Ye(n,e):t===f.FRAMESET?XP(n,e):t===f.FIELDSET?Jn(n,e):t===f.TEXTAREA?l2(n,e):t===f.TEMPLATE?Ye(n,e):t===f.NOSCRIPT?n.options.scriptingEnabled?av(n,e):zt(n,e):t===f.OPTGROUP?uv(n,e):t!==f.COLGROUP&&zt(n,e);break;case 9:t===f.PLAINTEXT?t2(n,e):zt(n,e);break;case 10:t===f.BLOCKQUOTE||t===f.FIGCAPTION?Jn(n,e):zt(n,e);break;default:zt(n,e)}}function T2(n){n.openElements.hasInScope(f.BODY)&&(n.insertionMode=xm)}function y2(n,e){n.openElements.hasInScope(f.BODY)&&(n.insertionMode=xm,n._processToken(e))}function Oi(n,e){let t=e.tagName;n.openElements.hasInScope(t)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(t))}function b2(n){let e=n.openElements.tmplCount>0,t=n.formElement;e||(n.formElement=null),(t||e)&&n.openElements.hasInScope(f.FORM)&&(n.openElements.generateImpliedEndTags(),e?n.openElements.popUntilTagNamePopped(f.FORM):n.openElements.remove(t))}function v2(n){n.openElements.hasInButtonScope(f.P)||n._insertFakeElement(f.P),n._closePElement()}function S2(n){n.openElements.hasInListItemScope(f.LI)&&(n.openElements.generateImpliedEndTagsWithExclusion(f.LI),n.openElements.popUntilTagNamePopped(f.LI))}function C2(n,e){let t=e.tagName;n.openElements.hasInScope(t)&&(n.openElements.generateImpliedEndTagsWithExclusion(t),n.openElements.popUntilTagNamePopped(t))}function x2(n){n.openElements.hasNumberedHeaderInScope()&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilNumberedHeaderPopped())}function cv(n,e){let t=e.tagName;n.openElements.hasInScope(t)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(t),n.activeFormattingElements.clearToLastMarker())}function w2(n){n._reconstructActiveFormattingElements(),n._insertFakeElement(f.BR),n.openElements.pop(),n.framesetOk=!1}function mn(n,e){let t=e.tagName;for(let i=n.openElements.stackTop;i>0;i--){let s=n.openElements.items[i];if(n.treeAdapter.getTagName(s)===t){n.openElements.generateImpliedEndTagsWithExclusion(t),n.openElements.popUntilElementPopped(s);break}if(n._isSpecialElement(s))break}}function wm(n,e){let t=e.tagName;switch(t.length){case 1:t===f.A||t===f.B||t===f.I||t===f.S||t===f.U?Ni(n,e):t===f.P?v2(n,e):mn(n,e);break;case 2:t===f.DL||t===f.UL||t===f.OL?Oi(n,e):t===f.LI?S2(n,e):t===f.DD||t===f.DT?C2(n,e):t===f.H1||t===f.H2||t===f.H3||t===f.H4||t===f.H5||t===f.H6?x2(n,e):t===f.BR?w2(n,e):t===f.EM||t===f.TT?Ni(n,e):mn(n,e);break;case 3:t===f.BIG?Ni(n,e):t===f.DIR||t===f.DIV||t===f.NAV||t===f.PRE?Oi(n,e):mn(n,e);break;case 4:t===f.BODY?T2(n,e):t===f.HTML?y2(n,e):t===f.FORM?b2(n,e):t===f.CODE||t===f.FONT||t===f.NOBR?Ni(n,e):t===f.MAIN||t===f.MENU?Oi(n,e):mn(n,e);break;case 5:t===f.ASIDE?Oi(n,e):t===f.SMALL?Ni(n,e):mn(n,e);break;case 6:t===f.CENTER||t===f.FIGURE||t===f.FOOTER||t===f.HEADER||t===f.HGROUP||t===f.DIALOG?Oi(n,e):t===f.APPLET||t===f.OBJECT?cv(n,e):t===f.STRIKE||t===f.STRONG?Ni(n,e):mn(n,e);break;case 7:t===f.ADDRESS||t===f.ARTICLE||t===f.DETAILS||t===f.SECTION||t===f.SUMMARY||t===f.LISTING?Oi(n,e):t===f.MARQUEE?cv(n,e):mn(n,e);break;case 8:t===f.FIELDSET?Oi(n,e):t===f.TEMPLATE?vs(n,e):mn(n,e);break;case 10:t===f.BLOCKQUOTE||t===f.FIGCAPTION?Oi(n,e):mn(n,e);break;default:mn(n,e)}}function Zn(n,e){n.tmplInsertionModeStackTop>-1?Sv(n,e):n.stopped=!0}function I2(n,e){e.tagName===f.SCRIPT&&(n.pendingScript=n.openElements.current),n.openElements.pop(),n.insertionMode=n.originalInsertionMode}function M2(n,e){n._err(nt.eofInElementThatCanContainOnlyText),n.openElements.pop(),n.insertionMode=n.originalInsertionMode,n._processToken(e)}function ei(n,e){let t=n.openElements.currentTagName;t===f.TABLE||t===f.TBODY||t===f.TFOOT||t===f.THEAD||t===f.TR?(n.pendingCharacterTokens=[],n.hasNonWhitespacePendingCharacterToken=!1,n.originalInsertionMode=n.insertionMode,n.insertionMode=fv,n._processToken(e)):Qt(n,e)}function E2(n,e){n.openElements.clearBackToTableContext(),n.activeFormattingElements.insertMarker(),n._insertElement(e,V.HTML),n.insertionMode=xl}function A2(n,e){n.openElements.clearBackToTableContext(),n._insertElement(e,V.HTML),n.insertionMode=Xo}function R2(n,e){n.openElements.clearBackToTableContext(),n._insertFakeElement(f.COLGROUP),n.insertionMode=Xo,n._processToken(e)}function k2(n,e){n.openElements.clearBackToTableContext(),n._insertElement(e,V.HTML),n.insertionMode=Yt}function P2(n,e){n.openElements.clearBackToTableContext(),n._insertFakeElement(f.TBODY),n.insertionMode=Yt,n._processToken(e)}function _2(n,e){n.openElements.hasInTableScope(f.TABLE)&&(n.openElements.popUntilTagNamePopped(f.TABLE),n._resetInsertionMode(),n._processToken(e))}function L2(n,e){let t=I.getTokenAttr(e,dv.TYPE);t&&t.toLowerCase()===hv?n._appendElement(e,V.HTML):Qt(n,e),e.ackSelfClosing=!0}function O2(n,e){!n.formElement&&n.openElements.tmplCount===0&&(n._insertElement(e,V.HTML),n.formElement=n.openElements.current,n.openElements.pop())}function Im(n,e){let t=e.tagName;switch(t.length){case 2:t===f.TD||t===f.TH||t===f.TR?P2(n,e):Qt(n,e);break;case 3:t===f.COL?R2(n,e):Qt(n,e);break;case 4:t===f.FORM?O2(n,e):Qt(n,e);break;case 5:t===f.TABLE?_2(n,e):t===f.STYLE?Ye(n,e):t===f.TBODY||t===f.TFOOT||t===f.THEAD?k2(n,e):t===f.INPUT?L2(n,e):Qt(n,e);break;case 6:t===f.SCRIPT?Ye(n,e):Qt(n,e);break;case 7:t===f.CAPTION?E2(n,e):Qt(n,e);break;case 8:t===f.COLGROUP?A2(n,e):t===f.TEMPLATE?Ye(n,e):Qt(n,e);break;default:Qt(n,e)}}function Mm(n,e){let t=e.tagName;t===f.TABLE?n.openElements.hasInTableScope(f.TABLE)&&(n.openElements.popUntilTagNamePopped(f.TABLE),n._resetInsertionMode()):t===f.TEMPLATE?vs(n,e):t!==f.BODY&&t!==f.CAPTION&&t!==f.COL&&t!==f.COLGROUP&&t!==f.HTML&&t!==f.TBODY&&t!==f.TD&&t!==f.TFOOT&&t!==f.TH&&t!==f.THEAD&&t!==f.TR&&Qt(n,e)}function Qt(n,e){let t=n.fosterParentingEnabled;n.fosterParentingEnabled=!0,n._processTokenInBodyMode(e),n.fosterParentingEnabled=t}function N2(n,e){n.pendingCharacterTokens.push(e)}function D2(n,e){n.pendingCharacterTokens.push(e),n.hasNonWhitespacePendingCharacterToken=!0}function jo(n,e){let t=0;if(n.hasNonWhitespacePendingCharacterToken)for(;t<n.pendingCharacterTokens.length;t++)Qt(n,n.pendingCharacterTokens[t]);else for(;t<n.pendingCharacterTokens.length;t++)n._insertCharacters(n.pendingCharacterTokens[t]);n.insertionMode=n.originalInsertionMode,n._processToken(e)}function F2(n,e){let t=e.tagName;t===f.CAPTION||t===f.COL||t===f.COLGROUP||t===f.TBODY||t===f.TD||t===f.TFOOT||t===f.TH||t===f.THEAD||t===f.TR?n.openElements.hasInTableScope(f.CAPTION)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(f.CAPTION),n.activeFormattingElements.clearToLastMarker(),n.insertionMode=lt,n._processToken(e)):wt(n,e)}function $2(n,e){let t=e.tagName;t===f.CAPTION||t===f.TABLE?n.openElements.hasInTableScope(f.CAPTION)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(f.CAPTION),n.activeFormattingElements.clearToLastMarker(),n.insertionMode=lt,t===f.TABLE&&n._processToken(e)):t!==f.BODY&&t!==f.COL&&t!==f.COLGROUP&&t!==f.HTML&&t!==f.TBODY&&t!==f.TD&&t!==f.TFOOT&&t!==f.TH&&t!==f.THEAD&&t!==f.TR&&wm(n,e)}function B2(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.COL?(n._appendElement(e,V.HTML),e.ackSelfClosing=!0):t===f.TEMPLATE?Ye(n,e):bl(n,e)}function q2(n,e){let t=e.tagName;t===f.COLGROUP?n.openElements.currentTagName===f.COLGROUP&&(n.openElements.pop(),n.insertionMode=lt):t===f.TEMPLATE?vs(n,e):t!==f.COL&&bl(n,e)}function bl(n,e){n.openElements.currentTagName===f.COLGROUP&&(n.openElements.pop(),n.insertionMode=lt,n._processToken(e))}function H2(n,e){let t=e.tagName;t===f.TR?(n.openElements.clearBackToTableBodyContext(),n._insertElement(e,V.HTML),n.insertionMode=ti):t===f.TH||t===f.TD?(n.openElements.clearBackToTableBodyContext(),n._insertFakeElement(f.TR),n.insertionMode=ti,n._processToken(e)):t===f.CAPTION||t===f.COL||t===f.COLGROUP||t===f.TBODY||t===f.TFOOT||t===f.THEAD?n.openElements.hasTableBodyContextInTableScope()&&(n.openElements.clearBackToTableBodyContext(),n.openElements.pop(),n.insertionMode=lt,n._processToken(e)):Im(n,e)}function U2(n,e){let t=e.tagName;t===f.TBODY||t===f.TFOOT||t===f.THEAD?n.openElements.hasInTableScope(t)&&(n.openElements.clearBackToTableBodyContext(),n.openElements.pop(),n.insertionMode=lt):t===f.TABLE?n.openElements.hasTableBodyContextInTableScope()&&(n.openElements.clearBackToTableBodyContext(),n.openElements.pop(),n.insertionMode=lt,n._processToken(e)):(t!==f.BODY&&t!==f.CAPTION&&t!==f.COL&&t!==f.COLGROUP||t!==f.HTML&&t!==f.TD&&t!==f.TH&&t!==f.TR)&&Mm(n,e)}function K2(n,e){let t=e.tagName;t===f.TH||t===f.TD?(n.openElements.clearBackToTableRowContext(),n._insertElement(e,V.HTML),n.insertionMode=wl,n.activeFormattingElements.insertMarker()):t===f.CAPTION||t===f.COL||t===f.COLGROUP||t===f.TBODY||t===f.TFOOT||t===f.THEAD||t===f.TR?n.openElements.hasInTableScope(f.TR)&&(n.openElements.clearBackToTableRowContext(),n.openElements.pop(),n.insertionMode=Yt,n._processToken(e)):Im(n,e)}function W2(n,e){let t=e.tagName;t===f.TR?n.openElements.hasInTableScope(f.TR)&&(n.openElements.clearBackToTableRowContext(),n.openElements.pop(),n.insertionMode=Yt):t===f.TABLE?n.openElements.hasInTableScope(f.TR)&&(n.openElements.clearBackToTableRowContext(),n.openElements.pop(),n.insertionMode=Yt,n._processToken(e)):t===f.TBODY||t===f.TFOOT||t===f.THEAD?(n.openElements.hasInTableScope(t)||n.openElements.hasInTableScope(f.TR))&&(n.openElements.clearBackToTableRowContext(),n.openElements.pop(),n.insertionMode=Yt,n._processToken(e)):(t!==f.BODY&&t!==f.CAPTION&&t!==f.COL&&t!==f.COLGROUP||t!==f.HTML&&t!==f.TD&&t!==f.TH)&&Mm(n,e)}function j2(n,e){let t=e.tagName;t===f.CAPTION||t===f.COL||t===f.COLGROUP||t===f.TBODY||t===f.TD||t===f.TFOOT||t===f.TH||t===f.THEAD||t===f.TR?(n.openElements.hasInTableScope(f.TD)||n.openElements.hasInTableScope(f.TH))&&(n._closeTableCell(),n._processToken(e)):wt(n,e)}function V2(n,e){let t=e.tagName;t===f.TD||t===f.TH?n.openElements.hasInTableScope(t)&&(n.openElements.generateImpliedEndTags(),n.openElements.popUntilTagNamePopped(t),n.activeFormattingElements.clearToLastMarker(),n.insertionMode=ti):t===f.TABLE||t===f.TBODY||t===f.TFOOT||t===f.THEAD||t===f.TR?n.openElements.hasInTableScope(t)&&(n._closeTableCell(),n._processToken(e)):t!==f.BODY&&t!==f.CAPTION&&t!==f.COL&&t!==f.COLGROUP&&t!==f.HTML&&wm(n,e)}function bv(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.OPTION?(n.openElements.currentTagName===f.OPTION&&n.openElements.pop(),n._insertElement(e,V.HTML)):t===f.OPTGROUP?(n.openElements.currentTagName===f.OPTION&&n.openElements.pop(),n.openElements.currentTagName===f.OPTGROUP&&n.openElements.pop(),n._insertElement(e,V.HTML)):t===f.INPUT||t===f.KEYGEN||t===f.TEXTAREA||t===f.SELECT?n.openElements.hasInSelectScope(f.SELECT)&&(n.openElements.popUntilTagNamePopped(f.SELECT),n._resetInsertionMode(),t!==f.SELECT&&n._processToken(e)):(t===f.SCRIPT||t===f.TEMPLATE)&&Ye(n,e)}function vv(n,e){let t=e.tagName;if(t===f.OPTGROUP){let i=n.openElements.items[n.openElements.stackTop-1],s=i&&n.treeAdapter.getTagName(i);n.openElements.currentTagName===f.OPTION&&s===f.OPTGROUP&&n.openElements.pop(),n.openElements.currentTagName===f.OPTGROUP&&n.openElements.pop()}else t===f.OPTION?n.openElements.currentTagName===f.OPTION&&n.openElements.pop():t===f.SELECT&&n.openElements.hasInSelectScope(f.SELECT)?(n.openElements.popUntilTagNamePopped(f.SELECT),n._resetInsertionMode()):t===f.TEMPLATE&&vs(n,e)}function G2(n,e){let t=e.tagName;t===f.CAPTION||t===f.TABLE||t===f.TBODY||t===f.TFOOT||t===f.THEAD||t===f.TR||t===f.TD||t===f.TH?(n.openElements.popUntilTagNamePopped(f.SELECT),n._resetInsertionMode(),n._processToken(e)):bv(n,e)}function z2(n,e){let t=e.tagName;t===f.CAPTION||t===f.TABLE||t===f.TBODY||t===f.TFOOT||t===f.THEAD||t===f.TR||t===f.TD||t===f.TH?n.openElements.hasInTableScope(t)&&(n.openElements.popUntilTagNamePopped(f.SELECT),n._resetInsertionMode(),n._processToken(e)):vv(n,e)}function Q2(n,e){let t=e.tagName;if(t===f.BASE||t===f.BASEFONT||t===f.BGSOUND||t===f.LINK||t===f.META||t===f.NOFRAMES||t===f.SCRIPT||t===f.STYLE||t===f.TEMPLATE||t===f.TITLE)Ye(n,e);else{let i=_P[t]||_n;n._popTmplInsertionMode(),n._pushTmplInsertionMode(i),n.insertionMode=i,n._processToken(e)}}function Y2(n,e){e.tagName===f.TEMPLATE&&vs(n,e)}function Sv(n,e){n.openElements.tmplCount>0?(n.openElements.popUntilTagNamePopped(f.TEMPLATE),n.activeFormattingElements.clearToLastMarker(),n._popTmplInsertionMode(),n._resetInsertionMode(),n._processToken(e)):n.stopped=!0}function X2(n,e){e.tagName===f.HTML?wt(n,e):vl(n,e)}function J2(n,e){e.tagName===f.HTML?n.fragmentContext||(n.insertionMode=Tv):vl(n,e)}function vl(n,e){n.insertionMode=_n,n._processToken(e)}function Z2(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.FRAMESET?n._insertElement(e,V.HTML):t===f.FRAME?(n._appendElement(e,V.HTML),e.ackSelfClosing=!0):t===f.NOFRAMES&&Ye(n,e)}function e4(n,e){e.tagName===f.FRAMESET&&!n.openElements.isRootHtmlElementCurrent()&&(n.openElements.pop(),!n.fragmentContext&&n.openElements.currentTagName!==f.FRAMESET&&(n.insertionMode=gv))}function t4(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.NOFRAMES&&Ye(n,e)}function n4(n,e){e.tagName===f.HTML&&(n.insertionMode=yv)}function i4(n,e){e.tagName===f.HTML?wt(n,e):gl(n,e)}function gl(n,e){n.insertionMode=_n,n._processToken(e)}function s4(n,e){let t=e.tagName;t===f.HTML?wt(n,e):t===f.NOFRAMES&&Ye(n,e)}function r4(n,e){e.chars=EP.REPLACEMENT_CHARACTER,n._insertCharacters(e)}function o4(n,e){n._insertCharacters(e),n.framesetOk=!1}function a4(n,e){if(Pn.causesExit(e)&&!n.fragmentContext){for(;n.treeAdapter.getNamespaceURI(n.openElements.current)!==V.HTML&&!n._isIntegrationPoint(n.openElements.current);)n.openElements.pop();n._processToken(e)}else{let t=n._getAdjustedCurrentElement(),i=n.treeAdapter.getNamespaceURI(t);i===V.MATHML?Pn.adjustTokenMathMLAttrs(e):i===V.SVG&&(Pn.adjustTokenSVGTagName(e),Pn.adjustTokenSVGAttrs(e)),Pn.adjustTokenXMLAttrs(e),e.selfClosing?n._appendElement(e,i):n._insertElement(e,i),e.ackSelfClosing=!0}}function u4(n,e){for(let t=n.openElements.stackTop;t>0;t--){let i=n.openElements.items[t];if(n.treeAdapter.getNamespaceURI(i)===V.HTML){n._processToken(e);break}if(n.treeAdapter.getTagName(i).toLowerCase()===e.tagName){n.openElements.popUntilElementPopped(i);break}}}});var Mv=ue((hj,Iv)=>{"use strict";var l4=mm(),c4=fm(),d4=gm(),wv=_i(),Ae=wv.TAG_NAMES,Ml=wv.NAMESPACES,h4={treeAdapter:l4},p4=/&/g,m4=/\u00a0/g,f4=/"/g,g4=/</g,T4=/>/g,El=class n{constructor(e,t){this.options=c4(h4,t),this.treeAdapter=this.options.treeAdapter,this.html="",this.startNode=e}serialize(){return this._serializeChildNodes(this.startNode),this.html}_serializeChildNodes(e){let t=this.treeAdapter.getChildNodes(e);if(t)for(let i=0,s=t.length;i<s;i++){let r=t[i];this.treeAdapter.isElementNode(r)?this._serializeElement(r):this.treeAdapter.isTextNode(r)?this._serializeTextNode(r):this.treeAdapter.isCommentNode(r)?this._serializeCommentNode(r):this.treeAdapter.isDocumentTypeNode(r)&&this._serializeDocumentTypeNode(r)}}_serializeElement(e){let t=this.treeAdapter.getTagName(e),i=this.treeAdapter.getNamespaceURI(e);if(this.html+="<"+t,this._serializeAttributes(e),this.html+=">",t!==Ae.AREA&&t!==Ae.BASE&&t!==Ae.BASEFONT&&t!==Ae.BGSOUND&&t!==Ae.BR&&t!==Ae.COL&&t!==Ae.EMBED&&t!==Ae.FRAME&&t!==Ae.HR&&t!==Ae.IMG&&t!==Ae.INPUT&&t!==Ae.KEYGEN&&t!==Ae.LINK&&t!==Ae.META&&t!==Ae.PARAM&&t!==Ae.SOURCE&&t!==Ae.TRACK&&t!==Ae.WBR){let s=t===Ae.TEMPLATE&&i===Ml.HTML?this.treeAdapter.getTemplateContent(e):e;this._serializeChildNodes(s),this.html+="</"+t+">"}}_serializeAttributes(e){let t=this.treeAdapter.getAttrList(e);for(let i=0,s=t.length;i<s;i++){let r=t[i],o=n.escapeString(r.value,!0);this.html+=" ",r.namespace?r.namespace===Ml.XML?this.html+="xml:"+r.name:r.namespace===Ml.XMLNS?(r.name!=="xmlns"&&(this.html+="xmlns:"),this.html+=r.name):r.namespace===Ml.XLINK?this.html+="xlink:"+r.name:this.html+=r.prefix+":"+r.name:this.html+=r.name,this.html+='="'+o+'"'}}_serializeTextNode(e){let t=this.treeAdapter.getTextNodeContent(e),i=this.treeAdapter.getParentNode(e),s;i&&this.treeAdapter.isElementNode(i)&&(s=this.treeAdapter.getTagName(i)),s===Ae.STYLE||s===Ae.SCRIPT||s===Ae.XMP||s===Ae.IFRAME||s===Ae.NOEMBED||s===Ae.NOFRAMES||s===Ae.PLAINTEXT||s===Ae.NOSCRIPT?this.html+=t:this.html+=n.escapeString(t,!1)}_serializeCommentNode(e){this.html+="<!--"+this.treeAdapter.getCommentNodeContent(e)+"-->"}_serializeDocumentTypeNode(e){let t=this.treeAdapter.getDocumentTypeNodeName(e);this.html+="<"+d4.serializeContent(t,null,null)+">"}};El.escapeString=function(n,e){return n=n.replace(p4,"&").replace(m4," "),e?n=n.replace(f4,"""):n=n.replace(g4,"<").replace(T4,">"),n};Iv.exports=El});var Av=ue(Al=>{"use strict";var Ev=xv(),y4=Mv();Al.parse=function(e,t){return new Ev(t).parse(e)};Al.parseFragment=function(e,t,i){return typeof e=="string"&&(i=t,t=e,e=null),new Ev(i).parseFragment(t,e)};Al.serialize=function(n,e){return new y4(n,e).serialize()}});var Am=ue(fr=>{"use strict";var Em=fr.NAMESPACES={HTML:"http://www.w3.org/1999/xhtml",MATHML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg",XLINK:"http://www.w3.org/1999/xlink",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"};fr.ATTRS={TYPE:"type",ACTION:"action",ENCODING:"encoding",PROMPT:"prompt",NAME:"name",COLOR:"color",FACE:"face",SIZE:"size"};fr.DOCUMENT_MODE={NO_QUIRKS:"no-quirks",QUIRKS:"quirks",LIMITED_QUIRKS:"limited-quirks"};var H=fr.TAG_NAMES={A:"a",ADDRESS:"address",ANNOTATION_XML:"annotation-xml",APPLET:"applet",AREA:"area",ARTICLE:"article",ASIDE:"aside",B:"b",BASE:"base",BASEFONT:"basefont",BGSOUND:"bgsound",BIG:"big",BLOCKQUOTE:"blockquote",BODY:"body",BR:"br",BUTTON:"button",CAPTION:"caption",CENTER:"center",CODE:"code",COL:"col",COLGROUP:"colgroup",DD:"dd",DESC:"desc",DETAILS:"details",DIALOG:"dialog",DIR:"dir",DIV:"div",DL:"dl",DT:"dt",EM:"em",EMBED:"embed",FIELDSET:"fieldset",FIGCAPTION:"figcaption",FIGURE:"figure",FONT:"font",FOOTER:"footer",FOREIGN_OBJECT:"foreignObject",FORM:"form",FRAME:"frame",FRAMESET:"frameset",H1:"h1",H2:"h2",H3:"h3",H4:"h4",H5:"h5",H6:"h6",HEAD:"head",HEADER:"header",HGROUP:"hgroup",HR:"hr",HTML:"html",I:"i",IMG:"img",IMAGE:"image",INPUT:"input",IFRAME:"iframe",KEYGEN:"keygen",LABEL:"label",LI:"li",LINK:"link",LISTING:"listing",MAIN:"main",MALIGNMARK:"malignmark",MARQUEE:"marquee",MATH:"math",MENU:"menu",META:"meta",MGLYPH:"mglyph",MI:"mi",MO:"mo",MN:"mn",MS:"ms",MTEXT:"mtext",NAV:"nav",NOBR:"nobr",NOFRAMES:"noframes",NOEMBED:"noembed",NOSCRIPT:"noscript",OBJECT:"object",OL:"ol",OPTGROUP:"optgroup",OPTION:"option",P:"p",PARAM:"param",PLAINTEXT:"plaintext",PRE:"pre",RB:"rb",RP:"rp",RT:"rt",RTC:"rtc",RUBY:"ruby",S:"s",SCRIPT:"script",SECTION:"section",SELECT:"select",SOURCE:"source",SMALL:"small",SPAN:"span",STRIKE:"strike",STRONG:"strong",STYLE:"style",SUB:"sub",SUMMARY:"summary",SUP:"sup",TABLE:"table",TBODY:"tbody",TEMPLATE:"template",TEXTAREA:"textarea",TFOOT:"tfoot",TD:"td",TH:"th",THEAD:"thead",TITLE:"title",TR:"tr",TRACK:"track",TT:"tt",U:"u",UL:"ul",SVG:"svg",VAR:"var",WBR:"wbr",XMP:"xmp"};fr.SPECIAL_ELEMENTS={[Em.HTML]:{[H.ADDRESS]:!0,[H.APPLET]:!0,[H.AREA]:!0,[H.ARTICLE]:!0,[H.ASIDE]:!0,[H.BASE]:!0,[H.BASEFONT]:!0,[H.BGSOUND]:!0,[H.BLOCKQUOTE]:!0,[H.BODY]:!0,[H.BR]:!0,[H.BUTTON]:!0,[H.CAPTION]:!0,[H.CENTER]:!0,[H.COL]:!0,[H.COLGROUP]:!0,[H.DD]:!0,[H.DETAILS]:!0,[H.DIR]:!0,[H.DIV]:!0,[H.DL]:!0,[H.DT]:!0,[H.EMBED]:!0,[H.FIELDSET]:!0,[H.FIGCAPTION]:!0,[H.FIGURE]:!0,[H.FOOTER]:!0,[H.FORM]:!0,[H.FRAME]:!0,[H.FRAMESET]:!0,[H.H1]:!0,[H.H2]:!0,[H.H3]:!0,[H.H4]:!0,[H.H5]:!0,[H.H6]:!0,[H.HEAD]:!0,[H.HEADER]:!0,[H.HGROUP]:!0,[H.HR]:!0,[H.HTML]:!0,[H.IFRAME]:!0,[H.IMG]:!0,[H.INPUT]:!0,[H.LI]:!0,[H.LINK]:!0,[H.LISTING]:!0,[H.MAIN]:!0,[H.MARQUEE]:!0,[H.MENU]:!0,[H.META]:!0,[H.NAV]:!0,[H.NOEMBED]:!0,[H.NOFRAMES]:!0,[H.NOSCRIPT]:!0,[H.OBJECT]:!0,[H.OL]:!0,[H.P]:!0,[H.PARAM]:!0,[H.PLAINTEXT]:!0,[H.PRE]:!0,[H.SCRIPT]:!0,[H.SECTION]:!0,[H.SELECT]:!0,[H.SOURCE]:!0,[H.STYLE]:!0,[H.SUMMARY]:!0,[H.TABLE]:!0,[H.TBODY]:!0,[H.TD]:!0,[H.TEMPLATE]:!0,[H.TEXTAREA]:!0,[H.TFOOT]:!0,[H.TH]:!0,[H.THEAD]:!0,[H.TITLE]:!0,[H.TR]:!0,[H.TRACK]:!0,[H.UL]:!0,[H.WBR]:!0,[H.XMP]:!0},[Em.MATHML]:{[H.MI]:!0,[H.MO]:!0,[H.MN]:!0,[H.MS]:!0,[H.MTEXT]:!0,[H.ANNOTATION_XML]:!0},[Em.SVG]:{[H.TITLE]:!0,[H.FOREIGN_OBJECT]:!0,[H.DESC]:!0}}});var Ov=ue(Rl=>{"use strict";var{DOCUMENT_MODE:gr}=Am(),Pv="html",b4="about:legacy-compat",v4="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",_v=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],S4=_v.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]),C4=["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"],Lv=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],x4=Lv.concat(["-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"]);function Rv(n){let e=n.indexOf('"')!==-1?"'":'"';return e+n+e}function kv(n,e){for(let t=0;t<e.length;t++)if(n.indexOf(e[t])===0)return!0;return!1}Rl.isConforming=function(n){return n.name===Pv&&n.publicId===null&&(n.systemId===null||n.systemId===b4)};Rl.getDocumentMode=function(n){if(n.name!==Pv)return gr.QUIRKS;let e=n.systemId;if(e&&e.toLowerCase()===v4)return gr.QUIRKS;let t=n.publicId;if(t!==null){if(t=t.toLowerCase(),C4.indexOf(t)>-1)return gr.QUIRKS;let i=e===null?S4:_v;if(kv(t,i))return gr.QUIRKS;if(i=e===null?Lv:x4,kv(t,i))return gr.LIMITED_QUIRKS}return gr.NO_QUIRKS};Rl.serializeContent=function(n,e,t){let i="!DOCTYPE ";return n&&(i+=n),e?i+=" PUBLIC "+Rv(e):t&&(i+=" SYSTEM"),t!==null&&(i+=" "+Rv(t)),i}});var $v=ue(fe=>{"use strict";var w4=Ov(),{DOCUMENT_MODE:I4}=Am(),Nv={element:1,text:3,cdata:4,comment:8},Dv={tagName:"name",childNodes:"children",parentNode:"parent",previousSibling:"prev",nextSibling:"next",nodeValue:"data"},ni=class{constructor(e){for(let t of Object.keys(e))this[t]=e[t]}get firstChild(){let e=this.children;return e&&e[0]||null}get lastChild(){let e=this.children;return e&&e[e.length-1]||null}get nodeType(){return Nv[this.type]||Nv.element}};Object.keys(Dv).forEach(n=>{let e=Dv[n];Object.defineProperty(ni.prototype,n,{get:function(){return this[e]||null},set:function(t){return this[e]=t,t}})});fe.createDocument=function(){return new ni({type:"root",name:"root",parent:null,prev:null,next:null,children:[],"x-mode":I4.NO_QUIRKS})};fe.createDocumentFragment=function(){return new ni({type:"root",name:"root",parent:null,prev:null,next:null,children:[]})};fe.createElement=function(n,e,t){let i=Object.create(null),s=Object.create(null),r=Object.create(null);for(let o=0;o<t.length;o++){let a=t[o].name;i[a]=t[o].value,s[a]=t[o].namespace,r[a]=t[o].prefix}return new ni({type:n==="script"||n==="style"?n:"tag",name:n,namespace:e,attribs:i,"x-attribsNamespace":s,"x-attribsPrefix":r,children:[],parent:null,prev:null,next:null})};fe.createCommentNode=function(n){return new ni({type:"comment",data:n,parent:null,prev:null,next:null})};var Fv=function(n){return new ni({type:"text",data:n,parent:null,prev:null,next:null})},Rm=fe.appendChild=function(n,e){let t=n.children[n.children.length-1];t&&(t.next=e,e.prev=t),n.children.push(e),e.parent=n},M4=fe.insertBefore=function(n,e,t){let i=n.children.indexOf(t),s=t.prev;s&&(s.next=e,e.prev=s),t.prev=e,e.next=t,n.children.splice(i,0,e),e.parent=n};fe.setTemplateContent=function(n,e){Rm(n,e)};fe.getTemplateContent=function(n){return n.children[0]};fe.setDocumentType=function(n,e,t,i){let s=w4.serializeContent(e,t,i),r=null;for(let o=0;o<n.children.length;o++)if(n.children[o].type==="directive"&&n.children[o].name==="!doctype"){r=n.children[o];break}r?(r.data=s,r["x-name"]=e,r["x-publicId"]=t,r["x-systemId"]=i):Rm(n,new ni({type:"directive",name:"!doctype",data:s,"x-name":e,"x-publicId":t,"x-systemId":i}))};fe.setDocumentMode=function(n,e){n["x-mode"]=e};fe.getDocumentMode=function(n){return n["x-mode"]};fe.detachNode=function(n){if(n.parent){let e=n.parent.children.indexOf(n),t=n.prev,i=n.next;n.prev=null,n.next=null,t&&(t.next=i),i&&(i.prev=t),n.parent.children.splice(e,1),n.parent=null}};fe.insertText=function(n,e){let t=n.children[n.children.length-1];t&&t.type==="text"?t.data+=e:Rm(n,Fv(e))};fe.insertTextBefore=function(n,e,t){let i=n.children[n.children.indexOf(t)-1];i&&i.type==="text"?i.data+=e:M4(n,Fv(e),t)};fe.adoptAttributes=function(n,e){for(let t=0;t<e.length;t++){let i=e[t].name;typeof n.attribs[i]>"u"&&(n.attribs[i]=e[t].value,n["x-attribsNamespace"][i]=e[t].namespace,n["x-attribsPrefix"][i]=e[t].prefix)}};fe.getFirstChild=function(n){return n.children[0]};fe.getChildNodes=function(n){return n.children};fe.getParentNode=function(n){return n.parent};fe.getAttrList=function(n){let e=[];for(let t in n.attribs)e.push({name:t,value:n.attribs[t],namespace:n["x-attribsNamespace"][t],prefix:n["x-attribsPrefix"][t]});return e};fe.getTagName=function(n){return n.name};fe.getNamespaceURI=function(n){return n.namespace};fe.getTextNodeContent=function(n){return n.data};fe.getCommentNodeContent=function(n){return n.data};fe.getDocumentTypeNodeName=function(n){return n["x-name"]};fe.getDocumentTypeNodePublicId=function(n){return n["x-publicId"]};fe.getDocumentTypeNodeSystemId=function(n){return n["x-systemId"]};fe.isTextNode=function(n){return n.type==="text"};fe.isCommentNode=function(n){return n.type==="comment"};fe.isDocumentTypeNode=function(n){return n.type==="directive"&&n.name==="!doctype"};fe.isElementNode=function(n){return!!n.attribs};fe.setNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=e};fe.getNodeSourceCodeLocation=function(n){return n.sourceCodeLocation};fe.updateNodeSourceCodeLocation=function(n,e){n.sourceCodeLocation=Object.assign(n.sourceCodeLocation,e)}});var qv=ue((Tj,Bv)=>{"use strict";Bv.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var km=ue((yj,Uv)=>{var Jo=qv(),Hv={};for(let n of Object.keys(Jo))Hv[Jo[n]]=n;var Q={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Uv.exports=Q;for(let n of Object.keys(Q)){if(!("channels"in Q[n]))throw new Error("missing channels property: "+n);if(!("labels"in Q[n]))throw new Error("missing channel labels property: "+n);if(Q[n].labels.length!==Q[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:e,labels:t}=Q[n];delete Q[n].channels,delete Q[n].labels,Object.defineProperty(Q[n],"channels",{value:e}),Object.defineProperty(Q[n],"labels",{value:t})}Q.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),r=Math.max(e,t,i),o=r-s,a,u;r===s?a=0:e===r?a=(t-i)/o:t===r?a=2+(i-e)/o:i===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);let l=(s+r)/2;return r===s?u=0:l<=.5?u=o/(r+s):u=o/(2-r-s),[a,u*100,l*100]};Q.rgb.hsv=function(n){let e,t,i,s,r,o=n[0]/255,a=n[1]/255,u=n[2]/255,l=Math.max(o,a,u),c=l-Math.min(o,a,u),p=function(m){return(l-m)/6/c+1/2};return c===0?(s=0,r=0):(r=c/l,e=p(o),t=p(a),i=p(u),o===l?s=i-t:a===l?s=1/3+e-i:u===l&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,r*100,l*100]};Q.rgb.hwb=function(n){let e=n[0],t=n[1],i=n[2],s=Q.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,r*100,i*100]};Q.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),r=(1-e-s)/(1-s)||0,o=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function E4(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}Q.rgb.keyword=function(n){let e=Hv[n];if(e)return e;let t=1/0,i;for(let s of Object.keys(Jo)){let r=Jo[s],o=E4(n,r);o<t&&(t=o,i=s)}return i};Q.keyword.rgb=function(n){return Jo[n]};Q.rgb.xyz=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255;e=e>.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let s=e*.4124+t*.3576+i*.1805,r=e*.2126+t*.7152+i*.0722,o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]};Q.rgb.lab=function(n){let e=Q.rgb.xyz(n),t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;let r=116*i-16,o=500*(t-i),a=200*(i-s);return[r,o,a]};Q.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100,s,r,o;if(t===0)return o=i*255,[o,o,o];i<.5?s=i*(1+t):s=i+t-i*t;let a=2*i-s,u=[0,0,0];for(let l=0;l<3;l++)r=e+1/3*-(l-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(s-a)*6*r:2*r<1?o=s:3*r<2?o=a+(s-a)*(2/3-r)*6:o=a,u[l]=o*255;return u};Q.hsl.hsv=function(n){let e=n[0],t=n[1]/100,i=n[2]/100,s=t,r=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=r<=1?r:2-r;let o=(i+t)/2,a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]};Q.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,i=n[2]/100,s=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-t),a=255*i*(1-t*r),u=255*i*(1-t*(1-r));switch(i*=255,s){case 0:return[i,u,o];case 1:return[a,i,o];case 2:return[o,i,u];case 3:return[o,a,i];case 4:return[u,o,i];case 5:return[i,o,a]}};Q.hsv.hsl=function(n){let e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01),r,o;o=(2-t)*i;let a=(2-t)*s;return r=t*s,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]};Q.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100,s=t+i,r;s>1&&(t/=s,i/=s);let o=Math.floor(6*e),a=1-i;r=6*e-o,(o&1)!==0&&(r=1-r);let u=t+r*(a-t),l,c,p;switch(o){default:case 6:case 0:l=a,c=u,p=t;break;case 1:l=u,c=a,p=t;break;case 2:l=t,c=a,p=u;break;case 3:l=t,c=u,p=a;break;case 4:l=u,c=t,p=a;break;case 5:l=a,c=t,p=u;break}return[l*255,c*255,p*255]};Q.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,r=1-Math.min(1,e*(1-s)+s),o=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]};Q.xyz.rgb=function(n){let e=n[0]/100,t=n[1]/100,i=n[2]/100,s,r,o;return s=e*3.2406+t*-1.5372+i*-.4986,r=e*-.9689+t*1.8758+i*.0415,o=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[s*255,r*255,o*255]};Q.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let s=116*t-16,r=500*(e-t),o=200*(t-i);return[s,r,o]};Q.lab.xyz=function(n){let e=n[0],t=n[1],i=n[2],s,r,o;r=(e+16)/116,s=t/500+r,o=r-i/200;let a=r**3,u=s**3,l=o**3;return r=a>.008856?a:(r-16/116)/7.787,s=u>.008856?u:(s-16/116)/7.787,o=l>.008856?l:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]};Q.lab.lch=function(n){let e=n[0],t=n[1],i=n[2],s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);let o=Math.sqrt(t*t+i*i);return[e,o,s]};Q.lch.lab=function(n){let e=n[0],t=n[1],s=n[2]/360*2*Math.PI,r=t*Math.cos(s),o=t*Math.sin(s);return[e,r,o]};Q.rgb.ansi16=function(n,e=null){let[t,i,s]=n,r=e===null?Q.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return r===2&&(o+=60),o};Q.hsv.ansi16=function(n){return Q.rgb.ansi16(Q.hsv.rgb(n),n[2])};Q.rgb.ansi256=function(n){let e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)};Q.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(n>50)+1)*.5,i=(e&1)*t*255,s=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[i,s,r]};Q.ansi256.rgb=function(n){if(n>=232){let r=(n-232)*10+8;return[r,r,r]}n-=16;let e,t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]};Q.rgb.hex=function(n){let t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};Q.hex.rgb=function(n){let e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));let i=parseInt(t,16),s=i>>16&255,r=i>>8&255,o=i&255;return[s,r,o]};Q.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),r=Math.min(Math.min(e,t),i),o=s-r,a,u;return o<1?a=r/(1-o):a=0,o<=0?u=0:s===e?u=(t-i)/o%6:s===t?u=2+(i-e)/o:u=4+(e-t)/o,u/=6,u%=1,[u*360,o*100,a*100]};Q.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t),s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]};Q.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,i=e*t,s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]};Q.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];let s=[0,0,0],r=e%1*6,o=r%1,a=1-o,u=0;switch(Math.floor(r)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return u=(1-t)*i,[(t*s[0]+u)*255,(t*s[1]+u)*255,(t*s[2]+u)*255]};Q.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,i=e+t*(1-e),s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]};Q.hcg.hsl=function(n){let e=n[1]/100,i=n[2]/100*(1-e)+.5*e,s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]};Q.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};Q.hwb.hcg=function(n){let e=n[1]/100,i=1-n[2]/100,s=i-e,r=0;return s<1&&(r=(i-s)/(1-s)),[n[0],s*100,r*100]};Q.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};Q.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};Q.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};Q.gray.hsl=function(n){return[0,0,n[0]]};Q.gray.hsv=Q.gray.hsl;Q.gray.hwb=function(n){return[0,100,n[0]]};Q.gray.cmyk=function(n){return[0,0,0,n[0]]};Q.gray.lab=function(n){return[n[0],0,0]};Q.gray.hex=function(n){let e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i};Q.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var Wv=ue((bj,Kv)=>{var kl=km();function A4(){let n={},e=Object.keys(kl);for(let t=e.length,i=0;i<t;i++)n[e[i]]={distance:-1,parent:null};return n}function R4(n){let e=A4(),t=[n];for(e[n].distance=0;t.length;){let i=t.pop(),s=Object.keys(kl[i]);for(let r=s.length,o=0;o<r;o++){let a=s[o],u=e[a];u.distance===-1&&(u.distance=e[i].distance+1,u.parent=i,t.unshift(a))}}return e}function k4(n,e){return function(t){return e(n(t))}}function P4(n,e){let t=[e[n].parent,n],i=kl[e[n].parent][n],s=e[n].parent;for(;e[s].parent;)t.unshift(e[s].parent),i=k4(kl[e[s].parent][s],i),s=e[s].parent;return i.conversion=t,i}Kv.exports=function(n){let e=R4(n),t={},i=Object.keys(e);for(let s=i.length,r=0;r<s;r++){let o=i[r];e[o].parent!==null&&(t[o]=P4(o,e))}return t}});var Vv=ue((vj,jv)=>{var Pm=km(),_4=Wv(),Tr={},L4=Object.keys(Pm);function O4(n){let e=function(...t){let i=t[0];return i==null?i:(i.length>1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function N4(n){let e=function(...t){let i=t[0];if(i==null)return i;i.length>1&&(t=i);let s=n(t);if(typeof s=="object")for(let r=s.length,o=0;o<r;o++)s[o]=Math.round(s[o]);return s};return"conversion"in n&&(e.conversion=n.conversion),e}L4.forEach(n=>{Tr[n]={},Object.defineProperty(Tr[n],"channels",{value:Pm[n].channels}),Object.defineProperty(Tr[n],"labels",{value:Pm[n].labels});let e=_4(n);Object.keys(e).forEach(i=>{let s=e[i];Tr[n][i]=N4(s),Tr[n][i].raw=O4(s)})});jv.exports=Tr});var Jv=ue((Sj,Xv)=>{"use strict";var Gv=(n,e)=>(...t)=>`\x1B[${n(...t)+e}m`,zv=(n,e)=>(...t)=>{let i=n(...t);return`\x1B[${38+e};5;${i}m`},Qv=(n,e)=>(...t)=>{let i=n(...t);return`\x1B[${38+e};2;${i[0]};${i[1]};${i[2]}m`},Pl=n=>n,Yv=(n,e,t)=>[n,e,t],yr=(n,e,t)=>{Object.defineProperty(n,e,{get:()=>{let i=t();return Object.defineProperty(n,e,{value:i,enumerable:!0,configurable:!0}),i},enumerable:!0,configurable:!0})},_m,br=(n,e,t,i)=>{_m===void 0&&(_m=Vv());let s=i?10:0,r={};for(let[o,a]of Object.entries(_m)){let u=o==="ansi16"?"ansi":o;o===e?r[u]=n(t,s):typeof a=="object"&&(r[u]=n(a[e],s))}return r};function D4(){let n=new Map,e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};e.color.gray=e.color.blackBright,e.bgColor.bgGray=e.bgColor.bgBlackBright,e.color.grey=e.color.blackBright,e.bgColor.bgGrey=e.bgColor.bgBlackBright;for(let[t,i]of Object.entries(e)){for(let[s,r]of Object.entries(i))e[s]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},i[s]=e[s],n.set(r[0],r[1]);Object.defineProperty(e,t,{value:i,enumerable:!1})}return Object.defineProperty(e,"codes",{value:n,enumerable:!1}),e.color.close="\x1B[39m",e.bgColor.close="\x1B[49m",yr(e.color,"ansi",()=>br(Gv,"ansi16",Pl,!1)),yr(e.color,"ansi256",()=>br(zv,"ansi256",Pl,!1)),yr(e.color,"ansi16m",()=>br(Qv,"rgb",Yv,!1)),yr(e.bgColor,"ansi",()=>br(Gv,"ansi16",Pl,!0)),yr(e.bgColor,"ansi256",()=>br(zv,"ansi256",Pl,!0)),yr(e.bgColor,"ansi16m",()=>br(Qv,"rgb",Yv,!0)),e}Object.defineProperty(Xv,"exports",{enumerable:!0,get:D4})});var tS=ue((Cj,eS)=>{"use strict";var F4=hg("os"),Zv=hg("tty"),Xt=tA(),{env:Xe}=process,Di;Xt("no-color")||Xt("no-colors")||Xt("color=false")||Xt("color=never")?Di=0:(Xt("color")||Xt("colors")||Xt("color=true")||Xt("color=always"))&&(Di=1);"FORCE_COLOR"in Xe&&(Xe.FORCE_COLOR==="true"?Di=1:Xe.FORCE_COLOR==="false"?Di=0:Di=Xe.FORCE_COLOR.length===0?1:Math.min(parseInt(Xe.FORCE_COLOR,10),3));function Lm(n){return n===0?!1:{level:n,hasBasic:!0,has256:n>=2,has16m:n>=3}}function Om(n,e){if(Di===0)return 0;if(Xt("color=16m")||Xt("color=full")||Xt("color=truecolor"))return 3;if(Xt("color=256"))return 2;if(n&&!e&&Di===void 0)return 0;let t=Di||0;if(Xe.TERM==="dumb")return t;if(process.platform==="win32"){let i=F4.release().split(".");return Number(i[0])>=10&&Number(i[2])>=10586?Number(i[2])>=14931?3:2:1}if("CI"in Xe)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some(i=>i in Xe)||Xe.CI_NAME==="codeship"?1:t;if("TEAMCITY_VERSION"in Xe)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Xe.TEAMCITY_VERSION)?1:0;if(Xe.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Xe){let i=parseInt((Xe.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Xe.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Xe.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Xe.TERM)||"COLORTERM"in Xe?1:t}function $4(n){let e=Om(n,n&&n.isTTY);return Lm(e)}eS.exports={supportsColor:$4,stdout:Lm(Om(!0,Zv.isatty(1))),stderr:Lm(Om(!0,Zv.isatty(2)))}});var iS=ue((xj,nS)=>{"use strict";var B4=(n,e,t)=>{let i=n.indexOf(e);if(i===-1)return n;let s=e.length,r=0,o="";do o+=n.substr(r,i-r)+e+t,r=i+s,i=n.indexOf(e,r);while(i!==-1);return o+=n.substr(r),o},q4=(n,e,t,i)=>{let s=0,r="";do{let o=n[i-1]==="\r";r+=n.substr(s,(o?i-1:i)-s)+e+(o?`\r
|
|
@@ -235,7 +235,7 @@ ${l?`[Earlier output truncated]
|
|
|
235
235
|
${T}`,S=this.pendingContext.get(y),M=S?`${S}
|
|
236
236
|
|
|
237
237
|
${b}`:b;this.pendingContext.set(y,M.length>uM?`[Earlier command context truncated]
|
|
238
|
-
${M.slice(-uM)}`:M)}}};var Fd=class{constructor(e){this.options=e}project(e){let t=e.sessionId;if(t){if(e.type==="permission.ask"){this.options.stateStore.dispatch({type:"interaction/permissionReceived",sessionId:t,permission:e.request});return}if(e.type==="permission.resolved"){this.options.stateStore.dispatch({type:"interaction/permissionResolved",sessionId:t,requestId:e.requestId});return}if(e.type==="questionnaire.ask"){this.options.stateStore.dispatch({type:"interaction/questionnaireReceived",sessionId:t,questionnaire:Cs(e.request,t,e.agentName)});return}if(e.type==="questionnaire.dismiss"||e.type==="questionnaire.superseded"){this.options.stateStore.dispatch({type:"interaction/questionnaireResolved",sessionId:t,requestId:e.requestId});return}if(e.type==="session.queue.updated"&&e.itemId&&e.status){if(!this.options.queueEnabled)return;this.options.stateStore.dispatch({type:"execution/queueObserved",sessionId:t,item:{itemId:e.itemId,status:e.status}});return}(e.type==="session.start"||e.type==="session.finish"||e.type==="session.error"||e.type==="session.abort")&&this.options.stateStore.dispatch({type:"execution/runObserved",sessionId:t,run:{runId:e.turnId??`session:${t}`,turnId:e.turnId,status:e.type==="session.start"?"running":"terminal"}})}}async reconcile(e){let t=e.sessionId,i=Tn(this.options.stateStore.snapshot(),t),s=i?.runRevision??0,r=i?.queueRevision??0,o=i?.permissionRevision??0,a=i?.questionnaireRevision??0,u=this.options.resolveSessionAgentName?.(t)??this.options.defaultAgentName,[l,c,p,m]=await Promise.allSettled([this.options.runtime.getActiveRun(t),this.options.queueEnabled?this.options.runtime.listQueuedMessages(t):Promise.resolve(void 0),this.options.runtime.listPendingPermissions(),this.options.runtime.getPendingQuestionnaire(u,t)]),g=[l,c,p,m].flatMap(b=>b.status==="rejected"?[b.reason]:[]);if(g.length>0)throw new AggregateError(g,`Unable to reconcile Runtime state for session ${t}.`);let T=[];if(l.status==="fulfilled"){let b=l.value,S=b.state==="running"||b.state==="decision-blocked",M=b.turnId??`session:${t}`;T.push({type:"execution/runsReconciled",sessionId:t,expectedRunRevision:s,runs:S?[{runId:M,turnId:b.turnId,status:b.state==="decision-blocked"?"blocked":"running"}]:[]})}c.status==="fulfilled"&&c.value!==void 0&&T.push({type:"execution/queueReplaced",sessionId:t,expectedQueueRevision:r,items:c.value.map(b=>({itemId:b.itemId,status:b.status??"queued",content:b.content,runtimeItem:b}))});let y={type:"interaction/snapshotReconciled",sessionId:t,expectedPermissionRevision:o,expectedQuestionnaireRevision:a};if(p.status==="fulfilled"){let b=new Set(this.options.permissionSessionScope?.(t)??[]);b.add(t),y.permission=p.value.find(S=>S.sessionId!==void 0&&b.has(S.sessionId))??null}if(m.status==="fulfilled"){let b=m.value;y.questionnaire=b?Cs(b,t,b.requester?.agentName??u):null}return("permission"in y||"questionnaire"in y)&&T.push(y),T.push({type:"connection/sessionReconciled",sessionId:t}),T}};function lM(n){let e=n.reason??n.toolDescription??n.toolInput;return e?x(e).trim():"Review this tool action."}function $d(n,e){let t=x(n.toolName??"unknown");return e==="allowAlways"?`Saved permission rule \xB7 ${t}`:e==="deny"?`Denied \xB7 ${t}`:`Allowed for this conversation \xB7 ${t}`}var B1=6,_a=class{constructor(e,t,i){this.request=e;this.onSelect=t;this.onStop=i;let s=[{value:"allowOnce",label:"1 Allow for this conversation"},...e.allowAlwaysSupported===!1?[]:[{value:"allowAlways",label:"2 Always allow matching actions"}],{value:"deny",label:e.allowAlwaysSupported===!1?"2 Deny and guide MCode":"3 Deny and guide MCode"}];this.decisions=s.map(r=>r.value),this.list=new Je(s,s.length,VD(),{minPrimaryColumnWidth:22,maxPrimaryColumnWidth:34,truncatePrimary:({item:r,maxWidth:o})=>GD(r.value,this.decisions.indexOf(r.value)+1,o)}),this.list.onSelect=r=>this.choose(r.value),this.list.onCancel=()=>this.onSelect("deny"),this.denyInput.onSubmit=r=>this.onSelect("deny",r.trim()||void 0),this.denyInput.onEscape=()=>{this.denyFeedback=!1,this.syncDenyInputFocus(),this.resetViewport()}}list;decisions;_focused=!1;confirmAlways=!1;denyFeedback=!1;detailsExpanded=!1;detailsExpandable=!1;submitting;viewportOffset=0;viewportEvidenceRows=0;viewportEvidenceLineCount=0;denyInput=new ze;get focused(){return this._focused}set focused(e){this._focused=e,this.syncDenyInputFocus()}handleInput(e){if(!this.submitting){if(v(e,"ctrl+c")){this.onStop();return}if(!this.confirmAlways&&v(e,"ctrl+e")&&(this.detailsExpandable||this.detailsExpanded)){this.detailsExpanded=!this.detailsExpanded,this.resetViewport();return}if(this.denyFeedback){this.denyInput.handleInput(e);return}if(this.confirmAlways){v(e,"enter")?this.onSelect("allowAlways"):(v(e,"escape")||v(e,"left"))&&(this.confirmAlways=!1,this.resetViewport());return}if(/^[1-9]$/u.test(e)){let t=Number(e)-1,i=this.decisions[t];i&&this.choose(i);return}this.list.handleInput(e)}}invalidate(){this.list.invalidate(),this.denyInput.invalidate()}beginSubmitting(e){this.submitting=e,this.syncDenyInputFocus(),this.resetViewport(),this.invalidate()}render(e){let t=Math.max(0,Math.floor(e));return t===0?[]:Bd(this.buildFrameModel(t),t)}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];let r=this.buildFrameModel(i),o=Bd(r,i);if(o.length<=s)return this.resetViewport(),o;let a={...r,leading:fM(r.leading),trailing:gM(r.trailing)};if(a.evidence.length===0)return cM(a,i).slice(0,s);let u={start:1,end:1,visibleTotal:a.evidence.length},l=Bd(a,i,[],u).length;if(l>=s)return this.resetViewport(),cM(a,i).slice(0,s);let c=s-l;this.viewportEvidenceRows=c,this.viewportEvidenceLineCount=a.evidence.length,this.viewportOffset=mM(this.viewportOffset,0,Math.max(0,a.evidence.length-c));let p=Math.min(a.evidence.length,this.viewportOffset+c),m={start:this.viewportOffset+1,end:p,visibleTotal:a.evidence.length};return Bd(a,i,a.evidence.slice(this.viewportOffset,p),m).slice(0,s)}scrollByRows(e){if(this.viewportEvidenceRows===0)return 0;let t=Math.max(0,this.viewportEvidenceLineCount-this.viewportEvidenceRows);if(t===0)return 0;let i=mM(this.viewportOffset+Math.trunc(e),0,t),s=i-this.viewportOffset;return this.viewportOffset=i,s}scrollByPage(e){return this.scrollByRows(e*Math.max(1,this.viewportEvidenceRows-1))}buildFrameModel(e){let t=Ze(e),i=x(this.request.toolName??"unknown"),s=UD(i),r=KD(i);if(this.detailsExpandable=!1,this.submitting)return{title:"\u25CC Applying permission\u2026",meta:s,tone:r,leading:[...new Se(h.bold.hex(d.text)(WD(this.submitting)),0,0).render(Math.max(1,t)),...new Se(h.hex(d.muted)("Waiting for Runtime to commit the decision."),0,0).render(Math.max(1,t))],evidence:[],trailing:[]};if(this.confirmAlways){let a=ZD(this.request,t);return{title:"\u25C6 Save permission rule",meta:s,tone:"warning",leading:[h.bold.hex(d.text)("Always allow matching actions?"),""],evidence:a,trailing:["",...new Se(h.hex(d.muted)("Future matching actions will continue without asking."),0,0).render(Math.max(1,t))],footer:QD(t),statusLine:u=>u?XD("Scope",u,a.length,t):void 0}}if(this.denyFeedback){let a=dM(this.request,t,this.detailsExpanded);return this.detailsExpandable=a.expandable,{title:"\xD7 Deny action",meta:s,tone:"warning",leading:[h.bold.hex(d.text)("Deny this action?"),""],evidence:a.lines,trailing:["",h.hex(d.muted)("Add guidance for MCode, or leave this blank."),...this.denyInput.render(Math.max(1,t)).map(u=>La(u,t))],footer:YD(t),statusLine:hM(a,t)}}let o=dM(this.request,t,this.detailsExpanded);return this.detailsExpandable=o.expandable,{title:"\u25C6 Approval required",meta:s,tone:r,leading:[h.bold.hex(d.text)(HD(i)),""],evidence:o.lines,trailing:["",...this.renderDecisionOptions(t)],footer:zD(t),statusLine:hM(o,t)}}renderDecisionOptions(e){let t=this.list.render(Math.max(1,e)),i=this.list.getSelectedItem()?.value,s=i?this.decisions.indexOf(i):-1;if(!i||s<0)return t;let r=Math.max(1,e-4),o=new Se(h.hex(d.muted)(jD(i)),0,0).render(r).map(a=>La(` ${a}`,e));return[...t.slice(0,s+1),...o,...t.slice(s+1)]}resetViewport(){this.viewportOffset=0,this.viewportEvidenceRows=0,this.viewportEvidenceLineCount=0}choose(e){if(e==="allowAlways"){this.confirmAlways=!0,this.resetViewport();return}if(e==="deny"){this.denyFeedback=!0,this.denyInput.setValue(""),this.syncDenyInputFocus(),this.resetViewport();return}this.onSelect(e)}syncDenyInputFocus(){this.denyInput.focused=this._focused&&this.denyFeedback&&this.submitting===void 0}};function Bd(n,e,t=n.evidence,i){let s=n.statusLine?.(i);return Fe({title:n.title,meta:n.meta,body:[...n.leading,...t,...s?[G(s)]:[],...n.trailing],footer:n.footer},e,n.tone)}function cM(n,e){return ji([h.bold.hex(d[n.tone])(n.title),...fM(n.leading),...gM(n.trailing),...n.footer?[G(n.footer)]:[]],e,n.tone)}function dM(n,e,t=!1){let i=[];n.structuredPreview?i.push(...Sr(n.structuredPreview,e,{maxBodyLines:Number.MAX_SAFE_INTEGER})):n.toolInput&&i.push(...JD(n,e));let s=[];n.toolDescription&&n.toolDescription!==n.toolName&&n.toolDescription!==n.toolInput&&s.push(...pM(n.toolDescription,e)),n.reason&&n.reason!==n.toolDescription&&n.reason!==n.toolInput&&s.push(...pM(`Why \xB7 ${n.reason}`,e));let r=[...i,...s],o=r.length>B1,a=t&&o,u=Math.min(i.length,Math.max(1,B1-Math.min(s.length,3))),l=[...i.slice(0,u),...s.slice(0,B1-u)];return{lines:a?r:l,totalLines:r.length,expandable:o,expanded:a}}function HD(n){let e=n.toLocaleLowerCase().replaceAll("-","_");return e==="bash"||e.includes("shell")||e.includes("exec")?"Run this command?":e.includes("write")||e.includes("create_file")?"Write this file?":e.includes("edit")||e.includes("patch")?"Apply these edits?":e.includes("delete")||e.includes("remove")?"Delete this item?":`Allow ${n}?`}function UD(n){let e=n.replaceAll(/[-_]+/gu," ").trim();return e?e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toLocaleUpperCase()):"Unknown"}function KD(n){let e=n.toLocaleLowerCase().replaceAll("-","_");return e.includes("delete")||e.includes("remove")?"error":"warning"}function WD(n){return n==="allowAlways"?"Saving the permission rule and allowing this action\u2026":n==="deny"?"Denying this action\u2026":"Allowing for this conversation\u2026"}function jD(n){return n==="allowAlways"?"Review the exact saved scope next":n==="deny"?"Add guidance before denying this action":"MCode asks again in a new conversation"}function VD(){return{...it,selectedPrefix:n=>h.bold.hex(d.signal)(n),selectedText:n=>{let e=n.startsWith("\u2192 ")?n.slice(2):n.trimStart();return`${h.bold.hex(d.signal)("\u203A")} ${h.bold.hex(d.signal)(e)}`}}}function GD(n,e,t){let i=String(Math.max(1,e)),s=n==="allowOnce"?[`${i} Allow for this conversation`,`${i} Allow this conversation`,`${i} Allow conversation`,`${i} Allow`]:n==="allowAlways"?[`${i} Always allow matching actions`,`${i} Always allow matching`,`${i} Always allow`]:[`${i} Deny and guide MCode`,`${i} Deny and guide`,`${i} Deny`];return s.find(r=>C(r)<=t)??E(s.at(-1)??i,Math.max(1,t),"")}function zD(n){return["\u2191/\u2193 choose \xB7 Enter confirm \xB7 Esc deny \xB7 Ctrl+C stop","\u2191/\u2193 \xB7 Enter confirm \xB7 Esc deny \xB7 Ctrl+C stop","Enter confirm \xB7 Esc deny \xB7 Ctrl+C stop","Enter \xB7 Esc deny \xB7 Ctrl+C"].find(t=>C(t)<=n)??"Enter \xB7 Esc"}function QD(n){return["Enter save and allow \xB7 Esc go back \xB7 Ctrl+C stop","Enter save \xB7 Esc go back \xB7 Ctrl+C stop","Enter save \xB7 Esc back"].find(t=>C(t)<=n)??"Enter \xB7 Esc"}function YD(n){return["Enter deny \xB7 Esc go back \xB7 Ctrl+C stop","Enter deny \xB7 Esc back \xB7 Ctrl+C stop","Enter deny \xB7 Esc back"].find(t=>C(t)<=n)??"Enter \xB7 Esc"}function hM(n,e){return t=>{if(!t&&!n.expandable)return;let i=n.expanded?"Ctrl+E collapse":"Ctrl+E review all";if(!t){let o=n.lines.length;return q1([`Details ${String(o)} of ${String(n.totalLines)} lines \xB7 ${i}`,`${String(o)}/${String(n.totalLines)} lines \xB7 ${i}`,`${String(o)}/${String(n.totalLines)} \xB7 Ctrl+E`],e)}let s=`${String(t.start)}-${String(t.end)}`,r=n.expandable&&!n.expanded?[`Details ${s} of ${String(t.visibleTotal)} shown \xB7 ${String(n.totalLines)} total \xB7 PgUp/PgDn scroll \xB7 ${i}`,`${s}/${String(t.visibleTotal)} shown \xB7 ${String(n.totalLines)} total \xB7 PgUp/PgDn \xB7 Ctrl+E`,`${s}/${String(t.visibleTotal)} \xB7 PgUp/PgDn \xB7 Ctrl+E`]:[`Details ${s} of ${String(n.totalLines)} \xB7 PgUp/PgDn scroll${n.expandable?` \xB7 ${i}`:""}`,`${s}/${String(n.totalLines)} \xB7 PgUp/PgDn${n.expandable?" \xB7 Ctrl+E":""}`];return q1(r,e)}}function XD(n,e,t,i){let s=`${String(e.start)}-${String(e.end)}`;return q1([`${n} ${s} of ${String(t)} \xB7 PgUp/PgDn scroll`,`${n} ${s}/${String(t)} \xB7 PgUp/PgDn`,`${s}/${String(t)} \xB7 PgUp/PgDn`],i)}function q1(n,e){return n.find(t=>C(t)<=e)??E(n.at(-1)??"",Math.max(0,e),"")}function JD(n,e){let t=n.toolName?.toLocaleLowerCase()??"",s=t==="bash"||t.includes("shell")||t.includes("exec")?jl(n.toolInput):void 0,r=s?"$":"\u203A",o=Math.max(1,e-4),a=x(s??n.toolInput??"");return new Se(s?Cr(a):h.hex(d.text)(a),0,0).render(o).map((l,c)=>La(` ${c===0?h.hex(d.accent)(r):" "} ${l}`,e))}function pM(n,e){let t=Math.max(1,e-2);return new Se(h.hex(d.muted)(x(n)),0,0).render(t).map(i=>La(` ${i}`,e))}function ZD(n,e){let t=n.ruleContents&&n.ruleContents.length>0?n.ruleContents:["Exact saved scope is unavailable."];return eF("Scope",t.map(i=>`- ${i}`),e)}function eF(n,e,t){let i=Math.min(12,Math.max(4,Math.floor(t/3))),s=` ${n.slice(0,i).padEnd(i)} `,r=Math.max(1,t-s.length);return e.flatMap(a=>new Se(h.hex(d.text)(x(a)),0,0).render(r)).map((a,u)=>{let l=u===0?` ${h.bold.hex(d.muted)(n.slice(0,i).padEnd(i))} `:" ".repeat(s.length);return La(`${l}${a}`,t)})}function La(n,e){return E(n,Math.max(0,e),"")}function fM(n){let e=n.length;for(;e>0&&n[e-1]==="";)e-=1;return n.slice(0,e)}function gM(n){let e=0;for(;e<n.length&&n[e]==="";)e+=1;return n.slice(e)}function mM(n,e,t){return Number.isFinite(n)?Math.min(t,Math.max(e,Math.floor(n))):e}var TM=1e3,yM=60,Jr=class{constructor(e,t,i,s={}){this.state=e;this.onAnswer=t;this.onCancel=i;this.onSubmit=s.onSubmit,this.onDismiss=s.onDismiss,this.requestRender=s.requestRender,this.now=s.now??Date.now,this.stepIndex=aF(e),this.mode="answer",this.configureStep(),this.startCountdown(),this.input.onSubmit=r=>{if(this.mode!=="text")return;let o=r.trim();o&&this.commitAnswer(o)},this.input.onEscape=()=>{this.mode==="text"&&(this.step?.options?.length??0)>0?(this.rememberTextDraft(),this.mode="answer",this.configureStep()):this.requestDismissConfirmation()}}stepIndex;mode;input=new ze;_focused=!1;multiSelected=new Set;textDrafts=new Map;singleIndex=0;multiIndex=0;confirmDismiss=!1;dismissing=!1;submitting=!1;viewportOptionRows;onSubmit;onDismiss;requestRender;now;countdownTimer;get focused(){return this._focused}set focused(e){this._focused=e,this.syncInputFocus()}handleInput(e){if(this.dismissing||this.submitting)return;if(v(e,"ctrl+c")){this.onCancel();return}if(this.confirmDismiss){v(e,"enter")?(this.confirmDismiss=!1,this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0),this.onDismiss?.()):v(e,"escape")&&(this.confirmDismiss=!1,this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0));return}if(!this.step){v(e,"escape")&&this.requestDismissConfirmation();return}if(v(e,"tab")||this.mode!=="text"&&v(e,"right")){this.moveStep(1);return}if((v(e,"shift+tab")||this.mode!=="text"&&v(e,"left"))&&U1(this.state)){this.moveStep(-1);return}if(this.mode==="text"){this.input.handleInput(e);return}if(!H1(this.step.selectionMode)){let s=this.step.options??[],r=s.length+(this.step.allowOther?1:0);if(v(e,"up")){this.singleIndex=this.singleIndex===0?r-1:this.singleIndex-1;return}if(v(e,"down")){this.singleIndex=this.singleIndex===r-1?0:this.singleIndex+1;return}if(/^[1-9]$/u.test(e)){let o=Number(e)-1;if(o>=0&&o<s.length){this.commitAnswer(String(o+1));return}if(this.step.allowOther&&o===s.length){this.openTextInput();return}}if(v(e,"enter")){this.singleIndex<s.length?this.commitAnswer(String(this.singleIndex+1)):this.step.allowOther&&this.openTextInput();return}if(this.step.allowOther&&e.toLocaleLowerCase()==="o"){this.openTextInput();return}v(e,"escape")&&this.requestDismissConfirmation();return}let t=this.step.options??[],i=t.length+(this.step.allowOther?1:0);if(v(e,"up")){i>0&&(this.multiIndex=this.multiIndex===0?i-1:this.multiIndex-1);return}if(v(e,"down")){i>0&&(this.multiIndex=this.multiIndex===i-1?0:this.multiIndex+1);return}if(/^[1-9]$/u.test(e)){let s=Number(e)-1;s>=0&&s<t.length&&(this.multiIndex=s,this.toggleMultiChoice(s));return}if(v(e,"space")){this.multiIndex<t.length?this.toggleMultiChoice(this.multiIndex):this.step.allowOther&&this.openTextInput();return}if(v(e,"enter")){this.multiIndex===t.length&&this.step.allowOther?this.openTextInput():this.multiSelected.size===0&&t[this.multiIndex]?this.commitAnswer(String(this.multiIndex+1)):this.multiSelected.size>0&&this.commitAnswer([...this.multiSelected].sort((s,r)=>s-r).map(s=>String(s+1)).join(","));return}if(this.step.allowOther&&e.toLocaleLowerCase()==="o"){this.mode="text",this.configureTextInput();return}v(e,"escape")&&this.requestDismissConfirmation()}invalidate(){this.input.invalidate()}beginDismiss(){return this.dismissing?!1:(this.confirmDismiss=!1,this.dismissing=!0,this.stopCountdown(),this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0),!0)}beginSubmitting(){this.submitting=!0,this.stopCountdown(),this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0)}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t),s=iF(this.state,this.stepIndex);if(this.submitting)return Fe({title:"Ask",meta:s,body:[h.bold.hex(d.text)("Sending answers\u2026"),h.hex(d.muted)("Waiting for MiniMax Code to continue the conversation.")]},t,"signal");if(this.dismissing)return Fe({title:"Ask",meta:s,body:[h.bold.hex(d.text)("Closing question\u2026"),Et(h.hex(d.muted)("Waiting for MiniMax Code to dismiss the pending request."),i)]},t,"signal");if(this.confirmDismiss)return Fe({title:"Cancel this question?",body:[Et(h.hex(d.muted)("The pending request and its unsent answers will be discarded."),i)],footer:Et("Enter cancel question \xB7 Esc keep answering",i)},t,"warning");if(!this.step)return Fe({title:"Ask",meta:s,body:[Et(h.hex(d.muted)("All questionnaire steps are answered."),i)]},t,"signal");let r=this.step.header??this.state.request.title,o=this.state.answers.get(this.step.id),a=sF(this.state,this.stepIndex,i),u=this.goalAutoReplyRemainingSeconds(),c=[...!!r&&a.length===0&&r?new Se(h.hex(d.muted)(x(r)),0,0).render(i):[],...new Se(h.bold.hex(d.text)(x(this.step.question)),0,0).render(i),...this.step.description?new Se(h.hex(d.muted)(x(this.step.description)),0,0).render(i):[],...u!==void 0?tF(u,i):[],...o?[Et(h.hex(d.success)(`Saved answer \xB7 ${x(o.rawText)}`),i)]:[],""];if(this.mode==="text")return Fe({title:"Ask",meta:s,navigation:a,body:[...c,...this.input.render(i).map(m=>Et(m,i))],footer:Et(`Type your answer \xB7 Enter ${K1(this.state,this.step.id)?"send":"next"} \xB7 Esc ${(this.step.options?.length??0)>0?"back":"cancel"}`,i)},t,"signal");if(!H1(this.step.selectionMode))return Fe({title:"Ask",meta:s,navigation:a,body:[...c,...this.renderSingleOptions(this.step.options??[],i)],footer:Et(SM(i,`\u2191\u2193 move \xB7 1-${Math.min(9,(this.step.options?.length??0)+(this.step.allowOther?1:0))} select \xB7 Enter ${K1(this.state,this.step.id)?"send":"next"}`,U1(this.state)),i)},t,"signal");let p=this.step.options??[];return Fe({title:"Ask",meta:s,navigation:a,body:[...c,...this.renderMultiOptions(p,i),...this.step.allowOther?[this.renderMultiOther(p.length,i)]:[]],footer:Et(SM(i,`\u2191\u2193 move \xB7 Space toggle \xB7 Enter ${K1(this.state,this.step.id)?"send":"next"}`,U1(this.state)),i)},t,"signal")}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];this.viewportOptionRows=Math.max(1,s-9);try{return oF(this.render(i),s)}finally{this.viewportOptionRows=void 0}}dispose(){this.stopCountdown()}renderSingleOptions(e,t){let i=[...e.map((a,u)=>({label:this.optionLabel(a),description:a.description,number:u+1})),...this.step?.allowOther?[{label:"Other\u2026",description:this.step.otherPlaceholder??"Type another answer",number:e.length+1}]:[]],s=rF(i,this.singleIndex,this.viewportOptionRows),r=[],o=vM(s.items.map(a=>a.label),t);s.start>0&&r.push(Et(h.hex(d.dim)(` \u2026 ${s.start} more above`),t));for(let[a,u]of s.items.entries()){let c=s.start+a===this.singleIndex,p=`${c?"\u203A":" "} ${u.number} `;r.push(...bM({prefix:p,label:u.label,description:this.viewportOptionRows===void 0?u.description:void 0,width:t,labelColumnWidth:o,focused:c}))}return s.end<i.length&&r.push(Et(h.hex(d.dim)(` \u2026 ${i.length-s.end} more below`),t)),r}renderMultiOptions(e,t){let i=Math.max(1,Math.min(6,this.viewportOptionRows??6)),s=Math.max(0,Math.min(this.multiIndex-Math.floor(i/2),e.length-i)),r=Math.min(e.length,s+i),o=[],a=vM(e.slice(s,r).map(u=>this.optionLabel(u)),t);s>0&&o.push(Et(h.hex(d.dim)(` \u2026 ${s} more above`),t));for(let u=s;u<r;u+=1){let l=e[u];if(!l)continue;let c=u===this.multiIndex?"\u2192":" ",p=this.multiSelected.has(u)?"\u25CF":"\u25CB";o.push(...bM({prefix:`${c} ${p} ${u+1} `,label:this.optionLabel(l),description:this.viewportOptionRows===void 0?l.description:void 0,width:t,labelColumnWidth:a,focused:u===this.multiIndex}))}return r<e.length&&o.push(Et(h.hex(d.dim)(` \u2026 ${e.length-r} more below`),t)),o}renderMultiOther(e,t){let i=e===this.multiIndex,s=`${i?"\u2192":" "} o `,r="Other\u2026";return qd(i?`${h.bold.hex(d.signal)(s)}${h.bold.hex(d.signal)(r)}`:h.hex(d.muted)(`${s}${r}`),t,i)}get step(){return this.state.request.steps[this.stepIndex]}optionLabel(e){return this.goalAutoReplyRemainingSeconds()!==void 0&&e.recommended===!0?`${e.label} (Recommended)`:e.label}configureStep(){let e=this.step;if(this.multiSelected.clear(),this.singleIndex=0,this.multiIndex=0,this.syncInputFocus(),!e||this.mode==="text")return;let t=e.options??[],i=this.state.answers.get(e.id);if(H1(e.selectionMode)){let o=new Set(i?.answer.selectedOptionIds??[]);for(let[u,l]of t.entries())o.has(l.id)&&this.multiSelected.add(u);let a=[...this.multiSelected][0];this.multiIndex=i?.answer.selectedOther?t.length:Math.min(t.length-1,Math.max(0,a??0));return}if(t.length===0){this.mode="text",this.configureTextInput();return}this.input.setValue("");let s=i?.answer.selectedOptionIds?.[0],r=s?t.findIndex(o=>o.id===s):i?.answer.selectedOther?t.length:0;this.singleIndex=Math.max(0,r)}openTextInput(){this.mode="text",this.configureTextInput()}requestDismissConfirmation(){if(!this.onDismiss){this.onCancel();return}this.confirmDismiss=!0,this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0)}configureTextInput(){let e=this.state.answers.get(this.step?.id??"");this.input.setValue(this.textDrafts.get(this.stepIndex)??e?.answer.otherText??""),this.syncInputFocus()}commitAnswer(e){if(this.onAnswer(this.stepIndex,e),Zl(this.state)){this.input.focused=!1,this.onSubmit?.();return}this.stepIndex=uF(this.state,this.stepIndex),this.mode="answer",this.configureStep()}syncInputFocus(){this.input.focused=this._focused&&this.mode==="text"&&!this.confirmDismiss&&!this.dismissing&&!this.submitting}moveStep(e){let t=this.state.request.steps.length;t!==0&&(this.rememberTextDraft(),this.stepIndex=(this.stepIndex+e+t)%t,this.mode="answer",this.configureStep())}rememberTextDraft(){this.mode!=="text"||!this.step||this.textDrafts.set(this.stepIndex,this.input.getValue())}toggleMultiChoice(e){this.multiSelected.has(e)?this.multiSelected.delete(e):this.multiSelected.add(e)}goalAutoReplyDeadline(){let e=this.state.request.expiresAt;return this.state.request.purpose==="goal"&&typeof e=="number"&&Number.isFinite(e)?e:void 0}goalAutoReplyRemainingSeconds(){let e=this.goalAutoReplyDeadline();if(e!==void 0)return Math.max(0,Math.ceil((e-this.now())/TM))}startCountdown(){let e=this.goalAutoReplyDeadline();e===void 0||e<=this.now()||!this.requestRender||(this.countdownTimer=setInterval(()=>{this.requestRender?.(),e<=this.now()&&this.stopCountdown()},TM),this.countdownTimer.unref())}stopCountdown(){this.countdownTimer&&(clearInterval(this.countdownTimer),this.countdownTimer=void 0)}};function tF(n,e){let t=n===0?`${h.hex(d.orbit)("\u25F7")} ${h.hex(d.muted)("Time is up \xB7 applying the recommended option\u2026")}`:`${h.hex(d.orbit)("\u25F7")} ${h.hex(d.muted)("Auto-continue in ")}${h.bold.hex(d.text)(nF(n))}${h.hex(d.muted)(" with the recommended option")}`;return new Se(t,0,0).render(e)}function nF(n){let e=Math.floor(n/yM),t=n%yM;return`${e}:${t.toString().padStart(2,"0")}`}function iF(n,e){if(n.request.presentation?.showProgress===!1)return;let t=n.request.steps.length;return t<=1?`${Math.min(t,e+1)} of ${t}`:`${n.answers.size}/${t} answered`}function sF(n,e,t){if(n.request.presentation?.showProgress===!1||n.request.steps.length<=1||t<52)return[];let i=n.request.steps,s=Math.max(1,Math.min(i.length,Math.floor((t+1)/19))),r=Math.max(0,Math.min(e-Math.floor(s/2),i.length-s)),o=Math.min(i.length,r+s),a=t-(r>0?2:0)-(o<i.length?2:0),u=Math.max(8,Math.min(18,Math.floor((a-s+1)/s))),l=i.slice(r,o).map((m,g)=>{let T=r+g,y=x(m.header??`Question ${T+1}`).trim(),b=T===e?"\u25CF":n.answers.has(m.id)?"\u2713":"\u25CB",S=E(y,Math.max(1,u-4),""),M=` ${b} ${S} `,R=`${M}${" ".repeat(Math.max(0,u-C(M)))}`;return T===e?mt(` ${h.bold.hex(d.signal)(b)} ${h.bold.hex(d.signal)(S)} `,u,h.bgHex(d.userMessageBg)):n.answers.has(m.id)?h.hex(d.success)(R):h.hex(d.dim)(R)}),c=r>0?h.hex(d.dim)("\u2026 "):"",p=o<i.length?h.hex(d.dim)(" \u2026"):"";return[`${c}${l.join(" ")}${p}`]}function bM(n){let e=x(n.label),t=n.description?x(n.description):void 0,i=n.focused?`${h.bold.hex(d.signal)(n.prefix)}${h.bold.hex(d.signal)(e)}`:h.hex(d.text)(`${n.prefix}${e}`),s=C(n.prefix),r=!!t&&n.width>=64&&n.width-s-n.labelColumnWidth>=24;if(t&&r){let a=Math.max(1,n.width-s-n.labelColumnWidth-2),u=Y(t,a),l=" ".repeat(Math.max(0,n.labelColumnWidth-C(e))),c=" ".repeat(s+n.labelColumnWidth+2);return u.map((p,m)=>{let g=m===0?`${i}${l} ${h.hex(d.muted)(p)}`:`${c}${h.hex(d.muted)(p)}`;return qd(g,n.width,n.focused)})}let o=[qd(i,n.width,n.focused)];if(t){let a=Math.max(1,n.width-s);for(let u of Y(t,a))o.push(qd(`${" ".repeat(s)}${h.hex(d.muted)(u)}`,n.width,n.focused))}return o}function vM(n,e){let t=Math.max(0,...n.map(i=>C(x(i))));return Math.min(t,Math.max(12,Math.floor(e*.32)))}function qd(n,e,t){let i=Et(n,e);return t?mt(i,e,h.bgHex(d.userMessageBg)):i}function Et(n,e){return E(n,Math.max(0,e),"")}function rF(n,e,t){if(t===void 0||n.length<=t)return{items:n,start:0,end:n.length};let i=Math.max(1,t-2),s=Math.max(0,Math.min(e-Math.floor(i/2),n.length-i)),r=Math.min(n.length,s+i);return{items:n.slice(s,r),start:s,end:r}}function oF(n,e){if(n.length<=e)return[...n];let t=new Set,i=Math.min(5,Math.max(1,e-3)),s=Math.min(2,Math.max(0,e-i));for(let o=0;o<i;o+=1)t.add(o);for(let o=Math.max(i,n.length-s);o<n.length;o+=1)t.add(o);let r=n.findIndex(o=>/[›→]/u.test(ge(o)));if(r>=0)for(let o=0;t.size<e;o+=1){let a=r-o,u=r+o;if(a>=i&&a<n.length-s&&t.add(a),u>=i&&u<n.length-s&&t.add(u),a<i&&u>=n.length-s)break}for(let o=i;t.size<e&&o<n.length-s;o+=1)t.add(o);return[...t].sort((o,a)=>o-a).slice(0,e).map(o=>n[o]??"")}function H1(n){return n===1||n==="multiple"}function U1(n){return n.request.steps.length>1&&n.request.presentation?.allowBackNavigation!==!1}function SM(n,e,t){let i=/Enter (?:send|next)/u.exec(e)?.[0]??"Enter",s=`${e}${t?" \xB7 Tab/\u2190/\u2192 questions":""} \xB7 Esc cancel`,r=`${e} \xB7 Esc cancel`,o=`${i} \xB7 Esc cancel`,a="Enter \xB7 Esc cancel",u="Enter \xB7 Esc";return[s,r,o,a,u].find(l=>C(l)<=n)??u}function K1(n,e){return n.request.steps.every(t=>t.id===e||n.answers.has(t.id))}function aF(n){let e=n.request.steps.findIndex(t=>!n.answers.has(t.id));return e>=0?e:Math.max(0,n.request.steps.length-1)}function uF(n,e){let t=n.request.steps.length;for(let i=1;i<=t;i+=1){let s=(e+i)%t,r=n.request.steps[s];if(r&&!n.answers.has(r.id))return s}return Math.max(0,Math.min(e,t-1))}var lF=new Map([["QUESTIONNAIRE_NOT_FOUND","Question is no longer available."],["QUESTIONNAIRE_ALREADY_ANSWERED","Answered on another surface."],["QUESTIONNAIRE_NOT_PENDING","Question is no longer pending."],["SESSION_NOT_FOUND","Session is no longer available."]]);function Oa(n){let e=gc(n)&&typeof n.code=="string"?n.code:void 0,t=e?lF.get(e):void 0;return e&&t?{status:"terminal",code:e,detail:t}:{status:"retryable",...e?{code:e}:{}}}var Hd=class{constructor(e){this.dependencies=e}state;async reply(e,t){let{controller:i,runtime:s}=this.dependencies,r=e.sessionId??i.snapshot().session?.sessionId;this.state=r?{requestId:e.request.id,sessionId:r,finished:!1}:void 0,this.updateTranscript(e.request.id,{status:"pending",detail:"Sending your answer\u2026",updatedAtMs:Date.now()}),this.render();let o;try{o=await s.replyQuestionnaire(e.agentName??e.request.requester?.agentName??vi,e.request.id,ec(e,{skipUnanswered:t}))}catch(u){if(!this.isSessionActive(r))return this.clear(e.request.id),{ok:!1,finished:!1};let l=Oa(u);if(l.status==="terminal"){let c=this.dependencies.transcript.get(`question:${e.request.id}`);this.clear(e.request.id),r&&await i.refreshSessionMetadata(r).catch(()=>{});let p=Date.now();return this.dependencies.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:"resolved",title:c?.title??e.request.title??"Agent needs input",content:c?.content??Ar(e),detail:l.detail,ephemeral:!0,createdAtMs:c?.createdAtMs??p,updatedAtMs:p}),this.render(),{ok:!0,finished:!0}}throw this.restoreRetryableQuestion(e),u}if(!this.isSessionActive(r))return this.clear(e.request.id),{ok:o,finished:!1};if(!o)return this.restoreRetryableQuestion(e),{ok:!1,finished:!1};let a=this.finished(e.request.id);return a||this.updateTranscript(e.request.id,{status:"resolved",detail:"Answer sent \xB7 MCode is continuing\u2026",updatedAtMs:Date.now()}),{ok:!0,finished:a}}clear(e){e&&this.state?.requestId!==e||(this.state=void 0)}isActive(e){return this.state?.requestId===e&&!this.state.finished}async handleEvent(e,t){if(this.state?.sessionId!==t||e.sessionId!==t)return!1;if(e.type==="session.start")return!e.turnId||this.state.turnId&&this.state.turnId!==e.turnId||(this.state.turnId=e.turnId,this.dependencies.updateChrome()),!1;if(!cF(e)||!this.state.turnId||e.turnId!==this.state.turnId)return!1;let i=this.state.requestId;if(this.state.finished=!0,await this.dependencies.controller.refreshSessionMetadata(t).catch(()=>{}),!this.isSessionActive(t))return!0;let s=this.dependencies.transcript.get(`question:${i}`);return s?.ephemeral&&this.dependencies.transcript.upsert({id:s.id,detail:void 0,updatedAtMs:Date.now()}),this.dependencies.hasActiveQuestionnaire()||this.clear(),this.render(),!0}restoreRetryableQuestion(e){this.clear(e.request.id),this.updateTranscript(e.request.id,{status:"blocked",title:e.request.title||"Agent needs input",detail:"Answer could not be sent \xB7 retry",updatedAtMs:Date.now()}),this.render()}finished(e){return this.state?.requestId===e&&this.state.finished}updateTranscript(e,t){let i=`question:${e}`;this.dependencies.transcript.get(i)&&this.dependencies.transcript.upsert({id:i,...t})}render(){this.dependencies.updateChrome(),this.dependencies.requestRender()}isSessionActive(e){return!this.dependencies.isStopped?.()&&!!e&&this.dependencies.controller.snapshot().session?.sessionId===e}};function cF(n){return n.type==="session.finish"||n.type==="session.error"||n.type==="session.abort"}var Ud=["Agree and start implementation","Skip for now","Add context to revise"],Na=class{constructor(e,t,i){this.onAction=t;this.requestRender=i;this.reviewDescription=e.request.steps.find(s=>s.id==="plan-review")?.description?.trim(),this.input.onSubmit=s=>{let r=s.trim();!r||this.submittingLabel||(this.beginSubmitting("Sending feedback\u2026"),this.onAction({kind:"feedback",text:r}))},this.input.onEscape=()=>{this.mode="review",this.syncInputFocus(),this.requestRender()}}reviewDescription;input=new ze;_focused=!1;mode="review";selectedIndex=0;submittingLabel;optionRows=[];get focused(){return this._focused}set focused(e){this._focused=e,this.syncInputFocus()}handleInput(e){if(!this.submittingLabel){if(this.mode==="feedback"){this.input.handleInput(e);return}if(v(e,"up")){this.selectedIndex=this.selectedIndex===0?Ud.length-1:this.selectedIndex-1,this.requestRender();return}if(v(e,"down")){this.selectedIndex=(this.selectedIndex+1)%Ud.length,this.requestRender();return}if(v(e,"enter")){this.confirmSelection();return}v(e,"escape")&&(this.beginSubmitting("Skipping review\u2026"),this.onAction({kind:"skip"}))}}confirmSelection(){if(this.selectedIndex===0){this.beginSubmitting("Starting implementation\u2026"),this.onAction({kind:"approve"});return}if(this.selectedIndex===1){this.beginSubmitting("Skipping review\u2026"),this.onAction({kind:"skip"});return}this.mode="feedback",this.syncInputFocus(),this.requestRender()}beginSubmitting(e){this.submittingLabel=e,this.syncInputFocus(),this.requestRender()}restore(){this.submittingLabel=void 0,this.syncInputFocus(),this.requestRender()}invalidate(){this.input.invalidate()}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t);return this.submittingLabel?(this.optionRows=[],Fe({title:"Plan Review",body:[h.bold.hex(d.text)(this.submittingLabel),h.hex(d.muted)("Waiting for Runtime to commit the decision.")]},t,"signal")):this.mode==="feedback"?(this.optionRows=[],Fe({title:"Add context",body:[G("Tell MiniMax Code what to adjust, then press Enter."),...this.input.render(i)],footer:"Enter send \xB7 Esc back"},t,"signal")):[...this.renderReviewFrame(t)]}handleMouse(e){let t=e.button==="primary"||e.action==="release"&&e.button==="none";if(this.mode!=="review"||this.submittingLabel||!t)return!1;let i=this.optionRows.indexOf(e.y);return i<0?!1:(this.selectedIndex=i,e.action==="release"?this.confirmSelection():this.requestRender(),!0)}syncInputFocus(){this.input.focused=this._focused&&this.mode==="feedback"&&this.submittingLabel===void 0}renderReviewFrame(e){let t=this.reviewDescription?[h.hex(d.warning)(this.reviewDescription),""]:[],i=[...t,h.bold.hex(d.text)("Plan complete. What would you like to do?"),...Ud.map((o,a)=>dF(o,a===this.selectedIndex))],r=(e<12?0:1)+t.length+1;return this.optionRows=Ud.map((o,a)=>r+a),Fe({title:"Plan Review",meta:h.hex(d.muted)("Full plan above \xB7 frozen snapshot"),body:i,footer:"\u2191/\u2193 select \xB7 Enter confirm \xB7 Esc skip"},e,"signal")}};function W1(n){return n.request.mode==="plan"&&!!n.request.modePayload?.planReview}function dF(n,e){return e?`${h.bold.hex(d.signal)("\u203A")} ${h.bold.hex(d.text)(n)}`:` ${h.hex(d.muted)(n)}`}var Kd=class{constructor(e,t,i=()=>{}){this.onClose=t;this.requestRender=i;let s=e.request.modePayload?.planReview;this.markdown=new ft(s?.markdown??"",0,0,Tt),this.path=x(s?.path??"")}markdown;path;viewportOffset=0;viewportRows=0;viewportLineCount=0;handleInput(e){ie().matches(e,"tui.select.cancel")&&this.onClose()}invalidate(){this.markdown.invalidate()}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t),s=this.markdown.render(i).map(r=>E(r,i));return this.renderFrame(t,s)}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];let r=Ze(i),o=this.markdown.render(r).map(c=>E(c,r)),a=this.renderFrame(i,o);if(a.length<=s)return this.viewportOffset=0,this.viewportRows=o.length,this.viewportLineCount=o.length,a;let u=this.renderFrame(i,[],["Lines 1-1 of 1 \xB7 PgUp/PgDn scroll"]).length;if(u>=s)return s===1?[a[0]??""]:[...a.slice(0,s-1),a.at(-1)??""];this.viewportRows=s-u,this.viewportLineCount=o.length,this.viewportOffset=CM(this.viewportOffset,0,Math.max(0,o.length-this.viewportRows));let l=Math.min(o.length,this.viewportOffset+this.viewportRows);return this.renderFrame(i,o.slice(this.viewportOffset,l),[`Lines ${String(this.viewportOffset+1)}-${String(l)} of ${String(o.length)} \xB7 PgUp/PgDn scroll`]).slice(0,s)}scrollByRows(e){if(this.viewportRows===0)return 0;let t=Math.max(0,this.viewportLineCount-this.viewportRows),i=CM(this.viewportOffset+Math.trunc(e),0,t),s=i-this.viewportOffset;return s===0?0:(this.viewportOffset=i,this.requestRender(),s)}scrollByPage(e){return this.scrollByRows(e*Math.max(1,this.viewportRows-1))}renderFrame(e,t,i=[]){let s=Ze(e);return Fe({title:"Latest Plan",meta:this.path?E(this.path,s):void 0,navigation:i.map(G),body:t,footer:"Esc close"},e,"signal")}};function CM(n,e,t){return Math.max(e,Math.min(t,n))}var hF=["Continue with plan","Deny"],Wd=class{constructor(e,t,i=new Set(["confirm","decline"])){this.onAction=e;this.requestRender=t;this.availableActions=i}selectedIndex=0;submitting;handleInput(e){if(this.submitting)return;if(v(e,"up")||v(e,"down")){this.selectedIndex=this.selectedIndex===0?1:0,this.requestRender();return}let t=Qe(e)??e;if(t==="1"){this.submit("confirm");return}if(t==="2"||v(e,"escape")){this.submit("decline");return}v(e,"enter")&&this.submit(this.selectedIndex===0?"confirm":"decline")}beginSubmitting(e){this.submitting=e,this.requestRender()}restore(){this.submitting=void 0,this.requestRender()}invalidate(){}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t);return this.submitting?Fe({title:"Plan mode",body:[h.bold.hex(d.text)(this.submitting==="confirm"?"Continuing with plan\u2026":"Keeping Default mode\u2026"),h.hex(d.muted)("Waiting for MiniMax Code to continue the conversation.")]},t,"signal"):Fe({title:"Use Plan mode?",body:[E(h.hex(d.muted)("Plan mode structures complex tasks before execution."),i),"",...hF.map((s,r)=>{let o=r===0?"confirm":"decline",a=this.availableActions.has(o),u=a?s:`${s} (unavailable)`;return r===this.selectedIndex?`${h.bold.hex(d.signal)("\u203A")} ${h.bold.hex(a?d.text:d.muted)(u)}`:` ${h.hex(d.muted)(u)}`})],footer:"\u2191/\u2193 select \xB7 Enter confirm \xB7 Esc deny"},t,"signal")}submit(e){this.availableActions.has(e)&&(this.beginSubmitting(e),this.onAction(e))}};var jd=class{constructor(e){this.options=e;this.defaultAgentName=e.defaultAgentName??vi,this.agentStatusEnabled=!!(e.agentStatusLineItems&&Hi(e.agentStatusLineItems).includes("build-mode")),this.continuation=new Hd({runtime:e.runtime,controller:e.controller,transcript:e.transcript,requestRender:e.onChanged,updateChrome:e.onChanged,hasActiveQuestionnaire:()=>!!this.questionnaire(),isStopped:e.isStopped})}defaultAgentName;continuation;agentStatusEnabled;questionnaireDismissals=new Set;panel;planViewRevision=0;submittingRequestId;submittingSessionId;permission(){return this.interactions().permission}questionnaire(){return this.interactions().questionnaire}hasPending(){return!!(this.permission()||this.questionnaire())}continuesTurn(e,t){let i=this.permission();if(i){let r=i.sessionId??this.options.controller.snapshot().session?.sessionId,o=r?this.options.permissionOwnerTurnId?.(r):void 0;if(wM(r,o,e,t))return!0}let s=this.questionnaire();if(s){let r=s.sessionId??s.request.requester?.sessionId??this.options.controller.snapshot().session?.sessionId;if(wM(r,s.request.requester?.runId,e,t))return!0}return!1}agentReadback(){if(!this.agentStatusEnabled)return;let e=this.permission();if(e){if(!Da(e))return{kind:"invalid"};let i=this.options.controller.snapshot().session?.sessionId,s=e.sessionId??i,r=s?this.options.permissionOwnerTurnId?.(s):void 0;return{kind:"permission",requestId:e.requestId,submitting:this.isAgentSubmission(e.requestId),...s&&s!==i?{ownerSessionId:s,...r?{ownerTurnId:r}:{}}:{}}}let t=this.questionnaire();if(t?.request.id)return{kind:t.request.mode==="plan"?"plan":"questionnaire",requestId:t.request.id,submitting:this.isAgentSubmission(t.request.id)}}deactivate(){this.planViewRevision+=1,this.clearAgentSubmission(),this.continuation.clear(),this.hidePanel(),this.options.onChanged()}replaceFromActiveSession(){this.planViewRevision+=1;let e=this.permission()?.requestId??this.questionnaire()?.request.id;(this.submittingRequestId!==e||this.submittingSessionId!==this.options.stateStore.snapshot().activeSessionId)&&this.clearAgentSubmission(),this.hidePanel(),this.showPending(),this.options.onChanged()}setQuestionnaire(e,t,i){if(this.isStopped())return;let s=Cs(e,t,i),r=t??this.options.controller.snapshot().session?.sessionId,o=r?Tn(this.options.stateStore.snapshot(),r)?.interactions.questionnaire:void 0;r&&this.options.stateStore.dispatch({type:"interaction/questionnaireReceived",sessionId:r,questionnaire:s}),o&&o.request.id!==e.id&&this.clearPlanReviewBody(o.request.id);let a=r===this.options.stateStore.snapshot().activeSessionId?this.questionnaire():r?Tn(this.options.stateStore.snapshot(),r)?.interactions.questionnaire:void 0;a?.request.id===e.id&&this.projectQuestionnaire(a,o?.request.id!==e.id)}projectQuestionnaire(e,t=!0){let i=Date.now(),s=this.options.transcript.get(`question:${e.request.id}`),r=this.createdAtOrNow(e.request.createdAt,i);this.projectPlanReviewBody(e,i),this.options.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:s?.status??"blocked",title:s?.title??e.request.title??"Agent needs input",content:s?.content??"",detail:s?.detail,turnId:s?.turnId??e.request.requester?.runId,createdAtMs:s?.createdAtMs??r,updatedAtMs:i}),t&&!this.continuation.isActive(e.request.id)&&this.showQuestionnairePicker(),this.notifyPendingInteraction("question-required",`question:${e.request.id}`)}planReviewBodyId(e){return`plan-review-body:${e}`}projectPlanReviewBody(e,t){if(!e.request.modePayload?.planReview)return;let i=e.request.modePayload.planReview.markdown.trim()||"_Plan preview unavailable._",s=this.planReviewBodyId(e.request.id),r=this.options.transcript.get(s);this.options.transcript.upsert({id:s,kind:"question",status:"blocked",title:"Plan Review",content:i,contentFormat:"markdown",ephemeral:!0,turnId:r?.turnId??e.request.requester?.runId,createdAtMs:r?.createdAtMs??t,updatedAtMs:t})}clearPlanReviewBody(e){this.options.transcript.remove(this.planReviewBodyId(e))}setPermission(e,t){if(this.isStopped()||!Da(e))return;let i=e.sessionId??this.options.controller.snapshot().session?.sessionId,s=t??i;s&&this.options.stateStore.dispatch({type:"interaction/permissionReceived",sessionId:s,permission:e});let r=Date.now(),o=this.createdAtOrNow(e.createdAt,r);this.options.transcript.upsert({id:`permission:${e.requestId}`,kind:"permission",status:"blocked",title:x(e.toolName??"Tool action"),content:lM(e),createdAtMs:o,updatedAtMs:r}),this.showPermissionPicker(),this.notifyPendingInteraction("permission-required",`permission:${e.requestId}`)}async recover(e){if(this.isStopped())return;this.hidePanel();let t=Tn(this.options.stateStore.snapshot(),e),i=t?.permissionRevision??0,s=t?.questionnaireRevision??0,r=t?.interactions.questionnaire,o=this.resolveSessionAgentName(e),[a,u]=await Promise.allSettled([this.options.runtime.getPendingQuestionnaire(o,e),this.options.runtime.listPendingPermissions()]);if(this.isStopped()||this.options.controller.snapshot().session?.sessionId!==e)return;let l={type:"interaction/snapshotReconciled",sessionId:e,expectedPermissionRevision:i,expectedQuestionnaireRevision:s},c,p=u.status==="fulfilled"&&(Tn(this.options.stateStore.snapshot(),e)?.permissionRevision??0)===i;if(u.status==="fulfilled"){let g=this.permissionSessionScope(e);c=u.value.find(T=>T.sessionId!==void 0&&g.has(T.sessionId)),l.permission=c??null}let m=a.status==="fulfilled"&&(Tn(this.options.stateStore.snapshot(),e)?.questionnaireRevision??0)===s;if(a.status==="fulfilled"){let g=a.value;l.questionnaire=g?Cs(g,e,g.requester?.agentName??o):null}if(this.options.stateStore.dispatch(l),m&&a.status==="fulfilled"){let g=a.value;if(g){let T=Tn(this.options.stateStore.snapshot(),e)?.interactions.questionnaire;T?.request.id===g.id&&this.projectQuestionnaire(T)}else r&&(this.clearPlanReviewBody(r.request.id),this.updateQuestionTranscript(r.request.id,{status:"resolved",detail:"Question is no longer pending.",updatedAtMs:Date.now()}))}if(u.status==="fulfilled"){let g=Tn(this.options.stateStore.snapshot(),e)?.interactions.permission;p&&c&&!Da(c)&&this.options.append("The Runtime returned a pending permission without a request id. Restart the Session or retry the task.","error"),p&&c&&Da(c)&&g&&g.requestId===c.requestId&&this.setPermission(g,e)}this.showPending(),this.options.onChanged()}showPending(){if(this.isStopped())return;let e=this.permission();e&&Da(e)?this.showPermissionPicker():e?this.hidePanel():this.questionnaire()?this.showQuestionnairePicker():this.hidePanel()}async showLatestPlanReview(){if(this.isStopped())return;if(this.hasPending()){this.showPending();return}let e=this.options.controller.snapshot().session;if(!e?.sessionId){this.options.append("Start or resume a Session before viewing its Plan.","warning");return}let t=++this.planViewRevision,i=e.agentName??this.defaultAgentName,s;try{s=await this.options.runtime.getLatestPlanReview(i,e.sessionId)}catch(a){!this.isStopped()&&t===this.planViewRevision&&this.options.controller.snapshot().session?.sessionId===e.sessionId&&this.options.append(L(a,{summary:"Couldn't load the latest Plan.",nextStep:"Retry /plan view."}),"error");return}if(this.isStopped()||t!==this.planViewRevision||this.options.controller.snapshot().session?.sessionId!==e.sessionId)return;if(this.hasPending()){this.showPending();return}if(!s){this.options.append("No Plan has been produced for this Session yet.","warning");return}let r=Cs(s,e.sessionId,i);if(!W1(r)){this.options.append("The latest Plan snapshot is unavailable.","warning");return}this.hidePanel();let o=new Kd(r,()=>{this.panel===o&&this.hidePanel(),this.options.onChanged()},this.options.onChanged);this.panel=o,this.options.surface.show(o),this.options.onChanged()}closeOwnedPanel(e){e===this.panel&&(this.panel=void 0)}ownsPendingPanel(e){return e===this.panel&&this.hasPending()}async handleCommand(e){let t=TC(e),s={"/allow":"allowOnce","/always":"allowAlways","/deny":"deny"}[e.toLocaleLowerCase()],r=t!==void 0||e==="/ask-send"||e==="/ask-cancel";if(this.permission()&&r)return this.options.append("Resolve the pending permission in the decision panel first.","warning"),this.showPermissionPicker(),!0;if(this.questionnaire()&&!this.permission()&&s)return this.options.append("Answer the pending Agent question in the decision panel first.","warning"),this.showQuestionnairePicker(),!0;let o=this.questionnaire();if(o?.request.mode==="plan"&&r)return this.options.append("Use the pending Plan decision panel first.","warning"),this.showQuestionnairePicker(),!0;if(t){let a=o;return a?await this.handleQuestionnaireAnswer(a,t.index,t.text):this.options.append("No pending questionnaire."),!0}if(e==="/ask-send"){let a=this.questionnaire();return a?await this.submitQuestionnaire(a,!0):this.options.append("No pending questionnaire."),!0}if(e==="/ask-cancel"){let a=this.questionnaire();return a?await this.requestQuestionnaireDismissal(a):this.options.append("No pending questionnaire."),!0}return s?(await this.replyPermission(s),!0):!1}async handleRuntimeEvent(e,t){if(this.isStopped())return!1;let i=e.type==="permission.ask"?e.request.sessionId??e.sessionId:e.sessionId;if(e.type==="permission.ask"&&e.request.sessionId&&e.sessionId&&e.request.sessionId!==e.sessionId)return!1;let s=e.type==="permission.ask"||e.type==="permission.resolved"?this.permissionPresentationSessionId(i,t):void 0;if(e.sessionId!==t&&!s)return!1;if(await this.continuation.handleEvent(e,t))return!0;if(this.isStopped())return!1;if(e.type==="questionnaire.ask")return this.setQuestionnaire(e.request,t,e.agentName),!0;if(e.type==="questionnaire.dismiss"||e.type==="questionnaire.superseded"){let r=this.questionnaire();return e.requestId&&this.clearPlanReviewBody(e.requestId),e.requestId&&r?.request.id===e.requestId&&(this.updateQuestionTranscript(e.requestId,{status:"resolved",detail:e.type==="questionnaire.dismiss"?"Dismissed.":"Superseded.",updatedAtMs:Date.now()}),this.resolveQuestionnaire(r)),!0}if(e.type==="permission.ask")return this.setPermission(e.request,s??t),!0;if(e.type==="permission.resolved"){let r=this.permission(),o=this.options.transcript.get(`permission:${e.requestId}`);if(o){let a=r?.requestId===e.requestId?r:{requestId:e.requestId,toolName:o.title};this.options.transcript.upsert({id:`permission:${e.requestId}`,status:"resolved",detail:e.decision?$d(a,e.decision):o.status==="resolved"&&o.detail?o.detail:"Permission request closed.",updatedAtMs:Date.now()})}return e.requestId&&r?.requestId===e.requestId&&(this.resolvePermission(r,t),await this.showNextPendingPermission(t,e.requestId)||this.showQuestionnairePicker()),!0}return!1}interactions(){return kd(this.options.stateStore.snapshot())?.interactions??{}}hidePanel(){let e=this.panel;this.panel=void 0,e&&this.options.surface.close(e)}showPermissionPicker(){if(this.isStopped())return;let e=this.permission();if(!e)return;this.hidePanel();let t=new _a(e,(i,s)=>{t.beginSubmitting(i),this.options.onChanged(),this.replyPermission(i,s).catch(r=>{this.isStopped()||this.options.append(L(r,{summary:"Couldn't send your permission choice.",nextStep:"Retry.",preservation:"The request remains open."}),"error")})},this.options.stopTurn);this.panel=t,this.options.surface.show(t)}showQuestionnairePicker(){if(this.isStopped())return;let e=this.questionnaire();if(!e||this.permission())return;if(W1(e)){this.showPlanReview(e);return}if(pF(e)){this.showPlanEntry(e);return}this.hidePanel();let t=new Jr(e,(i,s)=>{this.handleQuestionnaireAnswer(e,i,s,{interactive:!0}).catch(r=>{this.isStopped()||this.options.append(L(r,{summary:"Couldn't save that answer.",nextStep:"Retry.",preservation:"The question remains open."}),"error")})},()=>{this.requestQuestionnaireDismissal(e).catch(i=>{this.isStopped()||this.options.append(L(i,{summary:"Couldn't dismiss this question.",nextStep:"Retry.",preservation:"It remains open."}),"error")})},{requestRender:this.options.onChanged,onSubmit:()=>{t.beginSubmitting(),this.submitQuestionnaire(e,!1).catch(i=>{this.isStopped()||this.options.append(L(i,{summary:"Couldn't send your answers.",nextStep:"Retry.",preservation:"The question remains open."}),"error")})},onDismiss:()=>{this.requestQuestionnaireDismissal(e).catch(i=>{this.isStopped()||this.options.append(L(i,{summary:"Couldn't dismiss this question.",nextStep:"Retry.",preservation:"It remains open."}),"error")})}});this.questionnaireDismissals.has(e.request.id)&&t.beginDismiss(),this.panel=t,this.options.surface.show(t)}showPlanEntry(e){this.hidePanel();let t=e.request.steps.find(r=>r.id==="plan-enter"),i=new Set;t?.options?.some(r=>r.id==="confirm")&&i.add("confirm"),t?.options?.some(r=>r.id==="decline")&&i.add("decline");let s=new Wd(r=>{this.withAgentSubmission(e.request.id,()=>this.submitPlanEntry(e,r).catch(o=>{this.isStopped()||(this.questionnaire()?.request.id===e.request.id&&s.restore(),this.options.append(L(o,{summary:"Couldn't apply that Plan Mode decision.",nextStep:"Retry from the Plan Mode confirmation.",preservation:"The confirmation remains open."}),"error"))}))},this.options.onChanged,i);this.panel=s,this.options.surface.show(s)}async submitPlanEntry(e,t){let i=e.request.steps.find(o=>o.id==="plan-enter"),s=i?.options?.find(o=>o.id===t);if(!i||!s)throw new Error("The Runtime Plan entry confirmation is malformed.");if(e.answers.set(i.id,{stepId:i.id,rawText:s.label,answer:{stepId:i.id,selectedOptionIds:[t],selectedOther:!1}}),!await this.submitPlanQuestionnaire(e,t==="confirm"?"Plan Mode decision sent.":"Default Mode decision sent."))throw new Error("Runtime did not accept the Plan Mode decision.")}showPlanReview(e){this.hidePanel();let t=new Na(e,i=>{this.withAgentSubmission(e.request.id,()=>this.submitPlanReview(e,i).catch(s=>{this.isStopped()||this.appendPlanReviewFailure(s)}))},this.options.onChanged);this.panel=t,this.options.surface.show(t)}async submitPlanReview(e,t){if(t.kind==="feedback"){await this.submitPlanReviewFeedback(e,t.text);return}let i=e.sessionId??this.options.controller.snapshot().session?.sessionId,s=xM(e),r=t.kind==="approve"?{stepId:s,selectedOptionIds:["approve"],selectedOther:!1}:{stepId:s,selectedOptionIds:[],selectedOther:!1,skipped:!0};e.answers.set(s,{stepId:s,rawText:t.kind==="approve"?"Approve":"",answer:r});let o=t.kind==="approve"?"Approved \xB7 implementation queued":"Plan skipped \xB7 remaining in Plan Mode",a;try{a=await this.submitPlanQuestionnaire(e,o,"")}catch(u){if(!this.isActiveSession(i))return;throw this.restorePlanReview(e),u}if(this.isActiveSession(i)&&!a)throw this.restorePlanReview(e),new Error("Runtime did not accept the Plan review decision.")}async submitPlanReviewFeedback(e,t){let i=e.sessionId??this.options.controller.snapshot().session?.sessionId,s=xM(e),r=x(t).trim();e.answers.set(s,{stepId:s,rawText:r,answer:{stepId:s,selectedOptionIds:[],selectedOther:!0,otherText:r}}),this.updateQuestionTranscript(e.request.id,{title:"Plan Review",content:r,ephemeral:!0,updatedAtMs:Date.now()});let o;try{o=await this.submitPlanQuestionnaire(e,"Feedback sent \xB7 continuing in Plan Mode",r)}catch(a){throw this.isActiveSession(i)&&this.restorePlanReview(e),a}if(this.isActiveSession(i)&&!o)throw this.restorePlanReview(e),new Error("Runtime did not accept the Plan feedback.")}async submitPlanQuestionnaire(e,t,i=Ar(e)){let s=e.sessionId??this.options.controller.snapshot().session?.sessionId;this.updateQuestionTranscript(e.request.id,{status:"pending",title:e.request.modePayload?.planReview?"Plan Review":"Plan Mode",content:i,detail:"Sending your decision\u2026",ephemeral:!0,updatedAtMs:Date.now()});let r;try{r=await this.options.runtime.replyQuestionnaire(e.agentName??e.request.requester?.agentName??this.defaultAgentName,e.request.id,ec(e,{skipUnanswered:!1}))}catch(o){if(!this.isActiveSession(s))return!1;let a=Oa(o);if(a.status==="terminal")return await this.settleTerminalPlanQuestionnaire(e,a.detail),!0;throw o}return r&&this.clearPlanReviewBody(e.request.id),this.isActiveSession(s)?r?(s&&await this.options.controller.refreshSessionMetadata(s).catch(()=>{}),this.isActiveSession(s)&&(this.updateQuestionTranscript(e.request.id,{status:"resolved",title:e.request.modePayload?.planReview?"Plan Review":"Plan Mode",content:i,detail:t,ephemeral:!0,updatedAtMs:Date.now()}),this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),this.options.onChanged()),!0):!1:r}restorePlanReview(e){if(this.questionnaire()?.request.id===e.request.id){if(this.panel instanceof Na){this.panel.restore();return}this.showPlanReview(e)}}async settleTerminalPlanQuestionnaire(e,t){let i=e.sessionId??this.options.controller.snapshot().session?.sessionId;if(this.clearPlanReviewBody(e.request.id),!this.isActiveSession(i))return;let s=this.options.transcript.get(`question:${e.request.id}`);if(this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),i&&await this.options.controller.refreshSessionMetadata(i).catch(()=>{}),!this.isActiveSession(i))return;let r=Date.now();this.options.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:"resolved",title:e.request.modePayload?.planReview?"Plan Review closed":"Plan Mode decision closed",content:s?.content??"",detail:t,createdAtMs:s?.createdAtMs??r,updatedAtMs:r}),this.options.onChanged()}appendPlanReviewFailure(e){this.options.append(L(e,{summary:"Couldn't apply that Plan decision.",nextStep:"Retry from the Plan Review panel.",preservation:"The frozen Plan remains pending."}),"error")}async handleQuestionnaireAnswer(e,t,i,s={}){let r=yC(e,t,i);if(!r.ok){this.options.append(r.message,"warning"),this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker();return}this.updateQuestionTranscript(e.request.id,{content:Ar(e),detail:`${e.answers.size} of ${e.request.steps.length} answered`,updatedAtMs:Date.now()}),Zl(e)?s.interactive||await this.submitQuestionnaire(e,!1):s.interactive||this.showQuestionnairePicker()}requestQuestionnaireDismissal(e){return this.withAgentSubmission(e.request.id,()=>this.settleQuestionnaireDismissal(e))}async settleQuestionnaireDismissal(e){let t=e.request.id;if(!this.questionnaireDismissals.has(t)){if(this.questionnaireDismissals.add(t),this.questionnaire()?.request.id===t){let i=this.panel;i instanceof Jr&&i.beginDismiss()}this.options.onChanged();try{await this.dismissQuestionnaire(e)}finally{this.questionnaireDismissals.delete(t),this.questionnaire()?.request.id===t?this.showQuestionnairePicker():this.options.onChanged()}}}async dismissQuestionnaire(e){let t=e.sessionId??this.options.controller.snapshot().session?.sessionId,i;try{i=await this.options.runtime.dismissQuestionnaire(e.agentName??e.request.requester?.agentName??this.defaultAgentName,e.request.id)}catch(r){if(!this.isActiveSession(t))return;let o=Oa(r);if(o.status!=="terminal")throw this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker(),r;let a=this.options.transcript.get(`question:${e.request.id}`);if(this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),t&&await this.options.controller.refreshSessionMetadata(t).catch(()=>{}),!this.isActiveSession(t))return;let l=Date.now();this.options.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:"resolved",title:"Question closed",content:a?.content??"",detail:o.detail,createdAtMs:a?.createdAtMs??l,updatedAtMs:l}),this.options.onChanged();return}if(!this.isActiveSession(t))return;if(!i){this.options.append("Couldn't dismiss this question. It remains open; retry.","error"),this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker();return}let s=this.questionnaire()?.request.id===e.request.id;e.request.mode==="plan"&&t&&await this.options.controller.refreshSessionMetadata(t).catch(()=>{}),this.updateQuestionTranscript(e.request.id,{status:"resolved",title:"Question dismissed",content:"",detail:void 0,updatedAtMs:Date.now()}),s?this.resolveQuestionnaire(e):this.options.onChanged()}submitQuestionnaire(e,t){return this.withAgentSubmission(e.request.id,()=>this.settleQuestionnaireSubmission(e,t))}async settleQuestionnaireSubmission(e,t){let i=e.sessionId??this.options.controller.snapshot().session?.sessionId;this.updateQuestionTranscript(e.request.id,{title:"Answers sent",content:Ar(e),ephemeral:!0,updatedAtMs:Date.now()});let s;try{s=await this.continuation.reply(e,t)}catch(o){throw this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker(),o}if(!this.isActiveSession(i))return;if(!s.ok){this.options.append("Couldn't send your answers. The question remains open; retry.","error"),this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker();return}e.request.mode==="plan"&&i&&await this.options.controller.refreshSessionMetadata(i).catch(()=>{}),this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),s.finished&&this.continuation.clear(e.request.id),this.options.onChanged()}replyPermission(e,t){let i=this.permission();if(!i?.requestId)return this.options.append("No pending permission request."),Promise.resolve();let s=i.requestId;return e==="allowAlways"&&i.allowAlwaysSupported===!1?(this.options.append("This action cannot be remembered; choose Allow for this conversation or Deny.","warning"),this.showPermissionPicker(),Promise.resolve()):this.withAgentSubmission(s,()=>this.settlePermissionSubmission(i,s,e,t))}async settlePermissionSubmission(e,t,i,s){let r=this.options.controller.snapshot().session?.sessionId,o;try{o=await this.options.runtime.replyPermission(e.agentName??this.defaultAgentName,t,i)}catch(u){if(!this.isActiveSession(r))return;throw this.permission()?.requestId===t&&this.showPermissionPicker(),u}if(!this.isActiveSession(r)){o&&r&&this.options.stateStore.dispatch({type:"interaction/permissionResolved",sessionId:r,requestId:t});return}if(!o){if(this.permission()?.requestId!==t)return;let u=await this.options.runtime.listPendingPermissions().catch(()=>{});if(u&&!u.some(l=>l.requestId===t)){this.options.transcript.upsert({id:`permission:${t}`,status:"resolved",detail:"Resolved on another surface.",updatedAtMs:Date.now()}),this.resolvePermission(e,r),await this.showNextPendingPermission(r,t)||this.showQuestionnairePicker();return}this.options.append("Couldn't send your permission choice. The request remains open; retry.","error"),this.permission()?.requestId===t&&this.showPermissionPicker();return}let a=this.permission()?.requestId===t;if(this.options.transcript.upsert({id:`permission:${t}`,status:"resolved",detail:s?`${$d(e,i)} \xB7 Guidance: ${x(s)}`:$d(e,i),updatedAtMs:Date.now()}),!!a){if(this.resolvePermission(e,r),i==="deny"&&s&&this.options.deliverPermissionFeedback)try{await this.options.deliverPermissionFeedback(`Regarding the denied ${x(e.toolName??"tool")} action: ${x(s)}`)}catch(u){this.options.append(L(u,{summary:"The action was denied, but your guidance wasn't sent.",nextStep:"Send it as a new message if needed."}),"warning")}await this.showNextPendingPermission(r,t)||this.showQuestionnairePicker()}}withAgentSubmission(e,t){if(!this.agentStatusEnabled)return t();let i=this.options.stateStore.snapshot().activeSessionId;return this.submittingRequestId=e,this.submittingSessionId=i,this.options.onChanged(),t().finally(()=>{this.submittingRequestId===e&&this.submittingSessionId===i&&(this.clearAgentSubmission(),this.options.onChanged())})}isAgentSubmission(e){return this.submittingRequestId===e&&this.submittingSessionId===this.options.stateStore.snapshot().activeSessionId}clearAgentSubmission(){this.submittingRequestId=void 0,this.submittingSessionId=void 0}resolveQuestionnaire(e){let t=e.sessionId??this.options.controller.snapshot().session?.sessionId;this.clearPlanReviewBody(e.request.id),t&&this.options.stateStore.dispatch({type:"interaction/questionnaireResolved",sessionId:t,requestId:e.request.id}),this.permission()||this.hidePanel(),this.options.onChanged()}resolvePermission(e,t){let i=t??this.options.controller.snapshot().session?.sessionId;i&&e.requestId&&this.options.stateStore.dispatch({type:"interaction/permissionResolved",sessionId:i,requestId:e.requestId}),this.hidePanel(),this.options.onChanged()}async showNextPendingPermission(e,t){if(!e)return!1;if(this.permission())return this.showPermissionPicker(),!0;let i=await this.options.runtime.listPendingPermissions().catch(o=>(this.options.append(L(o,{summary:"Couldn't check for the next permission request.",nextStep:"Wait for the next prompt or retry the action."}),"warning"),[]));if(!this.isActiveSession(e))return!1;if(this.permission())return this.showPermissionPicker(),!0;let s=this.permissionSessionScope(e),r=i.find(o=>o.sessionId!==void 0&&s.has(o.sessionId)&&o.requestId!==t);return r?(this.setPermission(r,e),!0):!1}permissionPresentationSessionId(e,t){if(e)return this.permissionSessionScope(t).has(e)?t:void 0}permissionSessionScope(e){let t=new Set(this.options.permissionSessionScope?.(e)??[]);return t.add(e),t}updateQuestionTranscript(e,t){let i=`question:${e}`;this.options.transcript.get(i)&&this.options.transcript.upsert({id:i,...t})}createdAtOrNow(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}notifyPendingInteraction(e,t){this.options.notify?.(e,t),this.options.onChanged()}isActiveSession(e){return!this.isStopped()&&!!e&&this.options.controller.snapshot().session?.sessionId===e}resolveSessionAgentName(e){let t=this.options.controller.snapshot();return t.session?.sessionId===e&&t.session.agentName?t.session.agentName:t.sessions.find(i=>i.sessionId===e)?.agentName??this.defaultAgentName}isStopped(){return!!this.options.isStopped?.()}};function xM(n){return n.request.steps.find(e=>e.id==="plan-review")?.id??"plan-review"}function pF(n){return n.request.mode==="plan"&&n.request.modePayload?.planReview===void 0}function wM(n,e,t,i){return n&&n!==t?!1:e===void 0||e===i}function Da(n){return!!n.requestId?.trim()}function Zr(n){return[...new Set(n.contextWindowOptions??[])].filter(e=>Number.isSafeInteger(e)&&e>0)}function eo(n){return n>=1e6&&n%1e6===0?`${n/1e6}M`:n>=1e3&&n%1e3===0?`${n/1e3}K`:String(n)}var Fa=class{constructor(e){this.options=e}fullscreenViewport=!0;handlesViewportKeys=!0;_focused=!1;scrollOffset=0;lastPageSize=1;lastMaxScrollOffset=0;get focused(){return this._focused}set focused(e){this._focused=e}handleInput(e){if(v(e,j.escape)||v(e,j.ctrl("c"))){this.options.onCancel();return}if(v(e,j.up)){this.scrollBy(-1);return}if(v(e,j.down)){this.scrollBy(1);return}if(v(e,j.pageUp)){this.scrollBy(-this.lastPageSize);return}v(e,j.pageDown)&&this.scrollBy(this.lastPageSize)}invalidate(){}render(e){return this.renderViewport(e,mF(this.options.maxRows))}renderViewport(e,t){let i=Ft(this.options.footer??"Esc close"),s=e<44?`\u2191\u2193 scroll \xB7 ${i}`:`\u2191\u2193 / PgUp/PgDn scroll \xB7 ${i}`,r=oe(e,t,s),o=this.renderBody(r.contentWidth+4,t!==void 0&&t<=12),a=o.length>r.bodyHeight,u=oe(e,t,a?s:i),l=u.bodyHeight;return this.lastMaxScrollOffset=Math.max(0,o.length-l),this.lastPageSize=Math.max(1,l),this.scrollOffset=Math.max(0,Math.min(this.scrollOffset,this.lastMaxScrollOffset)),u.render({title:Ft(this.options.title),meta:this.options.badge?_s(this.options.badge.label,this.options.badge.tone,!0):void 0,body:o.slice(this.scrollOffset,this.scrollOffset+l)})}renderBody(e,t){if(this.options.layout!=="stacked"&&e>=72&&this.options.sections.length===2)return this.renderWideBody(e,t);let i=[],s=Math.max(1,e-4);if(this.options.subtitle&&!t)for(let o of Y(h.hex(d.muted)(Ft(this.options.subtitle)),s))i.push(o);for(let o of this.options.sections){i.push(""),i.push(h.bold.hex(d.text)(Ft(o.title)));let a=o.rows.map(c=>({...c,label:Ft(c.label),value:Ft(c.value),detail:c.detail?Ft(c.detail):void 0})),u=s<44,l=Math.min(Math.max(1,...a.map(c=>C(c.label))),Math.max(1,s-16));for(let c of a){let p=c.tone??"neutral";if(u){for(let M of Y(j1(c),s))i.push(M);let b=Math.max(1,s-2),S=fF(c.value)?_s(gF(c.value,b),p):_s(c.value,p);for(let M of Y(S,b))i.push(` ${M}`);for(let M of V1(c,s-2))i.push(` ${M}`);continue}let m=E(c.label,l,"\u2026"),g=Gd(j1(c,m),l),T=Math.max(1,s-l-2),y=Y(_s(c.value,p),T);for(let[b,S]of y.entries()){let M=b===0?`${g} `:" ".repeat(l+2);i.push(`${M}${S}`)}for(let b of V1(c,s-2))i.push(` ${b}`)}}let r=MM(this.options.warnings);if(r.length>0){i.push(""),i.push(Vd("Warnings",!0));for(let o of r)for(let a of Y(Vd(o),s))i.push(a)}return i}renderWideBody(e,t){let i=Math.max(1,e-4),s=3,r=Math.floor((i-s)/2),o=Math.max(1,i-s-r),[a,u]=this.options.sections;if(!a||!u)return[];let l=[];if(this.options.subtitle&&!t)for(let T of Y(h.hex(d.muted)(Ft(this.options.subtitle)),i))l.push(T);l.push("");let c=IM(a,r),p=IM(u,o),m=MM(this.options.warnings);m.length>0&&(p.push(Vd("Warnings",!0)),p.push(...m.flatMap(T=>Y(Vd(T),o))));let g=Math.max(c.length,p.length);for(let T=0;T<g;T+=1){let y=Gd(c[T]??"",r),b=Gd(p[T]??"",o);l.push(`${y} ${h.hex(d.line)("\u2502")} ${b}`)}return l}scrollBy(e){this.scrollOffset=Math.max(0,Math.min(this.scrollOffset+e,this.lastMaxScrollOffset))}};function _s(n,e,t=!1){let i=e==="accent"?d.signal:e==="success"?d.success:e==="warning"?d.error:e==="error"?d.error:d.text;return(t?h.bold.hex(i):h.hex(i))(n)}function IM(n,e){let t=n.rows.map(r=>({...r,label:Ft(r.label),value:Ft(r.value),detail:r.detail?Ft(r.detail):void 0})),i=Math.min(Math.max(1,...t.map(r=>C(r.label))),Math.max(1,e-12)),s=[h.bold.hex(d.text)(Ft(n.title))];for(let r of t){let o=E(r.label,i,"\u2026"),a=Gd(j1(r,o),i),u=Math.max(1,e-i-2),l=Y(_s(r.value,r.tone??"neutral"),u);for(let[c,p]of l.entries()){let m=c===0?`${a} `:" ".repeat(i+2);s.push(`${m}${p}`)}for(let c of V1(r,e-2))s.push(` ${c}`)}return s}function j1(n,e=n.label){return n.labelTone?_s(e,n.labelTone,n.labelBold):h.hex(d.muted)(e)}function V1(n,e){if(!n.detail)return[];let t=n.detailTone?_s(n.detail,n.detailTone):h.hex(d.muted)(n.detail),i=Math.max(1,e),s=Y(t,i),r=n.detailMaxLines;if(r===void 0||s.length<=r)return s;let o=s.slice(0,Math.max(1,r)),a=o.length-1;return o[a]=E(`${o[a]??""}${h.hex(d.dim)("\u2026")}`,i,h.hex(d.dim)("\u2026")),o}function MM(n){let e=(n??[]).map(t=>Ft(t)).filter(Boolean);return e.length>3?[...e.slice(0,3),`+${e.length-3} more warning(s)`]:e}function Vd(n,e=!1){let t=e?h.bold.hex(d.error)("!"):h.hex(d.error)("!"),i=e?h.bold.hex(d.text)(n):h.hex(d.text)(n);return`${t} ${i}`}function Gd(n,e){let t=E(n,e,h.hex(d.dim)("\u2026"));return`${t}${" ".repeat(Math.max(0,e-C(t)))}`}function mF(n){let e=typeof n=="function"?n():n;if(!(e===void 0||!Number.isFinite(e)))return Math.max(4,Math.floor(e))}function fF(n){return/^(?:~?[\\/]|[A-Za-z]:[\\/])/u.test(n)}function gF(n,e){if(C(n)<=e)return n;if(e<=1)return"\u2026";let t=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(n)],i=0,s=t.length;for(let r=t.length-1;r>=0;r-=1){let o=t[r]?.segment;if(!o)continue;let a=C(o);if(i+a>e-1)break;i+=a,s=r}return`\u2026${t.slice(s).map(r=>r.segment).join("")}`}function Ft(n){return x(n).replace(/\s+/gu," ").trim()}function RM(n,e,t,i){let s=n.skills??[],o=[{title:"Built-in",skills:s.filter(l=>xc(l)==="builtin")},{title:"User",skills:s.filter(l=>xc(l)==="user")},{title:"Other",skills:s.filter(l=>xc(l)==="other")}].filter(l=>l.skills.length>0).map(l=>({title:`${l.title} \xB7 ${l.skills.length}`,rows:l.skills.map(TF)}));o.length===0&&o.push(yF(e));let a=e.trim(),u=[a?`Matching \u201C${a}\u201D`:"Available to the current Agent",n.hasMore?"More results exist":void 0,"Read-only catalog"].filter(Boolean).join(" \xB7 ");return new Fa({title:"Skills",subtitle:u,badge:{label:`${s.length}${n.hasMore?"+":""} FOUND`,tone:s.length>0?"accent":"neutral"},sections:o,footer:"Esc close \xB7 read only",layout:"stacked",maxRows:i,onCancel:t})}function kM(n,e,t,i){let s=n.map(vF).sort(SF),r=s.filter(m=>m.status==="available").length,o=s.some(m=>m.status==="error"||m.status==="unavailable"),a=e.trim(),u=s.filter(m=>m.sourceKind==="builtin"),l=s.filter(m=>m.sourceKind!=="builtin"&&!m.sourceScope),c=s.filter(m=>m.sourceScope==="project"),p=s.filter(m=>m.sourceScope==="session");return new Fa({title:"MCP servers",subtitle:["Runtime capability catalog \xB7 Read-only",a?`Matching \u201C${a}\u201D`:void 0].filter(Boolean).join(" \xB7 "),badge:{label:`${r}/${s.length} AVAILABLE`,tone:o?"warning":r>0?"success":"neutral"},sections:[zd("Built-in",u,a),zd("User-configured",l,a),...c.length?[zd("Project \xB7 .mcp.json",c,a)]:[],...p.length?[zd("Client session",p,a)]:[]],footer:"Esc close \xB7 /mcp reload",layout:"stacked",maxRows:i,onCancel:t})}function TF(n){let e=n.enabled!==!1;return{label:n.displayName??n.name,value:`${e?"\u25CF available":"\u25CB unavailable"} \xB7 ${bF(n)}`,tone:e?"success":"neutral",labelTone:"neutral",labelBold:!0,detail:n.displayDescription??n.description,detailMaxLines:2}}function yF(n){let e=n.trim();return{title:"Catalog",rows:[{label:"No matches",value:e||"No Skills configured",labelTone:"neutral",labelBold:!0,detail:e?"Close this panel and try a broader /skills filter.":"The current Agent has no visible Skills."}]}}function bF(n){return n.sourceKind?n.sourceKind:n.sourceType===1?"official":n.sourceType===2?"user":n.sourceType===void 0?"unknown source":`source ${n.sourceType}`}function vF(n){let e=lx(n.configJson),t=n.status??e.status??(n.enabled?"configured":"disabled");return{name:n.name,transport:n.transport??"unknown transport",status:t,sourceKind:n.sourceKind??"configured",sourceScope:n.sourceScope,managed:n.managed===!0,tools:n.tools??[],...n.description?{description:n.description}:{},...n.error||e.error?{error:ot(n.error??e.error)}:{}}}function zd(n,e,t){return{title:`${n} \xB7 ${e.length}`,rows:e.length>0?e.map(CF):[{label:"No matches",value:t||`No ${n.toLocaleLowerCase()} servers`,labelTone:"neutral",labelBold:!0,detail:"The current Runtime returned no matching capabilities in this group."}]}}function SF(n,e){return EM(n.status)-EM(e.status)||n.name.localeCompare(e.name)}function EM(n){return n==="error"?0:n==="unavailable"?1:n==="configured"?2:n==="available"?3:4}function CF(n){let e=n.sourceKind==="builtin",t=n.tools.length;return{label:n.name,value:e?`${n.status==="unavailable"?"\u25CB":AM(n.status)} ${n.status} \xB7 ${n.managed?"runtime-managed":"built-in"} \xB7 ${t} ${t===1?"tool":"tools"}`:`${AM(n.status)} ${n.status} \xB7 ${n.transport}`,tone:xF(n.status),labelTone:"neutral",labelBold:!0,detail:e&&t>0?n.tools.map(i=>i.name).join(" \xB7 "):n.error??n.description,detailTone:!e&&n.error?"error":void 0,detailMaxLines:2}}function AM(n){return n==="available"?"\u25CF":n==="error"||n==="unavailable"?"!":n==="disabled"?"\u25CB":"\u25C6"}function xF(n){return n==="available"?"success":n==="error"||n==="unavailable"?"error":n==="configured"?"accent":"neutral"}var wF={...it,groupLabel:n=>h.bold.hex(d.text)(n),noMatch:()=>h.hex(d.dim)(" No matching models")},IF=3,G1="\0connect-codex",z1="\0add-provider",Qd=class{constructor(e,t,i,s={},r,o=""){this.models=e;this.onSelectModel=t;this.onCancel=i;this.availability=s;this.selectedEffort=r;let a=e.find(u=>u.selected);this.selectedModelKey=a?At(a):void 0,this.focusBeforeSearchKey=this.selectedModelKey,this.searchInput.setValue(o.trim()),this.searchInput.moveCursorToEnd(),this.list=this.createList()}fullscreenViewport=!0;handlesViewportKeys=!0;list;focusedModelKey;selectedModelKey;focusBeforeSearchKey;searchInput=new Ne({prompt:""});thinkingDrafts=new Map;contextDrafts=new Map;effortDrafts=new Map;modelByKey=new Map;deletingProviderId;deleteStatus;busy=!1;_focused=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.searchInput.focused=e}handleInput(e){if(this.busy)return;let t=ie();if(this.deletingProviderId){t.matches(e,"tui.select.cancel")?this.cancelProviderDeletion():t.matches(e,"tui.select.confirm")&&this.deleteProvider();return}if(t.matches(e,"tui.select.cancel")){this.onCancel();return}let i=this.focusedModel();if(i&&PM(i)&&this.availability.onDeleteProvider&&v(e,j.ctrl("d"))){this.deletingProviderId=i.providerId,this.deleteStatus=void 0,this.availability.requestRender?.();return}if(i&&Zr(i).length>1&&(v(e,"tab")||v(e,j.shift("tab")))){let o=Zr(i),a=o.indexOf(this.contextChoice(i)??0),u=v(e,j.shift("tab"))?-1:1,l=o[(a+u+o.length)%o.length];l!==void 0&&this.contextDrafts.set(At(i),l),this.list=this.createList();return}let s=this.searchInput.getValue();if(i&&s.trim().length===0&&(v(e,"left")||v(e,"right"))){if(fa(i)){this.moveEffort(i,v(e,"left")?-1:1);return}if(i.thinkingConfig?.mode==="switchable"){this.toggleThinking(i);return}}if(t.matches(e,"tui.select.up")||t.matches(e,"tui.select.down")||t.matches(e,"tui.select.confirm")){this.list.handleInput(e);return}let r=s;if(this.searchInput.handleInput(e),this.searchInput.getValue()!==r){let o=this.searchInput.getValue();r.trim().length===0&&o.trim().length>0?this.focusBeforeSearchKey=this.focusedModelKey??this.selectedModelKey:r.trim().length>0&&o.trim().length===0&&(this.focusedModelKey=this.focusBeforeSearchKey??this.focusedModelKey,this.focusBeforeSearchKey=void 0),this.list=this.createList()}}invalidate(){this.list.invalidate(),this.searchInput.invalidate()}render(e){return this.renderViewport(e,24)}renderViewport(e,t){if(this.deletingProviderId)return this.renderDeleteConfirmation(e,t);let i=oe(e,t,this.renderHint()),s=h.hex(d.muted)("Search: "),r=this.searchInput.render(Math.max(1,i.contentWidth-C(s)))[0]??"",o=[...i.bodyHeight>=10?[h.hex(d.muted)("Available models")]:[],...i.bodyHeight>=3&&this.availability.unavailableHint?[h.hex(d.warning)(x(this.availability.unavailableHint))]:[],...i.bodyHeight>=2?[`${s}${r}`]:[],...i.bodyHeight>=4&&this.visibleModels().length===0&&(this.availability.onAddProvider||this.availability.codexOAuth)?[h.hex(d.muted)("No matching models")]:[]],a=this.renderModelControl().slice(0,Math.max(0,i.bodyHeight-o.length-1));return i.render({title:"Models",body:[...o,...this.visibleModels().length===0&&!this.availability.onAddProvider&&!this.availability.codexOAuth?[h.hex(d.muted)("No matching models")]:this.list.renderViewport(i.contentWidth,Math.max(1,i.bodyHeight-o.length-a.length)),...a]})}focusedModel(){let e=this.list.getSelectedItem();return e?this.modelByKey.get(e.value):void 0}contextChoice(e){return this.contextDrafts.get(At(e))??e.contextLimit}renderContextControl(){let e=this.focusedModel();if(!e)return[];let t=Zr(e);if(t.length<2)return[];let i=this.contextChoice(e),s=t.map(o=>o===i?h.bold.hex(d.signal)(`[ ${eo(o)} ]`):h.hex(d.text)(eo(o))),r=e.contextWindowOptionHints?.[String(i)]==="higher_usage";return[`${h.hex(d.muted)("Context")} ${s.join(" ")} ${h.hex(d.dim)("(Tab to switch)")}`,...r?[h.hex(d.warning)("Higher usage with this context window.")]:[]]}moveEffort(e,t){let i=YC(e.effortOptions,this.effortChoice(e),t);i&&this.effortDrafts.set(At(e),i)}toggleThinking(e){let t=this.thinkingChoice(e)??"off";this.thinkingDrafts.set(At(e),t==="on"?"off":"on")}thinkingChoice(e){return this.thinkingDrafts.get(At(e))??li(e)}effortChoice(e){let t=this.effortDrafts.get(At(e));return t||Or(e,e.selected?this.selectedEffort:void 0)}createList(){let e=this.visibleModels(),t=AF(e);this.modelByKey.clear();for(let o of this.models)this.modelByKey.set(At(o),o);let i=t.flatMap(o=>o.models.map(a=>{let u=At(a),l=!!this.availability.isUnavailable?.(a);return{value:u,label:`${a.selected?"\u25CF ":""}${l?"[login] ":""}${x(a.displayName??a.modelId)}`,description:RF({...a,contextLimit:this.contextChoice(a)},l),groupLabel:`${x(o.label)} \xB7 ${o.models.length}`}}));i.push({value:z1,label:"+ Add 3rd-party provider\u2026",description:"Configure an API Key provider and add its models",groupLabel:"Providers"}),this.availability.codexOAuth&&i.push({value:G1,...MF(this.availability.codexOAuth.state),groupLabel:"Providers"});let s=new Je(i,Math.min(Math.max(i.length,1),10),wF,{minPrimaryColumnWidth:26,maxPrimaryColumnWidth:42});s.onSelectionChange=o=>{this.focusedModelKey=o.value},s.onSelect=o=>{if(o.value===G1){this.availability.codexOAuth?.onConnect();return}if(o.value===z1){this.availability.onAddProvider?.();return}let a=this.modelByKey.get(o.value);if(!a)return;if(this.availability.isUnavailable?.(a)){this.availability.onUnavailable?.(a);return}let u=this.effortChoice(a),l=u?void 0:this.thinkingChoice(a),c=this.contextDrafts.get(At(a)),p=c===void 0?a:{...a,contextLimit:c},m=l?QC(p,l):p;u?this.onSelectModel(m,u):this.onSelectModel(m)},s.onCancel=this.onCancel;let r=this.focusedModelKey?e.findIndex(o=>At(o)===this.focusedModelKey):e.findIndex(o=>At(o)===this.selectedModelKey);return r>=0?(s.setSelectedIndex(r),this.focusedModelKey=e[r]?At(e[r]):void 0):e[0]&&(this.focusedModelKey=At(e[0])),s}visibleModels(){let e=this.searchInput.getValue().trim().toLocaleLowerCase();return e?this.models.filter(t=>EF(t).includes(e)):[...this.models]}renderHint(){if(this.list.getSelectedItem()?.value===G1)return"\u2191\u2193 select \xB7 type to search \xB7 enter connect Codex \xB7 esc cancel";if(this.list.getSelectedItem()?.value===z1)return"\u2191\u2193 select \xB7 type to search \xB7 enter add provider \xB7 esc cancel";let e=this.focusedModel(),t=e?.thinkingConfig?.mode==="switchable",i=e&&Zr(e).length>1?" \xB7 tab context":"",s=e&&PM(e)&&this.availability.onDeleteProvider?" \xB7 ctrl+d delete provider":"";return fa(e)?`\u2191\u2193 select \xB7 type to search \xB7 \u2190/\u2192 effort \xB7 enter apply${i}${s} \xB7 esc cancel`:t?`\u2191\u2193 select \xB7 type to search \xB7 \u2190/\u2192 thinking \xB7 enter apply${i}${s} \xB7 esc cancel`:`\u2191\u2193 select \xB7 type to search \xB7 enter apply${i}${s} \xB7 esc cancel`}renderDeleteConfirmation(e,t){let i=this.deletingProviderId,s=this.models.filter(a=>a.providerId===i),r=s[0]?.providerName?.trim()||i||"Unknown provider",o=s.length;return Ln({title:"Delete provider?",body:[x(r),h.hex(d.muted)(`This removes its saved credentials and all ${o} configured model${o===1?"":"s"}.`),...this.deleteStatus?[this.deleteStatus.tone==="error"?h.hex(d.error)(`! ${this.deleteStatus.text}`):h.hex(d.accent)(this.deleteStatus.text)]:[]],footer:"Enter delete provider \xB7 Esc cancel"},e,t,"warning")}cancelProviderDeletion(){this.deletingProviderId=void 0,this.deleteStatus=void 0,this.availability.requestRender?.()}async deleteProvider(){let e=this.deletingProviderId;if(!(!e||!this.availability.onDeleteProvider)){this.busy=!0,this.deleteStatus={tone:"info",text:"Deleting provider\u2026"},this.availability.requestRender?.();try{await this.availability.onDeleteProvider(e),this.deletingProviderId=void 0,this.deleteStatus=void 0}catch(t){this.deleteStatus={tone:"error",text:L(t,{summary:"Couldn't delete provider.",nextStep:"Retry, or press Esc to cancel.",preservation:"The provider and its models are unchanged."})}}finally{this.busy=!1,this.availability.requestRender?.()}}}renderEffortControl(){let e=this.focusedModel();if(!e)return[];let t=Lr(e.effortOptions);if(t.length===0)return[];let i=this.effortChoice(e);return["",`${h.hex(d.muted)("Think effort")} ${h.hex(d.dim)("(\u2190/\u2192 to switch)")}`,t.map(s=>s===i?h.bold.hex(d.signal)(`[ ${s} ]`):h.hex(d.text)(s)).join(" ")]}renderModelControl(){if(!this.models.some(i=>Zr(i).length>1||fa(i)||li(i)!==void 0))return[];let t=[...this.renderContextControl(),...this.renderEffortControl(),...this.renderThinkingControl()];return[...t,...Array.from({length:Math.max(0,IF-t.length)},()=>"")]}renderThinkingControl(){let e=this.focusedModel();if(!e)return[];if(fa(e))return[];let t=this.thinkingChoice(e);if(!t)return[];if(e.thinkingConfig?.mode!=="switchable")return["",h.hex(d.muted)(`Thinking ${t==="on"?"On":"Off"}`)];let i=(s,r)=>s===t?h.bold.hex(d.signal)(`[ ${r} ]`):h.hex(d.text)(r);return["",`${h.hex(d.muted)("Thinking")} ${h.hex(d.dim)("(\u2190/\u2192 to switch)")}`,`${i("on","On")} ${i("off","Off")}`]}};function MF(n){return n==="connected"?{label:"\u2713 OpenAI Codex connected",description:"OAuth credentials are ready"}:n==="pending"?{label:"\u21BB Continue OpenAI Codex sign-in\u2026",description:"Open the browser sign-in again"}:n==="failed"?{label:"\u21BB Retry OpenAI Codex sign-in\u2026",description:"The previous sign-in failed"}:{label:"+ Connect OpenAI Codex\u2026",description:"Sign in with OpenAI OAuth"}}function At(n){return`${n.providerId}\0${n.modelId}`}function PM(n){return n.providerSource==="custom_provider"}function EF(n){return[n.providerId,n.providerName,n.modelId,n.displayName,n.variant,`${n.providerId}/${n.modelId}`].filter(e=>!!e).join(" ").toLocaleLowerCase()}function AF(n){let e=new Map;for(let t of n){let i=t.providerName?.trim()||t.providerId,s=e.get(i);s?s.push(t):e.set(i,[t])}return Array.from(e,([t,i])=>({label:t,models:i}))}function RF(n,e){let t=Lr(n.effortOptions);return[x(`${n.providerId}/${n.modelId}`),e?"Login required":void 0,n.variant&&n.variant!=="thinking"?x(n.variant):void 0,t.length>0?`${String(t.length)} efforts`:void 0,n.contextLimit?`${eo(n.contextLimit)} ctx`:void 0].filter(i=>!!i).join(" \xB7 ")}var Yd=class{constructor(e){this.options=e;this.methods=new Je([{value:"browser",label:"Browser login (default)",description:"Sign in on this computer"},{value:"device_code",label:"Device code login",description:"SSH / remote development machine"}],2,it),this.methods.onSelect=t=>{this.start(t.value)},this.methods.onCancel=()=>{this.cancel()}}fullscreenViewport=!0;handlesViewportKeys=!0;methods;phase="loading";method="browser";status;error;browserHint;openedUrl;timer;disposed=!1;cancelling=!1;async resume(){try{let e=await this.options.application.getCodexOAuthStatus();this.cancelling&&e.loginId?await this.options.application.cancelCodexOAuthLogin(e.loginId):this.disposed||this.update(e)}catch(e){this.fail(e)}}handleInput(e){this.disposed||this.cancelling||(ie().matches(e,"tui.select.cancel")?this.cancel():this.phase==="select"?(this.methods.handleInput(e),this.options.requestRender()):this.phase==="failed"&&v(e,j.enter)&&this.start(this.method))}invalidate(){this.methods.invalidate()}dispose(){this.disposed=!0,clearTimeout(this.timer)}async cancel(){if(!this.cancelling){this.cancelling=!0,clearTimeout(this.timer);try{this.status?.loginId&&await this.options.application.cancelCodexOAuthLogin(this.status.loginId),this.disposed||this.options.onClose()}catch(e){this.cancelling=!1,this.fail(e)}}}render(e){return this.renderViewport(e,20)}renderViewport(e,t){let i=this.phase==="select"?"\u2191\u2193 select \xB7 Enter continue \xB7 Esc cancel":this.phase==="failed"?"Enter retry \xB7 Esc cancel":"Esc cancel",s=oe(e,t,i),r=this.phase==="select"?this.methods.renderViewport(s.contentWidth,s.bodyHeight):this.body().flatMap(o=>Y(o,s.contentWidth));return s.render({title:"Connect OpenAI Codex",body:r},this.error?"error":"signal")}body(){if(this.cancelling)return["Cancelling sign-in\u2026"];if(this.phase==="loading")return["Checking Codex sign-in\u2026"];if(this.phase==="starting")return["Starting Codex sign-in\u2026"];if(this.error)return[h.hex(d.error)(this.error)];let e=this.status?.deviceCode,t=e?.verificationUri??this.status?.authUrl;return[...e?[h.bold.hex(d.signal)(`Enter code: ${x(e.userCode)}`)]:[],...t?[x(t)]:[],e?"Open this link in a browser on your computer and enter the code.":"Complete sign-in in your browser.","Waiting for authorization\u2026",...e?[`Code expires in ${Math.max(0,Math.ceil((e.expiresAt-Date.now())/6e4))} min.`]:[],...this.browserHint?[this.browserHint]:[]]}async start(e){this.method=e,this.phase="starting",this.error=void 0,this.browserHint=void 0,this.options.requestRender();try{let t=await this.options.application.connectCodexOAuth({method:e});if(this.cancelling&&t.loginId){await this.options.application.cancelCodexOAuthLogin(t.loginId);return}this.disposed||this.update(t)}catch(t){this.cancelling||this.fail(t)}}update(e){if(!this.cancelling){if(this.status=e,this.error=void 0,e.method&&(this.method=e.method),e.state==="connected"){this.options.onConnected();return}if(e.state==="pending"){this.phase="waiting";let t=e.deviceCode?.verificationUri??e.authUrl;t&&t!==this.openedUrl&&(this.openedUrl=t,this.openBrowser(t)),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.resume()},1e3),this.timer.unref?.()}else e.state==="failed"||e.state==="hidden"?(this.phase="failed",this.error=x(e.error??"Codex sign-in is unavailable in this build.")):this.phase="select";this.options.requestRender()}}async openBrowser(e){try{await this.options.openExternalTarget(e)}catch{if(this.disposed)return;this.browserHint="Open the link above manually to continue.",this.options.requestRender()}}fail(e){this.disposed||(this.phase="failed",this.error=x(e instanceof Error?e.message:"Codex sign-in failed. Retry to continue."),this.options.requestRender())}};var _M=["API Key","Base URL","Models","Alias","Test and save"],Xd=class{constructor(e){this.options=e;this.baseUrl=e.provider.baseUrl??"",this.modelIds=e.provider.models.map(t=>t.modelId),this.name=e.provider.name,this.textInput.onSubmit=t=>this.commitField(t),this.secretInput.onSubmit=t=>this.commitField(t),this.textInput.onEscape=this.secretInput.onEscape=()=>this.cancelField()}selected=0;editing=!1;textInput=new Ne({prompt:""});secretInput=new Ne({prompt:"",mask:"\u2022"});apiKey="";baseUrl;modelIds;name;modelsEdited=!1;busy=!1;disposed=!1;status="";_focused=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncFocus()}handleInput(e){this.busy||this.disposed||(this.editing?(this.selected===0?this.secretInput:this.textInput).handleInput(e):ie().matches(e,"tui.select.cancel")?this.options.onCancel():v(e,j.up)?this.selected=Math.max(0,this.selected-1):v(e,j.down)||v(e,"tab")?this.selected=(this.selected+1)%_M.length:v(e,j.enter)&&(this.selected===4?this.save():this.editField()),this.options.requestRender())}render(e){if(e<=0)return[];let t=[this.apiKey?"Replacement entered":this.options.provider.hasApiKey?"Saved key (unchanged)":"Not configured",_r(this.baseUrl),this.modelIds.join(", ")||"No models",this.name,""],i=_M.map((s,r)=>{let o=`${this.selected===r?"\u2192":" "} ${s}: ${x(t[r]??"")}`;return this.selected===r?h.hex(d.signal)(o):o});return[h.bold.hex(d.signal)(`Edit ${x(this.options.provider.name)}`),h.hex(d.muted)("Changes apply to all models in this connection after a successful test."),"",...i,...this.editing?["",...(this.selected===0?this.secretInput:this.textInput).render(e)]:[],...this.selected===2?[h.hex(d.dim)("Model IDs separated by commas; remove an ID to remove that model.")]:[],...this.status?["",h.hex(d.error)(x(this.status))]:[],"",h.hex(d.dim)(this.busy?"Testing and saving\u2026":this.editing?"Enter keep change \xB7 Esc cancel edit":"\u2191\u2193 move \xB7 Enter edit / save \xB7 Esc cancel")].map(s=>E(s,Math.max(0,e),"\u2026"))}invalidate(){this.textInput.invalidate(),this.secretInput.invalidate()}dispose(){this.disposed=!0,this.apiKey="",this.secretInput.setValue(""),this.focused=!1}editField(){this.editing=!0,this.status="";let e=["",this.baseUrl,this.modelIds.join(", "),this.name],t=this.selected===0?this.secretInput:this.textInput;t.setValue(e[this.selected]??""),t.moveCursorToEnd(),this.syncFocus()}commitField(e){let t=e.trim();if(!t){this.status="A value is required. Press Esc to keep the saved value.";return}if(this.selected===0&&(this.apiKey=t),this.selected===1){try{let i=new URL(t);if(i.protocol!=="http:"&&i.protocol!=="https:")throw new Error}catch{this.status="Base URL must use http or https.";return}this.baseUrl=t}if(this.selected===2){let i=[...new Set(t.split(/[,\n]/u).map(s=>s.trim()).filter(Boolean))];if(!i.length){this.status="At least one model is required for the connection test.";return}this.modelIds=i,this.modelsEdited=!0}this.selected===3&&(this.name=t),this.cancelField()}cancelField(){this.editing=!1,this.secretInput.setValue(""),this.status="",this.syncFocus()}async save(){let e=this.options.provider,t=e.models.find(i=>i.selected&&this.modelIds.includes(i.modelId))?.modelId??this.modelIds[0];if(!e.configRevision||!t){this.status=t?"Connection details are stale. Reopen /provider.":"Add a model before testing and saving.";return}if(!e.hasApiKey&&!this.apiKey){this.status="API Key is required.";return}this.busy=!0,this.status="",this.syncFocus();try{let i=await this.options.onSave({providerId:e.providerId,expectedRevision:e.configRevision,name:this.name,baseUrl:this.baseUrl,...e.apiFormat?{apiFormat:e.apiFormat}:{},...this.apiKey?{apiKey:this.apiKey}:{},...this.modelsEdited?{models:this.modelIds.map(s=>({modelId:s}))}:{},modelId:t,saveAndUse:!1});if(this.disposed)return;if(!i.success)throw new Error(i.status?.lastErrorMessage??"Connection test failed.");this.options.onSaved(!!this.apiKey)}catch(i){if(this.disposed)return;let s=L(i,{summary:"Changes were not saved. The previous connection remains in use.",nextStep:"Check the connection and retry. If it changed elsewhere, reopen /provider."});this.status=this.apiKey?s.split(this.apiKey).join("[redacted]"):s}finally{this.busy=!1,this.syncFocus(),this.disposed||this.options.requestRender()}}syncFocus(){this.secretInput.focused=this._focused&&this.editing&&!this.busy&&this.selected===0,this.textInput.focused=this._focused&&this.editing&&!this.busy&&this.selected!==0}};var Jd=class{constructor(e){this.options=e;this.snapshotValue=e.snapshot;let t=this.providers().findIndex(i=>i.active);this.selectedIndex=Math.max(0,t),this.secretInput.onSubmit=i=>this.submitMiniMaxKey(i),this.secretInput.onEscape=()=>this.exitMode()}editor;snapshotValue;selectedIndex=0;mode={kind:"list"};secretInput=new ze({mask:"\u2022"});busy=!1;status;_focused=!1;disposed=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncFocus()}handleInput(e){if(this.busy||this.disposed)return;if(this.editor){this.editor.handleInput(e);return}if(this.mode.kind==="minimax-key"){this.secretInput.handleInput(e),this.requestRender();return}if(ie().matches(e,"tui.select.cancel")){this.options.onCancel();return}if(v(e,j.up)){this.move(-1);return}if(v(e,j.down)){this.move(1);return}if(v(e,j.enter)){this.useSelected();return}let t=e.toLowerCase();t==="r"?this.refreshSelectedModels():t==="t"?this.testSelected():t==="e"?this.editSelected():t===" "&&this.useSelected()}invalidate(){this.secretInput.invalidate(),this.editor?.invalidate()}dispose(){this.disposed=!0,this.editor?.dispose(),this.secretInput.focused=!1,this.secretInput.setValue("")}render(e){let t=Math.max(0,e);return t===0?[]:this.editor?this.editor.render(t):(this.mode.kind==="minimax-key"?this.renderMiniMaxKey(t):this.renderList(t)).map(s=>E(s,t,h.hex(d.dim)("\u2026")))}renderList(e){let t=this.providers(),i=[OM(e),Rt(LM(h.bold.hex(d.signal)("Providers"),h.hex(d.muted)("Model sources and credentials"),Math.max(1,e-4)),e),Rt(h.hex(d.dim)("Choose a source or edit a connection; keys stay masked."),e),$a(e)];for(let[r,o]of t.entries()){let a=r===this.selectedIndex,u=kF(o),l=`${a?h.bold.hex(d.signal)("\u203A"):" "} ${h.hex(u?d.signal:d.text)(`${PF(o)} ${x(o.name)}`)}`;i.push(Rt(LM(l,G(OF(o)),e-4),e))}let s=this.selectedProvider();if(s&&(i.push($a(e)),i.push(Rt(G(LF(s)),e)),s.kind==="custom")){s.baseUrl&&i.push(Rt(h.hex(d.dim)(_r(s.baseUrl)),e));let r=_F(s);r&&i.push(Rt(h.hex(d.dim)(r),e))}return this.status&&i.push(Rt(this.status.tone==="error"?h.hex(d.error)(`! ${this.status.text}`):h.hex(d.accent)(`\u2713 ${this.status.text}`),e)),i.push($a(e),Rt(G(this.busy?"Working\u2026":"\u2191\u2193 move \xB7 Space use \xB7 r refresh models \xB7 e edit \xB7 t test \xB7 Esc close"),e),Rt(h.hex(d.dim)("Select a custom connection and press r to fetch its latest models."),e),NM(e)),i}renderMiniMaxKey(e){let t=this.mode.kind==="minimax-key"&&this.mode.replacing;return[OM(e),Rt(h.bold.hex(d.signal)(t?"Replace MiniMax API Key":"Configure MiniMax API Key"),e),Rt(h.hex(d.muted)(t?"The saved key is overwritten once you submit.":"Saved locally and used instead of Token Plan."),e),$a(e),Rt(this.secretInput.render(Math.max(1,e-8))[0]??"",e),...this.status?[Rt(h.hex(d.error)(`! ${this.status.text}`),e)]:[],$a(e),Rt(G("Enter save and use \xB7 Esc cancel"),e),NM(e)]}providers(){return this.snapshotValue.providers}selectedProvider(){return this.providers()[this.selectedIndex]}move(e){this.selectedIndex=Math.max(0,Math.min(this.providers().length-1,this.selectedIndex+e)),this.status=void 0,this.requestRender()}async refreshSelectedModels(){let e=this.selectedProvider(),t=this.options.onRefreshModels;if(!e||e.kind!=="custom"||e.readOnly||!t){this.status={tone:"info",text:"Select a custom connection to refresh its models."},this.requestRender();return}await this.perform(async()=>{let i=await t(e);try{await this.refresh(i?`Added ${i} new model(s). Choose one with /model.`:"Models are already up to date.")}catch{this.setStatus("Models were refreshed, but the list could not be reloaded. Reopen /provider.","error")}})}async useSelected(){let e=this.selectedProvider();if(e){if(e.kind==="codex-oauth"){await this.connectCodex(e);return}if(e.kind==="minimax-oauth"){await this.setMiniMaxSource("token_plan");return}if(e.kind==="minimax-api-key"){if(!e.hasApiKey){this.startMiniMaxKey();return}await this.setMiniMaxSource("minimax_api_key");return}this.editSelected()}}editSelected(){let e=this.selectedProvider();if(e){if(e.kind==="minimax-api-key"){this.startMiniMaxKey(e.hasApiKey);return}if(e.kind==="minimax-oauth"){if(!this.options.onReLogin){this.setStatus("MiniMax sign-in is unavailable in this host.","error");return}this.options.onReLogin();return}if(e.kind==="codex-oauth"){this.setStatus("Use Enter or Space on the Codex row to start sign-in.","info");return}if(e.readOnly||!this.options.onSaveCustom){this.setStatus("This connection cannot be edited in this host.","info");return}if(!e.configRevision||!e.baseUrl){this.setStatus("Connection details are stale. Reopen /provider.","error");return}this.editor=new Xd({provider:e,onSave:this.options.onSaveCustom,onSaved:t=>{this.closeEditor(),this.perform(()=>this.refresh(t?"Connection saved. All its models now use the new API Key.":"Connection changes saved."),{summary:"Connection saved, but the list could not refresh.",nextStep:"Reopen /provider."})},onCancel:()=>this.closeEditor(),requestRender:()=>this.requestRender()}),this.syncFocus(),this.requestRender()}}closeEditor(){this.editor?.dispose(),this.editor=void 0,this.syncFocus(),this.requestRender()}async connectCodex(e){if(e.status?.state==="connected"){this.setStatus("OpenAI Codex is already connected.","info");return}if(!this.options.onConnectCodex){this.setStatus("Codex sign-in is unavailable in this host.","error");return}this.options.onConnectCodex()}startMiniMaxKey(e=!1){this.mode={kind:"minimax-key",replacing:e},this.status=void 0,this.secretInput.setValue(""),this.secretInput.moveCursorToEnd(),this.syncFocus(),this.requestRender()}submitMiniMaxKey(e){if(this.mode.kind!=="minimax-key")return;let t=this.mode.replacing;if(!e.trim()){this.setStatus("API key is required.","error");return}this.perform(async()=>{await this.options.onSetMiniMaxApiKey(e.trim()),!this.disposed&&(await this.refresh(t?"MiniMax API Key replaced and selected.":"MiniMax API Key saved and selected."),!this.disposed&&(this.mode={kind:"list"}))})}async testSelected(){let e=this.selectedProvider();if(e){if(e.kind==="codex-oauth"){this.setStatus("Codex OAuth connectivity is managed by its sign-in flow.","info");return}if(e.kind==="minimax-oauth"){this.setStatus("MiniMax OAuth sign-in and connectivity are managed by /login.","info");return}await this.perform(async()=>{let t=await this.options.onTest(e.providerId);this.disposed||await this.refresh(t.success?`${e.name} connection is available.`:L(t.status.lastErrorMessage??t.status.state,{summary:`${e.name} connection test failed.`,nextStep:"Check the URL, credentials, and model ID, then retry."}),t.success?"info":"error")})}}async setMiniMaxSource(e){await this.perform(async()=>{await this.options.onSetMiniMaxSource(e),!this.disposed&&await this.refresh(e==="token_plan"?"Using MiniMax Token Plan.":"Using MiniMax API Key.")})}async refresh(e,t="info"){let i=await this.options.onRefresh();this.disposed||(this.snapshotValue=i,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.providers().length-1)),this.setStatus(e,t))}async perform(e,t={summary:"The provider source was not changed.",nextStep:"Retry, or manage providers in Settings."}){this.busy=!0,this.status=void 0,this.requestRender();try{await e()}catch(i){if(this.disposed)return;this.setStatus(L(i,{summary:t.summary,nextStep:t.nextStep}),"error")}finally{this.disposed||(this.busy=!1,this.syncFocus(),this.requestRender())}}exitMode(){this.mode={kind:"list"},this.status=void 0,this.syncFocus(),this.requestRender()}setStatus(e,t){this.status={text:x(e),tone:t},this.requestRender()}syncFocus(){this.secretInput.focused=this._focused&&this.mode.kind==="minimax-key"&&!this.editor,this.editor&&(this.editor.focused=this._focused)}requestRender(){this.disposed||this.options.requestRender()}};function kF(n){return(n.kind==="minimax-oauth"||n.kind==="minimax-api-key")&&n.active}function PF(n){return n.kind==="codex-oauth"?n.status?.state==="connected"?"\u2713":"\u25CB":n.kind==="custom"?n.enabled?"\u25CB":"\u2013":n.active?"\u25CF":"\u25CB"}function _F(n){if(n.models.length!==0)return x(n.models.map(e=>e.displayName??e.modelId).join(", "))}function LF(n){return n.kind==="codex-oauth"?n.status?.state==="connected"?"Connected with OpenAI OAuth":n.status?.state==="pending"?"Sign-in pending \xB7 Enter or Space to continue":n.status?.state==="failed"?`${n.status.lastErrorMessage??"Sign-in failed"} \xB7 Enter or Space to retry`:"Not connected \xB7 Enter or Space to connect":n.kind==="minimax-oauth"?"Sign-in managed by /login \xB7 Space to use \xB7 e to sign in again":n.kind==="minimax-api-key"?n.hasApiKey?`${n.maskedApiKey??"key saved"} \xB7 Space to use \xB7 e to replace`:"No API key saved \xB7 Space or e to add one":[n.enabled?"Enabled":"Disabled",n.apiFormat??"anthropic-messages",n.hasApiKey?n.maskedApiKey??"key saved":"no key",`${n.models.length} model${n.models.length===1?"":"s"}`].join(" \xB7 ")}function OF(n){return n.kind==="codex-oauth"?n.status?.state==="connected"?"Connected":n.status?.state==="pending"?"Waiting for sign-in":n.status?.state==="failed"?"Sign-in failed":"Not connected":n.kind==="minimax-oauth"?n.active?"Active \xB7 Token Plan":"Token Plan":n.kind==="minimax-api-key"?n.hasApiKey?n.active?"Active \xB7 Key saved":"Key saved":"Not configured":`${n.enabled?"Enabled":"Disabled"} \xB7 ${n.models.length} model${n.models.length===1?"":"s"}`}function LM(n,e,t){let i=t-C(n)-C(e);return i>=2?`${n}${" ".repeat(i)}${e}`:E(n,t,"\u2026")}function OM(n){return n<2?"\u2500".repeat(Math.max(0,n)):h.hex(d.line)(`\u256D${"\u2500".repeat(Math.max(0,n-2))}\u256E`)}function $a(n){return n<2?"\u2500".repeat(Math.max(0,n)):h.hex(d.line)(`\u251C${"\u2500".repeat(Math.max(0,n-2))}\u2524`)}function NM(n){return n<2?"\u2500".repeat(Math.max(0,n)):h.hex(d.line)(`\u2570${"\u2500".repeat(Math.max(0,n-2))}\u256F`)}function Rt(n,e){if(e<4)return E(n,e,"\u2026");let t=e-4,i=E(n,t,"\u2026");return`${h.hex(d.line)("\u2502")} ${i}${" ".repeat(Math.max(0,t-C(i)))} ${h.hex(d.line)("\u2502")}`}function DM(n,e){return n.kind==="custom"&&n.enabled&&!n.readOnly&&(n.apiFormat??"anthropic-messages")===e.apiFormat&&n.baseUrl?.trim().replace(/\/+$/u,"")===e.baseUrl.trim().replace(/\/+$/u,"")}function FM(n,e){let t=new Set(n.models.map(i=>i.modelId));return[...n.models.map(({modelId:i})=>({modelId:i})),...e.filter(i=>t.has(i.modelId)?!1:(t.add(i.modelId),!0))]}var Zd="\0custom-provider",NF=[{value:"openai-completions",label:"OpenAI Compatible",description:"/chat/completions"},{value:"openai-responses",label:"OpenAI Responses",description:"/responses"},{value:"anthropic-messages",label:"Anthropic Messages",description:"/v1/messages"}],eh=class{constructor(e){this.options=e;this.list=this.createProviderList(),this.textInput.onSubmit=t=>this.submitText(t),this.textInput.onEscape=()=>this.back(),this.secretInput.onSubmit=t=>this.editingModelApiKey?this.commitModelApiKey(t):this.submitApiKey(t),this.secretInput.onEscape=()=>this.editingModelApiKey?this.cancelModelApiKeyEdit():this.back()}mode="provider";list;searchInput=new Ne({prompt:""});textInput=new Ne({prompt:""});secretInput=new Ne({prompt:"",mask:"\u2022"});template;connection;alias="";selectedModelId="";modelFocus="models";editingModelApiKey=!1;modelApiKeyDraft="";customName="";customBaseUrl="";customApiFormat="openai-completions";customModelId="";busy=!1;status="";_focused=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncFocus()}handleInput(e){if(this.busy)return;if(this.mode==="model"){this.handleModelInput(e);return}if(ie().matches(e,"tui.select.cancel")){this.back();return}if(this.mode==="provider"){this.handleSearchableListInput(e);return}if(this.mode==="custom-format"||this.mode==="connection"){this.list.handleInput(e);return}(this.mode==="api-key"?this.secretInput:this.textInput).handleInput(e),this.options.requestRender()}invalidate(){this.list.invalidate(),this.searchInput.invalidate(),this.textInput.invalidate(),this.secretInput.invalidate()}render(e){let t=Math.max(0,e);return t?[h.bold.hex(d.signal)("Add 3rd-party provider"),h.hex(d.muted)(this.subtitle()),...this.mode==="provider"&&this.options.catalogWarning?[h.hex(d.warning)(x(this.options.catalogWarning))]:[],"",...this.renderBody(t),...this.status?["",h.hex(d.error)(`! ${x(this.status)}`)]:[],"",h.hex(d.dim)(this.footer())].map(s=>E(s,t,h.hex(d.dim)("\u2026"))):[]}handleSearchableListInput(e){let t=ie();if(t.matches(e,"tui.select.up")||t.matches(e,"tui.select.down")||t.matches(e,"tui.select.confirm")){this.list.handleInput(e),this.options.requestRender();return}let i=this.searchInput.getValue();this.searchInput.handleInput(e),this.searchInput.getValue()!==i&&(this.mode==="model"&&this.closeModelDetails(),this.rebuildList()),this.options.requestRender()}handleModelInput(e){let t=ie();if(this.editingModelApiKey){if(t.matches(e,"tui.select.down")){let i=this.secretInput.getValue().trim();i&&(this.modelApiKeyDraft=i),this.editingModelApiKey=!1,this.modelFocus="models",this.status="",this.secretInput.setValue(""),this.syncFocus(),this.options.requestRender();return}this.secretInput.handleInput(e),this.options.requestRender();return}if(this.modelFocus==="models"&&t.matches(e,"tui.select.up")&&this.list.getSelectedItem()?.value===this.filteredModels()[0]?.modelId){this.modelFocus="api-key",this.status="",this.syncFocus(),this.options.requestRender();return}if(t.matches(e,"tui.input.tab")){this.modelFocus=this.modelFocus==="models"?"api-key":"models",this.status="",this.syncFocus(),this.options.requestRender();return}if(t.matches(e,"tui.select.cancel")){if(this.modelFocus==="api-key"){this.modelFocus="models",this.status="",this.syncFocus(),this.options.requestRender();return}if(this.selectedModelId){this.closeModelDetails(),this.options.requestRender();return}this.back();return}if(this.modelFocus==="api-key"){if(t.matches(e,"tui.select.down")){this.modelFocus="models",this.status="",this.syncFocus(),this.options.requestRender();return}t.matches(e,"tui.select.confirm")&&this.startModelApiKeyEdit();return}this.handleSearchableListInput(e)}renderBody(e){if(this.mode==="model"){let s=h.hex(d.muted)("Search: "),r=this.searchInput.render(Math.max(1,e-C(s)))[0]??"";return[...this.renderModelApiKey(e),"",`${s}${r}`,...this.list.render(e),...this.renderModelDetails()]}if(this.mode==="provider"){let s=h.hex(d.muted)("Search: "),r=this.searchInput.render(Math.max(1,e-C(s)))[0]??"";return[`${s}${r}`,...this.list.render(e)]}if(this.mode==="custom-format"||this.mode==="connection")return this.list.render(e);let t=this.inputLabel(),i=this.mode==="api-key"?this.secretInput:this.textInput;return[h.hex(d.text)(t),i.render(e)[0]??""]}renderModelApiKey(e){let t=this.modelFocus==="api-key"?"\u2192 ":" ",i=this.modelApiKeyDraft||this.connection?.hasApiKey,s=this.modelApiKeyDraft?"Ready for test":this.connection?.hasApiKey?"Saved key (unchanged)":"Not configured",r=this.editingModelApiKey?"Enter to keep":this.modelFocus==="api-key"?`Enter to ${i?"edit":"configure"}`:`Tab to ${i?"edit":"configure"}`,o=`${t}API Key: ${s} \xB7 ${r}`;if(!this.editingModelApiKey)return[h.hex(d.text)(o)];let a=h.hex(d.muted)(" Edit: "),u=this.secretInput.render(Math.max(1,e-C(a)))[0]??"";return[h.hex(d.text)(o),`${a}${u}`]}renderModelDetails(){let e=this.selectedModel();if(!e)return[];let t=[e.limit?.context?`context ${e.limit.context.toLocaleString("en-US")}`:"",e.limit?.output?`output ${e.limit.output.toLocaleString("en-US")}`:""].filter(Boolean),i=[e.modalities?.input?.length?`input ${e.modalities.input.map(x).join(", ")}`:"",e.modalities?.output?.length?`output ${e.modalities.output.map(x).join(", ")}`:""].filter(Boolean),s=[e.attachment?"attachments":"",e.reasoning?"reasoning":"",e.toolCall?"tools":"",e.temperature?"temperature":""].filter(Boolean);return["",h.bold.hex(d.signal)("Model details"),h.hex(d.text)(`Model ID: ${x(e.modelId)}`),h.hex(d.text)(`Limits: ${t.join(" \xB7 ")||"Not specified"}`),h.hex(d.text)(`Modalities: ${i.join(" \xB7 ")||"Not specified"}`),h.hex(d.text)(`Capabilities: ${s.join(", ")||"None listed"}`)]}createProviderList(){let e=this.searchInput.getValue().trim().toLocaleLowerCase(),i=this.options.templates.filter(r=>`${r.providerId} ${r.name}`.toLocaleLowerCase().includes(e)).map(r=>({value:r.providerId,label:x(r.name),description:`${x(r.apiFormat)} \xB7 ${r.models.length} models`,groupLabel:"Known providers"}));(!e||"custom provider".includes(e))&&i.push({value:Zd,label:"Custom provider",description:"Enter URL, protocol, model ID, and API key",groupLabel:"Manual"});let s=this.createList(i);return s.onSelect=r=>this.selectProvider(r.value),s}createModelList(){let e=this.filteredModels(),t=this.createList(e.map(i=>({value:i.modelId,label:x(i.displayName??i.modelId),description:x(i.modelId)})));return t.onSelectionChange=()=>{this.closeModelDetails()},t.onSelect=i=>{if(this.selectedModelId!==i.value){this.selectedModelId=i.value,this.status="";return}if(!this.modelApiKeyDraft&&!this.connection?.hasApiKey){this.startModelApiKeyEdit();return}this.save(this.modelApiKeyDraft)},t}filteredModels(){let e=this.searchInput.getValue().trim().toLocaleLowerCase();return(this.template?.models??[]).filter(t=>`${t.modelId} ${t.displayName??""}`.toLocaleLowerCase().includes(e))}createFormatList(){let e=this.createList([...NF]);return e.onSelect=t=>{this.customApiFormat=t.value,this.enterTextMode("custom-model",this.customModelId)},e}createList(e){return new Je(e,Math.min(Math.max(e.length,1),10),it,{minPrimaryColumnWidth:24,maxPrimaryColumnWidth:40})}selectProvider(e){if(this.status="",e===Zd){this.resetKnownProviderDraft(),this.template=void 0,this.enterTextMode("custom-name",this.customName);return}this.template=this.options.templates.find(t=>t.providerId===e),this.template&&(this.resetKnownProviderDraft(),this.enterMode(this.matchingConnections().length?"connection":"model"))}matchingConnections(){let e=this.template;return e?(this.options.providers??[]).filter(t=>DM(t,e)&&t.configRevision):[]}createConnectionList(){let e=this.matchingConnections(),t=this.createList([...e.map(i=>({value:i.providerId,label:`Use existing connection: ${x(i.name)}`,description:`${i.providerId} \xB7 keep saved key \xB7 select or add models`})),{value:Zd,label:"Add another account",description:"Create a separate connection with an alias and API Key"}]);return t.onSelect=i=>{i.value===Zd?(this.connection=void 0,this.enterTextMode("alias","")):(this.connection=e.find(s=>s.providerId===i.value),this.enterMode("model"))},t}startModelApiKeyEdit(){this.editingModelApiKey=!0,this.modelFocus="api-key",this.status="",this.secretInput.setValue(""),this.secretInput.moveCursorToEnd(),this.syncFocus(),this.options.requestRender()}commitModelApiKey(e){let t=e.trim();if(!t&&!this.modelApiKeyDraft&&!this.connection?.hasApiKey){this.status="API Key is required.",this.options.requestRender();return}t&&(this.modelApiKeyDraft=t),this.editingModelApiKey=!1,this.modelFocus="models",this.status="",this.secretInput.setValue(""),this.syncFocus(),this.options.requestRender()}cancelModelApiKeyEdit(){this.editingModelApiKey=!1,this.status="",this.secretInput.setValue(""),this.syncFocus(),this.options.requestRender()}submitText(e){let t=e.trim();if(!t){this.status=`${this.inputLabel()} is required.`,this.options.requestRender();return}if(this.mode==="alias"){this.alias=t,this.enterMode("model");return}if(this.mode==="custom-name"){this.customName=t,this.enterTextMode("custom-url",this.customBaseUrl);return}if(this.mode==="custom-url"){if(!DF(t)){this.status="Base URL must use http or https.",this.options.requestRender();return}this.customBaseUrl=t,this.enterMode("custom-format");return}this.mode==="custom-model"&&(this.customModelId=t,this.enterMode("api-key"))}submitApiKey(e){let t=e.trim();if(!t){this.status="API Key is required.",this.options.requestRender();return}this.save(t)}async save(e){let t=this.saveInput(e);if(t){this.busy=!0,this.status="",this.options.requestRender();try{let i=await this.options.onSave(t);if(!i.success){this.status=i.status?.lastErrorMessage??"Connection test failed.";return}await this.options.onComplete({...i.provider?.providerId?{providerId:i.provider.providerId}:{},providerName:t.name??"Custom provider",modelId:t.modelId,...this.connection?{reused:!0}:{}}),this.template&&this.resetKnownProviderDraft()}catch(i){this.status=L(i,{summary:"Couldn't save the provider.",nextStep:"Check the URL, API key, and model, then retry."})}finally{e&&(this.status=this.status.split(e).join("[redacted]")),this.busy=!1,this.options.requestRender()}}}saveInput(e){if(this.template)return this.selectedModelId?{...this.connection?{providerId:this.connection.providerId,expectedRevision:this.connection.configRevision}:{},name:this.connection?.name??(this.alias||this.template.name),baseUrl:this.connection?.baseUrl??this.template.baseUrl,...e?{apiKey:e}:{},apiFormat:this.template.apiFormat,models:this.connection?FM(this.connection,this.template.models):this.template.models,modelId:this.selectedModelId,saveAndUse:!0}:void 0;if(!(!this.customName||!this.customBaseUrl||!this.customModelId))return{name:this.customName,baseUrl:this.customBaseUrl,apiKey:e,apiFormat:this.customApiFormat,models:[{modelId:this.customModelId,displayName:this.customModelId,configurationSource:"manual",toolCall:!0}],modelId:this.customModelId,saveAndUse:!0}}enterMode(e){this.mode=e,this.status="",this.searchInput.setValue(""),this.searchInput.moveCursorToEnd(),(e==="provider"||e==="model"||e==="custom-format"||e==="connection")&&this.rebuildList(),e==="api-key"&&(this.secretInput.setValue(""),this.secretInput.moveCursorToEnd()),this.syncFocus(),this.options.requestRender()}enterTextMode(e,t){this.mode=e,this.status="",this.textInput.setValue(t),this.textInput.moveCursorToEnd(),this.syncFocus(),this.options.requestRender()}rebuildList(){this.list=this.mode==="connection"?this.createConnectionList():this.mode==="provider"?this.createProviderList():this.mode==="model"?this.createModelList():this.createFormatList()}selectedModel(){return this.template?.models.find(e=>e.modelId===this.selectedModelId)}closeModelDetails(){this.selectedModelId="",this.status=""}resetKnownProviderDraft(){this.connection=void 0,this.alias="",this.selectedModelId="",this.modelFocus="models",this.editingModelApiKey=!1,this.modelApiKeyDraft="",this.secretInput.setValue("")}back(){if(this.mode==="provider")return this.resetKnownProviderDraft(),this.options.onCancel();if(this.mode==="model")return this.resetKnownProviderDraft(),this.enterMode("provider");if(this.mode==="connection")return this.enterMode("provider");if(this.mode==="alias")return this.enterMode("connection");if(this.mode==="custom-name")return this.enterMode("provider");if(this.mode==="custom-url")return this.enterTextMode("custom-name",this.customName);if(this.mode==="custom-format")return this.enterTextMode("custom-url",this.customBaseUrl);if(this.mode==="custom-model")return this.enterMode("custom-format");if(this.template)return this.enterMode("model");this.enterTextMode("custom-model",this.customModelId)}subtitle(){return this.mode==="connection"?"This provider is already configured. Use the saved connection or add another account.":this.mode==="alias"?"Give the additional account a recognizable name":this.mode==="provider"?"Choose a known provider or enter a custom endpoint":this.mode==="model"?`Choose a ${x(this.template?.name??"")} model`:this.mode==="api-key"?"The key is stored locally and never shown in output":"Custom provider"}inputLabel(){return this.mode==="alias"?"Account alias":this.mode==="custom-name"?"Provider name":this.mode==="custom-url"?"Base URL":this.mode==="custom-model"?"Model ID":"API Key"}footer(){return this.busy?"Testing and saving\u2026":this.mode==="model"?this.editingModelApiKey?"enter keep for setup \xB7 \u2193 models \xB7 esc cancel edit":this.modelFocus==="api-key"?"enter edit API Key \xB7 \u2193/tab models \xB7 esc models":this.selectedModelId?"enter test, save, and use \xB7 tab API Key \xB7 esc close details":"\u2191\u2193 select \xB7 type to search \xB7 tab API Key \xB7 enter details \xB7 esc back":this.mode==="api-key"?"enter test, save, and use \xB7 esc back":this.mode==="custom-name"||this.mode==="custom-url"||this.mode==="custom-model"||this.mode==="alias"?"enter continue \xB7 esc back":"\u2191\u2193 select \xB7 type to search \xB7 enter continue \xB7 esc back"}syncFocus(){this.searchInput.focused=this._focused&&(this.mode==="provider"||this.mode==="model"&&this.modelFocus==="models"&&!this.editingModelApiKey),this.textInput.focused=this._focused&&(this.mode==="custom-name"||this.mode==="custom-url"||this.mode==="custom-model"||this.mode==="alias"),this.secretInput.focused=this._focused&&(this.mode==="api-key"||this.mode==="model"&&this.editingModelApiKey)}};function DF(n){try{let e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}var th=["all","installed","official","local"],nh=class{constructor(e){this.options=e;this.plugins=[...e.plugins],this.searchInput.setValue(e.initialQuery?.trim()??""),this.searchInput.moveCursorToEnd();let t={render:r=>this.renderHeader(r),invalidate:()=>{}},i={render:r=>this.renderBody(r),invalidate:()=>{}},s={render:r=>this.renderFooter(r),invalidate:()=>{}};this.bodyViewport=new Nn(i,{primary:!0,overscroll:"contain"}),this.bodyViewport.setActiveRow(0,!0),this.layoutRoot=new St([{component:t,basis:"auto",shrink:1,minSize:1},{component:this.bodyViewport,basis:0,grow:1,shrink:1,minSize:1},{component:s,basis:"auto",shrink:1,minSize:1}])}id="plugins";layoutRoot;focused=!1;plugins;tab="all";searchInput=new Ne({prompt:""});bodyViewport;selectedIndex=0;busy=!1;status="";disposed=!1;handleInput(e){if(this.busy||this.disposed)return;if(v(e,"escape")||v(e,"ctrl+c")){this.searchInput.getValue()?(this.searchInput.setValue(""),this.resetSelection(),this.requestRender()):this.options.onCancel();return}if(v(e,"tab")){this.cycleTab(1);return}if(v(e,"shift+tab")){this.cycleTab(-1);return}if(v(e,"up"))return this.move(-1);if(v(e,"down"))return this.move(1);if(v(e,"enter")){let i=this.selected();i&&!i.installed&&this.mutate(i,()=>this.options.onInstall(i));return}if(v(e,"space")){let i=this.selected();i?.installed&&this.mutate(i,()=>this.options.onSetEnabled(i,!i.enabled));return}if(this.searchInput.getValue().length===0&&(v(e,"delete")||v(e,"ctrl+d"))){let i=this.selected();i?.installed&&this.mutate(i,()=>this.options.onRemove(i));return}if(v(e,"ctrl+r")){this.refresh();return}let t=this.searchInput.getValue();this.searchInput.handleInput(v(e,"shift+space")?" ":e),this.searchInput.getValue()!==t&&(this.resetSelection(),this.requestRender())}dispose(){this.disposed=!0}invalidate(){this.layoutRoot.invalidate()}render(e){return[...this.renderHeader(e),...this.renderBody(e),...this.renderFooter(e)]}renderHeader(e){let t=Math.max(0,e);if(!t)return[];let i=this.plugins.filter(a=>a.installed).length;this.searchInput.focused=this.focused;let s=h.hex(d.muted)("Search: "),r=Math.max(0,t-C(s)),o=`${s}${this.searchInput.render(r)[0]??""}`;return[h.bold.hex(d.signal)("Plugins"),h.hex(d.muted)(`Browse MiniMax Official and Local plugins \xB7 Installed ${i} of ${this.plugins.length}`),$F(this.tab,i),o,h.hex(d.line)("\u2500".repeat(t))].map(a=>E(a,t,"\u2026"))}renderBody(e){let t=Math.max(0,e);if(!t)return[];let i=this.visiblePlugins();return this.selectedIndex=i.length?Math.min(this.selectedIndex,i.length-1):0,this.bodyViewport.setActiveRow(this.selectedIndex),i.length===0?[h.hex(d.muted)("No matching plugins")]:i.map((s,r)=>E(BF(s,r===this.selectedIndex,t),t,"\u2026"))}renderFooter(e){let t=Math.max(0,e);return t?[this.status?h.hex(d.accent)(this.status):G("Enter install \xB7 Space enable/disable \xB7 Delete remove \xB7 Ctrl+R refresh"),G("\u2191\u2193 select \xB7 PgUp/PgDn scroll \xB7 Tab source \xB7 \u2190\u2192 edit search \xB7 Esc clear/close")].map(i=>E(i,t,"\u2026")):[]}visiblePlugins(){let e=this.searchInput.getValue().trim().toLocaleLowerCase();return this.plugins.filter(t=>this.tab==="all"||(this.tab==="installed"?t.installed:t.marketplace===this.tab)?e?[t.name,t.displayName,t.description,t.author].filter(s=>!!s).some(s=>s.toLocaleLowerCase().includes(e)):!0:!1)}selected(){return this.visiblePlugins()[this.selectedIndex]}move(e){let t=this.visiblePlugins().length;this.selectedIndex=t?Math.max(0,Math.min(t-1,this.selectedIndex+e)):0,this.bodyViewport.setActiveRow(this.selectedIndex,!0),this.status="",this.requestRender()}cycleTab(e){let t=th.indexOf(this.tab);this.tab=th[(t+e+th.length)%th.length]??"all",this.resetSelection(),this.requestRender()}resetSelection(){this.selectedIndex=0,this.bodyViewport.setActiveRow(0,!0),this.status=""}async mutate(e,t){this.busy=!0,this.status=`Updating ${e.displayName}\u2026`,this.requestRender();try{let i=await t();if(this.disposed)return;this.plugins=this.plugins.map(s=>s.pluginId===i.pluginId?i:s),this.status=`${i.displayName}: ${i.installed?i.enabled?"enabled":"disabled":"removed"}`}catch(i){if(this.disposed)return;this.status=L(i,{summary:`Couldn't update ${e.displayName}.`,nextStep:FF(i)?"Run /login, then retry.":"Retry or run mcode plugin for details."})}finally{this.disposed||(this.busy=!1,this.requestRender())}}async refresh(){this.busy=!0,this.status="Refreshing Plugin catalogs\u2026",this.requestRender();try{let e=await this.options.onRefresh();if(this.disposed)return;this.plugins=[...e],this.resetSelection(),this.status="Plugin catalogs refreshed."}catch(e){if(this.disposed)return;this.status=L(e,{summary:"Couldn't refresh Plugins.",nextStep:"Retry or run mcode plugin marketplace upgrade."})}finally{this.disposed||(this.busy=!1,this.requestRender())}}requestRender(){this.disposed||this.options.requestRender()}};function FF(n){return!n||typeof n!="object"?!1:("code"in n?n.code:void 0)==="PLUGIN_AUTH_REQUIRED"}function $F(n,e){return[["all","All Plugins"],["installed",`Installed (${e})`],["official","MiniMax Official"],["local","Local"]].map(([i,s])=>i===n?h.bold.hex(d.signal)(`[${s}]`):h.hex(d.muted)(s)).join(" ")}function BF(n,e,t){let i=n.enabled?"[*]":n.installed?"[-]":"[ ]",s=n.installed?n.enabled?"Enabled":"Disabled":"Available",r=`${e?"\u203A":" "} ${i} ${x(n.displayName)}`,o=`${s} \xB7 ${n.marketplace} \xB7 ${x(n.description??qF(n))}`,a=Math.max(1,t-C(r)-C(o));return`${e?h.bold.hex(d.signal)(r):h.hex(d.text)(r)}${" ".repeat(a)}${h.hex(d.muted)(o)}`}function qF(n){let{appCount:e,mcpServerCount:t,skillCount:i}=n.capabilities;return`${e} apps \xB7 ${t} MCP \xB7 ${i} skills`}var HF=["peek_","peek:"];function $M(n){if(n.visibility!=="hidden"||!n.parentSessionId)return!1;let e=n.purpose??"";return!HF.some(t=>e.startsWith(t))}var Q1=10,UF=200,ih=class{constructor(e){this.options=e;this.sessions=Ba(e.sessions),this.hasMore=!!(e.hasMore&&e.onLoadMore),this.now=e.now??Date.now,this.activeSessionId=e.activeSessionId,this.searchInput.setValue(e.initialQuery?.trim()??""),this.searchInput.onSubmit=()=>this.openSelected(),this.actionInput.onSubmit=t=>this.submitActionInput(t),this.actionInput.onEscape=()=>this.exitActionMode(),this.clampSelection(),this.searchInput.getValue()&&this.scheduleRemainingSearchLoad(),e.initialRenameSessionId&&this.startRename(e.initialRenameSessionId)}sessions;searchInput=new ze;actionInput=new ze;now;activeSessionId;view="active";scope="workspace";mode="list";selectedIndex=0;selectedSessionId;actionTargetId;busy=!1;hasMore;loadingMore=!1;pageLoad;searchLoadTimer;status;_focused=!1;disposed=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncInputFocus()}setSessions(e){this.disposed||(this.sessions=Ba(e),this.clampSelection(),this.requestRender())}startRename(e){let t=this.visibleSessions().findIndex(i=>i.sessionId===e);return t<0?(this.status={tone:"error",text:"The current Session is not available here. Use /rename <title> to rename it directly."},this.requestRender(),!1):(this.selectedIndex=t,this.selectedSessionId=e,this.enterTextMode("rename"),!0)}handleInput(e){if(this.busy||this.disposed)return;if(this.mode==="rename"){this.actionInput.handleInput(e),this.requestRender();return}if(this.mode==="confirm-archive"){v(e,j.enter)?this.confirmArchive():ie().matches(e,"tui.select.cancel")&&this.exitActionMode();return}if(v(e,j.up)){this.moveSelection(-1);return}if(v(e,j.down)){this.moveSelection(1);return}if(v(e,j.pageUp)){this.moveSelection(-Q1);return}if(v(e,j.pageDown)){this.moveSelection(Q1);return}if(v(e,j.ctrl("l"))){this.loadMore();return}let t=this.searchInput.getValue().length>0;if(!t&&v(e,j.ctrl("a"))){this.changeScope();return}if(v(e,j.tab)){this.view=this.view==="active"?"archived":"active",this.resetSelection();return}if(v(e,j.ctrl("n"))){this.options.onNew();return}if(v(e,j.ctrl("r"))){this.enterTextMode("rename");return}if(!t&&v(e,j.ctrl("d"))){this.toggleSelectedArchived();return}if(v(e,j.enter)){this.openSelected();return}if(ie().matches(e,"tui.select.cancel")){this.searchInput.getValue()?(this.searchInput.setValue(""),this.resetSelection()):this.options.onCancel();return}let i=this.searchInput.getValue();this.searchInput.handleInput(e),this.searchInput.getValue()!==i?(this.resetSelection(),this.scheduleRemainingSearchLoad()):this.requestRender()}invalidate(){this.searchInput.invalidate(),this.actionInput.invalidate()}dispose(){this.disposed=!0,this.searchLoadTimer&&clearTimeout(this.searchLoadTimer),this.searchLoadTimer=void 0,this.searchInput.focused=!1,this.actionInput.focused=!1}fullscreenViewport=!0;handlesViewportKeys=!0;render(e){return this.renderViewport(e,this.currentMaxRows()??1/0)}renderViewport(e,t){let i=Math.max(0,e);if(i===0)return[];let s=Number.isFinite(t)?Math.max(1,Math.floor(t)):void 0;return this.mode==="rename"?this.fitLines(this.fitToRows(this.renderTextMode(i,s),s),i):this.mode==="confirm-archive"?this.fitLines(this.fitToRows(this.renderArchiveConfirmation(i,s),s),i):this.fitLines(this.fitToRows(this.renderList(i,s),s),i)}renderList(e,t){let i=this.visibleSessions();this.clampSelection(i);let s=this.selectedSession(i),r=this.scopedSessions(),o=r.filter(_=>!_.archived).length,a=r.length-o,u=this.view==="active"?"Recent":"Archived",l=this.scope==="workspace"?"This workspace":"All sessions",c=this.searchInput.render(Math.max(1,e-12))[0]??"";if(t!==void 0&&t<=8)return this.renderInlineCompactList(e,t,i,u,c);let p=e<40||t!==void 0&&t<=18,m=e<40,g=!p&&!m,T=i.length>1?` \xB7 ${this.selectedIndex+1}/${i.length}`:"",y=`${m?e<30?"\u2191\u2193 \xB7 Enter \xB7 Esc \xB7 Ctrl+A all":`\u2191\u2193 \xB7 Enter \xB7 Esc \xB7 Ctrl+A ${this.scope==="workspace"?"all":"current"}${this.hasMore?" \xB7 Ctrl+L":""}`:p?`\u2191\u2193 \xB7 Enter ${this.view==="active"?"switch":"restore"} \xB7 Ctrl+A ${this.scope==="workspace"?"all":"current"}${this.hasMore?" \xB7 Ctrl+L more":""} \xB7 Tab ${this.view==="active"?"archived":"recent"} \xB7 Esc`:`\u2191\u2193 move \xB7 Enter ${this.view==="active"?"switch":"restore"} \xB7 Tab ${this.view==="active"?"archived":"recent"}`}${T}`,b=g?`Ctrl+A ${this.scope==="workspace"?"all":"current"} \xB7 Ctrl+N new \xB7 Ctrl+R rename \xB7 Ctrl+D ${this.view==="active"?"archive":"restore"}${this.hasMore?" \xB7 More sessions available \xB7 Ctrl+L more":""} \xB7 Esc close`:void 0,S=si([y,...b?[b]:[]],Math.max(1,e-4)),M=[ri(m?`Sessions \xB7 ${u}`:"Sessions",`${u} \xB7 ${l}`,e),Ce(h.hex(d.muted)(m?`${this.scope==="workspace"?"Workspace":l} \xB7 ${i.length} ${u.toLowerCase()}`:`${o} active \xB7 ${a} archived`),e)];if(!p&&(this.loadingMore||this.searchInput.getValue().trim()&&this.hasMore)&&M.push(Ce(h.hex(d.accent)(this.searchInput.getValue().trim()?"Searching saved sessions\u2026":"Loading more sessions\u2026"),e)),M.push(Ce(`${h.hex(d.muted)("Search")} ${c}`,e)),p||M.push(Ce(h.hex(d.dim)("Filter title, ID, workspace, model, status, or branch"),e)),i.length===0)M.push(Ce(h.hex(d.warning)(this.searchInput.getValue()?this.loadingMore||this.hasMore?"Searching saved sessions\u2026":"No matching sessions.":`No ${u.toLowerCase()} sessions in this workspace.`),e));else{let _=S.length+2,F=this.status?1:0,A=this.detailRowBudget(e,t),$=!this.searchInput.getValue().trim()&&e>=48&&(t===void 0||t>=20),N=Math.max(1,(t??Number.POSITIVE_INFINITY)-M.length-_-F-A),U=this.sessionWindow(i,N,$);M.push(...this.renderSessionWindow(U.sessions,e,N,$))}let R=this.detailRowBudget(e,t);if(s&&R>0){if(M.push(On(e),Ce(BM(h.bold.hex(d.text)(E(x(s.title?.trim()||"Untitled session"),Math.max(1,e-28),"\u2026")),h.hex(d.accent)(s.sessionId===this.activeSessionId?"\u25CF current":"\u25CB selected"),Math.max(1,e-4)),e)),R>=3&&M.push(Ce(h.hex(d.muted)(`ID ${x(s.sessionId)}${wn(s)?` \xB7 Sub-agent \xB7 Parent ${x(s.parentSessionId)}`:s.parentSessionId?" \xB7 child Session":""}`),e)),R>=4&&M.push(Ce(h.hex(d.muted)(`Path ${XF(YF(x(s.workspaceDir??"Unknown workspace")),Math.max(1,e-10))}`),e)),R>=5){let _=qM(s),F=s.interactionMode==="plan"?"Plan":void 0,A=[VF(s),_,F].filter(Boolean).join(" \xB7 ");A&&M.push(Ce(h.hex(d.muted)(A),e))}if(R>=6){let _=Y1(s.updatedAt,this.now()),F=Y1(s.createdAt,this.now()),A=[_?`Updated ${_}`:void 0,F?`Created ${F}`:void 0].filter(Boolean).join(" \xB7 ");A&&M.push(Ce(h.hex(d.dim)(A),e))}}return this.status&&M.push(Ce(this.status.tone==="error"?h.hex(d.error)(`! ${this.status.text}`):h.hex(d.accent)(`\u2713 ${this.status.text}`),e)),M.push(On(e),...S.map(_=>Ce(_,e)),oi(e)),M}renderInlineCompactList(e,t,i,s,r){this.clampSelection(i);let o=this.selectedSession(i),a=x(this.searchInput.getValue().trim()),u=a?`Sessions \xB7 /${a}`:`Sessions \xB7 ${s}`,l=a?this.loadingMore||this.hasMore?"Searching saved sessions\u2026":"No matching sessions.":`No ${s.toLowerCase()} sessions in this workspace.`,c=o?this.renderSessionLine(o,!0,e-4):h.hex(d.warning)(l),p=oe(e,t,"\u2191\u2193 \xB7 Enter \xB7 Tab \xB7 Ctrl+A \xB7 Esc"),m=[...p.bodyHeight>=2?[`${h.hex(d.muted)("Search")} ${r}`]:[],o?this.renderSessionLine(o,!0,p.contentWidth):c];return p.render({title:u,body:m})}detailRowBudget(e,t){return e<30||t!==void 0&&t<=18?0:e<60?4:6}renderSessionLine(e,t,i){let s=e.sessionId===this.activeSessionId,r=t?h.bold.hex(d.signal)("\u203A "):h.hex(d.dim)(" "),o=s?h.hex(d.success)("\u25CF "):"",a=x(e.title?.trim()||"Untitled session"),l=wn(e)?`\u21B3 Sub-agent${e.agentName?` \xB7 ${x(e.agentName)}`:""} \xB7 ${a}`:a,c=QF(e.status),p=[Y1(e.updatedAt,this.now()),s?"current":void 0,c].filter(T=>!!T).join(" \xB7 "),m=Math.max(1,i-C(r)-C(o)-4),g=`${r}${o}${E(l,m,"\u2026")}`;return BM(t?h.bold.hex(d.signal)(g):g,h.hex(d.muted)(p),i)}sessionWindow(e,t,i){if(e.length===0)return{sessions:[],start:0};let s=Math.max(1,Math.min(Q1,t,e.length));for(;;){let r=Math.max(0,Math.min(this.selectedIndex-Math.floor(s/2),Math.max(0,e.length-s))),o=e.slice(r,r+s);if(s===1||this.sessionWindowRowCount(o,i)<=t)return{sessions:o,start:r};s-=1}}sessionWindowRowCount(e,t){if(!t)return e.length;let i=0,s;for(let r of e){let o=this.sessionSection(r);o!==s&&(i+=1,s=o),i+=1}return i}renderSessionWindow(e,t,i,s){let r=[],o;for(let a of e){let u=this.sessionSection(a);if(s&&u!==o&&r.length<i-1&&r.push(Ce(h.bold.hex(d.text)(jF(u)),t)),o=u,r.length>=i)break;r.push(Ce(this.renderSessionLine(a,a.sessionId===this.selectedSessionId,t-4),t))}return r}sessionSection(e){let t=e.parentSessionId?this.sessions.find(i=>i.sessionId===e.parentSessionId):void 0;return WF(sh(t?.updatedAt??e.updatedAt),this.now())}renderTextMode(e,t){let i=this.findActionTarget(),s=oe(e,t,"Ctrl+U clear \xB7 Enter save \xB7 Esc cancel");return s.render({title:"Sessions / Rename session",body:[...s.bodyHeight>=2?[h.hex(d.muted)(x(i?.title?.trim()||i?.sessionId||"Unknown session"))]:[],this.actionInput.render(Math.max(1,s.contentWidth))[0]??"",...this.status?[h.hex(this.status.tone==="error"?d.error:d.accent)(this.status.text)]:[]]})}renderArchiveConfirmation(e,t){let i=this.findActionTarget();return Ln({title:"Archive session?",body:[x(i?.title?.trim()||i?.sessionId||"Unknown session"),h.hex(d.muted)("History stays available under Archived.")],footer:"Enter archive \xB7 Esc cancel"},e,t,"warning")}visibleSessions(){let e=this.searchInput.getValue().trim().toLocaleLowerCase().split(/\s+/u).filter(Boolean);return this.scopedSessions().filter(t=>{if(!!t.archived!=(this.view==="archived"))return!1;if(e.length===0)return!0;let i=GF(t);return e.every(s=>zF(i,s))})}scopedSessions(){let e=this.sessions.filter(i=>!Ja(i)&&(i.visibility!=="hidden"||$M(i)));if(this.scope==="all")return e;let t=rh(this.options.workspaceDir);return e.filter(i=>rh(i.workspaceDir)===t)}moveSelection(e){let t=this.visibleSessions();if(t.length!==0){if(this.clampSelection(t),e>0&&this.selectedIndex===t.length-1&&this.hasMore){this.loadMore();return}this.selectedIndex=(this.selectedIndex+e+t.length*Math.ceil(Math.abs(e)/t.length))%t.length,this.selectedSessionId=t[this.selectedIndex]?.sessionId,this.status=void 0,this.requestRender()}}loadMore(){this.loadNextPage(!0)}async changeScope(){let e=this.scope==="workspace"?"all":"workspace";if(!this.options.onScopeChange){this.scope=e,this.resetSelection();return}this.busy=!0,this.status={tone:"info",text:e==="all"?"Loading all sessions\u2026":"Loading this workspace\u2026"},this.requestRender();try{if(this.pageLoad&&await this.pageLoad,this.disposed)return;let t=await this.options.onScopeChange(e);if(this.disposed)return;this.scope=e,this.sessions=Ba(t.sessions),this.hasMore=!!(t.hasMore&&this.options.onLoadMore),this.selectedIndex=0,this.selectedSessionId=void 0,this.status=void 0,this.clampSelection(),this.scheduleRemainingSearchLoad()}catch(t){if(this.disposed)return;this.status={tone:"error",text:L(t,{summary:"Couldn't change the session scope.",nextStep:"Retry.",preservation:"The current session list is unchanged."})}}finally{this.disposed||(this.busy=!1,this.requestRender())}}scheduleRemainingSearchLoad(){this.searchLoadTimer&&clearTimeout(this.searchLoadTimer),this.searchLoadTimer=void 0,!(!this.searchInput.getValue().trim()||!this.hasMore)&&(this.searchLoadTimer=setTimeout(()=>{this.searchLoadTimer=void 0,this.loadRemainingForSearch()},UF))}loadRemainingForSearch(){!this.searchInput.getValue().trim()||!this.hasMore||this.loadNextPage(!1).then(e=>{!this.disposed&&e&&this.loadRemainingForSearch()})}loadNextPage(e){if(this.disposed)return Promise.resolve(!1);if(this.pageLoad)return this.pageLoad;if(!this.hasMore||!this.options.onLoadMore)return Promise.resolve(!1);this.loadingMore=!0,e&&(this.status=void 0),this.requestRender();let t=this.options.onLoadMore().then(i=>{if(this.disposed)return!1;let s=this.sessions.length,r=this.scopedSessions().length;this.sessions=KF(this.sessions,i.sessions),this.hasMore=i.hasMore;let o=this.sessions.length-s,a=this.scopedSessions().length-r;return e&&(this.status={tone:"info",text:this.scope==="workspace"&&a===0?i.hasMore?`${o} session${o===1?"":"s"} loaded \xB7 none in this workspace \xB7 Ctrl+A show all.`:"All sessions loaded \xB7 none new in this workspace.":i.hasMore?`${a} more session${a===1?"":"s"}${this.scope==="workspace"?" in this workspace":""} loaded.`:"All matching sessions loaded."}),this.clampSelection(),!0}).catch(i=>(this.disposed||(this.status={tone:"error",text:L(i,{summary:"Couldn't load more sessions.",nextStep:"Retry."})}),!1)).finally(()=>{this.pageLoad===t&&(this.pageLoad=void 0),this.disposed||(this.loadingMore=!1,this.requestRender())});return this.pageLoad=t,t}resetSelection(){this.selectedIndex=0,this.selectedSessionId=this.visibleSessions()[0]?.sessionId,this.status=void 0,this.requestRender()}clampSelection(e=this.visibleSessions()){if(e.length===0){this.selectedIndex=0,this.selectedSessionId=void 0;return}let t=this.selectedSessionId?e.findIndex(i=>i.sessionId===this.selectedSessionId):-1;this.selectedIndex=t>=0?t:Math.max(0,Math.min(this.selectedIndex,e.length-1)),this.selectedSessionId=e[this.selectedIndex]?.sessionId}selectedSession(e=this.visibleSessions()){if(this.selectedSessionId){let t=e.find(i=>i.sessionId===this.selectedSessionId);if(t)return t}return e[this.selectedIndex]}openSelected(){let e=this.selectedSession();e&&this.runAction(async()=>{await this.options.onSelect(e.sessionId,!!e.archived)})}enterTextMode(e){let t=this.selectedSession();t&&(this.mode=e,this.actionTargetId=t.sessionId,this.actionInput.setValue(t.title?.trim()??""),this.actionInput.moveCursorToEnd(),this.status=void 0,this.syncInputFocus(),this.requestRender())}submitActionInput(e){let t=this.findActionTarget();if(!t){this.exitActionMode();return}if(this.mode==="rename"){let i=e.trim();if(!i){this.setStatus("Session title cannot be empty.","error");return}if(i===(t.title?.trim()??"")){this.exitActionMode(!1),this.setStatus("Session title unchanged.","info");return}this.runAction(async()=>{let s=await this.options.onRename(t.sessionId,i);this.disposed||(this.replaceSession(s),this.exitActionMode(!1),this.setStatus(`Renamed to ${x(s.title??i)}.`,"info"))})}}toggleSelectedArchived(){let e=this.selectedSession();if(e){if(!e.archived){this.mode="confirm-archive",this.actionTargetId=e.sessionId,this.status=void 0,this.syncInputFocus(),this.requestRender();return}this.runAction(async()=>{await this.options.onSetArchived(e.sessionId,!1),!this.disposed&&(this.replaceSession({...e,archived:!1}),this.clampSelection(),this.setStatus("Session restored.","info"))})}}confirmArchive(){let e=this.findActionTarget();if(!e){this.exitActionMode();return}this.runAction(async()=>{await this.options.onSetArchived(e.sessionId,!0),!this.disposed&&(this.replaceSession({...e,archived:!0}),this.activeSessionId===e.sessionId&&(this.activeSessionId=void 0),this.exitActionMode(!1),this.clampSelection(),this.setStatus("Session archived.","info"))})}async runAction(e){this.busy=!0,this.status={tone:"info",text:"Working\u2026"},this.requestRender();try{await e()}catch(t){if(this.disposed)return;this.status={tone:"error",text:L(t,{summary:"Session changes were not saved.",nextStep:"Retry.",preservation:"The existing session is unchanged."})}}finally{this.disposed||(this.busy=!1,this.requestRender())}}exitActionMode(e=!0){this.mode="list",this.actionTargetId=void 0,this.actionInput.setValue(""),this.syncInputFocus(),e&&this.requestRender()}findActionTarget(){return this.sessions.find(e=>e.sessionId===this.actionTargetId)}replaceSession(e){this.sessions=Ba([e,...this.sessions.filter(t=>t.sessionId!==e.sessionId)])}setStatus(e,t){this.disposed||(this.status={text:e,tone:t},this.requestRender())}syncInputFocus(){this.searchInput.focused=this._focused&&this.mode==="list",this.actionInput.focused=this._focused&&this.mode==="rename"}fitLines(e,t){return e.map(i=>E(i,t,h.hex(d.dim)("\u2026")))}fitToRows(e,t){if(t===void 0||e.length<=t)return e;if(t<=3)return e.slice(-t);let i=e.slice(-3);return[...e.slice(0,t-i.length),...i]}currentMaxRows(){let e=typeof this.options.maxRows=="function"?this.options.maxRows():this.options.maxRows;return e===void 0?void 0:Math.max(1,Math.floor(e))}requestRender(){this.disposed||this.options.requestRender()}};function Ba(n){let e=[...n].sort((o,a)=>sh(a.updatedAt)-sh(o.updatedAt)),t=new Map;for(let o of e){if(!o.parentSessionId)continue;let a=t.get(o.parentSessionId)??[];a.push(o),t.set(o.parentSessionId,a)}let i=[],s=new Set,r=o=>{if(!s.has(o.sessionId)){s.add(o.sessionId),i.push(o);for(let a of t.get(o.sessionId)??[])r(a)}};for(let o of e)o.parentSessionId||r(o);for(let o of e)r(o);return i}function KF(n,e){let t=new Map(n.map(i=>[i.sessionId,i]));for(let i of e)t.set(i.sessionId,i);return Ba([...t.values()])}function sh(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let e=Number(n);if(Number.isFinite(e))return e;let t=Date.parse(n);if(Number.isFinite(t))return t}return 0}function Y1(n,e){let t=sh(n);if(!(t<=0))return ac(t,{preset:"social-compact",nowMs:e,locale:"en"})||void 0}function WF(n,e){if(n<=0||!Number.isFinite(n)||!Number.isFinite(e))return"older";let t=new Date(n),i=new Date(e),s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),r=Date.UTC(i.getFullYear(),i.getMonth(),i.getDate()),o=Math.round((r-s)/864e5);return o<=0?"today":o===1?"yesterday":o<7?"previous-7-days":"older"}function jF(n){return n==="today"?"Today":n==="yesterday"?"Yesterday":n==="previous-7-days"?"Previous 7 days":"Older"}function VF(n){if(n.sessionType==="branch")return"Branch";if(n.sessionType==="root")return"Root"}function qM(n){let e=[n.model?.providerId,n.model?.modelId].filter(Boolean).join("/"),t=n.model?.thinking?.effort?.trim();return[e||void 0,t].filter(Boolean).join(" \xB7 ")||void 0}function GF(n){let e=qM(n)?.toLocaleLowerCase()??"",t=n.sessionType??(n.parentSessionId?"branch":"");return{all:[n.title,n.sessionId,n.workspaceDir,n.parentSessionId,n.agentName,n.purpose,t,n.status,e,n.interactionMode].filter(s=>!!s).join(" ").toLocaleLowerCase(),id:n.sessionId.toLocaleLowerCase(),path:(n.workspaceDir??"").toLocaleLowerCase(),type:t.toLocaleLowerCase(),status:(n.status??"").toLocaleLowerCase(),model:e}}function zF(n,e){let t=e.indexOf(":");if(t<=0)return n.all.includes(e);let i=e.slice(0,t),s=e.slice(t+1);return s?i==="id"?n.id.includes(s):i==="path"?n.path.includes(s):i==="type"?n.type.includes(s):i==="status"?n.status.includes(s):i==="model"?n.model.includes(s):n.all.includes(e):n.all.includes(e)}function QF(n){if(n){if(n==="started"||n==="running")return"running";if(n==="error"||n==="failed")return"error"}}function rh(n){let e=(n??"").replaceAll("\\","/").replace(/\/+$/u,"");return/^[A-Za-z]:\//u.test(e)?e.toLocaleLowerCase():e}function YF(n){let e=process.env.HOME??process.env.USERPROFILE;if(!e)return n;let t=rh(e),i=rh(n);return i===t||i.startsWith(`${t}/`)?`~${i.slice(t.length)}`:n}function XF(n,e){if(C(n)<=e)return n;let t=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(n)].map(({segment:s})=>s),i="";for(let s=t.length-1;s>=0;s-=1){let r=`${t[s]}${i}`;if(C(r)>Math.max(1,e-1))break;i=r}return`\u2026${i}`}function BM(n,e,t){let i=t-C(n)-C(e);return i>=2?`${n}${" ".repeat(i)}${e}`:E(n,t,"\u2026")}var oh=class{constructor(e){this.options=e;this.markdown=new ft(e.markdown,0,0,Tt)}fullscreenViewport=!0;handlesViewportKeys=!0;markdown;viewportOffset=0;viewportRows=0;viewportLineCount=0;handleInput(e){ie().matches(e,"tui.select.cancel")?this.options.onClose():v(e,j.pageUp)?this.scrollByPage(-1):v(e,j.pageDown)?this.scrollByPage(1):v(e,j.up)?this.scrollByRows(-1):v(e,j.down)&&this.scrollByRows(1)}invalidate(){this.markdown.invalidate()}render(e){let t=Math.max(0,Math.floor(e));return t===0?[]:this.renderFrame(t,this.renderMarkdown(t))}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];let r=this.renderMarkdown(i),o=oe(i,s,"Esc close");if(r.length<=o.bodyHeight)return this.viewportOffset=0,this.viewportRows=r.length,this.viewportLineCount=r.length,this.renderFrame(i,r,"Esc close",s);let a=r.length,u=oe(i,s,`Lines ${a}-${a} of ${a} \xB7 PgUp/PgDn scroll \xB7 Esc close`);this.viewportRows=u.bodyHeight,this.viewportLineCount=a,this.viewportOffset=HM(this.viewportOffset,0,Math.max(0,a-this.viewportRows));let l=Math.min(a,this.viewportOffset+this.viewportRows);return this.renderFrame(i,r.slice(this.viewportOffset,l),`Lines ${this.viewportOffset+1}-${l} of ${a} \xB7 PgUp/PgDn scroll \xB7 Esc close`,s)}scrollByRows(e){if(this.viewportRows===0)return 0;let t=Math.max(0,this.viewportLineCount-this.viewportRows),i=HM(this.viewportOffset+Math.trunc(e),0,t),s=i-this.viewportOffset;return s!==0&&(this.viewportOffset=i,this.options.requestRender()),s}scrollByPage(e){return this.scrollByRows(e*Math.max(1,this.viewportRows-1))}renderMarkdown(e){let t=st(e);return this.markdown.render(t).map(i=>E(i,t))}renderFrame(e,t,i="Esc close",s){return Ln({title:"What's New",meta:`MCode ${this.options.version}`,body:t,footer:i},e,s)}};function HM(n,e,t){return Math.max(e,Math.min(t,n))}import{basename as s$,extname as r$}from"node:path";import{pathToFileURL as o$}from"node:url";var ah=class{constructor(e){this.options=e}selectedValue;selectedEffortValue;generation=0;hydrationSequence=0;mutationSequence=0;pendingSelections=0;selectionTail=Promise.resolve();stopped=!1;selected(){return this.selectedValue}selectedEffort(){return this.selectedEffortValue}reset(){this.generation+=1,this.hydrationSequence+=1,this.mutationSequence+=1,this.selectedValue=void 0,this.selectedEffortValue=void 0}stop(){this.stopped=!0,this.reset()}async refresh(e=this.options.currentSessionId()){if(this.isStopped())return this.selectedValue;let t=this.generation,i=++this.hydrationSequence,s=this.mutationSequence,r,o;try{r=await this.options.runtime.listModels(e),o=await this.readSessionEffort(e,r.find(a=>a.selected))}catch{return this.selectedValue}return!this.isCurrent(e,t)||i!==this.hydrationSequence||s!==this.mutationSequence||this.pendingSelections>0?this.selectedValue:(this.selectedValue=r.find(a=>a.selected),this.selectedEffortValue=this.selectedValue?o:void 0,this.options.onChanged(),this.selectedValue)}async select(e,t=this.options.currentSessionId()){if(!this.isCurrent(t,this.generation))return{status:"stale"};let i=this.generation,s=++this.mutationSequence;this.hydrationSequence+=1,this.pendingSelections+=1;let r=this.selectionTail.then(()=>this.applySelection(e,t,i,s));this.selectionTail=r.then(()=>{},()=>{});try{return await r}finally{this.pendingSelections=Math.max(0,this.pendingSelections-1)}}async applySelection(e,t,i,s){if(!this.isCurrent(t,i))return{status:"stale"};let r;try{r=await this.options.runtime.selectModel(e,t)}catch(u){if(!this.isCurrent(t,i))return{status:"stale"};if(s!==this.mutationSequence)return{status:"superseded"};throw this.mutationSequence+=1,this.hydrationSequence+=1,u}if(!this.isCurrent(t,i))return{status:"stale"};if(s!==this.mutationSequence)return{status:"superseded"};if(this.mutationSequence+=1,this.hydrationSequence+=1,!r)return{status:"rejected"};let{thinking:o,...a}=e;return this.selectedValue={...a,selected:!0},this.selectedEffortValue=o?.effort?.trim()||void 0,this.options.onChanged(),{status:"selected",model:this.selectedValue}}async readSessionEffort(e,t){let i=this.options.runtime.getSession;if(!(!e||!i))try{let s=await i.call(this.options.runtime,e);return t&&s.model?.providerId&&s.model.modelId&&(s.model.providerId!==t.providerId||s.model.modelId!==t.modelId)?void 0:s.model?.thinking?.effort?.trim()||void 0}catch{return this.selectedEffortValue}}isCurrent(e,t){return!this.isStopped()&&t===this.generation&&this.options.currentSessionId()===e}isStopped(){return this.stopped||!!this.options.isStopped?.()}};import{randomUUID as JF}from"node:crypto";var ZF=100,e$=100,uh=class{constructor(e){this.options=e}forking=!1;async forkFromUserMessage(e){if(this.forking)throw new Error("A Session fork is already in progress.");let t=this.options.currentSession();if(!t)throw new Error("Start or resume a Session before forking.");if(!this.options.isSessionIdle())throw new Error("Wait for the active turn to finish before forking.");let i=this.options.runtime.getSessionForkOptions,s=this.options.runtime.forkSession;if(!i||!s)throw new Error("Session fork is unavailable in this Runtime.");this.forking=!0;try{let r=await this.findForkBoundary(t.sessionId,e),o=await i.call(this.options.runtime,t.sessionId,r);if(this.requireCurrentSource(t.sessionId),!o.canFork)throw new Error(`This prompt cannot be forked${o.unavailableReason?`: ${o.unavailableReason}`:"."}`);let a=await s.call(this.options.runtime,{sessionId:t.sessionId,assistantMessageId:r,clientRequestId:(this.options.createRequestId??JF)(),useSuggestedTitle:!0,createIsolatedWorktree:!1});this.requireCurrentSource(t.sessionId),await this.options.onOpenSession(a.session.sessionId)}finally{this.forking=!1}}async findForkBoundary(e,t){let i=[],s,r=new Set;for(let o=0;o<e$;o+=1){let a=await this.options.runtime.listMessagePage(e,{limit:ZF,...s?{before:s}:{}});i=t$(a.messages,i);let u=n$(i,t);if(u)return u;if(!a.hasMore||!a.nextCursor||r.has(a.nextCursor))break;r.add(a.nextCursor),s=a.nextCursor}throw i.some(o=>o.id===t)?new Error("The selected prompt has no completed Assistant boundary to fork from."):new Error("The selected prompt is no longer present in Runtime history.")}requireCurrentSource(e){if(this.options.isStopped?.())throw new Error("The TUI closed before the fork completed.");if(this.options.currentSession()?.sessionId!==e)throw new Error("The active Session changed before the fork completed.")}};function t$(n,e){let t=new Set;return[...n,...e].filter(i=>!i.id||!t.has(i.id)?(i.id&&t.add(i.id),!0):!1)}function n$(n,e){let t=n.findIndex(i=>i.id===e&&i.role==="user");if(!(t<0))for(let i=t+1;i<n.length;i+=1){let s=n[i];if(s){if(s.role==="user")return;if(s.role==="assistant"&&s.id&&s.actions?.fork===!0)return s.id}}}function UM(n){let e=i$(n.panel);return n.status==="claimed"?`Checked in: Cycle day ${n.dayNo}, +${n.points} Credits
|
|
238
|
+
${M.slice(-uM)}`:M)}}};var Fd=class{constructor(e){this.options=e}project(e){let t=e.sessionId;if(t){if(e.type==="permission.ask"){this.options.stateStore.dispatch({type:"interaction/permissionReceived",sessionId:t,permission:e.request});return}if(e.type==="permission.resolved"){this.options.stateStore.dispatch({type:"interaction/permissionResolved",sessionId:t,requestId:e.requestId});return}if(e.type==="questionnaire.ask"){this.options.stateStore.dispatch({type:"interaction/questionnaireReceived",sessionId:t,questionnaire:Cs(e.request,t,e.agentName)});return}if(e.type==="questionnaire.dismiss"||e.type==="questionnaire.superseded"){this.options.stateStore.dispatch({type:"interaction/questionnaireResolved",sessionId:t,requestId:e.requestId});return}if(e.type==="session.queue.updated"&&e.itemId&&e.status){if(!this.options.queueEnabled)return;this.options.stateStore.dispatch({type:"execution/queueObserved",sessionId:t,item:{itemId:e.itemId,status:e.status}});return}(e.type==="session.start"||e.type==="session.finish"||e.type==="session.error"||e.type==="session.abort")&&this.options.stateStore.dispatch({type:"execution/runObserved",sessionId:t,run:{runId:e.turnId??`session:${t}`,turnId:e.turnId,status:e.type==="session.start"?"running":"terminal"}})}}async reconcile(e){let t=e.sessionId,i=Tn(this.options.stateStore.snapshot(),t),s=i?.runRevision??0,r=i?.queueRevision??0,o=i?.permissionRevision??0,a=i?.questionnaireRevision??0,u=this.options.resolveSessionAgentName?.(t)??this.options.defaultAgentName,[l,c,p,m]=await Promise.allSettled([this.options.runtime.getActiveRun(t),this.options.queueEnabled?this.options.runtime.listQueuedMessages(t):Promise.resolve(void 0),this.options.runtime.listPendingPermissions(),this.options.runtime.getPendingQuestionnaire(u,t)]),g=[l,c,p,m].flatMap(b=>b.status==="rejected"?[b.reason]:[]);if(g.length>0)throw new AggregateError(g,`Unable to reconcile Runtime state for session ${t}.`);let T=[];if(l.status==="fulfilled"){let b=l.value,S=b.state==="running"||b.state==="decision-blocked",M=b.turnId??`session:${t}`;T.push({type:"execution/runsReconciled",sessionId:t,expectedRunRevision:s,runs:S?[{runId:M,turnId:b.turnId,status:b.state==="decision-blocked"?"blocked":"running"}]:[]})}c.status==="fulfilled"&&c.value!==void 0&&T.push({type:"execution/queueReplaced",sessionId:t,expectedQueueRevision:r,items:c.value.map(b=>({itemId:b.itemId,status:b.status??"queued",content:b.content,runtimeItem:b}))});let y={type:"interaction/snapshotReconciled",sessionId:t,expectedPermissionRevision:o,expectedQuestionnaireRevision:a};if(p.status==="fulfilled"){let b=new Set(this.options.permissionSessionScope?.(t)??[]);b.add(t),y.permission=p.value.find(S=>S.sessionId!==void 0&&b.has(S.sessionId))??null}if(m.status==="fulfilled"){let b=m.value;y.questionnaire=b?Cs(b,t,b.requester?.agentName??u):null}return("permission"in y||"questionnaire"in y)&&T.push(y),T.push({type:"connection/sessionReconciled",sessionId:t}),T}};function lM(n){let e=n.reason??n.toolDescription??n.toolInput;return e?x(e).trim():"Review this tool action."}function $d(n,e){let t=x(n.toolName??"unknown");return e==="allowAlways"?`Saved permission rule \xB7 ${t}`:e==="deny"?`Denied \xB7 ${t}`:`Allowed for this conversation \xB7 ${t}`}var B1=6,_a=class{constructor(e,t,i){this.request=e;this.onSelect=t;this.onStop=i;let s=[{value:"allowOnce",label:"1 Allow for this conversation"},...e.allowAlwaysSupported===!1?[]:[{value:"allowAlways",label:"2 Always allow matching actions"}],{value:"deny",label:e.allowAlwaysSupported===!1?"2 Deny and guide MCode":"3 Deny and guide MCode"}];this.decisions=s.map(r=>r.value),this.list=new Je(s,s.length,VD(),{minPrimaryColumnWidth:22,maxPrimaryColumnWidth:34,truncatePrimary:({item:r,maxWidth:o})=>GD(r.value,this.decisions.indexOf(r.value)+1,o)}),this.list.onSelect=r=>this.choose(r.value),this.list.onCancel=()=>this.onSelect("deny"),this.denyInput.onSubmit=r=>this.onSelect("deny",r.trim()||void 0),this.denyInput.onEscape=()=>{this.denyFeedback=!1,this.syncDenyInputFocus(),this.resetViewport()}}list;decisions;_focused=!1;confirmAlways=!1;denyFeedback=!1;detailsExpanded=!1;detailsExpandable=!1;submitting;viewportOffset=0;viewportEvidenceRows=0;viewportEvidenceLineCount=0;denyInput=new ze;get focused(){return this._focused}set focused(e){this._focused=e,this.syncDenyInputFocus()}handleInput(e){if(!this.submitting){if(v(e,"ctrl+c")){this.onStop();return}if(!this.confirmAlways&&v(e,"ctrl+e")&&(this.detailsExpandable||this.detailsExpanded)){this.detailsExpanded=!this.detailsExpanded,this.resetViewport();return}if(this.denyFeedback){this.denyInput.handleInput(e);return}if(this.confirmAlways){v(e,"enter")?this.onSelect("allowAlways"):(v(e,"escape")||v(e,"left"))&&(this.confirmAlways=!1,this.resetViewport());return}if(/^[1-9]$/u.test(e)){let t=Number(e)-1,i=this.decisions[t];i&&this.choose(i);return}this.list.handleInput(e)}}invalidate(){this.list.invalidate(),this.denyInput.invalidate()}beginSubmitting(e){this.submitting=e,this.syncDenyInputFocus(),this.resetViewport(),this.invalidate()}render(e){let t=Math.max(0,Math.floor(e));return t===0?[]:Bd(this.buildFrameModel(t),t)}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];let r=this.buildFrameModel(i),o=Bd(r,i);if(o.length<=s)return this.resetViewport(),o;let a={...r,leading:fM(r.leading),trailing:gM(r.trailing)};if(a.evidence.length===0)return cM(a,i).slice(0,s);let u={start:1,end:1,visibleTotal:a.evidence.length},l=Bd(a,i,[],u).length;if(l>=s)return this.resetViewport(),cM(a,i).slice(0,s);let c=s-l;this.viewportEvidenceRows=c,this.viewportEvidenceLineCount=a.evidence.length,this.viewportOffset=mM(this.viewportOffset,0,Math.max(0,a.evidence.length-c));let p=Math.min(a.evidence.length,this.viewportOffset+c),m={start:this.viewportOffset+1,end:p,visibleTotal:a.evidence.length};return Bd(a,i,a.evidence.slice(this.viewportOffset,p),m).slice(0,s)}scrollByRows(e){if(this.viewportEvidenceRows===0)return 0;let t=Math.max(0,this.viewportEvidenceLineCount-this.viewportEvidenceRows);if(t===0)return 0;let i=mM(this.viewportOffset+Math.trunc(e),0,t),s=i-this.viewportOffset;return this.viewportOffset=i,s}scrollByPage(e){return this.scrollByRows(e*Math.max(1,this.viewportEvidenceRows-1))}buildFrameModel(e){let t=Ze(e),i=x(this.request.toolName??"unknown"),s=UD(i),r=KD(i);if(this.detailsExpandable=!1,this.submitting)return{title:"\u25CC Applying permission\u2026",meta:s,tone:r,leading:[...new Se(h.bold.hex(d.text)(WD(this.submitting)),0,0).render(Math.max(1,t)),...new Se(h.hex(d.muted)("Waiting for Runtime to commit the decision."),0,0).render(Math.max(1,t))],evidence:[],trailing:[]};if(this.confirmAlways){let a=ZD(this.request,t);return{title:"\u25C6 Save permission rule",meta:s,tone:"warning",leading:[h.bold.hex(d.text)("Always allow matching actions?"),""],evidence:a,trailing:["",...new Se(h.hex(d.muted)("Future matching actions will continue without asking."),0,0).render(Math.max(1,t))],footer:QD(t),statusLine:u=>u?XD("Scope",u,a.length,t):void 0}}if(this.denyFeedback){let a=dM(this.request,t,this.detailsExpanded);return this.detailsExpandable=a.expandable,{title:"\xD7 Deny action",meta:s,tone:"warning",leading:[h.bold.hex(d.text)("Deny this action?"),""],evidence:a.lines,trailing:["",h.hex(d.muted)("Add guidance for MCode, or leave this blank."),...this.denyInput.render(Math.max(1,t)).map(u=>La(u,t))],footer:YD(t),statusLine:hM(a,t)}}let o=dM(this.request,t,this.detailsExpanded);return this.detailsExpandable=o.expandable,{title:"\u25C6 Approval required",meta:s,tone:r,leading:[h.bold.hex(d.text)(HD(i)),""],evidence:o.lines,trailing:["",...this.renderDecisionOptions(t)],footer:zD(t),statusLine:hM(o,t)}}renderDecisionOptions(e){let t=this.list.render(Math.max(1,e)),i=this.list.getSelectedItem()?.value,s=i?this.decisions.indexOf(i):-1;if(!i||s<0)return t;let r=Math.max(1,e-4),o=new Se(h.hex(d.muted)(jD(i)),0,0).render(r).map(a=>La(` ${a}`,e));return[...t.slice(0,s+1),...o,...t.slice(s+1)]}resetViewport(){this.viewportOffset=0,this.viewportEvidenceRows=0,this.viewportEvidenceLineCount=0}choose(e){if(e==="allowAlways"){this.confirmAlways=!0,this.resetViewport();return}if(e==="deny"){this.denyFeedback=!0,this.denyInput.setValue(""),this.syncDenyInputFocus(),this.resetViewport();return}this.onSelect(e)}syncDenyInputFocus(){this.denyInput.focused=this._focused&&this.denyFeedback&&this.submitting===void 0}};function Bd(n,e,t=n.evidence,i){let s=n.statusLine?.(i);return Fe({title:n.title,meta:n.meta,body:[...n.leading,...t,...s?[G(s)]:[],...n.trailing],footer:n.footer},e,n.tone)}function cM(n,e){return ji([h.bold.hex(d[n.tone])(n.title),...fM(n.leading),...gM(n.trailing),...n.footer?[G(n.footer)]:[]],e,n.tone)}function dM(n,e,t=!1){let i=[];n.structuredPreview?i.push(...Sr(n.structuredPreview,e,{maxBodyLines:Number.MAX_SAFE_INTEGER})):n.toolInput&&i.push(...JD(n,e));let s=[];n.toolDescription&&n.toolDescription!==n.toolName&&n.toolDescription!==n.toolInput&&s.push(...pM(n.toolDescription,e)),n.reason&&n.reason!==n.toolDescription&&n.reason!==n.toolInput&&s.push(...pM(`Why \xB7 ${n.reason}`,e));let r=[...i,...s],o=r.length>B1,a=t&&o,u=Math.min(i.length,Math.max(1,B1-Math.min(s.length,3))),l=[...i.slice(0,u),...s.slice(0,B1-u)];return{lines:a?r:l,totalLines:r.length,expandable:o,expanded:a}}function HD(n){let e=n.toLocaleLowerCase().replaceAll("-","_");return e==="bash"||e.includes("shell")||e.includes("exec")?"Run this command?":e.includes("write")||e.includes("create_file")?"Write this file?":e.includes("edit")||e.includes("patch")?"Apply these edits?":e.includes("delete")||e.includes("remove")?"Delete this item?":`Allow ${n}?`}function UD(n){let e=n.replaceAll(/[-_]+/gu," ").trim();return e?e.replace(new RegExp("^\\p{Ll}","u"),t=>t.toLocaleUpperCase()):"Unknown"}function KD(n){let e=n.toLocaleLowerCase().replaceAll("-","_");return e.includes("delete")||e.includes("remove")?"error":"warning"}function WD(n){return n==="allowAlways"?"Saving the permission rule and allowing this action\u2026":n==="deny"?"Denying this action\u2026":"Allowing for this conversation\u2026"}function jD(n){return n==="allowAlways"?"Review the exact saved scope next":n==="deny"?"Add guidance before denying this action":"MCode asks again in a new conversation"}function VD(){return{...it,selectedPrefix:n=>h.bold.hex(d.signal)(n),selectedText:n=>{let e=n.startsWith("\u2192 ")?n.slice(2):n.trimStart();return`${h.bold.hex(d.signal)("\u203A")} ${h.bold.hex(d.signal)(e)}`}}}function GD(n,e,t){let i=String(Math.max(1,e)),s=n==="allowOnce"?[`${i} Allow for this conversation`,`${i} Allow this conversation`,`${i} Allow conversation`,`${i} Allow`]:n==="allowAlways"?[`${i} Always allow matching actions`,`${i} Always allow matching`,`${i} Always allow`]:[`${i} Deny and guide MCode`,`${i} Deny and guide`,`${i} Deny`];return s.find(r=>C(r)<=t)??E(s.at(-1)??i,Math.max(1,t),"")}function zD(n){return["\u2191/\u2193 choose \xB7 Enter confirm \xB7 Esc deny \xB7 Ctrl+C stop","\u2191/\u2193 \xB7 Enter confirm \xB7 Esc deny \xB7 Ctrl+C stop","Enter confirm \xB7 Esc deny \xB7 Ctrl+C stop","Enter \xB7 Esc deny \xB7 Ctrl+C"].find(t=>C(t)<=n)??"Enter \xB7 Esc"}function QD(n){return["Enter save and allow \xB7 Esc go back \xB7 Ctrl+C stop","Enter save \xB7 Esc go back \xB7 Ctrl+C stop","Enter save \xB7 Esc back"].find(t=>C(t)<=n)??"Enter \xB7 Esc"}function YD(n){return["Enter deny \xB7 Esc go back \xB7 Ctrl+C stop","Enter deny \xB7 Esc back \xB7 Ctrl+C stop","Enter deny \xB7 Esc back"].find(t=>C(t)<=n)??"Enter \xB7 Esc"}function hM(n,e){return t=>{if(!t&&!n.expandable)return;let i=n.expanded?"Ctrl+E collapse":"Ctrl+E review all";if(!t){let o=n.lines.length;return q1([`Details ${String(o)} of ${String(n.totalLines)} lines \xB7 ${i}`,`${String(o)}/${String(n.totalLines)} lines \xB7 ${i}`,`${String(o)}/${String(n.totalLines)} \xB7 Ctrl+E`],e)}let s=`${String(t.start)}-${String(t.end)}`,r=n.expandable&&!n.expanded?[`Details ${s} of ${String(t.visibleTotal)} shown \xB7 ${String(n.totalLines)} total \xB7 PgUp/PgDn scroll \xB7 ${i}`,`${s}/${String(t.visibleTotal)} shown \xB7 ${String(n.totalLines)} total \xB7 PgUp/PgDn \xB7 Ctrl+E`,`${s}/${String(t.visibleTotal)} \xB7 PgUp/PgDn \xB7 Ctrl+E`]:[`Details ${s} of ${String(n.totalLines)} \xB7 PgUp/PgDn scroll${n.expandable?` \xB7 ${i}`:""}`,`${s}/${String(n.totalLines)} \xB7 PgUp/PgDn${n.expandable?" \xB7 Ctrl+E":""}`];return q1(r,e)}}function XD(n,e,t,i){let s=`${String(e.start)}-${String(e.end)}`;return q1([`${n} ${s} of ${String(t)} \xB7 PgUp/PgDn scroll`,`${n} ${s}/${String(t)} \xB7 PgUp/PgDn`,`${s}/${String(t)} \xB7 PgUp/PgDn`],i)}function q1(n,e){return n.find(t=>C(t)<=e)??E(n.at(-1)??"",Math.max(0,e),"")}function JD(n,e){let t=n.toolName?.toLocaleLowerCase()??"",s=t==="bash"||t.includes("shell")||t.includes("exec")?jl(n.toolInput):void 0,r=s?"$":"\u203A",o=Math.max(1,e-4),a=x(s??n.toolInput??"");return new Se(s?Cr(a):h.hex(d.text)(a),0,0).render(o).map((l,c)=>La(` ${c===0?h.hex(d.accent)(r):" "} ${l}`,e))}function pM(n,e){let t=Math.max(1,e-2);return new Se(h.hex(d.muted)(x(n)),0,0).render(t).map(i=>La(` ${i}`,e))}function ZD(n,e){let t=n.ruleContents&&n.ruleContents.length>0?n.ruleContents:["Exact saved scope is unavailable."];return eF("Scope",t.map(i=>`- ${i}`),e)}function eF(n,e,t){let i=Math.min(12,Math.max(4,Math.floor(t/3))),s=` ${n.slice(0,i).padEnd(i)} `,r=Math.max(1,t-s.length);return e.flatMap(a=>new Se(h.hex(d.text)(x(a)),0,0).render(r)).map((a,u)=>{let l=u===0?` ${h.bold.hex(d.muted)(n.slice(0,i).padEnd(i))} `:" ".repeat(s.length);return La(`${l}${a}`,t)})}function La(n,e){return E(n,Math.max(0,e),"")}function fM(n){let e=n.length;for(;e>0&&n[e-1]==="";)e-=1;return n.slice(0,e)}function gM(n){let e=0;for(;e<n.length&&n[e]==="";)e+=1;return n.slice(e)}function mM(n,e,t){return Number.isFinite(n)?Math.min(t,Math.max(e,Math.floor(n))):e}var TM=1e3,yM=60,Jr=class{constructor(e,t,i,s={}){this.state=e;this.onAnswer=t;this.onCancel=i;this.onSubmit=s.onSubmit,this.onDismiss=s.onDismiss,this.requestRender=s.requestRender,this.now=s.now??Date.now,this.stepIndex=aF(e),this.mode="answer",this.configureStep(),this.startCountdown(),this.input.onSubmit=r=>{if(this.mode!=="text")return;let o=r.trim();o&&this.commitAnswer(o)},this.input.onEscape=()=>{this.mode==="text"&&(this.step?.options?.length??0)>0?(this.rememberTextDraft(),this.mode="answer",this.configureStep()):this.requestDismissConfirmation()}}stepIndex;mode;input=new ze;_focused=!1;multiSelected=new Set;textDrafts=new Map;singleIndex=0;multiIndex=0;confirmDismiss=!1;dismissing=!1;submitting=!1;viewportOptionRows;onSubmit;onDismiss;requestRender;now;countdownTimer;get focused(){return this._focused}set focused(e){this._focused=e,this.syncInputFocus()}handleInput(e){if(this.dismissing||this.submitting)return;if(v(e,"ctrl+c")){this.onCancel();return}if(this.confirmDismiss){v(e,"enter")?(this.confirmDismiss=!1,this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0),this.onDismiss?.()):v(e,"escape")&&(this.confirmDismiss=!1,this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0));return}if(!this.step){v(e,"escape")&&this.requestDismissConfirmation();return}if(v(e,"tab")||this.mode!=="text"&&v(e,"right")){this.moveStep(1);return}if((v(e,"shift+tab")||this.mode!=="text"&&v(e,"left"))&&U1(this.state)){this.moveStep(-1);return}if(this.mode==="text"){this.input.handleInput(e);return}if(!H1(this.step.selectionMode)){let s=this.step.options??[],r=s.length+(this.step.allowOther?1:0);if(v(e,"up")){this.singleIndex=this.singleIndex===0?r-1:this.singleIndex-1;return}if(v(e,"down")){this.singleIndex=this.singleIndex===r-1?0:this.singleIndex+1;return}if(/^[1-9]$/u.test(e)){let o=Number(e)-1;if(o>=0&&o<s.length){this.commitAnswer(String(o+1));return}if(this.step.allowOther&&o===s.length){this.openTextInput();return}}if(v(e,"enter")){this.singleIndex<s.length?this.commitAnswer(String(this.singleIndex+1)):this.step.allowOther&&this.openTextInput();return}if(this.step.allowOther&&e.toLocaleLowerCase()==="o"){this.openTextInput();return}v(e,"escape")&&this.requestDismissConfirmation();return}let t=this.step.options??[],i=t.length+(this.step.allowOther?1:0);if(v(e,"up")){i>0&&(this.multiIndex=this.multiIndex===0?i-1:this.multiIndex-1);return}if(v(e,"down")){i>0&&(this.multiIndex=this.multiIndex===i-1?0:this.multiIndex+1);return}if(/^[1-9]$/u.test(e)){let s=Number(e)-1;s>=0&&s<t.length&&(this.multiIndex=s,this.toggleMultiChoice(s));return}if(v(e,"space")){this.multiIndex<t.length?this.toggleMultiChoice(this.multiIndex):this.step.allowOther&&this.openTextInput();return}if(v(e,"enter")){this.multiIndex===t.length&&this.step.allowOther?this.openTextInput():this.multiSelected.size===0&&t[this.multiIndex]?this.commitAnswer(String(this.multiIndex+1)):this.multiSelected.size>0&&this.commitAnswer([...this.multiSelected].sort((s,r)=>s-r).map(s=>String(s+1)).join(","));return}if(this.step.allowOther&&e.toLocaleLowerCase()==="o"){this.mode="text",this.configureTextInput();return}v(e,"escape")&&this.requestDismissConfirmation()}invalidate(){this.input.invalidate()}beginDismiss(){return this.dismissing?!1:(this.confirmDismiss=!1,this.dismissing=!0,this.stopCountdown(),this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0),!0)}beginSubmitting(){this.submitting=!0,this.stopCountdown(),this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0)}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t),s=iF(this.state,this.stepIndex);if(this.submitting)return Fe({title:"Ask",meta:s,body:[h.bold.hex(d.text)("Sending answers\u2026"),h.hex(d.muted)("Waiting for MiniMax Code to continue the conversation.")]},t,"signal");if(this.dismissing)return Fe({title:"Ask",meta:s,body:[h.bold.hex(d.text)("Closing question\u2026"),Et(h.hex(d.muted)("Waiting for MiniMax Code to dismiss the pending request."),i)]},t,"signal");if(this.confirmDismiss)return Fe({title:"Cancel this question?",body:[Et(h.hex(d.muted)("The pending request and its unsent answers will be discarded."),i)],footer:Et("Enter cancel question \xB7 Esc keep answering",i)},t,"warning");if(!this.step)return Fe({title:"Ask",meta:s,body:[Et(h.hex(d.muted)("All questionnaire steps are answered."),i)]},t,"signal");let r=this.step.header??this.state.request.title,o=this.state.answers.get(this.step.id),a=sF(this.state,this.stepIndex,i),u=this.goalAutoReplyRemainingSeconds(),c=[...!!r&&a.length===0&&r?new Se(h.hex(d.muted)(x(r)),0,0).render(i):[],...new Se(h.bold.hex(d.text)(x(this.step.question)),0,0).render(i),...this.step.description?new Se(h.hex(d.muted)(x(this.step.description)),0,0).render(i):[],...u!==void 0?tF(u,i):[],...o?[Et(h.hex(d.success)(`Saved answer \xB7 ${x(o.rawText)}`),i)]:[],""];if(this.mode==="text")return Fe({title:"Ask",meta:s,navigation:a,body:[...c,...this.input.render(i).map(m=>Et(m,i))],footer:Et(`Type your answer \xB7 Enter ${K1(this.state,this.step.id)?"send":"next"} \xB7 Esc ${(this.step.options?.length??0)>0?"back":"cancel"}`,i)},t,"signal");if(!H1(this.step.selectionMode))return Fe({title:"Ask",meta:s,navigation:a,body:[...c,...this.renderSingleOptions(this.step.options??[],i)],footer:Et(SM(i,`\u2191\u2193 move \xB7 1-${Math.min(9,(this.step.options?.length??0)+(this.step.allowOther?1:0))} select \xB7 Enter ${K1(this.state,this.step.id)?"send":"next"}`,U1(this.state)),i)},t,"signal");let p=this.step.options??[];return Fe({title:"Ask",meta:s,navigation:a,body:[...c,...this.renderMultiOptions(p,i),...this.step.allowOther?[this.renderMultiOther(p.length,i)]:[]],footer:Et(SM(i,`\u2191\u2193 move \xB7 Space toggle \xB7 Enter ${K1(this.state,this.step.id)?"send":"next"}`,U1(this.state)),i)},t,"signal")}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];this.viewportOptionRows=Math.max(1,s-9);try{return oF(this.render(i),s)}finally{this.viewportOptionRows=void 0}}dispose(){this.stopCountdown()}renderSingleOptions(e,t){let i=[...e.map((a,u)=>({label:this.optionLabel(a),description:a.description,number:u+1})),...this.step?.allowOther?[{label:"Other\u2026",description:this.step.otherPlaceholder??"Type another answer",number:e.length+1}]:[]],s=rF(i,this.singleIndex,this.viewportOptionRows),r=[],o=vM(s.items.map(a=>a.label),t);s.start>0&&r.push(Et(h.hex(d.dim)(` \u2026 ${s.start} more above`),t));for(let[a,u]of s.items.entries()){let c=s.start+a===this.singleIndex,p=`${c?"\u203A":" "} ${u.number} `;r.push(...bM({prefix:p,label:u.label,description:this.viewportOptionRows===void 0?u.description:void 0,width:t,labelColumnWidth:o,focused:c}))}return s.end<i.length&&r.push(Et(h.hex(d.dim)(` \u2026 ${i.length-s.end} more below`),t)),r}renderMultiOptions(e,t){let i=Math.max(1,Math.min(6,this.viewportOptionRows??6)),s=Math.max(0,Math.min(this.multiIndex-Math.floor(i/2),e.length-i)),r=Math.min(e.length,s+i),o=[],a=vM(e.slice(s,r).map(u=>this.optionLabel(u)),t);s>0&&o.push(Et(h.hex(d.dim)(` \u2026 ${s} more above`),t));for(let u=s;u<r;u+=1){let l=e[u];if(!l)continue;let c=u===this.multiIndex?"\u2192":" ",p=this.multiSelected.has(u)?"\u25CF":"\u25CB";o.push(...bM({prefix:`${c} ${p} ${u+1} `,label:this.optionLabel(l),description:this.viewportOptionRows===void 0?l.description:void 0,width:t,labelColumnWidth:a,focused:u===this.multiIndex}))}return r<e.length&&o.push(Et(h.hex(d.dim)(` \u2026 ${e.length-r} more below`),t)),o}renderMultiOther(e,t){let i=e===this.multiIndex,s=`${i?"\u2192":" "} o `,r="Other\u2026";return qd(i?`${h.bold.hex(d.signal)(s)}${h.bold.hex(d.signal)(r)}`:h.hex(d.muted)(`${s}${r}`),t,i)}get step(){return this.state.request.steps[this.stepIndex]}optionLabel(e){return this.goalAutoReplyRemainingSeconds()!==void 0&&e.recommended===!0?`${e.label} (Recommended)`:e.label}configureStep(){let e=this.step;if(this.multiSelected.clear(),this.singleIndex=0,this.multiIndex=0,this.syncInputFocus(),!e||this.mode==="text")return;let t=e.options??[],i=this.state.answers.get(e.id);if(H1(e.selectionMode)){let o=new Set(i?.answer.selectedOptionIds??[]);for(let[u,l]of t.entries())o.has(l.id)&&this.multiSelected.add(u);let a=[...this.multiSelected][0];this.multiIndex=i?.answer.selectedOther?t.length:Math.min(t.length-1,Math.max(0,a??0));return}if(t.length===0){this.mode="text",this.configureTextInput();return}this.input.setValue("");let s=i?.answer.selectedOptionIds?.[0],r=s?t.findIndex(o=>o.id===s):i?.answer.selectedOther?t.length:0;this.singleIndex=Math.max(0,r)}openTextInput(){this.mode="text",this.configureTextInput()}requestDismissConfirmation(){if(!this.onDismiss){this.onCancel();return}this.confirmDismiss=!0,this.syncInputFocus(),this.invalidate(),this.requestRender?.(!0)}configureTextInput(){let e=this.state.answers.get(this.step?.id??"");this.input.setValue(this.textDrafts.get(this.stepIndex)??e?.answer.otherText??""),this.syncInputFocus()}commitAnswer(e){if(this.onAnswer(this.stepIndex,e),Zl(this.state)){this.input.focused=!1,this.onSubmit?.();return}this.stepIndex=uF(this.state,this.stepIndex),this.mode="answer",this.configureStep()}syncInputFocus(){this.input.focused=this._focused&&this.mode==="text"&&!this.confirmDismiss&&!this.dismissing&&!this.submitting}moveStep(e){let t=this.state.request.steps.length;t!==0&&(this.rememberTextDraft(),this.stepIndex=(this.stepIndex+e+t)%t,this.mode="answer",this.configureStep())}rememberTextDraft(){this.mode!=="text"||!this.step||this.textDrafts.set(this.stepIndex,this.input.getValue())}toggleMultiChoice(e){this.multiSelected.has(e)?this.multiSelected.delete(e):this.multiSelected.add(e)}goalAutoReplyDeadline(){let e=this.state.request.expiresAt;return this.state.request.purpose==="goal"&&typeof e=="number"&&Number.isFinite(e)?e:void 0}goalAutoReplyRemainingSeconds(){let e=this.goalAutoReplyDeadline();if(e!==void 0)return Math.max(0,Math.ceil((e-this.now())/TM))}startCountdown(){let e=this.goalAutoReplyDeadline();e===void 0||e<=this.now()||!this.requestRender||(this.countdownTimer=setInterval(()=>{this.requestRender?.(),e<=this.now()&&this.stopCountdown()},TM),this.countdownTimer.unref())}stopCountdown(){this.countdownTimer&&(clearInterval(this.countdownTimer),this.countdownTimer=void 0)}};function tF(n,e){let t=n===0?`${h.hex(d.orbit)("\u25F7")} ${h.hex(d.muted)("Time is up \xB7 applying the recommended option\u2026")}`:`${h.hex(d.orbit)("\u25F7")} ${h.hex(d.muted)("Auto-continue in ")}${h.bold.hex(d.text)(nF(n))}${h.hex(d.muted)(" with the recommended option")}`;return new Se(t,0,0).render(e)}function nF(n){let e=Math.floor(n/yM),t=n%yM;return`${e}:${t.toString().padStart(2,"0")}`}function iF(n,e){if(n.request.presentation?.showProgress===!1)return;let t=n.request.steps.length;return t<=1?`${Math.min(t,e+1)} of ${t}`:`${n.answers.size}/${t} answered`}function sF(n,e,t){if(n.request.presentation?.showProgress===!1||n.request.steps.length<=1||t<52)return[];let i=n.request.steps,s=Math.max(1,Math.min(i.length,Math.floor((t+1)/19))),r=Math.max(0,Math.min(e-Math.floor(s/2),i.length-s)),o=Math.min(i.length,r+s),a=t-(r>0?2:0)-(o<i.length?2:0),u=Math.max(8,Math.min(18,Math.floor((a-s+1)/s))),l=i.slice(r,o).map((m,g)=>{let T=r+g,y=x(m.header??`Question ${T+1}`).trim(),b=T===e?"\u25CF":n.answers.has(m.id)?"\u2713":"\u25CB",S=E(y,Math.max(1,u-4),""),M=` ${b} ${S} `,R=`${M}${" ".repeat(Math.max(0,u-C(M)))}`;return T===e?mt(` ${h.bold.hex(d.signal)(b)} ${h.bold.hex(d.signal)(S)} `,u,h.bgHex(d.userMessageBg)):n.answers.has(m.id)?h.hex(d.success)(R):h.hex(d.dim)(R)}),c=r>0?h.hex(d.dim)("\u2026 "):"",p=o<i.length?h.hex(d.dim)(" \u2026"):"";return[`${c}${l.join(" ")}${p}`]}function bM(n){let e=x(n.label),t=n.description?x(n.description):void 0,i=n.focused?`${h.bold.hex(d.signal)(n.prefix)}${h.bold.hex(d.signal)(e)}`:h.hex(d.text)(`${n.prefix}${e}`),s=C(n.prefix),r=!!t&&n.width>=64&&n.width-s-n.labelColumnWidth>=24;if(t&&r){let a=Math.max(1,n.width-s-n.labelColumnWidth-2),u=Y(t,a),l=" ".repeat(Math.max(0,n.labelColumnWidth-C(e))),c=" ".repeat(s+n.labelColumnWidth+2);return u.map((p,m)=>{let g=m===0?`${i}${l} ${h.hex(d.muted)(p)}`:`${c}${h.hex(d.muted)(p)}`;return qd(g,n.width,n.focused)})}let o=[qd(i,n.width,n.focused)];if(t){let a=Math.max(1,n.width-s);for(let u of Y(t,a))o.push(qd(`${" ".repeat(s)}${h.hex(d.muted)(u)}`,n.width,n.focused))}return o}function vM(n,e){let t=Math.max(0,...n.map(i=>C(x(i))));return Math.min(t,Math.max(12,Math.floor(e*.32)))}function qd(n,e,t){let i=Et(n,e);return t?mt(i,e,h.bgHex(d.userMessageBg)):i}function Et(n,e){return E(n,Math.max(0,e),"")}function rF(n,e,t){if(t===void 0||n.length<=t)return{items:n,start:0,end:n.length};let i=Math.max(1,t-2),s=Math.max(0,Math.min(e-Math.floor(i/2),n.length-i)),r=Math.min(n.length,s+i);return{items:n.slice(s,r),start:s,end:r}}function oF(n,e){if(n.length<=e)return[...n];let t=new Set,i=Math.min(5,Math.max(1,e-3)),s=Math.min(2,Math.max(0,e-i));for(let o=0;o<i;o+=1)t.add(o);for(let o=Math.max(i,n.length-s);o<n.length;o+=1)t.add(o);let r=n.findIndex(o=>/[›→]/u.test(ge(o)));if(r>=0)for(let o=0;t.size<e;o+=1){let a=r-o,u=r+o;if(a>=i&&a<n.length-s&&t.add(a),u>=i&&u<n.length-s&&t.add(u),a<i&&u>=n.length-s)break}for(let o=i;t.size<e&&o<n.length-s;o+=1)t.add(o);return[...t].sort((o,a)=>o-a).slice(0,e).map(o=>n[o]??"")}function H1(n){return n===1||n==="multiple"}function U1(n){return n.request.steps.length>1&&n.request.presentation?.allowBackNavigation!==!1}function SM(n,e,t){let i=/Enter (?:send|next)/u.exec(e)?.[0]??"Enter",s=`${e}${t?" \xB7 Tab/\u2190/\u2192 questions":""} \xB7 Esc cancel`,r=`${e} \xB7 Esc cancel`,o=`${i} \xB7 Esc cancel`,a="Enter \xB7 Esc cancel",u="Enter \xB7 Esc";return[s,r,o,a,u].find(l=>C(l)<=n)??u}function K1(n,e){return n.request.steps.every(t=>t.id===e||n.answers.has(t.id))}function aF(n){let e=n.request.steps.findIndex(t=>!n.answers.has(t.id));return e>=0?e:Math.max(0,n.request.steps.length-1)}function uF(n,e){let t=n.request.steps.length;for(let i=1;i<=t;i+=1){let s=(e+i)%t,r=n.request.steps[s];if(r&&!n.answers.has(r.id))return s}return Math.max(0,Math.min(e,t-1))}var lF=new Map([["QUESTIONNAIRE_NOT_FOUND","Question is no longer available."],["QUESTIONNAIRE_ALREADY_ANSWERED","Answered on another surface."],["QUESTIONNAIRE_NOT_PENDING","Question is no longer pending."],["SESSION_NOT_FOUND","Session is no longer available."]]);function Oa(n){let e=gc(n)&&typeof n.code=="string"?n.code:void 0,t=e?lF.get(e):void 0;return e&&t?{status:"terminal",code:e,detail:t}:{status:"retryable",...e?{code:e}:{}}}var Hd=class{constructor(e){this.dependencies=e}state;async reply(e,t){let{controller:i,runtime:s}=this.dependencies,r=e.sessionId??i.snapshot().session?.sessionId;this.state=r?{requestId:e.request.id,sessionId:r,finished:!1}:void 0,this.updateTranscript(e.request.id,{status:"pending",detail:"Sending your answer\u2026",updatedAtMs:Date.now()}),this.render();let o;try{o=await s.replyQuestionnaire(e.agentName??e.request.requester?.agentName??vi,e.request.id,ec(e,{skipUnanswered:t}))}catch(u){if(!this.isSessionActive(r))return this.clear(e.request.id),{ok:!1,finished:!1};let l=Oa(u);if(l.status==="terminal"){let c=this.dependencies.transcript.get(`question:${e.request.id}`);this.clear(e.request.id),r&&await i.refreshSessionMetadata(r).catch(()=>{});let p=Date.now();return this.dependencies.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:"resolved",title:c?.title??e.request.title??"Agent needs input",content:c?.content??Ar(e),detail:l.detail,ephemeral:!0,createdAtMs:c?.createdAtMs??p,updatedAtMs:p}),this.render(),{ok:!0,finished:!0}}throw this.restoreRetryableQuestion(e),u}if(!this.isSessionActive(r))return this.clear(e.request.id),{ok:o,finished:!1};if(!o)return this.restoreRetryableQuestion(e),{ok:!1,finished:!1};let a=this.finished(e.request.id);return a||this.updateTranscript(e.request.id,{status:"resolved",detail:"Answer sent \xB7 MCode is continuing\u2026",updatedAtMs:Date.now()}),{ok:!0,finished:a}}clear(e){e&&this.state?.requestId!==e||(this.state=void 0)}isActive(e){return this.state?.requestId===e&&!this.state.finished}async handleEvent(e,t){if(this.state?.sessionId!==t||e.sessionId!==t)return!1;if(e.type==="session.start")return!e.turnId||this.state.turnId&&this.state.turnId!==e.turnId||(this.state.turnId=e.turnId,this.dependencies.updateChrome()),!1;if(!cF(e)||!this.state.turnId||e.turnId!==this.state.turnId)return!1;let i=this.state.requestId;if(this.state.finished=!0,await this.dependencies.controller.refreshSessionMetadata(t).catch(()=>{}),!this.isSessionActive(t))return!0;let s=this.dependencies.transcript.get(`question:${i}`);return s?.ephemeral&&this.dependencies.transcript.upsert({id:s.id,detail:void 0,updatedAtMs:Date.now()}),this.dependencies.hasActiveQuestionnaire()||this.clear(),this.render(),!0}restoreRetryableQuestion(e){this.clear(e.request.id),this.updateTranscript(e.request.id,{status:"blocked",title:e.request.title||"Agent needs input",detail:"Answer could not be sent \xB7 retry",updatedAtMs:Date.now()}),this.render()}finished(e){return this.state?.requestId===e&&this.state.finished}updateTranscript(e,t){let i=`question:${e}`;this.dependencies.transcript.get(i)&&this.dependencies.transcript.upsert({id:i,...t})}render(){this.dependencies.updateChrome(),this.dependencies.requestRender()}isSessionActive(e){return!this.dependencies.isStopped?.()&&!!e&&this.dependencies.controller.snapshot().session?.sessionId===e}};function cF(n){return n.type==="session.finish"||n.type==="session.error"||n.type==="session.abort"}var Ud=["Agree and start implementation","Skip for now","Add context to revise"],Na=class{constructor(e,t,i){this.onAction=t;this.requestRender=i;this.reviewDescription=e.request.steps.find(s=>s.id==="plan-review")?.description?.trim(),this.input.onSubmit=s=>{let r=s.trim();!r||this.submittingLabel||(this.beginSubmitting("Sending feedback\u2026"),this.onAction({kind:"feedback",text:r}))},this.input.onEscape=()=>{this.mode="review",this.syncInputFocus(),this.requestRender()}}reviewDescription;input=new ze;_focused=!1;mode="review";selectedIndex=0;submittingLabel;optionRows=[];get focused(){return this._focused}set focused(e){this._focused=e,this.syncInputFocus()}handleInput(e){if(!this.submittingLabel){if(this.mode==="feedback"){this.input.handleInput(e);return}if(v(e,"up")){this.selectedIndex=this.selectedIndex===0?Ud.length-1:this.selectedIndex-1,this.requestRender();return}if(v(e,"down")){this.selectedIndex=(this.selectedIndex+1)%Ud.length,this.requestRender();return}if(v(e,"enter")){this.confirmSelection();return}v(e,"escape")&&(this.beginSubmitting("Skipping review\u2026"),this.onAction({kind:"skip"}))}}confirmSelection(){if(this.selectedIndex===0){this.beginSubmitting("Starting implementation\u2026"),this.onAction({kind:"approve"});return}if(this.selectedIndex===1){this.beginSubmitting("Skipping review\u2026"),this.onAction({kind:"skip"});return}this.mode="feedback",this.syncInputFocus(),this.requestRender()}beginSubmitting(e){this.submittingLabel=e,this.syncInputFocus(),this.requestRender()}restore(){this.submittingLabel=void 0,this.syncInputFocus(),this.requestRender()}invalidate(){this.input.invalidate()}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t);return this.submittingLabel?(this.optionRows=[],Fe({title:"Plan Review",body:[h.bold.hex(d.text)(this.submittingLabel),h.hex(d.muted)("Waiting for Runtime to commit the decision.")]},t,"signal")):this.mode==="feedback"?(this.optionRows=[],Fe({title:"Add context",body:[G("Tell MiniMax Code what to adjust, then press Enter."),...this.input.render(i)],footer:"Enter send \xB7 Esc back"},t,"signal")):[...this.renderReviewFrame(t)]}handleMouse(e){let t=e.button==="primary"||e.action==="release"&&e.button==="none";if(this.mode!=="review"||this.submittingLabel||!t)return!1;let i=this.optionRows.indexOf(e.y);return i<0?!1:(this.selectedIndex=i,e.action==="release"?this.confirmSelection():this.requestRender(),!0)}syncInputFocus(){this.input.focused=this._focused&&this.mode==="feedback"&&this.submittingLabel===void 0}renderReviewFrame(e){let t=this.reviewDescription?[h.hex(d.warning)(this.reviewDescription),""]:[],i=[...t,h.bold.hex(d.text)("Plan complete. What would you like to do?"),...Ud.map((o,a)=>dF(o,a===this.selectedIndex))],r=(e<12?0:1)+t.length+1;return this.optionRows=Ud.map((o,a)=>r+a),Fe({title:"Plan Review",meta:h.hex(d.muted)("Full plan above \xB7 frozen snapshot"),body:i,footer:"\u2191/\u2193 select \xB7 Enter confirm \xB7 Esc skip"},e,"signal")}};function W1(n){return n.request.mode==="plan"&&!!n.request.modePayload?.planReview}function dF(n,e){return e?`${h.bold.hex(d.signal)("\u203A")} ${h.bold.hex(d.text)(n)}`:` ${h.hex(d.muted)(n)}`}var Kd=class{constructor(e,t,i=()=>{}){this.onClose=t;this.requestRender=i;let s=e.request.modePayload?.planReview;this.markdown=new ft(s?.markdown??"",0,0,Tt),this.path=x(s?.path??"")}markdown;path;viewportOffset=0;viewportRows=0;viewportLineCount=0;handleInput(e){ie().matches(e,"tui.select.cancel")&&this.onClose()}invalidate(){this.markdown.invalidate()}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t),s=this.markdown.render(i).map(r=>E(r,i));return this.renderFrame(t,s)}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];let r=Ze(i),o=this.markdown.render(r).map(c=>E(c,r)),a=this.renderFrame(i,o);if(a.length<=s)return this.viewportOffset=0,this.viewportRows=o.length,this.viewportLineCount=o.length,a;let u=this.renderFrame(i,[],["Lines 1-1 of 1 \xB7 PgUp/PgDn scroll"]).length;if(u>=s)return s===1?[a[0]??""]:[...a.slice(0,s-1),a.at(-1)??""];this.viewportRows=s-u,this.viewportLineCount=o.length,this.viewportOffset=CM(this.viewportOffset,0,Math.max(0,o.length-this.viewportRows));let l=Math.min(o.length,this.viewportOffset+this.viewportRows);return this.renderFrame(i,o.slice(this.viewportOffset,l),[`Lines ${String(this.viewportOffset+1)}-${String(l)} of ${String(o.length)} \xB7 PgUp/PgDn scroll`]).slice(0,s)}scrollByRows(e){if(this.viewportRows===0)return 0;let t=Math.max(0,this.viewportLineCount-this.viewportRows),i=CM(this.viewportOffset+Math.trunc(e),0,t),s=i-this.viewportOffset;return s===0?0:(this.viewportOffset=i,this.requestRender(),s)}scrollByPage(e){return this.scrollByRows(e*Math.max(1,this.viewportRows-1))}renderFrame(e,t,i=[]){let s=Ze(e);return Fe({title:"Latest Plan",meta:this.path?E(this.path,s):void 0,navigation:i.map(G),body:t,footer:"Esc close"},e,"signal")}};function CM(n,e,t){return Math.max(e,Math.min(t,n))}var hF=["Continue with plan","Deny"],Wd=class{constructor(e,t,i=new Set(["confirm","decline"])){this.onAction=e;this.requestRender=t;this.availableActions=i}selectedIndex=0;submitting;handleInput(e){if(this.submitting)return;if(v(e,"up")||v(e,"down")){this.selectedIndex=this.selectedIndex===0?1:0,this.requestRender();return}let t=Qe(e)??e;if(t==="1"){this.submit("confirm");return}if(t==="2"||v(e,"escape")){this.submit("decline");return}v(e,"enter")&&this.submit(this.selectedIndex===0?"confirm":"decline")}beginSubmitting(e){this.submitting=e,this.requestRender()}restore(){this.submitting=void 0,this.requestRender()}invalidate(){}render(e){let t=Math.max(0,e);if(t===0)return[];let i=Ze(t);return this.submitting?Fe({title:"Plan mode",body:[h.bold.hex(d.text)(this.submitting==="confirm"?"Continuing with plan\u2026":"Keeping Default mode\u2026"),h.hex(d.muted)("Waiting for MiniMax Code to continue the conversation.")]},t,"signal"):Fe({title:"Use Plan mode?",body:[E(h.hex(d.muted)("Plan mode structures complex tasks before execution."),i),"",...hF.map((s,r)=>{let o=r===0?"confirm":"decline",a=this.availableActions.has(o),u=a?s:`${s} (unavailable)`;return r===this.selectedIndex?`${h.bold.hex(d.signal)("\u203A")} ${h.bold.hex(a?d.text:d.muted)(u)}`:` ${h.hex(d.muted)(u)}`})],footer:"\u2191/\u2193 select \xB7 Enter confirm \xB7 Esc deny"},t,"signal")}submit(e){this.availableActions.has(e)&&(this.beginSubmitting(e),this.onAction(e))}};var jd=class{constructor(e){this.options=e;this.defaultAgentName=e.defaultAgentName??vi,this.agentStatusEnabled=!!(e.agentStatusLineItems&&Hi(e.agentStatusLineItems).includes("build-mode")),this.continuation=new Hd({runtime:e.runtime,controller:e.controller,transcript:e.transcript,requestRender:e.onChanged,updateChrome:e.onChanged,hasActiveQuestionnaire:()=>!!this.questionnaire(),isStopped:e.isStopped})}defaultAgentName;continuation;agentStatusEnabled;questionnaireDismissals=new Set;panel;planViewRevision=0;submittingRequestId;submittingSessionId;permission(){return this.interactions().permission}questionnaire(){return this.interactions().questionnaire}hasPending(){return!!(this.permission()||this.questionnaire())}continuesTurn(e,t){let i=this.permission();if(i){let r=i.sessionId??this.options.controller.snapshot().session?.sessionId,o=r?this.options.permissionOwnerTurnId?.(r):void 0;if(wM(r,o,e,t))return!0}let s=this.questionnaire();if(s){let r=s.sessionId??s.request.requester?.sessionId??this.options.controller.snapshot().session?.sessionId;if(wM(r,s.request.requester?.runId,e,t))return!0}return!1}agentReadback(){if(!this.agentStatusEnabled)return;let e=this.permission();if(e){if(!Da(e))return{kind:"invalid"};let i=this.options.controller.snapshot().session?.sessionId,s=e.sessionId??i,r=s?this.options.permissionOwnerTurnId?.(s):void 0;return{kind:"permission",requestId:e.requestId,submitting:this.isAgentSubmission(e.requestId),...s&&s!==i?{ownerSessionId:s,...r?{ownerTurnId:r}:{}}:{}}}let t=this.questionnaire();if(t?.request.id)return{kind:t.request.mode==="plan"?"plan":"questionnaire",requestId:t.request.id,submitting:this.isAgentSubmission(t.request.id)}}deactivate(){this.planViewRevision+=1,this.clearAgentSubmission(),this.continuation.clear(),this.hidePanel(),this.options.onChanged()}replaceFromActiveSession(){this.planViewRevision+=1;let e=this.permission()?.requestId??this.questionnaire()?.request.id;(this.submittingRequestId!==e||this.submittingSessionId!==this.options.stateStore.snapshot().activeSessionId)&&this.clearAgentSubmission(),this.hidePanel(),this.showPending(),this.options.onChanged()}setQuestionnaire(e,t,i){if(this.isStopped())return;let s=Cs(e,t,i),r=t??this.options.controller.snapshot().session?.sessionId,o=r?Tn(this.options.stateStore.snapshot(),r)?.interactions.questionnaire:void 0;r&&this.options.stateStore.dispatch({type:"interaction/questionnaireReceived",sessionId:r,questionnaire:s}),o&&o.request.id!==e.id&&this.clearPlanReviewBody(o.request.id);let a=r===this.options.stateStore.snapshot().activeSessionId?this.questionnaire():r?Tn(this.options.stateStore.snapshot(),r)?.interactions.questionnaire:void 0;a?.request.id===e.id&&this.projectQuestionnaire(a,o?.request.id!==e.id)}projectQuestionnaire(e,t=!0){let i=Date.now(),s=this.options.transcript.get(`question:${e.request.id}`),r=this.createdAtOrNow(e.request.createdAt,i);this.projectPlanReviewBody(e,i),this.options.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:s?.status??"blocked",title:s?.title??e.request.title??"Agent needs input",content:s?.content??"",detail:s?.detail,turnId:s?.turnId??e.request.requester?.runId,createdAtMs:s?.createdAtMs??r,updatedAtMs:i}),t&&!this.continuation.isActive(e.request.id)&&this.showQuestionnairePicker(),this.notifyPendingInteraction("question-required",`question:${e.request.id}`)}planReviewBodyId(e){return`plan-review-body:${e}`}projectPlanReviewBody(e,t){if(!e.request.modePayload?.planReview)return;let i=e.request.modePayload.planReview.markdown.trim()||"_Plan preview unavailable._",s=this.planReviewBodyId(e.request.id),r=this.options.transcript.get(s);this.options.transcript.upsert({id:s,kind:"question",status:"blocked",title:"Plan Review",content:i,contentFormat:"markdown",ephemeral:!0,turnId:r?.turnId??e.request.requester?.runId,createdAtMs:r?.createdAtMs??t,updatedAtMs:t})}clearPlanReviewBody(e){this.options.transcript.remove(this.planReviewBodyId(e))}setPermission(e,t){if(this.isStopped()||!Da(e))return;let i=e.sessionId??this.options.controller.snapshot().session?.sessionId,s=t??i;s&&this.options.stateStore.dispatch({type:"interaction/permissionReceived",sessionId:s,permission:e});let r=Date.now(),o=this.createdAtOrNow(e.createdAt,r);this.options.transcript.upsert({id:`permission:${e.requestId}`,kind:"permission",status:"blocked",title:x(e.toolName??"Tool action"),content:lM(e),createdAtMs:o,updatedAtMs:r}),this.showPermissionPicker(),this.notifyPendingInteraction("permission-required",`permission:${e.requestId}`)}async recover(e){if(this.isStopped())return;this.hidePanel();let t=Tn(this.options.stateStore.snapshot(),e),i=t?.permissionRevision??0,s=t?.questionnaireRevision??0,r=t?.interactions.questionnaire,o=this.resolveSessionAgentName(e),[a,u]=await Promise.allSettled([this.options.runtime.getPendingQuestionnaire(o,e),this.options.runtime.listPendingPermissions()]);if(this.isStopped()||this.options.controller.snapshot().session?.sessionId!==e)return;let l={type:"interaction/snapshotReconciled",sessionId:e,expectedPermissionRevision:i,expectedQuestionnaireRevision:s},c,p=u.status==="fulfilled"&&(Tn(this.options.stateStore.snapshot(),e)?.permissionRevision??0)===i;if(u.status==="fulfilled"){let g=this.permissionSessionScope(e);c=u.value.find(T=>T.sessionId!==void 0&&g.has(T.sessionId)),l.permission=c??null}let m=a.status==="fulfilled"&&(Tn(this.options.stateStore.snapshot(),e)?.questionnaireRevision??0)===s;if(a.status==="fulfilled"){let g=a.value;l.questionnaire=g?Cs(g,e,g.requester?.agentName??o):null}if(this.options.stateStore.dispatch(l),m&&a.status==="fulfilled"){let g=a.value;if(g){let T=Tn(this.options.stateStore.snapshot(),e)?.interactions.questionnaire;T?.request.id===g.id&&this.projectQuestionnaire(T)}else r&&(this.clearPlanReviewBody(r.request.id),this.updateQuestionTranscript(r.request.id,{status:"resolved",detail:"Question is no longer pending.",updatedAtMs:Date.now()}))}if(u.status==="fulfilled"){let g=Tn(this.options.stateStore.snapshot(),e)?.interactions.permission;p&&c&&!Da(c)&&this.options.append("The Runtime returned a pending permission without a request id. Restart the Session or retry the task.","error"),p&&c&&Da(c)&&g&&g.requestId===c.requestId&&this.setPermission(g,e)}this.showPending(),this.options.onChanged()}showPending(){if(this.isStopped())return;let e=this.permission();e&&Da(e)?this.showPermissionPicker():e?this.hidePanel():this.questionnaire()?this.showQuestionnairePicker():this.hidePanel()}async showLatestPlanReview(){if(this.isStopped())return;if(this.hasPending()){this.showPending();return}let e=this.options.controller.snapshot().session;if(!e?.sessionId){this.options.append("Start or resume a Session before viewing its Plan.","warning");return}let t=++this.planViewRevision,i=e.agentName??this.defaultAgentName,s;try{s=await this.options.runtime.getLatestPlanReview(i,e.sessionId)}catch(a){!this.isStopped()&&t===this.planViewRevision&&this.options.controller.snapshot().session?.sessionId===e.sessionId&&this.options.append(L(a,{summary:"Couldn't load the latest Plan.",nextStep:"Retry /plan view."}),"error");return}if(this.isStopped()||t!==this.planViewRevision||this.options.controller.snapshot().session?.sessionId!==e.sessionId)return;if(this.hasPending()){this.showPending();return}if(!s){this.options.append("No Plan has been produced for this Session yet.","warning");return}let r=Cs(s,e.sessionId,i);if(!W1(r)){this.options.append("The latest Plan snapshot is unavailable.","warning");return}this.hidePanel();let o=new Kd(r,()=>{this.panel===o&&this.hidePanel(),this.options.onChanged()},this.options.onChanged);this.panel=o,this.options.surface.show(o),this.options.onChanged()}closeOwnedPanel(e){e===this.panel&&(this.panel=void 0)}ownsPendingPanel(e){return e===this.panel&&this.hasPending()}async handleCommand(e){let t=TC(e),s={"/allow":"allowOnce","/always":"allowAlways","/deny":"deny"}[e.toLocaleLowerCase()],r=t!==void 0||e==="/ask-send"||e==="/ask-cancel";if(this.permission()&&r)return this.options.append("Resolve the pending permission in the decision panel first.","warning"),this.showPermissionPicker(),!0;if(this.questionnaire()&&!this.permission()&&s)return this.options.append("Answer the pending Agent question in the decision panel first.","warning"),this.showQuestionnairePicker(),!0;let o=this.questionnaire();if(o?.request.mode==="plan"&&r)return this.options.append("Use the pending Plan decision panel first.","warning"),this.showQuestionnairePicker(),!0;if(t){let a=o;return a?await this.handleQuestionnaireAnswer(a,t.index,t.text):this.options.append("No pending questionnaire."),!0}if(e==="/ask-send"){let a=this.questionnaire();return a?await this.submitQuestionnaire(a,!0):this.options.append("No pending questionnaire."),!0}if(e==="/ask-cancel"){let a=this.questionnaire();return a?await this.requestQuestionnaireDismissal(a):this.options.append("No pending questionnaire."),!0}return s?(await this.replyPermission(s),!0):!1}async handleRuntimeEvent(e,t){if(this.isStopped())return!1;let i=e.type==="permission.ask"?e.request.sessionId??e.sessionId:e.sessionId;if(e.type==="permission.ask"&&e.request.sessionId&&e.sessionId&&e.request.sessionId!==e.sessionId)return!1;let s=e.type==="permission.ask"||e.type==="permission.resolved"?this.permissionPresentationSessionId(i,t):void 0;if(e.sessionId!==t&&!s)return!1;if(await this.continuation.handleEvent(e,t))return!0;if(this.isStopped())return!1;if(e.type==="questionnaire.ask")return this.setQuestionnaire(e.request,t,e.agentName),!0;if(e.type==="questionnaire.dismiss"||e.type==="questionnaire.superseded"){let r=this.questionnaire();return e.requestId&&this.clearPlanReviewBody(e.requestId),e.requestId&&r?.request.id===e.requestId&&(this.updateQuestionTranscript(e.requestId,{status:"resolved",detail:e.type==="questionnaire.dismiss"?"Dismissed.":"Superseded.",updatedAtMs:Date.now()}),this.resolveQuestionnaire(r)),!0}if(e.type==="permission.ask")return this.setPermission(e.request,s??t),!0;if(e.type==="permission.resolved"){let r=this.permission(),o=this.options.transcript.get(`permission:${e.requestId}`);if(o){let a=r?.requestId===e.requestId?r:{requestId:e.requestId,toolName:o.title};this.options.transcript.upsert({id:`permission:${e.requestId}`,status:"resolved",detail:e.decision?$d(a,e.decision):o.status==="resolved"&&o.detail?o.detail:"Permission request closed.",updatedAtMs:Date.now()})}return e.requestId&&r?.requestId===e.requestId&&(this.resolvePermission(r,t),await this.showNextPendingPermission(t,e.requestId)||this.showQuestionnairePicker()),!0}return!1}interactions(){return kd(this.options.stateStore.snapshot())?.interactions??{}}hidePanel(){let e=this.panel;this.panel=void 0,e&&this.options.surface.close(e)}showPermissionPicker(){if(this.isStopped())return;let e=this.permission();if(!e)return;this.hidePanel();let t=new _a(e,(i,s)=>{t.beginSubmitting(i),this.options.onChanged(),this.replyPermission(i,s).catch(r=>{this.isStopped()||this.options.append(L(r,{summary:"Couldn't send your permission choice.",nextStep:"Retry.",preservation:"The request remains open."}),"error")})},this.options.stopTurn);this.panel=t,this.options.surface.show(t)}showQuestionnairePicker(){if(this.isStopped())return;let e=this.questionnaire();if(!e||this.permission())return;if(W1(e)){this.showPlanReview(e);return}if(pF(e)){this.showPlanEntry(e);return}this.hidePanel();let t=new Jr(e,(i,s)=>{this.handleQuestionnaireAnswer(e,i,s,{interactive:!0}).catch(r=>{this.isStopped()||this.options.append(L(r,{summary:"Couldn't save that answer.",nextStep:"Retry.",preservation:"The question remains open."}),"error")})},()=>{this.requestQuestionnaireDismissal(e).catch(i=>{this.isStopped()||this.options.append(L(i,{summary:"Couldn't dismiss this question.",nextStep:"Retry.",preservation:"It remains open."}),"error")})},{requestRender:this.options.onChanged,onSubmit:()=>{t.beginSubmitting(),this.submitQuestionnaire(e,!1).catch(i=>{this.isStopped()||this.options.append(L(i,{summary:"Couldn't send your answers.",nextStep:"Retry.",preservation:"The question remains open."}),"error")})},onDismiss:()=>{this.requestQuestionnaireDismissal(e).catch(i=>{this.isStopped()||this.options.append(L(i,{summary:"Couldn't dismiss this question.",nextStep:"Retry.",preservation:"It remains open."}),"error")})}});this.questionnaireDismissals.has(e.request.id)&&t.beginDismiss(),this.panel=t,this.options.surface.show(t)}showPlanEntry(e){this.hidePanel();let t=e.request.steps.find(r=>r.id==="plan-enter"),i=new Set;t?.options?.some(r=>r.id==="confirm")&&i.add("confirm"),t?.options?.some(r=>r.id==="decline")&&i.add("decline");let s=new Wd(r=>{this.withAgentSubmission(e.request.id,()=>this.submitPlanEntry(e,r).catch(o=>{this.isStopped()||(this.questionnaire()?.request.id===e.request.id&&s.restore(),this.options.append(L(o,{summary:"Couldn't apply that Plan Mode decision.",nextStep:"Retry from the Plan Mode confirmation.",preservation:"The confirmation remains open."}),"error"))}))},this.options.onChanged,i);this.panel=s,this.options.surface.show(s)}async submitPlanEntry(e,t){let i=e.request.steps.find(o=>o.id==="plan-enter"),s=i?.options?.find(o=>o.id===t);if(!i||!s)throw new Error("The Runtime Plan entry confirmation is malformed.");if(e.answers.set(i.id,{stepId:i.id,rawText:s.label,answer:{stepId:i.id,selectedOptionIds:[t],selectedOther:!1}}),!await this.submitPlanQuestionnaire(e,t==="confirm"?"Plan Mode decision sent.":"Default Mode decision sent."))throw new Error("Runtime did not accept the Plan Mode decision.")}showPlanReview(e){this.hidePanel();let t=new Na(e,i=>{this.withAgentSubmission(e.request.id,()=>this.submitPlanReview(e,i).catch(s=>{this.isStopped()||this.appendPlanReviewFailure(s)}))},this.options.onChanged);this.panel=t,this.options.surface.show(t)}async submitPlanReview(e,t){if(t.kind==="feedback"){await this.submitPlanReviewFeedback(e,t.text);return}let i=e.sessionId??this.options.controller.snapshot().session?.sessionId,s=xM(e),r=t.kind==="approve"?{stepId:s,selectedOptionIds:["approve"],selectedOther:!1}:{stepId:s,selectedOptionIds:[],selectedOther:!1,skipped:!0};e.answers.set(s,{stepId:s,rawText:t.kind==="approve"?"Approve":"",answer:r});let o=t.kind==="approve"?"Approved \xB7 implementation queued":"Plan skipped \xB7 remaining in Plan Mode",a;try{a=await this.submitPlanQuestionnaire(e,o,"")}catch(u){if(!this.isActiveSession(i))return;throw this.restorePlanReview(e),u}if(this.isActiveSession(i)&&!a)throw this.restorePlanReview(e),new Error("Runtime did not accept the Plan review decision.")}async submitPlanReviewFeedback(e,t){let i=e.sessionId??this.options.controller.snapshot().session?.sessionId,s=xM(e),r=x(t).trim();e.answers.set(s,{stepId:s,rawText:r,answer:{stepId:s,selectedOptionIds:[],selectedOther:!0,otherText:r}}),this.updateQuestionTranscript(e.request.id,{title:"Plan Review",content:r,ephemeral:!0,updatedAtMs:Date.now()});let o;try{o=await this.submitPlanQuestionnaire(e,"Feedback sent \xB7 continuing in Plan Mode",r)}catch(a){throw this.isActiveSession(i)&&this.restorePlanReview(e),a}if(this.isActiveSession(i)&&!o)throw this.restorePlanReview(e),new Error("Runtime did not accept the Plan feedback.")}async submitPlanQuestionnaire(e,t,i=Ar(e)){let s=e.sessionId??this.options.controller.snapshot().session?.sessionId;this.updateQuestionTranscript(e.request.id,{status:"pending",title:e.request.modePayload?.planReview?"Plan Review":"Plan Mode",content:i,detail:"Sending your decision\u2026",ephemeral:!0,updatedAtMs:Date.now()});let r;try{r=await this.options.runtime.replyQuestionnaire(e.agentName??e.request.requester?.agentName??this.defaultAgentName,e.request.id,ec(e,{skipUnanswered:!1}))}catch(o){if(!this.isActiveSession(s))return!1;let a=Oa(o);if(a.status==="terminal")return await this.settleTerminalPlanQuestionnaire(e,a.detail),!0;throw o}return r&&this.clearPlanReviewBody(e.request.id),this.isActiveSession(s)?r?(s&&await this.options.controller.refreshSessionMetadata(s).catch(()=>{}),this.isActiveSession(s)&&(this.updateQuestionTranscript(e.request.id,{status:"resolved",title:e.request.modePayload?.planReview?"Plan Review":"Plan Mode",content:i,detail:t,ephemeral:!0,updatedAtMs:Date.now()}),this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),this.options.onChanged()),!0):!1:r}restorePlanReview(e){if(this.questionnaire()?.request.id===e.request.id){if(this.panel instanceof Na){this.panel.restore();return}this.showPlanReview(e)}}async settleTerminalPlanQuestionnaire(e,t){let i=e.sessionId??this.options.controller.snapshot().session?.sessionId;if(this.clearPlanReviewBody(e.request.id),!this.isActiveSession(i))return;let s=this.options.transcript.get(`question:${e.request.id}`);if(this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),i&&await this.options.controller.refreshSessionMetadata(i).catch(()=>{}),!this.isActiveSession(i))return;let r=Date.now();this.options.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:"resolved",title:e.request.modePayload?.planReview?"Plan Review closed":"Plan Mode decision closed",content:s?.content??"",detail:t,createdAtMs:s?.createdAtMs??r,updatedAtMs:r}),this.options.onChanged()}appendPlanReviewFailure(e){this.options.append(L(e,{summary:"Couldn't apply that Plan decision.",nextStep:"Retry from the Plan Review panel.",preservation:"The frozen Plan remains pending."}),"error")}async handleQuestionnaireAnswer(e,t,i,s={}){let r=yC(e,t,i);if(!r.ok){this.options.append(r.message,"warning"),this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker();return}this.updateQuestionTranscript(e.request.id,{content:Ar(e),detail:`${e.answers.size} of ${e.request.steps.length} answered`,updatedAtMs:Date.now()}),Zl(e)?s.interactive||await this.submitQuestionnaire(e,!1):s.interactive||this.showQuestionnairePicker()}requestQuestionnaireDismissal(e){return this.withAgentSubmission(e.request.id,()=>this.settleQuestionnaireDismissal(e))}async settleQuestionnaireDismissal(e){let t=e.request.id;if(!this.questionnaireDismissals.has(t)){if(this.questionnaireDismissals.add(t),this.questionnaire()?.request.id===t){let i=this.panel;i instanceof Jr&&i.beginDismiss()}this.options.onChanged();try{await this.dismissQuestionnaire(e)}finally{this.questionnaireDismissals.delete(t),this.questionnaire()?.request.id===t?this.showQuestionnairePicker():this.options.onChanged()}}}async dismissQuestionnaire(e){let t=e.sessionId??this.options.controller.snapshot().session?.sessionId,i;try{i=await this.options.runtime.dismissQuestionnaire(e.agentName??e.request.requester?.agentName??this.defaultAgentName,e.request.id)}catch(r){if(!this.isActiveSession(t))return;let o=Oa(r);if(o.status!=="terminal")throw this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker(),r;let a=this.options.transcript.get(`question:${e.request.id}`);if(this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),t&&await this.options.controller.refreshSessionMetadata(t).catch(()=>{}),!this.isActiveSession(t))return;let l=Date.now();this.options.transcript.upsert({id:`question:${e.request.id}`,kind:"question",status:"resolved",title:"Question closed",content:a?.content??"",detail:o.detail,createdAtMs:a?.createdAtMs??l,updatedAtMs:l}),this.options.onChanged();return}if(!this.isActiveSession(t))return;if(!i){this.options.append("Couldn't dismiss this question. It remains open; retry.","error"),this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker();return}let s=this.questionnaire()?.request.id===e.request.id;e.request.mode==="plan"&&t&&await this.options.controller.refreshSessionMetadata(t).catch(()=>{}),this.updateQuestionTranscript(e.request.id,{status:"resolved",title:"Question dismissed",content:"",detail:void 0,updatedAtMs:Date.now()}),s?this.resolveQuestionnaire(e):this.options.onChanged()}submitQuestionnaire(e,t){return this.withAgentSubmission(e.request.id,()=>this.settleQuestionnaireSubmission(e,t))}async settleQuestionnaireSubmission(e,t){let i=e.sessionId??this.options.controller.snapshot().session?.sessionId;this.updateQuestionTranscript(e.request.id,{title:"Answers sent",content:Ar(e),ephemeral:!0,updatedAtMs:Date.now()});let s;try{s=await this.continuation.reply(e,t)}catch(o){throw this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker(),o}if(!this.isActiveSession(i))return;if(!s.ok){this.options.append("Couldn't send your answers. The question remains open; retry.","error"),this.questionnaire()?.request.id===e.request.id&&this.showQuestionnairePicker();return}e.request.mode==="plan"&&i&&await this.options.controller.refreshSessionMetadata(i).catch(()=>{}),this.questionnaire()?.request.id===e.request.id&&this.resolveQuestionnaire(e),s.finished&&this.continuation.clear(e.request.id),this.options.onChanged()}replyPermission(e,t){let i=this.permission();if(!i?.requestId)return this.options.append("No pending permission request."),Promise.resolve();let s=i.requestId;return e==="allowAlways"&&i.allowAlwaysSupported===!1?(this.options.append("This action cannot be remembered; choose Allow for this conversation or Deny.","warning"),this.showPermissionPicker(),Promise.resolve()):this.withAgentSubmission(s,()=>this.settlePermissionSubmission(i,s,e,t))}async settlePermissionSubmission(e,t,i,s){let r=this.options.controller.snapshot().session?.sessionId,o;try{o=await this.options.runtime.replyPermission(e.agentName??this.defaultAgentName,t,i)}catch(u){if(!this.isActiveSession(r))return;throw this.permission()?.requestId===t&&this.showPermissionPicker(),u}if(!this.isActiveSession(r)){o&&r&&this.options.stateStore.dispatch({type:"interaction/permissionResolved",sessionId:r,requestId:t});return}if(!o){if(this.permission()?.requestId!==t)return;let u=await this.options.runtime.listPendingPermissions().catch(()=>{});if(u&&!u.some(l=>l.requestId===t)){this.options.transcript.upsert({id:`permission:${t}`,status:"resolved",detail:"Resolved on another surface.",updatedAtMs:Date.now()}),this.resolvePermission(e,r),await this.showNextPendingPermission(r,t)||this.showQuestionnairePicker();return}this.options.append("Couldn't send your permission choice. The request remains open; retry.","error"),this.permission()?.requestId===t&&this.showPermissionPicker();return}let a=this.permission()?.requestId===t;if(this.options.transcript.upsert({id:`permission:${t}`,status:"resolved",detail:s?`${$d(e,i)} \xB7 Guidance: ${x(s)}`:$d(e,i),updatedAtMs:Date.now()}),!!a){if(this.resolvePermission(e,r),i==="deny"&&s&&this.options.deliverPermissionFeedback)try{await this.options.deliverPermissionFeedback(`Regarding the denied ${x(e.toolName??"tool")} action: ${x(s)}`)}catch(u){this.options.append(L(u,{summary:"The action was denied, but your guidance wasn't sent.",nextStep:"Send it as a new message if needed."}),"warning")}await this.showNextPendingPermission(r,t)||this.showQuestionnairePicker()}}withAgentSubmission(e,t){if(!this.agentStatusEnabled)return t();let i=this.options.stateStore.snapshot().activeSessionId;return this.submittingRequestId=e,this.submittingSessionId=i,this.options.onChanged(),t().finally(()=>{this.submittingRequestId===e&&this.submittingSessionId===i&&(this.clearAgentSubmission(),this.options.onChanged())})}isAgentSubmission(e){return this.submittingRequestId===e&&this.submittingSessionId===this.options.stateStore.snapshot().activeSessionId}clearAgentSubmission(){this.submittingRequestId=void 0,this.submittingSessionId=void 0}resolveQuestionnaire(e){let t=e.sessionId??this.options.controller.snapshot().session?.sessionId;this.clearPlanReviewBody(e.request.id),t&&this.options.stateStore.dispatch({type:"interaction/questionnaireResolved",sessionId:t,requestId:e.request.id}),this.permission()||this.hidePanel(),this.options.onChanged()}resolvePermission(e,t){let i=t??this.options.controller.snapshot().session?.sessionId;i&&e.requestId&&this.options.stateStore.dispatch({type:"interaction/permissionResolved",sessionId:i,requestId:e.requestId}),this.hidePanel(),this.options.onChanged()}async showNextPendingPermission(e,t){if(!e)return!1;if(this.permission())return this.showPermissionPicker(),!0;let i=await this.options.runtime.listPendingPermissions().catch(o=>(this.options.append(L(o,{summary:"Couldn't check for the next permission request.",nextStep:"Wait for the next prompt or retry the action."}),"warning"),[]));if(!this.isActiveSession(e))return!1;if(this.permission())return this.showPermissionPicker(),!0;let s=this.permissionSessionScope(e),r=i.find(o=>o.sessionId!==void 0&&s.has(o.sessionId)&&o.requestId!==t);return r?(this.setPermission(r,e),!0):!1}permissionPresentationSessionId(e,t){if(e)return this.permissionSessionScope(t).has(e)?t:void 0}permissionSessionScope(e){let t=new Set(this.options.permissionSessionScope?.(e)??[]);return t.add(e),t}updateQuestionTranscript(e,t){let i=`question:${e}`;this.options.transcript.get(i)&&this.options.transcript.upsert({id:i,...t})}createdAtOrNow(e,t){return typeof e=="number"&&Number.isFinite(e)?e:t}notifyPendingInteraction(e,t){this.options.notify?.(e,t),this.options.onChanged()}isActiveSession(e){return!this.isStopped()&&!!e&&this.options.controller.snapshot().session?.sessionId===e}resolveSessionAgentName(e){let t=this.options.controller.snapshot();return t.session?.sessionId===e&&t.session.agentName?t.session.agentName:t.sessions.find(i=>i.sessionId===e)?.agentName??this.defaultAgentName}isStopped(){return!!this.options.isStopped?.()}};function xM(n){return n.request.steps.find(e=>e.id==="plan-review")?.id??"plan-review"}function pF(n){return n.request.mode==="plan"&&n.request.modePayload?.planReview===void 0}function wM(n,e,t,i){return n&&n!==t?!1:e===void 0||e===i}function Da(n){return!!n.requestId?.trim()}function Zr(n){return[...new Set(n.contextWindowOptions??[])].filter(e=>Number.isSafeInteger(e)&&e>0)}function eo(n){return n>=1e6&&n%1e6===0?`${n/1e6}M`:n>=1e3&&n%1e3===0?`${n/1e3}K`:String(n)}var Fa=class{constructor(e){this.options=e}fullscreenViewport=!0;handlesViewportKeys=!0;_focused=!1;scrollOffset=0;lastPageSize=1;lastMaxScrollOffset=0;get focused(){return this._focused}set focused(e){this._focused=e}handleInput(e){if(v(e,j.escape)||v(e,j.ctrl("c"))){this.options.onCancel();return}if(v(e,j.up)){this.scrollBy(-1);return}if(v(e,j.down)){this.scrollBy(1);return}if(v(e,j.pageUp)){this.scrollBy(-this.lastPageSize);return}v(e,j.pageDown)&&this.scrollBy(this.lastPageSize)}invalidate(){}render(e){return this.renderViewport(e,mF(this.options.maxRows))}renderViewport(e,t){let i=Ft(this.options.footer??"Esc close"),s=e<44?`\u2191\u2193 scroll \xB7 ${i}`:`\u2191\u2193 / PgUp/PgDn scroll \xB7 ${i}`,r=oe(e,t,s),o=this.renderBody(r.contentWidth+4,t!==void 0&&t<=12),a=o.length>r.bodyHeight,u=oe(e,t,a?s:i),l=u.bodyHeight;return this.lastMaxScrollOffset=Math.max(0,o.length-l),this.lastPageSize=Math.max(1,l),this.scrollOffset=Math.max(0,Math.min(this.scrollOffset,this.lastMaxScrollOffset)),u.render({title:Ft(this.options.title),meta:this.options.badge?_s(this.options.badge.label,this.options.badge.tone,!0):void 0,body:o.slice(this.scrollOffset,this.scrollOffset+l)})}renderBody(e,t){if(this.options.layout!=="stacked"&&e>=72&&this.options.sections.length===2)return this.renderWideBody(e,t);let i=[],s=Math.max(1,e-4);if(this.options.subtitle&&!t)for(let o of Y(h.hex(d.muted)(Ft(this.options.subtitle)),s))i.push(o);for(let o of this.options.sections){i.push(""),i.push(h.bold.hex(d.text)(Ft(o.title)));let a=o.rows.map(c=>({...c,label:Ft(c.label),value:Ft(c.value),detail:c.detail?Ft(c.detail):void 0})),u=s<44,l=Math.min(Math.max(1,...a.map(c=>C(c.label))),Math.max(1,s-16));for(let c of a){let p=c.tone??"neutral";if(u){for(let M of Y(j1(c),s))i.push(M);let b=Math.max(1,s-2),S=fF(c.value)?_s(gF(c.value,b),p):_s(c.value,p);for(let M of Y(S,b))i.push(` ${M}`);for(let M of V1(c,s-2))i.push(` ${M}`);continue}let m=E(c.label,l,"\u2026"),g=Gd(j1(c,m),l),T=Math.max(1,s-l-2),y=Y(_s(c.value,p),T);for(let[b,S]of y.entries()){let M=b===0?`${g} `:" ".repeat(l+2);i.push(`${M}${S}`)}for(let b of V1(c,s-2))i.push(` ${b}`)}}let r=MM(this.options.warnings);if(r.length>0){i.push(""),i.push(Vd("Warnings",!0));for(let o of r)for(let a of Y(Vd(o),s))i.push(a)}return i}renderWideBody(e,t){let i=Math.max(1,e-4),s=3,r=Math.floor((i-s)/2),o=Math.max(1,i-s-r),[a,u]=this.options.sections;if(!a||!u)return[];let l=[];if(this.options.subtitle&&!t)for(let T of Y(h.hex(d.muted)(Ft(this.options.subtitle)),i))l.push(T);l.push("");let c=IM(a,r),p=IM(u,o),m=MM(this.options.warnings);m.length>0&&(p.push(Vd("Warnings",!0)),p.push(...m.flatMap(T=>Y(Vd(T),o))));let g=Math.max(c.length,p.length);for(let T=0;T<g;T+=1){let y=Gd(c[T]??"",r),b=Gd(p[T]??"",o);l.push(`${y} ${h.hex(d.line)("\u2502")} ${b}`)}return l}scrollBy(e){this.scrollOffset=Math.max(0,Math.min(this.scrollOffset+e,this.lastMaxScrollOffset))}};function _s(n,e,t=!1){let i=e==="accent"?d.signal:e==="success"?d.success:e==="warning"?d.error:e==="error"?d.error:d.text;return(t?h.bold.hex(i):h.hex(i))(n)}function IM(n,e){let t=n.rows.map(r=>({...r,label:Ft(r.label),value:Ft(r.value),detail:r.detail?Ft(r.detail):void 0})),i=Math.min(Math.max(1,...t.map(r=>C(r.label))),Math.max(1,e-12)),s=[h.bold.hex(d.text)(Ft(n.title))];for(let r of t){let o=E(r.label,i,"\u2026"),a=Gd(j1(r,o),i),u=Math.max(1,e-i-2),l=Y(_s(r.value,r.tone??"neutral"),u);for(let[c,p]of l.entries()){let m=c===0?`${a} `:" ".repeat(i+2);s.push(`${m}${p}`)}for(let c of V1(r,e-2))s.push(` ${c}`)}return s}function j1(n,e=n.label){return n.labelTone?_s(e,n.labelTone,n.labelBold):h.hex(d.muted)(e)}function V1(n,e){if(!n.detail)return[];let t=n.detailTone?_s(n.detail,n.detailTone):h.hex(d.muted)(n.detail),i=Math.max(1,e),s=Y(t,i),r=n.detailMaxLines;if(r===void 0||s.length<=r)return s;let o=s.slice(0,Math.max(1,r)),a=o.length-1;return o[a]=E(`${o[a]??""}${h.hex(d.dim)("\u2026")}`,i,h.hex(d.dim)("\u2026")),o}function MM(n){let e=(n??[]).map(t=>Ft(t)).filter(Boolean);return e.length>3?[...e.slice(0,3),`+${e.length-3} more warning(s)`]:e}function Vd(n,e=!1){let t=e?h.bold.hex(d.error)("!"):h.hex(d.error)("!"),i=e?h.bold.hex(d.text)(n):h.hex(d.text)(n);return`${t} ${i}`}function Gd(n,e){let t=E(n,e,h.hex(d.dim)("\u2026"));return`${t}${" ".repeat(Math.max(0,e-C(t)))}`}function mF(n){let e=typeof n=="function"?n():n;if(!(e===void 0||!Number.isFinite(e)))return Math.max(4,Math.floor(e))}function fF(n){return/^(?:~?[\\/]|[A-Za-z]:[\\/])/u.test(n)}function gF(n,e){if(C(n)<=e)return n;if(e<=1)return"\u2026";let t=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(n)],i=0,s=t.length;for(let r=t.length-1;r>=0;r-=1){let o=t[r]?.segment;if(!o)continue;let a=C(o);if(i+a>e-1)break;i+=a,s=r}return`\u2026${t.slice(s).map(r=>r.segment).join("")}`}function Ft(n){return x(n).replace(/\s+/gu," ").trim()}function RM(n,e,t,i){let s=n.skills??[],o=[{title:"Built-in",skills:s.filter(l=>xc(l)==="builtin")},{title:"User",skills:s.filter(l=>xc(l)==="user")},{title:"Other",skills:s.filter(l=>xc(l)==="other")}].filter(l=>l.skills.length>0).map(l=>({title:`${l.title} \xB7 ${l.skills.length}`,rows:l.skills.map(TF)}));o.length===0&&o.push(yF(e));let a=e.trim(),u=[a?`Matching \u201C${a}\u201D`:"Available to the current Agent",n.hasMore?"More results exist":void 0,"Read-only catalog"].filter(Boolean).join(" \xB7 ");return new Fa({title:"Skills",subtitle:u,badge:{label:`${s.length}${n.hasMore?"+":""} FOUND`,tone:s.length>0?"accent":"neutral"},sections:o,footer:"Esc close \xB7 read only",layout:"stacked",maxRows:i,onCancel:t})}function kM(n,e,t,i){let s=n.map(vF).sort(SF),r=s.filter(m=>m.status==="available").length,o=s.some(m=>m.status==="error"||m.status==="unavailable"),a=e.trim(),u=s.filter(m=>m.sourceKind==="builtin"),l=s.filter(m=>m.sourceKind!=="builtin"&&!m.sourceScope),c=s.filter(m=>m.sourceScope==="project"),p=s.filter(m=>m.sourceScope==="session");return new Fa({title:"MCP servers",subtitle:["Runtime capability catalog \xB7 Read-only",a?`Matching \u201C${a}\u201D`:void 0].filter(Boolean).join(" \xB7 "),badge:{label:`${r}/${s.length} AVAILABLE`,tone:o?"warning":r>0?"success":"neutral"},sections:[zd("Built-in",u,a),zd("User-configured",l,a),...c.length?[zd("Project \xB7 .mcp.json",c,a)]:[],...p.length?[zd("Client session",p,a)]:[]],footer:"Esc close \xB7 /mcp reload",layout:"stacked",maxRows:i,onCancel:t})}function TF(n){let e=n.enabled!==!1;return{label:n.displayName??n.name,value:`${e?"\u25CF available":"\u25CB unavailable"} \xB7 ${bF(n)}`,tone:e?"success":"neutral",labelTone:"neutral",labelBold:!0,detail:n.displayDescription??n.description,detailMaxLines:2}}function yF(n){let e=n.trim();return{title:"Catalog",rows:[{label:"No matches",value:e||"No Skills configured",labelTone:"neutral",labelBold:!0,detail:e?"Close this panel and try a broader /skills filter.":"The current Agent has no visible Skills."}]}}function bF(n){return n.sourceKind?n.sourceKind:n.sourceType===1?"official":n.sourceType===2?"user":n.sourceType===void 0?"unknown source":`source ${n.sourceType}`}function vF(n){let e=lx(n.configJson),t=n.status??e.status??(n.enabled?"configured":"disabled");return{name:n.name,transport:n.transport??"unknown transport",status:t,sourceKind:n.sourceKind??"configured",sourceScope:n.sourceScope,managed:n.managed===!0,tools:n.tools??[],...n.description?{description:n.description}:{},...n.error||e.error?{error:ot(n.error??e.error)}:{}}}function zd(n,e,t){return{title:`${n} \xB7 ${e.length}`,rows:e.length>0?e.map(CF):[{label:"No matches",value:t||`No ${n.toLocaleLowerCase()} servers`,labelTone:"neutral",labelBold:!0,detail:"The current Runtime returned no matching capabilities in this group."}]}}function SF(n,e){return EM(n.status)-EM(e.status)||n.name.localeCompare(e.name)}function EM(n){return n==="error"?0:n==="unavailable"?1:n==="configured"?2:n==="available"?3:4}function CF(n){let e=n.sourceKind==="builtin",t=n.tools.length;return{label:n.name,value:e?`${n.status==="unavailable"?"\u25CB":AM(n.status)} ${n.status} \xB7 ${n.managed?"runtime-managed":"built-in"} \xB7 ${t} ${t===1?"tool":"tools"}`:`${AM(n.status)} ${n.status} \xB7 ${n.transport}`,tone:xF(n.status),labelTone:"neutral",labelBold:!0,detail:e&&t>0?n.tools.map(i=>i.name).join(" \xB7 "):n.error??n.description,detailTone:!e&&n.error?"error":void 0,detailMaxLines:2}}function AM(n){return n==="available"?"\u25CF":n==="error"||n==="unavailable"?"!":n==="disabled"?"\u25CB":"\u25C6"}function xF(n){return n==="available"?"success":n==="error"||n==="unavailable"?"error":n==="configured"?"accent":"neutral"}var wF={...it,groupLabel:n=>h.bold.hex(d.text)(n),noMatch:()=>h.hex(d.dim)(" No matching models")},IF=3,G1="\0connect-codex",z1="\0add-provider",Qd=class{constructor(e,t,i,s={},r,o=""){this.models=e;this.onSelectModel=t;this.onCancel=i;this.availability=s;this.selectedEffort=r;let a=e.find(u=>u.selected);this.selectedModelKey=a?At(a):void 0,this.focusBeforeSearchKey=this.selectedModelKey,this.searchInput.setValue(o.trim()),this.searchInput.moveCursorToEnd(),this.list=this.createList()}fullscreenViewport=!0;handlesViewportKeys=!0;list;focusedModelKey;selectedModelKey;focusBeforeSearchKey;searchInput=new Ne({prompt:""});thinkingDrafts=new Map;contextDrafts=new Map;effortDrafts=new Map;modelByKey=new Map;deletingProviderId;deleteStatus;busy=!1;_focused=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.searchInput.focused=e}handleInput(e){if(this.busy)return;let t=ie();if(this.deletingProviderId){t.matches(e,"tui.select.cancel")?this.cancelProviderDeletion():t.matches(e,"tui.select.confirm")&&this.deleteProvider();return}if(t.matches(e,"tui.select.cancel")){this.onCancel();return}let i=this.focusedModel();if(i&&PM(i)&&this.availability.onDeleteProvider&&v(e,j.ctrl("d"))){this.deletingProviderId=i.providerId,this.deleteStatus=void 0,this.availability.requestRender?.();return}if(i&&Zr(i).length>1&&(v(e,"tab")||v(e,j.shift("tab")))){let o=Zr(i),a=o.indexOf(this.contextChoice(i)??0),u=v(e,j.shift("tab"))?-1:1,l=o[(a+u+o.length)%o.length];l!==void 0&&this.contextDrafts.set(At(i),l),this.list=this.createList();return}let s=this.searchInput.getValue();if(i&&s.trim().length===0&&(v(e,"left")||v(e,"right"))){if(fa(i)){this.moveEffort(i,v(e,"left")?-1:1);return}if(i.thinkingConfig?.mode==="switchable"){this.toggleThinking(i);return}}if(t.matches(e,"tui.select.up")||t.matches(e,"tui.select.down")||t.matches(e,"tui.select.confirm")){this.list.handleInput(e);return}let r=s;if(this.searchInput.handleInput(e),this.searchInput.getValue()!==r){let o=this.searchInput.getValue();r.trim().length===0&&o.trim().length>0?this.focusBeforeSearchKey=this.focusedModelKey??this.selectedModelKey:r.trim().length>0&&o.trim().length===0&&(this.focusedModelKey=this.focusBeforeSearchKey??this.focusedModelKey,this.focusBeforeSearchKey=void 0),this.list=this.createList()}}invalidate(){this.list.invalidate(),this.searchInput.invalidate()}render(e){return this.renderViewport(e,24)}renderViewport(e,t){if(this.deletingProviderId)return this.renderDeleteConfirmation(e,t);let i=oe(e,t,this.renderHint()),s=h.hex(d.muted)("Search: "),r=this.searchInput.render(Math.max(1,i.contentWidth-C(s)))[0]??"",o=[...i.bodyHeight>=10?[h.hex(d.muted)("Available models")]:[],...i.bodyHeight>=3&&this.availability.unavailableHint?[h.hex(d.warning)(x(this.availability.unavailableHint))]:[],...i.bodyHeight>=2?[`${s}${r}`]:[],...i.bodyHeight>=4&&this.visibleModels().length===0&&(this.availability.onAddProvider||this.availability.codexOAuth)?[h.hex(d.muted)("No matching models")]:[]],a=this.renderModelControl().slice(0,Math.max(0,i.bodyHeight-o.length-1));return i.render({title:"Models",body:[...o,...this.visibleModels().length===0&&!this.availability.onAddProvider&&!this.availability.codexOAuth?[h.hex(d.muted)("No matching models")]:this.list.renderViewport(i.contentWidth,Math.max(1,i.bodyHeight-o.length-a.length)),...a]})}focusedModel(){let e=this.list.getSelectedItem();return e?this.modelByKey.get(e.value):void 0}contextChoice(e){return this.contextDrafts.get(At(e))??e.contextLimit}renderContextControl(){let e=this.focusedModel();if(!e)return[];let t=Zr(e);if(t.length<2)return[];let i=this.contextChoice(e),s=t.map(o=>o===i?h.bold.hex(d.signal)(`[ ${eo(o)} ]`):h.hex(d.text)(eo(o))),r=e.contextWindowOptionHints?.[String(i)]==="higher_usage";return[`${h.hex(d.muted)("Context")} ${s.join(" ")} ${h.hex(d.dim)("(Tab to switch)")}`,...r?[h.hex(d.warning)("Higher usage with this context window.")]:[]]}moveEffort(e,t){let i=YC(e.effortOptions,this.effortChoice(e),t);i&&this.effortDrafts.set(At(e),i)}toggleThinking(e){let t=this.thinkingChoice(e)??"off";this.thinkingDrafts.set(At(e),t==="on"?"off":"on")}thinkingChoice(e){return this.thinkingDrafts.get(At(e))??li(e)}effortChoice(e){let t=this.effortDrafts.get(At(e));return t||Or(e,e.selected?this.selectedEffort:void 0)}createList(){let e=this.visibleModels(),t=AF(e);this.modelByKey.clear();for(let o of this.models)this.modelByKey.set(At(o),o);let i=t.flatMap(o=>o.models.map(a=>{let u=At(a),l=!!this.availability.isUnavailable?.(a);return{value:u,label:`${a.selected?"\u25CF ":""}${l?"[login] ":""}${x(a.displayName??a.modelId)}`,description:RF({...a,contextLimit:this.contextChoice(a)},l),groupLabel:`${x(o.label)} \xB7 ${o.models.length}`}}));i.push({value:z1,label:"+ Add 3rd-party provider\u2026",description:"Configure an API Key provider and add its models",groupLabel:"Providers"}),this.availability.codexOAuth&&i.push({value:G1,...MF(this.availability.codexOAuth.state),groupLabel:"Providers"});let s=new Je(i,Math.min(Math.max(i.length,1),10),wF,{minPrimaryColumnWidth:26,maxPrimaryColumnWidth:42});s.onSelectionChange=o=>{this.focusedModelKey=o.value},s.onSelect=o=>{if(o.value===G1){this.availability.codexOAuth?.onConnect();return}if(o.value===z1){this.availability.onAddProvider?.();return}let a=this.modelByKey.get(o.value);if(!a)return;if(this.availability.isUnavailable?.(a)){this.availability.onUnavailable?.(a);return}let u=this.effortChoice(a),l=u?void 0:this.thinkingChoice(a),c=this.contextDrafts.get(At(a)),p=c===void 0?a:{...a,contextLimit:c},m=l?QC(p,l):p;u?this.onSelectModel(m,u):this.onSelectModel(m)},s.onCancel=this.onCancel;let r=this.focusedModelKey?e.findIndex(o=>At(o)===this.focusedModelKey):e.findIndex(o=>At(o)===this.selectedModelKey);return r>=0?(s.setSelectedIndex(r),this.focusedModelKey=e[r]?At(e[r]):void 0):e[0]&&(this.focusedModelKey=At(e[0])),s}visibleModels(){let e=this.searchInput.getValue().trim().toLocaleLowerCase();return e?this.models.filter(t=>EF(t).includes(e)):[...this.models]}renderHint(){if(this.list.getSelectedItem()?.value===G1)return"\u2191\u2193 select \xB7 type to search \xB7 enter connect Codex \xB7 esc cancel";if(this.list.getSelectedItem()?.value===z1)return"\u2191\u2193 select \xB7 type to search \xB7 enter add provider \xB7 esc cancel";let e=this.focusedModel(),t=e?.thinkingConfig?.mode==="switchable",i=e&&Zr(e).length>1?" \xB7 tab context":"",s=e&&PM(e)&&this.availability.onDeleteProvider?" \xB7 ctrl+d delete provider":"";return fa(e)?`\u2191\u2193 select \xB7 type to search \xB7 \u2190/\u2192 effort \xB7 enter apply${i}${s} \xB7 esc cancel`:t?`\u2191\u2193 select \xB7 type to search \xB7 \u2190/\u2192 thinking \xB7 enter apply${i}${s} \xB7 esc cancel`:`\u2191\u2193 select \xB7 type to search \xB7 enter apply${i}${s} \xB7 esc cancel`}renderDeleteConfirmation(e,t){let i=this.deletingProviderId,s=this.models.filter(a=>a.providerId===i),r=s[0]?.providerName?.trim()||i||"Unknown provider",o=s.length;return Ln({title:"Delete provider?",body:[x(r),h.hex(d.muted)(`This removes its saved credentials and all ${o} configured model${o===1?"":"s"}.`),...this.deleteStatus?[this.deleteStatus.tone==="error"?h.hex(d.error)(`! ${this.deleteStatus.text}`):h.hex(d.accent)(this.deleteStatus.text)]:[]],footer:"Enter delete provider \xB7 Esc cancel"},e,t,"warning")}cancelProviderDeletion(){this.deletingProviderId=void 0,this.deleteStatus=void 0,this.availability.requestRender?.()}async deleteProvider(){let e=this.deletingProviderId;if(!(!e||!this.availability.onDeleteProvider)){this.busy=!0,this.deleteStatus={tone:"info",text:"Deleting provider\u2026"},this.availability.requestRender?.();try{await this.availability.onDeleteProvider(e),this.deletingProviderId=void 0,this.deleteStatus=void 0}catch(t){this.deleteStatus={tone:"error",text:L(t,{summary:"Couldn't delete provider.",nextStep:"Retry, or press Esc to cancel.",preservation:"The provider and its models are unchanged."})}}finally{this.busy=!1,this.availability.requestRender?.()}}}renderEffortControl(){let e=this.focusedModel();if(!e)return[];let t=Lr(e.effortOptions);if(t.length===0)return[];let i=this.effortChoice(e);return["",`${h.hex(d.muted)("Think effort")} ${h.hex(d.dim)("(\u2190/\u2192 to switch)")}`,t.map(s=>s===i?h.bold.hex(d.signal)(`[ ${s} ]`):h.hex(d.text)(s)).join(" ")]}renderModelControl(){if(!this.models.some(i=>Zr(i).length>1||fa(i)||li(i)!==void 0))return[];let t=[...this.renderContextControl(),...this.renderEffortControl(),...this.renderThinkingControl()];return[...t,...Array.from({length:Math.max(0,IF-t.length)},()=>"")]}renderThinkingControl(){let e=this.focusedModel();if(!e)return[];if(fa(e))return[];let t=this.thinkingChoice(e);if(!t)return[];if(e.thinkingConfig?.mode!=="switchable")return["",h.hex(d.muted)(`Thinking ${t==="on"?"On":"Off"}`)];let i=(s,r)=>s===t?h.bold.hex(d.signal)(`[ ${r} ]`):h.hex(d.text)(r);return["",`${h.hex(d.muted)("Thinking")} ${h.hex(d.dim)("(\u2190/\u2192 to switch)")}`,`${i("on","On")} ${i("off","Off")}`]}};function MF(n){return n==="connected"?{label:"\u2713 OpenAI Codex connected",description:"OAuth credentials are ready"}:n==="pending"?{label:"\u21BB Continue OpenAI Codex sign-in\u2026",description:"Open the browser sign-in again"}:n==="failed"?{label:"\u21BB Retry OpenAI Codex sign-in\u2026",description:"The previous sign-in failed"}:{label:"+ Connect OpenAI Codex\u2026",description:"Sign in with OpenAI OAuth"}}function At(n){return`${n.providerId}\0${n.modelId}`}function PM(n){return n.providerSource==="custom_provider"}function EF(n){return[n.providerId,n.providerName,n.modelId,n.displayName,n.variant,`${n.providerId}/${n.modelId}`].filter(e=>!!e).join(" ").toLocaleLowerCase()}function AF(n){let e=new Map;for(let t of n){let i=t.providerName?.trim()||t.providerId,s=e.get(i);s?s.push(t):e.set(i,[t])}return Array.from(e,([t,i])=>({label:t,models:i}))}function RF(n,e){let t=Lr(n.effortOptions);return[x(`${n.providerId}/${n.modelId}`),e?"Login required":void 0,n.variant&&n.variant!=="thinking"?x(n.variant):void 0,t.length>0?`${String(t.length)} efforts`:void 0,n.contextLimit?`${eo(n.contextLimit)} ctx`:void 0].filter(i=>!!i).join(" \xB7 ")}var Yd=class{constructor(e){this.options=e;this.methods=new Je([{value:"browser",label:"Browser login (default)",description:"Sign in on this computer"},{value:"device_code",label:"Device code login",description:"SSH / remote development machine"}],2,it),this.methods.onSelect=t=>{this.start(t.value)},this.methods.onCancel=()=>{this.cancel()}}fullscreenViewport=!0;handlesViewportKeys=!0;methods;phase="loading";method="browser";status;error;browserHint;openedUrl;timer;disposed=!1;cancelling=!1;async resume(){try{let e=await this.options.application.getCodexOAuthStatus();this.cancelling&&e.loginId?await this.options.application.cancelCodexOAuthLogin(e.loginId):this.disposed||this.update(e)}catch(e){this.fail(e)}}handleInput(e){this.disposed||this.cancelling||(ie().matches(e,"tui.select.cancel")?this.cancel():this.phase==="select"?(this.methods.handleInput(e),this.options.requestRender()):this.phase==="failed"&&v(e,j.enter)&&this.start(this.method))}invalidate(){this.methods.invalidate()}dispose(){this.disposed=!0,clearTimeout(this.timer)}async cancel(){if(!this.cancelling){this.cancelling=!0,clearTimeout(this.timer);try{this.status?.loginId&&await this.options.application.cancelCodexOAuthLogin(this.status.loginId),this.disposed||this.options.onClose()}catch(e){this.cancelling=!1,this.fail(e)}}}render(e){return this.renderViewport(e,20)}renderViewport(e,t){let i=this.phase==="select"?"\u2191\u2193 select \xB7 Enter continue \xB7 Esc cancel":this.phase==="failed"?"Enter retry \xB7 Esc cancel":"Esc cancel",s=oe(e,t,i),r=this.phase==="select"?this.methods.renderViewport(s.contentWidth,s.bodyHeight):this.body().flatMap(o=>Y(o,s.contentWidth));return s.render({title:"Connect OpenAI Codex",body:r},this.error?"error":"signal")}body(){if(this.cancelling)return["Cancelling sign-in\u2026"];if(this.phase==="loading")return["Checking Codex sign-in\u2026"];if(this.phase==="starting")return["Starting Codex sign-in\u2026"];if(this.error)return[h.hex(d.error)(this.error)];let e=this.status?.deviceCode,t=e?.verificationUri??this.status?.authUrl;return[...e?[h.bold.hex(d.signal)(`Enter code: ${x(e.userCode)}`)]:[],...t?[x(t)]:[],e?"Open this link in a browser on your computer and enter the code.":"Complete sign-in in your browser.","Waiting for authorization\u2026",...e?[`Code expires in ${Math.max(0,Math.ceil((e.expiresAt-Date.now())/6e4))} min.`]:[],...this.browserHint?[this.browserHint]:[]]}async start(e){this.method=e,this.phase="starting",this.error=void 0,this.browserHint=void 0,this.options.requestRender();try{let t=await this.options.application.connectCodexOAuth({method:e});if(this.cancelling&&t.loginId){await this.options.application.cancelCodexOAuthLogin(t.loginId);return}this.disposed||this.update(t)}catch(t){this.cancelling||this.fail(t)}}update(e){if(!this.cancelling){if(this.status=e,this.error=void 0,e.method&&(this.method=e.method),e.state==="connected"){this.options.onConnected();return}if(e.state==="pending"){this.phase="waiting";let t=e.deviceCode?.verificationUri??e.authUrl;t&&t!==this.openedUrl&&(this.openedUrl=t,this.openBrowser(t)),clearTimeout(this.timer),this.timer=setTimeout(()=>{this.resume()},1e3),this.timer.unref?.()}else e.state==="failed"||e.state==="hidden"?(this.phase="failed",this.error=x(e.error??"Codex sign-in is unavailable in this build.")):this.phase="select";this.options.requestRender()}}async openBrowser(e){try{await this.options.openExternalTarget(e)}catch{if(this.disposed)return;this.browserHint="Open the link above manually to continue.",this.options.requestRender()}}fail(e){this.disposed||(this.phase="failed",this.error=x(e instanceof Error?e.message:"Codex sign-in failed. Retry to continue."),this.options.requestRender())}};var _M=["API Key","Base URL","Models","Alias","Test and save"],Xd=class{constructor(e){this.options=e;this.baseUrl=e.provider.baseUrl??"",this.modelIds=e.provider.models.map(t=>t.modelId),this.name=e.provider.name,this.textInput.onSubmit=t=>this.commitField(t),this.secretInput.onSubmit=t=>this.commitField(t),this.textInput.onEscape=this.secretInput.onEscape=()=>this.cancelField()}selected=0;editing=!1;textInput=new Ne({prompt:""});secretInput=new Ne({prompt:"",mask:"\u2022"});apiKey="";baseUrl;modelIds;name;modelsEdited=!1;busy=!1;disposed=!1;status="";_focused=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncFocus()}handleInput(e){this.busy||this.disposed||(this.editing?(this.selected===0?this.secretInput:this.textInput).handleInput(e):ie().matches(e,"tui.select.cancel")?this.options.onCancel():v(e,j.up)?this.selected=Math.max(0,this.selected-1):v(e,j.down)||v(e,"tab")?this.selected=(this.selected+1)%_M.length:v(e,j.enter)&&(this.selected===4?this.save():this.editField()),this.options.requestRender())}render(e){if(e<=0)return[];let t=[this.apiKey?"Replacement entered":this.options.provider.hasApiKey?"Saved key (unchanged)":"Not configured",_r(this.baseUrl),this.modelIds.join(", ")||"No models",this.name,""],i=_M.map((s,r)=>{let o=`${this.selected===r?"\u2192":" "} ${s}: ${x(t[r]??"")}`;return this.selected===r?h.hex(d.signal)(o):o});return[h.bold.hex(d.signal)(`Edit ${x(this.options.provider.name)}`),h.hex(d.muted)("Changes apply to all models in this connection after a successful test."),"",...i,...this.editing?["",...(this.selected===0?this.secretInput:this.textInput).render(e)]:[],...this.selected===2?[h.hex(d.dim)("Model IDs separated by commas; remove an ID to remove that model.")]:[],...this.status?["",h.hex(d.error)(x(this.status))]:[],"",h.hex(d.dim)(this.busy?"Testing and saving\u2026":this.editing?"Enter keep change \xB7 Esc cancel edit":"\u2191\u2193 move \xB7 Enter edit / save \xB7 Esc cancel")].map(s=>E(s,Math.max(0,e),"\u2026"))}invalidate(){this.textInput.invalidate(),this.secretInput.invalidate()}dispose(){this.disposed=!0,this.apiKey="",this.secretInput.setValue(""),this.focused=!1}editField(){this.editing=!0,this.status="";let e=["",this.baseUrl,this.modelIds.join(", "),this.name],t=this.selected===0?this.secretInput:this.textInput;t.setValue(e[this.selected]??""),t.moveCursorToEnd(),this.syncFocus()}commitField(e){let t=e.trim();if(!t){this.status="A value is required. Press Esc to keep the saved value.";return}if(this.selected===0&&(this.apiKey=t),this.selected===1){try{let i=new URL(t);if(i.protocol!=="http:"&&i.protocol!=="https:")throw new Error}catch{this.status="Base URL must use http or https.";return}this.baseUrl=t}if(this.selected===2){let i=[...new Set(t.split(/[,\n]/u).map(s=>s.trim()).filter(Boolean))];if(!i.length){this.status="At least one model is required for the connection test.";return}this.modelIds=i,this.modelsEdited=!0}this.selected===3&&(this.name=t),this.cancelField()}cancelField(){this.editing=!1,this.secretInput.setValue(""),this.status="",this.syncFocus()}async save(){let e=this.options.provider,t=e.models.find(i=>i.selected&&this.modelIds.includes(i.modelId))?.modelId??this.modelIds[0];if(!e.configRevision||!t){this.status=t?"Connection details are stale. Reopen /provider.":"Add a model before testing and saving.";return}if(!e.hasApiKey&&!this.apiKey){this.status="API Key is required.";return}this.busy=!0,this.status="",this.syncFocus();try{let i=await this.options.onSave({providerId:e.providerId,expectedRevision:e.configRevision,name:this.name,baseUrl:this.baseUrl,...e.apiFormat?{apiFormat:e.apiFormat}:{},...this.apiKey?{apiKey:this.apiKey}:{},...this.modelsEdited?{models:this.modelIds.map(s=>({modelId:s}))}:{},modelId:t,saveAndUse:!1});if(this.disposed)return;if(!i.success)throw new Error(i.status?.lastErrorMessage??"Connection test failed.");this.options.onSaved(!!this.apiKey)}catch(i){if(this.disposed)return;let s=L(i,{summary:"Changes were not saved. The previous connection remains in use.",nextStep:"Check the connection and retry. If it changed elsewhere, reopen /provider."});this.status=this.apiKey?s.split(this.apiKey).join("[redacted]"):s}finally{this.busy=!1,this.syncFocus(),this.disposed||this.options.requestRender()}}syncFocus(){this.secretInput.focused=this._focused&&this.editing&&!this.busy&&this.selected===0,this.textInput.focused=this._focused&&this.editing&&!this.busy&&this.selected!==0}};var Jd=class{constructor(e){this.options=e;this.snapshotValue=e.snapshot;let t=this.providers().findIndex(i=>i.active);this.selectedIndex=Math.max(0,t),this.secretInput.onSubmit=i=>this.submitMiniMaxKey(i),this.secretInput.onEscape=()=>this.exitMode()}editor;snapshotValue;selectedIndex=0;mode={kind:"list"};secretInput=new ze({mask:"\u2022"});busy=!1;status;_focused=!1;disposed=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncFocus()}handleInput(e){if(this.busy||this.disposed)return;if(this.editor){this.editor.handleInput(e);return}if(this.mode.kind==="minimax-key"){this.secretInput.handleInput(e),this.requestRender();return}if(ie().matches(e,"tui.select.cancel")){this.options.onCancel();return}if(v(e,j.up)){this.move(-1);return}if(v(e,j.down)){this.move(1);return}if(v(e,j.enter)){this.useSelected();return}let t=e.toLowerCase();t==="r"?this.refreshSelectedModels():t==="t"?this.testSelected():t==="e"?this.editSelected():t===" "&&this.useSelected()}invalidate(){this.secretInput.invalidate(),this.editor?.invalidate()}dispose(){this.disposed=!0,this.editor?.dispose(),this.secretInput.focused=!1,this.secretInput.setValue("")}render(e){let t=Math.max(0,e);return t===0?[]:this.editor?this.editor.render(t):(this.mode.kind==="minimax-key"?this.renderMiniMaxKey(t):this.renderList(t)).map(s=>E(s,t,h.hex(d.dim)("\u2026")))}renderList(e){let t=this.providers(),i=[OM(e),Rt(LM(h.bold.hex(d.signal)("Providers"),h.hex(d.muted)("Model sources and credentials"),Math.max(1,e-4)),e),Rt(h.hex(d.dim)("Choose a source or edit a connection; keys stay masked."),e),$a(e)];for(let[r,o]of t.entries()){let a=r===this.selectedIndex,u=kF(o),l=`${a?h.bold.hex(d.signal)("\u203A"):" "} ${h.hex(u?d.signal:d.text)(`${PF(o)} ${x(o.name)}`)}`;i.push(Rt(LM(l,G(OF(o)),e-4),e))}let s=this.selectedProvider();if(s&&(i.push($a(e)),i.push(Rt(G(LF(s)),e)),s.kind==="custom")){s.baseUrl&&i.push(Rt(h.hex(d.dim)(_r(s.baseUrl)),e));let r=_F(s);r&&i.push(Rt(h.hex(d.dim)(r),e))}return this.status&&i.push(Rt(this.status.tone==="error"?h.hex(d.error)(`! ${this.status.text}`):h.hex(d.accent)(`\u2713 ${this.status.text}`),e)),i.push($a(e),Rt(G(this.busy?"Working\u2026":"\u2191\u2193 move \xB7 Space use \xB7 r refresh models \xB7 e edit \xB7 t test \xB7 Esc close"),e),Rt(h.hex(d.dim)("Select a custom connection and press r to fetch its latest models."),e),NM(e)),i}renderMiniMaxKey(e){let t=this.mode.kind==="minimax-key"&&this.mode.replacing;return[OM(e),Rt(h.bold.hex(d.signal)(t?"Replace MiniMax API Key":"Configure MiniMax API Key"),e),Rt(h.hex(d.muted)(t?"The saved key is overwritten once you submit.":"Saved locally and used instead of Token Plan."),e),$a(e),Rt(this.secretInput.render(Math.max(1,e-8))[0]??"",e),...this.status?[Rt(h.hex(d.error)(`! ${this.status.text}`),e)]:[],$a(e),Rt(G("Enter save and use \xB7 Esc cancel"),e),NM(e)]}providers(){return this.snapshotValue.providers}selectedProvider(){return this.providers()[this.selectedIndex]}move(e){this.selectedIndex=Math.max(0,Math.min(this.providers().length-1,this.selectedIndex+e)),this.status=void 0,this.requestRender()}async refreshSelectedModels(){let e=this.selectedProvider(),t=this.options.onRefreshModels;if(!e||e.kind!=="custom"||e.readOnly||!t){this.status={tone:"info",text:"Select a custom connection to refresh its models."},this.requestRender();return}await this.perform(async()=>{let i=await t(e);try{await this.refresh(i?`Added ${i} new model(s). Choose one with /model.`:"Models are already up to date.")}catch{this.setStatus("Models were refreshed, but the list could not be reloaded. Reopen /provider.","error")}})}async useSelected(){let e=this.selectedProvider();if(e){if(e.kind==="codex-oauth"){await this.connectCodex(e);return}if(e.kind==="minimax-oauth"){await this.setMiniMaxSource("token_plan");return}if(e.kind==="minimax-api-key"){if(!e.hasApiKey){this.startMiniMaxKey();return}await this.setMiniMaxSource("minimax_api_key");return}this.editSelected()}}editSelected(){let e=this.selectedProvider();if(e){if(e.kind==="minimax-api-key"){this.startMiniMaxKey(e.hasApiKey);return}if(e.kind==="minimax-oauth"){if(!this.options.onReLogin){this.setStatus("MiniMax sign-in is unavailable in this host.","error");return}this.options.onReLogin();return}if(e.kind==="codex-oauth"){this.setStatus("Use Enter or Space on the Codex row to start sign-in.","info");return}if(e.readOnly||!this.options.onSaveCustom){this.setStatus("This connection cannot be edited in this host.","info");return}if(!e.configRevision||!e.baseUrl){this.setStatus("Connection details are stale. Reopen /provider.","error");return}this.editor=new Xd({provider:e,onSave:this.options.onSaveCustom,onSaved:t=>{this.closeEditor(),this.perform(()=>this.refresh(t?"Connection saved. All its models now use the new API Key.":"Connection changes saved."),{summary:"Connection saved, but the list could not refresh.",nextStep:"Reopen /provider."})},onCancel:()=>this.closeEditor(),requestRender:()=>this.requestRender()}),this.syncFocus(),this.requestRender()}}closeEditor(){this.editor?.dispose(),this.editor=void 0,this.syncFocus(),this.requestRender()}async connectCodex(e){if(e.status?.state==="connected"){this.setStatus("OpenAI Codex is already connected.","info");return}if(!this.options.onConnectCodex){this.setStatus("Codex sign-in is unavailable in this host.","error");return}this.options.onConnectCodex()}startMiniMaxKey(e=!1){this.mode={kind:"minimax-key",replacing:e},this.status=void 0,this.secretInput.setValue(""),this.secretInput.moveCursorToEnd(),this.syncFocus(),this.requestRender()}submitMiniMaxKey(e){if(this.mode.kind!=="minimax-key")return;let t=this.mode.replacing;if(!e.trim()){this.setStatus("API key is required.","error");return}this.perform(async()=>{await this.options.onSetMiniMaxApiKey(e.trim()),!this.disposed&&(await this.refresh(t?"MiniMax API Key replaced and selected.":"MiniMax API Key saved and selected."),!this.disposed&&(this.mode={kind:"list"}))})}async testSelected(){let e=this.selectedProvider();if(e){if(e.kind==="codex-oauth"){this.setStatus("Codex OAuth connectivity is managed by its sign-in flow.","info");return}if(e.kind==="minimax-oauth"){this.setStatus("MiniMax OAuth sign-in and connectivity are managed by /login.","info");return}await this.perform(async()=>{let t=await this.options.onTest(e.providerId);this.disposed||await this.refresh(t.success?`${e.name} connection is available.`:L(t.status.lastErrorMessage??t.status.state,{summary:`${e.name} connection test failed.`,nextStep:"Check the URL, credentials, and model ID, then retry."}),t.success?"info":"error")})}}async setMiniMaxSource(e){await this.perform(async()=>{await this.options.onSetMiniMaxSource(e),!this.disposed&&await this.refresh(e==="token_plan"?"Using MiniMax Token Plan.":"Using MiniMax API Key.")})}async refresh(e,t="info"){let i=await this.options.onRefresh();this.disposed||(this.snapshotValue=i,this.selectedIndex=Math.min(this.selectedIndex,Math.max(0,this.providers().length-1)),this.setStatus(e,t))}async perform(e,t={summary:"The provider source was not changed.",nextStep:"Retry, or manage providers in Settings."}){this.busy=!0,this.status=void 0,this.requestRender();try{await e()}catch(i){if(this.disposed)return;this.setStatus(L(i,{summary:t.summary,nextStep:t.nextStep}),"error")}finally{this.disposed||(this.busy=!1,this.syncFocus(),this.requestRender())}}exitMode(){this.mode={kind:"list"},this.status=void 0,this.syncFocus(),this.requestRender()}setStatus(e,t){this.status={text:x(e),tone:t},this.requestRender()}syncFocus(){this.secretInput.focused=this._focused&&this.mode.kind==="minimax-key"&&!this.editor,this.editor&&(this.editor.focused=this._focused)}requestRender(){this.disposed||this.options.requestRender()}};function kF(n){return(n.kind==="minimax-oauth"||n.kind==="minimax-api-key")&&n.active}function PF(n){return n.kind==="codex-oauth"?n.status?.state==="connected"?"\u2713":"\u25CB":n.kind==="custom"?n.enabled?"\u25CB":"\u2013":n.active?"\u25CF":"\u25CB"}function _F(n){if(n.models.length!==0)return x(n.models.map(e=>e.displayName??e.modelId).join(", "))}function LF(n){return n.kind==="codex-oauth"?n.status?.state==="connected"?"Connected with OpenAI OAuth":n.status?.state==="pending"?"Sign-in pending \xB7 Enter or Space to continue":n.status?.state==="failed"?`${n.status.lastErrorMessage??"Sign-in failed"} \xB7 Enter or Space to retry`:"Not connected \xB7 Enter or Space to connect":n.kind==="minimax-oauth"?"Sign-in managed by /login \xB7 Space to use \xB7 e to sign in again":n.kind==="minimax-api-key"?n.hasApiKey?`${n.maskedApiKey??"key saved"} \xB7 Space to use \xB7 e to replace`:"No API key saved \xB7 Space or e to add one":[n.enabled?"Enabled":"Disabled",n.apiFormat??"anthropic-messages",n.hasApiKey?n.maskedApiKey??"key saved":"no key",`${n.models.length} model${n.models.length===1?"":"s"}`].join(" \xB7 ")}function OF(n){return n.kind==="codex-oauth"?n.status?.state==="connected"?"Connected":n.status?.state==="pending"?"Waiting for sign-in":n.status?.state==="failed"?"Sign-in failed":"Not connected":n.kind==="minimax-oauth"?n.active?"Active \xB7 Token Plan":"Token Plan":n.kind==="minimax-api-key"?n.hasApiKey?n.active?"Active \xB7 Key saved":"Key saved":"Not configured":`${n.enabled?"Enabled":"Disabled"} \xB7 ${n.models.length} model${n.models.length===1?"":"s"}`}function LM(n,e,t){let i=t-C(n)-C(e);return i>=2?`${n}${" ".repeat(i)}${e}`:E(n,t,"\u2026")}function OM(n){return n<2?"\u2500".repeat(Math.max(0,n)):h.hex(d.line)(`\u256D${"\u2500".repeat(Math.max(0,n-2))}\u256E`)}function $a(n){return n<2?"\u2500".repeat(Math.max(0,n)):h.hex(d.line)(`\u251C${"\u2500".repeat(Math.max(0,n-2))}\u2524`)}function NM(n){return n<2?"\u2500".repeat(Math.max(0,n)):h.hex(d.line)(`\u2570${"\u2500".repeat(Math.max(0,n-2))}\u256F`)}function Rt(n,e){if(e<4)return E(n,e,"\u2026");let t=e-4,i=E(n,t,"\u2026");return`${h.hex(d.line)("\u2502")} ${i}${" ".repeat(Math.max(0,t-C(i)))} ${h.hex(d.line)("\u2502")}`}function DM(n,e){return n.kind==="custom"&&n.enabled&&!n.readOnly&&(n.apiFormat??"anthropic-messages")===e.apiFormat&&n.baseUrl?.trim().replace(/\/+$/u,"")===e.baseUrl.trim().replace(/\/+$/u,"")}function FM(n,e){let t=new Set(n.models.map(i=>i.modelId));return[...n.models.map(({modelId:i})=>({modelId:i})),...e.filter(i=>t.has(i.modelId)?!1:(t.add(i.modelId),!0))]}var Zd="\0custom-provider",NF=[{value:"openai-completions",label:"OpenAI Compatible",description:"/chat/completions"},{value:"openai-responses",label:"OpenAI Responses",description:"/responses"},{value:"anthropic-messages",label:"Anthropic Messages",description:"/v1/messages"}],eh=class{constructor(e){this.options=e;this.list=this.createProviderList(),this.textInput.onSubmit=t=>this.submitText(t),this.textInput.onEscape=()=>this.back(),this.secretInput.onSubmit=t=>this.editingModelApiKey?this.commitModelApiKey(t):this.submitApiKey(t),this.secretInput.onEscape=()=>this.editingModelApiKey?this.cancelModelApiKeyEdit():this.back()}mode="provider";list;searchInput=new Ne({prompt:""});textInput=new Ne({prompt:""});secretInput=new Ne({prompt:"",mask:"\u2022"});template;connection;alias="";selectedModelId="";modelFocus="models";editingModelApiKey=!1;modelApiKeyDraft="";customName="";customBaseUrl="";customApiFormat="openai-completions";customModelId="";busy=!1;status="";_focused=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncFocus()}handleInput(e){if(this.busy)return;if(this.mode==="model"){this.handleModelInput(e);return}if(ie().matches(e,"tui.select.cancel")){this.back();return}if(this.mode==="provider"){this.handleSearchableListInput(e);return}if(this.mode==="custom-format"||this.mode==="connection"){this.list.handleInput(e);return}(this.mode==="api-key"?this.secretInput:this.textInput).handleInput(e),this.options.requestRender()}invalidate(){this.list.invalidate(),this.searchInput.invalidate(),this.textInput.invalidate(),this.secretInput.invalidate()}render(e){let t=Math.max(0,e);return t?[h.bold.hex(d.signal)("Add 3rd-party provider"),h.hex(d.muted)(this.subtitle()),...this.mode==="provider"&&this.options.catalogWarning?[h.hex(d.warning)(x(this.options.catalogWarning))]:[],"",...this.renderBody(t),...this.status?["",h.hex(d.error)(`! ${x(this.status)}`)]:[],"",h.hex(d.dim)(this.footer())].map(s=>E(s,t,h.hex(d.dim)("\u2026"))):[]}handleSearchableListInput(e){let t=ie();if(t.matches(e,"tui.select.up")||t.matches(e,"tui.select.down")||t.matches(e,"tui.select.confirm")){this.list.handleInput(e),this.options.requestRender();return}let i=this.searchInput.getValue();this.searchInput.handleInput(e),this.searchInput.getValue()!==i&&(this.mode==="model"&&this.closeModelDetails(),this.rebuildList()),this.options.requestRender()}handleModelInput(e){let t=ie();if(this.editingModelApiKey){if(t.matches(e,"tui.select.down")){let i=this.secretInput.getValue().trim();i&&(this.modelApiKeyDraft=i),this.editingModelApiKey=!1,this.modelFocus="models",this.status="",this.secretInput.setValue(""),this.syncFocus(),this.options.requestRender();return}this.secretInput.handleInput(e),this.options.requestRender();return}if(this.modelFocus==="models"&&t.matches(e,"tui.select.up")&&this.list.getSelectedItem()?.value===this.filteredModels()[0]?.modelId){this.modelFocus="api-key",this.status="",this.syncFocus(),this.options.requestRender();return}if(t.matches(e,"tui.input.tab")){this.modelFocus=this.modelFocus==="models"?"api-key":"models",this.status="",this.syncFocus(),this.options.requestRender();return}if(t.matches(e,"tui.select.cancel")){if(this.modelFocus==="api-key"){this.modelFocus="models",this.status="",this.syncFocus(),this.options.requestRender();return}if(this.selectedModelId){this.closeModelDetails(),this.options.requestRender();return}this.back();return}if(this.modelFocus==="api-key"){if(t.matches(e,"tui.select.down")){this.modelFocus="models",this.status="",this.syncFocus(),this.options.requestRender();return}t.matches(e,"tui.select.confirm")&&this.startModelApiKeyEdit();return}this.handleSearchableListInput(e)}renderBody(e){if(this.mode==="model"){let s=h.hex(d.muted)("Search: "),r=this.searchInput.render(Math.max(1,e-C(s)))[0]??"";return[...this.renderModelApiKey(e),"",`${s}${r}`,...this.list.render(e),...this.renderModelDetails()]}if(this.mode==="provider"){let s=h.hex(d.muted)("Search: "),r=this.searchInput.render(Math.max(1,e-C(s)))[0]??"";return[`${s}${r}`,...this.list.render(e)]}if(this.mode==="custom-format"||this.mode==="connection")return this.list.render(e);let t=this.inputLabel(),i=this.mode==="api-key"?this.secretInput:this.textInput;return[h.hex(d.text)(t),i.render(e)[0]??""]}renderModelApiKey(e){let t=this.modelFocus==="api-key"?"\u2192 ":" ",i=this.modelApiKeyDraft||this.connection?.hasApiKey,s=this.modelApiKeyDraft?"Ready for test":this.connection?.hasApiKey?"Saved key (unchanged)":"Not configured",r=this.editingModelApiKey?"Enter to keep":this.modelFocus==="api-key"?`Enter to ${i?"edit":"configure"}`:`Tab to ${i?"edit":"configure"}`,o=`${t}API Key: ${s} \xB7 ${r}`;if(!this.editingModelApiKey)return[h.hex(d.text)(o)];let a=h.hex(d.muted)(" Edit: "),u=this.secretInput.render(Math.max(1,e-C(a)))[0]??"";return[h.hex(d.text)(o),`${a}${u}`]}renderModelDetails(){let e=this.selectedModel();if(!e)return[];let t=[e.limit?.context?`context ${e.limit.context.toLocaleString("en-US")}`:"",e.limit?.output?`output ${e.limit.output.toLocaleString("en-US")}`:""].filter(Boolean),i=[e.modalities?.input?.length?`input ${e.modalities.input.map(x).join(", ")}`:"",e.modalities?.output?.length?`output ${e.modalities.output.map(x).join(", ")}`:""].filter(Boolean),s=[e.attachment?"attachments":"",e.reasoning?"reasoning":"",e.toolCall?"tools":"",e.temperature?"temperature":""].filter(Boolean);return["",h.bold.hex(d.signal)("Model details"),h.hex(d.text)(`Model ID: ${x(e.modelId)}`),h.hex(d.text)(`Limits: ${t.join(" \xB7 ")||"Not specified"}`),h.hex(d.text)(`Modalities: ${i.join(" \xB7 ")||"Not specified"}`),h.hex(d.text)(`Capabilities: ${s.join(", ")||"None listed"}`)]}createProviderList(){let e=this.searchInput.getValue().trim().toLocaleLowerCase(),i=this.options.templates.filter(r=>`${r.providerId} ${r.name}`.toLocaleLowerCase().includes(e)).map(r=>({value:r.providerId,label:x(r.name),description:`${x(r.apiFormat)} \xB7 ${r.models.length} models`,groupLabel:"Known providers"}));(!e||"custom provider".includes(e))&&i.push({value:Zd,label:"Custom provider",description:"Enter URL, protocol, model ID, and API key",groupLabel:"Manual"});let s=this.createList(i);return s.onSelect=r=>this.selectProvider(r.value),s}createModelList(){let e=this.filteredModels(),t=this.createList(e.map(i=>({value:i.modelId,label:x(i.displayName??i.modelId),description:x(i.modelId)})));return t.onSelectionChange=()=>{this.closeModelDetails()},t.onSelect=i=>{if(this.selectedModelId!==i.value){this.selectedModelId=i.value,this.status="";return}if(!this.modelApiKeyDraft&&!this.connection?.hasApiKey){this.startModelApiKeyEdit();return}this.save(this.modelApiKeyDraft)},t}filteredModels(){let e=this.searchInput.getValue().trim().toLocaleLowerCase();return(this.template?.models??[]).filter(t=>`${t.modelId} ${t.displayName??""}`.toLocaleLowerCase().includes(e))}createFormatList(){let e=this.createList([...NF]);return e.onSelect=t=>{this.customApiFormat=t.value,this.enterTextMode("custom-model",this.customModelId)},e}createList(e){return new Je(e,Math.min(Math.max(e.length,1),10),it,{minPrimaryColumnWidth:24,maxPrimaryColumnWidth:40})}selectProvider(e){if(this.status="",e===Zd){this.resetKnownProviderDraft(),this.template=void 0,this.enterTextMode("custom-name",this.customName);return}this.template=this.options.templates.find(t=>t.providerId===e),this.template&&(this.resetKnownProviderDraft(),this.enterMode(this.matchingConnections().length?"connection":"model"))}matchingConnections(){let e=this.template;return e?(this.options.providers??[]).filter(t=>DM(t,e)&&t.configRevision):[]}createConnectionList(){let e=this.matchingConnections(),t=this.createList([...e.map(i=>({value:i.providerId,label:`Use existing connection: ${x(i.name)}`,description:`${i.providerId} \xB7 keep saved key \xB7 select or add models`})),{value:Zd,label:"Add another account",description:"Create a separate connection with an alias and API Key"}]);return t.onSelect=i=>{i.value===Zd?(this.connection=void 0,this.enterTextMode("alias","")):(this.connection=e.find(s=>s.providerId===i.value),this.enterMode("model"))},t}startModelApiKeyEdit(){this.editingModelApiKey=!0,this.modelFocus="api-key",this.status="",this.secretInput.setValue(""),this.secretInput.moveCursorToEnd(),this.syncFocus(),this.options.requestRender()}commitModelApiKey(e){let t=e.trim();if(!t&&!this.modelApiKeyDraft&&!this.connection?.hasApiKey){this.status="API Key is required.",this.options.requestRender();return}t&&(this.modelApiKeyDraft=t),this.editingModelApiKey=!1,this.modelFocus="models",this.status="",this.secretInput.setValue(""),this.syncFocus(),this.options.requestRender()}cancelModelApiKeyEdit(){this.editingModelApiKey=!1,this.status="",this.secretInput.setValue(""),this.syncFocus(),this.options.requestRender()}submitText(e){let t=e.trim();if(!t){this.status=`${this.inputLabel()} is required.`,this.options.requestRender();return}if(this.mode==="alias"){this.alias=t,this.enterMode("model");return}if(this.mode==="custom-name"){this.customName=t,this.enterTextMode("custom-url",this.customBaseUrl);return}if(this.mode==="custom-url"){if(!DF(t)){this.status="Base URL must use http or https.",this.options.requestRender();return}this.customBaseUrl=t,this.enterMode("custom-format");return}this.mode==="custom-model"&&(this.customModelId=t,this.enterMode("api-key"))}submitApiKey(e){let t=e.trim();if(!t){this.status="API Key is required.",this.options.requestRender();return}this.save(t)}async save(e){let t=this.saveInput(e);if(t){this.busy=!0,this.status="",this.options.requestRender();try{let i=await this.options.onSave(t);if(!i.success){this.status=i.status?.lastErrorMessage??"Connection test failed.";return}await this.options.onComplete({...i.provider?.providerId?{providerId:i.provider.providerId}:{},providerName:t.name??"Custom provider",modelId:t.modelId,...this.connection?{reused:!0}:{}}),this.template&&this.resetKnownProviderDraft()}catch(i){this.status=L(i,{summary:"Couldn't save the provider.",nextStep:"Check the URL, API key, and model, then retry."})}finally{e&&(this.status=this.status.split(e).join("[redacted]")),this.busy=!1,this.options.requestRender()}}}saveInput(e){if(this.template)return this.selectedModelId?{...this.connection?{providerId:this.connection.providerId,expectedRevision:this.connection.configRevision}:{},name:this.connection?.name??(this.alias||this.template.name),baseUrl:this.connection?.baseUrl??this.template.baseUrl,...e?{apiKey:e}:{},apiFormat:this.template.apiFormat,models:this.connection?FM(this.connection,this.template.models):this.template.models,modelId:this.selectedModelId,saveAndUse:!0}:void 0;if(!(!this.customName||!this.customBaseUrl||!this.customModelId))return{name:this.customName,baseUrl:this.customBaseUrl,apiKey:e,apiFormat:this.customApiFormat,models:[{modelId:this.customModelId,displayName:this.customModelId,configurationSource:"manual",toolCall:!0}],modelId:this.customModelId,saveAndUse:!0}}enterMode(e){this.mode=e,this.status="",this.searchInput.setValue(""),this.searchInput.moveCursorToEnd(),(e==="provider"||e==="model"||e==="custom-format"||e==="connection")&&this.rebuildList(),e==="api-key"&&(this.secretInput.setValue(""),this.secretInput.moveCursorToEnd()),this.syncFocus(),this.options.requestRender()}enterTextMode(e,t){this.mode=e,this.status="",this.textInput.setValue(t),this.textInput.moveCursorToEnd(),this.syncFocus(),this.options.requestRender()}rebuildList(){this.list=this.mode==="connection"?this.createConnectionList():this.mode==="provider"?this.createProviderList():this.mode==="model"?this.createModelList():this.createFormatList()}selectedModel(){return this.template?.models.find(e=>e.modelId===this.selectedModelId)}closeModelDetails(){this.selectedModelId="",this.status=""}resetKnownProviderDraft(){this.connection=void 0,this.alias="",this.selectedModelId="",this.modelFocus="models",this.editingModelApiKey=!1,this.modelApiKeyDraft="",this.secretInput.setValue("")}back(){if(this.mode==="provider")return this.resetKnownProviderDraft(),this.options.onCancel();if(this.mode==="model")return this.resetKnownProviderDraft(),this.enterMode("provider");if(this.mode==="connection")return this.enterMode("provider");if(this.mode==="alias")return this.enterMode("connection");if(this.mode==="custom-name")return this.enterMode("provider");if(this.mode==="custom-url")return this.enterTextMode("custom-name",this.customName);if(this.mode==="custom-format")return this.enterTextMode("custom-url",this.customBaseUrl);if(this.mode==="custom-model")return this.enterMode("custom-format");if(this.template)return this.enterMode("model");this.enterTextMode("custom-model",this.customModelId)}subtitle(){return this.mode==="connection"?"This provider is already configured. Use the saved connection or add another account.":this.mode==="alias"?"Give the additional account a recognizable name":this.mode==="provider"?"Choose a known provider or enter a custom endpoint":this.mode==="model"?`Choose a ${x(this.template?.name??"")} model`:this.mode==="api-key"?"The key is stored locally and never shown in output":"Custom provider"}inputLabel(){return this.mode==="alias"?"Account alias":this.mode==="custom-name"?"Provider name":this.mode==="custom-url"?"Base URL":this.mode==="custom-model"?"Model ID":"API Key"}footer(){return this.busy?"Testing and saving\u2026":this.mode==="model"?this.editingModelApiKey?"enter keep for setup \xB7 \u2193 models \xB7 esc cancel edit":this.modelFocus==="api-key"?"enter edit API Key \xB7 \u2193/tab models \xB7 esc models":this.selectedModelId?"enter test, save, and use \xB7 tab API Key \xB7 esc close details":"\u2191\u2193 select \xB7 type to search \xB7 tab API Key \xB7 enter details \xB7 esc back":this.mode==="api-key"?"enter test, save, and use \xB7 esc back":this.mode==="custom-name"||this.mode==="custom-url"||this.mode==="custom-model"||this.mode==="alias"?"enter continue \xB7 esc back":"\u2191\u2193 select \xB7 type to search \xB7 enter continue \xB7 esc back"}syncFocus(){this.searchInput.focused=this._focused&&(this.mode==="provider"||this.mode==="model"&&this.modelFocus==="models"&&!this.editingModelApiKey),this.textInput.focused=this._focused&&(this.mode==="custom-name"||this.mode==="custom-url"||this.mode==="custom-model"||this.mode==="alias"),this.secretInput.focused=this._focused&&(this.mode==="api-key"||this.mode==="model"&&this.editingModelApiKey)}};function DF(n){try{let e=new URL(n);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}var th=["all","installed","official","local"],nh=class{constructor(e){this.options=e;this.plugins=[...e.plugins],this.searchInput.setValue(e.initialQuery?.trim()??""),this.searchInput.moveCursorToEnd();let t={render:r=>this.renderHeader(r),invalidate:()=>{}},i={render:r=>this.renderBody(r),invalidate:()=>{}},s={render:r=>this.renderFooter(r),invalidate:()=>{}};this.bodyViewport=new Nn(i,{primary:!0,overscroll:"contain"}),this.bodyViewport.setActiveRow(0,!0),this.layoutRoot=new St([{component:t,basis:"auto",shrink:1,minSize:1},{component:this.bodyViewport,basis:0,grow:1,shrink:1,minSize:1},{component:s,basis:"auto",shrink:1,minSize:1}])}id="plugins";layoutRoot;focused=!1;plugins;tab="all";searchInput=new Ne({prompt:""});bodyViewport;selectedIndex=0;busy=!1;status="";disposed=!1;handleInput(e){if(this.busy||this.disposed)return;if(v(e,"escape")||v(e,"ctrl+c")){this.searchInput.getValue()?(this.searchInput.setValue(""),this.resetSelection(),this.requestRender()):this.options.onCancel();return}if(v(e,"tab")){this.cycleTab(1);return}if(v(e,"shift+tab")){this.cycleTab(-1);return}if(v(e,"up"))return this.move(-1);if(v(e,"down"))return this.move(1);if(v(e,"enter")){let i=this.selected();i&&!i.installed&&this.mutate(i,()=>this.options.onInstall(i));return}if(v(e,"space")){let i=this.selected();i?.installed&&this.mutate(i,()=>this.options.onSetEnabled(i,!i.enabled));return}if(this.searchInput.getValue().length===0&&(v(e,"delete")||v(e,"ctrl+d"))){let i=this.selected();i?.installed&&this.mutate(i,()=>this.options.onRemove(i));return}if(v(e,"ctrl+r")){this.refresh();return}let t=this.searchInput.getValue();this.searchInput.handleInput(v(e,"shift+space")?" ":e),this.searchInput.getValue()!==t&&(this.resetSelection(),this.requestRender())}dispose(){this.disposed=!0}invalidate(){this.layoutRoot.invalidate()}render(e){return[...this.renderHeader(e),...this.renderBody(e),...this.renderFooter(e)]}renderHeader(e){let t=Math.max(0,e);if(!t)return[];let i=this.plugins.filter(a=>a.installed).length;this.searchInput.focused=this.focused;let s=h.hex(d.muted)("Search: "),r=Math.max(0,t-C(s)),o=`${s}${this.searchInput.render(r)[0]??""}`;return[h.bold.hex(d.signal)("Plugins"),h.hex(d.muted)(`Browse MiniMax Official and Local plugins \xB7 Installed ${i} of ${this.plugins.length}`),$F(this.tab,i),o,h.hex(d.line)("\u2500".repeat(t))].map(a=>E(a,t,"\u2026"))}renderBody(e){let t=Math.max(0,e);if(!t)return[];let i=this.visiblePlugins();return this.selectedIndex=i.length?Math.min(this.selectedIndex,i.length-1):0,this.bodyViewport.setActiveRow(this.selectedIndex),i.length===0?[h.hex(d.muted)("No matching plugins")]:i.map((s,r)=>E(BF(s,r===this.selectedIndex,t),t,"\u2026"))}renderFooter(e){let t=Math.max(0,e);return t?[this.status?h.hex(d.accent)(this.status):G("Enter install \xB7 Space enable/disable \xB7 Delete remove \xB7 Ctrl+R refresh"),G("\u2191\u2193 select \xB7 PgUp/PgDn scroll \xB7 Tab source \xB7 \u2190\u2192 edit search \xB7 Esc clear/close")].map(i=>E(i,t,"\u2026")):[]}visiblePlugins(){let e=this.searchInput.getValue().trim().toLocaleLowerCase();return this.plugins.filter(t=>this.tab==="all"||(this.tab==="installed"?t.installed:t.marketplace===this.tab)?e?[t.name,t.displayName,t.description,t.author].filter(s=>!!s).some(s=>s.toLocaleLowerCase().includes(e)):!0:!1)}selected(){return this.visiblePlugins()[this.selectedIndex]}move(e){let t=this.visiblePlugins().length;this.selectedIndex=t?Math.max(0,Math.min(t-1,this.selectedIndex+e)):0,this.bodyViewport.setActiveRow(this.selectedIndex,!0),this.status="",this.requestRender()}cycleTab(e){let t=th.indexOf(this.tab);this.tab=th[(t+e+th.length)%th.length]??"all",this.resetSelection(),this.requestRender()}resetSelection(){this.selectedIndex=0,this.bodyViewport.setActiveRow(0,!0),this.status=""}async mutate(e,t){this.busy=!0,this.status=`Updating ${e.displayName}\u2026`,this.requestRender();try{let i=await t();if(this.disposed)return;this.plugins=this.plugins.map(s=>s.pluginId===i.pluginId?i:s),this.status=`${i.displayName}: ${i.installed?i.enabled?"enabled":"disabled":"removed"}`}catch(i){if(this.disposed)return;this.status=L(i,{summary:`Couldn't update ${e.displayName}.`,nextStep:FF(i)?"Run /login, then retry.":"Retry or run mcode plugin for details."})}finally{this.disposed||(this.busy=!1,this.requestRender())}}async refresh(){this.busy=!0,this.status="Refreshing Plugin catalogs\u2026",this.requestRender();try{let e=await this.options.onRefresh();if(this.disposed)return;this.plugins=[...e],this.resetSelection(),this.status="Plugin catalogs refreshed."}catch(e){if(this.disposed)return;this.status=L(e,{summary:"Couldn't refresh Plugins.",nextStep:"Retry or run mcode plugin marketplace upgrade."})}finally{this.disposed||(this.busy=!1,this.requestRender())}}requestRender(){this.disposed||this.options.requestRender()}};function FF(n){return!n||typeof n!="object"?!1:("code"in n?n.code:void 0)==="PLUGIN_AUTH_REQUIRED"}function $F(n,e){return[["all","All Plugins"],["installed",`Installed (${e})`],["official","MiniMax Official"],["local","Local"]].map(([i,s])=>i===n?h.bold.hex(d.signal)(`[${s}]`):h.hex(d.muted)(s)).join(" ")}function BF(n,e,t){let i=n.enabled?"[*]":n.installed?"[-]":"[ ]",s=n.installed?n.enabled?"Enabled":"Disabled":"Available",r=`${e?"\u203A":" "} ${i} ${x(n.displayName)}`,o=`${s} \xB7 ${n.marketplace} \xB7 ${x(n.description??qF(n))}`,a=Math.max(1,t-C(r)-C(o));return`${e?h.bold.hex(d.signal)(r):h.hex(d.text)(r)}${" ".repeat(a)}${h.hex(d.muted)(o)}`}function qF(n){let{appCount:e,mcpServerCount:t,skillCount:i}=n.capabilities;return`${e} apps \xB7 ${t} MCP \xB7 ${i} skills`}var HF=["peek_","peek:"];function $M(n){if(n.visibility!=="hidden"||!n.parentSessionId)return!1;let e=n.purpose??"";return!HF.some(t=>e.startsWith(t))}var Q1=10,UF=200,ih=class{constructor(e){this.options=e;this.sessions=Ba(e.sessions),this.hasMore=!!(e.hasMore&&e.onLoadMore),this.now=e.now??Date.now,this.activeSessionId=e.activeSessionId,this.searchInput.setValue(e.initialQuery?.trim()??""),this.searchInput.onSubmit=()=>this.openSelected(),this.actionInput.onSubmit=t=>this.submitActionInput(t),this.actionInput.onEscape=()=>this.exitActionMode(),this.clampSelection(),this.searchInput.getValue()&&this.scheduleRemainingSearchLoad(),e.initialRenameSessionId&&this.startRename(e.initialRenameSessionId)}sessions;searchInput=new ze;actionInput=new ze;now;activeSessionId;view="active";scope="workspace";mode="list";selectedIndex=0;selectedSessionId;actionTargetId;busy=!1;hasMore;loadingMore=!1;pageLoad;searchLoadTimer;status;_focused=!1;disposed=!1;get focused(){return this._focused}set focused(e){this._focused=e,this.syncInputFocus()}setSessions(e){this.disposed||(this.sessions=Ba(e),this.clampSelection(),this.requestRender())}startRename(e){let t=this.visibleSessions().findIndex(i=>i.sessionId===e);return t<0?(this.status={tone:"error",text:"The current Session is not available here. Use /rename <title> to rename it directly."},this.requestRender(),!1):(this.selectedIndex=t,this.selectedSessionId=e,this.enterTextMode("rename"),!0)}handleInput(e){if(this.busy||this.disposed)return;if(this.mode==="rename"){this.actionInput.handleInput(e),this.requestRender();return}if(this.mode==="confirm-archive"){v(e,j.enter)?this.confirmArchive():ie().matches(e,"tui.select.cancel")&&this.exitActionMode();return}if(v(e,j.up)){this.moveSelection(-1);return}if(v(e,j.down)){this.moveSelection(1);return}if(v(e,j.pageUp)){this.moveSelection(-Q1);return}if(v(e,j.pageDown)){this.moveSelection(Q1);return}if(v(e,j.ctrl("l"))){this.loadMore();return}let t=this.searchInput.getValue().length>0;if(!t&&v(e,j.ctrl("a"))){this.changeScope();return}if(v(e,j.tab)){this.view=this.view==="active"?"archived":"active",this.resetSelection();return}if(v(e,j.ctrl("n"))){this.options.onNew();return}if(v(e,j.ctrl("r"))){this.enterTextMode("rename");return}if(!t&&v(e,j.ctrl("d"))){this.toggleSelectedArchived();return}if(v(e,j.enter)){this.openSelected();return}if(ie().matches(e,"tui.select.cancel")){this.searchInput.getValue()?(this.searchInput.setValue(""),this.resetSelection()):this.options.onCancel();return}let i=this.searchInput.getValue();this.searchInput.handleInput(e),this.searchInput.getValue()!==i?(this.resetSelection(),this.scheduleRemainingSearchLoad()):this.requestRender()}invalidate(){this.searchInput.invalidate(),this.actionInput.invalidate()}dispose(){this.disposed=!0,this.searchLoadTimer&&clearTimeout(this.searchLoadTimer),this.searchLoadTimer=void 0,this.searchInput.focused=!1,this.actionInput.focused=!1}fullscreenViewport=!0;handlesViewportKeys=!0;render(e){return this.renderViewport(e,this.currentMaxRows()??1/0)}renderViewport(e,t){let i=Math.max(0,e);if(i===0)return[];let s=Number.isFinite(t)?Math.max(1,Math.floor(t)):void 0;return this.mode==="rename"?this.fitLines(this.fitToRows(this.renderTextMode(i,s),s),i):this.mode==="confirm-archive"?this.fitLines(this.fitToRows(this.renderArchiveConfirmation(i,s),s),i):this.fitLines(this.fitToRows(this.renderList(i,s),s),i)}renderList(e,t){let i=this.visibleSessions();this.clampSelection(i);let s=this.selectedSession(i),r=this.scopedSessions(),o=r.filter(_=>!_.archived).length,a=r.length-o,u=this.view==="active"?"Recent":"Archived",l=this.scope==="workspace"?"This workspace":"All sessions",c=this.searchInput.render(Math.max(1,e-12))[0]??"";if(t!==void 0&&t<=8)return this.renderInlineCompactList(e,t,i,u,c);let p=e<40||t!==void 0&&t<=18,m=e<40,g=!p&&!m,T=i.length>1?` \xB7 ${this.selectedIndex+1}/${i.length}`:"",y=`${m?e<30?"\u2191\u2193 \xB7 Enter \xB7 Esc \xB7 Ctrl+A all":`\u2191\u2193 \xB7 Enter \xB7 Esc \xB7 Ctrl+A ${this.scope==="workspace"?"all":"current"}${this.hasMore?" \xB7 Ctrl+L":""}`:p?`\u2191\u2193 \xB7 Enter ${this.view==="active"?"switch":"restore"} \xB7 Ctrl+A ${this.scope==="workspace"?"all":"current"}${this.hasMore?" \xB7 Ctrl+L more":""} \xB7 Tab ${this.view==="active"?"archived":"recent"} \xB7 Esc`:`\u2191\u2193 move \xB7 Enter ${this.view==="active"?"switch":"restore"} \xB7 Tab ${this.view==="active"?"archived":"recent"}`}${T}`,b=g?`Ctrl+A ${this.scope==="workspace"?"all":"current"} \xB7 Ctrl+N new \xB7 Ctrl+R rename \xB7 Ctrl+D ${this.view==="active"?"archive":"restore"}${this.hasMore?" \xB7 More sessions available \xB7 Ctrl+L more":""} \xB7 Esc close`:void 0,S=si([y,...b?[b]:[]],Math.max(1,e-4)),M=[ri(m?`Sessions \xB7 ${u}`:"Sessions",`${u} \xB7 ${l}`,e),Ce(h.hex(d.muted)(m?`${this.scope==="workspace"?"Workspace":l} \xB7 ${i.length} ${u.toLowerCase()}`:`${o} active \xB7 ${a} archived`),e)];if(!p&&(this.loadingMore||this.searchInput.getValue().trim()&&this.hasMore)&&M.push(Ce(h.hex(d.accent)(this.searchInput.getValue().trim()?"Searching saved sessions\u2026":"Loading more sessions\u2026"),e)),M.push(Ce(`${h.hex(d.muted)("Search")} ${c}`,e)),p||M.push(Ce(h.hex(d.dim)("Filter title, ID, workspace, model, status, or branch"),e)),i.length===0)M.push(Ce(h.hex(d.warning)(this.searchInput.getValue()?this.loadingMore||this.hasMore?"Searching saved sessions\u2026":"No matching sessions.":`No ${u.toLowerCase()} sessions in this workspace.`),e));else{let _=S.length+2,F=this.status?1:0,A=this.detailRowBudget(e,t),$=!this.searchInput.getValue().trim()&&e>=48&&(t===void 0||t>=20),N=Math.max(1,(t??Number.POSITIVE_INFINITY)-M.length-_-F-A),U=this.sessionWindow(i,N,$);M.push(...this.renderSessionWindow(U.sessions,e,N,$))}let R=this.detailRowBudget(e,t);if(s&&R>0){if(M.push(On(e),Ce(BM(h.bold.hex(d.text)(E(x(s.title?.trim()||"Untitled session"),Math.max(1,e-28),"\u2026")),h.hex(d.accent)(s.sessionId===this.activeSessionId?"\u25CF current":"\u25CB selected"),Math.max(1,e-4)),e)),R>=3&&M.push(Ce(h.hex(d.muted)(`ID ${x(s.sessionId)}${wn(s)?` \xB7 Sub-agent \xB7 Parent ${x(s.parentSessionId)}`:s.parentSessionId?" \xB7 child Session":""}`),e)),R>=4&&M.push(Ce(h.hex(d.muted)(`Path ${XF(YF(x(s.workspaceDir??"Unknown workspace")),Math.max(1,e-10))}`),e)),R>=5){let _=qM(s),F=s.interactionMode==="plan"?"Plan":void 0,A=[VF(s),_,F].filter(Boolean).join(" \xB7 ");A&&M.push(Ce(h.hex(d.muted)(A),e))}if(R>=6){let _=Y1(s.updatedAt,this.now()),F=Y1(s.createdAt,this.now()),A=[_?`Updated ${_}`:void 0,F?`Created ${F}`:void 0].filter(Boolean).join(" \xB7 ");A&&M.push(Ce(h.hex(d.dim)(A),e))}}return this.status&&M.push(Ce(this.status.tone==="error"?h.hex(d.error)(`! ${this.status.text}`):h.hex(d.accent)(`\u2713 ${this.status.text}`),e)),M.push(On(e),...S.map(_=>Ce(_,e)),oi(e)),M}renderInlineCompactList(e,t,i,s,r){this.clampSelection(i);let o=this.selectedSession(i),a=x(this.searchInput.getValue().trim()),u=a?`Sessions \xB7 /${a}`:`Sessions \xB7 ${s}`,l=a?this.loadingMore||this.hasMore?"Searching saved sessions\u2026":"No matching sessions.":`No ${s.toLowerCase()} sessions in this workspace.`,c=o?this.renderSessionLine(o,!0,e-4):h.hex(d.warning)(l),p=oe(e,t,"\u2191\u2193 \xB7 Enter \xB7 Tab \xB7 Ctrl+A \xB7 Esc"),m=[...p.bodyHeight>=2?[`${h.hex(d.muted)("Search")} ${r}`]:[],o?this.renderSessionLine(o,!0,p.contentWidth):c];return p.render({title:u,body:m})}detailRowBudget(e,t){return e<30||t!==void 0&&t<=18?0:e<60?4:6}renderSessionLine(e,t,i){let s=e.sessionId===this.activeSessionId,r=t?h.bold.hex(d.signal)("\u203A "):h.hex(d.dim)(" "),o=s?h.hex(d.success)("\u25CF "):"",a=x(e.title?.trim()||"Untitled session"),l=wn(e)?`\u21B3 Sub-agent${e.agentName?` \xB7 ${x(e.agentName)}`:""} \xB7 ${a}`:a,c=QF(e.status),p=[Y1(e.updatedAt,this.now()),s?"current":void 0,c].filter(T=>!!T).join(" \xB7 "),m=Math.max(1,i-C(r)-C(o)-4),g=`${r}${o}${E(l,m,"\u2026")}`;return BM(t?h.bold.hex(d.signal)(g):g,h.hex(d.muted)(p),i)}sessionWindow(e,t,i){if(e.length===0)return{sessions:[],start:0};let s=Math.max(1,Math.min(Q1,t,e.length));for(;;){let r=Math.max(0,Math.min(this.selectedIndex-Math.floor(s/2),Math.max(0,e.length-s))),o=e.slice(r,r+s);if(s===1||this.sessionWindowRowCount(o,i)<=t)return{sessions:o,start:r};s-=1}}sessionWindowRowCount(e,t){if(!t)return e.length;let i=0,s;for(let r of e){let o=this.sessionSection(r);o!==s&&(i+=1,s=o),i+=1}return i}renderSessionWindow(e,t,i,s){let r=[],o;for(let a of e){let u=this.sessionSection(a);if(s&&u!==o&&r.length<i-1&&r.push(Ce(h.bold.hex(d.text)(jF(u)),t)),o=u,r.length>=i)break;r.push(Ce(this.renderSessionLine(a,a.sessionId===this.selectedSessionId,t-4),t))}return r}sessionSection(e){let t=e.parentSessionId?this.sessions.find(i=>i.sessionId===e.parentSessionId):void 0;return WF(sh(t?.updatedAt??e.updatedAt),this.now())}renderTextMode(e,t){let i=oe(e,t,"Ctrl+U clear \xB7 Enter save \xB7 Esc cancel");return i.render({title:"Sessions / Rename session",body:[this.actionInput.render(Math.max(1,i.contentWidth))[0]??"",...this.status?[h.hex(this.status.tone==="error"?d.error:d.accent)(this.status.text)]:[]]})}renderArchiveConfirmation(e,t){let i=this.findActionTarget();return Ln({title:"Archive session?",body:[x(i?.title?.trim()||i?.sessionId||"Unknown session"),h.hex(d.muted)("History stays available under Archived.")],footer:"Enter archive \xB7 Esc cancel"},e,t,"warning")}visibleSessions(){let e=this.searchInput.getValue().trim().toLocaleLowerCase().split(/\s+/u).filter(Boolean);return this.scopedSessions().filter(t=>{if(!!t.archived!=(this.view==="archived"))return!1;if(e.length===0)return!0;let i=GF(t);return e.every(s=>zF(i,s))})}scopedSessions(){let e=this.sessions.filter(i=>!Ja(i)&&(i.visibility!=="hidden"||$M(i)));if(this.scope==="all")return e;let t=rh(this.options.workspaceDir);return e.filter(i=>rh(i.workspaceDir)===t)}moveSelection(e){let t=this.visibleSessions();if(t.length!==0){if(this.clampSelection(t),e>0&&this.selectedIndex===t.length-1&&this.hasMore){this.loadMore();return}this.selectedIndex=(this.selectedIndex+e+t.length*Math.ceil(Math.abs(e)/t.length))%t.length,this.selectedSessionId=t[this.selectedIndex]?.sessionId,this.status=void 0,this.requestRender()}}loadMore(){this.loadNextPage(!0)}async changeScope(){let e=this.scope==="workspace"?"all":"workspace";if(!this.options.onScopeChange){this.scope=e,this.resetSelection();return}this.busy=!0,this.status={tone:"info",text:e==="all"?"Loading all sessions\u2026":"Loading this workspace\u2026"},this.requestRender();try{if(this.pageLoad&&await this.pageLoad,this.disposed)return;let t=await this.options.onScopeChange(e);if(this.disposed)return;this.scope=e,this.sessions=Ba(t.sessions),this.hasMore=!!(t.hasMore&&this.options.onLoadMore),this.selectedIndex=0,this.selectedSessionId=void 0,this.status=void 0,this.clampSelection(),this.scheduleRemainingSearchLoad()}catch(t){if(this.disposed)return;this.status={tone:"error",text:L(t,{summary:"Couldn't change the session scope.",nextStep:"Retry.",preservation:"The current session list is unchanged."})}}finally{this.disposed||(this.busy=!1,this.requestRender())}}scheduleRemainingSearchLoad(){this.searchLoadTimer&&clearTimeout(this.searchLoadTimer),this.searchLoadTimer=void 0,!(!this.searchInput.getValue().trim()||!this.hasMore)&&(this.searchLoadTimer=setTimeout(()=>{this.searchLoadTimer=void 0,this.loadRemainingForSearch()},UF))}loadRemainingForSearch(){!this.searchInput.getValue().trim()||!this.hasMore||this.loadNextPage(!1).then(e=>{!this.disposed&&e&&this.loadRemainingForSearch()})}loadNextPage(e){if(this.disposed)return Promise.resolve(!1);if(this.pageLoad)return this.pageLoad;if(!this.hasMore||!this.options.onLoadMore)return Promise.resolve(!1);this.loadingMore=!0,e&&(this.status=void 0),this.requestRender();let t=this.options.onLoadMore().then(i=>{if(this.disposed)return!1;let s=this.sessions.length,r=this.scopedSessions().length;this.sessions=KF(this.sessions,i.sessions),this.hasMore=i.hasMore;let o=this.sessions.length-s,a=this.scopedSessions().length-r;return e&&(this.status={tone:"info",text:this.scope==="workspace"&&a===0?i.hasMore?`${o} session${o===1?"":"s"} loaded \xB7 none in this workspace \xB7 Ctrl+A show all.`:"All sessions loaded \xB7 none new in this workspace.":i.hasMore?`${a} more session${a===1?"":"s"}${this.scope==="workspace"?" in this workspace":""} loaded.`:"All matching sessions loaded."}),this.clampSelection(),!0}).catch(i=>(this.disposed||(this.status={tone:"error",text:L(i,{summary:"Couldn't load more sessions.",nextStep:"Retry."})}),!1)).finally(()=>{this.pageLoad===t&&(this.pageLoad=void 0),this.disposed||(this.loadingMore=!1,this.requestRender())});return this.pageLoad=t,t}resetSelection(){this.selectedIndex=0,this.selectedSessionId=this.visibleSessions()[0]?.sessionId,this.status=void 0,this.requestRender()}clampSelection(e=this.visibleSessions()){if(e.length===0){this.selectedIndex=0,this.selectedSessionId=void 0;return}let t=this.selectedSessionId?e.findIndex(i=>i.sessionId===this.selectedSessionId):-1;this.selectedIndex=t>=0?t:Math.max(0,Math.min(this.selectedIndex,e.length-1)),this.selectedSessionId=e[this.selectedIndex]?.sessionId}selectedSession(e=this.visibleSessions()){if(this.selectedSessionId){let t=e.find(i=>i.sessionId===this.selectedSessionId);if(t)return t}return e[this.selectedIndex]}openSelected(){let e=this.selectedSession();e&&this.runAction(async()=>{await this.options.onSelect(e.sessionId,!!e.archived)})}enterTextMode(e){let t=this.selectedSession();t&&(this.mode=e,this.actionTargetId=t.sessionId,this.actionInput.setValue(t.title?.trim()??""),this.actionInput.moveCursorToEnd(),this.status=void 0,this.syncInputFocus(),this.requestRender())}submitActionInput(e){let t=this.findActionTarget();if(!t){this.exitActionMode();return}if(this.mode==="rename"){let i=e.trim();if(!i){this.setStatus("Session title cannot be empty.","error");return}if(i===(t.title?.trim()??"")){this.exitActionMode(!1),this.setStatus("Session title unchanged.","info");return}this.runAction(async()=>{let s=await this.options.onRename(t.sessionId,i);this.disposed||(this.replaceSession(s),this.exitActionMode(!1),this.setStatus(`Renamed to ${x(s.title??i)}.`,"info"))})}}toggleSelectedArchived(){let e=this.selectedSession();if(e){if(!e.archived){this.mode="confirm-archive",this.actionTargetId=e.sessionId,this.status=void 0,this.syncInputFocus(),this.requestRender();return}this.runAction(async()=>{await this.options.onSetArchived(e.sessionId,!1),!this.disposed&&(this.replaceSession({...e,archived:!1}),this.clampSelection(),this.setStatus("Session restored.","info"))})}}confirmArchive(){let e=this.findActionTarget();if(!e){this.exitActionMode();return}this.runAction(async()=>{await this.options.onSetArchived(e.sessionId,!0),!this.disposed&&(this.replaceSession({...e,archived:!0}),this.activeSessionId===e.sessionId&&(this.activeSessionId=void 0),this.exitActionMode(!1),this.clampSelection(),this.setStatus("Session archived.","info"))})}async runAction(e){this.busy=!0,this.status={tone:"info",text:"Working\u2026"},this.requestRender();try{await e()}catch(t){if(this.disposed)return;this.status={tone:"error",text:L(t,{summary:"Session changes were not saved.",nextStep:"Retry.",preservation:"The existing session is unchanged."})}}finally{this.disposed||(this.busy=!1,this.requestRender())}}exitActionMode(e=!0){this.mode="list",this.actionTargetId=void 0,this.actionInput.setValue(""),this.syncInputFocus(),e&&this.requestRender()}findActionTarget(){return this.sessions.find(e=>e.sessionId===this.actionTargetId)}replaceSession(e){this.sessions=Ba([e,...this.sessions.filter(t=>t.sessionId!==e.sessionId)])}setStatus(e,t){this.disposed||(this.status={text:e,tone:t},this.requestRender())}syncInputFocus(){this.searchInput.focused=this._focused&&this.mode==="list",this.actionInput.focused=this._focused&&this.mode==="rename"}fitLines(e,t){return e.map(i=>E(i,t,h.hex(d.dim)("\u2026")))}fitToRows(e,t){if(t===void 0||e.length<=t)return e;if(t<=3)return e.slice(-t);let i=e.slice(-3);return[...e.slice(0,t-i.length),...i]}currentMaxRows(){let e=typeof this.options.maxRows=="function"?this.options.maxRows():this.options.maxRows;return e===void 0?void 0:Math.max(1,Math.floor(e))}requestRender(){this.disposed||this.options.requestRender()}};function Ba(n){let e=[...n].sort((o,a)=>sh(a.updatedAt)-sh(o.updatedAt)),t=new Map;for(let o of e){if(!o.parentSessionId)continue;let a=t.get(o.parentSessionId)??[];a.push(o),t.set(o.parentSessionId,a)}let i=[],s=new Set,r=o=>{if(!s.has(o.sessionId)){s.add(o.sessionId),i.push(o);for(let a of t.get(o.sessionId)??[])r(a)}};for(let o of e)o.parentSessionId||r(o);for(let o of e)r(o);return i}function KF(n,e){let t=new Map(n.map(i=>[i.sessionId,i]));for(let i of e)t.set(i.sessionId,i);return Ba([...t.values()])}function sh(n){if(typeof n=="number"&&Number.isFinite(n))return n;if(typeof n=="string"){let e=Number(n);if(Number.isFinite(e))return e;let t=Date.parse(n);if(Number.isFinite(t))return t}return 0}function Y1(n,e){let t=sh(n);if(!(t<=0))return ac(t,{preset:"social-compact",nowMs:e,locale:"en"})||void 0}function WF(n,e){if(n<=0||!Number.isFinite(n)||!Number.isFinite(e))return"older";let t=new Date(n),i=new Date(e),s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()),r=Date.UTC(i.getFullYear(),i.getMonth(),i.getDate()),o=Math.round((r-s)/864e5);return o<=0?"today":o===1?"yesterday":o<7?"previous-7-days":"older"}function jF(n){return n==="today"?"Today":n==="yesterday"?"Yesterday":n==="previous-7-days"?"Previous 7 days":"Older"}function VF(n){if(n.sessionType==="branch")return"Branch";if(n.sessionType==="root")return"Root"}function qM(n){let e=[n.model?.providerId,n.model?.modelId].filter(Boolean).join("/"),t=n.model?.thinking?.effort?.trim();return[e||void 0,t].filter(Boolean).join(" \xB7 ")||void 0}function GF(n){let e=qM(n)?.toLocaleLowerCase()??"",t=n.sessionType??(n.parentSessionId?"branch":"");return{all:[n.title,n.sessionId,n.workspaceDir,n.parentSessionId,n.agentName,n.purpose,t,n.status,e,n.interactionMode].filter(s=>!!s).join(" ").toLocaleLowerCase(),id:n.sessionId.toLocaleLowerCase(),path:(n.workspaceDir??"").toLocaleLowerCase(),type:t.toLocaleLowerCase(),status:(n.status??"").toLocaleLowerCase(),model:e}}function zF(n,e){let t=e.indexOf(":");if(t<=0)return n.all.includes(e);let i=e.slice(0,t),s=e.slice(t+1);return s?i==="id"?n.id.includes(s):i==="path"?n.path.includes(s):i==="type"?n.type.includes(s):i==="status"?n.status.includes(s):i==="model"?n.model.includes(s):n.all.includes(e):n.all.includes(e)}function QF(n){if(n){if(n==="started"||n==="running")return"running";if(n==="error"||n==="failed")return"error"}}function rh(n){let e=(n??"").replaceAll("\\","/").replace(/\/+$/u,"");return/^[A-Za-z]:\//u.test(e)?e.toLocaleLowerCase():e}function YF(n){let e=process.env.HOME??process.env.USERPROFILE;if(!e)return n;let t=rh(e),i=rh(n);return i===t||i.startsWith(`${t}/`)?`~${i.slice(t.length)}`:n}function XF(n,e){if(C(n)<=e)return n;let t=[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(n)].map(({segment:s})=>s),i="";for(let s=t.length-1;s>=0;s-=1){let r=`${t[s]}${i}`;if(C(r)>Math.max(1,e-1))break;i=r}return`\u2026${i}`}function BM(n,e,t){let i=t-C(n)-C(e);return i>=2?`${n}${" ".repeat(i)}${e}`:E(n,t,"\u2026")}var oh=class{constructor(e){this.options=e;this.markdown=new ft(e.markdown,0,0,Tt)}fullscreenViewport=!0;handlesViewportKeys=!0;markdown;viewportOffset=0;viewportRows=0;viewportLineCount=0;handleInput(e){ie().matches(e,"tui.select.cancel")?this.options.onClose():v(e,j.pageUp)?this.scrollByPage(-1):v(e,j.pageDown)?this.scrollByPage(1):v(e,j.up)?this.scrollByRows(-1):v(e,j.down)&&this.scrollByRows(1)}invalidate(){this.markdown.invalidate()}render(e){let t=Math.max(0,Math.floor(e));return t===0?[]:this.renderFrame(t,this.renderMarkdown(t))}renderViewport(e,t){let i=Math.max(0,Math.floor(e)),s=Math.max(1,Math.floor(t));if(i===0)return[];let r=this.renderMarkdown(i),o=oe(i,s,"Esc close");if(r.length<=o.bodyHeight)return this.viewportOffset=0,this.viewportRows=r.length,this.viewportLineCount=r.length,this.renderFrame(i,r,"Esc close",s);let a=r.length,u=oe(i,s,`Lines ${a}-${a} of ${a} \xB7 PgUp/PgDn scroll \xB7 Esc close`);this.viewportRows=u.bodyHeight,this.viewportLineCount=a,this.viewportOffset=HM(this.viewportOffset,0,Math.max(0,a-this.viewportRows));let l=Math.min(a,this.viewportOffset+this.viewportRows);return this.renderFrame(i,r.slice(this.viewportOffset,l),`Lines ${this.viewportOffset+1}-${l} of ${a} \xB7 PgUp/PgDn scroll \xB7 Esc close`,s)}scrollByRows(e){if(this.viewportRows===0)return 0;let t=Math.max(0,this.viewportLineCount-this.viewportRows),i=HM(this.viewportOffset+Math.trunc(e),0,t),s=i-this.viewportOffset;return s!==0&&(this.viewportOffset=i,this.options.requestRender()),s}scrollByPage(e){return this.scrollByRows(e*Math.max(1,this.viewportRows-1))}renderMarkdown(e){let t=st(e);return this.markdown.render(t).map(i=>E(i,t))}renderFrame(e,t,i="Esc close",s){return Ln({title:"What's New",meta:`MCode ${this.options.version}`,body:t,footer:i},e,s)}};function HM(n,e,t){return Math.max(e,Math.min(t,n))}import{basename as s$,extname as r$}from"node:path";import{pathToFileURL as o$}from"node:url";var ah=class{constructor(e){this.options=e}selectedValue;selectedEffortValue;generation=0;hydrationSequence=0;mutationSequence=0;pendingSelections=0;selectionTail=Promise.resolve();stopped=!1;selected(){return this.selectedValue}selectedEffort(){return this.selectedEffortValue}reset(){this.generation+=1,this.hydrationSequence+=1,this.mutationSequence+=1,this.selectedValue=void 0,this.selectedEffortValue=void 0}stop(){this.stopped=!0,this.reset()}async refresh(e=this.options.currentSessionId()){if(this.isStopped())return this.selectedValue;let t=this.generation,i=++this.hydrationSequence,s=this.mutationSequence,r,o;try{r=await this.options.runtime.listModels(e),o=await this.readSessionEffort(e,r.find(a=>a.selected))}catch{return this.selectedValue}return!this.isCurrent(e,t)||i!==this.hydrationSequence||s!==this.mutationSequence||this.pendingSelections>0?this.selectedValue:(this.selectedValue=r.find(a=>a.selected),this.selectedEffortValue=this.selectedValue?o:void 0,this.options.onChanged(),this.selectedValue)}async select(e,t=this.options.currentSessionId()){if(!this.isCurrent(t,this.generation))return{status:"stale"};let i=this.generation,s=++this.mutationSequence;this.hydrationSequence+=1,this.pendingSelections+=1;let r=this.selectionTail.then(()=>this.applySelection(e,t,i,s));this.selectionTail=r.then(()=>{},()=>{});try{return await r}finally{this.pendingSelections=Math.max(0,this.pendingSelections-1)}}async applySelection(e,t,i,s){if(!this.isCurrent(t,i))return{status:"stale"};let r;try{r=await this.options.runtime.selectModel(e,t)}catch(u){if(!this.isCurrent(t,i))return{status:"stale"};if(s!==this.mutationSequence)return{status:"superseded"};throw this.mutationSequence+=1,this.hydrationSequence+=1,u}if(!this.isCurrent(t,i))return{status:"stale"};if(s!==this.mutationSequence)return{status:"superseded"};if(this.mutationSequence+=1,this.hydrationSequence+=1,!r)return{status:"rejected"};let{thinking:o,...a}=e;return this.selectedValue={...a,selected:!0},this.selectedEffortValue=o?.effort?.trim()||void 0,this.options.onChanged(),{status:"selected",model:this.selectedValue}}async readSessionEffort(e,t){let i=this.options.runtime.getSession;if(!(!e||!i))try{let s=await i.call(this.options.runtime,e);return t&&s.model?.providerId&&s.model.modelId&&(s.model.providerId!==t.providerId||s.model.modelId!==t.modelId)?void 0:s.model?.thinking?.effort?.trim()||void 0}catch{return this.selectedEffortValue}}isCurrent(e,t){return!this.isStopped()&&t===this.generation&&this.options.currentSessionId()===e}isStopped(){return this.stopped||!!this.options.isStopped?.()}};import{randomUUID as JF}from"node:crypto";var ZF=100,e$=100,uh=class{constructor(e){this.options=e}forking=!1;async forkFromUserMessage(e){if(this.forking)throw new Error("A Session fork is already in progress.");let t=this.options.currentSession();if(!t)throw new Error("Start or resume a Session before forking.");if(!this.options.isSessionIdle())throw new Error("Wait for the active turn to finish before forking.");let i=this.options.runtime.getSessionForkOptions,s=this.options.runtime.forkSession;if(!i||!s)throw new Error("Session fork is unavailable in this Runtime.");this.forking=!0;try{let r=await this.findForkBoundary(t.sessionId,e),o=await i.call(this.options.runtime,t.sessionId,r);if(this.requireCurrentSource(t.sessionId),!o.canFork)throw new Error(`This prompt cannot be forked${o.unavailableReason?`: ${o.unavailableReason}`:"."}`);let a=await s.call(this.options.runtime,{sessionId:t.sessionId,assistantMessageId:r,clientRequestId:(this.options.createRequestId??JF)(),useSuggestedTitle:!0,createIsolatedWorktree:!1});this.requireCurrentSource(t.sessionId),await this.options.onOpenSession(a.session.sessionId)}finally{this.forking=!1}}async findForkBoundary(e,t){let i=[],s,r=new Set;for(let o=0;o<e$;o+=1){let a=await this.options.runtime.listMessagePage(e,{limit:ZF,...s?{before:s}:{}});i=t$(a.messages,i);let u=n$(i,t);if(u)return u;if(!a.hasMore||!a.nextCursor||r.has(a.nextCursor))break;r.add(a.nextCursor),s=a.nextCursor}throw i.some(o=>o.id===t)?new Error("The selected prompt has no completed Assistant boundary to fork from."):new Error("The selected prompt is no longer present in Runtime history.")}requireCurrentSource(e){if(this.options.isStopped?.())throw new Error("The TUI closed before the fork completed.");if(this.options.currentSession()?.sessionId!==e)throw new Error("The active Session changed before the fork completed.")}};function t$(n,e){let t=new Set;return[...n,...e].filter(i=>!i.id||!t.has(i.id)?(i.id&&t.add(i.id),!0):!1)}function n$(n,e){let t=n.findIndex(i=>i.id===e&&i.role==="user");if(!(t<0))for(let i=t+1;i<n.length;i+=1){let s=n[i];if(s){if(s.role==="user")return;if(s.role==="assistant"&&s.id&&s.actions?.fork===!0)return s.id}}}function UM(n){let e=i$(n.panel);return n.status==="claimed"?`Checked in: Cycle day ${n.dayNo}, +${n.points} Credits
|
|
239
239
|
${e}`:n.status==="already-claimed"?`Already checked in today.
|
|
240
240
|
${e}`:`Daily check-in is unavailable right now.
|
|
241
241
|
${e}`}function i$(n){let e=Yg(n.days),t=[...n.days].sort((i,s)=>i.day_no-s.day_no).map(i=>i.status===Qg.Claimed?"\u2713":"\xB7").join(" ");return[e>0?`${e}-day streak this cycle`:void 0,`This cycle: ${t}`].filter(i=>!!i).join(`
|
|
@@ -257,7 +257,7 @@ ${e}`),this.options.onChanged();try{await this.openExternalTarget(e)}catch{this.
|
|
|
257
257
|
/goal resume: resume a paused or blocked goal.`,SE="[\\s\\u2026\\u3000-\\u30FF\\u4E00-\\u9FFF\\uFF00-\\uFFEF]",bE=new RegExp(`^budget=([A-Za-z0-9.]+)(?=$|${SE})`,"iu"),oB=new RegExp(`(^|${SE})budget=([A-Za-z0-9.]+)$`,"iu"),aB=/[\s…、。!,:;?]+$/u,uB=/^[\s…、。!,:;?]+/u;function lB(n){let e=n.trimEnd(),t=e.search(/\s\S*$/),i=t===-1?e:e.slice(t+1);if(!/^budget=[A-Za-z0-9.]*$/i.test(i))return null;let s=i.slice(7),r=t===-1?"":e.slice(0,t).trimEnd();return{value:Ua(s),head:r}}function cB(n){let e=n.trim(),t=lB(e);if(t?.value==="invalid")return{kind:"invalid"};let i,s;if(t)i=t.value,s=t.head;else{let o=oB.exec(e);if(o){let a=Ua(o[2]??"");a!=="invalid"&&(i=a,s=e.slice(0,o.index+(o[1]??"").length))}}if(s!==void 0&&i!==void 0){let o=s.replace(aB,"").trim(),a=bE.exec(o);return a&&Ua(a[1]??"")!=="invalid"?{kind:"double"}:{kind:"value",value:i,objective:o}}let r=bE.exec(e);if(r){let o=Ua(r[1]??"");if(o!=="invalid"){let a=e.slice(r[0].length).replace(uB,"").trim();return{kind:"value",value:o,objective:a}}}return{kind:"none"}}function Ua(n){let e=n.trim();if(!e)return"invalid";let t=e.toLowerCase();if(t==="clear"||t==="null"||t==="none"||t==="off"||e==="0")return null;let i=t.match(/^([0-9]+(?:\.[0-9]+)?)([km])?$/);if(!i)return"invalid";let[,s,r]=i,o=Number(s);if(!Number.isFinite(o)||o<=0)return"invalid";let u=Math.round(o*(r==="k"?1e3:r==="m"?1e6:1));return u>0?u:"invalid"}function CE(n){let e=n.trim();if(!e)return{kind:"view"};let t=e.search(/\s/),i=t===-1?e:e.slice(0,t),s=i.toLowerCase();if(s==="budget")return{kind:"error",message:"/goal budget needs a value: `/goal budget=50K` or `/goal budget=clear`."};if(/^budget=[A-Za-z0-9.]*$/i.test(i)&&e.length===i.length){let r=i.slice(7),o=Ua(r);return o==="invalid"?{kind:"error",message:`Bad budget value: use a positive integer, K/M suffix, or 'clear' (got "${r}").`}:{kind:"budget",tokenBudget:o}}switch(s){case"clear":case"cancel":case"delete":return e.length>i.length?{kind:"error",message:"/goal clear takes no arguments."}:{kind:"clear"};case"edit":return e.length>i.length?{kind:"error",message:"/goal edit takes no arguments."}:{kind:"edit"};case"pause":return e.length>i.length?{kind:"error",message:"/goal pause takes no arguments."}:{kind:"pause"};case"resume":return e.length>i.length?{kind:"error",message:"/goal resume takes no arguments."}:{kind:"resume"};case"help":return{kind:"help"};default:{let r=cB(e);return r.kind==="invalid"?{kind:"error",message:"Bad budget value: use a positive integer, K/M suffix, or `clear`/`null` to remove the cap."}:r.kind==="double"?{kind:"error",message:"budget= is specified more than once: keep a single budget=<value>."}:r.kind==="value"?r.objective?{kind:"create",objective:r.objective,tokenBudget:r.value}:{kind:"budget",tokenBudget:r.value}:{kind:"create",objective:e}}}}var Rh=class{constructor(e){this.options=e}refreshSequence=0;announcedCompletedGoalIds=new Set;async execute(e){let t=CE(e);if(t.kind==="help")return this.options.append(vE),"consumed";if(t.kind==="error")return this.options.append(t.message,"warning"),"retained";let i=this.options.composerDraft.capture();try{let s=this.options.currentSessionId();if(!s&&t.kind==="create"&&(s=await this.options.ensureSessionId?.()),!s)return this.options.append(t.kind==="create"?"Couldn't create a Session for this Goal. Retry after the Runtime recovers.":"Start or resume a Session before managing its Goal.","warning"),"retained";let r=++this.refreshSequence;if(!this.options.runtime.isGoalEnabled())return this.options.append("Thread Goal is disabled in the current Runtime.","warning"),"retained";let o=await this.options.runtime.getGoal(s);if(!this.canProjectOperation(s,r))return"consumed";if(t.kind==="create")return await this.setObjective(s,t.objective,t.tokenBudget,o,r,i);if(!o)return this.options.append("No Goal exists for the active Session.","warning"),"consumed";if(t.kind==="view")return this.options.append(Fw(o)),"consumed";if(t.kind==="budget"){let l=await this.options.runtime.patchGoal(s,{tokenBudget:t.tokenBudget});return this.canProjectOperation(s,r)&&(this.options.banner.setGoal(l),this.options.setHint(t.tokenBudget===null?"Goal budget cleared.":"Goal budget updated."),this.options.onChanged()),"consumed"}if(t.kind==="edit")return this.options.editor.setText(`/goal ${o.objective}`),this.options.surfaceHost.setChatFocus(this.options.editor),this.options.setHint("Edit the Goal objective, then press Enter."),this.options.onChanged(),"consumed";if(t.kind==="clear")return await this.options.runtime.clearGoal(s),this.canProjectOperation(s,r)&&(this.options.banner.setGoal(void 0),this.options.setHint("Goal cleared."),this.options.onChanged()),"consumed";if(t.kind==="resume"&&o.status==="budget_limited")return this.options.append("This Goal exhausted its execution budget. Clear it, then start a new Goal.","warning"),"consumed";let a=t.kind==="pause"?"paused":"active",u=await this.options.runtime.patchGoal(s,{status:a});return this.canProjectOperation(s,r)&&(this.options.banner.setGoal(u),this.options.setHint(a==="paused"?"Goal paused.":"Goal resumed."),this.options.onChanged()),"consumed"}catch(s){return this.appendFailure(s),"retained"}}async resumeBlocked(){let e=this.options.banner.getGoal(),t=this.options.currentSessionId();if(!e||e.status!=="blocked"||!t||e.sessionId!==t)return"not-blocked";try{let i=await this.options.runtime.patchGoal(t,{status:"active"});return this.options.currentSessionId()===t&&(this.options.banner.setGoal(i),this.options.setHint("Goal resumed."),this.options.onChanged()),"resumed"}catch(i){return this.appendFailure(i),"failed"}}async refresh(e=this.options.currentSessionId()){let t=++this.refreshSequence;if(!e){this.options.banner.setGoal(void 0);return}try{if(!this.options.runtime.isGoalEnabled()){t===this.refreshSequence&&this.options.banner.setGoal(void 0);return}let i=await this.options.runtime.getGoal(e);t===this.refreshSequence&&this.options.currentSessionId()===e&&(this.options.banner.setGoal(i?.status==="complete"?void 0:i),this.options.onChanged())}catch{t===this.refreshSequence&&this.options.currentSessionId()===e&&this.options.banner.setGoal(void 0)}}reset(){this.refreshSequence+=1,this.options.banner.setGoal(void 0)}project(e){e.sessionId===this.options.currentSessionId()&&(this.refreshSequence+=1,e.type==="thread_goal.updated"?e.goal.status==="complete"?(this.options.banner.setGoal(void 0),this.announcedCompletedGoalIds.has(e.goal.goalId)||(this.announcedCompletedGoalIds.add(e.goal.goalId),this.options.append(Dw(e.goal)))):this.options.banner.setGoal(e.goal):(!this.options.banner.getGoal()||this.options.banner.getGoal()?.goalId===e.goalId)&&this.options.banner.setGoal(void 0),this.options.onChanged())}async setObjective(e,t,i,s,r,o){if(s&&s.status!=="complete"){if(o.attachments.length>0)return this.options.append("Goal kickoff attachments are immutable. Remove the attachments to edit this Goal, or clear it and start a new Goal.","warning"),"retained";let u=await this.options.runtime.patchGoal(e,{objective:t,...i!==void 0?{tokenBudget:i}:{}});return this.canProjectOperation(e,r)&&(this.options.banner.setGoal(u),this.options.setHint("Goal objective updated."),this.options.onChanged()),"consumed"}let a;try{a=o,this.options.composerDraft.reserveSubmission(o);let u=await this.options.runtime.createGoal({sessionId:e,objective:t,...i!==void 0?{tokenBudget:i}:{},...o.attachments.length>0?{attachments:o.attachments}:{}});return this.canProjectOperation(e,r)&&(this.options.banner.setGoal(u),this.options.setHint("Goal started."),this.options.onChanged()),await this.options.composerDraft.completeSubmission(a).catch(l=>{this.options.append(L(l,{summary:"Couldn't clean up the submitted Goal attachments.",nextStep:"The Goal was still created."}),"warning")}),"consumed"}catch(u){throw a&&this.options.composerDraft.restoreSubmission(a),u}}canProjectOperation(e,t){return t===this.refreshSequence&&this.options.currentSessionId()===e}appendFailure(e){this.options.append(L(e,{summary:"Couldn't update the Goal.",nextStep:"Retry /goal after the Runtime recovers.",preservation:"Your draft is preserved."}),"error")}};import{tmpdir as dB}from"node:os";import{isAbsolute as xE,relative as wE,resolve as kh}from"node:path";var Ph=class{constructor(e,t,i,s){this.readClipboardImage=e;this.readClipboardText=t;this.prepareQueueLease=i;this.draftRecoveryDataDir=s}pendingDisposals=new Map;queuedDisposals=new Map;activeRead;async paste(e){if(!this.readClipboardImage&&!this.readClipboardText){e.onWarning("Clipboard paste is unavailable in this host. Save media and reference it in the prompt with @.");return}if(this.activeRead)return;let t=new AbortController;this.activeRead=t,e.onHint("Reading clipboard\u2026");try{let i;if(this.readClipboardImage)try{let r=await this.readClipboardImage(t.signal);if(e.isStopped()||t.signal.aborted){await r.dispose().catch(()=>{});return}e.onPasted(r.attachment)?this.pendingDisposals.set(r.attachment.filePath,r.dispose):await r.dispose().catch(()=>{});return}catch(r){i=r}let s=await this.readClipboardText?.().catch(()=>null);if(e.isStopped()||t.signal.aborted)return;if(s){e.onTextPasted(s);return}i&&hB(i)&&e.onWarning(L(i,{summary:"Couldn't paste media from the clipboard.",nextStep:"Copy the image or video file again, or attach the saved file with @."}))}finally{this.activeRead===t&&(this.activeRead=void 0),e.onHint(void 0),e.onRender()}}abortRead(){return this.activeRead?(this.activeRead.abort(),!0):!1}transferToQueue(e,t){let i=this.take(t);i.length>0&&this.append(this.queuedDisposals,e,i)}async prepareAttachmentsForQueue(e){let t=this.prepareQueueLease??(this.draftRecoveryDataDir?pB(this.draftRecoveryDataDir):void 0);if(!t)return e.map(r=>({...r}));let i=[],s=[];try{for(let r of e){if(this.pendingDisposals.has(r.filePath)){i.push({...r});continue}let o=await t(r);if(!o){i.push({...r});continue}s.push(o),this.pendingDisposals.set(o.attachment.filePath,o.dispose),i.push({...o.attachment})}return i}catch(r){for(let o of s)this.pendingDisposals.delete(o.attachment.filePath);throw await ig(s.map(o=>o.dispose)),r}}async releasePreparedQueueAttachments(e,t){let i=new Set(e.map(s=>s.filePath));await this.releaseAttachments(t.filter(s=>!i.has(s.filePath)))}async releaseAttachments(e){await ig(this.take(e))}async releaseQueueItem(e){let t=this.queuedDisposals.get(e);t&&(this.queuedDisposals.delete(e),await ig(t))}restoreQueueItem(e,t){let i=this.queuedDisposals.get(e);if(i){this.queuedDisposals.delete(e);for(let[s,r]of t.entries()){let o=i[s];o&&this.pendingDisposals.set(r.filePath,o)}}}take(e){let t=[];for(let i of e){let s=this.pendingDisposals.get(i.filePath);s&&(this.pendingDisposals.delete(i.filePath),t.push(s))}return t}append(e,t,i){e.set(t,[...e.get(t)??[],...i])}};function hB(n){return!(n instanceof Jg&&n.code==="no-image")}function pB(n){return async e=>mB(n,e.filePath)||fB(e)?Zg(e):void 0}function mB(n,e){let t=kh(n,"v2","mcode","drafts"),i=wE(t,kh(e));return!i||i.startsWith("..")||xE(i)?!1:i.split(/[\\/]/u).some(s=>s.endsWith(".assets"))}function fB(n){let e=wE(kh(dB()),kh(n.filePath));return!e||e.startsWith("..")||xE(e)?!1:e.split(/[\\/]/u)[0]?.startsWith("minimax-code-clipboard-")===!0}async function ig(n){await Promise.allSettled(n.map(e=>e()))}var _h=class{constructor(e){this.options=e;this.clipboard=e.clipboard??new Ph(e.readClipboardImage,e.readClipboardText,e.prepareQueueAttachmentLease,e.draftRecoveryDataDir)}attachments=[];detachedAttachments=new Map;clearedDraft;clipboard;draftGeneration=0;snapshot(){return{attachments:[...this.attachments]}}capture(){return this.snapshot()}reserveSubmission(e=this.capture()){return this.releaseDetachedAttachments(),this.discardClearedDraft(),this.removeCaptured(e),this.notifyChanged(),e}restoreSubmission(e){let t=new Set(this.attachments.map(i=>i.filePath));this.attachments=[...e.attachments.filter(i=>!t.has(i.filePath)),...this.attachments],this.notifyChanged()}hasContent(){return this.attachments.length>0}restoreAttachments(e){let t=new Set(this.attachments.map(s=>s.filePath)),i=[];for(let s of e)if(!t.has(s.filePath)){if(!this.canAddAttachment(s,!1,[...this.attachments,...i]))break;t.add(s.filePath),i.push(s)}i.length>0&&(this.attachments=[...this.attachments,...i]),this.notifyChanged()}ensureAttachmentPlaceholders(){this.syncAttachmentPlaceholders()}async queueAttachment(e){if(!e.trim()){this.options.append("Cannot add an empty attachment path.","warning");return}let t=this.draftGeneration,i=await this.options.resolveAttachment(e,{workspaceDir:this.options.workspaceDir,...this.options.homeDir?{homeDir:this.options.homeDir}:{}});if(!(t!==this.draftGeneration||this.options.isStopped?.())){if(this.attachments.some(s=>s.filePath===i.filePath)){this.options.append(`Already attached for the next message: ${i.fileName}`,"warning");return}this.canAddAttachment(i)&&(this.attachments=[...this.attachments,i],this.notifyChanged())}}async pasteClipboard(){await this.clipboard.paste({isStopped:()=>this.options.isStopped?.()??!1,onHint:e=>this.options.onHint?.(e),onPasted:e=>this.canAddAttachment(e)?(this.attachments=[...this.attachments,e],this.notifyChanged(),!0):!1,onTextPasted:e=>{this.options.insertTextAtCursor?.(e),this.notifyChanged()},onWarning:e=>this.options.append(e,"warning"),onRender:()=>this.options.onRender?.()})}async removeLastAttachment(){return this.removeAttachmentAt(this.attachments.length-1)}async removeAttachmentById(e){let t=this.attachments.findIndex(s=>s.filePath===e),i=this.attachments[t];return i?(this.detachedAttachments.set(e,{attachment:i,index:t}),this.attachments=this.attachments.filter((s,r)=>r!==t),this.notifyChanged(),!0):!1}restoreAttachmentById(e){let t=this.detachedAttachments.get(e);if(!t||this.attachments.some(s=>s.filePath===e))return!1;this.detachedAttachments.delete(e);let i=Math.max(0,Math.min(t.index,this.attachments.length));return this.attachments=[...this.attachments.slice(0,i),t.attachment,...this.attachments.slice(i)],this.notifyChanged(),!0}stashForClear(){return this.clearedDraft||!this.hasContent()?!1:(this.releaseDetachedAttachments(),this.clearedDraft=this.capture(),this.attachments=[],this.notifyChanged(),!0)}restoreClearedDraft(){let e=this.clearedDraft;return e?(this.clearedDraft=void 0,this.restoreSubmission(e),!0):!1}async discardClearedDraft(){let e=this.clearedDraft;e&&(this.clearedDraft=void 0,await this.clipboard.releaseAttachments(e.attachments))}async completeSubmission(e){this.removeCaptured(e),this.notifyChanged(),await Promise.all([this.clipboard.releaseAttachments(e.attachments),this.releaseDetachedAttachments(),this.discardClearedDraft()])}async prepareQueueSubmission(e){return{attachments:this.clipboard.prepareAttachmentsForQueue?await this.clipboard.prepareAttachmentsForQueue(e.attachments):e.attachments.map(t=>({...t}))}}releasePreparedQueueSubmission(e,t){return this.clipboard.releasePreparedQueueAttachments?.(e.attachments,t.attachments)??Promise.resolve()}completeQueuedSubmission(e,t,i=e){this.removeCaptured(e),this.clipboard.transferToQueue(t,i.attachments),this.releaseDetachedAttachments(),this.discardClearedDraft(),this.notifyChanged()}restoreQueuedSubmission(e,t){this.clipboard.restoreQueueItem?.(e,t.attachments),this.restoreSubmission(t)}releaseQueueItem(e){return this.clipboard.releaseQueueItem(e)}abortClipboardRead(){return this.clipboard.abortRead()}async discard(){this.draftGeneration+=1;let e=[...this.attachments,...[...this.detachedAttachments.values()].map(({attachment:t})=>t),...this.clearedDraft?.attachments??[]];this.attachments=[],this.detachedAttachments.clear(),this.clearedDraft=void 0,this.notifyChanged(),await this.clipboard.releaseAttachments(e)}removeCaptured(e){let t=new Set(e.attachments.map(i=>i.filePath));this.attachments=this.attachments.filter(i=>!t.has(i.filePath))}async removeAttachmentAt(e){let t=this.attachments[e];return t?(this.attachments=this.attachments.filter((i,s)=>s!==e),this.notifyChanged(),await this.clipboard.releaseAttachments([t]),!0):!1}async releaseDetachedAttachments(){let e=[...this.detachedAttachments.values()].map(({attachment:t})=>t);e.length!==0&&(this.detachedAttachments.clear(),await this.clipboard.releaseAttachments(e))}notifyChanged(){this.syncAttachmentPlaceholders(),this.options.onChanged()}canAddAttachment(e,t=!0,i=this.attachments){return i.length>=10?(t&&this.options.append("You can attach up to 10 files. Remove one before adding another.","warning"),!1):i.reduce((r,o)=>r+o.sizeBytes,0)+e.sizeBytes>104857600?(t&&this.options.append("Attachments can total up to 100 MB. Remove an attachment or choose a smaller file.","warning"),!1):!0}syncAttachmentPlaceholders(){this.options.onAttachmentPlaceholdersChanged?.(this.attachments.map((e,t)=>({id:e.filePath,label:e.type==="image"?`[Image #${t+1}]`:e.mimeType.startsWith("video/")?`[Video #${t+1} ${yB(e.fileName)}]`:`[File #${t+1}]`})))}};function yB(n){return n.replaceAll(/[\u0000-\u001F\u007F[\]]/gu,"_").trim()||"video"}function IE(n){let e=n.app.resolveAttachment??fC,t=new _h({workspaceDir:n.app.workspaceDir,...n.app.homeDir?{homeDir:n.app.homeDir}:{},resolveAttachment:e,...n.app.readClipboardImage?{readClipboardImage:n.app.readClipboardImage}:{},readClipboardText:n.app.readClipboardText??Ku,insertTextAtCursor:s=>n.editor.insertTextAtCursor(s),...n.app.dataDir?{draftRecoveryDataDir:n.app.dataDir}:{},append:n.append,onAttachmentPlaceholdersChanged:s=>n.editor.syncAttachmentPlaceholders(s),onChanged:()=>{n.scheduleDraft(),n.updateChrome()},isStopped:n.isStopped,onHint:s=>{n.chrome()?.setHint(s),n.updateChrome()},onRender:()=>{n.isStopped()||n.requestRender()}});n.editor.onChange=()=>{n.onEditorChanged?.(),n.scheduleDraft(),n.updateChrome()};let i=new Rh({runtime:n.app.runtime,currentSessionId:()=>n.controller.snapshot().session?.sessionId,ensureSessionId:async()=>(await n.controller.ensureSession()).sessionId,banner:n.banner,composerDraft:t,editor:n.editor,surfaceHost:n.surfaceHost,append:n.append,setHint:s=>n.chrome()?.setHint(s),onChanged:()=>{n.updateChrome(),n.requestRender()}});return{composerDraft:t,goalFlow:i}}function ME(n){let e=!1;return{onSessionLifecycle(t){if(!t){e=!0;return}e&&(e=!1,eT(t,"clear"))},async preparePluginHookSessionSwitch(t,i){await nT(t,async s=>{await n.abortSession({id:s,reason:"user_stop"})}),await tT(t,i)},adoptForegroundRun(t,i,s){t&&i?.sessionId===t&&(i.state==="running"||i.state==="decision-blocked")&&i.turnId&&s.adoptRuntimeTurn(t,i.turnId,Date.now())}}}var bB={title:"Status Line",search:"Search",preview:"Preview",defaults:"Defaults",unavailable:"No current data; hidden until available.",empty:"Status line hidden",noMatches:"No matching items",saving:"Saving\u2026",failed:"Could not save. Check config.yaml syntax and permissions; previous settings kept.",locked:"build-mode is startup-only. Edit config.yaml and restart to change it.",help:"Space toggle \xB7 \u2190/\u2192 reorder \xB7 Enter save \xB7 Esc cancel",compactHelp:"Space \xB7 \u2190\u2192 \xB7 Enter \xB7 Esc",reset:"Ctrl+R restores defaults; type to search",filtered:"Clear search before reordering",custom:"Uses the saved command. Starts only after saving; preview never runs it.",close:"Enter / Esc close"},vB={title:"\u72B6\u6001\u680F",search:"\u641C\u7D22",preview:"\u9884\u89C8",defaults:"\u9ED8\u8BA4\u914D\u7F6E",unavailable:"\u5F53\u524D\u65E0\u6570\u636E\uFF0C\u6709\u6570\u636E\u65F6\u624D\u663E\u793A\u3002",empty:"\u72B6\u6001\u680F\u5DF2\u9690\u85CF",noMatches:"\u6CA1\u6709\u5339\u914D\u9879",saving:"\u6B63\u5728\u4FDD\u5B58\u2026",failed:"\u4FDD\u5B58\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5 config.yaml \u8BED\u6CD5\u548C\u6743\u9650\uFF1B\u539F\u8BBE\u7F6E\u5DF2\u4FDD\u7559\u3002",locked:"build-mode \u4EC5\u5728\u542F\u52A8\u65F6\u751F\u6548\uFF0C\u8BF7\u4FEE\u6539 config.yaml \u540E\u91CD\u542F\u3002",help:"Space \u52FE\u9009 \xB7 \u2190/\u2192 \u6392\u5E8F \xB7 Enter \u4FDD\u5B58 \xB7 Esc \u53D6\u6D88",compactHelp:"Space \xB7 \u2190\u2192 \xB7 Enter \xB7 Esc",reset:"Ctrl+R \u6062\u590D\u9ED8\u8BA4\uFF1B\u8F93\u5165\u6587\u5B57\u641C\u7D22",filtered:"\u6E05\u7A7A\u641C\u7D22\u540E\u624D\u80FD\u6392\u5E8F",custom:"\u4F7F\u7528\u5DF2\u914D\u7F6E\u7684\u547D\u4EE4\uFF0C\u4FDD\u5B58\u540E\u624D\u542F\u52A8\uFF1B\u9884\u89C8\u4E0D\u4F1A\u6267\u884C\u547D\u4EE4\u3002",close:"Enter / Esc \u5173\u95ED"},SB={"current-dir":["Current working directory","\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55"],"session-title":["Current session title","\u5F53\u524D\u4F1A\u8BDD\u6807\u9898"],"git-branch":["Current Git branch","\u5F53\u524D Git \u5206\u652F"],"review-link":["Current branch PR / MR link","\u5F53\u524D\u5206\u652F\u7684 PR / MR \u94FE\u63A5"],"plan-mode":["Plan mode","\u8BA1\u5212\u6A21\u5F0F"],"approval-mode":["Current permission mode","\u5F53\u524D\u6743\u9650\u6A21\u5F0F"],"model-with-reasoning":["Model and reasoning","\u6A21\u578B\u548C\u63A8\u7406\u914D\u7F6E"],model:["Model name","\u6A21\u578B\u540D\u79F0"],subagent:["Subagent identity","\u5B50 Agent \u8EAB\u4EFD"],"token-quota":["Account token quota","\u8D26\u6237\u989D\u5EA6"],"cache-read-ratio":["Session cache read ratio","\u4F1A\u8BDD\u7F13\u5B58\u8BFB\u53D6\u6BD4\u4F8B"],"context-remaining":["Remaining context window","\u5269\u4F59\u4E0A\u4E0B\u6587\u7A97\u53E3"],"custom-command":["Configured custom command output","\u5DF2\u914D\u7F6E\u7684\u81EA\u5B9A\u4E49\u547D\u4EE4\u8F93\u51FA"]};function EE(n){return bi(n??Intl.DateTimeFormat().resolvedOptions().locale)==="zh"}function AE(n,e){return EE(e)?vB[n]:bB[n]}function sg(n,e){return SB[n][EE(e)?1:0]}var Lh=class{constructor(e){this.options=e;this.locked=e.items?.includes("build-mode")??!1,this.useDefaults=e.items===void 0,this.resetItems(e.items??Ui)}fullscreenViewport=!0;handlesViewportKeys=!0;items=[];enabled=new Set;useDefaults;selected=0;searchInput=new ze;busy=!1;error=!1;disposed=!1;locked;get focused(){return this.searchInput.focused}set focused(e){this.searchInput.focused=e&&!this.locked}get query(){return this.searchInput.getValue()}handleInput(e){if(this.busy||this.disposed)return;let t=ie();if(t.matches(e,"tui.select.cancel")||v(e,"ctrl+c")){this.options.onClose();return}if(t.matches(e,"tui.select.confirm")){this.locked?this.options.onClose():this.save();return}if(this.locked)return;let i=this.visibleItems();if(t.matches(e,"tui.select.up"))this.selected=(this.selected-1+i.length)%Math.max(1,i.length);else if(t.matches(e,"tui.select.down"))this.selected=(this.selected+1)%Math.max(1,i.length);else if(v(e,"space")){let s=i[this.selected];s&&(this.enabled.has(s)?this.enabled.delete(s):this.enabled.add(s),this.useDefaults=!1)}else if(v(e,"left")||v(e,"right"))this.query?this.searchInput.handleInput(e):this.moveItem(v(e,"left")?-1:1);else if(v(e,"ctrl+r"))this.resetItems(Ui),this.useDefaults=!0,this.searchInput.setValue("");else{let s=this.query;this.searchInput.handleInput(e),this.query.length>100&&this.searchInput.setValue(this.query.slice(0,100)),this.query!==s&&(this.selected=0)}this.options.requestRender()}dispose(){this.disposed=!0}invalidate(){this.searchInput.invalidate()}render(e){return this.renderViewport(e,20)}renderViewport(e,t){let i=Math.max(0,Math.floor(t));if(e<=0||i===0)return[];let s=_=>AE(_,this.options.locale);if(this.locked)return Ln({title:s("title"),body:Y(s("locked"),Math.max(1,Ze(e))),footer:s("close")},e,i);let r=this.busy?s("saving"):s(e>=64?"help":"compactHelp"),o=oe(e,i,r),a=o.contentWidth,u=`${s("search")}: `,l=u+(this.searchInput.render(Math.max(1,a-C(u)))[0]??""),c=this.visibleItems(),p=c[this.selected],m=this.options.preview(this.selection(),a,3),g=m.lines.filter(_=>_.length>0).slice(0,i>=15?3:1);g.length===0&&g.push(s("empty"));let T=_=>(_===p?h.bold.hex(d.signal):h.hex(d.text))(`${_===p?"\u203A":" "} [${this.enabled.has(_)?"x":" "}] ${_}`);if(i<9)return o.render({title:s("title"),body:[...o.bodyHeight>=2?[l]:[],p?T(p):s("noMatches"),...this.error?[s("failed")]:g]});let y=p?`${sg(p,this.options.locale)}${m.unavailable.includes(p)?` \xB7 ${s("unavailable")}`:""}`:s("noMatches"),b=i>=15?[s(p==="custom-command"?"custom":this.query?"filtered":"reset")]:[],S=this.error?[h.hex(d.warning)(s("failed"))]:[],M=Math.max(1,Math.min(8,o.bodyHeight-3-g.length-b.length-S.length)),R=Math.max(0,Math.min(this.selected-M+1,c.length-M));return o.render({title:s("title"),meta:this.useDefaults?s("defaults"):`${this.enabled.size} / ${this.items.length}`,body:[l,...c.length?c.slice(R,R+M).map(T):[s("noMatches")],h.hex(d.muted)(y),...b.map(_=>h.hex(d.muted)(_)),h.bold.hex(d.text)(s("preview")),...g,...S]})}selection(){return this.useDefaults?void 0:this.items.filter(e=>this.enabled.has(e))}resetItems(e){this.items=[...new Set([...e,...Yf])].filter(t=>t!=="build-mode"),this.enabled=new Set(e.filter(t=>t!=="build-mode")),this.selected=0}visibleItems(){let e=this.query.toLocaleLowerCase();return this.items.filter(t=>`${t} ${sg(t,this.options.locale)}`.toLocaleLowerCase().includes(e))}moveItem(e){let t=this.selected+e,i=this.items[this.selected];!i||t<0||t>=this.items.length||(this.items.splice(this.selected,1),this.items.splice(t,0,i),this.selected=t,this.useDefaults=!1)}async save(){let e=this.selection();if(JSON.stringify(e)===JSON.stringify(this.options.items)){this.options.onClose();return}this.busy=!0,this.error=!1,this.options.requestRender();try{await this.options.save(e),this.disposed||this.options.onClose()}catch{this.error=!0}finally{this.busy=!1,this.disposed||this.options.requestRender()}}};function RE(n){let e=new Lh({items:n.statusLine.getConfiguredItems(),preview:(t,i,s)=>n.statusLine.preview(t,i,s),save:async t=>{if(!n.persist)throw new Error("Status line persistence is unavailable");await n.persist(t),n.statusLine.setConfiguredItems(t)},onClose:()=>{n.surface.close(e)},requestRender:()=>n.surface.request()});n.surface.show(e)}import{lstat as CB,open as xB,readdir as wB,realpath as Oh}from"node:fs/promises";import{createRequire as IB}from"node:module";import{homedir as MB}from"node:os";import Vi from"node:path";var EB=600*1e3,AB=256,kE=64*1024,RB=256*1024,kB=300*1e3,LE=async n=>{let e=n.nowMs??Date.now(),t=n.recentWindowMs??EB,i=e-t,s=Vi.resolve(n.codexHome??process.env.CODEX_HOME??Vi.join(n.homeDir??MB(),".codex")),r=Vi.join(s,"sessions"),o,a;try{[o,a]=await Promise.all([Oh(n.workspaceDir),Oh(r)])}catch{return}let u=await PB(a,i,e);if(u)for(let l of u){let c=await LB(l.filePath);if(!(!c||c.source!=="cli"&&c.source!=="vscode"||await NB(c.cwd)!==o))return{sessionId:c.sessionId,updatedAtMs:l.updatedAtMs,source:c.source}}};async function PB(n,e,t){let i=_B(e,t),s=[];for(let r of i){let o=Vi.join(n,...r),a;try{a=await wB(o,{withFileTypes:!0})}catch{continue}for(let u of a){if(!u.isFile()||!/^rollout-.+\.jsonl(?:\.zst)?$/u.test(u.name))continue;let l=Vi.join(o,u.name);try{let c=await CB(l);if(!c.isFile()||c.isSymbolicLink()||c.mtimeMs<e||c.mtimeMs>t+kB)continue;let p=await Oh(l);if(!DB(n,p))continue;if(s.push({filePath:p,updatedAtMs:Math.min(c.mtimeMs,t)}),s.length>AB)return}catch{continue}}}return s.sort((r,o)=>o.updatedAtMs-r.updatedAtMs||r.filePath.localeCompare(o.filePath))}function _B(n,e){let t=new Map;for(let i of[n,e]){let s=new Date(i),r=[[s.getFullYear(),s.getMonth()+1,s.getDate()],[s.getUTCFullYear(),s.getUTCMonth()+1,s.getUTCDate()]];for(let[o,a,u]of r){let l=[String(o),_E(a),_E(u)];t.set(l.join("/"),l)}}return[...t.values()]}async function LB(n){let e;try{e=await OB(n)}catch{return}for(let t of e.split(`
|
|
258
258
|
`).slice(0,20)){if(!t.trim())continue;let i;try{i=JSON.parse(t)}catch{continue}if(!PE(i)||i.type!=="session_meta"||!PE(i.payload))continue;let{id:s,cwd:r,source:o}=i.payload;return typeof s!="string"||!s.trim()||typeof r!="string"||typeof o!="string"||!Vi.basename(n).includes(s)?void 0:{sessionId:s,cwd:r,source:o}}}async function OB(n){let e=n.endsWith(".zst"),t=e?RB:kE,i=await xB(n,"r");try{let s=Buffer.alloc(t),{bytesRead:r}=await i.read(s,0,s.length,0),o=s.subarray(0,r);if(!e)return o.toString("utf8");let u=IB(__mavis_tuiPackageEntryUrl)("node:zlib");if(!u.zstdDecompressSync)throw new Error("Zstandard is unavailable.");return u.zstdDecompressSync(o,{maxOutputLength:kE}).toString("utf8")}finally{await i.close()}}async function NB(n){try{return await Oh(n)}catch{return}}function PE(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function DB(n,e){let t=Vi.relative(n,e);return t!==""&&!t.startsWith("..")&&!Vi.isAbsolute(t)}function _E(n){return String(n).padStart(2,"0")}var Nh=class{constructor(e){this.options=e}pristine=!0;recentSession;take(){if(!this.isEligible())return;let e=this.recentSession;if(e)return this.recentSession=void 0,this.pristine=!1,this.options.chrome()?.setWelcomeTip(void 0),e}restore(e){this.isEligible(!0)&&(this.recentSession=e,this.pristine=!0,this.showTip())}dismiss(){!this.pristine&&!this.recentSession||(this.pristine=!1,this.recentSession=void 0,this.options.chrome()?.setWelcomeTip(void 0))}async detect(){if(await this.options.skills.refreshSkillCommands(),!this.options.skills.skillCommands().some(t=>t.name==="resume-codex"))return;let e=await(this.options.app.findRecentCodexSession??LE)({workspaceDir:this.options.app.workspaceDir,...this.options.app.homeDir?{homeDir:this.options.app.homeDir}:{}});!e||!this.isEligible()||(this.recentSession=e,this.showTip())}isEligible(e=!1){return(e||this.pristine)&&!this.options.isStopped()&&!this.options.controller.snapshot().session&&!this.options.liveRunId()&&this.options.transcript.snapshot().length===0&&this.options.editor.getExpandedText().length===0&&!this.options.composerDraft.hasContent()}showTip(){let e=Te("welcome.resume-codex",this.options.app.keybindings);this.options.chrome()?.setWelcomeTip({id:"codex-handoff",command:"resume-codex",text:`Tip: ${e} resumes your recent Codex session`,shortText:`Tip: ${e} resumes Codex`}),this.options.onChanged()}};function OE(n){let e=ME(n.runtime),t=Hi(n.statusLineItems??[]).includes("build-mode"),{terminal:i,renderer:s,tui:r,terminalNotifications:o,themeController:a,openExternalTarget:u,writeClipboardText:l}=nI(n),c=new Pd(JI()),p=TE(n.productFeatures),m=n.exportTranscript??(n.dataDir?yE(n.dataDir):void 0),{defaultAgentName:g,workspaceRoots:T,...y}=tI(n),b=new Mr,S=new Nd(b),M=new yd(S,{displayModes:new zr,workspaceDir:n.workspaceDir}),R=iI(r,T,n.runtime),_,F,A,$=k=>A?.update(k),N,U,D,B,z,ae,xe=()=>{},ce=!1,Z=!1,bt=!1,ht=oI({app:n,tui:r,terminal:i,editor:R,requestRender:()=>ce&&!Z?r.requestRender():void 0}),{welcome:Gi,updateNotice:fi,status:Dn,activity:Ns,composer:$e,interaction:zi,followUp:no,goal:Ds,tasks:Fn}=ht,We=rM({transcript:b,isStopped:()=>Z,onChanged:()=>r.requestRender()}),$n=new Dd({transcript:b,onChanged:()=>{xe(),Z||($(te.snapshot()),r.requestRender())}}),te=new Md({runtime:n.runtime,transcript:b,workspaceDir:n.workspaceDir,version:n.version,defaultAgentName:g,...y,onAutomationResultPublished:k=>sn.handleAutomationResultPublished(k),onTodoChange:k=>Fn.setItems(k),onUserSubmissionProjected:()=>{B?.dismiss(),xe(),ce&&!Z&&r.requestImmediateRender()},onSessionLifecycle:k=>{k||$n.clearUnboundContext(),e.onSessionLifecycle(k)},onChange:k=>{if(Z)return;let se=k.session?.sessionId;se&&_?.adoptCreatedSession(se),c.snapshot().activeSessionId!==se&&(c.dispatch({type:"session/activate",sessionId:se}),Re?.reconcileSession(),ae?.refresh(se)),$(k),N?.schedule(k),ce&&r.requestRender()}}),Cn=()=>{$(te.snapshot()),ce&&!Z&&r.requestRender()},$t=new Rd,{latestRuntimeTurnId:Fs,liveRunId:X}=cI(te,$t),et=()=>!!(X()||te.hasInProcessRun()),tn=()=>ce&&!Z&&!bt,Va=()=>!1,{layout:gi,surfaceHost:nn,fullscreenLayout:og,themeRendering:Ga,interactionSurface:Oe}=uI({terminal:i,tui:r,editor:R,controller:te,transcript:b,transcriptView:M,widgets:ht,themeController:a,liveRunId:X,shouldResumeDraftAfterLogin:()=>Va(),isActive:tn,requestInteractionRender:Qa,mode:()=>s.mode,switchMode:k=>s.switchMode(k),chatMode:n.tuiMode??"regular"});xe=()=>gi.followBottom(),s.setFullscreenLayoutRoot(og);let xn,Bn=new Promise(k=>{xn=k}),ne,{sessionMutationFlow:Re,delegationFlow:sn}=dI({app:n,controller:te,transcript:b,surfaceHost:nn,editor:R,sessionFlow:()=>ne,setHint:k=>A?.setHint(k),append:We,setEditTranscriptBoundary:S.hideFromSourceMessage,onAgentTeamChanged:k=>Fn.setAgentTeam(k),onBackgroundTasksChanged:k=>Fn.setBackgroundTasks(k),onChanged:Cn,hasLiveRun:et}),za=IE({app:n,controller:te,banner:Ds,editor:R,surfaceHost:nn,append:We,scheduleDraft:()=>_?.schedule(),chrome:()=>A,isStopped:()=>Z,updateChrome:()=>$(te.snapshot()),onEditorChanged:()=>N?.onEditorChanged(),requestRender:()=>ce&&!Z?r.requestRender():void 0}),Bt=za.composerDraft;Va=()=>n.resumeDraftAfterLogin===!0&&(R.getExpandedText().length>0||Bt.snapshot().attachments.length>0),ae=za.goalFlow;let ag=new Fd({runtime:n.runtime,stateStore:c,defaultAgentName:g,resolveSessionAgentName:k=>{let se=te.snapshot();return se.session?.sessionId===k?se.session.agentName:se.sessions.find(rn=>rn.sessionId===k)?.agentName},permissionSessionScope:k=>sn.permissionSessionScope(k),queueEnabled:p.queue}),jE=new _d(k=>ag.reconcile(k),k=>c.dispatch(k)),Ti=new jd({runtime:n.runtime,controller:te,stateStore:c,transcript:b,surface:Oe,defaultAgentName:g,append:We,deliverPermissionFeedback:async k=>{if(await D.submit(k)==="retained")throw new Error("MCode kept the guidance in the composer instead of sending it.")},onChanged:()=>{$(te.snapshot()),ce&&!Z&&r.requestImmediateRender()},isStopped:()=>Z,notify:(k,se)=>{o.notifyOnce(k,se)},...sn.permissionResolvers(X),agentStatusLineItems:n.statusLineItems,stopTurn:()=>{z()}}),rt=new lh({runtime:n.runtime,version:n.version,planMode:()=>yi.snapshot(),controller:te,surface:Oe,surfaceHost:nn,editor:R,transcript:b,transcriptView:M,writeClipboardText:l,openExternalTarget:u,exportTranscript:m,workspaceDir:n.workspaceDir,defaultAgentName:g,terminalRows:()=>i.rows,append:We,setCompacting:k=>{A?.setCompacting(k),$(te.snapshot()),ce&&!Z&&r.requestRender()},setHint:k=>{A?.setHint(k)},onChanged:Cn,onNewSession:()=>ne.startNew(),onOpenSession:k=>ne.activateSessionById(k),onArchivedCurrentSession:k=>ne.archiveCurrentProjection(k),refreshAutocomplete:()=>N?.refreshAutocomplete(),onStartMiniMaxLogin:()=>D.startMiniMaxLogin(),isStopped:()=>Z,hasLiveRun:et}),io=lI({telemetry:n.businessTelemetry,workspaceDir:n.workspaceDir,controller:te,featureFlow:rt,stateStore:c,transcript:b});R.onAutocompleteView=k=>io?.trackAutocompleteView(k),R.onAutocompleteSelect=(k,se)=>io?.trackAutocompleteSelection(k,se);let ug=new Od(n.runtime,te,We,k=>Oe.show(k),k=>Oe.close(k),Qa,()=>I1(i.rows)),VE=gE({runtime:n.runtime,snapshot:()=>te.snapshot(),defaultAgentName:g,queueEnabled:p.queue}),lg=fE(n,We,Oe,Qa,()=>I1(i.rows),async()=>{n.requestRestart?.(),await Ya()},VE);N=new Dc({runtime:n.runtime,controller:te,editor:R,terminal:i,workspaceDir:n.workspaceDir,workspaceRoots:()=>T.list(),liveRunId:X,skillCommands:()=>[...rt.skillCommands()],requireSession:()=>rt.requireActiveSession(),append:We,stage:k=>rt.stageCommand(k),showInteraction:k=>Oe.show(k),closeInteraction:k=>Oe.close(k),onChanged:Cn,adoptRuntimeTurn:(k,se,rn)=>U.adoptRuntimeTurn(k,se,rn),queueEnabled:p.queue,keybindings:n.keybindings,isStopped:()=>Z}),z=pE({controller:te,runProjection:$t,stopDelegation:k=>n.runtime.stopDelegation(k),abortSession:k=>n.runtime.abortSession(k),getActiveRun:k=>n.runtime.getActiveRun(k),latestRuntimeTurnId:Fs,setTransientHint:k=>A?.setHint(k),updateChrome:()=>$(te.snapshot()),requestRender:()=>{Z||r.requestRender()},append:We});let yi=new Eh({currentSession:()=>te.snapshot().session,loadEntryEnabled:async()=>(await n.runtime.getPlanModeCapabilities()).entryEnabled,append:We,setHint:k=>A?.setHint(k),onChanged:Cn,isStopped:()=>Z}),qn=new ph({runtime:n.runtime,controller:te,composerDraft:Bt,runProjection:$t,transcript:b,followUp:no,surface:Oe,enabled:p.queue,setHint:k=>A?.setHint(k),onChanged:()=>$(te.snapshot()),requestRender:()=>r.requestRender(),selectedModel:()=>{let k=rt.selectedModel();if(!k)return;let se=rt.selectedEffort()?.trim();return{providerId:k.providerId,modelId:k.modelId,...k.variant!==void 0?{variant:k.variant}:{},...se?{thinking:{effort:se}}:{}}},adoptRuntimeTurn:(k,se,rn)=>U.adoptRuntimeTurn(k,se,rn),isStopped:()=>Z,onSubmissionQueued:(k,se,rn,JE)=>yi.acceptQueued(rn,se,k,JE),onSubmissionRestored:(k,se)=>yi.restoreQueued(se,k),restoreSubmission:k=>D.restoreSubmission(k)});_=sI({app:n,editor:R,composerDraft:Bt,setHint:k=>A?.setHint(k),updateChrome:()=>$(te.snapshot()),append:We,onRetryRestored:k=>D?.restoreRecoverableSubmission(k)}),ne=new mh({runtime:n.runtime,controller:te,stateStore:c,composerDraft:Bt,interactionFlow:Ti,featureFlow:rt,queueFlow:qn,delegationFlow:sn,activeRunFlow:{refresh:k=>N.refresh(k),currentSnapshot:()=>N.currentSnapshot()},goalFlow:ae,runProjection:$t,append:We,onChanged:()=>{$(te.snapshot()),r.requestRender()},followBottom:()=>gi.followBottom(),requestWelcomeRebuild:()=>r.requestImmediateRender(),switchComposerDraft:k=>_?.switchSession(k)??Promise.resolve(),detachForegroundObserver:()=>U?.detachForegroundObserver(),adoptForegroundRun:()=>e.adoptForegroundRun(te.snapshot().session?.sessionId,N.currentSnapshot(),U),preparePluginHookSessionSwitch:e.preparePluginHookSessionSwitch,hasLiveRun:()=>et()||$n.isRunning(),abortForegroundRun:()=>z(),abortSessionRun:k=>n.runtime.abortSession({id:k,reason:"user_stop"}),currentRunId:X,onSideSessionOpened:k=>io?.trackBtwSessionOpened(k),onSideSessionClosed:k=>io?.trackBtwSessionClosed(k),onSideConversationChanged:()=>{$(te.snapshot()),r.requestRender()}});let so=new wh({runtime:n.runtime,append:We,setHint:k=>A?.setHint(k),onChanged:()=>{$(te.snapshot()),r.requestRender()},isStopped:()=>Z});D=new bh({bashFlow:$n,workspaceDir:n.workspaceDir,...n.commandContributions?{contributions:n.commandContributions}:{},controller:te,activeRunFlow:N,featureFlow:rt,feedbackFlow:ug,sessionMutationFlow:Re,updateFlow:lg,goalFlow:ae,planModeFlow:yi,permissionModeFlow:so,...n.auth?{auth:n.auth}:{},openExternalTarget:n.openExternalTarget,interactionFlow:Ti,sessionFlow:ne,queueFlow:qn,composerDraft:Bt,workspaceRoots:T,runProjection:$t,editor:R,surface:Oe,surfaceHost:nn,showTasks:()=>sn.showTasks(),persistTuiMode:n.persistTuiMode,showStatusLine:()=>RE({statusLine:Dn,surface:Oe,persist:n.persistStatusLineItems}),keybindings:n.keybindings,getTuiKeybindingOverrides:n.getTuiKeybindingOverrides,saveTuiKeybindingOverrides:n.saveTuiKeybindingOverrides,reloadTui:n.reloadTui,queueEnabled:p.queue,liveRunId:X,runtimeStopping:()=>!!$t.snapshot().stoppingRuntimeTurnId,isLlmRetrying:()=>A?.isLlmRetrying()??!1,abortLiveTurn:z,leaveUi:Ya,requestRestart:n.requestRestart,notifyAuthContextChanged:n.notifyAuthContextChanged,whenControllerReady:()=>cg,whenReady:()=>Dh,whenStopping:()=>F??Promise.resolve(),isStopped:()=>Z,append:We,setHint:k=>A?.setHint(k),onChanged:()=>{$(te.snapshot()),r.requestRender()},userMessageCount:()=>b.snapshot().filter(k=>k.kind==="user").length,onMessageAdmitted:k=>io?.trackChatSend(k)}),N.setCommandCatalog(D.catalog),U=new ch({runtime:n.runtime,controller:te,stateStore:c,effectRunner:jE,stateCoordinator:ag,sessionFlow:ne,delegationFlow:sn,activeRunFlow:N,interactionFlow:Ti,runProjection:$t,releaseQueueItem:k=>qn.releaseQueuedSubmission(k),transcript:b,refreshQueue:k=>qn.refresh(k),projectQueueItem:k=>qn.project(k),restoreFailedQueueItem:k=>{let se=qn.takeOverFailedQueueItem(k);se&&D.restoreSubmission(se)},onLlmRetryChanged:k=>{A?.setLlmRetry(k),$(te.snapshot())},onRetryAvailabilityChanged:(k,se)=>D.setSessionRetryable(k,se),goalFlow:ae,updateFollowUpPanel:()=>qn.updatePanel(),onChanged:Cn,append:We,isStopped:()=>Z,queueEnabled:p.queue,observability:n.observability,incidentReporter:n.incidentReporter,notify:(k,se)=>{o.notifyOnce(k,se)}}),B=new Nh({app:n,skills:rt,controller:te,liveRunId:X,transcript:b,editor:R,composerDraft:Bt,isStopped:()=>Z,chrome:()=>A,onChanged:Cn});let GE=new xh({cancelBash:()=>$n.cancel(),tui:r,addInputListener:k=>s.addInputListener(k),renderLifecycle:{start:()=>s.start(),stop:()=>s.stop(),requestRender:k=>r.requestRender(k)},editor:R,workspaceDir:n.workspaceDir,externalEditorCommand:n.externalEditorCommand,editDraftInExternalEditor:n.editDraftInExternalEditor,interaction:zi,interactionSurface:Oe,interactionFlow:Ti,featureFlow:rt,commandFlow:D,permissionModeFlow:so,planModeFlow:yi,composerDraft:Bt,liveRunId:X,hasWaitingMessage:()=>$t.snapshot().queuedCount>0,restoreWaitingMessage:async()=>{let k=await qn.restoreLatest();return k?(R.restoreSubmittedDraft(k.editor),nn.setChatFocus(R),!0):!1},openQueueManager:()=>qn.openManager(),toggleTasks:()=>Fn.toggleExpanded(),isStopped:()=>Z,abortLiveTurn:z,cancelSessionEdit:()=>Re.cancelActiveEdit(),takeRecentCodexSession:()=>B?.take(),restoreRecentCodexSession:k=>B?.restore(k),dismissRecentCodexSession:()=>B?.dismiss(),leaveUi:Ya,isSideModeActive:()=>ne.isSideModeActive(),toggleSideConversation:()=>ne.toggleSideConversation(),closeSideConversation:k=>ne.closeSideConversation(k),requestProcessSuspend:n.requestProcessSuspend,keybindings:n.keybindings,append:We,setHint:(k,se)=>A?.setHint(k,se),onChanged:()=>{$(te.snapshot()),r.requestRender()},onSubmissionStarted:(k,se)=>_?.suspendForSubmission(k,se),onSubmissionPrepared:(k,se)=>_?.updatePendingSubmission(k,se),onSubmissionAdmitted:k=>_?.settleSubmission(k),onSubmissionSettled:k=>_?.settleSubmission(k),requestInteractionRender:Qa}).attach();A=new Ad({keybindings:n.keybindings,version:n.version,workspace:n.workspaceDir,...n.homeDir?{homeDir:n.homeDir}:{},queueEnabled:p.queue,isStarted:()=>ce,isStopped:()=>Z,setTerminalTitle:k=>i.setTitle(k),connection:()=>c.snapshot().connection,liveRunId:X,runProjection:()=>$t.snapshot(),transcript:b,shouldResumeDraftAfterLogin:()=>Va(),activePermission:()=>!!Ti.permission(),activeQuestionnaire:()=>!!Ti.questionnaire(),agentInteraction:()=>Ti.agentReadback(),...t?{agentCounts:()=>sn.agentCounts()}:{},attachmentCount:()=>Bt.snapshot().attachments.length,expandedDraft:()=>R.getExpandedText(),inputCommands:()=>[...D.catalog.inputCommands,...rt.skillCommands()],selectedModel:()=>rt.selectedModel(),selectedEffort:()=>rt.selectedEffort(),permissionMode:()=>so.snapshot(),planMode:()=>yi.snapshot(),sideConversation:()=>ne.sideConversationSnapshot(),sessionState:()=>c.snapshot(),welcome:Gi,status:Dn,activity:Ns,composer:$e});function Qa(){ce&&!Z&&r.requestImmediateRender()}let cg=te.initialize(),Dh=cg.then(async()=>{await rt.refreshSelectedModel(),await Promise.all([so.refresh().catch(()=>{}),yi.refreshCapabilities().catch(()=>{})]),await ae?.refresh()}),{openSession:zE,continueLatestSession:QE}=rI({ready:Dh,sessionFlow:ne,workspaceDir:n.workspaceDir,append:We});async function dg(k={}){if(Z)return Bn;c.dispatch({type:"lifecycle/leaveUi"}),Z=!0;let se=$n.stop();if(GE(),Bt.abortClipboardRead(),U.stop(),ne.stop(),Ti.deactivate(),rt.stop(),sn.stop(),N.stop(),so.stop(),yi.stop(),ug.stop(),lg.stop(),a.dispose(),Ns.dispose(),s.prepareTranscriptExit(),gt(nn,R,M,Dn,Ds),F??=_?.stop()??Promise.resolve(),k.abortActiveTurn!==!1){let rn=te.snapshot();rn.activeTurnId?te.abort().catch(()=>{}):Fs()&&rn.session?.sessionId&&n.runtime.abortSession({id:rn.session.sessionId,turnId:Fs(),reason:"user_stop"}).catch(()=>{})}return await i.drainInput(1e3).catch(()=>{}),s.dispose(),await F,await se,c.dispatch({type:"lifecycle/stopped"}),xn?.(),Bn}async function Ya(){return await z().catch(()=>!1),dg({abortActiveTurn:!1})}async function YE(){!ce||Z||bt||(bt=!0,s.stop(),await _?.suspend())}async function XE(){!ce||Z||!bt||(bt=!1,s.start(),U.restart(),r.requestRender(!0),_?.resume())}return{tui:r,surfaceHost:nn,editor:R,interaction:zi,controller:te,state:c,transcript:b,ready:Dh,firstFrame:s.firstFrame,stopped:Bn,getSurface:()=>gi.getSurface(),start(){ce||Z||(ce=!0,$(te.snapshot()),nn.setChatFocus(R),U.start(),s.start(),Ga.start(),B.detect().catch(()=>{}),rt.refreshSelectedModel(te.snapshot().session?.sessionId).catch(()=>{}),N.refresh().catch(()=>{}),ae?.refresh().catch(()=>{}),aI(n,fi,()=>Z,r))},suspend:YE,resume:XE,openSession:zE,continueLatestSession:QE,setStartupStatus(k){A?.setStartupHint(k),Cn()},submit:k=>D.submit(k).then(()=>{}),abortTurn:z,leaveUi:Ya,stop:dg}}var FB=new Set(["sendMessage","watchEvents","watchSessionTurn","watchSessionUsageCommits"]);function NE(n){let e;return n.then(t=>{e=t},()=>{}),new Proxy({},{get(t,i){if(i!=="then"){if(i==="isGoalEnabled")return()=>e?.isGoalEnabled()??!1;if(typeof i=="string")return FB.has(i)?(...s)=>$B(n,i,s):async(...s)=>{let r=await n,o=Reflect.get(r,i);return typeof o!="function"?o:Reflect.apply(o,r,s)}}}})}async function*$B(n,e,t){let i=await n,s=Reflect.get(i,e);if(typeof s!="function")return;yield*Reflect.apply(s,i,t)}import{randomUUID as BB}from"node:crypto";import Ka from"node:fs";import qB from"node:path";var HB="business-telemetry.identity.json",UB=100;function FE(n){let e=n.fetch??fetch,t=jB(n.dataDir),i=WB(n.region,n.buildEnv),s=Math.max(1,n.queueLimit??UB),r=[],o,a=!1,u=async()=>{for(a=!1;r.length>0;){let c=r.shift();if(c)try{let p=await KB(c,t,n);await e(i,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:VB(p),signal:AbortSignal.timeout(n.timeoutMs??3e3)})}catch{}}},l=()=>{a||o||(a=!0,queueMicrotask(()=>{!a||o||(o=u().finally(()=>{o=void 0,r.length>0&&l()}))}))};return{track(c,p){r.length>=s&&r.shift(),r.push({event:c,properties:p}),l()},async flush(){a=!1,o&&await o,r.length>0&&await u()}}}async function KB(n,e,t){let i=await DE(t.hailuoUserId),r=("hailuo_user_id"in n.properties?n.properties.hailuo_user_id.trim():"")||i,o=await DE(t.opGroupId),a={...n.properties,hailuo_user_id:r,...o?{op_group_id:o}:{},page:"tui",project:"MiniMaxAgent",project_name:t.region==="en"?"foreign-agent":"inland-agent",client:"TUI",web_device:"terminal",os:process.platform,device_id:e,real_device_id:e,login_status:r?1:0,onLine:1,browser:"terminal",env:t.buildEnv==="prod"?"prod":"test",device:"TUI",app_id:"3001",app_name:"MiniMax Code",version_tag:t.version,new_version:"marvis",download_source:"mcode"};return{identities:{$identity_cookie_id:e},distinct_id:e,lib:{$lib:"js",$lib_method:"code",$lib_version:t.version},properties:a,type:"track",event:n.event,time:(t.now??Date.now)()}}async function DE(n){try{return(await n?.())?.trim()??""}catch{return""}}function WB(n,e){return n==="en"?e==="prod"?"https://data.hailuo.ai/meerkat-reporter/api/report?project=MiniMaxAgent":"https://bigdata-test.talkie-ai.com/meerkat-reporter/api/report?project=MiniMaxAgent":e==="prod"?"https://data.hailuoai.com/meerkat-reporter/api/report?project=MiniMaxAgent":"https://bigdata-test.xingyeai.com/meerkat-reporter/api/report?project=MiniMaxAgent"}function jB(n){let e=qB.join(n,HB);try{let i=JSON.parse(Ka.readFileSync(e,"utf8"));if(i.version===1&&typeof i.distinctId=="string"&&i.distinctId.trim())return i.distinctId.trim()}catch{}let t=BB();try{Ka.mkdirSync(n,{recursive:!0,mode:448});let i=`${e}.${process.pid}.${Date.now()}.tmp`;Ka.writeFileSync(i,`${JSON.stringify({version:1,distinctId:t},null,2)}
|
|
259
259
|
`,{encoding:"utf8",mode:384}),Ka.renameSync(i,e),Ka.chmodSync(e,384)}catch{}return t}function VB(n){let e=Buffer.from(JSON.stringify(n),"utf8").toString("base64");return new URLSearchParams({data:e,ext:`crc=${GB(e)}`}).toString()}function GB(n){let e=0;for(let t=0;t<n.length;t+=1)e=(e<<5)-e+n.charCodeAt(t),e&=e;return e}function $E(n){if(n.kind!=="available"&&n.kind!=="package-manager")return;let e=n.latestVersion.trim();return e?{latestVersion:e}:void 0}import{mkdirSync as zB,readFileSync as QB,writeFileSync as YB}from"node:fs";import Wa from"node:path";var rg=Wa.join("tui","tui-settings.json"),XB="tui-settings.json";function BE(n){for(let e of[rg,XB])try{let t=QB(Wa.join(n,e),"utf8").replace(/^\uFEFF/u,"");return JSON.parse(t).tuiMode==="fullscreen"?"fullscreen":"regular"}catch{}return"regular"}function qE(n,e){zB(Wa.dirname(Wa.join(n,rg)),{recursive:!0}),YB(Wa.join(n,rg),`${JSON.stringify({tuiMode:e},null,2)}
|
|
260
|
-
`,{encoding:"utf8",mode:384})}var HE=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function UE(n){let e=0,t=!1,i=o=>{try{n(o)}catch{}},s=()=>{t||(i(`${HE[e]} Starting server...`),e=(e+1)%HE.length)};s();let r=setInterval(s,80);return r.unref?.(),{stop(){t||(t=!0,clearInterval(r),i(void 0))}}}var iq="Intelligence with everyone, bye~";async function Ele(n,e={}){if(!n.terminal&&(!process.stdin.isTTY||!process.stdout.isTTY))throw new Error("Minimax Code interactive mode requires a TTY.");let t=n.homeDir??tq(),i=n.workspaceDir??process.cwd(),s=n.dataDir??await(e.prepareDataDir??Ig)(),r=n.terminal??new us,o=n.tuiMode??(e.readTuiMode??BE)(s),a=er(),u=yg({runtimeRegion:process.env.MAVIS_REGION==="en"?"en":"cn"}),l=vg(n.lane,u.buildEnv),c=l?{bedrockLane:l}:void 0,p=(e.createSharedAuthSession??sT)({dataDir:s,...u,oauthEndpoints:mg(process.env,u)}),m,g=()=>m?.realUserID,T=new iT({authContextGetter:()=>m,...c?{routingContextGetter:()=>c}:{},...u}),y=async()=>{try{let X=await p.getAccessToken({requiredScopes:[...pg],minValidityMs:3e4});return m?.accessToken!==X.accessToken&&(m={accessToken:X.accessToken}),X}catch{m=void 0;return}},b=KE(async()=>{let X=m?.accessToken;if(!X)return;let et=await T.getRealUserID();return et&&m?.accessToken===X&&(m={...m,realUserID:et}),et}),S=KE(async()=>{let{opGroupId:X}=await T.getTokenPlanMembership();return X}),M=async()=>{let X=(await y())?.accessToken.trim();return b(X)},R=async()=>{let X=(await y())?.accessToken.trim();return S(X)},_={dataDir:s,appVersion:n.version,...u,terminal:a.terminalId,tuiMode:o,resolveAuthContext:async()=>{let X=await y();if(X)return{accessToken:X.accessToken,realUserID:g()?.trim()}}},F=e.createIncidentReporter?e.createIncidentReporter(_):WE()?Bg:$g(_),A=(X,et)=>{Mn(F,{eventType:"cli_process_error",error:X,component:"process",operation:et==="unhandledRejection"?"unhandledRejection":"uncaughtException",codeLocation:"src/tui/launcher.ts#uncaughtExceptionMonitor",severity:"fatal",impact:"exit",handled:!1})},$=e.createBusinessTelemetry?e.createBusinessTelemetry({dataDir:s,...u,version:n.version,hailuoUserId:M,opGroupId:R}):WE()?{track:()=>{},flush:async()=>{}}:FE({dataDir:s,...u,version:n.version,hailuoUserId:M,opGroupId:R}),N=X=>{try{$.track("tui_launch",{hailuo_user_id:g()?.trim()??"",launch_type:X})}catch{}},U=(e.createObservability??Dg)(s,{surface:"tui"}),D=!1,B=!1,z=X=>{if(X.terminalDead&&(B=!0),!D){D=!0;try{U.recordProcessStop(Ky(X,{homeDirectory:t,workspaceDir:i}))}catch{}}},ae=By(r,z);U.recordStartup({phase:"cli.process",outcome:"started"}),U.recordTerminal({...a,columns:ae.columns,rows:ae.rows});let xe=e.loadUpdateApplication??(async X=>{let{McodeUpdateApplication:et}=await import("./application-FCLZ6WHZ.js");return new et({currentVersion:X})}),ce,Z=()=>(ce??=xe(n.version),ce),bt,ht=new Promise(X=>{bt=X}),Gi,fi,Dn,Ns,$e,zi,no,Ds,Fn=!1,We=!1,$n=!1,te=!1,Cn=!1,$t,Fs;F.runId&&process.on("uncaughtExceptionMonitor",A);try{let X=Sn.now();F.breadcrumb("cli.runtime.initialize.started"),U.recordStartup({phase:"runtime.initialize",outcome:"started"});try{fi=await(e.loadRuntimeLifecycle??(()=>import("./lifecycle-
|
|
260
|
+
`,{encoding:"utf8",mode:384})}var HE=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function UE(n){let e=0,t=!1,i=o=>{try{n(o)}catch{}},s=()=>{t||(i(`${HE[e]} Starting server...`),e=(e+1)%HE.length)};s();let r=setInterval(s,80);return r.unref?.(),{stop(){t||(t=!0,clearInterval(r),i(void 0))}}}var iq="Intelligence with everyone, bye~";async function Ele(n,e={}){if(!n.terminal&&(!process.stdin.isTTY||!process.stdout.isTTY))throw new Error("Minimax Code interactive mode requires a TTY.");let t=n.homeDir??tq(),i=n.workspaceDir??process.cwd(),s=n.dataDir??await(e.prepareDataDir??Ig)(),r=n.terminal??new us,o=n.tuiMode??(e.readTuiMode??BE)(s),a=er(),u=yg({runtimeRegion:process.env.MAVIS_REGION==="en"?"en":"cn"}),l=vg(n.lane,u.buildEnv),c=l?{bedrockLane:l}:void 0,p=(e.createSharedAuthSession??sT)({dataDir:s,...u,oauthEndpoints:mg(process.env,u)}),m,g=()=>m?.realUserID,T=new iT({authContextGetter:()=>m,...c?{routingContextGetter:()=>c}:{},...u}),y=async()=>{try{let X=await p.getAccessToken({requiredScopes:[...pg],minValidityMs:3e4});return m?.accessToken!==X.accessToken&&(m={accessToken:X.accessToken}),X}catch{m=void 0;return}},b=KE(async()=>{let X=m?.accessToken;if(!X)return;let et=await T.getRealUserID();return et&&m?.accessToken===X&&(m={...m,realUserID:et}),et}),S=KE(async()=>{let{opGroupId:X}=await T.getTokenPlanMembership();return X}),M=async()=>{let X=(await y())?.accessToken.trim();return b(X)},R=async()=>{let X=(await y())?.accessToken.trim();return S(X)},_={dataDir:s,appVersion:n.version,...u,terminal:a.terminalId,tuiMode:o,resolveAuthContext:async()=>{let X=await y();if(X)return{accessToken:X.accessToken,realUserID:g()?.trim()}}},F=e.createIncidentReporter?e.createIncidentReporter(_):WE()?Bg:$g(_),A=(X,et)=>{Mn(F,{eventType:"cli_process_error",error:X,component:"process",operation:et==="unhandledRejection"?"unhandledRejection":"uncaughtException",codeLocation:"src/tui/launcher.ts#uncaughtExceptionMonitor",severity:"fatal",impact:"exit",handled:!1})},$=e.createBusinessTelemetry?e.createBusinessTelemetry({dataDir:s,...u,version:n.version,hailuoUserId:M,opGroupId:R}):WE()?{track:()=>{},flush:async()=>{}}:FE({dataDir:s,...u,version:n.version,hailuoUserId:M,opGroupId:R}),N=X=>{try{$.track("tui_launch",{hailuo_user_id:g()?.trim()??"",launch_type:X})}catch{}},U=(e.createObservability??Dg)(s,{surface:"tui"}),D=!1,B=!1,z=X=>{if(X.terminalDead&&(B=!0),!D){D=!0;try{U.recordProcessStop(Ky(X,{homeDirectory:t,workspaceDir:i}))}catch{}}},ae=By(r,z);U.recordStartup({phase:"cli.process",outcome:"started"}),U.recordTerminal({...a,columns:ae.columns,rows:ae.rows});let xe=e.loadUpdateApplication??(async X=>{let{McodeUpdateApplication:et}=await import("./application-FCLZ6WHZ.js");return new et({currentVersion:X})}),ce,Z=()=>(ce??=xe(n.version),ce),bt,ht=new Promise(X=>{bt=X}),Gi,fi,Dn,Ns,$e,zi,no,Ds,Fn=!1,We=!1,$n=!1,te=!1,Cn=!1,$t,Fs;F.runId&&process.on("uncaughtExceptionMonitor",A);try{let X=Sn.now();F.breadcrumb("cli.runtime.initialize.started"),U.recordStartup({phase:"runtime.initialize",outcome:"started"});try{fi=await(e.loadRuntimeLifecycle??(()=>import("./lifecycle-I4FKLUH5.js")))(),Dn=fi.createTuiRuntime({dataDir:s,workspaceDir:i,version:n.version,surface:"tui",observability:U,...l?{lane:l}:{}},{sharedAuthCore:p}),Dn.catch(()=>{})}catch(Oe){throw U.recordStartup({phase:"runtime.initialize",outcome:"failed",durationMs:Sn.now()-X,errorKind:Os(Oe)}),Oe}let et=Sn.now();U.recordStartup({phase:"tui.start",outcome:"started"});let tn=await jy(s),gi=Op(s).overrides,nn=!0;try{let Oe=Dn;if(!Oe)throw new Error("Runtime initialization did not start.");let xn=Yy({platform:process.platform,suspendSupported:process.platform!=="win32",windowsClipboardInterop:process.platform==="linux"&&!!(process.env.WSL_DISTRO_NAME||process.env.WSLENV),userOverrides:gi});rp(xn.manager),$e=(e.createApp??OE)({runtime:NE(Oe.then(ne=>ne.adapter)),dataDir:s,version:n.version,workspaceDir:i,...tn.statusLineItems?{statusLineItems:tn.statusLineItems}:{},...tn.customStatusLine?{customStatusLine:tn.customStatusLine}:{},...tn.showTips===void 0?{}:{showTips:tn.showTips},...tn.notifications?{notifications:tn.notifications}:{},...process.env[w1]?{automationResultPath:process.env[w1]}:{},...n.workspaceRoots?{workspaceRoots:n.workspaceRoots}:{},homeDir:t,terminal:ae,tuiMode:o,persistTuiMode:ne=>(e.writeTuiMode??qE)(s,ne),persistStatusLineItems:ne=>fg(s,ne),externalEditorCommand:n.externalEditorCommand,observability:U,incidentReporter:F,businessTelemetry:$,auth:(e.createAuthApplication??rT)({dataDir:s,...u,sharedAuthCore:p,telemetry:$,telemetrySource:"mcode_tui",hailuoUserId:g}),notifyAuthContextChanged:async ne=>{let Re=await Oe;await Re.synchronizeAuthContext(ne),await Re.host.notifyAuthContextChanged?.(ne),ne==="authenticated"?await y():m=void 0,F.breadcrumb("cli.auth.context.changed",{authState:ne}),ne==="authenticated"&&F.drain()},readClipboardImage:async ne=>{let{readTuiClipboardImage:Re}=await import("./clipboard-image-Q5NH3BUQ.js");return Re({signal:ne})},keybindings:xn.registry,...process.platform==="win32"?{}:{requestProcessSuspend:()=>process.kill(process.pid,"SIGTSTP")},requestRestart:(ne,Re)=>{Cn=!0,ne&&($t=ne),Re&&(Fs=Re)},getTuiKeybindingOverrides:()=>({...gi}),saveTuiKeybindingOverrides:ne=>{let Re={...ne};Zy(s,Re),gi=Re,xn.manager.setUserBindings({...xn.hostOverrides,...Re})},reloadTui:async()=>{let ne=await Oe,Re=Op(s);if(Re.error)throw new Error(`Couldn't reload ${Re.path}: ${Re.error}`);let sn=xn.registry.findConflicts(Re.overrides);if(sn.length>0){let za=sn.map(Bt=>`${Bt.key} (${Bt.ids.join(", ")})`).join("; ");throw new Error(`Conflicting TUI keybindings: ${za}`)}gg(),await ne.adapter.refreshPlugins(),gi=Re.overrides,xn.manager.setUserBindings({...xn.hostOverrides,...Re.overrides})},...n.resumeDraftAfterLogin?{resumeDraftAfterLogin:!0}:{},checkForUpdate:async()=>$E(await(await Z()).inspect()),inspectUpdate:async()=>(await Z()).inspect(),applyUpdate:async(ne,Re)=>(await Z()).apply(ne,Re)}),$e.ready.catch(()=>{}),$e.editor&&($e.editor.disableSubmit=!0),zi=UE(ne=>$e?.setStartupStatus?.(ne)),Gi=(e.installProcessGuards??Fy)({process,stop:()=>$e?.stop()??Promise.resolve(),report:ne=>{try{process.stderr.write(`Minimax Code TUI stopped unexpectedly: ${ot(ne)}. Restart MCode; if it keeps happening, report it through an available support channel.
|
|
261
261
|
`)}catch{}},capture:(ne,Re)=>sq(F,ne,Re),onStopCause:z,onStopFailure:()=>bt?.(),isTerminalDead:()=>B,...process.platform==="win32"?{}:{suspend:()=>$e?.suspend?.(),resume:async()=>{await $e?.resume?.(),N("hot")},suspendProcess:()=>process.kill(process.pid,"SIGTSTP")}}),$e.start(),no=oq($e,U,ht),no.catch(()=>{});let Bn=await Promise.race([Oe.then(ne=>({status:"ready",runtime:ne}),ne=>({status:"failed",error:ne})),$e.stopped.then(()=>({status:"stopped"})),ht.then(()=>({status:"stopped"}))]);if(Bn.status==="stopped"){U.recordStartup({phase:"runtime.initialize",outcome:"failed",durationMs:Sn.now()-X,errorKind:"StoppedDuringInitialization"});return}if(Bn.status==="failed")throw U.recordStartup({phase:"runtime.initialize",outcome:"failed",durationMs:Sn.now()-X,errorKind:Os(Bn.error)}),Bn.error;Ns=Bn.runtime,We=!0,F.breadcrumb("cli.runtime.initialize.succeeded"),U.recordStartup({phase:"runtime.initialize",outcome:"succeeded",durationMs:Sn.now()-X}),await $e.ready,nn=await fq($e,U,n),zi.stop(),zi=void 0,$e.editor&&($e.editor.disableSubmit=!1)}catch(Oe){throw U.recordStartup({phase:"tui.start",outcome:"failed",durationMs:Sn.now()-et,errorKind:Os(Oe)}),Oe}if(U.recordStartup({phase:"tui.start",outcome:"succeeded",durationMs:Sn.now()-et}),!await no)return;$n=!0,N("cold"),F.setPhase("runtime"),F.breadcrumb("cli.first-frame.rendered");let Ga=nn?n.initialPrompt?.trim():void 0;Ga&&gq($e,U,Ga),Fn=await Promise.race([$e.stopped.then(()=>!0),ht.then(()=>!1)]),Fn&&(Ds=$e.controller?.snapshot().session?.sessionId)}catch(X){throw Mn(F,{eventType:$n?"cli_process_error":"cli_startup_error",error:X,component:$n?"tui":"startup",operation:"launch-lifecycle",codeLocation:"src/tui/launcher.ts#launchTui",severity:"fatal",impact:"exit",handled:!1}),X}finally{if(F.setPhase("shutdown"),F.breadcrumb("cli.shutdown.started"),aq(zi),Gi?.(),$e)try{await Promise.resolve($e.stop())}catch(X){ja(F,"cli-ui",X)}if(Ns&&fi){try{te=await fi.shutdownTuiRuntime(Ns,{reportFailure:(X,et)=>{ja(F,X,et);try{process.stderr.write(`[minimax-code] ${X} cleanup failed: ${ot(et)}
|
|
262
262
|
`)}catch{}}})}catch(X){te=!0,ja(F,"runtime",X)}te&&(process.exitCode=1)}else Dn&&fi&&rq(Dn,fi,F);try{await U.flush()}catch(X){Mn(F,{eventType:"cli_persistence_error",error:X,component:"observability",operation:"flush",codeLocation:"src/tui/launcher.ts#observability.flush",severity:"warning",impact:"degraded",handled:!0})}try{await $.flush()}catch{}F.completeRun(),await F.flush(),F.runId&&process.off("uncaughtExceptionMonitor",A)}if(Cn&&Fn&&We&&!te){await(e.restartProcess??uq)(Ds,$t,Fs);return}if(Fn&&We&&!te)try{(e.writeExitMessage??(X=>process.stdout.write(X)))(pq(Ds))}catch{}}function sq(n,e,t){let i=t.origin==="stdout"||t.origin==="stderr",s=t.origin==="shutdown";Mn(n,{eventType:i?"cli_terminal_error":s?"cli_shutdown_error":t.origin==="suspend"||t.origin==="resume"?"cli_interaction_error":"cli_process_error",error:e,component:i?"terminal":s?"shutdown":"process",operation:s?"cli-ui":t.origin,codeLocation:"src/tui/platform/process-guards.ts#installTuiProcessGuards",severity:t.terminalDead||s?"error":"fatal",impact:"exit",handled:!!(t.terminalDead||s),context:{origin:t.origin,...t.terminalDead===void 0?{}:{terminalDead:t.terminalDead}}})}function ja(n,e,t){Mn(n,{eventType:"cli_shutdown_error",error:t,component:"shutdown",operation:e,codeLocation:"src/tui/launcher.ts#shutdown",severity:"error",impact:"degraded",handled:!0})}function rq(n,e,t){n.then(async i=>{await e.shutdownTuiRuntime(i,{reportFailure:(s,r)=>ja(t,s,r)})&&(process.exitCode=1)}).catch(i=>ja(t,"pending-runtime",i))}async function oq(n,e,t){let i=Sn.now();e.recordStartup({phase:"tui.first-frame",outcome:"started"});let s;try{s=await Promise.race([n.firstFrame.then(()=>!0),n.stopped.then(()=>!1),t.then(()=>!1)])}catch(r){throw e.recordStartup({phase:"tui.first-frame",outcome:"failed",durationMs:Sn.now()-i,errorKind:Os(r)}),r}return e.recordStartup({phase:"tui.first-frame",outcome:s?"succeeded":"failed",durationMs:Sn.now()-i,...s?{}:{errorKind:"StoppedBeforeFirstFrame"}}),s}function KE(n){let e,t,i,s=0;return async r=>{if(!r)return;if(e!==r&&(e=r,t=void 0,i=void 0,s=0),t)return t;if(Date.now()<s)return;let o=i??n().then(a=>(a?t=a:s=Date.now()+6e4,a)).catch(()=>{s=Date.now()+6e4});i=o;try{return await o}finally{i===o&&(i=void 0)}}}function aq(n){try{n?.stop()}catch{}}async function uq(n,e,t){let i=cq(process.execPath,process.argv,n,t),s=lq(process.env,e);if(!await wg(process.argv[1],process.execPath,process.pid,i,s))return new Promise((r,o)=>{let a=JB(process.execPath,i,{cwd:process.cwd(),env:s,stdio:"inherit",windowsHide:!1});a.once("error",o),a.once("exit",(u,l)=>{u!==null&&u!==0?process.exitCode=u:l&&(process.exitCode=1),r()})})}function lq(n,e){return e?Eg({...n,MAVIS_REGION:e}):n}function cq(n,e,t,i){let s=dq(n),r=e.slice(s?2:1),o=bg(r,!0),a=o?["--env",o]:[],u=t?["--session",t]:[],l=i?[i]:[];if(!s)return[...a,...u,...l];let c=e[1];if(!c||!hq(c))throw new Error("Unable to restart MCode because its Node.js entry file is unavailable.");return[c,...a,...u,...l]}function dq(n){let e=nq.basename(n).toLocaleLowerCase();return e==="node"||e==="node.exe"}function WE(){return!!import.meta.vitest||process.env.VITEST==="true"}function hq(n){try{return ZB(n)&&eq(n).isFile()}catch{return!1}}function pq(n){let e=n?mq(n):void 0;return`${e??`
|
|
263
263
|
`}${e?`
|