var TO=Object.create;var Ko=Object.defineProperty;var PO=Object.getOwnPropertyDescriptor;var CO=Object.getOwnPropertyNames;var EO=Object.getPrototypeOf,RO=Object.prototype.hasOwnProperty;var me=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),AO=(i,e)=>{for(var t in e)Ko(i,t,{get:e[t],enumerable:!0})},QO=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of CO(e))!RO.call(i,n)&&n!==t&&Ko(i,n,{get:()=>e[n],enumerable:!(r=PO(e,n))||r.enumerable});return i};var _h=(i,e,t)=>(t=i!=null?TO(EO(i)):{},QO(e||!i||!i.__esModule?Ko(t,"default",{value:i,enumerable:!0}):t,i));var Qg=me((IP,NS)=>{NS.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-repeat" viewBox="0 0 16 16">
  <path d="M11.534 7h3.932a.25.25 0 0 1 .192.41l-1.966 2.36a.25.25 0 0 1-.384 0l-1.966-2.36a.25.25 0 0 1 .192-.41m-11 2h3.932a.25.25 0 0 0 .192-.41L2.692 6.23a.25.25 0 0 0-.384 0L.342 8.59A.25.25 0 0 0 .534 9"/>
  <path fill-rule="evenodd" d="M8 3c-1.552 0-2.94.707-3.857 1.818a.5.5 0 1 1-.771-.636A6.002 6.002 0 0 1 13.917 7H12.9A5 5 0 0 0 8 3M3.1 9a5.002 5.002 0 0 0 8.757 2.182.5.5 0 1 1 .771.636A6.002 6.002 0 0 1 2.083 9z"/>
</svg>`});var Mg=me((WP,jS)=>{jS.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-exclamation-circle" viewBox="0 0 16 16">
  <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
  <path d="M7.002 11a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 4.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/>
</svg>
`});var _g=me((zP,IS)=>{IS.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-lightbulb" viewBox="0 0 16 16">
  <path d="M2 6a6 6 0 1 1 10.174 4.31c-.203.196-.359.4-.453.619l-.762 1.769A.5.5 0 0 1 10.5 13a.5.5 0 0 1 0 1 .5.5 0 0 1 0 1l-.224.447a1 1 0 0 1-.894.553H6.618a1 1 0 0 1-.894-.553L5.5 15a.5.5 0 0 1 0-1 .5.5 0 0 1 0-1 .5.5 0 0 1-.46-.302l-.761-1.77a2 2 0 0 0-.453-.618A5.98 5.98 0 0 1 2 6m6-5a5 5 0 0 0-3.479 8.592c.263.254.514.564.676.941L5.83 12h4.342l.632-1.467c.162-.377.413-.687.676-.941A5 5 0 0 0 8 1"/>
</svg>`});var Dg=me((UP,WS)=>{WS.exports=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-play" viewBox="0 0 16 16">
  <path d="M10.804 8 5 4.633v6.734zm.792-.696a.802.802 0 0 1 0 1.392l-6.363 3.692C4.713 12.69 4 12.345 4 11.692V4.308c0-.653.713-.998 1.233-.696z"/>
</svg>`});var kh=me((fC,HS)=>{HS.exports={Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",amp:"&",AMP:"&",andand:"\u2A55",And:"\u2A53",and:"\u2227",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angmsd:"\u2221",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",apacir:"\u2A6F",ap:"\u2248",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",barwed:"\u2305",Barwed:"\u2306",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",Because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxdl:"\u2510",boxdL:"\u2555",boxDl:"\u2556",boxDL:"\u2557",boxdr:"\u250C",boxdR:"\u2552",boxDr:"\u2553",boxDR:"\u2554",boxh:"\u2500",boxH:"\u2550",boxhd:"\u252C",boxHd:"\u2564",boxhD:"\u2565",boxHD:"\u2566",boxhu:"\u2534",boxHu:"\u2567",boxhU:"\u2568",boxHU:"\u2569",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxul:"\u2518",boxuL:"\u255B",boxUl:"\u255C",boxUL:"\u255D",boxur:"\u2514",boxuR:"\u2558",boxUr:"\u2559",boxUR:"\u255A",boxv:"\u2502",boxV:"\u2551",boxvh:"\u253C",boxvH:"\u256A",boxVh:"\u256B",boxVH:"\u256C",boxvl:"\u2524",boxvL:"\u2561",boxVl:"\u2562",boxVL:"\u2563",boxvr:"\u251C",boxvR:"\u255E",boxVr:"\u255F",boxVR:"\u2560",bprime:"\u2035",breve:"\u02D8",Breve:"\u02D8",brvbar:"\xA6",bscr:"\u{1D4B7}",Bscr:"\u212C",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsolb:"\u29C5",bsol:"\\",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",cap:"\u2229",Cap:"\u22D2",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",CenterDot:"\xB7",cfr:"\u{1D520}",Cfr:"\u212D",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cir:"\u25CB",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",colon:":",Colon:"\u2237",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",conint:"\u222E",Conint:"\u222F",ContourIntegral:"\u222E",copf:"\u{1D554}",Copf:"\u2102",coprod:"\u2210",Coproduct:"\u2210",copy:"\xA9",COPY:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",cross:"\u2717",Cross:"\u2A2F",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cupbrcap:"\u2A48",cupcap:"\u2A46",CupCap:"\u224D",cup:"\u222A",Cup:"\u22D3",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dagger:"\u2020",Dagger:"\u2021",daleth:"\u2138",darr:"\u2193",Darr:"\u21A1",dArr:"\u21D3",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",ddagger:"\u2021",ddarr:"\u21CA",DD:"\u2145",dd:"\u2146",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",diamond:"\u22C4",Diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrowBar:"\u2913",downarrow:"\u2193",DownArrow:"\u2193",Downarrow:"\u21D3",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVectorBar:"\u2956",DownLeftVector:"\u21BD",DownRightTeeVector:"\u295F",DownRightVectorBar:"\u2957",DownRightVector:"\u21C1",DownTeeArrow:"\u21A7",DownTee:"\u22A4",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",Ecirc:"\xCA",ecirc:"\xEA",ecir:"\u2256",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",edot:"\u0117",eDot:"\u2251",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",escr:"\u212F",Escr:"\u2130",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",exponentiale:"\u2147",ExponentialE:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",forall:"\u2200",ForAll:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\u{1D4BB}",Fscr:"\u2131",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",ge:"\u2265",gE:"\u2267",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",gescc:"\u2AA9",ges:"\u2A7E",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",gg:"\u226B",Gg:"\u22D9",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gla:"\u2AA5",gl:"\u2277",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gnE:"\u2269",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gtcc:"\u2AA7",gtcir:"\u2A7A",gt:">",GT:">",Gt:"\u226B",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",harrcir:"\u2948",harr:"\u2194",hArr:"\u21D4",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",Hfr:"\u210C",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\u{1D559}",Hopf:"\u210D",horbar:"\u2015",HorizontalLine:"\u2500",hscr:"\u{1D4BD}",Hscr:"\u210B",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",Ifr:"\u2111",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",Im:"\u2111",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",incare:"\u2105",in:"\u2208",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",intcal:"\u22BA",int:"\u222B",Int:"\u222C",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",Iscr:"\u2110",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",lang:"\u27E8",Lang:"\u27EA",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",larrb:"\u21E4",larrbfs:"\u291F",larr:"\u2190",Larr:"\u219E",lArr:"\u21D0",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",latail:"\u2919",lAtail:"\u291B",lat:"\u2AAB",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lBarr:"\u290E",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",lE:"\u2266",LeftAngleBracket:"\u27E8",LeftArrowBar:"\u21E4",leftarrow:"\u2190",LeftArrow:"\u2190",Leftarrow:"\u21D0",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVectorBar:"\u2959",LeftDownVector:"\u21C3",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTeeArrow:"\u21A4",LeftTee:"\u22A3",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangleBar:"\u29CF",LeftTriangle:"\u22B2",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVectorBar:"\u2958",LeftUpVector:"\u21BF",LeftVectorBar:"\u2952",LeftVector:"\u21BC",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",lescc:"\u2AA8",les:"\u2A7D",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",llarr:"\u21C7",ll:"\u226A",Ll:"\u22D8",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoustache:"\u23B0",lmoust:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lnE:"\u2268",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftrightarrow:"\u27F7",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longmapsto:"\u27FC",longrightarrow:"\u27F6",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",Lscr:"\u2112",lsh:"\u21B0",Lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",ltcc:"\u2AA6",ltcir:"\u2A79",lt:"<",LT:"<",Lt:"\u226A",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",midast:"*",midcir:"\u2AF0",mid:"\u2223",middot:"\xB7",minusb:"\u229F",minus:"\u2212",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",mscr:"\u{1D4C2}",Mscr:"\u2133",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natural:"\u266E",naturals:"\u2115",natur:"\u266E",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",nearhk:"\u2924",nearr:"\u2197",neArr:"\u21D7",nearrow:"\u2197",ne:"\u2260",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangle:"\u22EB",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",nprec:"\u2280",npreceq:"\u2AAF\u0338",npre:"\u2AAF\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21D6",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",Ocirc:"\xD4",ocirc:"\xF4",ocir:"\u229A",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",orarr:"\u21BB",Or:"\u2A54",or:"\u2228",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",otimesas:"\u2A36",Otimes:"\u2A37",otimes:"\u2297",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",para:"\xB6",parallel:"\u2225",par:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plus:"+",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",popf:"\u{1D561}",Popf:"\u2119",pound:"\xA3",prap:"\u2AB7",Pr:"\u2ABB",pr:"\u227A",prcue:"\u227C",precapprox:"\u2AB7",prec:"\u227A",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",pre:"\u2AAF",prE:"\u2AB3",precsim:"\u227E",prime:"\u2032",Prime:"\u2033",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportional:"\u221D",Proportion:"\u2237",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",qopf:"\u{1D562}",Qopf:"\u211A",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',QUOT:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",Rang:"\u27EB",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarr:"\u2192",Rarr:"\u21A0",rArr:"\u21D2",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",ratail:"\u291A",rAtail:"\u291C",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rBarr:"\u290F",RBarr:"\u2910",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",Re:"\u211C",rect:"\u25AD",reg:"\xAE",REG:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",rfr:"\u{1D52F}",Rfr:"\u211C",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrowBar:"\u21E5",rightarrow:"\u2192",RightArrow:"\u2192",Rightarrow:"\u21D2",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVectorBar:"\u2955",RightDownVector:"\u21C2",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTeeArrow:"\u21A6",RightTee:"\u22A2",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangleBar:"\u29D0",RightTriangle:"\u22B3",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVectorBar:"\u2954",RightUpVector:"\u21BE",RightVectorBar:"\u2953",RightVector:"\u21C0",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoustache:"\u23B1",rmoust:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\u{1D563}",Ropf:"\u211D",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",rscr:"\u{1D4C7}",Rscr:"\u211B",rsh:"\u21B1",Rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",Sc:"\u2ABC",sc:"\u227B",sccue:"\u227D",sce:"\u2AB0",scE:"\u2AB4",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdotb:"\u22A1",sdot:"\u22C5",sdote:"\u2A66",searhk:"\u2925",searr:"\u2198",seArr:"\u21D8",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",solbar:"\u233F",solb:"\u29C4",sol:"/",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",square:"\u25A1",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squ:"\u25A1",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",Sub:"\u22D0",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",Subset:"\u22D0",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succapprox:"\u2AB8",succ:"\u227B",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",sum:"\u2211",Sum:"\u2211",sung:"\u266A",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",Sup:"\u22D1",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",supset:"\u2283",Supset:"\u22D1",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swarr:"\u2199",swArr:"\u21D9",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:"	",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",therefore:"\u2234",Therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",tilde:"\u02DC",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",timesbar:"\u2A31",timesb:"\u22A0",times:"\xD7",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",topbot:"\u2336",topcir:"\u2AF1",top:"\u22A4",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",TRADE:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",uarr:"\u2191",Uarr:"\u219F",uArr:"\u21D1",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrowBar:"\u2912",uparrow:"\u2191",UpArrow:"\u2191",Uparrow:"\u21D1",UpArrowDownArrow:"\u21C5",updownarrow:"\u2195",UpDownArrow:"\u2195",Updownarrow:"\u21D5",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",upsi:"\u03C5",Upsi:"\u03D2",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTeeArrow:"\u21A5",UpTee:"\u22A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",vArr:"\u21D5",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vBar:"\u2AE8",Vbar:"\u2AEB",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",vdash:"\u22A2",vDash:"\u22A8",Vdash:"\u22A9",VDash:"\u22AB",Vdashl:"\u2AE6",veebar:"\u22BB",vee:"\u2228",Vee:"\u22C1",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",Verbar:"\u2016",vert:"|",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",Wedge:"\u22C0",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xharr:"\u27F7",xhArr:"\u27FA",Xi:"\u039E",xi:"\u03BE",xlarr:"\u27F5",xlArr:"\u27F8",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrarr:"\u27F6",xrArr:"\u27F9",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",yuml:"\xFF",Yuml:"\u0178",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",zfr:"\u{1D537}",Zfr:"\u2128",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",Zopf:"\u2124",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}});var $g=me((dC,GS)=>{GS.exports={Aacute:"\xC1",aacute:"\xE1",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",AElig:"\xC6",aelig:"\xE6",Agrave:"\xC0",agrave:"\xE0",amp:"&",AMP:"&",Aring:"\xC5",aring:"\xE5",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",brvbar:"\xA6",Ccedil:"\xC7",ccedil:"\xE7",cedil:"\xB8",cent:"\xA2",copy:"\xA9",COPY:"\xA9",curren:"\xA4",deg:"\xB0",divide:"\xF7",Eacute:"\xC9",eacute:"\xE9",Ecirc:"\xCA",ecirc:"\xEA",Egrave:"\xC8",egrave:"\xE8",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",frac12:"\xBD",frac14:"\xBC",frac34:"\xBE",gt:">",GT:">",Iacute:"\xCD",iacute:"\xED",Icirc:"\xCE",icirc:"\xEE",iexcl:"\xA1",Igrave:"\xCC",igrave:"\xEC",iquest:"\xBF",Iuml:"\xCF",iuml:"\xEF",laquo:"\xAB",lt:"<",LT:"<",macr:"\xAF",micro:"\xB5",middot:"\xB7",nbsp:"\xA0",not:"\xAC",Ntilde:"\xD1",ntilde:"\xF1",Oacute:"\xD3",oacute:"\xF3",Ocirc:"\xD4",ocirc:"\xF4",Ograve:"\xD2",ograve:"\xF2",ordf:"\xAA",ordm:"\xBA",Oslash:"\xD8",oslash:"\xF8",Otilde:"\xD5",otilde:"\xF5",Ouml:"\xD6",ouml:"\xF6",para:"\xB6",plusmn:"\xB1",pound:"\xA3",quot:'"',QUOT:'"',raquo:"\xBB",reg:"\xAE",REG:"\xAE",sect:"\xA7",shy:"\xAD",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",szlig:"\xDF",THORN:"\xDE",thorn:"\xFE",times:"\xD7",Uacute:"\xDA",uacute:"\xFA",Ucirc:"\xDB",ucirc:"\xFB",Ugrave:"\xD9",ugrave:"\xF9",uml:"\xA8",Uuml:"\xDC",uuml:"\xFC",Yacute:"\xDD",yacute:"\xFD",yen:"\xA5",yuml:"\xFF"}});var Th=me((pC,YS)=>{YS.exports={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}});var Bg=me((mC,ZS)=>{ZS.exports={"0":65533,"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}});var Ng=me($n=>{"use strict";var JS=$n&&$n.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($n,"__esModule",{value:!0});var Xg=JS(Bg()),KS=String.fromCodePoint||function(i){var e="";return i>65535&&(i-=65536,e+=String.fromCharCode(i>>>10&1023|55296),i=56320|i&1023),e+=String.fromCharCode(i),e};function ek(i){return i>=55296&&i<=57343||i>1114111?"\uFFFD":(i in Xg.default&&(i=Xg.default[i]),KS(i))}$n.default=ek});var Ch=me(kt=>{"use strict";var jo=kt&&kt.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(kt,"__esModule",{value:!0});kt.decodeHTML=kt.decodeHTMLStrict=kt.decodeXML=void 0;var Ph=jo(kh()),tk=jo($g()),ik=jo(Th()),jg=jo(Ng()),rk=/&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;kt.decodeXML=Wg(ik.default);kt.decodeHTMLStrict=Wg(Ph.default);function Wg(i){var e=zg(i);return function(t){return String(t).replace(rk,e)}}var Ig=function(i,e){return i<e?1:-1};kt.decodeHTML=function(){for(var i=Object.keys(tk.default).sort(Ig),e=Object.keys(Ph.default).sort(Ig),t=0,r=0;t<e.length;t++)i[r]===e[t]?(e[t]+=";?",r++):e[t]+=";";var n=new RegExp("&(?:"+e.join("|")+"|#[xX][\\da-fA-F]+;?|#\\d+;?)","g"),s=zg(Ph.default);function o(a){return a.substr(-1)!==";"&&(a+=";"),s(a)}return function(a){return String(a).replace(n,o)}}();function zg(i){return function(t){if(t.charAt(1)==="#"){var r=t.charAt(2);return r==="X"||r==="x"?jg.default(parseInt(t.substr(3),16)):jg.default(parseInt(t.substr(2),10))}return i[t.slice(1,-1)]||t}}});var Rh=me($e=>{"use strict";var Ug=$e&&$e.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($e,"__esModule",{value:!0});$e.escapeUTF8=$e.escape=$e.encodeNonAsciiHTML=$e.encodeHTML=$e.encodeXML=void 0;var nk=Ug(Th()),Fg=Gg(nk.default),Hg=Yg(Fg);$e.encodeXML=Kg(Fg);var sk=Ug(kh()),Eh=Gg(sk.default),ok=Yg(Eh);$e.encodeHTML=lk(Eh,ok);$e.encodeNonAsciiHTML=Kg(Eh);function Gg(i){return Object.keys(i).sort().reduce(function(e,t){return e[i[t]]="&"+t+";",e},{})}function Yg(i){for(var e=[],t=[],r=0,n=Object.keys(i);r<n.length;r++){var s=n[r];s.length===1?e.push("\\"+s):t.push(s)}e.sort();for(var o=0;o<e.length-1;o++){for(var a=o;a<e.length-1&&e[a].charCodeAt(1)+1===e[a+1].charCodeAt(1);)a+=1;var l=1+a-o;l<3||e.splice(o,l,e[o]+"-"+e[a])}return t.unshift("["+e.join("")+"]"),new RegExp(t.join("|"),"g")}var Zg=/(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g,ak=String.prototype.codePointAt!=null?function(i){return i.codePointAt(0)}:function(i){return(i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536};function Io(i){return"&#x"+(i.length>1?ak(i):i.charCodeAt(0)).toString(16).toUpperCase()+";"}function lk(i,e){return function(t){return t.replace(e,function(r){return i[r]}).replace(Zg,Io)}}var Jg=new RegExp(Hg.source+"|"+Zg.source,"g");function ck(i){return i.replace(Jg,Io)}$e.escape=ck;function hk(i){return i.replace(Hg,Io)}$e.escapeUTF8=hk;function Kg(i){return function(e){return e.replace(Jg,function(t){return i[t]||Io(t)})}}});var tO=me($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.decodeXMLStrict=$.decodeHTML5Strict=$.decodeHTML4Strict=$.decodeHTML5=$.decodeHTML4=$.decodeHTMLStrict=$.decodeHTML=$.decodeXML=$.encodeHTML5=$.encodeHTML4=$.escapeUTF8=$.escape=$.encodeNonAsciiHTML=$.encodeHTML=$.encodeXML=$.encode=$.decodeStrict=$.decode=void 0;var Wo=Ch(),eO=Rh();function uk(i,e){return(!e||e<=0?Wo.decodeXML:Wo.decodeHTML)(i)}$.decode=uk;function fk(i,e){return(!e||e<=0?Wo.decodeXML:Wo.decodeHTMLStrict)(i)}$.decodeStrict=fk;function dk(i,e){return(!e||e<=0?eO.encodeXML:eO.encodeHTML)(i)}$.encode=dk;var Di=Rh();Object.defineProperty($,"encodeXML",{enumerable:!0,get:function(){return Di.encodeXML}});Object.defineProperty($,"encodeHTML",{enumerable:!0,get:function(){return Di.encodeHTML}});Object.defineProperty($,"encodeNonAsciiHTML",{enumerable:!0,get:function(){return Di.encodeNonAsciiHTML}});Object.defineProperty($,"escape",{enumerable:!0,get:function(){return Di.escape}});Object.defineProperty($,"escapeUTF8",{enumerable:!0,get:function(){return Di.escapeUTF8}});Object.defineProperty($,"encodeHTML4",{enumerable:!0,get:function(){return Di.encodeHTML}});Object.defineProperty($,"encodeHTML5",{enumerable:!0,get:function(){return Di.encodeHTML}});var ri=Ch();Object.defineProperty($,"decodeXML",{enumerable:!0,get:function(){return ri.decodeXML}});Object.defineProperty($,"decodeHTML",{enumerable:!0,get:function(){return ri.decodeHTML}});Object.defineProperty($,"decodeHTMLStrict",{enumerable:!0,get:function(){return ri.decodeHTMLStrict}});Object.defineProperty($,"decodeHTML4",{enumerable:!0,get:function(){return ri.decodeHTML}});Object.defineProperty($,"decodeHTML5",{enumerable:!0,get:function(){return ri.decodeHTML}});Object.defineProperty($,"decodeHTML4Strict",{enumerable:!0,get:function(){return ri.decodeHTMLStrict}});Object.defineProperty($,"decodeHTML5Strict",{enumerable:!0,get:function(){return ri.decodeHTMLStrict}});Object.defineProperty($,"decodeXMLStrict",{enumerable:!0,get:function(){return ri.decodeXML}})});var Ah=me((wC,uO)=>{"use strict";function pk(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function iO(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function mk(i,e,t){return e&&iO(i.prototype,e),t&&iO(i,t),i}function lO(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(!t){if(Array.isArray(i)||(t=gk(i))||e&&i&&typeof i.length=="number"){t&&(i=t);var r=0,n=function(){};return{s:n,n:function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}},e:function(c){throw c},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){t=t.call(i)},n:function(){var c=t.next();return s=c.done,c},e:function(c){o=!0,a=c},f:function(){try{!s&&t.return!=null&&t.return()}finally{if(o)throw a}}}}function gk(i,e){if(i){if(typeof i=="string")return rO(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return rO(i,e)}}function rO(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var Ok=tO(),nO={fg:"#FFF",bg:"#000",newline:!1,escapeXML:!1,stream:!1,colors:yk()};function yk(){var i={0:"#000",1:"#A00",2:"#0A0",3:"#A50",4:"#00A",5:"#A0A",6:"#0AA",7:"#AAA",8:"#555",9:"#F55",10:"#5F5",11:"#FF5",12:"#55F",13:"#F5F",14:"#5FF",15:"#FFF"};return zo(0,5).forEach(function(e){zo(0,5).forEach(function(t){zo(0,5).forEach(function(r){return bk(e,t,r,i)})})}),zo(0,23).forEach(function(e){var t=e+232,r=cO(e*10+8);i[t]="#"+r+r+r}),i}function bk(i,e,t,r){var n=16+i*36+e*6+t,s=i>0?i*40+55:0,o=e>0?e*40+55:0,a=t>0?t*40+55:0;r[n]=wk([s,o,a])}function cO(i){for(var e=i.toString(16);e.length<2;)e="0"+e;return e}function wk(i){var e=[],t=lO(i),r;try{for(t.s();!(r=t.n()).done;){var n=r.value;e.push(cO(n))}}catch(s){t.e(s)}finally{t.f()}return"#"+e.join("")}function sO(i,e,t,r){var n;return e==="text"?n=kk(t,r):e==="display"?n=xk(i,t,r):e==="xterm256Foreground"?n=Fo(i,r.colors[t]):e==="xterm256Background"?n=Ho(i,r.colors[t]):e==="rgb"&&(n=vk(i,t)),n}function vk(i,e){e=e.substring(2).slice(0,-1);var t=+e.substr(0,2),r=e.substring(5).split(";"),n=r.map(function(s){return("0"+Number(s).toString(16)).substr(-2)}).join("");return Uo(i,(t===38?"color:#":"background-color:#")+n)}function xk(i,e,t){e=parseInt(e,10);var r={"-1":function(){return"<br/>"},0:function(){return i.length&&hO(i)},1:function(){return ni(i,"b")},3:function(){return ni(i,"i")},4:function(){return ni(i,"u")},8:function(){return Uo(i,"display:none")},9:function(){return ni(i,"strike")},22:function(){return Uo(i,"font-weight:normal;text-decoration:none;font-style:normal")},23:function(){return aO(i,"i")},24:function(){return aO(i,"u")},39:function(){return Fo(i,t.fg)},49:function(){return Ho(i,t.bg)},53:function(){return Uo(i,"text-decoration:overline")}},n;return r[e]?n=r[e]():4<e&&e<7?n=ni(i,"blink"):29<e&&e<38?n=Fo(i,t.colors[e-30]):39<e&&e<48?n=Ho(i,t.colors[e-40]):89<e&&e<98?n=Fo(i,t.colors[8+(e-90)]):99<e&&e<108&&(n=Ho(i,t.colors[8+(e-100)])),n}function hO(i){var e=i.slice(0);return i.length=0,e.reverse().map(function(t){return"</"+t+">"}).join("")}function zo(i,e){for(var t=[],r=i;r<=e;r++)t.push(r);return t}function Sk(i){return function(e){return(i===null||e.category!==i)&&i!=="all"}}function oO(i){i=parseInt(i,10);var e=null;return i===0?e="all":i===1?e="bold":2<i&&i<5?e="underline":4<i&&i<7?e="blink":i===8?e="hide":i===9?e="strike":29<i&&i<38||i===39||89<i&&i<98?e="foreground-color":(39<i&&i<48||i===49||99<i&&i<108)&&(e="background-color"),e}function kk(i,e){return e.escapeXML?Ok.encodeXML(i):i}function ni(i,e,t){return t||(t=""),i.push(e),"<".concat(e).concat(t?' style="'.concat(t,'"'):"",">")}function Uo(i,e){return ni(i,"span",e)}function Fo(i,e){return ni(i,"span","color:"+e)}function Ho(i,e){return ni(i,"span","background-color:"+e)}function aO(i,e){var t;if(i.slice(-1)[0]===e&&(t=i.pop()),t)return"</"+e+">"}function Tk(i,e,t){var r=!1,n=3;function s(){return""}function o(w,T){return t("xterm256Foreground",T),""}function a(w,T){return t("xterm256Background",T),""}function l(w){return e.newline?t("display",-1):t("text",w),""}function c(w,T){r=!0,T.trim().length===0&&(T="0"),T=T.trimRight(";").split(";");var P=lO(T),M;try{for(P.s();!(M=P.n()).done;){var q=M.value;t("display",q)}}catch(L){P.e(L)}finally{P.f()}return""}function h(w){return t("text",w),""}function u(w){return t("rgb",w),""}var f=[{pattern:/^\x08+/,sub:s},{pattern:/^\x1b\[[012]?K/,sub:s},{pattern:/^\x1b\[\(B/,sub:s},{pattern:/^\x1b\[[34]8;2;\d+;\d+;\d+m/,sub:u},{pattern:/^\x1b\[38;5;(\d+)m/,sub:o},{pattern:/^\x1b\[48;5;(\d+)m/,sub:a},{pattern:/^\n/,sub:l},{pattern:/^\r+\n/,sub:l},{pattern:/^\r/,sub:l},{pattern:/^\x1b\[((?:\d{1,3};?)+|)m/,sub:c},{pattern:/^\x1b\[\d?J/,sub:s},{pattern:/^\x1b\[\d{0,3};\d{0,3}f/,sub:s},{pattern:/^\x1b\[?[\d;]{0,3}/,sub:s},{pattern:/^(([^\x1b\x08\r\n])+)/,sub:h}];function d(w,T){T>n&&r||(r=!1,i=i.replace(w.pattern,w.sub))}var m=[],p=i,g=p.length;e:for(;g>0;){for(var O=0,y=0,x=f.length;y<x;O=++y){var v=f[O];if(d(v,O),i.length!==g){g=i.length;continue e}}if(i.length===g)break;m.push(0),g=i.length}return m}function Pk(i,e,t){return e!=="text"&&(i=i.filter(Sk(oO(t))),i.push({token:e,data:t,category:oO(t)})),i}var Ck=function(){function i(e){pk(this,i),e=e||{},e.colors&&(e.colors=Object.assign({},nO.colors,e.colors)),this.options=Object.assign({},nO,e),this.stack=[],this.stickyStack=[]}return mk(i,[{key:"toHtml",value:function(t){var r=this;t=typeof t=="string"?[t]:t;var n=this.stack,s=this.options,o=[];return this.stickyStack.forEach(function(a){var l=sO(n,a.token,a.data,s);l&&o.push(l)}),Tk(t.join(""),s,function(a,l){var c=sO(n,a,l,s);c&&o.push(c),s.stream&&(r.stickyStack=Pk(r.stickyStack,a,l))}),n.length&&o.push(hO(n)),o.join("")}}]),i}();uO.exports=Ck});var dO=me((RC,Ek)=>{Ek.exports="CmltcG9ydCBweW9kaWRlICMgdHlwZTogaWdub3JlW2F0dHItZGVmaW5lZF0KaW1wb3J0IHN5cwoKIyBDbGVhbnVwIGFueSBsZWZ0b3ZlciBtYXRwbG90bGliIHBsb3RzCnRyeToKICBpbXBvcnQgbWF0cG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ogIHZhbHVlID0gZnVuY3Rpb24oeCwgdmlzaWJsZSkgewogICAga25pdF9vcHRpb25zID0gbGlzdChzY3JlZW5zaG90LmZvcmNlID0gRkFMU0UpCiAgICByZXMgPC0gaWYgKHZpc2libGUpIHsKICAgICAgd2l0aFZpc2libGUoCiAgICAgICAga25pdHI6OmtuaXRfcHJpbnQoCiAgICAgICAgICBpZiAoaW5oZXJpdHMoeCwgImRhdGEuZnJhbWUiKSkgewogICAgICAgICAgICBzd2l0Y2goCiAgICAgICAgICAgICAgZ2V0T3B0aW9uKCJ3ZWJyLnJlbmRlci5kZiIsICJkZWZhdWx0IiksCiAgICAgICAgICAgICAgImthYmxlIiA9IGtuaXRyOjprYWJsZSh4KSwKICAgICAgICAgICAgICAiZHQiID0gRFQ6OmRhdGF0YWJsZSh4KSwKICAgICAgICAgICAgICAicGFnZWQtdGFibGUiID0gcm1hcmtkb3duOjpwYWdlZF90YWJsZSh4KSwKICAgICAgICAgICAgICAiZ3QiID0gZ3Q6Omd0KHgpLAogICAgICAgICAgICAgICJndC1pbnRlcmFjdGl2ZSIgPSBndDo6b3B0X2ludGVyYWN0aXZlKGd0OjpndCh4KSksCiAgICAgICAgICAgICAgInJlYWN0YWJsZSIgPSByZWFjdGFibGU6OnJlYWN0YWJsZSh4KSwKICAgICAgICAgICAgICB4CiAgICAgICAgICAgICkKICAgICAgICAgIH0gZWxzZSB4LAogICAgICAgIG9wdGlvbnMgPSBrbml0X29wdGlvbnMpCiAgICAgICkKICAgIH0gZWxzZSBsaXN0KHZhbHVlID0geCwgdmlzaWJsZSA9IEZBTFNFKQogICAgcmVzJGNsYXNzIDwtIGNsYXNzKHJlcyR2YWx1ZSkKICAgIGNsYXNzKHJlcykgPC0gInJlc3VsdCIKICAgIHJlcwogIH0KKSkKCiMgQWRkaXRpb25hbCBwYWNrYWdlIG9wdGlvbnMKb3B0aW9ucyhrbml0ci50YWJsZS5mb3JtYXQgPSAiaHRtbCIpCm9wdGlvbnMocmdsLnByaW50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gogICAgIyBFdmFsdWF0ZSBwcm92aWRlZCBjaGVjayBjb2RlCiAgICBldmFsKHBhcnNlZF9jaGVja19jb2RlKQogIH0sIGVycm9yID0gZnVuY3Rpb24oZSkgewogICAgbGlzdCgKICAgICAgbWVzc2FnZSA9IHBhc3RlMCgiRXJyb3IgaW4gY2hlY2tpbmcgY29kZSBmb3IgYCIsIGxhYmVsLCAiYDogIiwgZSRtZXNzYWdlKSwKICAgICAgY29ycmVjdCA9IEZBTFNFLAogICAgICBsb2NhdGlvbiA9ICJhcHBlbmQiLAogICAgICB0eXBlID0gIndhcm5pbmciCiAgICApCiAgfSkKfSkK"});var SO=me((nE,_k)=>{_k.exports="aW1wb3J0IHN5cwppbXBvcnQgb3MKaW1wb3J0IHB5b2RpZGVfaHR0cCAgIyB0eXBlOiBpZ25vcmVbYXR0ci1kZWZpbmVkXQpweW9kaWRlX2h0dHAucGF0Y2hfYWxsKCkKc3lzLnBhdGguaW5zZXJ0KDAsICIvcHlvZGlkZS8iKQpvcy5ta2Rpcihvcy5wYXRoLmV4cGFuZHVzZXIoIn4vLm1hdHBsb3RsaWIiKSkKZiA9IG9wZW4ob3MucGF0aC5leHBhbmR1c2VyKCJ+Ly5tYXRwbG90bGliL21hdHBsb3RsaWJyYyIpLCAiYSIpCmYud3JpdGUoImJhY2tlbmQ6IG1vZHVsZTovL21hdHBsb3RsaWJfZGlzcGxheSIpCmYuY2xvc2UoKQo="});var kO=me((sE,Dk)=>{Dk.exports="[encoded data, 18024 characters]"});var ya={};AO(ya,{ChannelType:()=>ai,Console:()=>C0,Shelter:()=>oa,WebR:()=>wu,WebRChannelError:()=>oi,WebRError:()=>hi,WebRPayloadError:()=>Cr,WebRWorkerError:()=>Vt,isRCall:()=>Un,isRCharacter:()=>Ni,isRComplex:()=>S0,isRDouble:()=>x0,isREnvironment:()=>b0,isRFunction:()=>Fn,isRInteger:()=>v0,isRList:()=>it,isRLogical:()=>w0,isRNull:()=>ke,isRObject:()=>J,isRPairlist:()=>y0,isRRaw:()=>Oa,isRSymbol:()=>O0,isShelterID:()=>JO});var MO=Object.create,Xh=Object.defineProperty,_O=Object.getOwnPropertyDescriptor,DO=Object.getOwnPropertyNames,LO=Object.getPrototypeOf,qO=Object.prototype.hasOwnProperty,fe=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),VO=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of DO(e))!qO.call(i,n)&&n!==t&&Xh(i,n,{get:()=>e[n],enumerable:!(r=_O(e,n))||r.enumerable});return i},Nh=(i,e,t)=>(t=i!=null?MO(LO(i)):{},VO(e||!i||!i.__esModule?Xh(t,"default",{value:i,enumerable:!0}):t,i)),$O=fe((i,e)=>{e.exports={_makeLong:"",basename:"",default:"",delimiter:"",dirname:"",extname:"",format:"",isAbsolute:"",join:"",matchesGlob:"",normalize:"",parse:"",posix:"",relative:"",resolve:"",sep:"",toNamespacedPath:"",win32:""}}),zn=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.getUint64=i.getInt64=i.setInt64=i.setUint64=i.UINT32_MAX=void 0,i.UINT32_MAX=4294967295;function e(s,o,a){let l=a/4294967296,c=a;s.setUint32(o,l),s.setUint32(o+4,c)}i.setUint64=e;function t(s,o,a){let l=Math.floor(a/4294967296),c=a;s.setUint32(o,l),s.setUint32(o+4,c)}i.setInt64=t;function r(s,o){let a=s.getInt32(o),l=s.getUint32(o+4);return a*4294967296+l}i.getInt64=r;function n(s,o){let a=s.getUint32(o),l=s.getUint32(o+4);return a*4294967296+l}i.getUint64=n}),aa=fe(i=>{"use strict";var e,t,r;Object.defineProperty(i,"__esModule",{value:!0}),i.utf8DecodeTD=i.TEXT_DECODER_THRESHOLD=i.utf8DecodeJs=i.utf8EncodeTE=i.TEXT_ENCODER_THRESHOLD=i.utf8EncodeJs=i.utf8Count=void 0;var n=zn(),s=(typeof process>"u"||((e=process==null?void 0:process.env)===null||e===void 0?void 0:e.TEXT_ENCODING)!=="never")&&typeof TextEncoder<"u"&&typeof TextDecoder<"u";function o(p){let g=p.length,O=0,y=0;for(;y<g;){let x=p.charCodeAt(y++);if((x&4294967168)===0){O++;continue}else if((x&4294965248)===0)O+=2;else{if(x>=55296&&x<=56319&&y<g){let v=p.charCodeAt(y);(v&64512)===56320&&(++y,x=((x&1023)<<10)+(v&1023)+65536)}(x&4294901760)===0?O+=3:O+=4}}return O}i.utf8Count=o;function a(p,g,O){let y=p.length,x=O,v=0;for(;v<y;){let w=p.charCodeAt(v++);if((w&4294967168)===0){g[x++]=w;continue}else if((w&4294965248)===0)g[x++]=w>>6&31|192;else{if(w>=55296&&w<=56319&&v<y){let T=p.charCodeAt(v);(T&64512)===56320&&(++v,w=((w&1023)<<10)+(T&1023)+65536)}(w&4294901760)===0?(g[x++]=w>>12&15|224,g[x++]=w>>6&63|128):(g[x++]=w>>18&7|240,g[x++]=w>>12&63|128,g[x++]=w>>6&63|128)}g[x++]=w&63|128}}i.utf8EncodeJs=a;var l=s?new TextEncoder:void 0;i.TEXT_ENCODER_THRESHOLD=s?typeof process<"u"&&((t=process==null?void 0:process.env)===null||t===void 0?void 0:t.TEXT_ENCODING)!=="force"?200:0:n.UINT32_MAX;function c(p,g,O){g.set(l.encode(p),O)}function h(p,g,O){l.encodeInto(p,g.subarray(O))}i.utf8EncodeTE=l?.encodeInto?h:c;var u=4096;function f(p,g,O){let y=g,x=y+O,v=[],w="";for(;y<x;){let T=p[y++];if((T&128)===0)v.push(T);else if((T&224)===192){let P=p[y++]&63;v.push((T&31)<<6|P)}else if((T&240)===224){let P=p[y++]&63,M=p[y++]&63;v.push((T&31)<<12|P<<6|M)}else if((T&248)===240){let P=p[y++]&63,M=p[y++]&63,q=p[y++]&63,L=(T&7)<<18|P<<12|M<<6|q;L>65535&&(L-=65536,v.push(L>>>10&1023|55296),L=56320|L&1023),v.push(L)}else v.push(T);v.length>=u&&(w+=String.fromCharCode(...v),v.length=0)}return v.length>0&&(w+=String.fromCharCode(...v)),w}i.utf8DecodeJs=f;var d=s?new TextDecoder:null;i.TEXT_DECODER_THRESHOLD=s?typeof process<"u"&&((r=process==null?void 0:process.env)===null||r===void 0?void 0:r.TEXT_DECODER)!=="force"?200:0:n.UINT32_MAX;function m(p,g,O){let y=p.subarray(g,g+O);return d.decode(y)}i.utf8DecodeTD=m}),jh=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ExtData=void 0;var e=class{constructor(t,r){this.type=t,this.data=r}};i.ExtData=e}),la=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.DecodeError=void 0;var e=class ia extends Error{constructor(r){super(r);let n=Object.create(ia.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:ia.name})}};i.DecodeError=e}),Ih=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.timestampExtension=i.decodeTimestampExtension=i.decodeTimestampToTimeSpec=i.encodeTimestampExtension=i.encodeDateToTimeSpec=i.encodeTimeSpecToTimestamp=i.EXT_TIMESTAMP=void 0;var e=la(),t=zn();i.EXT_TIMESTAMP=-1;var r=4294967296-1,n=17179869184-1;function s({sec:h,nsec:u}){if(h>=0&&u>=0&&h<=n)if(u===0&&h<=r){let f=new Uint8Array(4);return new DataView(f.buffer).setUint32(0,h),f}else{let f=h/4294967296,d=h&4294967295,m=new Uint8Array(8),p=new DataView(m.buffer);return p.setUint32(0,u<<2|f&3),p.setUint32(4,d),m}else{let f=new Uint8Array(12),d=new DataView(f.buffer);return d.setUint32(0,u),(0,t.setInt64)(d,4,h),f}}i.encodeTimeSpecToTimestamp=s;function o(h){let u=h.getTime(),f=Math.floor(u/1e3),d=(u-f*1e3)*1e6,m=Math.floor(d/1e9);return{sec:f+m,nsec:d-m*1e9}}i.encodeDateToTimeSpec=o;function a(h){if(h instanceof Date){let u=o(h);return s(u)}else return null}i.encodeTimestampExtension=a;function l(h){let u=new DataView(h.buffer,h.byteOffset,h.byteLength);switch(h.byteLength){case 4:return{sec:u.getUint32(0),nsec:0};case 8:{let f=u.getUint32(0),d=u.getUint32(4),m=(f&3)*4294967296+d,p=f>>>2;return{sec:m,nsec:p}}case 12:{let f=(0,t.getInt64)(u,4),d=u.getUint32(0);return{sec:f,nsec:d}}default:throw new e.DecodeError(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${h.length}`)}}i.decodeTimestampToTimeSpec=l;function c(h){let u=l(h);return new Date(u.sec*1e3+u.nsec/1e6)}i.decodeTimestampExtension=c,i.timestampExtension={type:i.EXT_TIMESTAMP,encode:a,decode:c}}),ca=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ExtensionCodec=void 0;var e=jh(),t=Ih(),r=class{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(t.timestampExtension)}register({type:n,encode:s,decode:o}){if(n>=0)this.encoders[n]=s,this.decoders[n]=o;else{let a=1+n;this.builtInEncoders[a]=s,this.builtInDecoders[a]=o}}tryToEncode(n,s){for(let o=0;o<this.builtInEncoders.length;o++){let a=this.builtInEncoders[o];if(a!=null){let l=a(n,s);if(l!=null){let c=-1-o;return new e.ExtData(c,l)}}}for(let o=0;o<this.encoders.length;o++){let a=this.encoders[o];if(a!=null){let l=a(n,s);if(l!=null){let c=o;return new e.ExtData(c,l)}}}return n instanceof e.ExtData?n:null}decode(n,s,o){let a=s<0?this.builtInDecoders[-1-s]:this.decoders[s];return a?a(n,s,o):new e.ExtData(s,n)}};i.ExtensionCodec=r,r.defaultCodec=new r}),Wh=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.createDataView=i.ensureUint8Array=void 0;function e(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r instanceof ArrayBuffer?new Uint8Array(r):Uint8Array.from(r)}i.ensureUint8Array=e;function t(r){if(r instanceof ArrayBuffer)return new DataView(r);let n=e(r);return new DataView(n.buffer,n.byteOffset,n.byteLength)}i.createDataView=t}),zh=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Encoder=i.DEFAULT_INITIAL_BUFFER_SIZE=i.DEFAULT_MAX_DEPTH=void 0;var e=aa(),t=ca(),r=zn(),n=Wh();i.DEFAULT_MAX_DEPTH=100,i.DEFAULT_INITIAL_BUFFER_SIZE=2048;var s=class{constructor(o=t.ExtensionCodec.defaultCodec,a=void 0,l=i.DEFAULT_MAX_DEPTH,c=i.DEFAULT_INITIAL_BUFFER_SIZE,h=!1,u=!1,f=!1,d=!1){this.extensionCodec=o,this.context=a,this.maxDepth=l,this.initialBufferSize=c,this.sortKeys=h,this.forceFloat32=u,this.ignoreUndefined=f,this.forceIntegerToFloat=d,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}reinitializeState(){this.pos=0}encodeSharedRef(o){return this.reinitializeState(),this.doEncode(o,1),this.bytes.subarray(0,this.pos)}encode(o){return this.reinitializeState(),this.doEncode(o,1),this.bytes.slice(0,this.pos)}doEncode(o,a){if(a>this.maxDepth)throw new Error(`Too deep objects in depth ${a}`);o==null?this.encodeNil():typeof o=="boolean"?this.encodeBoolean(o):typeof o=="number"?this.encodeNumber(o):typeof o=="string"?this.encodeString(o):this.encodeObject(o,a)}ensureBufferSizeToWrite(o){let a=this.pos+o;this.view.byteLength<a&&this.resizeBuffer(a*2)}resizeBuffer(o){let a=new ArrayBuffer(o),l=new Uint8Array(a),c=new DataView(a);l.set(this.bytes),this.view=c,this.bytes=l}encodeNil(){this.writeU8(192)}encodeBoolean(o){o===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(o){Number.isSafeInteger(o)&&!this.forceIntegerToFloat?o>=0?o<128?this.writeU8(o):o<256?(this.writeU8(204),this.writeU8(o)):o<65536?(this.writeU8(205),this.writeU16(o)):o<4294967296?(this.writeU8(206),this.writeU32(o)):(this.writeU8(207),this.writeU64(o)):o>=-32?this.writeU8(224|o+32):o>=-128?(this.writeU8(208),this.writeI8(o)):o>=-32768?(this.writeU8(209),this.writeI16(o)):o>=-2147483648?(this.writeU8(210),this.writeI32(o)):(this.writeU8(211),this.writeI64(o)):this.forceFloat32?(this.writeU8(202),this.writeF32(o)):(this.writeU8(203),this.writeF64(o))}writeStringHeader(o){if(o<32)this.writeU8(160+o);else if(o<256)this.writeU8(217),this.writeU8(o);else if(o<65536)this.writeU8(218),this.writeU16(o);else if(o<4294967296)this.writeU8(219),this.writeU32(o);else throw new Error(`Too long string: ${o} bytes in UTF-8`)}encodeString(o){if(o.length>e.TEXT_ENCODER_THRESHOLD){let a=(0,e.utf8Count)(o);this.ensureBufferSizeToWrite(5+a),this.writeStringHeader(a),(0,e.utf8EncodeTE)(o,this.bytes,this.pos),this.pos+=a}else{let a=(0,e.utf8Count)(o);this.ensureBufferSizeToWrite(5+a),this.writeStringHeader(a),(0,e.utf8EncodeJs)(o,this.bytes,this.pos),this.pos+=a}}encodeObject(o,a){let l=this.extensionCodec.tryToEncode(o,this.context);if(l!=null)this.encodeExtension(l);else if(Array.isArray(o))this.encodeArray(o,a);else if(ArrayBuffer.isView(o))this.encodeBinary(o);else if(typeof o=="object")this.encodeMap(o,a);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(o)}`)}encodeBinary(o){let a=o.byteLength;if(a<256)this.writeU8(196),this.writeU8(a);else if(a<65536)this.writeU8(197),this.writeU16(a);else if(a<4294967296)this.writeU8(198),this.writeU32(a);else throw new Error(`Too large binary: ${a}`);let l=(0,n.ensureUint8Array)(o);this.writeU8a(l)}encodeArray(o,a){let l=o.length;if(l<16)this.writeU8(144+l);else if(l<65536)this.writeU8(220),this.writeU16(l);else if(l<4294967296)this.writeU8(221),this.writeU32(l);else throw new Error(`Too large array: ${l}`);for(let c of o)this.doEncode(c,a+1)}countWithoutUndefined(o,a){let l=0;for(let c of a)o[c]!==void 0&&l++;return l}encodeMap(o,a){let l=Object.keys(o);this.sortKeys&&l.sort();let c=this.ignoreUndefined?this.countWithoutUndefined(o,l):l.length;if(c<16)this.writeU8(128+c);else if(c<65536)this.writeU8(222),this.writeU16(c);else if(c<4294967296)this.writeU8(223),this.writeU32(c);else throw new Error(`Too large map object: ${c}`);for(let h of l){let u=o[h];this.ignoreUndefined&&u===void 0||(this.encodeString(h),this.doEncode(u,a+1))}}encodeExtension(o){let a=o.data.length;if(a===1)this.writeU8(212);else if(a===2)this.writeU8(213);else if(a===4)this.writeU8(214);else if(a===8)this.writeU8(215);else if(a===16)this.writeU8(216);else if(a<256)this.writeU8(199),this.writeU8(a);else if(a<65536)this.writeU8(200),this.writeU16(a);else if(a<4294967296)this.writeU8(201),this.writeU32(a);else throw new Error(`Too large extension object: ${a}`);this.writeI8(o.type),this.writeU8a(o.data)}writeU8(o){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,o),this.pos++}writeU8a(o){let a=o.length;this.ensureBufferSizeToWrite(a),this.bytes.set(o,this.pos),this.pos+=a}writeI8(o){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,o),this.pos++}writeU16(o){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,o),this.pos+=2}writeI16(o){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,o),this.pos+=2}writeU32(o){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,o),this.pos+=4}writeI32(o){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,o),this.pos+=4}writeF32(o){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,o),this.pos+=4}writeF64(o){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,o),this.pos+=8}writeU64(o){this.ensureBufferSizeToWrite(8),(0,r.setUint64)(this.view,this.pos,o),this.pos+=8}writeI64(o){this.ensureBufferSizeToWrite(8),(0,r.setInt64)(this.view,this.pos,o),this.pos+=8}};i.Encoder=s}),BO=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.encode=void 0;var e=zh(),t={};function r(n,s=t){return new e.Encoder(s.extensionCodec,s.context,s.maxDepth,s.initialBufferSize,s.sortKeys,s.forceFloat32,s.ignoreUndefined,s.forceIntegerToFloat).encodeSharedRef(n)}i.encode=r}),XO=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.prettyByte=void 0;function e(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}i.prettyByte=e}),NO=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.CachedKeyDecoder=void 0;var e=aa(),t=16,r=16,n=class{constructor(s=t,o=r){this.maxKeyLength=s,this.maxLengthPerKey=o,this.hit=0,this.miss=0,this.caches=[];for(let a=0;a<this.maxKeyLength;a++)this.caches.push([])}canBeCached(s){return s>0&&s<=this.maxKeyLength}find(s,o,a){let l=this.caches[a-1];e:for(let c of l){let h=c.bytes;for(let u=0;u<a;u++)if(h[u]!==s[o+u])continue e;return c.str}return null}store(s,o){let a=this.caches[s.length-1],l={bytes:s,str:o};a.length>=this.maxLengthPerKey?a[Math.random()*a.length|0]=l:a.push(l)}decode(s,o,a){let l=this.find(s,o,a);if(l!=null)return this.hit++,l;this.miss++;let c=(0,e.utf8DecodeJs)(s,o,a),h=Uint8Array.prototype.slice.call(s,o,o+a);return this.store(h,c),c}};i.CachedKeyDecoder=n}),ha=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.Decoder=i.DataViewIndexOutOfBoundsError=void 0;var e=XO(),t=ca(),r=zn(),n=aa(),s=Wh(),o=NO(),a=la(),l=p=>{let g=typeof p;return g==="string"||g==="number"},c=-1,h=new DataView(new ArrayBuffer(0)),u=new Uint8Array(h.buffer);i.DataViewIndexOutOfBoundsError=(()=>{try{h.getInt8(0)}catch(p){return p.constructor}throw new Error("never reached")})();var f=new i.DataViewIndexOutOfBoundsError("Insufficient data"),d=new o.CachedKeyDecoder,m=class{constructor(p=t.ExtensionCodec.defaultCodec,g=void 0,O=r.UINT32_MAX,y=r.UINT32_MAX,x=r.UINT32_MAX,v=r.UINT32_MAX,w=r.UINT32_MAX,T=d){this.extensionCodec=p,this.context=g,this.maxStrLength=O,this.maxBinLength=y,this.maxArrayLength=x,this.maxMapLength=v,this.maxExtLength=w,this.keyDecoder=T,this.totalPos=0,this.pos=0,this.view=h,this.bytes=u,this.headByte=c,this.stack=[]}reinitializeState(){this.totalPos=0,this.headByte=c,this.stack.length=0}setBuffer(p){this.bytes=(0,s.ensureUint8Array)(p),this.view=(0,s.createDataView)(this.bytes),this.pos=0}appendBuffer(p){if(this.headByte===c&&!this.hasRemaining(1))this.setBuffer(p);else{let g=this.bytes.subarray(this.pos),O=(0,s.ensureUint8Array)(p),y=new Uint8Array(g.length+O.length);y.set(g),y.set(O,g.length),this.setBuffer(y)}}hasRemaining(p){return this.view.byteLength-this.pos>=p}createExtraByteError(p){let{view:g,pos:O}=this;return new RangeError(`Extra ${g.byteLength-O} of ${g.byteLength} byte(s) found at buffer[${p}]`)}decode(p){this.reinitializeState(),this.setBuffer(p);let g=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return g}*decodeMulti(p){for(this.reinitializeState(),this.setBuffer(p);this.hasRemaining(1);)yield this.doDecodeSync()}async decodeAsync(p){let g=!1,O;for await(let w of p){if(g)throw this.createExtraByteError(this.totalPos);this.appendBuffer(w);try{O=this.doDecodeSync(),g=!0}catch(T){if(!(T instanceof i.DataViewIndexOutOfBoundsError))throw T}this.totalPos+=this.pos}if(g){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return O}let{headByte:y,pos:x,totalPos:v}=this;throw new RangeError(`Insufficient data in parsing ${(0,e.prettyByte)(y)} at ${v} (${x} in the current buffer)`)}decodeArrayStream(p){return this.decodeMultiAsync(p,!0)}decodeStream(p){return this.decodeMultiAsync(p,!1)}async*decodeMultiAsync(p,g){let O=g,y=-1;for await(let x of p){if(g&&y===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(x),O&&(y=this.readArraySize(),O=!1,this.complete());try{for(;yield this.doDecodeSync(),--y!==0;);}catch(v){if(!(v instanceof i.DataViewIndexOutOfBoundsError))throw v}this.totalPos+=this.pos}}doDecodeSync(){e:for(;;){let p=this.readHeadByte(),g;if(p>=224)g=p-256;else if(p<192)if(p<128)g=p;else if(p<144){let y=p-128;if(y!==0){this.pushMapState(y),this.complete();continue e}else g={}}else if(p<160){let y=p-144;if(y!==0){this.pushArrayState(y),this.complete();continue e}else g=[]}else{let y=p-160;g=this.decodeUtf8String(y,0)}else if(p===192)g=null;else if(p===194)g=!1;else if(p===195)g=!0;else if(p===202)g=this.readF32();else if(p===203)g=this.readF64();else if(p===204)g=this.readU8();else if(p===205)g=this.readU16();else if(p===206)g=this.readU32();else if(p===207)g=this.readU64();else if(p===208)g=this.readI8();else if(p===209)g=this.readI16();else if(p===210)g=this.readI32();else if(p===211)g=this.readI64();else if(p===217){let y=this.lookU8();g=this.decodeUtf8String(y,1)}else if(p===218){let y=this.lookU16();g=this.decodeUtf8String(y,2)}else if(p===219){let y=this.lookU32();g=this.decodeUtf8String(y,4)}else if(p===220){let y=this.readU16();if(y!==0){this.pushArrayState(y),this.complete();continue e}else g=[]}else if(p===221){let y=this.readU32();if(y!==0){this.pushArrayState(y),this.complete();continue e}else g=[]}else if(p===222){let y=this.readU16();if(y!==0){this.pushMapState(y),this.complete();continue e}else g={}}else if(p===223){let y=this.readU32();if(y!==0){this.pushMapState(y),this.complete();continue e}else g={}}else if(p===196){let y=this.lookU8();g=this.decodeBinary(y,1)}else if(p===197){let y=this.lookU16();g=this.decodeBinary(y,2)}else if(p===198){let y=this.lookU32();g=this.decodeBinary(y,4)}else if(p===212)g=this.decodeExtension(1,0);else if(p===213)g=this.decodeExtension(2,0);else if(p===214)g=this.decodeExtension(4,0);else if(p===215)g=this.decodeExtension(8,0);else if(p===216)g=this.decodeExtension(16,0);else if(p===199){let y=this.lookU8();g=this.decodeExtension(y,1)}else if(p===200){let y=this.lookU16();g=this.decodeExtension(y,2)}else if(p===201){let y=this.lookU32();g=this.decodeExtension(y,4)}else throw new a.DecodeError(`Unrecognized type byte: ${(0,e.prettyByte)(p)}`);this.complete();let O=this.stack;for(;O.length>0;){let y=O[O.length-1];if(y.type===0)if(y.array[y.position]=g,y.position++,y.position===y.size)O.pop(),g=y.array;else continue e;else if(y.type===1){if(!l(g))throw new a.DecodeError("The type of key must be string or number but "+typeof g);if(g==="__proto__")throw new a.DecodeError("The key __proto__ is not allowed");y.key=g,y.type=2;continue e}else if(y.map[y.key]=g,y.readCount++,y.readCount===y.size)O.pop(),g=y.map;else{y.key=null,y.type=1;continue e}}return g}}readHeadByte(){return this.headByte===c&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=c}readArraySize(){let p=this.readHeadByte();switch(p){case 220:return this.readU16();case 221:return this.readU32();default:{if(p<160)return p-144;throw new a.DecodeError(`Unrecognized array type byte: ${(0,e.prettyByte)(p)}`)}}}pushMapState(p){if(p>this.maxMapLength)throw new a.DecodeError(`Max length exceeded: map length (${p}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.push({type:1,size:p,key:null,readCount:0,map:{}})}pushArrayState(p){if(p>this.maxArrayLength)throw new a.DecodeError(`Max length exceeded: array length (${p}) > maxArrayLength (${this.maxArrayLength})`);this.stack.push({type:0,size:p,array:new Array(p),position:0})}decodeUtf8String(p,g){var O;if(p>this.maxStrLength)throw new a.DecodeError(`Max length exceeded: UTF-8 byte length (${p}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+g+p)throw f;let y=this.pos+g,x;return this.stateIsMapKey()&&!((O=this.keyDecoder)===null||O===void 0)&&O.canBeCached(p)?x=this.keyDecoder.decode(this.bytes,y,p):p>n.TEXT_DECODER_THRESHOLD?x=(0,n.utf8DecodeTD)(this.bytes,y,p):x=(0,n.utf8DecodeJs)(this.bytes,y,p),this.pos+=g+p,x}stateIsMapKey(){return this.stack.length>0?this.stack[this.stack.length-1].type===1:!1}decodeBinary(p,g){if(p>this.maxBinLength)throw new a.DecodeError(`Max length exceeded: bin length (${p}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(p+g))throw f;let O=this.pos+g,y=this.bytes.subarray(O,O+p);return this.pos+=g+p,y}decodeExtension(p,g){if(p>this.maxExtLength)throw new a.DecodeError(`Max length exceeded: ext length (${p}) > maxExtLength (${this.maxExtLength})`);let O=this.view.getInt8(this.pos+g),y=this.decodeBinary(p,g+1);return this.extensionCodec.decode(y,O,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let p=this.view.getUint8(this.pos);return this.pos++,p}readI8(){let p=this.view.getInt8(this.pos);return this.pos++,p}readU16(){let p=this.view.getUint16(this.pos);return this.pos+=2,p}readI16(){let p=this.view.getInt16(this.pos);return this.pos+=2,p}readU32(){let p=this.view.getUint32(this.pos);return this.pos+=4,p}readI32(){let p=this.view.getInt32(this.pos);return this.pos+=4,p}readU64(){let p=(0,r.getUint64)(this.view,this.pos);return this.pos+=8,p}readI64(){let p=(0,r.getInt64)(this.view,this.pos);return this.pos+=8,p}readF32(){let p=this.view.getFloat32(this.pos);return this.pos+=4,p}readF64(){let p=this.view.getFloat64(this.pos);return this.pos+=8,p}};i.Decoder=m}),Uh=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.decodeMulti=i.decode=i.defaultDecodeOptions=void 0;var e=ha();i.defaultDecodeOptions={};function t(n,s=i.defaultDecodeOptions){return new e.Decoder(s.extensionCodec,s.context,s.maxStrLength,s.maxBinLength,s.maxArrayLength,s.maxMapLength,s.maxExtLength).decode(n)}i.decode=t;function r(n,s=i.defaultDecodeOptions){return new e.Decoder(s.extensionCodec,s.context,s.maxStrLength,s.maxBinLength,s.maxArrayLength,s.maxMapLength,s.maxExtLength).decodeMulti(n)}i.decodeMulti=r}),jO=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.ensureAsyncIterable=i.asyncIterableFromStream=i.isAsyncIterable=void 0;function e(s){return s[Symbol.asyncIterator]!=null}i.isAsyncIterable=e;function t(s){if(s==null)throw new Error("Assertion Failure: value must not be null nor undefined")}async function*r(s){let o=s.getReader();try{for(;;){let{done:a,value:l}=await o.read();if(a)return;t(l),yield l}}finally{o.releaseLock()}}i.asyncIterableFromStream=r;function n(s){return e(s)?s:r(s)}i.ensureAsyncIterable=n}),IO=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.decodeStream=i.decodeMultiStream=i.decodeArrayStream=i.decodeAsync=void 0;var e=ha(),t=jO(),r=Uh();async function n(l,c=r.defaultDecodeOptions){let h=(0,t.ensureAsyncIterable)(l);return new e.Decoder(c.extensionCodec,c.context,c.maxStrLength,c.maxBinLength,c.maxArrayLength,c.maxMapLength,c.maxExtLength).decodeAsync(h)}i.decodeAsync=n;function s(l,c=r.defaultDecodeOptions){let h=(0,t.ensureAsyncIterable)(l);return new e.Decoder(c.extensionCodec,c.context,c.maxStrLength,c.maxBinLength,c.maxArrayLength,c.maxMapLength,c.maxExtLength).decodeArrayStream(h)}i.decodeArrayStream=s;function o(l,c=r.defaultDecodeOptions){let h=(0,t.ensureAsyncIterable)(l);return new e.Decoder(c.extensionCodec,c.context,c.maxStrLength,c.maxBinLength,c.maxArrayLength,c.maxMapLength,c.maxExtLength).decodeStream(h)}i.decodeMultiStream=o;function a(l,c=r.defaultDecodeOptions){return o(l,c)}i.decodeStream=a}),WO=fe(i=>{"use strict";Object.defineProperty(i,"__esModule",{value:!0}),i.decodeTimestampExtension=i.encodeTimestampExtension=i.decodeTimestampToTimeSpec=i.encodeTimeSpecToTimestamp=i.encodeDateToTimeSpec=i.EXT_TIMESTAMP=i.ExtData=i.ExtensionCodec=i.Encoder=i.DataViewIndexOutOfBoundsError=i.DecodeError=i.Decoder=i.decodeStream=i.decodeMultiStream=i.decodeArrayStream=i.decodeAsync=i.decodeMulti=i.decode=i.encode=void 0;var e=BO();Object.defineProperty(i,"encode",{enumerable:!0,get:function(){return e.encode}});var t=Uh();Object.defineProperty(i,"decode",{enumerable:!0,get:function(){return t.decode}}),Object.defineProperty(i,"decodeMulti",{enumerable:!0,get:function(){return t.decodeMulti}});var r=IO();Object.defineProperty(i,"decodeAsync",{enumerable:!0,get:function(){return r.decodeAsync}}),Object.defineProperty(i,"decodeArrayStream",{enumerable:!0,get:function(){return r.decodeArrayStream}}),Object.defineProperty(i,"decodeMultiStream",{enumerable:!0,get:function(){return r.decodeMultiStream}}),Object.defineProperty(i,"decodeStream",{enumerable:!0,get:function(){return r.decodeStream}});var n=ha();Object.defineProperty(i,"Decoder",{enumerable:!0,get:function(){return n.Decoder}}),Object.defineProperty(i,"DataViewIndexOutOfBoundsError",{enumerable:!0,get:function(){return n.DataViewIndexOutOfBoundsError}});var s=la();Object.defineProperty(i,"DecodeError",{enumerable:!0,get:function(){return s.DecodeError}});var o=zh();Object.defineProperty(i,"Encoder",{enumerable:!0,get:function(){return o.Encoder}});var a=ca();Object.defineProperty(i,"ExtensionCodec",{enumerable:!0,get:function(){return a.ExtensionCodec}});var l=jh();Object.defineProperty(i,"ExtData",{enumerable:!0,get:function(){return l.ExtData}});var c=Ih();Object.defineProperty(i,"EXT_TIMESTAMP",{enumerable:!0,get:function(){return c.EXT_TIMESTAMP}}),Object.defineProperty(i,"encodeDateToTimeSpec",{enumerable:!0,get:function(){return c.encodeDateToTimeSpec}}),Object.defineProperty(i,"encodeTimeSpecToTimestamp",{enumerable:!0,get:function(){return c.encodeTimeSpecToTimestamp}}),Object.defineProperty(i,"decodeTimestampToTimeSpec",{enumerable:!0,get:function(){return c.decodeTimestampToTimeSpec}}),Object.defineProperty(i,"encodeTimestampExtension",{enumerable:!0,get:function(){return c.encodeTimestampExtension}}),Object.defineProperty(i,"decodeTimestampExtension",{enumerable:!0,get:function(){return c.decodeTimestampExtension}})}),zO=fe((i,e)=>{e.exports={Receiver:"",Sender:"",WebSocket:"",WebSocketServer:"",createWebSocketStream:"",default:""}}),Fh=fe((i,e)=>{e.exports={BroadcastChannel:"",MessageChannel:"",MessagePort:"",SHARE_ENV:"",Worker:"",default:"",getEnvironmentData:"",isMainThread:"",markAsUntransferable:"",moveMessagePortToContext:"",parentPort:"",postMessageToThread:"",receiveMessageOnPort:"",resourceLimits:"",setEnvironmentData:"",threadId:"",workerData:""}}),hi=class extends Error{constructor(i){super(i),this.name=this.constructor.name,Object.setPrototypeOf(this,new.target.prototype)}},Vt=class extends hi{},oi=class extends hi{},Cr=class extends hi{},_e=typeof process<"u"&&process.release&&process.release.name==="node",ea;if(globalThis.document)ea=i=>new Promise((e,t)=>{let r=document.createElement("script");r.src=i,r.onload=()=>e(),r.onerror=t,document.head.appendChild(r)});else if(globalThis.importScripts)ea=async i=>{try{globalThis.importScripts(i)}catch(e){if(e instanceof TypeError)await import(i);else throw e}};else if(_e)ea=async i=>{await import((await Promise.resolve().then(()=>Nh($O()))).default.resolve(i))};else throw new hi("Cannot determine runtime environment");var ht={null:0,symbol:1,pairlist:2,closure:3,environment:4,promise:5,call:6,special:7,builtin:8,string:9,logical:10,integer:13,double:14,complex:15,character:16,dots:17,any:18,list:19,expression:20,bytecode:21,pointer:22,weakref:23,raw:24,s4:25,new:30,free:31,function:99};function ua(i){return!!i&&typeof i=="object"&&Object.keys(ht).includes(i.type)}function Rr(i){return!!i&&typeof i=="object"&&"re"in i&&"im"in i}var S={};function UO(i){Object.keys(i).forEach(e=>S._free(i[e]))}function Nn(i){return S._Rf_protect(Tt(i)),i}function re(i,e){return S._Rf_protect(Tt(i)),++e.n,i}function FO(i){let e=S._malloc(4);return S._R_ProtectWithIndex(Tt(i),e),{loc:S.getValue(e,"i32"),ptr:e}}function HO(i){S._Rf_unprotect(1),S._free(i.ptr)}function GO(i,e){return S._R_Reprotect(Tt(i),e.loc),i}function pe(i){S._Rf_unprotect(i)}function Dh(i,e,t){S._Rf_defineVar(Tt(e),Tt(t),Tt(i))}function Lh(i,e){let t={},r={n:0};try{let n=new tu(e);re(n,r),t.code=S.allocateUTF8(i);let s=S._R_ParseEvalString(t.code,n.ptr);return W.wrap(s)}finally{UO(t),pe(r.n)}}function jn(i,e){return S.getWasmTableEntry(S.GOT.ffi_safe_eval.value)(Tt(i),Tt(e))}var YO=new WeakMap;function ZO(i,e){return YO.set(i,e),i}function JO(i){return typeof i=="string"&&i.length===Hh}var Hh=63;function Gh(){let i=Array.from({length:4},KO).join("-");if(i.length!==Hh)throw new Error("comlink internal error: UUID has the wrong length");return i}function KO(){let i=Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16),e=15-i.length;return e>0&&(i=Array.from({length:e},()=>0).join("")+i),i}function Tt(i){return In(i)?i.ptr:i}function ui(i,e){if(S._TYPEOF(i.ptr)!==ht[e])throw new Error(`Unexpected object type "${i.type()}" when expecting type "${e}"`)}function Yh(i){if(ua(i))return new(hu(i.type))(i);if(typeof i>"u")return new ra;if(i&&typeof i=="object"&&"type"in i&&i.type==="null")return new ra;if(i===null)return new Er({type:"logical",names:null,values:[null]});if(typeof i=="boolean")return new Er(i);if(typeof i=="number")return new ma(i);if(typeof i=="string")return new ci(i);if(Rr(i))return new su(i);if(ArrayBuffer.isView(i)||i instanceof ArrayBuffer)return new lu(i);if(Array.isArray(i))return e0(i);if(typeof i=="object")return da.fromObject(i);throw new Error("R object construction for this JS object is not yet supported.")}function e0(i){let e={n:0};if(i.every(t=>t&&typeof t=="object"&&!In(t)&&!Rr(t))){let t=i,r=t.every(s=>Object.keys(s).filter(o=>!Object.keys(t[0]).includes(o)).length===0&&Object.keys(t[0]).filter(o=>!Object.keys(s).includes(o)).length===0),n=t.every(s=>Object.values(s).every(o=>fu(o)||uu(o)));if(r&&n)return da.fromD3(t)}if(i.every(t=>typeof t=="boolean"||t===null))return new Er(i);if(i.every(t=>typeof t=="number"||t===null))return new ma(i);if(i.every(t=>typeof t=="string"||t===null))return new ci(i);try{let t=new $i([new ut("c"),...i]);return re(t,e),t.eval()}finally{pe(e.n)}}var ue=class{constructor(i){this.ptr=i}type(){let i=S._TYPEOF(this.ptr);return Object.keys(ht).find(e=>ht[e]===i)}},W=class Vi extends ue{constructor(e){if(!(e instanceof ue))return Yh(e);super(e.ptr)}static wrap(e){let t=S._TYPEOF(e),r=Object.keys(ht)[Object.values(ht).indexOf(t)];return new(hu(r))(new ue(e))}get[Symbol.toStringTag](){return`RObject:${this.type()}`}static getPersistentObject(e){return be[e]}getPropertyValue(e){return this[e]}inspect(){Lh(".Internal(inspect(x))",{x:this})}isNull(){return S._TYPEOF(this.ptr)===ht.null}isNa(){try{let e=Lh("is.na(x)",{x:this});return Nn(e),e.toBoolean()}finally{pe(1)}}isUnbound(){return this.ptr===be.unboundValue.ptr}attrs(){return fa.wrap(S._ATTRIB(this.ptr))}class(){let e={n:0},t=new $i([new ut("class"),this]);re(t,e);try{return t.eval()}finally{pe(e.n)}}setNames(e){let t;if(e===null)t=be.null;else if(Array.isArray(e)&&e.every(r=>typeof r=="string"||r===null))t=new ci(e);else throw new Error("Argument to setNames must be null or an Array of strings or null");return S._Rf_setAttrib(this.ptr,be.namesSymbol.ptr,t.ptr),this}names(){let e=ci.wrap(S._Rf_getAttrib(this.ptr,be.namesSymbol.ptr));return e.isNull()?null:e.toArray()}includes(e){let t=this.names();return t&&t.includes(e)}toJs(e={depth:0},t=1){throw new Error("This R object cannot be converted to JS")}subset(e){return this.#e(e,be.bracketSymbol.ptr)}get(e){return this.#e(e,be.bracket2Symbol.ptr)}getDollar(e){return this.#e(e,be.dollarSymbol.ptr)}#e(e,t){let r={n:0};try{let n=new Vi(e);re(n,r);let s=S._Rf_lang3(t,this.ptr,n.ptr);return re(s,r),Vi.wrap(jn(s,be.baseEnv))}finally{pe(r.n)}}pluck(...e){let t=FO(be.null);try{let r=(s,o)=>{let a=s.get(o);return GO(a,t)},n=e.reduce(r,this);return n.isNull()?void 0:n}finally{HO(t)}}set(e,t){let r={n:0};try{let n=new Vi(e);re(n,r);let s=new Vi(t);re(s,r);let o=new ut("[[<-"),a=S._Rf_lang4(o.ptr,this.ptr,n.ptr,s.ptr);return re(a,r),Vi.wrap(jn(a,be.baseEnv))}finally{pe(r.n)}}static getMethods(e){let t=new Set,r=e;do Object.getOwnPropertyNames(r).map(n=>t.add(n));while(r=Object.getPrototypeOf(r));return[...t.keys()].filter(n=>typeof e[n]=="function")}},ra=class extends W{constructor(){return super(new ue(S.getValue(S._R_NilValue,"*"))),this}toJs(){return{type:"null"}}},ut=class extends W{constructor(i){if(i instanceof ue){ui(i,"symbol"),super(i);return}let e=S.allocateUTF8(i);try{super(new ue(S._Rf_install(e)))}finally{S._free(e)}}toJs(){let i=this.toObject();return{type:"symbol",printname:i.printname,symvalue:i.symvalue,internal:i.internal}}toObject(){return{printname:this.printname().isUnbound()?null:this.printname().toString(),symvalue:this.symvalue().isUnbound()?null:this.symvalue().ptr,internal:this.internal().isNull()?null:this.internal().ptr}}toString(){return this.printname().toString()}printname(){return pa.wrap(S._PRINTNAME(this.ptr))}symvalue(){return W.wrap(S._SYMVALUE(this.ptr))}internal(){return W.wrap(S._INTERNAL(this.ptr))}},fa=class Zh extends W{constructor(e){if(e instanceof ue)return ui(e,"pairlist"),super(e),this;let t={n:0};try{let{names:r,values:n}=Xi(e),s=Zh.wrap(S._Rf_allocList(n.length));re(s,t);for(let[o,a]=[0,s];!a.isNull();[o,a]=[o+1,a.cdr()])a.setcar(new W(n[o]));s.setNames(r),super(s)}finally{pe(t.n)}}get length(){return this.toArray().length}toArray(e={depth:1}){return this.toJs(e).values}toObject({allowDuplicateKey:e=!0,allowEmptyKey:t=!1,depth:r=-1}={}){let n=this.entries({depth:r}),s=n.map(([o])=>o);if(!e&&new Set(s).size!==s.length)throw new Error("Duplicate key when converting pairlist without allowDuplicateKey enabled");if(!t&&s.some(o=>!o))throw new Error("Empty or null key when converting pairlist without allowEmptyKey enabled");return Object.fromEntries(n.filter((o,a)=>n.findIndex(l=>l[0]===o[0])===a))}entries(e={depth:1}){let t=this.toJs(e);return t.values.map((r,n)=>[t.names?t.names[n]:null,r])}toJs(e={depth:0},t=1){let r=[],n=!1,s=[];for(let o=this;!o.isNull();o=o.cdr()){let a=o.tag();a.isNull()?r.push(""):(n=!0,r.push(a.toString())),e.depth&&t>=e.depth?s.push(o.car()):s.push(o.car().toJs(e,t+1))}return{type:"pairlist",names:n?r:null,values:s}}includes(e){return e in this.toObject()}setcar(e){S._SETCAR(this.ptr,e.ptr)}car(){return W.wrap(S._CAR(this.ptr))}cdr(){return W.wrap(S._CDR(this.ptr))}tag(){return W.wrap(S._TAG(this.ptr))}},$i=class Jh extends W{constructor(e){if(e instanceof ue)return ui(e,"call"),super(e),this;let t={n:0};try{let{values:r}=Xi(e),n=r.map(o=>re(new W(o),t)),s=Jh.wrap(S._Rf_allocVector(ht.call,r.length));re(s,t);for(let[o,a]=[0,s];!a.isNull();[o,a]=[o+1,a.cdr()])a.setcar(n[o]);super(s)}finally{pe(t.n)}}setcar(e){S._SETCAR(this.ptr,e.ptr)}car(){return W.wrap(S._CAR(this.ptr))}cdr(){return W.wrap(S._CDR(this.ptr))}eval(){return S.webr.evalR(this,{env:be.baseEnv})}capture(e={}){return S.webr.captureR(this,e)}deparse(){let e={n:0};try{let t=S._Rf_lang2(new ut("deparse1").ptr,S._Rf_lang2(new ut("quote").ptr,this.ptr));re(t,e);let r=ci.wrap(jn(t,be.baseEnv));return re(r,e),r.toString()}finally{pe(e.n)}}},na=class Kh extends W{constructor(e,t=null){if(e instanceof ue){if(ui(e,"list"),super(e),t){if(t.length!==this.length)throw new Error("Can't construct named `RList`. Supplied `names` must be the same length as the list.");this.setNames(t)}return this}let r={n:0};try{let n=Xi(e),s=S._Rf_allocVector(ht.list,n.values.length);re(s,r),n.values.forEach((a,l)=>{n0(a)?S._SET_VECTOR_ELT(s,l,new Kh(a).ptr):S._SET_VECTOR_ELT(s,l,new W(a).ptr)});let o=t||n.names;if(o&&o.length!==n.values.length)throw new Error("Can't construct named `RList`. Supplied `names` must be the same length as the list.");W.wrap(s).setNames(o),super(new ue(s))}finally{pe(r.n)}}get length(){return S._LENGTH(this.ptr)}isDataFrame(){let e=fa.wrap(S._ATTRIB(this.ptr)).get("class");return!e.isNull()&&e.toArray().includes("data.frame")}toArray(e={depth:1}){return this.toJs(e).values}toObject({allowDuplicateKey:e=!0,allowEmptyKey:t=!1,depth:r=-1}={}){let n=this.entries({depth:r}),s=n.map(([o])=>o);if(!e&&new Set(s).size!==s.length)throw new Error("Duplicate key when converting list without allowDuplicateKey enabled");if(!t&&s.some(o=>!o))throw new Error("Empty or null key when converting list without allowEmptyKey enabled");return Object.fromEntries(n.filter((o,a)=>n.findIndex(l=>l[0]===o[0])===a))}toD3(){if(!this.isDataFrame())throw new Error("Can't convert R list object to D3 format. Object must be of class 'data.frame'.");return this.entries().reduce((e,t)=>(t[1].forEach((r,n)=>e[n]=Object.assign(e[n]||{},{[t[0]]:r})),e),[])}entries(e={depth:-1}){let t=this.toJs(e);return this.isDataFrame()&&e.depth<0&&(t.values=t.values.map(r=>r.toArray())),t.values.map((r,n)=>[t.names?t.names[n]:null,r])}toJs(e={depth:0},t=1){return{type:"list",names:this.names(),values:[...Array(this.length).keys()].map(r=>e.depth&&t>=e.depth?this.get(r+1):this.get(r+1).toJs(e,t+1))}}},da=class sa extends na{constructor(e){if(e instanceof ue){if(super(e),!this.isDataFrame())throw new Error("Can't construct `RDataFrame`. Supplied R object is not a `data.frame`.");return this}return sa.fromObject(e)}static fromObject(e){let{names:t,values:r}=Xi(e),n={n:0};try{let s=!!t&&t.length>0&&t.every(a=>a),o=r.length>0&&r.every(a=>Array.isArray(a)||ArrayBuffer.isView(a)||a instanceof ArrayBuffer);if(s&&o){let a=r,l=a.every(h=>h.length===a[0].length),c=a.every(h=>fu(h[0])||uu(h[0]));if(l&&c){let h=new na({type:"list",names:t,values:a.map(f=>Yh(f))});re(h,n);let u=new $i([new ut("as.data.frame"),h]);return re(u,n),new sa(u.eval())}}}finally{pe(n.n)}throw new Error("Can't construct `data.frame`. Source object is not eligible.")}static fromD3(e){return this.fromObject(Object.fromEntries(Object.keys(e[0]).map(t=>[t,e.map(r=>r[t])])))}},Xn=class extends W{exec(...i){let e={n:0};try{let t=new $i([this,...i]);return re(t,e),t.eval()}finally{pe(e.n)}}capture(i={},...e){let t={n:0};try{let r=new $i([this,...e]);return re(r,t),r.capture(i)}finally{pe(t.n)}}},pa=class eu extends W{static{this.CEType={CE_NATIVE:0,CE_UTF8:1,CE_LATIN1:2,CE_BYTES:3,CE_SYMBOL:5,CE_ANY:99}}constructor(e){if(e instanceof ue){ui(e,"string"),super(e);return}let t=S.allocateUTF8(e);try{super(new ue(S._Rf_mkCharCE(t,eu.CEType.CE_UTF8)))}finally{S._free(t)}}toString(){let e=S._vmaxget();try{return S.UTF8ToString(S._Rf_translateCharUTF8(this.ptr))}finally{S._vmaxset(e)}}toJs(){return{type:"string",value:this.toString()}}},tu=class extends W{constructor(i={}){if(i instanceof ue)return ui(i,"environment"),super(i),this;let e=0;try{let{names:t,values:r}=Xi(i),n=Nn(S._R_NewEnv(be.globalEnv.ptr,0,0));++e,r.forEach((s,o)=>{let a=t?t[o]:null;if(!a)throw new Error("Can't create object in new environment with empty symbol name");let l=new ut(a),c=Nn(new W(s));try{Dh(n,l,c)}finally{pe(1)}}),super(new ue(n))}finally{pe(e)}}ls(i=!1,e=!0){return ci.wrap(S._R_lsInternal3(this.ptr,Number(i),Number(e))).toArray()}bind(i,e){let t=new ut(i),r=Nn(new W(e));try{Dh(this,t,r)}finally{pe(1)}}names(){return this.ls(!0,!0)}frame(){return W.wrap(S._FRAME(this.ptr))}subset(i){if(typeof i=="number")throw new Error("Object of type environment is not subsettable");return this.getDollar(i)}toObject({depth:i=-1}={}){let e=this.names();return Object.fromEntries([...Array(e.length).keys()].map(t=>{let r=this.getDollar(e[t]);return[e[t],i<0?r:r.toJs({depth:i})]}))}toJs(i={depth:0},e=1){let t=this.names(),r=[...Array(t.length).keys()].map(n=>i.depth&&e>=i.depth?this.getDollar(t[n]):this.getDollar(t[n]).toJs(i,e+1));return{type:"environment",names:t,values:r}}},Bi=class extends W{constructor(i,e,t){if(i instanceof ue)return ui(i,e),super(i),this;let r={n:0};try{let{names:n,values:s}=Xi(i),o=S._Rf_allocVector(ht[e],s.length);re(o,r),s.forEach(t(o)),W.wrap(o).setNames(n),super(new ue(o))}finally{pe(r.n)}}get length(){return S._LENGTH(this.ptr)}get(i){return super.get(i)}subset(i){return super.subset(i)}getDollar(){throw new Error("$ operator is invalid for atomic vectors")}detectMissing(){let i={n:0};try{let e=S._Rf_lang2(new ut("is.na").ptr,this.ptr);re(e,i);let t=Er.wrap(jn(e,be.baseEnv));re(t,i);let r=t.toTypedArray();return Array.from(r).map(n=>!!n)}finally{pe(i.n)}}toArray(){let i=this.toTypedArray();return this.detectMissing().map((e,t)=>e?null:i[t])}toObject({allowDuplicateKey:i=!0,allowEmptyKey:e=!1}={}){let t=this.entries(),r=t.map(([n])=>n);if(!i&&new Set(r).size!==r.length)throw new Error("Duplicate key when converting atomic vector without allowDuplicateKey enabled");if(!e&&r.some(n=>!n))throw new Error("Empty or null key when converting atomic vector without allowEmptyKey enabled");return Object.fromEntries(t.filter((n,s)=>t.findIndex(o=>o[0]===n[0])===s))}entries(){let i=this.toArray(),e=this.names();return i.map((t,r)=>[e?e[r]:null,t])}toJs(){return{type:this.type(),names:this.names(),values:this.toArray()}}},Er=class iu extends Bi{constructor(e){super(e,"logical",iu.#e)}static#e=e=>{let t=S._LOGICAL(e),r=S.getValue(S._R_NaInt,"i32");return(n,s)=>{S.setValue(t+4*s,n===null?r:!!n,"i32")}};getBoolean(e){return this.get(e).toArray()[0]}toBoolean(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getBoolean(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS boolean");return e}toTypedArray(){return new Int32Array(S.HEAP32.subarray(S._LOGICAL(this.ptr)/4,S._LOGICAL(this.ptr)/4+this.length))}toArray(){let e=this.toTypedArray();return this.detectMissing().map((t,r)=>t?null:!!e[r])}},t0=class ru extends Bi{constructor(e){super(e,"integer",ru.#e)}static#e=e=>{let t=S._INTEGER(e),r=S.getValue(S._R_NaInt,"i32");return(n,s)=>{S.setValue(t+4*s,n===null?r:Math.round(Number(n)),"i32")}};getNumber(e){return this.get(e).toArray()[0]}toNumber(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getNumber(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS number");return e}toTypedArray(){return new Int32Array(S.HEAP32.subarray(S._INTEGER(this.ptr)/4,S._INTEGER(this.ptr)/4+this.length))}},ma=class nu extends Bi{constructor(e){super(e,"double",nu.#e)}static#e=e=>{let t=S._REAL(e),r=S.getValue(S._R_NaReal,"double");return(n,s)=>{S.setValue(t+8*s,n===null?r:n,"double")}};getNumber(e){return this.get(e).toArray()[0]}toNumber(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getNumber(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS number");return e}toTypedArray(){return new Float64Array(S.HEAPF64.subarray(S._REAL(this.ptr)/8,S._REAL(this.ptr)/8+this.length))}},su=class ou extends Bi{constructor(e){super(e,"complex",ou.#e)}static#e=e=>{let t=S._COMPLEX(e),r=S.getValue(S._R_NaReal,"double");return(n,s)=>{S.setValue(t+8*(2*s),n===null?r:n.re,"double"),S.setValue(t+8*(2*s+1),n===null?r:n.im,"double")}};getComplex(e){return this.get(e).toArray()[0]}toComplex(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getComplex(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS object");return e}toTypedArray(){return new Float64Array(S.HEAPF64.subarray(S._COMPLEX(this.ptr)/8,S._COMPLEX(this.ptr)/8+2*this.length))}toArray(){let e=this.toTypedArray();return this.detectMissing().map((t,r)=>t?null:{re:e[2*r],im:e[2*r+1]})}},ci=class au extends Bi{constructor(e){super(e,"character",au.#e)}static#e=e=>(t,r)=>{t===null?S._SET_STRING_ELT(e,r,be.naString.ptr):S._SET_STRING_ELT(e,r,new pa(t).ptr)};getString(e){return this.get(e).toArray()[0]}toString(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getString(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS string");return e}toTypedArray(){return new Uint32Array(S.HEAPU32.subarray(S._STRING_PTR(this.ptr)/4,S._STRING_PTR(this.ptr)/4+this.length))}toArray(){let e=S._vmaxget();try{return this.detectMissing().map((t,r)=>t?null:S.UTF8ToString(S._Rf_translateCharUTF8(S._STRING_ELT(this.ptr,r))))}finally{S._vmaxset(e)}}},lu=class cu extends Bi{constructor(e){e instanceof ArrayBuffer&&(e=new Uint8Array(e)),super(e,"raw",cu.#e)}static#e=e=>{let t=S._RAW(e);return(r,n)=>{S.setValue(t+n,Number(r),"i8")}};getNumber(e){return this.get(e).toArray()[0]}toNumber(){if(this.length!==1)throw new Error("Can't convert atomic vector of length > 1 to a scalar JS value");let e=this.getNumber(1);if(e===null)throw new Error("Can't convert missing value `NA` to a JS number");return e}toTypedArray(){return new Uint8Array(S.HEAPU8.subarray(S._RAW(this.ptr),S._RAW(this.ptr)+this.length))}};function Xi(i){return ua(i)?i:Array.isArray(i)||ArrayBuffer.isView(i)?{names:null,values:i}:i&&typeof i=="object"&&!Rr(i)?{names:Object.keys(i),values:Object.values(i)}:{names:null,values:[i]}}function hu(i){let e={object:W,null:ra,symbol:ut,pairlist:fa,closure:Xn,environment:tu,call:$i,special:Xn,builtin:Xn,string:pa,logical:Er,integer:t0,double:ma,complex:su,character:ci,list:na,raw:lu,function:Xn,dataframe:da};return i in e?e[i]:W}function In(i){return i instanceof W}function uu(i){let e=["logical","integer","double","complex","character"];return In(i)&&e.includes(i.type())||In(i)&&i.isNa()}function fu(i){return i===null||typeof i=="number"||typeof i=="boolean"||typeof i=="string"||Rr(i)}var be;function Wn(){let i={resolve:()=>{},reject:()=>{},promise:Promise.resolve()},e=new Promise((t,r)=>{i.resolve=t,i.reject=r});return i.promise=e,i}function i0(i){return new Promise(e=>setTimeout(e,i))}function $t(i,e,t,...r){return i==null||r0(i)?i:i instanceof ArrayBuffer?new Uint8Array(i):e(i)?t(i,...r):Array.isArray(i)||ArrayBuffer.isView(i)?i.map(n=>$t(n,e,t,...r)):i instanceof ue?i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,s])=>[n,$t(s,e,t,...r)])):i}function ga(i,e,t,r,n=!0){let s=new XMLHttpRequest;s.open("get",i,n),s.onload=()=>{if(s.status>=200&&s.status<300)try{let o=new Worker(URL.createObjectURL(new Blob([s.responseText])),r);e(o)}catch(o){if(t)t(o instanceof Error?o:new Error(String(o)));else throw o}else t?t(new Error(`Worker loading error: HTTP ${s.status}`)):console.error(`HTTP Error: ${s.status}`)},s.onerror=()=>{t?t(new Error(`Network error loading ${i}`)):console.error(`Network error loading ${i}`)},s.send()}function du(i){if(_e)return!1;let e=new URL(location.href),t=new URL(i,location.origin);return!(e.host===t.host&&e.port===t.port&&e.protocol===t.protocol)}function r0(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}function n0(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&!ArrayBuffer.isView(i)&&!Rr(i)&&!ua(i)&&!(i instanceof Date)&&!(i instanceof RegExp)&&!(i instanceof Error)&&!(i instanceof ue)&&Object.getPrototypeOf(i)===Object.prototype}var s0=Nh(WO()),o0=new TextEncoder;async function qi(i,e,t){try{let{taskId:r,sizeBuffer:n,dataBuffer:s,signalBuffer:o}=e,a=(0,s0.encode)(t),l=a.length<=s.length;if(Atomics.store(n,0,a.length),Atomics.store(n,1,+l),!l){let[c,h]=a0(i);s.set(o0.encode(c)),await qh(o,r),s=(await h).dataBuffer}s.set(a),Atomics.store(n,1,1),await qh(o,r)}catch(r){console.warn(r)}}function a0(i){let e=Gh();return[e,new Promise(t=>{_e?i.once("message",r=>{!r.id||r.id!==e||t(r)}):i.addEventListener("message",function r(n){!n.data||!n.data.id||n.data.id!==e||(i.removeEventListener("message",r),t(n.data))}),i.start&&i.start()})]}async function qh(i,e){let t=(e>>1)%32,r=1;for(;Atomics.compareExchange(i,t+1,0,e)!==0;)await i0(r),r<32&&(r*=2);Atomics.or(i,0,1<<t),Atomics.notify(i,0)}var ta=class{#e;#t;constructor(){this.#t=[],this.#e=[]}reset(){this.#t=[],this.#e=[]}put(i){this.#t.length||this.#i(),this.#t.shift()(i)}async get(){return this.#e.length||this.#i(),this.#e.shift()}isEmpty(){return!this.#e.length}isBlocked(){return!!this.#t.length}get length(){return this.#e.length-this.#t.length}#i(){this.#e.push(new Promise(i=>{this.#t.push(i)}))}};function l0(i,e){return pu({type:"request",data:{uuid:Gh(),msg:i}},e)}function c0(i,e,t){return pu({type:"response",data:{uuid:i,resp:e}},t)}function pu(i,e){return e&&ZO(i,e),i}function h0(i){let e=new Vt(i.obj.message);return i.obj.name=="ErrnoError"?e.message=`ErrnoError: ${String(i.obj.errno)}`:i.obj.name!=="Error"&&(e.name=i.obj.name),e.stack=i.obj.stack,e}function u0(i){return!!i&&typeof i=="object"&&"payloadType"in i&&"obj"in i}function mu(i){return u0(i)&&i.payloadType==="ptr"}var gu=class{constructor(){this.inputQueue=new ta,this.outputQueue=new ta,this.systemQueue=new ta,this.eventQueue=new Array,this.#e=new Map,this.#t=!1}#e;#t;async read(){return await this.outputQueue.get()}async flush(){let i=[];for(;!this.outputQueue.isEmpty();)i.push(await this.read());return i}async readSystem(){return await this.systemQueue.get()}write(i){if(this.#t)throw new oi("The webR communication channel has been closed.");this.inputQueue.put(i)}async request(i,e){let t=l0(i,e),{resolve:r,reject:n,promise:s}=Wn();return this.#e.set(t.data.uuid,{resolve:r,reject:n}),this.write(t),s}putClosedMessage(){this.#t=!0,this.outputQueue.put({type:"closed"})}resolveResponse(i){let e=i.data.uuid,t=this.#e.get(e);if(t){let r=i.data.resp.data;this.#e.delete(e),r.payloadType==="err"?t.reject(h0(r)):t.resolve(r)}else console.warn("Can't find request.")}},Bk=new TextDecoder("utf-8"),Xk=new Int32Array(new ArrayBuffer(4)),f0=class{constructor(i){this.chan=i,this.WebSocket=_e?zO():WebSocket}#e=new Map;new(i,e,t){let r=new this.WebSocket(e,t||[]);r.binaryType="arraybuffer",r.addEventListener("open",()=>{this.chan.emit({type:"websocket-open",data:{uuid:i}})}),r.addEventListener("message",n=>{let s=new Uint8Array(n.data);this.chan.emit({type:"websocket-message",data:{uuid:i,data:s}})}),r.addEventListener("close",n=>{this.chan.emit({type:"websocket-close",data:{uuid:i,code:n.code,reason:n.reason}})}),r.addEventListener("error",()=>{this.chan.emit({type:"websocket-error",data:{uuid:i}})}),this.#e.set(i,r)}send(i,e){this.#e.get(i)?.send(e)}close(i,e,t){this.#e.get(i)?.close(e,t),this.#e.delete(i)}};_e&&(globalThis.CloseEvent=class extends Event{constructor(i,e={}){super(i,e),this.wasClean=e.wasClean||!1,this.code=e.code||0,this.reason=e.reason||""}});var d0=class{constructor(i){this.chan=i}#e=new Map;new(i,e,t){if(_e){let r=new Worker(e,t),n=r;n.on("message",s=>{this.chan.emit({type:"worker-message",data:{uuid:i,data:s}})}),n.on("messageerror",s=>{this.chan.emit({type:"worker-messageerror",data:{uuid:i,data:s}})}),n.on("error",()=>{this.chan.emit({type:"worker-error",data:{uuid:i}})}),this.#e.set(i,r)}else ga(e,r=>{r.addEventListener("message",n=>{this.chan.emit({type:"worker-message",data:{uuid:i,data:n.data}})}),r.addEventListener("messageerror",n=>{this.chan.emit({type:"worker-messageerror",data:{uuid:i,data:n.data}})}),r.addEventListener("error",()=>{this.chan.emit({type:"worker-error",data:{uuid:i}})}),this.#e.set(i,r)},r=>{throw r},t,!1)}postMessage(i){let{uuid:e,async:t,handles:r,data:n,transfer:s}=i.data,o=this.#e.get(e);if(!o)throw new Error(`Worker with uuid ${e} not found`);if(!t&&r){let a=l=>{let c=l.data.uuid,h=l.data.result,u=l.data.error;c===e&&(u?r.reject(new Error(u)):r.resolve(h),o.removeEventListener("message",a))};o.addEventListener("message",a)}o.postMessage({uuid:e,data:n},{transfer:s})}terminate(i){this.#e.get(i)?.terminate(),this.#e.delete(i)}};_e&&(globalThis.Worker=Fh().Worker);var Vh=class extends gu{constructor(i){super(),this.close=()=>{},this.#i=async(t,r)=>{if(!(!r||!r.type))switch(r.type){case"resolve":this.#e=new Int32Array(r.data),this.resolve();return;case"response":this.resolveResponse(r);return;case"system":this.systemQueue.put(r.data);return;default:this.outputQueue.put(r);return;case"sync-request":{let n=r,s=n.data.msg,o=n.data.reqData;switch(s.type){case"read":{let a=await this.inputQueue.get();await qi(t,o,a);break}case"event":{let a=this.eventQueue.shift();await qi(t,o,a);break}case"eval-await":{let a=s.data,l={};try{l.result=await(0,eval)(a),typeof l.result=="function"&&(l.result=String(l.result))}catch(c){let h=c;l.error=h.message}await qi(t,o,{type:"eval-response",data:l});break}case"post-message-worker":{let a=s.data;a.handles=Wn(),this.systemQueue.put({type:"postMessageWorker",data:a}),a.async?await qi(t,o,{type:"post-message-response"}):a.handles.promise.then(l=>{qi(t,o,{type:"post-message-response",data:{result:l}})},l=>{qi(t,o,{type:"post-message-response",data:{error:String(l)}})});break}default:throw new oi(`Unsupported request type '${s.type}'.`)}return}case"request":throw new oi("Can't send messages of type 'request' from a worker. Please Use 'sync-request' instead.")}},{resolve:this.resolve,reject:this.reject,promise:this.initialised}=Wn();let e=t=>{this.#t(t),this.close=()=>{t.terminate(),this.putClosedMessage()};let r={type:"init",data:{config:i,channelType:ai.SharedArrayBuffer}};t.postMessage(r)};if(du(i.baseUrl))ga(`${i.baseUrl}webr-worker.js`,t=>e(t),t=>{this.reject(new Vt(`Worker loading error: ${t.message}`))});else{let t=new Worker(`${i.baseUrl}webr-worker.js`);e(t)}}#e;emit(i){if(!this.#e)throw new oi("Failed attempt to interrupt before initialising interruptBuffer");this.eventQueue.push({type:"event",data:{msg:i}}),this.#e[0]=1}interrupt(){this.inputQueue.reset(),this.emit({type:"interrupt"})}#t(i){_e?(i.on("message",e=>{this.#i(i,e)}),i.on("error",e=>{let t=e instanceof Error?e.message:String(e);console.error(t),this.reject(new Vt(`An error occurred initialising the webR SharedBufferChannel worker: ${t}.`))})):(i.onmessage=e=>this.#i(i,e.data),i.onerror=e=>{let t=e instanceof Error?e.message:String(e);console.error(t),this.reject(new Vt(`An error occurred initialising the webR SharedBufferChannel worker: ${t}.`))})}#i};_e&&(globalThis.Worker=Fh().Worker);var $h=class extends gu{constructor(i){super(),this.close=()=>{},this.emit=()=>{},this.#i=async(t,r)=>{if(!(!r||!r.type))switch(r.type){case"resolve":this.resolve();return;case"response":this.resolveResponse(r);return;case"system":this.systemQueue.put(r.data);return;default:this.outputQueue.put(r);return;case"request":{let n=r,s=n.data.msg;switch(s.type){case"read":{let o=await this.inputQueue.get();if(this.#e){let a=c0(n.data.uuid,o);this.#e.postMessage(a)}break}default:throw new oi(`Unsupported request type '${s.type}'.`)}return}case"sync-request":throw new oi("Can't send messages of type 'sync-request' in PostMessage mode. Use 'request' instead.")}},{resolve:this.resolve,reject:this.reject,promise:this.initialised}=Wn();let e=t=>{this.#e=t,this.#t(t),this.close=()=>{t.terminate(),this.putClosedMessage()};let r={type:"init",data:{config:i,channelType:ai.PostMessage}};t.postMessage(r)};if(du(i.baseUrl))ga(`${i.baseUrl}webr-worker.js`,t=>e(t),t=>{this.reject(new Vt(`Worker loading error: ${t.message}`))});else{let t=new Worker(`${i.baseUrl}webr-worker.js`);e(t)}}#e;interrupt(){console.error("Interrupting R execution is not available when using the PostMessage channel")}#t(i){_e?(i.on("message",e=>{this.#i(i,e)}),i.on("error",e=>{console.error(e),this.reject(new Vt("An error occurred initialising the webR PostMessageChannel worker."))})):(i.onmessage=e=>this.#i(i,e.data),i.onerror=e=>{console.error(e),this.reject(new Vt("An error occurred initialising the webR PostMessageChannel worker."))})}#i},ai={Automatic:0,SharedArrayBuffer:1,PostMessage:3};function p0(i){switch(i.channelType){case ai.SharedArrayBuffer:return new Vh(i);case ai.PostMessage:return new $h(i);case ai.Automatic:default:return typeof SharedArrayBuffer<"u"?new Vh(i):new $h(i)}}var m0=_e?__dirname+"/":"https://webr.r-wasm.org/v0.5.8/",g0="https://repo.r-wasm.org",Ou="0.5.8",yu="4.5.1";function J(i){return!!i&&(typeof i=="object"||typeof i=="function")&&"payloadType"in i&&mu(i._payload)}function ke(i){return J(i)&&i._payload.obj.type==="null"}function O0(i){return J(i)&&i._payload.obj.type==="symbol"}function y0(i){return J(i)&&i._payload.obj.type==="pairlist"}function b0(i){return J(i)&&i._payload.obj.type==="environment"}function w0(i){return J(i)&&i._payload.obj.type==="logical"}function v0(i){return J(i)&&i._payload.obj.type==="integer"}function x0(i){return J(i)&&i._payload.obj.type==="double"}function S0(i){return J(i)&&i._payload.obj.type==="complex"}function Ni(i){return J(i)&&i._payload.obj.type==="character"}function it(i){return J(i)&&i._payload.obj.type==="list"}function Oa(i){return J(i)&&i._payload.obj.type==="raw"}function Un(i){return J(i)&&i._payload.obj.type==="call"}function Fn(i){return!!(J(i)&&i._payload.obj.methods?.includes("exec"))}function k0(){}function T0(i,e){return async function*(){let t={type:"callRObjectMethod",data:{payload:e._payload,prop:"getPropertyValue",args:[{payloadType:"raw",obj:"length"}],shelter:void 0}},r=await i.request(t);if(typeof r.obj!="number")throw new hi("Cannot iterate over object, unexpected type for length property.");for(let n=1;n<=r.obj;n++)yield e.get(n)}}function bu(i,e,t){return async(...r)=>{let n=r.map(a=>J(a)?a._payload:{obj:$t(a,J,l=>l._payload),payloadType:"raw"}),s={type:"callRObjectMethod",data:{payload:t,prop:e,args:n}},o=await i.request(s);switch(o.payloadType){case"ptr":return li(i,o);case"raw":return $t(o,mu,(a,l)=>li(l,a),i).obj}}}async function P0(i,e,t,...r){let n={type:"newRObject",data:{objType:e,args:$t(r,J,o=>o._payload),shelter:t}},s=await i.request(n);switch(s.payloadType){case"raw":throw new Cr("Unexpected raw payload type returned from newRObject");case"ptr":return li(i,s)}}function li(i,e){let t=new Proxy(e.obj.methods?.includes("exec")?Object.assign(k0,{...e}):e,{get:(r,n)=>{if(n==="_payload")return e;if(n===Symbol.asyncIterator)return T0(i,t);if(e.obj.methods?.includes(n.toString()))return bu(i,n.toString(),e)},apply:async(r,n,s)=>{let o=await li(i,e).exec(...s);return Fn(o)?o:o.toJs()}});return t}function Me(i,e,t){return new Proxy(W,{construct:(r,n)=>P0(i,t,e,...n),get:(r,n)=>bu(i,n.toString())})}var C0=class{#e;#t;#i;#r;#n;constructor(i={},e={REnv:{R_HOME:"/usr/lib/R",FONTCONFIG_PATH:"/etc/fonts",R_ENABLE_JIT:"0"}}){this.webR=new wu(e),_e||(this.canvas=document.createElement("canvas"),this.canvas.setAttribute("width","1008"),this.canvas.setAttribute("height","1008")),this.#e=i.stdout||this.#s,this.#t=i.stderr||this.#o,this.#i=i.prompt||this.#a,this.#r=i.canvasImage||this.#l,this.#n=i.canvasNewPage||this.#c,this.webR.evalRVoid("options(device=webr::canvas)")}stdin(i){this.webR.writeConsole(i)}interrupt(){this.webR.interrupt()}#s=i=>{console.log(i)};#o=i=>{console.error(i)};#a=i=>{let e=prompt(i);e&&this.stdin(`${e}
`)};#l=i=>{if(_e)throw new Error("Plotting with HTML canvas is not yet supported under Node");this.canvas.getContext("2d").drawImage(i,0,0)};#c=()=>{if(_e)throw new Error("Plotting with HTML canvas is not yet supported under Node");this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height)};run(){this.#h()}async#h(){for(;;){let i=await this.webR.read();switch(i.type){case"stdout":this.#e(i.data);break;case"stderr":this.#t(i.data);break;case"prompt":this.#i(i.data);break;case"canvas":i.data.event==="canvasImage"?this.#r(i.data.image):i.data.event==="canvasNewPage"&&this.#n();break;case"closed":return;default:console.warn(`Unhandled output type for webR Console: ${i.type}.`)}}}},E0={FONTCONFIG_PATH:"/etc/fonts",R_HOME:"/usr/lib/R",R_ENABLE_JIT:"0",ALL_PROXY:"socks5h://localhost:8580",WEBR:"1",WEBR_VERSION:Ou,R_VERSION:yu},Bh={RArgs:[],REnv:E0,baseUrl:m0,serviceWorkerUrl:"",repoUrl:g0,homedir:"/home/web_user",interactive:!0,channelType:ai.Automatic,createLazyFilesystem:!0},wu=class{constructor(i={}){this.version=Ou,this.versionR=yu,this.FS={analyzePath:async(t,r)=>{let n={type:"analyzePath",data:{path:t,dontResolveLastLink:r}};return(await this.#e.request(n)).obj},lookupPath:async t=>{let r={type:"lookupPath",data:{path:t}};return(await this.#e.request(r)).obj},mkdir:async t=>{let r={type:"mkdir",data:{path:t}};return(await this.#e.request(r)).obj},mount:async(t,r,n)=>{let s=[];"blobs"in r&&r.blobs&&(s=[...s,...r.blobs.map(a=>a.data instanceof Blob?a.data.arrayBuffer().then(l=>{a.data=new Uint8Array(l)}):Promise.resolve())]),"packages"in r&&r.packages&&(s=[...s,...r.packages.map(a=>a.blob instanceof Blob?a.blob.arrayBuffer().then(l=>{a.blob=new Uint8Array(l)}):Promise.resolve())]),await Promise.all(s);let o={type:"mount",data:{type:t,options:r,mountpoint:n}};await this.#e.request(o)},syncfs:async t=>{let r={type:"syncfs",data:{populate:t}};await this.#e.request(r)},readFile:async(t,r)=>{let n={type:"readFile",data:{path:t,flags:r}};return(await this.#e.request(n)).obj},rename:async(t,r)=>{let n={type:"rename",data:{oldpath:t,newpath:r}};await this.#e.request(n)},rmdir:async t=>{let r={type:"rmdir",data:{path:t}};await this.#e.request(r)},writeFile:async(t,r,n)=>{let s={type:"writeFile",data:{path:t,data:r,flags:n}};await this.#e.request(s)},unlink:async t=>{let r={type:"unlink",data:{path:t}};await this.#e.request(r)},unmount:async t=>{let r={type:"unmount",data:{path:t}};await this.#e.request(r)}};let e={...Bh,...i,REnv:{...Bh.REnv,...i.REnv}};this.#e=p0(e),this.#t=new f0(this.#e),this.#i=new d0(this.#e),this.objs={},this.Shelter=R0(this.#e),this.#r=this.#e.initialised.then(async()=>{this.globalShelter=await new this.Shelter,this.RObject=this.globalShelter.RObject,this.RLogical=this.globalShelter.RLogical,this.RInteger=this.globalShelter.RInteger,this.RDouble=this.globalShelter.RDouble,this.RComplex=this.globalShelter.RComplex,this.RCharacter=this.globalShelter.RCharacter,this.RRaw=this.globalShelter.RRaw,this.RList=this.globalShelter.RList,this.RDataFrame=this.globalShelter.RDataFrame,this.RPairlist=this.globalShelter.RPairlist,this.REnvironment=this.globalShelter.REnvironment,this.RSymbol=this.globalShelter.RSymbol,this.RString=this.globalShelter.RString,this.RCall=this.globalShelter.RCall,this.objs={baseEnv:await this.RObject.getPersistentObject("baseEnv"),globalEnv:await this.RObject.getPersistentObject("globalEnv"),null:await this.RObject.getPersistentObject("null"),true:await this.RObject.getPersistentObject("true"),false:await this.RObject.getPersistentObject("false"),na:await this.RObject.getPersistentObject("na")},this.#n()})}#e;#t;#i;#r;async init(){return this.#r}async#n(){for(;;){let i=await this.#e.readSystem();switch(i.type){case"setTimeoutWasm":setTimeout((e,t)=>{this.invokeWasmFunction(e,...t)},i.data.delay,i.data.ptr,i.data.args);break;case"proxyWebSocket":{let e=i;this.#t.new(e.data.uuid,e.data.url,e.data.protocol);break}case"sendWebSocket":{let e=i;this.#t.send(e.data.uuid,e.data.data);break}case"closeWebSocket":{let e=i;this.#t.close(e.data.uuid,e.data.code,e.data.reason);break}case"proxyWorker":{let e=i;this.#i.new(e.data.uuid,e.data.url,e.data.options);break}case"postMessageWorker":{let e=i;this.#i.postMessage(e);break}case"terminateWorker":{let e=i;this.#i.terminate(e.data.uuid);break}case"console.log":console.log(i.data);break;case"console.warn":console.warn(i.data);break;case"console.error":console.error(i.data);break;case"close":this.#e.close();break;default:throw new hi("Unknown system message type `"+i.type+"`")}}}close(){this.#e.close()}async read(){return await this.#e.read()}async*stream(){for(;;){let i=await this.#e.read();if(i.type==="closed")return;yield i}}async flush(){return await this.#e.flush()}write(i){this.#e.write(i)}writeConsole(i){this.write({type:"stdin",data:i+`
`})}interrupt(){this.#e.interrupt()}async installPackages(i,e){let t=Object.assign({quiet:!1,mount:!0},e),r={type:"installPackages",data:{name:i,options:t}};await this.#e.request(r)}async destroy(i){await this.globalShelter.destroy(i)}async evalR(i,e){return this.globalShelter.evalR(i,e)}async evalRVoid(i,e){return this.evalRRaw(i,"void",e)}async evalRBoolean(i,e){return this.evalRRaw(i,"boolean",e)}async evalRNumber(i,e){return this.evalRRaw(i,"number",e)}async evalRString(i,e){return this.evalRRaw(i,"string",e)}async evalRRaw(i,e,t={}){let r=$t(t,J,o=>o._payload),n={type:"evalRRaw",data:{code:i,options:r,outputType:e}},s=await this.#e.request(n);switch(s.payloadType){case"raw":return s.obj;case"ptr":throw new Cr("Unexpected ptr payload type returned from evalRVoid")}}async invokeWasmFunction(i,...e){let t={type:"invokeWasmFunction",data:{ptr:i,args:e}};return(await this.#e.request(t)).obj}},oa=class{#e="";#t;#i=!1;constructor(i){this.#t=i}async init(){if(this.#i)return;let i={type:"newShelter"},e=await this.#t.request(i);this.#e=e.obj,this.RObject=Me(this.#t,this.#e,"object"),this.RLogical=Me(this.#t,this.#e,"logical"),this.RInteger=Me(this.#t,this.#e,"integer"),this.RDouble=Me(this.#t,this.#e,"double"),this.RComplex=Me(this.#t,this.#e,"complex"),this.RCharacter=Me(this.#t,this.#e,"character"),this.RRaw=Me(this.#t,this.#e,"raw"),this.RList=Me(this.#t,this.#e,"list"),this.RDataFrame=Me(this.#t,this.#e,"dataframe"),this.RPairlist=Me(this.#t,this.#e,"pairlist"),this.REnvironment=Me(this.#t,this.#e,"environment"),this.RSymbol=Me(this.#t,this.#e,"symbol"),this.RString=Me(this.#t,this.#e,"string"),this.RCall=Me(this.#t,this.#e,"call"),this.#i=!0}async purge(){let i={type:"shelterPurge",data:this.#e};await this.#t.request(i)}async destroy(i){let e={type:"shelterDestroy",data:{id:this.#e,obj:i._payload}};await this.#t.request(e)}async size(){let i={type:"shelterSize",data:this.#e};return(await this.#t.request(i)).obj}async evalR(i,e={}){let t=$t(e,J,s=>s._payload),r={type:"evalR",data:{code:i,options:t,shelter:this.#e}},n=await this.#t.request(r);switch(n.payloadType){case"raw":throw new Cr("Unexpected payload type returned from evalR");default:return li(this.#t,n)}}async captureR(i,e={}){let t=$t(e,J,s=>s._payload),r={type:"captureR",data:{code:i,options:t,shelter:this.#e}},n=await this.#t.request(r);switch(n.payloadType){case"ptr":throw new Cr("Unexpected payload type returned from evalR");case"raw":{let s=n.obj,o=li(this.#t,s.result),a=s.output,l=s.images;for(let c=0;c<a.length;++c)a[c].type!=="stdout"&&a[c].type!=="stderr"&&(a[c].data=li(this.#t,a[c].data));return{result:o,output:a,images:l}}}}};function R0(i){return new Proxy(oa,{construct:async()=>{let e=new oa(i);return await e.init(),e}})}var xu=Symbol("Comlink.proxy"),va=Symbol("Comlink.endpoint"),A0=Symbol("Comlink.releaseProxy"),ba=Symbol("Comlink.finalizer"),Gn=Symbol("Comlink.thrown"),Su=i=>typeof i=="object"&&i!==null||typeof i=="function",Q0={canHandle:i=>Su(i)&&i[xu],serialize(i){let{port1:e,port2:t}=new MessageChannel;return Kn(i,e),[t,[t]]},deserialize(i){return i.start(),Ar(i)}},M0={canHandle:i=>Su(i)&&Gn in i,serialize({value:i}){let e;return i instanceof Error?e={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:e={isError:!1,value:i},[e,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},Bt=new Map([["proxy",Q0],["throw",M0]]);function _0(i,e){for(let t of i)if(e===t||t==="*"||t instanceof RegExp&&t.test(e))return!0;return!1}function Kn(i,e=globalThis,t=["*"]){e.addEventListener("message",function r(n){if(!n||!n.data)return;if(!_0(t,n.origin)){console.warn(`Invalid origin '${n.origin}' for comlink proxy`);return}let{id:s,type:o,path:a}=Object.assign({path:[]},n.data),l=(n.data.argumentList||[]).map(fi),c;try{let h=a.slice(0,-1).reduce((f,d)=>f[d],i),u=a.reduce((f,d)=>f[d],i);switch(o){case"GET":c=u;break;case"SET":h[a.slice(-1)[0]]=fi(n.data.value),c=!0;break;case"APPLY":c=u.apply(h,l);break;case"CONSTRUCT":{let f=new u(...l);c=B0(f)}break;case"ENDPOINT":{let{port1:f,port2:d}=new MessageChannel;Kn(i,d),c=$0(f,[f])}break;case"RELEASE":c=void 0;break;default:return}}catch(h){c={value:h,[Gn]:0}}Promise.resolve(c).catch(h=>({value:h,[Gn]:0})).then(h=>{let[u,f]=Jn(h);e.postMessage(Object.assign(Object.assign({},u),{id:s}),f),o==="RELEASE"&&(e.removeEventListener("message",r),ku(e),ba in i&&typeof i[ba]=="function"&&i[ba]())}).catch(h=>{let[u,f]=Jn({value:new TypeError("Unserializable return value"),[Gn]:0});e.postMessage(Object.assign(Object.assign({},u),{id:s}),f)})}),e.start&&e.start()}function D0(i){return i.constructor.name==="MessagePort"}function ku(i){D0(i)&&i.close()}function Ar(i,e){return wa(i,[],e)}function Hn(i){if(i)throw new Error("Proxy has been released and is not useable")}function Tu(i){return ji(i,{type:"RELEASE"}).then(()=>{ku(i)})}var Yn=new WeakMap,Zn="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{let e=(Yn.get(i)||0)-1;Yn.set(i,e),e===0&&Tu(i)});function L0(i,e){let t=(Yn.get(e)||0)+1;Yn.set(e,t),Zn&&Zn.register(i,e,i)}function q0(i){Zn&&Zn.unregister(i)}function wa(i,e=[],t=function(){}){let r=!1,n=new Proxy(t,{get(s,o){if(Hn(r),o===A0)return()=>{q0(n),Tu(i),r=!0};if(o==="then"){if(e.length===0)return{then:()=>n};let a=ji(i,{type:"GET",path:e.map(l=>l.toString())}).then(fi);return a.then.bind(a)}return wa(i,[...e,o])},set(s,o,a){Hn(r);let[l,c]=Jn(a);return ji(i,{type:"SET",path:[...e,o].map(h=>h.toString()),value:l},c).then(fi)},apply(s,o,a){Hn(r);let l=e[e.length-1];if(l===va)return ji(i,{type:"ENDPOINT"}).then(fi);if(l==="bind")return wa(i,e.slice(0,-1));let[c,h]=vu(a);return ji(i,{type:"APPLY",path:e.map(u=>u.toString()),argumentList:c},h).then(fi)},construct(s,o){Hn(r);let[a,l]=vu(o);return ji(i,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:a},l).then(fi)}});return L0(n,i),n}function V0(i){return Array.prototype.concat.apply([],i)}function vu(i){let e=i.map(Jn);return[e.map(t=>t[0]),V0(e.map(t=>t[1]))]}var Pu=new WeakMap;function $0(i,e){return Pu.set(i,e),i}function B0(i){return Object.assign(i,{[xu]:!0})}function Jn(i){for(let[e,t]of Bt)if(t.canHandle(i)){let[r,n]=t.serialize(i);return[{type:"HANDLER",name:e,value:r},n]}return[{type:"RAW",value:i},Pu.get(i)||[]]}function fi(i){switch(i.type){case"HANDLER":return Bt.get(i.name).deserialize(i.value);case"RAW":return i.value}}function ji(i,e,t){return new Promise(r=>{let n=X0();i.addEventListener("message",function s(o){!o.data||!o.data.id||o.data.id!==n||(i.removeEventListener("message",s),r(o.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:n},e),t)})}function X0(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}var Ii=[],Ge=class{constructor(e){this.isRunning=!1;this.isDestroyed=!1;Ii.push(this),e?this.callbacks=e:this.callbacks={busyCallback:()=>{},idleCallback:()=>{},runningCallback:()=>{},finishedCallback:()=>{}}}running(){this.isRunning=!0,Ii.forEach(e=>e.callbacks.busyCallback()),this.callbacks.runningCallback()}finished(){this.isRunning=!1,this.callbacks.finishedCallback(),this.status().busy||Ii.forEach(e=>e.callbacks.idleCallback())}status(){let e=this.isRunning,t=this.isDestroyed,r=Ii.some(n=>n.isRunning);return{running:e,busy:r,destroyed:t}}destroy(){this.isDestroyed=!0;let e=Ii.indexOf(this);Ii.splice(e,1)}};var X=class i{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,r){[e,t]=Gi(this,e,t);let n=[];return this.decompose(0,e,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(t,this.length,n,1),zi.from(n,this.length-(t-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Gi(this,e,t);let r=[];return this.decompose(e,t,r,0),zi.from(r,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),n=new mi(this),s=new mi(e);for(let o=t,a=t;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(a+=n.value.length,n.done||a>=r)return!0}}iter(e=1){return new mi(this,e)}iterRange(e,t=this.length){return new rs(this,e,t)}iterLines(e,t){let r;if(e==null)r=this.iter();else{t==null&&(t=this.lines+1);let n=this.line(e).from;r=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ns(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?i.empty:e.length<=32?new Xe(e):zi.from(Xe.split(e,[]))}},Xe=class i extends X{constructor(e,t=N0(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.text[s],a=n+o.length;if((t?r:a)>=e)return new Sa(n,a,r,o);n=a+1,r++}}decompose(e,t,r,n){let s=e<=0&&t>=this.length?this:new i(Eu(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let o=r.pop(),a=is(s.text,o.text.slice(),0,s.length);if(a.length<=32)r.push(new i(a,o.length+s.length));else{let l=a.length>>1;r.push(new i(a.slice(0,l)),new i(a.slice(l)))}}else r.push(s)}replace(e,t,r){if(!(r instanceof i))return super.replace(e,t,r);[e,t]=Gi(this,e,t);let n=is(this.text,is(r.text,Eu(this.text,0,e)),t),s=this.length+r.length-(t-e);return n.length<=32?new i(n,s):zi.from(i.split(n,[]),s)}sliceString(e,t=this.length,r=`
`){[e,t]=Gi(this,e,t);let n="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let a=this.text[o],l=s+a.length;s>e&&o&&(n+=r),e<l&&t>s&&(n+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let r=[],n=-1;for(let s of e)r.push(s),n+=s.length+1,r.length==32&&(t.push(new i(r,n)),r=[],n=-1);return n>-1&&t.push(new i(r,n)),t}},zi=class i extends X{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,t,r,n){for(let s=0;;s++){let o=this.children[s],a=n+o.length,l=r+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,r,n);n=a+1,r=l+1}}decompose(e,t,r,n){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let a=this.children[s],l=o+a.length;if(e<=l&&t>=o){let c=n&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?r.push(a):a.decompose(e-o,t-o,r,c)}o=l+1}}replace(e,t,r){if([e,t]=Gi(this,e,t),r.lines<this.lines)for(let n=0,s=0;n<this.children.length;n++){let o=this.children[n],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,r),c=this.lines-o.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let h=this.children.slice();return h[n]=l,new i(h,this.length-(t-e)+r.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,r)}sliceString(e,t=this.length,r=`
`){[e,t]=Gi(this,e,t);let n="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let a=this.children[s],l=o+a.length;o>e&&s&&(n+=r),e<l&&t>o&&(n+=a.sliceString(e-o,t-o,r)),o=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof i))return 0;let r=0,[n,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,s+=t){if(n==o||s==a)return r;let l=this.children[n],c=e.children[s];if(l!=c)return r+l.scanIdentical(c,t);r+=l.length+1}}static from(e,t=e.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of e)r+=d.lines;if(r<32){let d=[];for(let m of e)m.flatten(d);return new Xe(d,t)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,a=[],l=0,c=-1,h=[];function u(d){let m;if(d.lines>s&&d instanceof i)for(let p of d.children)u(p);else d.lines>o&&(l>o||!l)?(f(),a.push(d)):d instanceof Xe&&l&&(m=h[h.length-1])instanceof Xe&&d.lines+m.lines<=32?(l+=d.lines,c+=d.length+1,h[h.length-1]=new Xe(m.text.concat(d.text),m.length+1+d.length)):(l+d.lines>n&&f(),l+=d.lines,c+=d.length+1,h.push(d))}function f(){l!=0&&(a.push(h.length==1?h[0]:i.from(h,c)),c=-1,l=h.length=0)}for(let d of e)u(d);return f(),a.length==1?a[0]:new i(a,t)}};X.empty=new Xe([""],0);function N0(i){let e=-1;for(let t of i)e+=t.length+1;return e}function is(i,e,t=0,r=1e9){for(let n=0,s=0,o=!0;s<i.length&&n<=r;s++){let a=i[s],l=n+a.length;l>=t&&(l>r&&(a=a.slice(0,r-n)),n<t&&(a=a.slice(t-n)),o?(e[e.length-1]+=a,o=!1):e.push(a)),n=l+1}return e}function Eu(i,e,t){return is(i,[""],e,t)}var mi=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Xe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,a=n instanceof Xe?n.text.length:n.children.length;if(o==(t>0?a:0)){if(r==0)return this.done=!0,this.value="",this;t>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[r]+=t,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(n instanceof Xe){let l=n.text[o+(t<0?-1:0)];if(this.offsets[r]+=t,l.length>Math.max(0,e))return this.value=e==0?l:t>0?l.slice(e):l.slice(0,l.length-e),this;e-=l.length}else{let l=n.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[r]+=t):(t<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof Xe?l.text.length:l.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},rs=class{constructor(e,t,r){this.value="",this.done=!1,this.cursor=new mi(e,t>r?-1:1),this.pos=t>r?e.length:0,this.from=Math.min(t,r),this.to=Math.max(t,r)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let r=t<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:n}=this.cursor.next(e);return this.pos+=(n.length+e)*t,this.value=n.length<=r?n:t<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},ns=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:r,value:n}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(X.prototype[Symbol.iterator]=function(){return this.iter()},mi.prototype[Symbol.iterator]=rs.prototype[Symbol.iterator]=ns.prototype[Symbol.iterator]=function(){return this});var Sa=class{constructor(e,t,r,n){this.from=e,this.to=t,this.number=r,this.text=n}get length(){return this.to-this.from}};function Gi(i,e,t){return e=Math.max(0,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6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(i=>i?parseInt(i,36):1);for(let i=1;i<Ui.length;i++)Ui[i]+=Ui[i-1];function j0(i){for(let e=1;e<Ui.length;e+=2)if(Ui[e]>i)return Ui[e-1]<=i;return!1}function Ru(i){return i>=127462&&i<=127487}var Au=8205;function le(i,e,t=!0,r=!0){return(t?qu:I0)(i,e,r)}function qu(i,e,t){if(e==i.length)return e;e&&Vu(i.charCodeAt(e))&&$u(i.charCodeAt(e-1))&&e--;let r=oe(i,e);for(e+=Te(r);e<i.length;){let n=oe(i,e);if(r==Au||n==Au||t&&j0(n))e+=Te(n),r=n;else if(Ru(n)){let s=0,o=e-2;for(;o>=0&&Ru(oe(i,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function I0(i,e,t){for(;e>0;){let r=qu(i,e-2,t);if(r<e)return r;e--}return 0}function Vu(i){return i>=56320&&i<57344}function $u(i){return i>=55296&&i<56320}function oe(i,e){let t=i.charCodeAt(e);if(!$u(t)||e+1==i.length)return t;let r=i.charCodeAt(e+1);return Vu(r)?(t-55296<<10)+(r-56320)+65536:t}function qr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Te(i){return i<65536?1:2}var ka=/\r\n?|\n/,de=function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i}(de||(de={})),Pt=class i{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t+1];e+=r<0?this.sections[t]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,r=0,n=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(r,n,s),n+=s):n+=o,r+=s}}iterChangedRanges(e,t=!1){Ta(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];n<0?e.push(r,n):e.push(n,r)}return new i(e)}composeDesc(e){return this.empty?e:e.empty?this:Bu(this,e)}mapDesc(e,t=!1){return e.empty?this:Pa(this,e,t)}mapPos(e,t=-1,r=de.Simple){let n=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=n+a;if(l<0){if(c>e)return s+(e-n);s+=a}else{if(r!=de.Simple&&c>=e&&(r==de.TrackDel&&n<e&&c>e||r==de.TrackBefore&&n<e||r==de.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==n||t<0?s:s+l;s+=l}n=c}if(e>n)throw new RangeError(`Position ${e} is out of range for changeset of length ${n}`);return s}touchesRange(e,t=e){for(let r=0,n=0;r<this.sections.length&&n<=t;){let s=this.sections[r++],o=this.sections[r++],a=n+s;if(o>=0&&n<=t&&a>=e)return n<e&&a>t?"cover":!0;n=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let r=this.sections[t++],n=this.sections[t++];e+=(e?" ":"")+r+(n>=0?":"+n:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new i(e)}static create(e){return new i(e)}},Pe=class i extends Pt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ta(this,(t,r,n,s,o)=>e=e.replace(n,n+(r-t),o),!1),e}mapDesc(e,t=!1){return Pa(this,e,t,!0)}invert(e){let t=this.sections.slice(),r=[];for(let n=0,s=0;n<t.length;n+=2){let o=t[n],a=t[n+1];if(a>=0){t[n]=a,t[n+1]=o;let l=n>>1;for(;r.length<l;)r.push(X.empty);r.push(o?e.slice(s,s+o):X.empty)}s+=o}return new i(t,r)}compose(e){return this.empty?e:e.empty?this:Bu(this,e,!0)}map(e,t=!1){return e.empty?this:Pa(this,e,t,!0)}iterChanges(e,t=!1){Ta(this,e,t)}get desc(){return Pt.create(this.sections)}filter(e){let t=[],r=[],n=[],s=new gi(this);e:for(let o=0,a=0;;){let l=o==e.length?1e9:e[o++];for(;a<l||a==l&&s.len==0;){if(s.done)break e;let h=Math.min(s.len,l-a);we(n,h,-1);let u=s.ins==-1?-1:s.off==0?s.ins:0;we(t,h,u),u>0&&Xt(r,t,s.text),s.forward(h),a+=h}let c=e[o++];for(;a<c;){if(s.done)break e;let h=Math.min(s.len,c-a);we(t,h,-1),we(n,h,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(h),a+=h}}return{changes:new i(t,r),filtered:Pt.create(n)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let r=this.sections[t],n=this.sections[t+1];n<0?e.push(r):n==0?e.push([r]):e.push([r].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,r){let n=[],s=[],o=0,a=null;function l(h=!1){if(!h&&!n.length)return;o<t&&we(n,t-o,-1);let u=new i(n,s);a=a?a.compose(u.map(a)):u,n=[],s=[],o=0}function c(h){if(Array.isArray(h))for(let u of h)c(u);else if(h instanceof i){if(h.length!=t)throw new RangeError(`Mismatched change set length (got ${h.length}, expected ${t})`);l(),a=a?a.compose(h.map(a)):h}else{let{from:u,to:f=u,insert:d}=h;if(u>f||u<0||f>t)throw new RangeError(`Invalid change range ${u} to ${f} (in doc of length ${t})`);let m=d?typeof d=="string"?X.of(d.split(r||ka)):d:X.empty,p=m.length;if(u==f&&p==0)return;u<o&&l(),u>o&&we(n,u-o,-1),we(n,f-u,p),Xt(s,n,m),o=f}}return c(e),l(!a),a}static empty(e){return new i(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],r=[];for(let n=0;n<e.length;n++){let s=e[n];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,a)=>a&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;r.length<n;)r.push(X.empty);r[n]=X.of(s.slice(1)),t.push(s[0],r[n].length)}}}return new i(t,r)}static createSet(e,t){return new i(e,t)}};function we(i,e,t,r=!1){if(e==0&&t<=0)return;let n=i.length-2;n>=0&&t<=0&&t==i[n+1]?i[n]+=e:e==0&&i[n]==0?i[n+1]+=t:r?(i[n]+=e,i[n+1]+=t):i.push(e,t)}function Xt(i,e,t){if(t.length==0)return;let r=e.length-2>>1;if(r<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<r;)i.push(X.empty);i.push(t)}}function Ta(i,e,t){let r=i.inserted;for(let n=0,s=0,o=0;o<i.sections.length;){let a=i.sections[o++],l=i.sections[o++];if(l<0)n+=a,s+=a;else{let c=n,h=s,u=X.empty;for(;c+=a,h+=l,l&&r&&(u=u.append(r[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)a=i.sections[o++],l=i.sections[o++];e(n,c,s,h,u),n=c,s=h}}}function Pa(i,e,t,r=!1){let n=[],s=r?[]:null,o=new gi(i),a=new gi(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);we(n,c,-1),o.forward(c),a.forward(c)}else if(a.ins>=0&&(o.ins<0||l==o.i||o.off==0&&(a.len<o.len||a.len==o.len&&!t))){let c=a.len;for(we(n,a.ins,-1);c;){let h=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=h&&(we(n,0,o.ins),s&&Xt(s,n,o.text),l=o.i),o.forward(h),c-=h}a.next()}else if(o.ins>=0){let c=0,h=o.len;for(;h;)if(a.ins==-1){let u=Math.min(h,a.len);c+=u,h-=u,a.forward(u)}else if(a.ins==0&&a.len<h)h-=a.len,a.next();else break;we(n,c,l<o.i?o.ins:0),s&&l<o.i&&Xt(s,n,o.text),l=o.i,o.forward(o.len-h)}else{if(o.done&&a.done)return s?Pe.createSet(n,s):Pt.create(n);throw new Error("Mismatched change set lengths")}}function Bu(i,e,t=!1){let r=[],n=t?[]:null,s=new gi(i),o=new gi(e);for(let a=!1;;){if(s.done&&o.done)return n?Pe.createSet(r,n):Pt.create(r);if(s.ins==0)we(r,s.len,0,a),s.next();else if(o.len==0&&!o.done)we(r,0,o.ins,a),n&&Xt(n,r,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,o.len),c=r.length;if(s.ins==-1){let h=o.ins==-1?-1:o.off?0:o.ins;we(r,l,h,a),n&&h&&Xt(n,r,o.text)}else o.ins==-1?(we(r,s.off?0:s.len,l,a),n&&Xt(n,r,s.textBit(l))):(we(r,s.off?0:s.len,o.off?0:o.ins,a),n&&!o.off&&Xt(n,r,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||r.length>c),s.forward2(l),o.forward(l)}}}}var gi=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?X.empty:e[t]}textBit(e){let{inserted:t}=this.set,r=this.i-2>>1;return r>=t.length&&!e?X.empty:t[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Wi=class i{constructor(e,t,r){this.from=e,this.to=t,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let r,n;return this.empty?r=n=e.mapPos(this.from,t):(r=e.mapPos(this.from,1),n=e.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return k.range(e,t);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return k.range(this.anchor,r)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return k.range(e.anchor,e.head)}static create(e,t,r){return new i(e,t,r)}},k=class i{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:i.create(this.ranges.map(r=>r.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new i([this.main],0)}addRange(e,t=!0){return i.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let r=this.ranges.slice();return r[t]=e,i.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new i(e.ranges.map(t=>Wi.fromJSON(t)),e.main)}static single(e,t=e){return new i([i.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,n=0;n<e.length;n++){let s=e[n];if(s.empty?s.from<=r:s.from<r)return i.normalized(e.slice(),t);r=s.to}return new i(e,t)}static cursor(e,t=0,r,n){return Wi.create(e,e,(t==0?0:t<0?8:16)|(r==null?7:Math.min(6,r))|(n??16777215)<<6)}static range(e,t,r,n){let s=(r??16777215)<<6|(n==null?7:Math.min(6,n));return t<e?Wi.create(t,e,48|s):Wi.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let r=e[t];e.sort((n,s)=>n.from-s.from),t=e.indexOf(r);for(let n=1;n<e.length;n++){let s=e[n],o=e[n-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);n<=t&&t--,e.splice(--n,2,s.anchor>s.head?i.range(l,a):i.range(a,l))}}return new i(e,t)}};function Xu(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}var qa=0,R=class i{constructor(e,t,r,n,s){this.combine=e,this.compareInput=t,this.compare=r,this.isStatic=n,this.id=qa++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new i(e.combine||(t=>t),e.compareInput||((t,r)=>t===r),e.compare||(e.combine?(t,r)=>t===r:Va),!!e.static,e.enables)}of(e){return new Fi([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fi(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Fi(e,this,2,t)}from(e,t){return t||(t=r=>r),this.compute([e],r=>t(r.field(e)))}};function Va(i,e){return i==e||i.length==e.length&&i.every((t,r)=>t===e[r])}var Fi=class{constructor(e,t,r,n){this.dependencies=e,this.facet=t,this.type=r,this.value=n,this.id=qa++}dynamicSlot(e){var t;let r=this.value,n=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,h=[];for(let u of this.dependencies)u=="doc"?l=!0:u=="selection"?c=!0:(((t=e[u.id])!==null&&t!==void 0?t:1)&1)==0&&h.push(e[u.id]);return{create(u){return u.values[o]=r(u),1},update(u,f){if(l&&f.docChanged||c&&(f.docChanged||f.selection)||Ca(u,h)){let d=r(u);if(a?!Qu(d,u.values[o],n):!n(d,u.values[o]))return u.values[o]=d,1}return 0},reconfigure:(u,f)=>{let d,m=f.config.address[s];if(m!=null){let p=as(f,m);if(this.dependencies.every(g=>g instanceof R?f.facet(g)===u.facet(g):g instanceof K?f.field(g,!1)==u.field(g,!1):!0)||(a?Qu(d=r(u),p,n):n(d=r(u),p)))return u.values[o]=p,0}else d=r(u);return u.values[o]=d,1}}}};function Qu(i,e,t){if(i.length!=e.length)return!1;for(let r=0;r<i.length;r++)if(!t(i[r],e[r]))return!1;return!0}function Ca(i,e){let t=!1;for(let r of e)Mr(i,r)&1&&(t=!0);return t}function W0(i,e,t){let r=t.map(l=>i[l.id]),n=t.map(l=>l.type),s=r.filter(l=>!(l&1)),o=i[e.id]>>1;function a(l){let c=[];for(let h=0;h<r.length;h++){let u=as(l,r[h]);if(n[h]==2)for(let f of u)c.push(f);else c.push(u)}return e.combine(c)}return{create(l){for(let c of r)Mr(l,c);return l.values[o]=a(l),1},update(l,c){if(!Ca(l,s))return 0;let h=a(l);return e.compare(h,l.values[o])?0:(l.values[o]=h,1)},reconfigure(l,c){let h=Ca(l,r),u=c.config.facets[e.id],f=c.facet(e);if(u&&!h&&Va(t,u))return l.values[o]=f,0;let d=a(l);return e.compare(d,f)?(l.values[o]=f,0):(l.values[o]=d,1)}}}var Mu=R.define({static:!0}),K=class i{constructor(e,t,r,n,s){this.id=e,this.createF=t,this.updateF=r,this.compareF=n,this.spec=s,this.provides=void 0}static define(e){let t=new i(qa++,e.create,e.update,e.compare||((r,n)=>r===n),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Mu).find(r=>r.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:r=>(r.values[t]=this.create(r),1),update:(r,n)=>{let s=r.values[t],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[t]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[t]=n.field(this),0):(r.values[t]=this.create(r),1)}}init(e){return[this,Mu.of({field:this,create:e})]}get extension(){return this}},di={lowest:4,low:3,default:2,high:1,highest:0};function Qr(i){return e=>new ss(e,i)}var Ce={highest:Qr(di.highest),high:Qr(di.high),default:Qr(di.default),low:Qr(di.low),lowest:Qr(di.lowest)},ss=class{constructor(e,t){this.inner=e,this.prec=t}},Ct=class i{of(e){return new _r(this,e)}reconfigure(e){return i.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},_r=class{constructor(e,t){this.compartment=e,this.inner=t}},os=class i{constructor(e,t,r,n,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,r){let n=[],s=Object.create(null),o=new Map;for(let f of z0(e,t,o))f instanceof K?n.push(f):(s[f.facet.id]||(s[f.facet.id]=[])).push(f);let a=Object.create(null),l=[],c=[];for(let f of n)a[f.id]=c.length<<1,c.push(d=>f.slot(d));let h=r?.config.facets;for(let f in s){let d=s[f],m=d[0].facet,p=h&&h[f]||[];if(d.every(g=>g.type==0))if(a[m.id]=l.length<<1|1,Va(p,d))l.push(r.facet(m));else{let g=m.combine(d.map(O=>O.value));l.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(a[g.id]=l.length<<1|1,l.push(g.value)):(a[g.id]=c.length<<1,c.push(O=>g.dynamicSlot(O)));a[m.id]=c.length<<1,c.push(g=>W0(g,m,d))}}let u=c.map(f=>f(a));return new i(e,o,u,a,l,s)}};function z0(i,e,t){let r=[[],[],[],[],[]],n=new Map;function s(o,a){let l=n.get(o);if(l!=null){if(l<=a)return;let c=r[l].indexOf(o);c>-1&&r[l].splice(c,1),o instanceof _r&&t.delete(o.compartment)}if(n.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof _r){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=e.get(o.compartment)||o.inner;t.set(o.compartment,c),s(c,a)}else if(o instanceof ss)s(o.inner,o.prec);else if(o instanceof K)r[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof Fi)r[a].push(o),o.facet.extensions&&s(o.facet.extensions,di.default);else{let c=o.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,a)}}return s(i,di.default),r.reduce((o,a)=>o.concat(a))}function Mr(i,e){if(e&1)return 2;let t=e>>1,r=i.status[t];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;i.status[t]=4;let n=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|n}function as(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}var Nu=R.define(),Ea=R.define({combine:i=>i.some(e=>e),static:!0}),ju=R.define({combine:i=>i.length?i[0]:void 0,static:!0}),Iu=R.define(),Wu=R.define(),zu=R.define(),Uu=R.define({combine:i=>i.length?i[0]:!1}),De=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ra}},Ra=class{of(e){return new De(this,e)}},Aa=class{constructor(e){this.map=e}of(e){return new _(this,e)}},_=class i{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new i(this.type,t)}is(e){return this.type==e}static define(e={}){return new Aa(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let r=[];for(let n of e){let s=n.map(t);s&&r.push(s)}return r}};_.reconfigure=_.define();_.appendConfig=_.define();var ae=class i{constructor(e,t,r,n,s,o){this.startState=e,this.changes=t,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Xu(r,t.newLength),s.some(a=>a.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(e,t,r,n,s,o){return new i(e,t,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(i.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}};ae.time=De.define();ae.userEvent=De.define();ae.addToHistory=De.define();ae.remote=De.define();function U0(i,e){let t=[];for(let r=0,n=0;;){let s,o;if(r<i.length&&(n==e.length||e[n]>=i[r]))s=i[r++],o=i[r++];else if(n<e.length)s=e[n++],o=e[n++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Fu(i,e,t){var r;let n,s,o;return t?(n=e.changes,s=Pe.empty(e.changes.length),o=i.changes.compose(e.changes)):(n=e.changes.map(i.changes),s=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(n)),{changes:o,selection:e.selection?e.selection.map(s):(r=i.selection)===null||r===void 0?void 0:r.map(n),effects:_.mapEffects(i.effects,n).concat(_.mapEffects(e.effects,s)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Qa(i,e,t){let r=e.selection,n=Hi(e.annotations);return e.userEvent&&(n=n.concat(ae.userEvent.of(e.userEvent))),{changes:e.changes instanceof Pe?e.changes:Pe.of(e.changes||[],t,i.facet(ju)),selection:r&&(r instanceof k?r:k.single(r.anchor,r.head)),effects:Hi(e.effects),annotations:n,scrollIntoView:!!e.scrollIntoView}}function Hu(i,e,t){let r=Qa(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;r=Fu(r,Qa(i,e[s],o?r.changes.newLength:i.doc.length),o)}let n=ae.create(i,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return H0(t?F0(n):n)}function F0(i){let e=i.startState,t=!0;for(let n of e.facet(Iu)){let s=n(i);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:U0(t,s))}if(t!==!0){let n,s;if(t===!1)s=i.changes.invertedDesc,n=Pe.empty(e.doc.length);else{let o=i.changes.filter(t);n=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}i=ae.create(e,n,i.selection&&i.selection.map(s),_.mapEffects(i.effects,s),i.annotations,i.scrollIntoView)}let r=e.facet(Wu);for(let n=r.length-1;n>=0;n--){let s=r[n](i);s instanceof ae?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ae?i=s[0]:i=Hu(e,Hi(s),!1)}return i}function H0(i){let e=i.startState,t=e.facet(zu),r=i;for(let n=t.length-1;n>=0;n--){let s=t[n](i);s&&Object.keys(s).length&&(r=Fu(r,Qa(e,s,i.changes.newLength),!0))}return r==i?i:ae.create(e,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var G0=[];function Hi(i){return i==null?G0:Array.isArray(i)?i:[i]}var U=function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i}(U||(U={})),Y0=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ma;try{Ma=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Z0(i){if(Ma)return Ma.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||Y0.test(t)))return!0}return!1}function J0(i){return e=>{if(!/\S/.test(e))return U.Space;if(Z0(e))return U.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return U.Word;return U.Other}}var j=class i{constructor(e,t,r,n,s,o){this.config=e,this.doc=t,this.selection=r,this.values=n,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Mr(this,a<<1);this.computeSlot=null}field(e,t=!0){let r=this.config.address[e.id];if(r==null){if(t)throw new RangeError("Field is not present in this state");return}return Mr(this,r),as(this,r)}update(...e){return Hu(this,e,!0)}applyTransaction(e){let t=this.config,{base:r,compartments:n}=t;for(let a of e.effects)a.is(Ct.reconfigure)?(t&&(n=new Map,t.compartments.forEach((l,c)=>n.set(c,l)),t=null),n.set(a.value.compartment,a.value.extension)):a.is(_.reconfigure)?(t=null,r=a.value):a.is(_.appendConfig)&&(t=null,r=Hi(r).concat(a.value));let s;t?s=e.startState.values.slice():(t=os.resolve(r,n,this),s=new i(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let o=e.startState.facet(Ea)?e.newSelection:e.newSelection.asSingle();new i(t,e.newDoc,o,s,(a,l)=>l.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:k.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,r=e(t.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Hi(r.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),h=c.map(n);for(let f=0;f<a;f++)s[f]=s[f].map(h);let u=n.mapDesc(c,!0);s.push(l.range.map(u)),n=n.compose(h),o=_.mapEffects(o,h).concat(_.mapEffects(Hi(l.effects),u))}return{changes:n,selection:k.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Pe?e:Pe.of(e,this.doc.length,this.facet(i.lineSeparator))}toText(e){return X.of(e.split(this.facet(i.lineSeparator)||ka))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Mr(this,t),as(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let n=e[r];n instanceof K&&this.config.address[n.id]!=null&&(t[r]=n.spec.toJSON(this.field(e[r]),this))}return t}static fromJSON(e,t={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let n=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(e,s)){let o=r[s],a=e[s];n.push(o.init(l=>o.spec.fromJSON(a,l)))}}return i.create({doc:e.doc,selection:k.fromJSON(e.selection),extensions:t.extensions?n.concat([t.extensions]):n})}static create(e={}){let t=os.resolve(e.extensions||[],new Map),r=e.doc instanceof X?e.doc:X.of((e.doc||"").split(t.staticFacet(i.lineSeparator)||ka)),n=e.selection?e.selection instanceof k?e.selection:k.single(e.selection.anchor,e.selection.head):k.single(0);return Xu(n,r.length),t.staticFacet(Ea)||(n=n.asSingle()),new i(t,r,n,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`
`}get readOnly(){return this.facet(Uu)}phrase(e,...t){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(r,n)=>{if(n=="$")return"$";let s=+(n||1);return!s||s>t.length?r:t[s-1]})),e}languageDataAt(e,t,r=-1){let n=[];for(let s of this.facet(Nu))for(let o of s(this,t,r))Object.prototype.hasOwnProperty.call(o,e)&&n.push(o[e]);return n}charCategorizer(e){return J0(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:r,length:n}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-r,a=e-r;for(;o>0;){let l=le(t,o,!1);if(s(t.slice(l,o))!=U.Word)break;o=l}for(;a<n;){let l=le(t,a);if(s(t.slice(a,l))!=U.Word)break;a=l}return o==a?null:k.range(o+r,a+r)}};j.allowMultipleSelections=Ea;j.tabSize=R.define({combine:i=>i.length?i[0]:4});j.lineSeparator=ju;j.readOnly=Uu;j.phrases=R.define({compare(i,e){let t=Object.keys(i),r=Object.keys(e);return t.length==r.length&&t.every(n=>i[n]==e[n])}});j.languageData=Nu;j.changeFilter=Iu;j.transactionFilter=Wu;j.transactionExtender=zu;Ct.reconfigure=_.define();function ve(i,e,t={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],a=r[s];if(a===void 0)r[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))r[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let n in e)r[n]===void 0&&(r[n]=e[n]);return r}var rt=class{eq(e){return this==e}range(e,t=e){return Dr.create(e,t,this)}};rt.prototype.startSide=rt.prototype.endSide=0;rt.prototype.point=!1;rt.prototype.mapMode=de.TrackDel;var Dr=class i{constructor(e,t,r){this.from=e,this.to=t,this.value=r}static create(e,t,r){return new i(e,t,r)}};function _a(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}var Da=class i{constructor(e,t,r,n){this.from=e,this.to=t,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(e,t,r,n=0){let s=r?this.to:this.from;for(let o=n,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(r?this.value[l].endSide:this.value[l].startSide)-t;if(l==o)return c>=0?o:a;c>=0?a=l:o=l+1}}between(e,t,r,n){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(r,1e9,!1,s);s<o;s++)if(n(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let r=[],n=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],h=this.from[l]+e,u=this.to[l]+e,f,d;if(h==u){let m=t.mapPos(h,c.startSide,c.mapMode);if(m==null||(f=d=m,c.startSide!=c.endSide&&(d=t.mapPos(h,c.endSide),d<f)))continue}else if(f=t.mapPos(h,c.startSide),d=t.mapPos(u,c.endSide),f>d||f==d&&c.startSide>0&&c.endSide<=0)continue;(d-f||c.endSide-c.startSide)<0||(o<0&&(o=f),c.point&&(a=Math.max(a,d-f)),r.push(c),n.push(f-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,a):null,pos:o}}},I=class i{constructor(e,t,r,n){this.chunkPos=e,this.chunk=t,this.nextLayer=r,this.maxPoint=n}static create(e,t,r,n){return new i(e,t,r,n)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(r&&(t=t.slice().sort(_a)),this.isEmpty)return t.length?i.of(t):this;let a=new ls(this,null,-1).goto(0),l=0,c=[],h=new nt;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let u=t[l++];h.addInner(u.from,u.to,u.value)||c.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||n>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&h.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||n>a.to||s<a.from||o(a.from,a.to,a.value))&&(h.addInner(a.from,a.to,a.value)||c.push(Dr.create(a.from,a.to,a.value))),a.next());return h.finishInner(this.nextLayer.isEmpty&&!c.length?i.empty:this.nextLayer.update({add:c,filter:o,filterFrom:n,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],r=[],n=-1;for(let o=0;o<this.chunk.length;o++){let a=this.chunkPos[o],l=this.chunk[o],c=e.touchesRange(a,a+l.length);if(c===!1)n=Math.max(n,l.maxPoint),t.push(l),r.push(e.mapPos(a));else if(c===!0){let{mapped:h,pos:u}=l.map(a,e);h&&(n=Math.max(n,h.maxPoint),t.push(h),r.push(u))}}let s=this.nextLayer.map(e);return t.length==0?s:new i(r,t,s||i.empty,n)}between(e,t,r){if(!this.isEmpty){for(let n=0;n<this.chunk.length;n++){let s=this.chunkPos[n],o=this.chunk[n];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,r)===!1)return}this.nextLayer.between(e,t,r)}}iter(e=0){return Lr.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Lr.from(e).goto(t)}static compare(e,t,r,n,s=-1){let o=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),a=t.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=s),l=_u(o,a,r),c=new pi(o,l,s),h=new pi(a,l,s);r.iterGaps((u,f,d)=>Du(c,u,h,f,d,n)),r.empty&&r.length==0&&Du(c,0,h,0,0,n)}static eq(e,t,r=0,n){n==null&&(n=999999999);let s=e.filter(h=>!h.isEmpty&&t.indexOf(h)<0),o=t.filter(h=>!h.isEmpty&&e.indexOf(h)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=_u(s,o),l=new pi(s,a,0).goto(r),c=new pi(o,a,0).goto(r);for(;;){if(l.to!=c.to||!La(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>n)return!0;l.next(),c.next()}}static spans(e,t,r,n,s=-1){let o=new pi(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,r);if(o.point){let h=o.activeForPoint(o.to),u=o.pointFrom<t?h.length+1:o.point.startSide<0?h.length:Math.min(h.length,l);n.point(a,c,o.point,h,u,o.pointRank),l=Math.min(o.openEnd(c),h.length)}else c>a&&(n.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>r)return l+(o.point&&o.to>r?1:0);a=o.to,o.next()}}static of(e,t=!1){let r=new nt;for(let n of e instanceof Dr?[e]:t?K0(e):e)r.add(n.from,n.to,n.value);return r.finish()}static join(e){if(!e.length)return i.empty;let t=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let n=e[r];n!=i.empty;n=n.nextLayer)t=new i(n.chunkPos,n.chunk,t,Math.max(n.maxPoint,t.maxPoint));return t}};I.empty=new I([],[],null,-1);function K0(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let r=i[t];if(_a(e,r)>0)return i.slice().sort(_a);e=r}return i}I.empty.nextLayer=I.empty;var nt=class i{finishChunk(e){this.chunks.push(new Da(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,r){this.addInner(e,t,r)||(this.nextLayer||(this.nextLayer=new i)).add(e,t,r)}addInner(e,t,r){let n=e-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=t,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let r=t.value.length-1;return this.last=t.value[r],this.lastFrom=t.from[r]+e,this.lastTo=t.to[r]+e,!0}finish(){return this.finishInner(I.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=I.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function _u(i,e,t){let r=new Map;for(let s of i)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&r.set(s.chunk[o],s.chunkPos[o]);let n=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=r.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&n.add(s.chunk[o])}return n}var ls=class{constructor(e,t,r,n=0){this.layer=e,this.skip=t,this.minPoint=r,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,r){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<e||n.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!r||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],r=e+t.from[this.rangeIndex];if(this.from=r,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Lr=class i{constructor(e){this.heap=e}static from(e,t=null,r=-1){let n=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=r&&n.push(new ls(o,t,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let r of this.heap)r.goto(e,t);for(let r=this.heap.length>>1;r>=0;r--)xa(this.heap,r);return this.next(),this}forward(e,t){for(let r of this.heap)r.forward(e,t);for(let r=this.heap.length>>1;r>=0;r--)xa(this.heap,r);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),xa(this.heap,0)}}};function xa(i,e){for(let t=i[e];;){let r=(e<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1<i.length&&n.compare(i[r+1])>=0&&(n=i[r+1],r++),t.compare(n)<0)break;i[r]=t,i[e]=n,e=r}}var pi=class{constructor(e,t,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Lr.from(e,t,r)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){es(this.active,e),es(this.activeTo,e),es(this.activeRank,e),this.minActive=Lu(this.active,this.activeTo)}addActive(e){let t=0,{value:r,to:n,rank:s}=this.cursor;for(;t<this.activeRank.length&&(s-this.activeRank[t]||n-this.activeTo[t])>0;)t++;ts(this.active,t,r),ts(this.activeTo,t,n),ts(this.activeRank,t,s),e&&ts(e,t,this.cursor.from),this.minActive=Lu(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>e){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&es(r,n)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=s,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=s.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let n=r.length-1;n>=0&&r[n]<e;n--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&t.push(this.active[r]);return t.reverse()}openEnd(e){let t=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)t++;return t}};function Du(i,e,t,r,n,s){i.goto(e),t.goto(r);let o=r+n,a=r,l=r-e;for(;;){let c=i.to+l-t.to||i.endSide-t.endSide,h=c<0?i.to+l:t.to,u=Math.min(h,o);if(i.point||t.point?i.point&&t.point&&(i.point==t.point||i.point.eq(t.point))&&La(i.activeForPoint(i.to),t.activeForPoint(t.to))||s.comparePoint(a,u,i.point,t.point):u>a&&!La(i.active,t.active)&&s.compareRange(a,u,i.active,t.active),h>o)break;a=h,c<=0&&i.next(),c>=0&&t.next()}}function La(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!i[t].eq(e[t]))return!1;return!0}function es(i,e){for(let t=e,r=i.length-1;t<r;t++)i[t]=i[t+1];i.pop()}function ts(i,e,t){for(let r=i.length-1;r>=e;r--)i[r+1]=i[r];i[e]=t}function Lu(i,e){let t=-1,r=1e9;for(let n=0;n<e.length;n++)(e[n]-r||i[n].endSide-i[t].endSide)<0&&(t=n,r=e[n]);return t}function Et(i,e,t=i.length){let r=0;for(let n=0;n<t;)i.charCodeAt(n)==9?(r+=e-r%e,n++):(r++,n=le(i,n));return r}function cs(i,e,t,r){for(let n=0,s=0;;){if(s>=e)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?t-s%t:1,n=le(i,n)}return r===!0?-1:i.length}var $a="\u037C",Gu=typeof Symbol>"u"?"__"+$a:Symbol.for($a),Ba=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Yu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Ye=class{constructor(e,t){this.rules=[];let{finish:r}=t||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let h=[],u=/^@(\w+)\b/.exec(o[0]),f=u&&u[1]=="keyframes";if(u&&a==null)return l.push(o[0]+";");for(let d in a){let m=a[d];if(/&/.test(d))s(d.split(/,\s*/).map(p=>o.map(g=>p.replace(/&/,g))).reduce((p,g)=>p.concat(g)),m,l);else if(m&&typeof m=="object"){if(!u)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(n(d),m,h,f)}else m!=null&&h.push(d.replace(/_.*/,"").replace(/[A-Z]/g,p=>"-"+p.toLowerCase())+": "+m+";")}(h.length||f)&&l.push((r&&!u&&!c?o.map(r):o).join(", ")+" {"+h.join(" ")+"}")}for(let o in e)s(n(o),e[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let e=Yu[Gu]||1;return Yu[Gu]=e+1,$a+e.toString(36)}static mount(e,t,r){let n=e[Ba],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xa(e,s),n.mount(Array.isArray(t)?t:[t],e)}},Zu=new Map,Xa=class{constructor(e,t){let r=e.ownerDocument||e,n=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&n.CSSStyleSheet){let s=Zu.get(r);if(s)return e[Ba]=s;this.sheet=new n.CSSStyleSheet,Zu.set(r,this)}else this.styleTag=r.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ba]=this}mount(e,t){let r=this.sheet,n=0,s=0;for(let o=0;o<e.length;o++){let a=e[o],l=this.modules.indexOf(a);if(l<s&&l>-1&&(this.modules.splice(l,1),s--,l=-1),l==-1){if(this.modules.splice(s++,0,a),r)for(let c=0;c<a.rules.length;c++)r.insertRule(a.rules[c],n++)}else{for(;s<l;)n+=this.modules[s++].rules.length;n+=a.rules.length,s++}}if(r)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let l=0;l<this.modules.length;l++)o+=this.modules[l].getRules()+`
`;this.styleTag.textContent=o;let a=t.head||t;this.styleTag.parentNode!=a&&a.insertBefore(this.styleTag,a.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var Rt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Yi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ey=typeof navigator<"u"&&/Mac/.test(navigator.platform),ty=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(ce=0;ce<10;ce++)Rt[48+ce]=Rt[96+ce]=String(ce);var ce;for(ce=1;ce<=24;ce++)Rt[ce+111]="F"+ce;var ce;for(ce=65;ce<=90;ce++)Rt[ce]=String.fromCharCode(ce+32),Yi[ce]=String.fromCharCode(ce);var ce;for(hs in Rt)Yi.hasOwnProperty(hs)||(Yi[hs]=Rt[hs]);var hs;function Ju(i){var e=ey&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||ty&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?Yi:Rt)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Yr(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function Ha(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function iy(i){let e=i.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function ws(i,e){if(!e.anchorNode)return!1;try{return Ha(i,e.anchorNode)}catch{return!1}}function Zr(i){return i.nodeType==3?bi(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Ir(i,e,t,r){return t?Ku(i,e,t,r,-1)||Ku(i,e,t,r,1):!1}function yi(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function Ps(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function Ku(i,e,t,r,n){for(;;){if(i==t&&e==r)return!0;if(e==(n<0?0:At(i))){if(i.nodeName=="DIV")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;e=yi(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[e+(n<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=n<0?At(i):0}else return!1}}function At(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Vl(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function ry(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Xf(i,e){let t=e.width/i.offsetWidth,r=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-i.offsetHeight)<1)&&(r=1),{scaleX:t,scaleY:r}}function ny(i,e,t,r,n,s,o,a){let l=i.ownerDocument,c=l.defaultView||window;for(let h=i,u=!1;h&&!u;)if(h.nodeType==1){let f,d=h==l.body,m=1,p=1;if(d)f=ry(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let y=h.getBoundingClientRect();({scaleX:m,scaleY:p}=Xf(h,y)),f={left:y.left,right:y.left+h.clientWidth*m,top:y.top,bottom:y.top+h.clientHeight*p}}let g=0,O=0;if(n=="nearest")e.top<f.top?(O=-(f.top-e.top+o),t>0&&e.bottom>f.bottom+O&&(O=e.bottom-f.bottom+O+o)):e.bottom>f.bottom&&(O=e.bottom-f.bottom+o,t<0&&e.top-O<f.top&&(O=-(f.top+O-e.top+o)));else{let y=e.bottom-e.top,x=f.bottom-f.top;O=(n=="center"&&y<=x?e.top+y/2-x/2:n=="start"||n=="center"&&t<0?e.top-o:e.bottom-x+o)-f.top}if(r=="nearest"?e.left<f.left?(g=-(f.left-e.left+s),t>0&&e.right>f.right+g&&(g=e.right-f.right+g+s)):e.right>f.right&&(g=e.right-f.right+s,t<0&&e.left<f.left+g&&(g=-(f.left+g-e.left+s))):g=(r=="center"?e.left+(e.right-e.left)/2-(f.right-f.left)/2:r=="start"==a?e.left-s:e.right-(f.right-f.left)+s)-f.left,g||O)if(d)c.scrollBy(g,O);else{let y=0,x=0;if(O){let v=h.scrollTop;h.scrollTop+=O/p,x=(h.scrollTop-v)*p}if(g){let v=h.scrollLeft;h.scrollLeft+=g/m,y=(h.scrollLeft-v)*m}e={left:e.left-y,top:e.top-x,right:e.right-y,bottom:e.bottom-x},y&&Math.abs(y-g)<1&&(r="nearest"),x&&Math.abs(x-O)<1&&(n="nearest")}if(d)break;h=h.assignedSlot||h.parentNode}else if(h.nodeType==11)h=h.host;else break}function sy(i){let e=i.ownerDocument;for(let t=i.parentNode;t&&t!=e.body;)if(t.nodeType==1){if(t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.assignedSlot||t.parentNode}else if(t.nodeType==11)t=t.host;else break;return null}var Ga=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:r}=e;this.set(t,Math.min(e.anchorOffset,t?At(t):0),r,Math.min(e.focusOffset,r?At(r):0))}set(e,t,r,n){this.anchorNode=e,this.anchorOffset=t,this.focusNode=r,this.focusOffset=n}},Zi=null;function Nf(i){if(i.setActive)return i.setActive();if(Zi)return i.focus(Zi);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Zi==null?{get preventScroll(){return Zi={preventScroll:!0},!0}}:void 0),!Zi){Zi=!1;for(let t=0;t<e.length;){let r=e[t++],n=e[t++],s=e[t++];r.scrollTop!=n&&(r.scrollTop=n),r.scrollLeft!=s&&(r.scrollLeft=s)}}}var ef;function bi(i,e,t=e){let r=ef||(ef=document.createRange());return r.setEnd(i,t),r.setStart(i,e),r}function tr(i,e,t,r){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0};r&&({altKey:n.altKey,ctrlKey:n.ctrlKey,shiftKey:n.shiftKey,metaKey:n.metaKey}=r);let s=new KeyboardEvent("keydown",n);s.synthetic=!0,i.dispatchEvent(s);let o=new KeyboardEvent("keyup",n);return o.synthetic=!0,i.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function oy(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function jf(i){for(;i.attributes.length;)i.removeAttributeNode(i.attributes[0])}function ay(i,e){let t=e.focusNode,r=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=r)return!1;for(r=Math.min(r,At(t));;)if(r){if(t.nodeType!=1)return!1;let n=t.childNodes[r-1];n.contentEditable=="false"?r--:(t=n,r=At(t))}else{if(t==i)return!0;r=yi(t),t=t.parentNode}}function If(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function Wf(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r>0)return{node:t,offset:r};if(t.nodeType==1&&r>0){if(t.contentEditable=="false")return null;t=t.childNodes[r-1],r=At(t)}else if(t.parentNode&&!Ps(t))r=yi(t),t=t.parentNode;else return null}}function zf(i,e){for(let t=i,r=e;;){if(t.nodeType==3&&r<t.nodeValue.length)return{node:t,offset:r};if(t.nodeType==1&&r<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[r],r=0}else if(t.parentNode&&!Ps(t))r=yi(t)+1,t=t.parentNode;else return null}}var Ee=class i{constructor(e,t,r=!0){this.node=e,this.offset=t,this.precise=r}static before(e,t){return new i(e.parentNode,yi(e),t)}static after(e,t){return new i(e.parentNode,yi(e)+1,t)}},$l=[],Y=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let r of this.children){if(r==e)return t;t+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let a=i.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,t&&!t.written&&t.node==r&&s!=o.dom&&(t.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=tf(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&t&&t.node==r&&(t.written=!0);s;)s=tf(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,t),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let r;if(e==this.dom)r=this.dom.childNodes[t];else{let n=At(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?n=-1:n=1),e=s}n<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,r=0){let n=-1,s=-1,o=-1,a=-1;for(let l=0,c=r,h=r;l<this.children.length;l++){let u=this.children[l],f=c+u.length;if(c<e&&f>t)return u.domBoundsAround(e,t,c);if(f>=e&&n==-1&&(n=l,s=c),c>t&&u.dom.parentNode==this.dom){o=l,a=h;break}h=f,c=f+u.breakAfter}return{from:s,to:a<0?r+this.length:a,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o<this.children.length&&o>=0?this.children[o].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,r=$l){this.markDirty();for(let n=e;n<t;n++){let s=this.children[n];s.parent==this&&r.indexOf(s)<0&&s.destroy()}this.children.splice(e,t-e,...r);for(let n=0;n<r.length;n++)r[n].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Cs(this.children,e,this.children.length)}childPos(e,t=1){return this.childCursor().findPos(e,t)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,t,r,n,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){for(let e of this.children)e.parent==this&&e.destroy();this.parent=null}};Y.prototype.breakAfter=0;function tf(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}var Cs=class{constructor(e,t,r){this.children=e,this.pos=t,this.i=r,this.off=0}findPos(e,t=1){for(;;){if(e>this.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function Uf(i,e,t,r,n,s,o,a,l){let{children:c}=i,h=c.length?c[e]:null,u=s.length?s[s.length-1]:null,f=u?u.breakAfter:o;if(!(e==r&&h&&!o&&!f&&s.length<2&&h.merge(t,n,s.length?u:null,t==0,a,l))){if(r<c.length){let d=c[r];d&&(n<d.length||d.breakAfter&&u?.breakAfter)?(e==r&&(d=d.split(n),n=0),!f&&u&&d.merge(0,n,u,!0,0,l)?s[s.length-1]=d:((n||d.children.length&&!d.children[0].length)&&d.merge(0,n,null,!1,0,l),s.push(d))):d?.breakAfter&&(u?u.breakAfter=1:o=1),r++}for(h&&(h.breakAfter=o,t>0&&(!o&&s.length&&h.merge(t,h.length,s[0],!1,a,0)?h.breakAfter=s.shift().breakAfter:(t<h.length||h.children.length&&h.children[h.children.length-1].length==0)&&h.merge(t,h.length,null,!1,a,0),e++));e<r&&s.length;)if(c[r-1].become(s[s.length-1]))r--,s.pop(),l=s.length?0:a;else if(c[e].become(s[0]))e++,s.shift(),a=s.length?0:l;else break;!s.length&&e&&r<c.length&&!c[e-1].breakAfter&&c[r].merge(0,0,c[e-1],!1,a,l)&&e--,(e<r||s.length)&&i.replaceChildren(e,r,s)}}function Ff(i,e,t,r,n,s){let o=i.childCursor(),{i:a,off:l}=o.findPos(t,1),{i:c,off:h}=o.findPos(e,-1),u=e-t;for(let f of r)u+=f.length;i.length+=u,Uf(i,c,h,a,l,r,0,n,s)}var Le=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Ya=typeof document<"u"?document:{documentElement:{style:{}}},Za=/Edge\/(\d+)/.exec(Le.userAgent),Hf=/MSIE \d/.test(Le.userAgent),Ja=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Le.userAgent),Ns=!!(Hf||Ja||Za),rf=!Ns&&/gecko\/(\d+)/i.test(Le.userAgent),Na=!Ns&&/Chrome\/(\d+)/.exec(Le.userAgent),nf="webkitFontSmoothing"in Ya.documentElement.style,Gf=!Ns&&/Apple Computer/.test(Le.vendor),sf=Gf&&(/Mobile\/\w+/.test(Le.userAgent)||Le.maxTouchPoints>2),A={mac:sf||/Mac/.test(Le.platform),windows:/Win/.test(Le.platform),linux:/Linux|X11/.test(Le.platform),ie:Ns,ie_version:Hf?Ya.documentMode||6:Ja?+Ja[1]:Za?+Za[1]:0,gecko:rf,gecko_version:rf?+(/Firefox\/(\d+)/.exec(Le.userAgent)||[0,0])[1]:0,chrome:!!Na,chrome_version:Na?+Na[1]:0,ios:sf,android:/Android\b/.test(Le.userAgent),webkit:nf,safari:Gf,webkit_version:nf?+(/\bAppleWebKit\/(\d+)/.exec(Le.userAgent)||[0,0])[1]:0,tabSize:Ya.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},ly=256,gt=class i extends Y{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,t,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(t-e)+r.length>ly||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new i(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=this.flags&8,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new Ee(this.dom,e)}domBoundsAround(e,t,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return cy(this.dom,e,t)}},Wt=class i extends Y{constructor(e,t=[],r=0){super(),this.mark=e,this.children=t,this.length=r;for(let n of t)n.setParent(this)}setAttrs(e){if(jf(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(Ff(this,e,t,r?r.children.slice():[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],r=0,n=-1,s=0;for(let a of this.children){let l=r+a.length;l>e&&t.push(r<e?a.split(e-r):a),n<0&&r>=e&&(n=s),r=l,s++}let o=this.length-e;return this.length=e,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,t,o)}domAtPos(e){return Yf(this,e)}coordsAt(e,t){return Jf(this,e,t)}};function cy(i,e,t){let r=i.nodeValue.length;e>r&&(e=r);let n=e,s=e,o=0;e==0&&t<0||e==r&&t>=0?A.chrome||A.gecko||(e?(n--,o=1):s<r&&(s++,o=-1)):t<0?n--:s<r&&s++;let a=bi(i,n,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return A.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Vl(l,o<0):l||null}var Jr=class i extends Y{static create(e,t,r){return new i(e,t,r)}constructor(e,t,r){super(),this.widget=e,this.length=t,this.side=r,this.prevWidget=null}split(e){let t=i.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,t,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}become(e){return e instanceof i&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return X.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,r=t&&t.state.doc,n=this.posAtStart;return r?r.slice(n,n+this.length):X.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Ee.before(this.dom):Ee.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?n.length-1:0;s=n[a],!(e>0?a==0:a==n.length-1||s.top<s.bottom);a+=o?-1:1);return Vl(s,!o)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},Kr=class i extends Y{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof i&&e.side==this.side}split(){return new i(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Ee.before(this.dom):Ee.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return X.empty}get isHidden(){return!0}};gt.prototype.children=Jr.prototype.children=Kr.prototype.children=$l;function Yf(i,e){let t=i.dom,{children:r}=i,n=0;for(let s=0;n<r.length;n++){let o=r[n],a=s+o.length;if(!(a==s&&o.getSide()<=0)){if(e>s&&e<a&&o.dom.parentNode==t)return o.domAtPos(e-s);if(e<=s)break;s=a}}for(let s=n;s>0;s--){let o=r[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=n;s<r.length;s++){let o=r[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Ee(t,0)}function Zf(i,e,t){let r,{children:n}=i;t>0&&e instanceof Wt&&n.length&&(r=n[n.length-1])instanceof Wt&&r.mark.eq(e.mark)?Zf(r,e.children[0],t-1):(n.push(e),e.setParent(i)),i.length+=e.length}function Jf(i,e,t){let r=null,n=-1,s=null,o=-1;function a(c,h){for(let u=0,f=0;u<c.children.length&&f<=h;u++){let d=c.children[u],m=f+d.length;m>=h&&(d.children.length?a(d,h-f):(!s||s.isHidden&&t>0)&&(m>h||f==m&&d.getSide()>0)?(s=d,o=h-f):(f<h||f==m&&d.getSide()<0&&!d.isHidden)&&(r=d,n=h-f)),f=m}}a(i,e);let l=(t<0?r:s)||r||s;return l?l.coordsAt(Math.max(0,l==r?n:o),t):hy(i)}function hy(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=Zr(e);return t[t.length-1]||null}function Ka(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}var of=Object.create(null);function Es(i,e,t){if(i==e)return!0;i||(i=of),e||(e=of);let r=Object.keys(i),n=Object.keys(e);if(r.length-(t&&r.indexOf(t)>-1?1:0)!=n.length-(t&&n.indexOf(t)>-1?1:0))return!1;for(let s of r)if(s!=t&&(n.indexOf(s)==-1||i[s]!==e[s]))return!1;return!0}function el(i,e,t){let r=!1;if(e)for(let n in e)t&&n in t||(r=!0,n=="style"?i.style.cssText="":i.removeAttribute(n));if(t)for(let n in t)e&&e[n]==t[n]||(r=!0,n=="style"?i.style.cssText=t[n]:i.setAttribute(n,t[n]));return r}function uy(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let r=i.attributes[t];e[r.name]=r.value}return e}var ge=class i extends Y{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,r,n,s,o){if(r){if(!(r instanceof i))return!1;this.dom||r.transferDOM(this)}return n&&this.setDeco(r?r.attrs:null),Ff(this,e,t,r?r.children.slice():[],s,o),!0}split(e){let t=new i;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:r,off:n}=this.childPos(e);n&&(t.append(this.children[r].split(n),0),this.children[r].merge(n,this.children[r].length,null,!1,0,0),r++);for(let s=r;s<this.children.length;s++)t.append(this.children[s],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Es(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Zf(this,e,t)}addLineDeco(e){let t=e.spec.attributes,r=e.spec.class;t&&(this.attrs=Ka(t,this.attrs||{})),r&&(this.attrs=Ka({class:r},this.attrs||{}))}domAtPos(e){return Yf(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var r;this.dom?this.flags&4&&(jf(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(el(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&Y.get(n)instanceof Wt;)n=n.lastChild;if(!n||!this.length||n.nodeName!="BR"&&((r=Y.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!A.ios||!this.children.some(s=>s instanceof gt))){let s=document.createElement("BR");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let r of this.children){if(!(r instanceof gt)||/[^ -~]/.test(r.text))return null;let n=Zr(r.dom);if(n.length!=1)return null;e+=n[0].width,t=n[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let r=Jf(this,e,t);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight<s){let o=(s-n.textHeight)/2;return{top:r.top+o,bottom:r.bottom-o,left:r.left,right:r.left}}}return r}become(e){return e instanceof i&&this.children.length==0&&e.children.length==0&&Es(this.attrs,e.attrs)&&this.breakAfter==e.breakAfter}covers(){return!0}static find(e,t){for(let r=0,n=0;r<e.children.length;r++){let s=e.children[r],o=n+s.length;if(o>=t){if(s instanceof i)return s;if(o>t)break}n=o+s.breakAfter}return null}},Oi=class i extends Y{constructor(e,t,r){super(),this.widget=e,this.length=t,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,t,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Ee.before(this.dom):Ee.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let r=new i(this.widget,t,this.deco);return r.breakAfter=this.breakAfter,r}get children(){return $l}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):X.empty}domBoundsAround(){return null}become(e){return e instanceof i&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.deco=e.deco,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,t){return this.widget.coordsAt(this.dom,e,t)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}covers(e){let{startSide:t,endSide:r}=this.deco;return t==r?!1:e<0?t<0:r>0}},qe=class{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},Re=function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i}(Re||(Re={})),Q=class extends rt{constructor(e,t,r,n){super(),this.startSide=e,this.endSide=t,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(e){return new en(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return t+=r&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new zt(e,t,t,r,e.widget||null,!1)}static replace(e){let t=!!e.block,r,n;if(e.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=Kf(e,t);r=(s?t?-3e8:-1:5e8)-1,n=(o?t?2e8:1:-6e8)+1}return new zt(e,r,n,t,e.widget||null,!0)}static line(e){return new tn(e)}static set(e,t=!1){return I.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Q.none=I.empty;var en=class i extends Q{constructor(e){let{start:t,end:r}=Kf(e);super(t?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,r;return this==e||e instanceof i&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&Es(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}};en.prototype.point=!1;var tn=class i extends Q{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof i&&this.spec.class==e.spec.class&&Es(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}};tn.prototype.mapMode=de.TrackBefore;tn.prototype.point=!0;var zt=class i extends Q{constructor(e,t,r,n,s,o){super(t,r,s,e),this.block=n,this.isReplace=o,this.mapMode=n?t<=0?de.TrackBefore:de.TrackAfter:de.TrackDel}get type(){return this.startSide!=this.endSide?Re.WidgetRange:this.startSide<=0?Re.WidgetBefore:Re.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof i&&fy(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}};zt.prototype.point=!0;function Kf(i,e=!1){let{inclusiveStart:t,inclusiveEnd:r}=i;return t==null&&(t=i.inclusive),r==null&&(r=i.inclusive),{start:t??e,end:r??e}}function fy(i,e){return i==e||!!(i&&e&&i.compare(e))}function tl(i,e,t,r=0){let n=t.length-1;n>=0&&t[n]+r>=i?t[n]=Math.max(t[n],e):t.push(i,e)}var Wr=class i{constructor(e,t,r,n){this.doc=e,this.pos=t,this.end=r,this.disallowBlockEffectsFor=n,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Oi&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new ge),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(us(new Kr(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof Oi)&&this.getLine()}buildText(e,t,r){for(;e>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:a}=this.cursor.next(this.skip);if(this.skip=0,a)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-r)),this.getLine().append(us(new gt(this.text.slice(this.textOff,this.textOff+n)),t),r),this.atCursorPos=!0,this.textOff+=n,e-=n,r=0}}span(e,t,r,n){this.buildText(t-e,r,n),this.pos=t,this.openStart<0&&(this.openStart=n)}point(e,t,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof zt){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let a=t-e;if(r instanceof zt)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Oi(r.widget||Ut.block,a,r));else{let l=Jr.create(r.widget||Ut.inline,a,a?0:r.startSide),c=this.atCursorPos&&!l.isEditable&&s<=n.length&&(e<t||r.startSide>0),h=!l.isEditable&&(e<t||s>n.length||r.startSide<=0),u=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),c&&(u.append(us(new Kr(1),n),s),s=n.length+Math.max(0,s-n.length)),u.append(us(l,n),s),this.atCursorPos=h,this.pendingBuffer=h?e<t||s>n.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);a&&(this.textOff+a<=this.text.length?this.textOff+=a:(this.skip+=a-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=s)}static build(e,t,r,n,s){let o=new i(e,t,r,s);return o.openEnd=I.spans(n,t,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function us(i,e){for(let t of e)i=new Wt(t,[i],i.length);return i}var Ut=class extends qe{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}};Ut.inline=new Ut("span");Ut.block=new Ut("div");var F=function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i}(F||(F={})),wi=F.LTR,Bl=F.RTL;function ed(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}var dy=ed("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),py=ed("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),il=Object.create(null),ft=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);il[e]=t,il[t]=-e}function td(i){return i<=247?dy[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?py[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}var my=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,pt=class{get dir(){return this.level%2?Bl:wi}constructor(e,t,r){this.from=e,this.to=t,this.level=r}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,r,n){let s=-1;for(let o=0;o<e.length;o++){let a=e[o];if(a.from<=t&&a.to>=t){if(a.level==r)return o;(s<0||(n!=0?n<0?a.from<t:a.to>t:e[s].level>a.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}};function id(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let r=i[t],n=e[t];if(r.from!=n.from||r.to!=n.to||r.direction!=n.direction||!id(r.inner,n.inner))return!1}return!0}var G=[];function gy(i,e,t,r,n){for(let s=0;s<=r.length;s++){let o=s?r[s-1].to:e,a=s<r.length?r[s].from:t,l=s?256:n;for(let c=o,h=l,u=l;c<a;c++){let f=td(i.charCodeAt(c));f==512?f=h:f==8&&u==4&&(f=16),G[c]=f==4?2:f,f&7&&(u=f),h=f}for(let c=o,h=l,u=l;c<a;c++){let f=G[c];if(f==128)c<a-1&&h==G[c+1]&&h&24?f=G[c]=h:G[c]=256;else if(f==64){let d=c+1;for(;d<a&&G[d]==64;)d++;let m=c&&h==8||d<t&&G[d]==8?u==1?1:8:256;for(let p=c;p<d;p++)G[p]=m;c=d-1}else f==8&&u==1&&(G[c]=1);h=f,f&7&&(u=f)}}}function Oy(i,e,t,r,n){let s=n==1?2:1;for(let o=0,a=0,l=0;o<=r.length;o++){let c=o?r[o-1].to:e,h=o<r.length?r[o].from:t;for(let u=c,f,d,m;u<h;u++)if(d=il[f=i.charCodeAt(u)])if(d<0){for(let p=a-3;p>=0;p-=3)if(ft[p+1]==-d){let g=ft[p+2],O=g&2?n:g&4?g&1?s:n:0;O&&(G[u]=G[ft[p]]=O),a=p;break}}else{if(ft.length==189)break;ft[a++]=u,ft[a++]=f,ft[a++]=l}else if((m=G[u])==2||m==1){let p=m==n;l=p?0:1;for(let g=a-3;g>=0;g-=3){let O=ft[g+2];if(O&2)break;if(p)ft[g+2]|=2;else{if(O&4)break;ft[g+2]|=4}}}}}function yy(i,e,t,r){for(let n=0,s=r;n<=t.length;n++){let o=n?t[n-1].to:i,a=n<t.length?t[n].from:e;for(let l=o;l<a;){let c=G[l];if(c==256){let h=l+1;for(;;)if(h==a){if(n==t.length)break;h=t[n++].to,a=n<t.length?t[n].from:e}else if(G[h]==256)h++;else break;let u=s==1,f=(h<e?G[h]:r)==1,d=u==f?u?1:2:r;for(let m=h,p=n,g=p?t[p-1].to:i;m>l;)m==g&&(m=t[--p].from,g=p?t[p-1].to:i),G[--m]=d;l=h}else s=c,l++}}}function rl(i,e,t,r,n,s,o){let a=r%2?2:1;if(r%2==n%2)for(let l=e,c=0;l<t;){let h=!0,u=!1;if(c==s.length||l<s[c].from){let p=G[l];p!=a&&(h=!1,u=p==16)}let f=!h&&a==1?[]:null,d=h?r:r+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(u)break e;let p=s[c];if(!h)for(let g=p.to,O=c+1;;){if(g==t)break e;if(O<s.length&&s[O].from==g)g=s[O++].to;else{if(G[g]==a)break e;break}}if(c++,f)f.push(p);else{p.from>l&&o.push(new pt(l,p.from,d));let g=p.direction==wi!=!(d%2);nl(i,g?r+1:r,n,p.inner,p.from,p.to,o),l=p.to}m=p.to}else{if(m==t||(h?G[m]!=a:G[m]==a))break;m++}f?rl(i,l,m,r+1,n,f,o):l<m&&o.push(new pt(l,m,d)),l=m}else for(let l=t,c=s.length;l>e;){let h=!0,u=!1;if(!c||l>s[c-1].to){let p=G[l-1];p!=a&&(h=!1,u=p==16)}let f=!h&&a==1?[]:null,d=h?r:r+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(u)break e;let p=s[--c];if(!h)for(let g=p.from,O=c;;){if(g==e)break e;if(O&&s[O-1].to==g)g=s[--O].from;else{if(G[g-1]==a)break e;break}}if(f)f.push(p);else{p.to<l&&o.push(new pt(p.to,l,d));let g=p.direction==wi!=!(d%2);nl(i,g?r+1:r,n,p.inner,p.from,p.to,o),l=p.from}m=p.from}else{if(m==e||(h?G[m-1]!=a:G[m-1]==a))break;m--}f?rl(i,m,l,r+1,n,f,o):m<l&&o.push(new pt(m,l,d)),l=m}}function nl(i,e,t,r,n,s,o){let a=e%2?2:1;gy(i,n,s,r,a),Oy(i,n,s,r,a),yy(n,s,r,a),rl(i,n,s,e,t,r,o)}function by(i,e,t){if(!i)return[new pt(0,0,e==Bl?1:0)];if(e==wi&&!t.length&&!my.test(i))return rd(i.length);if(t.length)for(;i.length>G.length;)G[G.length]=256;let r=[],n=e==wi?0:1;return nl(i,n,n,t,0,i.length,r),r}function rd(i){return[new pt(0,i,0)]}var nd="";function wy(i,e,t,r,n){var s;let o=r.head-i.from,a=pt.find(e,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),l=e[a],c=l.side(n,t);if(o==c){let f=a+=n?1:-1;if(f<0||f>=e.length)return null;l=e[a=f],o=l.side(!n,t),c=l.side(n,t)}let h=le(i.text,o,l.forward(n,t));(h<l.from||h>l.to)&&(h=c),nd=i.text.slice(Math.min(o,h),Math.max(o,h));let u=a==(n?e.length-1:0)?null:e[a+(n?1:-1)];return u&&h==c&&u.level+(n?0:1)<l.level?k.cursor(u.side(!n,t)+i.from,u.forward(n,t)?1:-1,u.level):k.cursor(h+i.from,l.forward(n,t)?-1:1,l.level)}function vy(i,e,t){for(let r=e;r<t;r++){let n=td(i.charCodeAt(r));if(n==1)return wi;if(n==2||n==4)return Bl}return wi}var sd=R.define(),od=R.define(),ad=R.define(),ld=R.define(),sl=R.define(),cd=R.define(),hd=R.define(),ud=R.define({combine:i=>i.some(e=>e)}),fd=R.define({combine:i=>i.some(e=>e)}),dd=R.define(),zr=class i{constructor(e,t="nearest",r="nearest",n=5,s=5,o=!1){this.range=e,this.y=t,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new i(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new i(k.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},fs=_.define({map:(i,e)=>i.map(e)}),pd=_.define();function Oe(i,e,t){let r=i.facet(ld);r.length?r[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}var Nt=R.define({combine:i=>i.length?i[0]:!0}),xy=0,$r=R.define(),te=class i{constructor(e,t,r,n,s){this.id=e,this.create=t,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(e,t){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=t||{};return new i(xy++,e,r,n,a=>{let l=[$r.of(a)];return o&&l.push(rn.of(c=>{let h=c.plugin(a);return h?o(h):Q.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return i.define(r=>new e(r),t)}},Ur=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(r){if(Oe(t.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){Oe(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(r){Oe(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},md=R.define(),Xl=R.define(),rn=R.define(),gd=R.define(),Nl=R.define(),Od=R.define();function af(i,e){let t=i.state.facet(Od);if(!t.length)return t;let r=t.map(s=>s instanceof Function?s(i):s),n=[];return I.spans(r,e.from,e.to,{point(){},span(s,o,a,l){let c=s-e.from,h=o-e.from,u=n;for(let f=a.length-1;f>=0;f--,l--){let d=a[f].spec.bidiIsolate,m;if(d==null&&(d=vy(e.text,c,h)),l>0&&u.length&&(m=u[u.length-1]).to==c&&m.direction==d)m.to=h,u=m.inner;else{let p={from:c,to:h,direction:d,inner:[]};u.push(p),u=p.inner}}}}),n}var yd=R.define();function bd(i){let e=0,t=0,r=0,n=0;for(let s of i.state.facet(yd)){let o=s(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:e,right:t,top:r,bottom:n}}var Br=R.define(),mt=class i{constructor(e,t,r,n){this.fromA=e,this.toA=t,this.fromB=r,this.toB=n}join(e){return new i(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,r=this;for(;t>0;t--){let n=e[t-1];if(!(n.fromA>r.toA)){if(n.toA<r.fromA)break;r=r.join(n),e.splice(t-1,1)}}return e.splice(t,0,r),e}static extendWithRanges(e,t){if(t.length==0)return e;let r=[];for(let n=0,s=0,o=0,a=0;;n++){let l=n==e.length?null:e[n],c=o-a,h=l?l.fromB:1e9;for(;s<t.length&&t[s]<h;){let u=t[s],f=t[s+1],d=Math.max(a,u),m=Math.min(h,f);if(d<=m&&new i(d+c,m+c,d,m).addToSet(r),f>h)break;s+=2}if(!l)return r;new i(l.fromA,l.toA,l.fromB,l.toB).addToSet(r),o=l.toA,a=l.toB}}},Rs=class i{constructor(e,t,r){this.view=e,this.state=t,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Pe.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,a,l)=>n.push(new mt(s,o,a,l))),this.changedRanges=n}static create(e,t,r){return new i(e,t,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},As=class extends Y{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=Q.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new ge],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new mt(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:c,toA:h})=>h<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?n=this.domChanged.newSel.head:!Ry(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let s=n>-1?ky(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:h}=this.hasComposition;r=new mt(c,h,e.changes.mapPos(c,-1),e.changes.mapPos(h,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(A.ie||A.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Cy(o,a,e.changes);return r=mt.extendWithRanges(r,l),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=A.chrome||A.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.children)o instanceof Oi&&o.widget instanceof Qs&&s.push(o.dom);n.updateGaps(s)}updateChildren(e,t,r){let n=r?r.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=n.length-1;;o--){let a=o>=0?n[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:h,toB:u}=a,f,d,m,p;if(r&&r.range.fromB<u&&r.range.toB>h){let v=Wr.build(this.view.state.doc,h,r.range.fromB,this.decorations,this.dynamicDecorationMap),w=Wr.build(this.view.state.doc,r.range.toB,u,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,p=w.openEnd;let T=this.compositionView(r);w.breakAtStart?T.breakAfter=1:w.content.length&&T.merge(T.length,T.length,w.content[0],!1,w.openStart,0)&&(T.breakAfter=w.content[0].breakAfter,w.content.shift()),v.content.length&&T.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),f=v.content.concat(T).concat(w.content)}else({content:f,breakAtStart:d,openStart:m,openEnd:p}=Wr.build(this.view.state.doc,h,u,this.decorations,this.dynamicDecorationMap));let{i:g,off:O}=s.findPos(c,1),{i:y,off:x}=s.findPos(l,-1);Uf(this,y,x,g,O,f,d,m,p)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let r of t.effects)r.is(pd)&&(this.editContextFormatting=r.value)}compositionView(e){let t=new gt(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Wt(n,[t],t.length);let r=new ge;return r.append(t,0),r}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=Y.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},r=this.childPos(e.range.fromB,1),n=this.children[r.i];t(e.line,n);for(let s=e.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],t(s>=0?e.marks[s].node:e.text,n)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&ws(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,l=this.moveToLine(this.domAtPos(a.anchor)),c=a.empty?l:this.moveToLine(this.domAtPos(a.head));if(A.gecko&&a.empty&&!this.hasComposition&&Sy(l)){let u=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(u,l.node.childNodes[l.offset]||null)),l=c=new Ee(u,0),o=!0}let h=this.view.observer.selectionRange;(o||!h.focusNode||(!Ir(l.node,l.offset,h.anchorNode,h.anchorOffset)||!Ir(c.node,c.offset,h.focusNode,h.focusOffset))&&!this.suppressWidgetCursorChange(h,a))&&(this.view.observer.ignore(()=>{A.android&&A.chrome&&this.dom.contains(h.focusNode)&&Ey(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let u=Yr(this.view.root);if(u)if(a.empty){if(A.gecko){let f=Ty(l.node,l.offset);if(f&&f!=3){let d=(f==1?Wf:zf)(l.node,l.offset);d&&(l=new Ee(d.node,d.offset))}}u.collapse(l.node,l.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(l.node,l.offset);try{u.extend(c.node,c.offset)}catch{}}else{let f=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),f.setEnd(c.node,c.offset),f.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(f)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Ee(h.anchorNode,h.anchorOffset),this.impreciseHead=c.precise?null:new Ee(h.focusNode,h.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ir(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,r=Yr(e.root),{anchorNode:n,anchorOffset:s}=e.observer.selectionRange;if(!r||!t.empty||!t.assoc||!r.modify)return;let o=ge.find(this,t.head);if(!o)return;let a=o.posAtStart;if(t.head==a||t.head==a+o.length)return;let l=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!l||!c||l.bottom>c.top)return;let h=this.domAtPos(t.head+t.assoc);r.collapse(h.node,h.offset),r.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&r.collapse(n,s)}moveToLine(e){let t=this.dom,r;if(e.node!=t)return e;for(let n=e.offset;!r&&n<t.childNodes.length;n++){let s=Y.get(t.childNodes[n]);s instanceof ge&&(r=s.domAtPos(0))}for(let n=e.offset-1;!r&&n>=0;n--){let s=Y.get(t.childNodes[n]);s instanceof ge&&(r=s.domAtPos(s.length))}return r?new Ee(r.node,r.offset,!0):e}nearest(e){for(let t=e;t;){let r=Y.get(t);if(r&&r.rootView==this)return r;t=t.parentNode}return null}posFromDOM(e,t){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,t)+r.posAtStart}domAtPos(e){let{i:t,off:r}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let n=this.children[t];if(r<n.length||n instanceof ge)break;t++,r=0}return this.children[t].domAtPos(r)}coordsAt(e,t){let r=null,n=0;for(let s=this.length,o=this.children.length-1;o>=0;o--){let a=this.children[o],l=s-a.breakAfter,c=l-a.length;if(l<e)break;if(c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!r||a instanceof ge&&!(r instanceof ge&&t>=0)))r=a,n=c;else if(r&&c==e&&l==e&&a instanceof Oi&&Math.abs(t)<2){if(a.deco.startSide<0)break;o&&(r=null)}s=c}return r?r.coordsAt(e-n,t):null}coordsForChar(e){let{i:t,off:r}=this.childPos(e,1),n=this.children[t];if(!(n instanceof ge))return null;for(;n.children.length;){let{i:a,off:l}=n.childPos(r,1);for(;;a++){if(a==n.children.length)return null;if((n=n.children[a]).length)break}r=l}if(!(n instanceof gt))return null;let s=le(n.text,r);if(s==r)return null;let o=bi(n.dom,r,s).getClientRects();for(let a=0;a<o.length;a++){let l=o[a];if(a==o.length-1||l.top<l.bottom&&l.left<l.right)return l}return null}measureVisibleLineHeights(e){let t=[],{from:r,to:n}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==F.LTR;for(let c=0,h=0;h<this.children.length;h++){let u=this.children[h],f=c+u.length;if(f>n)break;if(c>=r){let d=u.dom.getBoundingClientRect();if(t.push(d.height),o){let m=u.dom.lastChild,p=m?Zr(m):[];if(p.length){let g=p[p.length-1],O=l?g.right-d.left:d.right-g.left;O>a&&(a=O,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=f)}}}c=f+u.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?F.RTL:F.LTR}measureTextSize(){for(let s of this.children)if(s instanceof ge){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,r,n;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let s=Zr(e.firstChild)[0];t=e.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:r,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Cs(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let r=0,n=0;;n++){let s=n==t.viewports.length?null:t.viewports[n],o=s?s.from-1:this.length;if(o>r){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(r).top)/this.view.scaleY;e.push(Q.replace({widget:new Qs(a),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return Q.set(e)}updateDeco(){let e=1,t=this.view.state.facet(rn).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),r=!1,n=this.view.state.facet(gd).map((s,o)=>{let a=typeof s=="function";return a&&(r=!0),a?s(this.view):s});for(n.length&&(this.dynamicDecorationMap[e++]=r,t.push(I.join(n))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;return this.decorations}scrollIntoView(e){if(e.isSnapshot){let c=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=c.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let c of this.view.state.facet(dd))try{if(c(this.view,e.range,e))return!0}catch(h){Oe(this.view.state,h,"scroll handler")}let{range:t}=e,r=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),n;if(!r)return;!t.empty&&(n=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=bd(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:a,offsetHeight:l}=this.view.scrollDOM;ny(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,a),-a),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==F.LTR)}};function Sy(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}var Qs=class extends qe{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}};function wd(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let r=Wf(t.focusNode,t.focusOffset),n=zf(t.focusNode,t.focusOffset),s=r||n;if(n&&r&&n.node!=r.node){let a=Y.get(n.node);if(!a||a instanceof gt&&a.text!=n.node.nodeValue)s=n;else if(i.docView.lastCompositionAfterCursor){let l=Y.get(r.node);!l||l instanceof gt&&l.text!=r.node.nodeValue||(s=n)}}if(i.docView.lastCompositionAfterCursor=s!=r,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function ky(i,e,t){let r=wd(i,t);if(!r)return null;let{node:n,from:s,to:o}=r,a=n.nodeValue;if(/[\n\r]/.test(a)||i.state.doc.sliceString(r.from,r.to)!=a)return null;let l=e.invertedDesc,c=new mt(l.mapPos(s),l.mapPos(o),s,o),h=[];for(let u=n.parentNode;;u=u.parentNode){let f=Y.get(u);if(f instanceof Wt)h.push({node:u,deco:f.mark});else{if(f instanceof ge||u.nodeName=="DIV"&&u.parentNode==i.contentDOM)return{range:c,text:n,marks:h,line:u};if(u!=i.contentDOM)h.push({node:u,deco:new en({inclusive:!0,attributes:uy(u),tagName:u.tagName.toLowerCase()})});else return null}}}function Ty(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}var Py=class{constructor(){this.changes=[]}compareRange(e,t){tl(e,t,this.changes)}comparePoint(e,t){tl(e,t,this.changes)}};function Cy(i,e,t){let r=new Py;return I.compare(i,e,t,r),r.changes}function Ey(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Ry(i,e){let t=!1;return e&&i.iterChangedRanges((r,n)=>{r<e.to&&n>e.from&&(t=!0)}),t}function Ay(i,e,t=1){let r=i.charCategorizer(e),n=i.doc.lineAt(e),s=e-n.from;if(n.length==0)return k.cursor(e);s==0?t=1:s==n.length&&(t=-1);let o=s,a=s;t<0?o=le(n.text,s,!1):a=le(n.text,s);let l=r(n.text.slice(o,a));for(;o>0;){let c=le(n.text,o,!1);if(r(n.text.slice(c,o))!=l)break;o=c}for(;a<n.length;){let c=le(n.text,a);if(r(n.text.slice(a,c))!=l)break;a=c}return k.range(o+n.from,a+n.from)}function Qy(i,e){return e.left>i?e.left-i:Math.max(0,i-e.right)}function My(i,e){return e.top>i?e.top-i:Math.max(0,i-e.bottom)}function ja(i,e){return i.top<e.bottom-1&&i.bottom>e.top+1}function lf(i,e){return e<i.top?{top:e,left:i.left,right:i.right,bottom:i.bottom}:i}function cf(i,e){return e>i.bottom?{top:i.top,left:i.left,right:i.right,bottom:e}:i}function ol(i,e,t){let r,n,s,o,a=!1,l,c,h,u;for(let m=i.firstChild;m;m=m.nextSibling){let p=Zr(m);for(let g=0;g<p.length;g++){let O=p[g];n&&ja(n,O)&&(O=lf(cf(O,n.bottom),n.top));let y=Qy(e,O),x=My(t,O);if(y==0&&x==0)return m.nodeType==3?hf(m,e,t):ol(m,e,t);if(!r||o>x||o==x&&s>y){r=m,n=O,s=y,o=x;let v=x?t<O.top?-1:1:y?e<O.left?-1:1:0;a=!v||(v>0?g<p.length-1:g>0)}y==0?t>O.bottom&&(!h||h.bottom<O.bottom)?(l=m,h=O):t<O.top&&(!u||u.top>O.top)&&(c=m,u=O):h&&ja(h,O)?h=cf(h,O.bottom):u&&ja(u,O)&&(u=lf(u,O.top))}}if(h&&h.bottom>=t?(r=l,n=h):u&&u.top<=t&&(r=c,n=u),!r)return{node:i,offset:0};let f=Math.max(n.left,Math.min(n.right,e));if(r.nodeType==3)return hf(r,f,t);if(a&&r.contentEditable!="false")return ol(r,f,t);let d=Array.prototype.indexOf.call(i.childNodes,r)+(e>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function hf(i,e,t){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let a=0;a<r;a++){let l=bi(i,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let h=l[c];if(h.top==h.bottom)continue;o||(o=e-h.left);let u=(h.top>t?h.top-t:t-h.bottom)-1;if(h.left-1<=e&&h.right+1>=e&&u<s){let f=e>=(h.left+h.right)/2,d=f;if((A.chrome||A.gecko)&&bi(i,a).getBoundingClientRect().left==h.right&&(d=!f),u<=0)return{node:i,offset:a+(d?1:0)};n=a+(d?1:0),s=u}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function vd(i,e,t,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),a=o.top+i.viewState.paddingTop,l,{docHeight:c}=i.viewState,{x:h,y:u}=e,f=u-a;if(f<0)return 0;if(f>c)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,w=!1;l=i.elementAtHeight(f),l.type!=Re.Text;)for(;f=r>0?l.bottom+v:l.top-v,!(f>=0&&f<=c);){if(w)return t?null:0;w=!0,r=-r}u=a+f;let d=l.from;if(d<i.viewport.from)return i.viewport.from==0?0:t?null:uf(i,o,l,h,u);if(d>i.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:t?null:uf(i,o,l,h,u);let m=i.dom.ownerDocument,p=i.root.elementFromPoint?i.root:m,g=p.elementFromPoint(h,u);g&&!i.contentDOM.contains(g)&&(g=null),g||(h=Math.max(o.left+1,Math.min(o.right-1,h)),g=p.elementFromPoint(h,u),g&&!i.contentDOM.contains(g)&&(g=null));let O,y=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(h,u);v&&({offsetNode:O,offset:y}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(h,u);v&&({startContainer:O,startOffset:y}=v,(!i.contentDOM.contains(O)||A.safari&&_y(O,y,h)||A.chrome&&Dy(O,y,h))&&(O=void 0))}}if(!O||!i.docView.dom.contains(O)){let v=ge.find(i.docView,d);if(!v)return f>l.top+l.height/2?l.to:l.from;({node:O,offset:y}=ol(v.dom,h,u))}let x=i.docView.nearest(O);if(!x)return null;if(x.isWidget&&((s=x.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=x.dom.getBoundingClientRect();return e.y<v.top||e.y<=v.bottom&&e.x<=(v.left+v.right)/2?x.posAtStart:x.posAtEnd}else return x.localPosFromDOM(O,y)+x.posAtStart}function uf(i,e,t,r,n){let s=Math.round((r-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let a=i.viewState.heightOracle.textHeight,l=Math.floor((n-t.top-(i.defaultLineHeight-a)*.5)/a);s+=l*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+cs(o,s,i.state.tabSize)}function _y(i,e,t){let r;if(i.nodeType!=3||e!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!="BR")return!1;return bi(i,r-1,r).getBoundingClientRect().left>t}function Dy(i,e,t){if(e!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains("cm-line"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():bi(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return t-r.left>5}function al(i,e){let t=i.lineBlockAt(e);if(Array.isArray(t.type)){for(let r of t.type)if(r.to>e||r.to==e&&(r.to==t.to||r.type==Re.Text))return r}return t}function Ly(i,e,t,r){let n=al(i,e.head),s=!r||n.type!=Re.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>n.from?e.head-1:e.head);if(s){let o=i.dom.getBoundingClientRect(),a=i.textDirectionAt(n.from),l=i.posAtCoords({x:t==(a==F.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return k.cursor(l,t?-1:1)}return k.cursor(t?n.to:n.from,t?-1:1)}function ff(i,e,t,r){let n=i.state.doc.lineAt(e.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let a=e,l=null;;){let c=wy(n,s,o,a,t),h=nd;if(!c){if(n.number==(t?i.state.doc.lines:1))return a;h=`
`,n=i.state.doc.line(n.number+(t?1:-1)),s=i.bidiSpans(n),c=i.visualLineSide(n,!t)}if(l){if(!l(h))return a}else{if(!r)return c;l=r(h)}a=c}}function qy(i,e,t){let r=i.state.charCategorizer(e),n=r(t);return s=>{let o=r(s);return n==U.Space&&(n=o),n==o}}function Vy(i,e,t,r){let n=e.head,s=t?1:-1;if(n==(t?i.state.doc.length:0))return k.cursor(n,e.assoc);let o=e.goalColumn,a,l=i.contentDOM.getBoundingClientRect(),c=i.coordsAtPos(n,e.assoc||-1),h=i.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(l.right-l.left,i.defaultCharacterWidth*(n-d.from))),a=(s<0?d.top:d.bottom)+h}let u=l.left+o,f=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=a+(f+d)*s,p=vd(i,{x:u,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?p<n:p>n)){let g=i.docView.coordsForChar(p),O=!g||m<g.top?-1:1;return k.cursor(p,O,void 0,o)}}}function vs(i,e,t){for(;;){let r=0;for(let n of i)n.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=r||t||(e-s<o-e?-1:1);e=l<0?s:o,r=l}});if(!r)return e}}function Ia(i,e,t){let r=vs(i.state.facet(Nl).map(n=>n(i)),t.from,e.head>t.from?-1:1);return r==t.from?t:k.cursor(r,r<t.from?1:-1)}var ll=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,A.safari&&e.contentDOM.addEventListener("input",()=>null),A.gecko&&Jy(e.contentDOM.ownerDocument)}handleEvent(e){!Wy(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let r=this.handlers[e];if(r){for(let n of r.observers)n(this.view,t);for(let n of r.handlers){if(t.defaultPrevented)break;if(n(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=$y(e),r=this.handlers,n=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=r[s];a&&o!=!a.handlers.length&&(n.removeEventListener(s,this.handleEvent),a=null),a||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!="scroll"&&!t[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Sd.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),A.android&&A.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return A.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=xd.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||By.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,tr(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:A.safari&&!A.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function df(i,e){return(t,r)=>{try{return e.call(i,r,t)}catch(n){Oe(t.state,n)}}}function $y(i){let e=Object.create(null);function t(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&t(s).handlers.push(df(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&t(s).observers.push(df(r.value,o))}}for(let r in st)t(r).handlers.push(st[r]);for(let r in Je)t(r).observers.push(Je[r]);return e}var xd=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],By="dthko",Sd=[16,17,18,20,91,92,224,225],ds=6;function ps(i){return Math.max(0,i)*.7+8}function Xy(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}var cl=class{constructor(e,t,r,n){this.view=e,this.startEvent=t,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=sy(e.contentDOM),this.atoms=e.state.facet(Nl).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(j.allowMultipleSelections)&&Ny(e,t),this.dragging=Iy(e,t)&&Cd(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){var t;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Xy(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,n=0,s=((t=this.scrollParent)===null||t===void 0?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=bd(this.view);e.clientX-o.left<=s.left+ds?r=-ps(s.left-e.clientX):e.clientX+o.right>=s.right-ds&&(r=ps(e.clientX-s.right)),e.clientY-o.top<=s.top+ds?n=-ps(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-ds&&(n=ps(e.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let r=0;r<e.ranges.length;r++){let n=e.ranges[r],s=null;if(n.empty){let o=vs(this.atoms,n.from,0);o!=n.from&&(s=k.cursor(o,-1))}else{let o=vs(this.atoms,n.from,-1),a=vs(this.atoms,n.to,1);(o!=n.from||a!=n.to)&&(s=k.range(n.from==n.anchor?o:a,n.from==n.head?o:a))}s&&(t||(t=e.ranges.slice()),t[r]=s)}return t?k.create(t,e.mainIndex):e}select(e){let{view:t}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function Ny(i,e){let t=i.state.facet(sd);return t.length?t[0](e):A.mac?e.metaKey:e.ctrlKey}function jy(i,e){let t=i.state.facet(od);return t.length?t[0](e):A.mac?!e.altKey:!e.ctrlKey}function Iy(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let r=Yr(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s<n.length;s++){let o=n[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function Wy(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,r;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(r=Y.get(t))&&r.ignoreEvent(e))return!1;return!0}var st=Object.create(null),Je=Object.create(null),kd=A.ie&&A.ie_version<15||A.ios&&A.webkit_version<604;function zy(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),Td(i,t.value)},50)}function Td(i,e){let{state:t}=i,r,n=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(hl!=null&&t.selection.ranges.every(l=>l.empty)&&hl==s.toString()){let l=-1;r=t.changeByRange(c=>{let h=t.doc.lineAt(c.from);if(h.from==l)return{range:c};l=h.from;let u=t.toText((o?s.line(n++).text:e)+t.lineBreak);return{changes:{from:h.from,insert:u},range:k.cursor(c.from+u.length)}})}else o?r=t.changeByRange(l=>{let c=s.line(n++);return{changes:{from:l.from,to:l.to,insert:c.text},range:k.cursor(l.from+c.length)}}):r=t.replaceSelection(s);i.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Je.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};st.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);Je.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};Je.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};st.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let r of i.state.facet(ad))if(t=r(i,e),t)break;if(!t&&e.button==0&&(t=Hy(i,e)),t){let r=!i.hasFocus;i.inputState.startMouseSelection(new cl(i,e,t,r)),r&&i.observer.ignore(()=>{Nf(i.contentDOM);let s=i.root.activeElement;s&&!s.contains(i.contentDOM)&&s.blur()});let n=i.inputState.mouseSelection;if(n)return n.start(e),n.dragging===!1}return!1};function pf(i,e,t,r){if(r==1)return k.cursor(e,t);if(r==2)return Ay(i.state,e,t);{let n=ge.find(i.docView,e),s=i.state.doc.lineAt(n?n.posAtEnd:e),o=n?n.posAtStart:s.from,a=n?n.posAtEnd:s.to;return a<i.state.doc.length&&a==s.to&&a++,k.range(o,a)}}var Pd=(i,e)=>i>=e.top&&i<=e.bottom,mf=(i,e,t)=>Pd(e,t)&&i>=t.left&&i<=t.right;function Uy(i,e,t,r){let n=ge.find(i.docView,e);if(!n)return 1;let s=e-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&mf(t,r,o))return-1;let a=n.coordsAt(s,1);return a&&mf(t,r,a)?1:o&&Pd(r,o)?-1:1}function gf(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:Uy(i,t,e.clientX,e.clientY)}}var Fy=A.ie&&A.ie_version<=11,Of=null,yf=0,bf=0;function Cd(i){if(!Fy)return i.detail;let e=Of,t=bf;return Of=i,bf=Date.now(),yf=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(yf+1)%3:1}function Hy(i,e){let t=gf(i,e),r=Cd(e),n=i.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),n=n.map(s.changes))},get(s,o,a){let l=gf(i,s),c,h=pf(i,l.pos,l.bias,r);if(t.pos!=l.pos&&!o){let u=pf(i,t.pos,t.bias,r),f=Math.min(u.from,h.from),d=Math.max(u.to,h.to);h=f<h.from?k.range(f,d):k.range(d,f)}return o?n.replaceRange(n.main.extend(h.from,h.to)):a&&r==1&&n.ranges.length>1&&(c=Gy(n,l.pos))?c:a?n.addRange(h):k.create([h])}}}function Gy(i,e){for(let t=0;t<i.ranges.length;t++){let{from:r,to:n}=i.ranges[t];if(r<=e&&n>=e)return k.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}st.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let n=i.docView.nearest(e.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=t.to||o<=t.from)&&(t=k.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",i.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};st.dragend=i=>(i.inputState.draggedContent=null,!1);function wf(i,e,t,r){if(!t)return;let n=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&jy(i,e)?{from:s.from,to:s.to}:null,a={from:n,insert:t},l=i.state.changes(o?[o,a]:a);i.focus(),i.dispatch({changes:l,selection:{anchor:l.mapPos(n,-1),head:l.mapPos(n,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}st.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let r=Array(t.length),n=0,s=()=>{++n==t.length&&wf(i,e,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let a=new FileReader;a.onerror=s,a.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(a.result)||(r[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return wf(i,e,r,!0),!0}return!1};st.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=kd?null:e.clipboardData;return t?(Td(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(zy(i),!1)};function Yy(i,e){let t=i.dom.parentNode;if(!t)return;let r=t.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function Zy(i){let e=[],t=[],r=!1;for(let n of i.selection.ranges)n.empty||(e.push(i.sliceDoc(n.from,n.to)),t.push(n));if(!e.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:e.join(i.lineBreak),ranges:t,linewise:r}}var hl=null;st.copy=st.cut=(i,e)=>{let{text:t,ranges:r,linewise:n}=Zy(i.state);if(!t&&!n)return!1;hl=n?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let s=kd?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(Yy(i,t),!1)};var Ed=De.define();function Rd(i,e){let t=[];for(let r of i.facet(hd)){let n=r(i,e);n&&t.push(n)}return t?i.update({effects:t,annotations:Ed.of(!0)}):null}function Ad(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=Rd(i.state,e);t?i.dispatch(t):i.update([])}},10)}Je.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Ad(i)};Je.blur=i=>{i.observer.clearSelectionRange(),Ad(i)};Je.compositionstart=Je.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};Je.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,A.chrome&&A.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};Je.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};st.beforeinput=(i,e)=>{var t;let r;if(A.chrome&&A.android&&(r=xd.find(n=>n.inputType==e.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let n=((t=window.visualViewport)===null||t===void 0?void 0:t.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return A.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),A.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Je.compositionend(i,e),20),!1};var vf=new Set;function Jy(i){vf.has(i)||(vf.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}var xf=["pre-wrap","normal","pre-line","break-spaces"],ul=class{constructor(e){this.lineWrapping=e,this.doc=X.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let r=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((t-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return xf.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let r=0;r<e.length;r++){let n=e[r];n<0?r++:this.heightSamples[Math.floor(n*10)]||(t=!0,this.heightSamples[Math.floor(n*10)]=!0)}return t}refresh(e,t,r,n,s,o){let a=xf.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=r,this.textHeight=n,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let h=o[c];h<0?c++:this.heightSamples[Math.floor(h*10)]=!0}}return l}},fl=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},dt=class i{constructor(e,t,r,n,s){this.from=e,this.length=t,this.top=r,this.height=n,this._content=s}get type(){return typeof this._content=="number"?Re.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof zt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new i(this.from,this.length+e.length,this.top,this.height+e.height,t)}},Z=function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i}(Z||(Z={})),xs=.001,Ne=class i{constructor(e,t,r=2){this.length=e,this.height=t,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>xs&&(e.heightChanged=!0),this.height=t)}replace(e,t,r){return i.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,r,n){let s=this,o=r.doc;for(let a=n.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:h,toB:u}=n[a],f=s.lineAt(l,Z.ByPosNoHeight,r.setDoc(t),0,0),d=f.to>=c?f:s.lineAt(c,Z.ByPosNoHeight,r,0,0);for(u+=d.to-c,c=d.to;a>0&&f.from<=n[a-1].toA;)l=n[a-1].fromA,h=n[a-1].fromB,a--,l<f.from&&(f=s.lineAt(l,Z.ByPosNoHeight,r,0,0));h+=f.from-l,l=f.from;let m=pl.build(r.setDoc(o),e,h,u);s=s.replace(l,c,m)}return s.updateHeight(r,0)}static empty(){return new Ze(0,0)}static of(e){if(e.length==1)return e[0];let t=0,r=e.length,n=0,s=0;for(;;)if(t==r)if(n>s*2){let a=e[t-1];a.break?e.splice(--t,1,a.left,null,a.right):e.splice(--t,1,a.left,a.right),r+=1+a.break,n-=a.size}else if(s>n*2){let a=e[r];a.break?e.splice(r,1,a.left,null,a.right):e.splice(r,1,a.left,a.right),r+=2+a.break,s-=a.size}else break;else if(n<s){let a=e[t++];a&&(n+=a.size)}else{let a=e[--r];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,r++),new dl(i.of(e.slice(0,t)),o,i.of(e.slice(r)))}};Ne.prototype.size=1;var Ms=class extends Ne{constructor(e,t,r){super(e,t),this.deco=r}blockAt(e,t,r,n){return new dt(n,this.length,r,this.height,this.deco||0)}lineAt(e,t,r,n,s){return this.blockAt(0,r,n,s)}forEachLine(e,t,r,n,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,r,n,s))}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more&&this.setHeight(e,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ze=class i extends Ms{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,r,n){return new dt(n,this.length,r,this.height,this.breaks)}replace(e,t,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof It&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof It?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Ne.of(r)}updateHeight(e,t=0,r=!1,n){return n&&n.from<=t&&n.more?this.setHeight(e,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},It=class i extends Ne{constructor(e){super(e,0)}heightMetrics(e,t){let r=e.doc.lineAt(t).number,n=e.doc.lineAt(t+this.length).number,s=n-r+1,o,a=0;if(e.lineWrapping){let l=Math.min(this.height,e.lineHeight*s);o=l/s,this.length>s+1&&(a=(this.height-l)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:a}}blockAt(e,t,r,n){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,n);if(t.lineWrapping){let c=n+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),h=t.doc.lineAt(c),u=a+h.length*l,f=Math.max(r,e-u/2);return new dt(h.from,h.length,f,u,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-r)/a))),{from:h,length:u}=t.doc.line(s+c);return new dt(h,u,r+a*c,a,0)}}lineAt(e,t,r,n,s){if(t==Z.ByHeight)return this.blockAt(e,r,n,s);if(t==Z.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(e);return new dt(d,m-d,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(r,s),c=r.doc.lineAt(e),h=a+c.length*l,u=c.number-o,f=n+a*u+l*(c.from-s-u);return new dt(c.from,c.length,Math.max(n,Math.min(f,n+this.height-h)),h,0)}forEachLine(e,t,r,n,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(r,s);for(let h=e,u=n;h<=t;){let f=r.doc.lineAt(h);if(h==e){let m=f.number-a;u+=l*m+c*(e-s-m)}let d=l+c*f.length;o(new dt(f.from,f.length,u,d,0)),u+=d,h=f.to+1}}replace(e,t,r){let n=this.length-t;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(e>0){let s=r[0];s instanceof i?r[0]=new i(e+s.length):r.unshift(new i(e-1),null)}return Ne.of(r)}decomposeLeft(e,t){t.push(new i(e-1),null)}decomposeRight(e,t){t.push(null,new i(this.length-e-1))}updateHeight(e,t=0,r=!1,n){let s=t+this.length;if(n&&n.from<=t+this.length&&n.more){let o=[],a=Math.max(t,n.from),l=-1;for(n.from>t&&o.push(new i(n.from-t-1).updateHeight(e,t));a<=s&&n.more;){let h=e.doc.lineAt(a).length;o.length&&o.push(null);let u=n.heights[n.index++];l==-1?l=u:Math.abs(u-l)>=xs&&(l=-2);let f=new Ze(h,u);f.outdated=!1,o.push(f),a+=h+1}a<=s&&o.push(null,new i(s-a).updateHeight(e,a));let c=Ne.of(o);return(l<0||Math.abs(c.height-this.height)>=xs||Math.abs(l-this.heightMetrics(e,t).perLine)>=xs)&&(e.heightChanged=!0),c}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},dl=class extends Ne{constructor(e,t,r){super(e.length+t+r.length,e.height+r.height,t|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,t,r,n){let s=r+this.left.height;return e<s?this.left.blockAt(e,t,r,n):this.right.blockAt(e,t,s,n+this.left.length+this.break)}lineAt(e,t,r,n,s){let o=n+this.left.height,a=s+this.left.length+this.break,l=t==Z.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,r,n,s):this.right.lineAt(e,t,r,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let h=t==Z.ByPosNoHeight?Z.ByPosNoHeight:Z.ByPos;return l?c.join(this.right.lineAt(a,h,r,o,a)):this.left.lineAt(a,h,r,n,s).join(c)}forEachLine(e,t,r,n,s,o){let a=n+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,r,n,s,o),t>=l&&this.right.forEachLine(e,t,r,a,l,o);else{let c=this.lineAt(l,Z.ByPos,r,n,s);e<c.from&&this.left.forEachLine(e,c.from-1,r,n,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,r,a,l,o)}}replace(e,t,r){let n=this.left.length+this.break;if(t<n)return this.balanced(this.left.replace(e,t,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-n,t-n,r));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of r)s.push(a);if(e>0&&Sf(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Sf(s,a)}return Ne.of(s)}decomposeLeft(e,t){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(r++,e>=r&&t.push(null)),e>r&&this.right.decomposeLeft(e-r,t)}decomposeRight(e,t){let r=this.left.length,n=r+this.break;if(e>=n)return this.right.decomposeRight(e-n,t);e<r&&this.left.decomposeRight(e,t),this.break&&e<n&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Ne.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,r=!1,n){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return n&&n.from<=t+s.length&&n.more?l=s=s.updateHeight(e,t,r,n):s.updateHeight(e,t,r),n&&n.from<=a+o.length&&n.more?l=o=o.updateHeight(e,a,r,n):o.updateHeight(e,a,r),l?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function Sf(i,e){let t,r;i[e]==null&&(t=i[e-1])instanceof It&&(r=i[e+1])instanceof It&&i.splice(e-1,3,new It(t.length+1+r.length))}var Ky=5,pl=class i{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let r=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ze?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ze(r-this.pos,-1)),this.writtenTo=r,t>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,r){if(e<t||r.heightRelevant){let n=r.widget?r.widget.estimatedHeight:0,s=r.widget?r.widget.lineBreaks:0;n<0&&(n=this.oracle.lineHeight);let o=t-e;r.block?this.addBlock(new Ms(o,n,r)):(o||s||n>=Ky)&&this.addLineDeco(n,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ze(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let r=new It(t-e);return this.oracle.doc.lineAt(e).to==t&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ze)return e;let t=new Ze(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,e),n.breaks+=t,this.writtenTo=this.pos=this.pos+r}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ze)&&!this.isCovered?this.nodes.push(new Ze(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let n of this.nodes)n instanceof Ze&&n.updateHeight(this.oracle,r),r+=n?n.length:1;return this.nodes}static build(e,t,r,n){let s=new i(r,e);return I.spans(t,r,n,s,0),s.finish(r)}};function eb(i,e,t){let r=new ml;return I.compare(i,e,t,r,0),r.changes}var ml=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,r,n){(e<t||r&&r.heightRelevant||n&&n.heightRelevant)&&tl(e,t,this.changes,5)}};function tb(i,e){let t=i.getBoundingClientRect(),r=i.ownerDocument,n=r.defaultView||window,s=Math.max(0,t.left),o=Math.min(n.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(n.innerHeight,t.bottom);for(let c=i.parentNode;c&&c!=r.body;)if(c.nodeType==1){let h=c,u=window.getComputedStyle(h);if((h.scrollHeight>h.clientHeight||h.scrollWidth>h.clientWidth)&&u.overflow!="visible"){let f=h.getBoundingClientRect();s=Math.max(s,f.left),o=Math.min(o,f.right),a=Math.max(a,f.top),l=c==i.parentNode?f.bottom:Math.min(l,f.bottom)}c=u.position=="absolute"||u.position=="fixed"?h.offsetParent:h.parentNode}else if(c.nodeType==11)c=c.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:a-(t.top+e),bottom:Math.max(a,l)-(t.top+e)}}function ib(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}var Fr=class{constructor(e,t,r){this.from=e,this.to=t,this.size=r}static same(e,t){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],s=t[r];if(n.from!=s.from||n.to!=s.to||n.size!=s.size)return!1}return!0}draw(e,t){return Q.replace({widget:new gl(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},gl=class extends qe{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}},_s=class{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=kf,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=F.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Xl).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new ul(t),this.stateDeco=e.facet(rn).filter(r=>typeof r!="function"),this.heightMap=Ne.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle.setDoc(e.doc),[new mt(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Q.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let r=0;r<=1;r++){let n=r?t.head:t.anchor;if(!e.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);e.push(new Ji(s,o))}}return this.viewports=e.sort((r,n)=>r.from-n.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?kf:new Ol(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Xr(e,this.scaler))})}update(e,t=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(rn).filter(h=>typeof h!="function");let n=e.changedRanges,s=mt.extendWithRanges(n,eb(r,this.stateDeco,e?e.changes:Pe.empty(this.state.doc.length))),o=this.heightMap.height,a=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(e.flags|=2),a?(this.scrollAnchorPos=e.changes.mapPos(a.from,-1),this.scrollAnchorHeight=a.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let l=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let c=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(c||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fd)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,r=window.getComputedStyle(t),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?F.RTL:F.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),a=t.getBoundingClientRect(),l=o||this.mustMeasureContent||this.contentDOMHeight!=a.height;this.contentDOMHeight=a.height,this.mustMeasureContent=!1;let c=0,h=0;if(a.width&&a.height){let{scaleX:v,scaleY:w}=Xf(t,a);(v>.005&&Math.abs(this.scaleX-v)>.005||w>.005&&Math.abs(this.scaleY-w)>.005)&&(this.scaleX=v,this.scaleY=w,c|=8,o=l=!0)}let u=(parseInt(r.paddingTop)||0)*this.scaleY,f=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=f)&&(this.paddingTop=u,this.paddingBottom=f,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(n.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=If(e.scrollDOM);let m=(this.printing?ib:tb)(t,this.paddingTop),p=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let y=a.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let v=e.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(y-this.contentDOMWidth)>n.charWidth){let{lineHeight:w,charWidth:T,textHeight:P}=e.docView.measureTextSize();o=w>0&&n.refresh(s,w,T,P,y/T,v),o&&(e.docView.minWidth=0,c|=8)}p>0&&g>0?h=Math.max(p,g):p<0&&g<0&&(h=Math.min(p,g)),n.heightChanged=!1;for(let w of this.viewports){let T=w.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?Ne.empty().applyChanges(this.stateDeco,X.empty,this.heightOracle,[new mt(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new fl(w.from,T))}n.heightChanged&&(c|=2)}let x=!this.viewportIsAppropriate(this.viewport,h)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return x&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(h,this.scrollTarget),c|=this.updateForViewport()),(c&2||x)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Ji(n.lineAt(o-r*1e3,Z.ByHeight,s,0,0).from,n.lineAt(a+(1-r)*1e3,Z.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let h=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=n.lineAt(c,Z.ByPos,s,0,0),f;t.y=="center"?f=(u.top+u.bottom)/2-h/2:t.y=="start"||t.y=="nearest"&&c<l.from?f=u.top:f=u.bottom-h,l=new Ji(n.lineAt(f-1e3/2,Z.ByHeight,s,0,0).from,n.lineAt(f+h+1e3/2,Z.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let r=t.mapPos(e.from,-1),n=t.mapPos(e.to,1);return new Ji(this.heightMap.lineAt(r,Z.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(n,Z.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},r=0){if(!this.inView)return!0;let{top:n}=this.heightMap.lineAt(e,Z.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,Z.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||n<=o-Math.max(10,Math.min(-r,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let r=[];for(let n of e)t.touchesRange(n.from,n.to)||r.push(new Fr(t.mapPos(n.from),t.mapPos(n.to),n.size));return r}ensureLineGaps(e,t){let r=this.heightOracle.lineWrapping,n=r?1e4:2e3,s=n>>1,o=n<<1;if(this.defaultTextDirection!=F.LTR&&!r)return[];let a=[],l=(h,u,f,d)=>{if(u-h<s)return;let m=this.state.selection.main,p=[m.from];m.empty||p.push(m.to);for(let O of p)if(O>h&&O<u){l(h,O-10,f,d),l(O+10,u,f,d);return}let g=nb(e,O=>O.from>=f.from&&O.to<=f.to&&Math.abs(O.from-h)<s&&Math.abs(O.to-u)<s&&!p.some(y=>O.from<y&&O.to>y));if(!g){if(u<f.to&&t&&r&&t.visibleRanges.some(O=>O.from<=u&&O.to>=u)){let O=t.moveToLineBoundary(k.cursor(u),!1,!0).head;O>h&&(u=O)}g=new Fr(h,u,this.gapSize(f,h,u,d))}a.push(g)},c=h=>{if(h.length<o||h.type!=Re.Text)return;let u=rb(h.from,h.to,this.stateDeco);if(u.total<o)return;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,m;if(r){let p=n/this.heightOracle.lineLength*this.heightOracle.lineHeight,g,O;if(f!=null){let y=gs(u,f),x=((this.visibleBottom-this.visibleTop)/2+p)/h.height;g=y-x,O=y+x}else g=(this.visibleTop-h.top-p)/h.height,O=(this.visibleBottom-h.top+p)/h.height;d=ms(u,g),m=ms(u,O)}else{let p=u.total*this.heightOracle.charWidth,g=n*this.heightOracle.charWidth,O,y;if(f!=null){let x=gs(u,f),v=((this.pixelViewport.right-this.pixelViewport.left)/2+g)/p;O=x-v,y=x+v}else O=(this.pixelViewport.left-g)/p,y=(this.pixelViewport.right+g)/p;d=ms(u,O),m=ms(u,y)}d>h.from&&l(h.from,d,h,u),m<h.to&&l(m,h.to,h,u)};for(let h of this.viewportLines)Array.isArray(h.type)?h.type.forEach(c):c(h);return a}gapSize(e,t,r,n){let s=gs(n,r)-gs(n,t);return this.heightOracle.lineWrapping?e.height*s:n.total*this.heightOracle.charWidth*s}updateLineGaps(e){Fr.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Q.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];I.spans(e,this.viewport.from,this.viewport.to,{span(n,s){t.push({from:n,to:s})},point(){}},20);let r=t.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=t[s].from||n.to!=t[s].to);return this.visibleRanges=t,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Xr(this.heightMap.lineAt(e,Z.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Xr(this.heightMap.lineAt(this.scaler.fromDOM(e),Z.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Xr(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ji=class{constructor(e,t){this.from=e,this.to=t}};function rb(i,e,t){let r=[],n=i,s=0;return I.spans(t,i,e,{span(){},point(o,a){o>n&&(r.push({from:n,to:o}),s+=o-n),n=a}},20),n<e&&(r.push({from:n,to:e}),s+=e-n),{total:s,ranges:r}}function ms({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let r=Math.floor(i*t);for(let n=0;;n++){let{from:s,to:o}=e[n],a=o-s;if(r<=a)return s+r;r-=a}}function gs(i,e){let t=0;for(let{from:r,to:n}of i.ranges){if(e<=n){t+=e-r;break}t+=n-r}return t/i.total}function nb(i,e){for(let t of i)if(e(t))return t}var kf={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}},Ol=class i{constructor(e,t,r){let n=0,s=0,o=0;this.viewports=r.map(({from:a,to:l})=>{let c=t.lineAt(a,Z.ByPos,e,0,0).top,h=t.lineAt(l,Z.ByPos,e,0,0).bottom;return n+=h-c,{from:a,to:l,top:c,bottom:h,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(t.height-n);for(let a of this.viewports)a.domTop=o+(a.top-s)*this.scale,o=a.domBottom=a.domTop+(a.bottom-a.top),s=a.bottom}toDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return n+(e-r)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);r=s.bottom,n=s.domBottom}}fromDOM(e){for(let t=0,r=0,n=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return r+(e-n)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);r=s.bottom,n=s.domBottom}}eq(e){return e instanceof i?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,r)=>t.from==e.viewports[r].from&&t.to==e.viewports[r].to):!1}};function Xr(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),r=e.toDOM(i.bottom);return new dt(i.from,i.length,t,r-t,Array.isArray(i._content)?i._content.map(n=>Xr(n,e)):i._content)}var Os=R.define({combine:i=>i.join(" ")}),yl=R.define({combine:i=>i.indexOf(!0)>-1}),bl=Ye.newName(),Qd=Ye.newName(),Md=Ye.newName(),_d={"&light":"."+Qd,"&dark":"."+Md};function wl(i,e,t){return new Ye(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,n=>{if(n=="&")return i;if(!t||!t[n])throw new RangeError(`Unsupported selector: ${n}`);return t[n]}):i+" "+r}})}var sb=wl("."+bl,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},_d),Nr="\uFFFF",vl=class{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(j.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Nr}readRange(e,t){if(!e)return this;let r=e.parentNode;for(let n=e;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==t)break;let a=Y.get(n),l=Y.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Ps(n))||Ps(o)&&(n.nodeName!="BR"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,t),this}readTextNode(e){let t=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,t.length));for(let r=0,n=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(a=n.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(r,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let l of this.points)l.node==e&&l.pos>this.text.length&&(l.pos-=o-1);r=s+o}}readNode(e){if(e.cmIgnore)return;let t=Y.get(e),r=t&&t.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==t&&(r.pos=this.text.length)}findPointInside(e,t){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(ob(e,r.node,r.offset)?t:0))}};function ob(i,e,t){for(;;){if(!e||t<At(e))return!1;if(e==i)return!0;t=yi(e)+1,e=e.parentNode}}var Ds=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},xl=class{constructor(e,t,r,n){this.typeOver=n,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,r,0))){let a=s||o?[]:cb(e),l=new vl(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=hb(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Ha(e.contentDOM,a.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Ha(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),h=e.viewport;if((A.ios||A.chrome)&&e.state.selection.main.empty&&l!=c&&(h.from>0||h.to<e.state.doc.length)){let u=Math.min(l,c),f=Math.max(l,c),d=h.from-u,m=h.to-f;(d==0||d==1||u==0)&&(m==0||m==-1||f==e.state.doc.length)&&(l=0,c=e.state.doc.length)}this.newSel=k.single(c,l)}}};function Dd(i,e){let t,{newSel:r}=e,n=i.state.selection.main,s=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=n.from,c=null;(s===8||A.android&&e.text.length<a-o)&&(l=n.to,c="end");let h=lb(i.state.doc.sliceString(o,a,Nr),e.text,l-o,c);h&&(A.chrome&&s==13&&h.toB==h.from+2&&e.text.slice(h.from,h.toB)==Nr+Nr&&h.toB--,t={from:o+h.from,to:o+h.toA,insert:X.of(e.text.slice(h.from,h.toB).split(Nr))})}else r&&(!i.hasFocus&&i.state.facet(Nt)||r.main.eq(n))&&(r=null);if(!t&&!r)return!1;if(!t&&e.typeOver&&!n.empty&&r&&r.main.empty?t={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,n.to)}:t&&t.from>=n.from&&t.to<=n.to&&(t.from!=n.from||t.to!=n.to)&&n.to-n.from-(t.to-t.from)<=4?t={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,n.to))}:(A.mac||A.android)&&t&&t.from==t.to&&t.from==n.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(r&&t.insert.length==2&&(r=k.single(r.main.anchor-1,r.main.head-1)),t={from:n.from,to:n.to,insert:X.of([" "])}):A.chrome&&t&&t.from==t.to&&t.from==n.head&&t.insert.toString()==`
 `&&i.lineWrapping&&(r&&(r=k.single(r.main.anchor-1,r.main.head-1)),t={from:n.from,to:n.to,insert:X.of([" "])}),t)return Ld(i,t,r,s);if(r&&!r.main.eq(n)){let o=!1,a="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),a=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:a}),!0}else return!1}function Ld(i,e,t,r=-1){if(A.ios&&i.inputState.flushIOSKey(e))return!0;let n=i.state.selection.main;if(A.android&&(e.to==n.to&&(e.from==n.from||e.from==n.from-1&&i.state.sliceDoc(e.from,n.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&tr(i.contentDOM,"Enter",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>n.head)&&tr(i.contentDOM,"Backspace",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&tr(i.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,a=()=>o||(o=ab(i,e,t));return i.state.facet(cd).some(l=>l(i,e.from,e.to,s,a))||i.dispatch(a()),!0}function ab(i,e,t){let r,n=i.state,s=n.selection.main;if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let a=s.from<e.from?n.sliceDoc(s.from,e.from):"",l=s.to>e.to?n.sliceDoc(e.to,s.to):"";r=n.replaceSelection(i.state.toText(a+e.insert.sliceString(0,void 0,i.state.lineBreak)+l))}else{let a=n.changes(e),l=t&&t.main.to<=a.newLength?t.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=i.state.sliceDoc(e.from,e.to),h,u=t&&wd(i,t.main.head);if(u){let m=e.insert.length-(e.to-e.from);h={from:u.from,to:u.to-m}}else h=i.state.doc.lineAt(s.head);let f=s.to-e.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let p=m.to-f,g=p-c.length;if(m.to-m.from!=d||i.state.sliceDoc(g,p)!=c||m.to>=h.from&&m.from<=h.to)return{range:m};let O=n.changes({from:g,to:p,insert:e.insert}),y=m.to-s.to;return{changes:O,range:l?k.range(Math.max(0,l.anchor+y),Math.max(0,l.head+y)):m.map(O)}})}else r={changes:a,selection:l&&n.selection.replaceRange(l)}}let o="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=".compose",i.inputState.compositionFirstChange&&(o+=".start",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function lb(i,e,t,r){let n=Math.min(i.length,e.length),s=0;for(;s<n&&i.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==n&&i.length==e.length)return null;let o=i.length,a=e.length;for(;o>0&&a>0&&i.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(r=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&i.length<e.length){let l=t<=s&&t>=o?s-t:0;s-=l,a=s+(a-o),o=s}else if(a<s){let l=t<=s&&t>=a?s-t:0;s-=l,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}function cb(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return t&&(e.push(new Ds(t,r)),(n!=t||s!=r)&&e.push(new Ds(n,s))),e}function hb(i,e){if(i.length==0)return null;let t=i[0].pos,r=i.length==2?i[1].pos:t;return t>-1&&r>-1?k.single(t+e,r+e):null}var ub={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Wa=A.ie&&A.ie_version<=11,Sl=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Ga,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let r of t)this.queue.push(r);(A.ie&&A.ie_version<=11||A.ios&&e.composing)&&t.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&e.constructor.EDIT_CONTEXT!==!1&&!(A.chrome&&A.chrome_version<126)&&(this.editContext=new kl(e),e.state.facet(Nt)&&(e.contentDOM.editContext=this.editContext.editContext)),Wa&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){e.type=="change"&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,r)=>t!=e[r]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Nt)?r.root.activeElement!=this.dom:!ws(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(A.ie&&A.ie_version<=11||A.android&&A.chrome)&&!r.state.selection.main.empty&&n.focusNode&&Ir(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Yr(e.root);if(!t)return!1;let r=A.safari&&e.root.nodeType==11&&iy(this.dom.ownerDocument)==this.dom&&fb(this.view,t)||t;if(!r||this.selectionRange.eq(r))return!1;let n=ws(this.dom,r);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&ay(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),n&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let r=this.dom;r;)if(r.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=t)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,ub),Wa&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Wa&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var r;if(!this.delayedAndroidKey){let n=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&tr(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,r=-1,n=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),t==-1?{from:t,to:r}=o:(t=Math.min(o.from,t),r=Math.max(o.to,r)))}return{from:t,to:r,typeOver:n}}readChange(){let{from:e,to:t,typeOver:r}=this.processRecords(),n=this.selectionChanged&&ws(this.dom,this.selectionRange);if(e<0&&!n)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new xl(this.view,e,t,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let r=this.view.state,n=Dd(this.view,t);return this.view.state==r&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),n}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type=="attributes"),e.type=="attributes"&&(t.flags|=4),e.type=="childList"){let r=Tf(t,e.previousSibling||e.target.previousSibling,-1),n=Tf(t,e.nextSibling||e.target.nextSibling,1);return{from:r?t.posAfter(r):t.posAtStart,to:n?t.posBefore(n):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener("change",this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener("change",this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Nt)!=e.state.facet(Nt)&&(e.view.contentDOM.editContext=e.state.facet(Nt)?this.editContext.editContext:null))}destroy(){var e,t,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Tf(i,e,t){for(;e;){let r=Y.get(e);if(r&&r.parent==i)return r;let n=e.parentNode;e=n!=i.dom?n:t>0?e.nextSibling:e.previousSibling}return null}function Pf(i,e){let t=e.startContainer,r=e.startOffset,n=e.endContainer,s=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor);return Ir(o.node,o.offset,n,s)&&([t,r,n,s]=[n,s,t,r]),{anchorNode:t,anchorOffset:r,focusNode:n,focusOffset:s}}function fb(i,e){if(e.getComposedRanges){let n=e.getComposedRanges(i.root)[0];if(n)return Pf(i,n)}let t=null;function r(n){n.preventDefault(),n.stopImmediatePropagation(),t=n.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",r,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",r,!0),t?Pf(i,t):null}var kl=class{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});t.addEventListener("textupdate",r=>{let{anchor:n}=e.state.selection.main,s={from:this.toEditorPos(r.updateRangeStart),to:this.toEditorPos(r.updateRangeEnd),insert:X.of(r.text.split(`
`))};s.from==this.from&&n<this.from?s.from=n:s.to==this.to&&n>this.to&&(s.to=n),!(s.from==s.to&&!s.insert.length)&&(this.pendingContextChange=s,Ld(e,s,k.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd))),this.pendingContextChange&&this.revertPending(e.state))}),t.addEventListener("characterboundsupdate",r=>{let n=[],s=null;for(let o=this.toEditorPos(r.rangeStart),a=this.toEditorPos(r.rangeEnd);o<a;o++){let l=e.coordsForChar(o);s=l&&new DOMRect(l.left,l.right,l.right-l.left,l.bottom-l.top)||s||new DOMRect,n.push(s)}t.updateCharacterBounds(r.rangeStart,n)}),t.addEventListener("textformatupdate",r=>{let n=[];for(let s of r.getTextFormats()){let o=s.underlineStyle,a=s.underlineThickness;if(o!="None"&&a!="None"){let l=`text-decoration: underline ${o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${a=="Thin"?1:2}px`;n.push(Q.mark({attributes:{style:l}}).range(this.toEditorPos(s.rangeStart),this.toEditorPos(s.rangeEnd)))}}e.dispatch({effects:pd.of(Q.set(n))})}),t.addEventListener("compositionstart",()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)}),t.addEventListener("compositionend",()=>{e.inputState.composing=-1,e.inputState.compositionFirstChange=null}),this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let n=Yr(r.root);n&&n.rangeCount&&this.editContext.updateSelectionBounds(n.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,r=!1,n=this.pendingContextChange;return e.changes.iterChanges((s,o,a,l,c)=>{if(r)return;let h=c.length-(o-s);if(n&&o>=n.to)if(n.from==s&&n.to==o&&n.insert.eq(c)){n=this.pendingContextChange=null,t+=h;return}else n=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=h,this.to+=h;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),c.toString()),this.to+=h}t+=h}),n&&!r&&this.revertPending(e.state),!r}update(e){!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.resetRange(e.state),this.editContext.updateText(0,this.editContext.text.length,e.state.doc.sliceString(this.from,this.to)),this.setSelection(e.state)):(e.docChanged||e.selectionSet)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.to+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),n=this.toContextPos(t.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=n)&&this.editContext.updateSelection(r,n)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e){return e+this.from}toContextPos(e){return e-this.from}},E=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(r=>r.forEach(n=>t(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||oy(e.parent)||document,this.viewState=new _s(e.state||j.create(e)),e.scrollTo&&e.scrollTo.is(fs)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet($r).map(r=>new Ur(r));for(let r of this.plugins)r.update(this);this.observer=new Sl(this),this.inputState=new ll(this),this.inputState.ensureHandlers(this.plugins),this.docView=new As(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...e){let t=e.length==1&&e[0]instanceof ae?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,r=!1,n,s=this.state;for(let f of e){if(f.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=f.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(f=>f.annotation(Ed))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Rd(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,h=null;if(c?(this.observer.clearDelayedAndroidKey(),h=this.observer.readChange(),(h&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(h=null)):this.observer.clear(),s.facet(j.phrases)!=this.state.facet(j.phrases))return this.setState(s);n=Rs.create(this,s,e),n.flags|=a;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let f of e){if(u&&(u=u.map(f.changes)),f.scrollIntoView){let{main:d}=f.state.selection;u=new zr(d.empty?d:k.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of f.effects)d.is(fs)&&(u=d.value.clip(this.state))}this.viewState.update(n,u),this.bidiCache=Ls.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),t=this.docView.update(n),this.state.facet(Br)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(f=>f.isUserEvent("select.pointer")))}finally{this.updateState=0}if(n.startState.facet(Os)!=n.state.facet(Os)&&(this.viewState.mustMeasureContent=!0),(t||r||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!n.empty)for(let f of this.state.facet(sl))try{f(n)}catch(d){Oe(this.state,d,"update listener")}(l||h)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),h&&!Dd(this,h)&&c.force&&tr(this.contentDOM,c.key,c.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new _s(e),this.plugins=e.facet($r).map(r=>new Ur(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new As(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet($r),r=e.state.facet($r);if(t!=r){let n=[];for(let s of r){let o=t.indexOf(s);if(o<0)n.push(new Ur(s));else{let a=this.plugins[o];a.mustUpdate=e,n.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=e;for(let n=0;n<this.plugins.length;n++)this.plugins[n].update(this);t!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(r){Oe(this.state,r,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(If(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(a>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let h=c.map(d=>{try{return d.read(this)}catch(m){return Oe(this.state,m),Cf}}),u=Rs.create(this,this.state,[]),f=!1;u.flags|=l,t?t.flags|=l:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),f=this.docView.update(u),f&&this.docViewUpdate());for(let d=0;d<c.length;d++)if(h[d]!=Cf)try{let m=c[d];m.write&&m.write(h[d],this)}catch(m){Oe(this.state,m)}if(f&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(sl))a(t)}get themeClasses(){return bl+" "+(this.state.facet(yl)?Md:Qd)+" "+this.state.facet(Os)}updateAttrs(){let e=Ef(this,md,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Nt)?"true":"false",class:"cm-content",style:`${A.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Ef(this,Xl,t);let r=this.observer.ignore(()=>{let n=el(this.contentDOM,this.contentAttrs,t),s=el(this.dom,this.editorAttrs,e);return n||s});return this.editorAttrs=e,this.contentAttrs=t,r}showAnnouncements(e){let t=!0;for(let r of e)for(let n of r.effects)if(n.is(i.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Br);let e=this.state.facet(i.cspNonce);Ye.mount(this.root,this.styleModules.concat(sb).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.spec!=e)&&this.pluginMap.set(e,t=this.plugins.find(r=>r.spec==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,r){return Ia(this,e,ff(this,e,t,r))}moveByGroup(e,t){return Ia(this,e,ff(this,e,t,r=>qy(this,e.head,r)))}visualLineSide(e,t){let r=this.bidiSpans(e),n=this.textDirectionAt(e.from),s=r[t?r.length-1:0];return k.cursor(s.side(t,n)+e.from,s.forward(!t,n)?1:-1)}moveToLineBoundary(e,t,r=!0){return Ly(this,e,t,r)}moveVertically(e,t,r){return Ia(this,e,Vy(this,e,t,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),vd(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let r=this.docView.coordsAt(e,t);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(e),s=this.bidiSpans(n),o=s[pt.find(s,e-n.from,-1,t)];return Vl(r,o.dir==F.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ud)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>db)return rd(e.length);let t=this.textDirectionAt(e.from),r;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||id(s.isolates,r=af(this,e))))return s.order;r||(r=af(this,e));let n=by(e.text,t,r);return this.bidiCache.push(new Ls(e.from,e.to,t,r,!0,n)),n}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||A.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nf(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return fs.of(new zr(typeof e=="number"?k.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return fs.of(new zr(k.cursor(r.from),"start","start",r.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return te.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return te.define(()=>({}),{eventObservers:e})}static theme(e,t){let r=Ye.newName(),n=[Os.of(r),Br.of(wl(`.${r}`,e))];return t&&t.dark&&n.push(yl.of(!0)),n}static baseTheme(e){return Ce.lowest(Br.of(wl("."+bl,e,_d)))}static findFromDOM(e){var t;let r=e.querySelector(".cm-content"),n=r&&Y.get(r)||Y.get(e);return((t=n?.rootView)===null||t===void 0?void 0:t.view)||null}};E.styleModule=Br;E.inputHandler=cd;E.scrollHandler=dd;E.focusChangeEffect=hd;E.perLineTextDirection=ud;E.exceptionSink=ld;E.updateListener=sl;E.editable=Nt;E.mouseSelectionStyle=ad;E.dragMovesSelection=od;E.clickAddsSelectionRange=sd;E.decorations=rn;E.outerDecorations=gd;E.atomicRanges=Nl;E.bidiIsolatedRanges=Od;E.scrollMargins=yd;E.darkTheme=yl;E.cspNonce=R.define({combine:i=>i.length?i[0]:""});E.contentAttributes=Xl;E.editorAttributes=md;E.lineWrapping=E.contentAttributes.of({class:"cm-lineWrapping"});E.announce=_.define();var db=4096,Cf={},Ls=class i{constructor(e,t,r,n,s,o){this.from=e,this.to=t,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let r=[],n=e.length?e[e.length-1].dir:F.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==n&&!t.touchesRange(o.from,o.to)&&r.push(new i(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Ef(i,e,t){for(let r=i.state.facet(e),n=r.length-1;n>=0;n--){let s=r[n],o=typeof s=="function"?s(i):s;o&&Ka(o,t)}return t}var pb=A.mac?"mac":A.windows?"win":A.linux?"linux":"key";function mb(i,e){let t=i.split(/-(?!$)/),r=t[t.length-1];r=="Space"&&(r=" ");let n,s,o,a;for(let l=0;l<t.length-1;++l){let c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))n=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))o=!0;else if(/^mod$/i.test(c))e=="mac"?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return n&&(r="Alt-"+r),s&&(r="Ctrl-"+r),a&&(r="Meta-"+r),o&&(r="Shift-"+r),r}function ys(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}var gb=Ce.default(E.domEventHandlers({keydown(i,e){return $d(qd(e.state),i,e,"editor")}})),Qt=R.define({enables:gb}),Rf=new WeakMap;function qd(i){let e=i.facet(Qt),t=Rf.get(e);return t||Rf.set(e,t=yb(e.reduce((r,n)=>r.concat(n),[]))),t}function Vd(i,e,t){return $d(qd(i.state),e,i,t)}var jt=null,Ob=4e3;function yb(i,e=pb){let t=Object.create(null),r=Object.create(null),n=(o,a)=>{let l=r[o];if(l==null)r[o]=a;else if(l!=a)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},s=(o,a,l,c,h)=>{var u,f;let d=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(O=>mb(O,e));for(let O=1;O<m.length;O++){let y=m.slice(0,O).join(" ");n(y,!0),d[y]||(d[y]={preventDefault:!0,stopPropagation:!1,run:[x=>{let v=jt={view:x,prefix:y,scope:o};return setTimeout(()=>{jt==v&&(jt=null)},Ob),!0}]})}let p=m.join(" ");n(p,!1);let g=d[p]||(d[p]={preventDefault:!1,stopPropagation:!1,run:((f=(u=d._any)===null||u===void 0?void 0:u.run)===null||f===void 0?void 0:f.slice())||[]});l&&g.run.push(l),c&&(g.preventDefault=!0),h&&(g.stopPropagation=!0)};for(let o of i){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let h=t[c]||(t[c]=Object.create(null));h._any||(h._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:u}=o;for(let f in h)h[f].run.push(d=>u(d,Tl))}let l=o[e]||o.key;if(l)for(let c of a)s(c,l,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(c,"Shift-"+l,o.shift,o.preventDefault,o.stopPropagation)}return t}var Tl=null;function $d(i,e,t,r){Tl=e;let n=Ju(e),s=oe(n,0),o=Te(s)==n.length&&n!=" ",a="",l=!1,c=!1,h=!1;jt&&jt.view==t&&jt.scope==r&&(a=jt.prefix+" ",Sd.indexOf(e.keyCode)<0&&(c=!0,jt=null));let u=new Set,f=g=>{if(g){for(let O of g.run)if(!u.has(O)&&(u.add(O),O(t)))return g.stopPropagation&&(h=!0),!0;g.preventDefault&&(g.stopPropagation&&(h=!0),c=!0)}return!1},d=i[r],m,p;return d&&(f(d[a+ys(n,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(A.windows&&e.ctrlKey&&e.altKey)&&(m=Rt[e.keyCode])&&m!=n?(f(d[a+ys(m,e,!0)])||e.shiftKey&&(p=Yi[e.keyCode])!=n&&p!=m&&f(d[a+ys(p,e,!1)]))&&(l=!0):o&&e.shiftKey&&f(d[a+ys(n,e,!0)])&&(l=!0),!l&&f(d._any)&&(l=!0)),c&&(l=!0),l&&h&&e.stopPropagation(),Tl=null,l}var nn=class i{constructor(e,t,r,n,s){this.className=e,this.left=t,this.top=r,this.width=n,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,r){if(r.empty){let n=e.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Bd(e);return[new i(t,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return bb(e,t,r)}};function Bd(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==F.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function Af(i,e,t,r){let n=i.coordsAtPos(e,t*2);if(!n)return r;let s=i.dom.getBoundingClientRect(),o=(n.top+n.bottom)/2,a=i.posAtCoords({x:s.left+1,y:o}),l=i.posAtCoords({x:s.right-1,y:o});return a==null||l==null?r:{from:Math.max(r.from,Math.min(a,l)),to:Math.min(r.to,Math.max(a,l))}}function bb(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let r=Math.max(t.from,i.viewport.from),n=Math.min(t.to,i.viewport.to),s=i.textDirection==F.LTR,o=i.contentDOM,a=o.getBoundingClientRect(),l=Bd(i),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),f=a.right-(h?parseInt(h.paddingRight):0),d=al(i,r),m=al(i,n),p=d.type==Re.Text?d:null,g=m.type==Re.Text?m:null;if(p&&(i.lineWrapping||d.widgetLineBreaks)&&(p=Af(i,r,1,p)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=Af(i,n,-1,g)),p&&g&&p.from==g.from&&p.to==g.to)return y(x(t.from,t.to,p));{let w=p?x(t.from,null,p):v(d,!1),T=g?x(null,t.to,g):v(m,!0),P=[];return(p||d).to<(g||m).from-(p&&g?1:0)||d.widgetLineBreaks>1&&w.bottom+i.defaultLineHeight/2<T.top?P.push(O(u,w.bottom,f,T.top)):w.bottom<T.top&&i.elementAtHeight((w.bottom+T.top)/2).type==Re.Text&&(w.bottom=T.top=(w.bottom+T.top)/2),y(w).concat(P).concat(y(T))}function O(w,T,P,M){return new nn(e,w-l.left,T-l.top-.01,P-w,M-T+.01)}function y({top:w,bottom:T,horizontal:P}){let M=[];for(let q=0;q<P.length;q+=2)M.push(O(P[q],w,P[q+1],T));return M}function x(w,T,P){let M=1e9,q=-1e9,L=[];function B(N,ee,Ae,Qe,Be){let Fe=i.coordsAtPos(N,N==P.to?-2:2),he=i.coordsAtPos(Ae,Ae==P.from?2:-2);!Fe||!he||(M=Math.min(Fe.top,he.top,M),q=Math.max(Fe.bottom,he.bottom,q),Be==F.LTR?L.push(s&&ee?u:Fe.left,s&&Qe?f:he.right):L.push(!s&&Qe?u:he.left,!s&&ee?f:Fe.right))}let V=w??P.from,H=T??P.to;for(let N of i.visibleRanges)if(N.to>V&&N.from<H)for(let ee=Math.max(N.from,V),Ae=Math.min(N.to,H);;){let Qe=i.state.doc.lineAt(ee);for(let Be of i.bidiSpans(Qe)){let Fe=Be.from+Qe.from,he=Be.to+Qe.from;if(Fe>=Ae)break;he>ee&&B(Math.max(Fe,ee),w==null&&Fe<=V,Math.min(he,Ae),T==null&&he>=H,Be.dir)}if(ee=Qe.to+1,ee>=Ae)break}return L.length==0&&B(V,w==null,H,T==null,i.textDirection),{top:M,bottom:q,horizontal:L}}function v(w,T){let P=a.top+(T?w.top:w.bottom);return{top:P,bottom:P,horizontal:[]}}}function wb(i,e){return i.constructor==e.constructor&&i.eq(e)}var Pl=class{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Ss)!=e.state.facet(Ss)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,r=e.facet(Ss);for(;t<r.length&&r[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,r)=>!wb(t,this.drawn[r]))){let t=this.dom.firstChild,r=0;for(let n of e)n.update&&t&&n.constructor&&this.drawn[r].constructor&&n.update(t,this.drawn[r])?(t=t.nextSibling,r++):this.dom.insertBefore(n.draw(),t);for(;t;){let n=t.nextSibling;t.remove(),t=n}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},Ss=R.define();function Xd(i){return[te.define(e=>new Pl(e,i)),Ss.of(i)]}var Nd=!A.ios,sn=R.define({combine(i){return ve(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function jd(i={}){return[sn.of(i),vb,xb,Sb,fd.of(!0)]}function Id(i){return i.startState.facet(sn)!=i.state.facet(sn)}var vb=Xd({above:!0,markers(i){let{state:e}=i,t=e.facet(sn),r=[];for(let n of e.selection.ranges){let s=n==e.selection.main;if(n.empty?!s||Nd:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=n.empty?n:k.cursor(n.head,n.head>n.anchor?-1:1);for(let l of nn.forRange(i,o,a))r.push(l)}}return r},update(i,e){i.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=Id(i);return t&&Qf(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){Qf(e.state,i)},class:"cm-cursorLayer"});function Qf(i,e){e.style.animationDuration=i.facet(sn).cursorBlinkRate+"ms"}var xb=Xd({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:nn.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||Id(i)},class:"cm-selectionLayer"}),Cl={".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"}},".cm-content":{"& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}};Nd&&(Cl[".cm-line"].caretColor=Cl[".cm-content"].caretColor="transparent !important");var Sb=Ce.highest(E.theme(Cl)),Wd=_.define({map(i,e){return i==null?null:e.mapPos(i)}}),jr=K.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,r)=>r.is(Wd)?r.value:t,i)}}),kb=te.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(jr);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(jr)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(jr),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:t.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(jr)!=i&&this.view.dispatch({effects:Wd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function zd(){return[jr,kb]}function Mf(i,e,t,r,n){e.lastIndex=0;for(let s=i.iterRange(t,r),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)n(o+a.index,a)}function Tb(i,e){let t=i.visibleRanges;if(t.length==1&&t[0].from==i.viewport.from&&t[0].to==i.viewport.to)return t;let r=[];for(let{from:n,to:s}of t)n=Math.max(i.state.doc.lineAt(n).from,n-e),s=Math.min(i.state.doc.lineAt(s).to,s+e),r.length&&r[r.length-1].to>=n?r[r.length-1].to=s:r.push({from:n,to:s});return r}var El=class{constructor(e){let{regexp:t,decoration:r,decorate:n,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,n)this.addMatch=(a,l,c,h)=>n(h,c,c+a[0].length,a,l);else if(typeof r=="function")this.addMatch=(a,l,c,h)=>{let u=r(a,l,c);u&&h(c,c+a[0].length,u)};else if(r)this.addMatch=(a,l,c,h)=>h(c,c+a[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new nt,r=t.add.bind(t);for(let{from:n,to:s}of Tb(e,this.maxLength))Mf(e.state.doc,this.regexp,n,s,(o,a)=>this.addMatch(a,e,o,r));return t.finish()}updateDeco(e,t){let r=1e9,n=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(r=Math.min(a,r),n=Math.max(l,n))}),e.viewportChanged||n-r>1e3?this.createDeco(e.view):n>-1?this.updateRange(e.view,t.map(e.changes),r,n):t}updateRange(e,t,r,n){for(let s of e.visibleRanges){let o=Math.max(s.from,r),a=Math.min(s.to,n);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,h=Math.max(s.from,l.from),u=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){h=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){u=a;break}}let f=[],d,m=(p,g,O)=>f.push(O.range(p,g));if(l==c)for(this.regexp.lastIndex=h-l.from;(d=this.regexp.exec(l.text))&&d.index<u-l.from;)this.addMatch(d,e,d.index+l.from,m);else Mf(e.state.doc,this.regexp,h,u,(p,g)=>this.addMatch(g,e,p,m));t=t.update({filterFrom:h,filterTo:u,filter:(p,g)=>p<h||g>u,add:f})}}return t}},Rl=/x/.unicode!=null?"gu":"g",Pb=new RegExp(`[\0-\b
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Rl),Cb={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},za=null;function Eb(){var i;if(za==null&&typeof document<"u"&&document.body){let e=document.body.style;za=((i=e.tabSize)!==null&&i!==void 0?i:e.MozTabSize)!=null}return za||!1}var ks=R.define({combine(i){let e=ve(i,{render:null,specialChars:Pb,addSpecialChars:null});return(e.replaceTabs=!Eb())&&(e.specialChars=new RegExp("	|"+e.specialChars.source,Rl)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Rl)),e}});function Ud(i={}){return[ks.of(i),Rb()]}var _f=null;function Rb(){return _f||(_f=te.fromClass(class{constructor(i){this.view=i,this.decorations=Q.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(i.state.facet(ks)),this.decorations=this.decorator.createDeco(i)}makeDecorator(i){return new El({regexp:i.specialChars,decoration:(e,t,r)=>{let{doc:n}=t.state,s=oe(e[0],0);if(s==9){let o=n.lineAt(r),a=t.state.tabSize,l=Et(o.text,a,r-o.from);return Q.replace({widget:new Ql((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Q.replace({widget:new Al(i,s)}))},boundary:i.replaceTabs?void 0:/[^]/})}update(i){let e=i.state.facet(ks);i.startState.facet(ks)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(i.view)):this.decorations=this.decorator.updateDeco(i,this.decorations)}},{decorations:i=>i.decorations}))}var Ab="\u2022";function Qb(i){return i>=32?Ab:i==10?"\u2424":String.fromCharCode(9216+i)}var Al=class extends qe{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Qb(this.code),r=e.state.phrase("Control character")+" "+(Cb[this.code]||"0x"+this.code.toString(16)),n=this.options.render&&this.options.render(this.code,r,t);if(n)return n;let s=document.createElement("span");return s.textContent=t,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}},Ql=class extends qe{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="	",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};function Fd(){return _b}var Mb=Q.line({class:"cm-activeLine"}),_b=te.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let r of i.state.selection.ranges){let n=i.lineBlockAt(r.head);n.from>e&&(t.push(Mb.range(n.from)),e=n.from)}return Q.set(t)}},{decorations:i=>i.decorations});var Ml=2e3;function Db(i,e,t){let r=Math.min(e.line,t.line),n=Math.max(e.line,t.line),s=[];if(e.off>Ml||t.off>Ml||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=r;l<=n;l++){let c=i.doc.line(l);c.length<=a&&s.push(k.range(c.from+o,c.to+a))}}else{let o=Math.min(e.col,t.col),a=Math.max(e.col,t.col);for(let l=r;l<=n;l++){let c=i.doc.line(l),h=cs(c.text,o,i.tabSize,!0);if(h<0)s.push(k.cursor(c.to));else{let u=cs(c.text,a,i.tabSize);s.push(k.range(c.from+h,c.from+u))}}}return s}function Lb(i,e){let t=i.coordsAtPos(i.viewport.from);return t?Math.round(Math.abs((t.left-e)/i.defaultCharacterWidth)):-1}function Df(i,e){let t=i.posAtCoords({x:e.clientX,y:e.clientY},!1),r=i.state.doc.lineAt(t),n=t-r.from,s=n>Ml?-1:n==r.length?Lb(i,e.clientX):Et(r.text,i.state.tabSize,t-r.from);return{line:r.number,col:s,off:n}}function qb(i,e){let t=Df(i,e),r=i.state.selection;return t?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(t.line).from),o=n.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let a=Df(i,n);if(!a)return r;let l=Db(i.state,t,a);return l.length?o?k.create(l.concat(r.ranges)):k.create(l):r}}:null}function Hd(i){let e=i?.eventFilter||(t=>t.altKey&&t.button==0);return E.mouseSelectionStyle.of((t,r)=>e(r)?qb(t,r):null)}var Vb={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},$b={style:"cursor: crosshair"};function Gd(i={}){let[e,t]=Vb[i.key||"Alt"],r=te.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==e||t(n))},keyup(n){(n.keyCode==e||!t(n))&&this.set(!1)},mousemove(n){this.set(t(n))}}});return[r,E.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?$b:null})]}var Vr="-10000px",qs=class{constructor(e,t,r,n){this.facet=t,this.createTooltipView=r,this.removeTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(e,t){var r;let n=e.state.facet(this.facet),s=n.filter(l=>l);if(n===this.input){for(let l of this.tooltipViews)l.update&&l.update(e);return!1}let o=[],a=t?[]:null;for(let l=0;l<s.length;l++){let c=s[l],h=-1;if(c){for(let u=0;u<this.tooltips.length;u++){let f=this.tooltips[u];f&&f.create==c.create&&(h=u)}if(h<0)o[l]=this.createTooltipView(c,l?o[l-1]:null),a&&(a[l]=!!c.above);else{let u=o[l]=this.tooltipViews[h];a&&(a[l]=t[h]),u.update&&u.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function Bb(i){let{win:e}=i;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}var Ua=R.define({combine:i=>{var e,t,r;return{position:A.ios?"absolute":((e=i.find(n=>n.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(n=>n.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Bb}}}),Lf=new WeakMap,jl=te.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(Ua);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new qs(i,on,(t,r)=>this.createTooltip(t,r),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,r=i.state.facet(Ua);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;t=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),r=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let n=document.createElement("div");n.className="cm-tooltip-arrow",t.dom.appendChild(n)}return t.dom.style.position=this.position,t.dom.style.top=Vr,t.dom.style.left="0px",this.container.insertBefore(t.dom,r),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),e=1,t=1,r=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(A.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==Vr&&n.style.left=="0px"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position=="absolute")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Ua).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:r}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:t,space:r,scaleX:n,scaleY:s}=i,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:h}=c,u=i.pos[a],f=i.size[a];if(!u||u.bottom<=Math.max(t.top,r.top)||u.top>=Math.min(t.bottom,r.bottom)||u.right<Math.max(t.left,r.left)-.1||u.left>Math.min(t.right,r.right)+.1){h.style.top=Vr;continue}let d=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=d?7:0,p=f.right-f.left,g=(e=Lf.get(c))!==null&&e!==void 0?e:f.bottom-f.top,O=c.offset||Nb,y=this.view.textDirection==F.LTR,x=f.width>r.right-r.left?y?r.left:r.right-f.width:y?Math.min(u.left-(d?14:0)+O.x,r.right-p):Math.max(r.left,u.left-p+(d?14:0)-O.x),v=this.above[a];!l.strictSide&&(v?u.top-(f.bottom-f.top)-O.y<r.top:u.bottom+(f.bottom-f.top)+O.y>r.bottom)&&v==r.bottom-u.bottom>u.top-r.top&&(v=this.above[a]=!v);let w=(v?u.top-r.top:r.bottom-u.bottom)-m;if(w<g&&c.resize!==!1){if(w<this.view.defaultLineHeight){h.style.top=Vr;continue}Lf.set(c,g),h.style.height=(g=w)/s+"px"}else h.style.height&&(h.style.height="");let T=v?u.top-g-m-O.y:u.bottom+m+O.y,P=x+p;if(c.overlap!==!0)for(let M of o)M.left<P&&M.right>x&&M.top<T+g&&M.bottom>T&&(T=v?M.top-g-2-m:M.bottom+m+2);if(this.position=="absolute"?(h.style.top=(T-i.parent.top)/s+"px",h.style.left=(x-i.parent.left)/n+"px"):(h.style.top=T/s+"px",h.style.left=x/n+"px"),d){let M=u.left+(y?O.x:-O.x)-(x+14-7);d.style.left=M/n+"px"}c.overlap!==!0&&o.push({left:x,top:T,right:P,bottom:T+g}),h.classList.toggle("cm-tooltip-above",v),h.classList.toggle("cm-tooltip-below",!v),c.positioned&&c.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=Vr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),Xb=E.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Nb={x:0,y:0},on=R.define({enables:[jl,Xb]}),Vs=R.define({combine:i=>i.reduce((e,t)=>e.concat(t),[])}),$s=class i{static create(e){return new i(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new qs(e,Vs,(t,r)=>this.createHostedView(t,r),t=>t.dom.remove())}createHostedView(e,t){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let r of this.manager.tooltipViews){let n=r[e];if(n!==void 0){if(t===void 0)t=n;else if(t!==n)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}},jb=on.compute([Vs],i=>{let e=i.facet(Vs);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var r;return(r=t.end)!==null&&r!==void 0?r:t.pos})),create:$s.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),_l=class{constructor(e,t,r,n,s){this.view=e,this.source=t,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,r=e.docView.nearest(t.target);if(!r)return;let n,s=1;if(r instanceof Jr)n=r.posAtStart;else{if(n=e.posAtCoords(t),n==null)return;let a=e.coordsAtPos(n);if(!a||t.y<a.top||t.y>a.bottom||t.x<a.left-e.defaultCharacterWidth||t.x>a.right+e.defaultCharacterWidth)return;let l=e.bidiSpans(e.state.doc.lineAt(n)).find(h=>h.from<=n&&h.to>=n),c=l&&l.dir==F.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,n,s);if(o?.then){let a=this.pending={pos:n};o.then(l=>{this.pending==a&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Oe(e.state,l,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(jl),t=e?e.manager.tooltips.findIndex(r=>r.create==$s.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!Ib(s.dom,e)||this.pending){let{pos:o}=n[0]||this.pending,a=(r=(t=n[0])===null||t===void 0?void 0:t.end)!==null&&r!==void 0?r:o;(o==a?this.view.posAtCoords(this.lastMove)!=o:!Wb(this.view,o,a,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=r=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}},bs=4;function Ib(i,e){let t=i.getBoundingClientRect();return e.clientX>=t.left-bs&&e.clientX<=t.right+bs&&e.clientY>=t.top-bs&&e.clientY<=t.bottom+bs}function Wb(i,e,t,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),a=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.right<r||o.top>n||Math.min(o.bottom,a)<n)return!1;let l=i.posAtCoords({x:r,y:n},!1);return l>=e&&l<=t}function Yd(i,e={}){let t=_.define(),r=K.define({create(){return[]},update(n,s){if(n.length&&(e.hideOnChange&&(s.docChanged||s.selection)?n=[]:e.hideOn&&(n=n.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let a of n){let l=s.changes.mapPos(a.pos,-1,de.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),a);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),o.push(c)}}n=o}for(let o of s.effects)o.is(t)&&(n=o.value),o.is(zb)&&(n=[]);return n},provide:n=>Vs.from(n)});return[r,te.define(n=>new _l(n,i,r,t,e.hoverTime||300)),jb]}function Il(i,e){let t=i.plugin(jl);if(!t)return null;let r=t.manager.tooltips.indexOf(e);return r<0?null:t.manager.tooltipViews[r]}var zb=_.define();var qf=R.define({combine(i){let e,t;for(let r of i)e=e||r.topContainer,t=t||r.bottomContainer;return{topContainer:e,bottomContainer:t}}});function xi(i,e){let t=i.plugin(Zd),r=t?t.specs.indexOf(e):-1;return r>-1?t.panels[r]:null}var Zd=te.fromClass(class{constructor(i){this.input=i.state.facet(vi),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(i));let e=i.state.facet(qf);this.top=new Ki(i,!0,e.topContainer),this.bottom=new Ki(i,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(i){let e=i.state.facet(qf);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Ki(i.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ki(i.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=i.state.facet(vi);if(t!=this.input){let r=t.filter(l=>l),n=[],s=[],o=[],a=[];for(let l of r){let c=this.specs.indexOf(l),h;c<0?(h=l(i.view),a.push(h)):(h=this.panels[c],h.update&&h.update(i)),n.push(h),(h.top?s:o).push(h)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let l of a)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>E.scrollMargins.of(e=>{let t=e.plugin(i);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})}),Ki=class{constructor(e,t,r){this.view=e,this.top=t,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Vf(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Vf(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}};function Vf(i){let e=i.nextSibling;return i.remove(),e}var vi=R.define({enables:Zd}),je=class extends rt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};je.prototype.elementClass="";je.prototype.toDOM=void 0;je.prototype.mapMode=de.TrackBefore;je.prototype.startSide=je.prototype.endSide=-1;je.prototype.point=!0;var Ts=R.define(),Ub={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>I.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Hr=R.define();function Wl(i){return[Jd(),Hr.of(Object.assign(Object.assign({},Ub),i))]}var Dl=R.define({combine:i=>i.some(e=>e)});function Jd(i){let e=[Fb];return i&&i.fixed===!1&&e.push(Dl.of(!0)),e}var Fb=te.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet(Hr).map(e=>new Bs(i,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!i.state.facet(Dl),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,r=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(r<(t.to-t.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(Dl)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&this.dom.remove();let t=I.iter(this.view.state.facet(Ts),this.view.viewport.from),r=[],n=this.gutters.map(s=>new ql(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==Re.Text&&o){Ll(t,r,a.from);for(let l of n)l.line(this.view,a,r);o=!1}else if(a.widget)for(let l of n)l.widget(this.view,a)}else if(s.type==Re.Text){Ll(t,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(i){let e=i.startState.facet(Hr),t=i.state.facet(Hr),r=i.docChanged||i.heightChanged||i.viewportChanged||!I.eq(i.startState.facet(Ts),i.state.facet(Ts),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of t){let o=e.indexOf(s);o<0?n.push(new Bs(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>E.scrollMargins.of(e=>{let t=e.plugin(i);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==F.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function $f(i){return Array.isArray(i)?i:[i]}function Ll(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}var ql=class{constructor(e,t,r){this.gutter=e,this.height=r,this.i=0,this.cursor=I.iter(e.markers,t.from)}addElement(e,t,r){let{gutter:n}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==n.elements.length){let a=new Xs(e,o,s,r);n.elements.push(a),n.dom.appendChild(a.dom)}else n.elements[this.i].update(e,o,s,r);this.height=t.bottom,this.i++}line(e,t,r){let n=[];Ll(this.cursor,n,t.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(e,t,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,n)}widget(e,t){let r=this.gutter.config.widgetMarker(e,t.widget,t);r&&this.addElement(e,t,[r])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}},Bs=class{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in t.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();o=(l.top+l.bottom)/2}else o=n.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[r](e,a,n)&&n.preventDefault()});this.markers=$f(t.markers(e)),t.initialSpacer&&(this.spacer=new Xs(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=$f(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],e);n!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[n])}let r=e.view.viewport;return!I.eq(this.markers,t,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}},Xs=class{constructor(e,t,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,r,n)}update(e,t,r,n){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Hb(this.markers,n)||this.setMarkers(e,n)}setMarkers(e,t){let r="cm-gutterElement",n=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let h=l.elementClass;h&&(r+=" "+h);for(let u=o;u<this.markers.length;u++)if(this.markers[u].compare(l)){a=u,c=!0;break}}else a=this.markers.length;for(;o<a;){let h=this.markers[o++];if(h.toDOM){h.destroy(n);let u=n.nextSibling;n.remove(),n=u}}if(!l)break;l.toDOM&&(c?n=n.nextSibling:this.dom.insertBefore(l.toDOM(e),n)),c&&o++}this.dom.className=r,this.markers=t}destroy(){this.setMarkers(null,[])}};function Hb(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}var Gb=R.define(),er=R.define({combine(i){return ve(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let r=Object.assign({},e);for(let n in t){let s=r[n],o=t[n];r[n]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return r}})}}),Gr=class extends je{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}};function Fa(i,e){return i.state.facet(er).formatNumber(e,i.state)}var Yb=Hr.compute([er],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Gb)},lineMarker(e,t,r){return r.some(n=>n.toDOM)?null:new Gr(Fa(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(er)!=e.state.facet(er),initialSpacer(e){return new Gr(Fa(e,Bf(e.state.doc.lines)))},updateSpacer(e,t){let r=Fa(t.view,Bf(t.view.state.doc.lines));return r==e.number?e:new Gr(r)},domEventHandlers:i.facet(er).domEventHandlers}));function Kd(i={}){return[er.of(i),Jd(),Yb]}function Bf(i){let e=9;for(;e<i;)e=e*10+9;return e}var Zb=new class extends je{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Jb=Ts.compute(["selection"],i=>{let e=[],t=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.head).from;n>t&&(t=n,e.push(Zb.range(n)))}return I.of(e)});function ep(){return Jb}var Kb=0,an=class{constructor(e,t){this.from=e,this.to=t}},D=class{constructor(e={}){this.id=Kb++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=xe.match(e)),t=>{let r=e(t);return r===void 0?null:[this,r]}}};D.closedBy=new D({deserialize:i=>i.split(" ")});D.openedBy=new D({deserialize:i=>i.split(" ")});D.group=new D({deserialize:i=>i.split(" ")});D.isolate=new D({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});D.contextHash=new D({perNode:!0});D.lookAhead=new D({perNode:!0});D.mounted=new D({perNode:!0});var ir=class{constructor(e,t,r){this.tree=e,this.overlay=t,this.parser=r}static get(e){return e&&e.props&&e.props[D.mounted.id]}},ew=Object.create(null),xe=class i{constructor(e,t,r,n=0){this.name=e,this.props=t,this.id=r,this.flags=n}static define(e){let t=e.props&&e.props.length?Object.create(null):ew,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),n=new i(e.name||"",t,e.id,r);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return n}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(D.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let r in e)for(let n of r.split(" "))t[n]=e[r];return r=>{for(let n=r.prop(D.group),s=-1;s<(n?n.length:0);s++){let o=t[s<0?r.name:n[s]];if(o)return o}}}};xe.none=new xe("",Object.create(null),0,8);var ln=class i{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let r of this.types){let n=null;for(let s of e){let o=s(r);o&&(n||(n=Object.assign({},r.props)),n[o[0].id]=o[1])}t.push(n?new xe(r.name,n,r.id,r.flags):r)}return new i(t)}},js=new WeakMap,tp=new WeakMap,ie;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays"})(ie||(ie={}));var ne=class i{constructor(e,t,r,n,s){if(this.type=e,this.children=t,this.positions=r,this.length=n,this.props=null,s&&s.length){this.props=Object.create(null);for(let[o,a]of s)this.props[typeof o=="number"?o:o.id]=a}}toString(){let e=ir.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let r of this.children){let n=r.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new hn(this.topNode,e)}cursorAt(e,t=0,r=0){let n=js.get(this)||this.topNode,s=new hn(n);return s.moveTo(e,t),js.set(this,s._tree),s}get topNode(){return new Ke(this,0,0,null)}resolve(e,t=0){let r=cn(js.get(this)||this.topNode,e,t,!1);return js.set(this,r),r}resolveInner(e,t=0){let r=cn(tp.get(this)||this.topNode,e,t,!0);return tp.set(this,r),r}resolveStack(e,t=0){return tw(this,e,t)}iterate(e){let{enter:t,leave:r,from:n=0,to:s=this.length}=e,o=e.mode||0,a=(o&ie.IncludeAnonymous)>0;for(let l=this.cursor(o|ie.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=n&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(a||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Zl(xe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,r,n)=>new i(this.type,t,r,n,this.propValues),e.makeTree||((t,r,n)=>new i(xe.none,t,r,n)))}static build(e){return iw(e)}};ne.empty=new ne(xe.none,[],[],0);var zl=class i{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},Ft=class i{constructor(e,t,r){this.buffer=e,this.length=t,this.set=r}get type(){return xe.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],r=this.buffer[e+3],n=this.set.types[t],s=n.name;if(/\W/.test(s)&&!n.isError&&(s=JSON.stringify(s)),e+=4,r==e)return s;let o=[];for(;e<r;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,r,n,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(np(s,n,o[l+1],o[l+2])&&(a=l,r>0));l=o[l+3]);return a}slice(e,t,r){let n=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=n[a++],s[l++]=n[a++]-r;let c=s[l++]=n[a++]-r;s[l++]=n[a++]-e,o=Math.max(o,c)}return new i(s,o,this.set)}};function np(i,e,t,r){switch(i){case-2:return t<e;case-1:return r>=e&&t<e;case 0:return t<e&&r>e;case 1:return t<=e&&r>e;case 2:return r>e;case 4:return!0}}function cn(i,e,t,r){for(var n;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!r&&i instanceof Ke&&i.index<0?null:i.parent;if(!o)return i;i=o}let s=r?0:ie.IgnoreOverlays;if(r)for(let o=i,a=o.parent;a;o=a,a=o.parent)o instanceof Ke&&o.index<0&&((n=a.enter(e,t,s))===null||n===void 0?void 0:n.from)!=o.from&&(i=a);for(;;){let o=i.enter(e,t,s);if(!o)return i;i=o}}var Ws=class{cursor(e=0){return new hn(this,e)}getChild(e,t=null,r=null){let n=ip(this,e,t,r);return n.length?n[0]:null}getChildren(e,t=null,r=null){return ip(this,e,t,r)}resolve(e,t=0){return cn(this,e,t,!1)}resolveInner(e,t=0){return cn(this,e,t,!0)}matchContext(e){return Ul(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),r=this;for(;t;){let n=t.lastChild;if(!n||n.to!=t.to)break;n.type.isError&&n.from==n.to?(r=t,t=n.prevSibling):t=n}return r}get node(){return this}get next(){return this.parent}},Ke=class i extends Ws{constructor(e,t,r,n){super(),this._tree=e,this.from=t,this.index=r,this._parent=n}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,r,n,s=0){for(let o=this;;){for(let{children:a,positions:l}=o._tree,c=t>0?a.length:-1;e!=c;e+=t){let h=a[e],u=l[e]+o.from;if(np(n,r,u,u+h.length)){if(h instanceof Ft){if(s&ie.ExcludeBuffers)continue;let f=h.findChild(0,h.buffer.length,t,r-u,n);if(f>-1)return new Si(new Fl(o,h,e,u),null,f)}else if(s&ie.IncludeAnonymous||!h.type.isAnonymous||Yl(h)){let f;if(!(s&ie.IgnoreMounts)&&(f=ir.get(h))&&!f.overlay)return new i(f.tree,u,e,o);let d=new i(h,u,e,o);return s&ie.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(t<0?h.children.length-1:0,t,r,n)}}}if(s&ie.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,r=0){let n;if(!(r&ie.IgnoreOverlays)&&(n=ir.get(this._tree))&&n.overlay){let s=e-this.from;for(let{from:o,to:a}of n.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function ip(i,e,t,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=n.type.is(t),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(e)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function Ul(i,e,t=e.length-1){for(let r=i.parent;t>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[t]&&e[t]!=r.name)return!1;t--}}return!0}var Fl=class{constructor(e,t,r,n){this.parent=e,this.buffer=t,this.index=r,this.start=n}},Si=class i extends Ws{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,r){super(),this.context=e,this._parent=t,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,t,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,r=0){if(r&ie.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new i(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new i(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];e.push(r.slice(n,s,o)),t.push(0)}return new ne(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function sp(i){if(!i.length)return null;let e=0,t=i[0];for(let s=1;s<i.length;s++){let o=i[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let r=t instanceof Ke&&t.index<0?null:t.parent,n=i.slice();return r?n[e]=r:n.splice(e,1),new Hl(n,t)}var Hl=class{constructor(e,t){this.heads=e,this.node=t}get next(){return sp(this.heads)}};function tw(i,e,t){let r=i.resolveInner(e,t),n=null;for(let s=r instanceof Ke?r:r.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(n||(n=[r])).push(o.resolve(e,t)),s=o}else{let o=ir.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new Ke(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(cn(a,e,t,!1))}}return n?sp(n):r}var hn=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Ke)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:r,buffer:n}=this.buffer;return this.type=t||n.set.types[n.buffer[e]],this.from=r+n.buffer[e+1],this.to=r+n.buffer[e+2],!0}yield(e){return e?e instanceof Ke?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],e,t-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,r=this.mode){return this.buffer?r&ie.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ie.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ie.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,r=this.stack.length-1;if(e<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(t.findChild(n,this.index,-1,0,4))}else{let n=t.buffer[this.index+3];if(n<(r<0?t.buffer.length:t.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,r,{buffer:n}=this;if(n){if(e>0){if(this.index<n.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(n.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:r}=n)}else({index:t,_parent:r}=this._tree);for(;r;{index:t,_parent:r}=r)if(t>-1)for(let s=t+e,o=e<0?-1:r._tree.children.length;s!=o;s+=e){let a=r._tree.children[s];if(this.mode&ie.IncludeAnonymous||a instanceof Ft||!a.type.isAnonymous||Yl(a))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,r=0;if(e&&e.context==this.buffer)e:for(let n=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==n){if(n==this.index)return o;t=o,r=s+1;break e}n=this.stack[--s]}for(let n=r;n<this.stack.length;n++)t=new Si(this.buffer,t,this.stack[n]);return this.bufferNode=new Si(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let r=0;;){let n=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(n=!0)}for(;n&&t&&t(this),n=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,n=!0}}}matchContext(e){if(!this.buffer)return Ul(this.node,e);let{buffer:t}=this.buffer,{types:r}=t.set;for(let n=e.length-1,s=this.stack.length-1;n>=0;s--){if(s<0)return Ul(this.node,e,n);let o=r[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[n]&&e[n]!=o.name)return!1;n--}}return!0}};function Yl(i){return i.children.some(e=>e instanceof Ft||!e.type.isAnonymous||Yl(e))}function iw(i){var e;let{buffer:t,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,a=Array.isArray(t)?new zl(t,t.length):t,l=r.types,c=0,h=0;function u(w,T,P,M,q,L){let{id:B,start:V,end:H,size:N}=a,ee=h;for(;N<0;)if(a.next(),N==-1){let he=s[B];P.push(he),M.push(V-w);return}else if(N==-3){c=B;return}else if(N==-4){h=B;return}else throw new RangeError(`Unrecognized record size: ${N}`);let Ae=l[B],Qe,Be,Fe=V-w;if(H-V<=n&&(Be=g(a.pos-T,q))){let he=new Uint16Array(Be.size-Be.skip),He=a.pos-Be.size,ct=he.length;for(;a.pos>He;)ct=O(Be.start,he,ct);Qe=new Ft(he,H-Be.start,r),Fe=Be.start-w}else{let he=a.pos-N;a.next();let He=[],ct=[],si=B>=o?B:-1,Li=0,Bn=H;for(;a.pos>he;)si>=0&&a.id==si&&a.size>=0?(a.end<=Bn-n&&(m(He,ct,V,Li,a.end,Bn,si,ee),Li=He.length,Bn=a.end),a.next()):L>2500?f(V,he,He,ct):u(V,he,He,ct,si,L+1);if(si>=0&&Li>0&&Li<He.length&&m(He,ct,V,Li,V,Bn,si,ee),He.reverse(),ct.reverse(),si>-1&&Li>0){let Mh=d(Ae);Qe=Zl(Ae,He,ct,0,He.length,0,H-V,Mh,Mh)}else Qe=p(Ae,He,ct,H-V,ee-H)}P.push(Qe),M.push(Fe)}function f(w,T,P,M){let q=[],L=0,B=-1;for(;a.pos>T;){let{id:V,start:H,end:N,size:ee}=a;if(ee>4)a.next();else{if(B>-1&&H<B)break;B<0&&(B=N-n),q.push(V,H,N),L++,a.next()}}if(L){let V=new Uint16Array(L*4),H=q[q.length-2];for(let N=q.length-3,ee=0;N>=0;N-=3)V[ee++]=q[N],V[ee++]=q[N+1]-H,V[ee++]=q[N+2]-H,V[ee++]=ee;P.push(new Ft(V,q[2]-H,r)),M.push(H-w)}}function d(w){return(T,P,M)=>{let q=0,L=T.length-1,B,V;if(L>=0&&(B=T[L])instanceof ne){if(!L&&B.type==w&&B.length==M)return B;(V=B.prop(D.lookAhead))&&(q=P[L]+B.length+V)}return p(w,T,P,M,q)}}function m(w,T,P,M,q,L,B,V){let H=[],N=[];for(;w.length>M;)H.push(w.pop()),N.push(T.pop()+P-q);w.push(p(r.types[B],H,N,L-q,V-L)),T.push(q-P)}function p(w,T,P,M,q=0,L){if(c){let B=[D.contextHash,c];L=L?[B].concat(L):[B]}if(q>25){let B=[D.lookAhead,q];L=L?[B].concat(L):[B]}return new ne(w,T,P,M,L)}function g(w,T){let P=a.fork(),M=0,q=0,L=0,B=P.end-n,V={size:0,start:0,skip:0};e:for(let H=P.pos-w;P.pos>H;){let N=P.size;if(P.id==T&&N>=0){V.size=M,V.start=q,V.skip=L,L+=4,M+=4,P.next();continue}let ee=P.pos-N;if(N<0||ee<H||P.start<B)break;let Ae=P.id>=o?4:0,Qe=P.start;for(P.next();P.pos>ee;){if(P.size<0)if(P.size==-3)Ae+=4;else break e;else P.id>=o&&(Ae+=4);P.next()}q=Qe,M+=N,L+=Ae}return(T<0||M==w)&&(V.size=M,V.start=q,V.skip=L),V.size>4?V:void 0}function O(w,T,P){let{id:M,start:q,end:L,size:B}=a;if(a.next(),B>=0&&M<o){let V=P;if(B>4){let H=a.pos-(B-4);for(;a.pos>H;)P=O(w,T,P)}T[--P]=V,T[--P]=L-w,T[--P]=q-w,T[--P]=M}else B==-3?c=M:B==-4&&(h=M);return P}let y=[],x=[];for(;a.pos>0;)u(i.start||0,i.bufferStart||0,y,x,-1,0);let v=(e=i.length)!==null&&e!==void 0?e:y.length?x[0]+y[0].length:0;return new ne(l[i.topID],y.reverse(),x.reverse(),v)}var rp=new WeakMap;function Is(i,e){if(!i.isAnonymous||e instanceof Ft||e.type!=i)return 1;let t=rp.get(e);if(t==null){t=1;for(let r of e.children){if(r.type!=i||!(r instanceof ne)){t=1;break}t+=Is(i,r)}rp.set(e,t)}return t}function Zl(i,e,t,r,n,s,o,a,l){let c=0;for(let m=r;m<n;m++)c+=Is(i,e[m]);let h=Math.ceil(c*1.5/8),u=[],f=[];function d(m,p,g,O,y){for(let x=g;x<O;){let v=x,w=p[x],T=Is(i,m[x]);for(x++;x<O;x++){let P=Is(i,m[x]);if(T+P>=h)break;T+=P}if(x==v+1){if(T>h){let P=m[v];d(P.children,P.positions,0,P.children.length,p[v]+y);continue}u.push(m[v])}else{let P=p[x-1]+m[x-1].length-w;u.push(Zl(i,m,p,v,x,w,P,null,l))}f.push(w+y-s)}}return d(e,t,r,n,0),(a||l)(u,f,o)}var zs=class{constructor(){this.map=new WeakMap}setBuffer(e,t,r){let n=this.map.get(e);n||this.map.set(e,n=new Map),n.set(t,r)}getBuffer(e,t){let r=this.map.get(e);return r&&r.get(t)}set(e,t){e instanceof Si?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ke&&this.map.set(e.tree,t)}get(e){return e instanceof Si?this.getBuffer(e.context.buffer,e.index):e instanceof Ke?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},ki=class i{constructor(e,t,r,n,s=!1,o=!1){this.from=e,this.to=t,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],r=!1){let n=[new i(0,e.length,e,0,!1,r)];for(let s of t)s.to>e.length&&n.push(s);return n}static applyChanges(e,t,r=128){if(!t.length)return e;let n=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let h=a<t.length?t[a]:null,u=h?h.fromA:1e9;if(u-l>=r)for(;o&&o.from<u;){let f=o;if(l>=f.from||u<=f.to||c){let d=Math.max(f.from,l)-c,m=Math.min(f.to,u)-c;f=d>=m?null:new i(d,m,f.tree,f.offset+c,a>0,!!h)}if(f&&n.push(f),o.to>u)break;o=s<e.length?e[s++]:null}if(!h)break;l=h.toA,c=h.toA-h.toB}return n}},rr=class{startParse(e,t,r){return typeof e=="string"&&(e=new Gl(e)),r=r?r.length?r.map(n=>new an(n.from,n.to)):[new an(0,0)]:[new an(0,e.length)],this.createParse(e,t||[],r)}parse(e,t,r){let n=this.startParse(e,t,r);for(;;){let s=n.advance();if(s)return s}}},Gl=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}};var RT=new D({perNode:!0});var rw=0,wt=class i{constructor(e,t,r){this.set=e,this.base=t,this.modified=r,this.id=rw++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new i([],null,[]);if(t.set.push(t),e)for(let r of e.set)t.set.push(r);return t}static defineModifier(){let e=new Gs;return t=>t.modified.indexOf(e)>-1?t:Gs.get(t.base||t,t.modified.concat(e).sort((r,n)=>r.id-n.id))}},nw=0,Gs=class i{constructor(){this.instances=[],this.id=nw++}static get(e,t){if(!t.length)return e;let r=t[0].instances.find(a=>a.base==e&&sw(t,a.modified));if(r)return r;let n=[],s=new wt(n,e,t);for(let a of t)a.instances.push(s);let o=ow(t);for(let a of e.set)if(!a.modified.length)for(let l of o)n.push(i.get(a,l));return s}};function sw(i,e){return i.length==e.length&&i.every((t,r)=>t==e[r])}function ow(i){let e=[[]];for(let t=0;t<i.length;t++)for(let r=0,n=e.length;r<n;r++)e.push(e[r].concat(i[t]));return e.sort((t,r)=>r.length-t.length)}function sr(i){let e=Object.create(null);for(let t in i){let r=i[t];Array.isArray(r)||(r=[r]);for(let n of t.split(" "))if(n){let s=[],o=2,a=n;for(let u=0;;){if(a=="..."&&u>0&&u+3==n.length){o=1;break}let f=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!f)throw new RangeError("Invalid path: "+n);if(s.push(f[0]=="*"?"":f[0][0]=='"'?JSON.parse(f[0]):f[0]),u+=f[0].length,u==n.length)break;let d=n[u++];if(u==n.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+n);a=n.slice(u)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+n);let h=new nr(r,o,l>0?s.slice(0,l):null);e[c]=h.sort(e[c])}}return lp.add(e)}var lp=new D,nr=class{constructor(e,t,r,n){this.tags=e,this.mode=t,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};nr.empty=new nr([],2,null);function fn(i,e){let t=Object.create(null);for(let s of i)if(!Array.isArray(s.tag))t[s.tag.id]=s.class;else for(let o of s.tag)t[o.id]=s.class;let{scope:r,all:n=null}=e||{};return{style:s=>{let o=n;for(let a of s)for(let l of a.set){let c=t[l.id];if(c){o=o?o+" "+c:c;break}}return o},scope:r}}function aw(i,e){let t=null;for(let r of i){let n=r.style(e);n&&(t=t?t+" "+n:n)}return t}function tc(i,e,t,r=0,n=i.length){let s=new Kl(r,Array.isArray(e)?e:[e],t);s.highlightRange(i.cursor(),r,n,"",s.highlighters),s.flush(n)}function ic(i,e,t,r,n,s=0,o=i.length){let a=s;function l(c,h){if(!(c<=a)){for(let u=i.slice(a,c),f=0;;){let d=u.indexOf(`
`,f),m=d<0?u.length:d;if(m>f&&r(u.slice(f,m),h),d<0)break;n(),f=d+1}a=c}}tc(e,t,(c,h,u)=>{l(c,""),l(h,u)},s,o),l(o,"")}var Kl=class{constructor(e,t,r){this.at=e,this.highlighters=t,this.span=r,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,r,n,s){let{type:o,from:a,to:l}=e;if(a>=r||l<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let c=n,h=lw(e)||nr.empty,u=aw(s,h.tags);if(u&&(c&&(c+=" "),c+=u,h.mode==1&&(n+=(n?" ":"")+u)),this.startSpan(Math.max(t,a),c),h.opaque)return;let f=e.tree&&e.tree.prop(D.mounted);if(f&&f.overlay){let d=e.node.enter(f.overlay[0].from+a,1),m=this.highlighters.filter(g=>!g.scope||g.scope(f.tree.type)),p=e.firstChild();for(let g=0,O=a;;g++){let y=g<f.overlay.length?f.overlay[g]:null,x=y?y.from+a:l,v=Math.max(t,O),w=Math.min(r,x);if(v<w&&p)for(;e.from<w&&(this.highlightRange(e,v,w,n,s),this.startSpan(Math.min(w,e.to),c),!(e.to>=x||!e.nextSibling())););if(!y||x>r)break;O=y.to+a,O>t&&(this.highlightRange(d.cursor(),Math.max(t,y.from+a),Math.min(r,O),"",m),this.startSpan(Math.min(r,O),c))}p&&e.parent()}else if(e.firstChild()){f&&(n="");do if(!(e.to<=t)){if(e.from>=r)break;this.highlightRange(e,t,r,n,s),this.startSpan(Math.min(r,e.to),c)}while(e.nextSibling());e.parent()}}};function lw(i){let e=i.type.prop(lp);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}var C=wt.define,Us=C(),Ht=C(),op=C(Ht),ap=C(Ht),Gt=C(),Fs=C(Gt),Jl=C(Gt),bt=C(),Ti=C(bt),Ot=C(),yt=C(),ec=C(),un=C(ec),Hs=C(),b={comment:Us,lineComment:C(Us),blockComment:C(Us),docComment:C(Us),name:Ht,variableName:C(Ht),typeName:op,tagName:C(op),propertyName:ap,attributeName:C(ap),className:C(Ht),labelName:C(Ht),namespace:C(Ht),macroName:C(Ht),literal:Gt,string:Fs,docString:C(Fs),character:C(Fs),attributeValue:C(Fs),number:Jl,integer:C(Jl),float:C(Jl),bool:C(Gt),regexp:C(Gt),escape:C(Gt),color:C(Gt),url:C(Gt),keyword:Ot,self:C(Ot),null:C(Ot),atom:C(Ot),unit:C(Ot),modifier:C(Ot),operatorKeyword:C(Ot),controlKeyword:C(Ot),definitionKeyword:C(Ot),moduleKeyword:C(Ot),operator:yt,derefOperator:C(yt),arithmeticOperator:C(yt),logicOperator:C(yt),bitwiseOperator:C(yt),compareOperator:C(yt),updateOperator:C(yt),definitionOperator:C(yt),typeOperator:C(yt),controlOperator:C(yt),punctuation:ec,separator:C(ec),bracket:un,angleBracket:C(un),squareBracket:C(un),paren:C(un),brace:C(un),content:bt,heading:Ti,heading1:C(Ti),heading2:C(Ti),heading3:C(Ti),heading4:C(Ti),heading5:C(Ti),heading6:C(Ti),contentSeparator:C(bt),list:C(bt),quote:C(bt),emphasis:C(bt),strong:C(bt),link:C(bt),monospace:C(bt),strikethrough:C(bt),inserted:C(),deleted:C(),changed:C(),invalid:C(),meta:Hs,documentMeta:C(Hs),annotation:C(Hs),processingInstruction:C(Hs),definition:wt.defineModifier(),constant:wt.defineModifier(),function:wt.defineModifier(),standard:wt.defineModifier(),local:wt.defineModifier(),special:wt.defineModifier()},MT=fn([{tag:b.link,class:"tok-link"},{tag:b.heading,class:"tok-heading"},{tag:b.emphasis,class:"tok-emphasis"},{tag:b.strong,class:"tok-strong"},{tag:b.keyword,class:"tok-keyword"},{tag:b.atom,class:"tok-atom"},{tag:b.bool,class:"tok-bool"},{tag:b.url,class:"tok-url"},{tag:b.labelName,class:"tok-labelName"},{tag:b.inserted,class:"tok-inserted"},{tag:b.deleted,class:"tok-deleted"},{tag:b.literal,class:"tok-literal"},{tag:b.string,class:"tok-string"},{tag:b.number,class:"tok-number"},{tag:[b.regexp,b.escape,b.special(b.string)],class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.local(b.variableName),class:"tok-variableName tok-local"},{tag:b.definition(b.variableName),class:"tok-variableName tok-definition"},{tag:b.special(b.variableName),class:"tok-variableName2"},{tag:b.definition(b.propertyName),class:"tok-propertyName tok-definition"},{tag:b.typeName,class:"tok-typeName"},{tag:b.namespace,class:"tok-namespace"},{tag:b.className,class:"tok-className"},{tag:b.macroName,class:"tok-macroName"},{tag:b.propertyName,class:"tok-propertyName"},{tag:b.operator,class:"tok-operator"},{tag:b.comment,class:"tok-comment"},{tag:b.meta,class:"tok-meta"},{tag:b.invalid,class:"tok-invalid"},{tag:b.punctuation,class:"tok-punctuation"}]);var rc,or=new D;function cw(i){return R.define({combine:i?e=>e.concat(i):void 0})}var hw=new D,Ie=class{constructor(e,t,r=[],n=""){this.data=e,this.name=n,j.prototype.hasOwnProperty("tree")||Object.defineProperty(j.prototype,"tree",{get(){return se(this)}}),this.parser=t,this.extension=[Yt.of(this),j.languageData.of((s,o,a)=>{let l=cp(s,o,a),c=l.type.prop(or);if(!c)return[];let h=s.facet(c),u=l.type.prop(hw);if(u){let f=l.resolve(o-l.from,a);for(let d of u)if(d.test(f,s)){let m=s.facet(d.facet);return d.type=="replace"?m:m.concat(h)}}return h})].concat(r)}isActiveAt(e,t,r=-1){return cp(e,t,r).type.prop(or)==this.data}findRegions(e){let t=e.facet(Yt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(or)==this.data){r.push({from:o,to:o+s.length});return}let a=s.prop(D.mounted);if(a){if(a.tree.prop(or)==this.data){if(a.overlay)for(let l of a.overlay)r.push({from:l.from+o,to:l.to+o});else r.push({from:o,to:o+s.length});return}else if(a.overlay){let l=r.length;if(n(a.tree,a.overlay[0].from+o),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ne&&n(c,s.positions[l]+o)}};return n(se(e),0),r}get allowsNesting(){return!0}};Ie.setState=_.define();function cp(i,e,t){let r=i.facet(Yt),n=se(i).topNode;if(!r||r.allowsNesting)for(let s=n;s;s=s.enter(e,t,ie.ExcludeBuffers))s.type.isTop&&(n=s);return n}var ar=class i extends Ie{constructor(e,t,r){super(e,t,[],r),this.parser=t}static define(e){let t=cw(e.languageData);return new i(t,e.parser.configure({props:[or.add(r=>r.isTop?t:void 0)]}),e.name)}configure(e,t){return new i(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function se(i){let e=i.field(Ie.state,!1);return e?e.tree:ne.empty}var ac=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let r=this.cursorPos-this.string.length;return e<r||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-r,t-r)}},dn=null,lc=class i{constructor(e,t,r=[],n,s,o,a,l){this.parser=e,this.state=t,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,r){return new i(e,t,[],ne.empty,0,r,[],null)}startParse(){return this.parser.startParse(new ac(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ne.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let n=Date.now()+e;e=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n)if(this.fragments=this.withoutTempSkipped(ki.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ki.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=dn;dn=this;try{return e()}finally{dn=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=hp(e,t.from,t.to);return e}changes(e,t){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,h,u,f)=>l.push({fromA:c,toA:h,fromB:u,toB:f})),r=ki.applyChanges(r,l),n=ne.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){a=[];for(let c of this.skipped){let h=e.mapPos(c.from,1),u=e.mapPos(c.to,-1);h<u&&a.push({from:h,to:u})}}}return new i(this.parser,t,r,n,s,o,a,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:n,to:s}=this.skipped[r];n<e.to&&s>e.from&&(this.fragments=hp(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends rr{createParse(t,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let l=dn;if(l){for(let c of n)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ne(xe.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return dn}};function hp(i,e,t){return ki.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}var mn=class i{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,r)||t.takeTree(),new i(t)}static init(e){let t=Math.min(3e3,e.doc.length),r=lc.create(e.facet(Yt).parser,e,{from:0,to:t});return r.work(20,t)||r.takeTree(),new i(r)}};Ie.state=K.define({create:mn.init,update(i,e){for(let t of e.effects)if(t.is(Ie.setState))return t.value;return e.startState.facet(Yt)!=e.state.facet(Yt)?mn.init(e.state):i.apply(e)}});var mp=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(mp=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});var nc=typeof navigator<"u"&&(!((rc=navigator.scheduling)===null||rc===void 0)&&rc.isInputPending)?()=>navigator.scheduling.isInputPending():null,uw=te.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Ie.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Ie.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=mp(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:n}}=this.view,s=r.field(Ie.state);if(s.tree==s.context.tree&&s.context.isDone(n+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!nc?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<n&&r.doc.length>n+1e3,l=s.context.work(()=>nc&&nc()||Date.now()>o,n+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Ie.setState.of(new mn(s.context))})),this.chunkBudget>0&&!(l&&!a)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Oe(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Yt=R.define({combine(i){return i.length?i[0]:null},enables:i=>[Ie.state,uw,E.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]}),lr=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}};var fw=R.define(),cr=R.define({combine:i=>{if(!i.length)return"  ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function gn(i){let e=i.facet(cr);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function hr(i,e){let t="",r=i.tabSize,n=i.facet(cr)[0];if(n=="	"){for(;e>=r;)t+="	",e-=r;n=" "}for(let s=0;s<e;s++)t+=n;return t}function Ks(i,e){i instanceof j&&(i=new Pi(i));for(let r of i.state.facet(fw)){let n=r(i,e);if(n!==void 0)return n}let t=se(i.state);return t.length>=e?dw(i,t,e):null}var Pi=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=gn(e)}lineAt(e,t=1){let r=this.state.doc.lineAt(e),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==e?{text:"",from:e}:(t<0?n<e:n<=e)?{text:r.text.slice(n-r.from),from:n}:{text:r.text.slice(0,n-r.from),from:r.from}:r}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:n}=this.lineAt(e,t);return r.slice(e-n,Math.min(r.length,e+100-n))}column(e,t=1){let{text:r,from:n}=this.lineAt(e,t),s=this.countColumn(r,e-n),o=this.options.overrideIndentation?this.options.overrideIndentation(n):-1;return o>-1&&(s+=o-this.countColumn(r,r.search(/\S|$/))),s}countColumn(e,t=e.length){return Et(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:r,from:n}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},On=new D;function dw(i,e,t){let r=e.resolveStack(t),n=r.node.enterUnfinishedNodesBefore(t);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return gp(r,i,t)}function gp(i,e,t){for(let r=i;r;r=r.next){let n=mw(r.node);if(n)return n(cc.create(e,t,r))}return 0}function pw(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function mw(i){let e=i.type.prop(On);if(e)return e;let t=i.firstChild,r;if(t&&(r=t.type.prop(D.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>Op(o,!0,1,void 0,s&&!pw(o)?n.from:void 0)}return i.parent==null?gw:null}function gw(){return 0}var cc=class i extends Pi{constructor(e,t,r){super(e.state,e.options),this.base=e,this.pos=t,this.context=r}get node(){return this.context.node}static create(e,t,r){return new i(e,t,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(t.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ow(r,e))break;t=this.state.doc.lineAt(r.from)}return this.lineIndent(t.from)}continue(){return gp(this.context.next,this.base,this.pos)}};function Ow(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function yw(i){let e=i.node,t=e.childAfter(e.from),r=e.lastChild;if(!t)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(t.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==r)return null;if(!l.type.isSkipped)return l.from<o?t:null;a=l.to}}function Ei({closing:i,align:e=!0,units:t=1}){return r=>Op(r,e,t,i)}function Op(i,e,t,r,n){let s=i.textAfter,o=s.match(/^\s*/)[0].length,a=r&&s.slice(o,o+r.length)==r||n==i.pos+o,l=e?yw(i):null;return l?a?i.column(l.from):i.column(l.to):i.baseIndent+(a?0:i.unit*t)}var bw=200;function yp(){return j.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:r}=i.newSelection.main,n=t.lineAt(r);if(r>n.from+bw)return i;let s=t.sliceString(n.from,r);if(!e.some(c=>c.test(s)))return i;let{state:o}=i,a=-1,l=[];for(let{head:c}of o.selection.ranges){let h=o.doc.lineAt(c);if(h.from==a)continue;a=h.from;let u=Ks(o,h.from);if(u==null)continue;let f=/^\s*/.exec(h.text)[0],d=hr(o,u);f!=d&&l.push({from:h.from,to:h.from+f.length,insert:d})}return l.length?[i,{changes:l,sequential:!0}]:i})}var ww=R.define(),yn=new D;function eo(i){let e=i.firstChild,t=i.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?i.to:t.from}:null}function vw(i,e,t){let r=se(i);if(r.length<t)return null;let n=r.resolveStack(t,1),s=null;for(let o=n;o;o=o.next){let a=o.node;if(a.to<=t||a.from>t)continue;if(s&&a.from<e)break;let l=a.type.prop(yn);if(l&&(a.to<r.length-50||r.length==i.doc.length||!xw(a))){let c=l(a,i);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function xw(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function Ys(i,e,t){for(let r of i.facet(ww)){let n=r(i,e,t);if(n)return n}return vw(i,e,t)}function bp(i,e){let t=e.mapPos(i.from,1),r=e.mapPos(i.to,-1);return t>=r?void 0:{from:t,to:r}}var to=_.define({map:bp}),bn=_.define({map:bp});function wp(i){let e=[];for(let{head:t}of i.state.selection.ranges)e.some(r=>r.from<=t&&r.to>=t)||e.push(i.lineBlockAt(t));return e}var Ci=K.define({create(){return Q.none},update(i,e){i=i.map(e.changes);for(let t of e.effects)if(t.is(to)&&!Sw(i,t.value.from,t.value.to)){let{preparePlaceholder:r}=e.state.facet(mc),n=r?Q.replace({widget:new hc(r(e.state,t.value))}):up;i=i.update({add:[n.range(t.value.from,t.value.to)]})}else t.is(bn)&&(i=i.update({filter:(r,n)=>t.value.from!=r||t.value.to!=n,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:r}=e.selection.main;i.between(r,r,(n,s)=>{n<r&&s>r&&(t=!0)}),t&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>E.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(r,n)=>{t.push(r,n)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let r=i[t++],n=i[t++];if(typeof r!="number"||typeof n!="number")throw new RangeError("Invalid JSON for fold state");e.push(up.range(r,n))}return Q.set(e,!0)}});function Zs(i,e,t){var r;let n=null;return(r=i.field(Ci,!1))===null||r===void 0||r.between(e,t,(s,o)=>{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Sw(i,e,t){let r=!1;return i.between(e,e,(n,s)=>{n==e&&s==t&&(r=!0)}),r}function vp(i,e){return i.field(Ci,!1)?e:e.concat(_.appendConfig.of(kp()))}var kw=i=>{for(let e of wp(i)){let t=Ys(i.state,e.from,e.to);if(t)return i.dispatch({effects:vp(i.state,[to.of(t),xp(i,t)])}),!0}return!1},Tw=i=>{if(!i.state.field(Ci,!1))return!1;let e=[];for(let t of wp(i)){let r=Zs(i.state,t.from,t.to);r&&e.push(bn.of(r),xp(i,r,!1))}return e.length&&i.dispatch({effects:e}),e.length>0};function xp(i,e,t=!0){let r=i.state.doc.lineAt(e.from).number,n=i.state.doc.lineAt(e.to).number;return E.announce.of(`${i.state.phrase(t?"Folded lines":"Unfolded lines")} ${r} ${i.state.phrase("to")} ${n}.`)}var Pw=i=>{let{state:e}=i,t=[];for(let r=0;r<e.doc.length;){let n=i.lineBlockAt(r),s=Ys(e,n.from,n.to);s&&t.push(to.of(s)),r=(s?i.lineBlockAt(s.to):n).to+1}return t.length&&i.dispatch({effects:vp(i.state,t)}),!!t.length},Cw=i=>{let e=i.state.field(Ci,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,i.state.doc.length,(r,n)=>{t.push(bn.of({from:r,to:n}))}),i.dispatch({effects:t}),!0};var Sp=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:kw},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Tw},{key:"Ctrl-Alt-[",run:Pw},{key:"Ctrl-Alt-]",run:Cw}],Ew={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},mc=R.define({combine(i){return ve(i,Ew)}});function kp(i){let e=[Ci,Aw];return i&&e.push(mc.of(i)),e}function Tp(i,e){let{state:t}=i,r=t.facet(mc),n=o=>{let a=i.lineBlockAt(i.posAtDOM(o.target)),l=Zs(i.state,a.from,a.to);l&&i.dispatch({effects:bn.of(l)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,e);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=n,s}var up=Q.replace({widget:new class extends qe{toDOM(i){return Tp(i,null)}}}),hc=class extends qe{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Tp(e,this.value)}},Rw={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1},pn=class extends je{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}};function Pp(i={}){let e=Object.assign(Object.assign({},Rw),i),t=new pn(e,!0),r=new pn(e,!1),n=te.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Yt)!=o.state.facet(Yt)||o.startState.field(Ci,!1)!=o.state.field(Ci,!1)||se(o.startState)!=se(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new nt;for(let l of o.viewportLineBlocks){let c=Zs(o.state,l.from,l.to)?r:Ys(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[n,Wl({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(n))===null||a===void 0?void 0:a.markers)||I.empty},initialSpacer(){return new pn(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=Zs(o.state,a.from,a.to);if(c)return o.dispatch({effects:bn.of(c)}),!0;let h=Ys(o.state,a.from,a.to);return h?(o.dispatch({effects:to.of(h)}),!0):!1}})}),kp()]}var Aw=E.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}}),Js=class i{constructor(e,t){this.specs=e;let r;function n(a){let l=Ye.newName();return(r||(r=Object.create(null)))["."+l]=a,l}let s=typeof t.all=="string"?t.all:t.all?n(t.all):void 0,o=t.scope;this.scope=o instanceof Ie?a=>a.prop(or)==o.data:o?a=>a==o:void 0,this.style=fn(e.map(a=>({tag:a.tag,class:a.class||n(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=r?new Ye(r):null,this.themeType=t.themeType}static define(e,t){return new i(e,t||{})}},uc=R.define(),Cp=R.define({combine(i){return i.length?[i[0]]:null}});function sc(i){let e=i.facet(uc);return e.length?e:i.facet(Cp)}function wn(i,e){let t=[Qw],r;return i instanceof Js&&(i.module&&t.push(E.styleModule.of(i.module)),r=i.themeType),e?.fallback?t.push(Cp.of(i)):r?t.push(uc.computeN([E.darkTheme],n=>n.facet(E.darkTheme)==(r=="dark")?[i]:[])):t.push(uc.of(i)),t}var fc=class{constructor(e){this.markCache=Object.create(null),this.tree=se(e.state),this.decorations=this.buildDeco(e,sc(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=se(e.state),r=sc(e.state),n=r!=sc(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<s.to&&!n&&t.type==this.tree.type&&o>=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||n)&&(this.tree=t,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return Q.none;let r=new nt;for(let{from:n,to:s}of e.visibleRanges)tc(this.tree,t,(o,a,l)=>{r.add(o,a,this.markCache[l]||(this.markCache[l]=Q.mark({class:l})))},n,s);return r.finish()}},Qw=Ce.high(te.fromClass(fc,{decorations:i=>i.decorations})),Ep=Js.define([{tag:b.meta,color:"#404740"},{tag:b.link,textDecoration:"underline"},{tag:b.heading,textDecoration:"underline",fontWeight:"bold"},{tag:b.emphasis,fontStyle:"italic"},{tag:b.strong,fontWeight:"bold"},{tag:b.strikethrough,textDecoration:"line-through"},{tag:b.keyword,color:"#708"},{tag:[b.atom,b.bool,b.url,b.contentSeparator,b.labelName],color:"#219"},{tag:[b.literal,b.inserted],color:"#164"},{tag:[b.string,b.deleted],color:"#a11"},{tag:[b.regexp,b.escape,b.special(b.string)],color:"#e40"},{tag:b.definition(b.variableName),color:"#00f"},{tag:b.local(b.variableName),color:"#30a"},{tag:[b.typeName,b.namespace],color:"#085"},{tag:b.className,color:"#167"},{tag:[b.special(b.variableName),b.macroName],color:"#256"},{tag:b.definition(b.propertyName),color:"#00c"},{tag:b.comment,color:"#940"},{tag:b.invalid,color:"#f00"}]),Mw=E.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Rp=1e4,Ap="()[]{}",Qp=R.define({combine(i){return ve(i,{afterCursor:!0,brackets:Ap,maxScanDistance:Rp,renderMatch:Lw})}}),_w=Q.mark({class:"cm-matchingBracket"}),Dw=Q.mark({class:"cm-nonmatchingBracket"});function Lw(i){let e=[],t=i.matched?_w:Dw;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}var qw=K.define({create(){return Q.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],r=e.state.facet(Qp);for(let n of e.state.selection.ranges){if(!n.empty)continue;let s=ot(e.state,n.head,-1,r)||n.head>0&&ot(e.state,n.head-1,1,r)||r.afterCursor&&(ot(e.state,n.head,1,r)||n.head<e.state.doc.length&&ot(e.state,n.head+1,-1,r));s&&(t=t.concat(r.renderMatch(s,e.state)))}return Q.set(t,!0)},provide:i=>E.decorations.from(i)}),Vw=[qw,Mw];function Mp(i={}){return[Qp.of(i),Vw]}var $w=new D;function dc(i,e,t){let r=i.prop(e<0?D.openedBy:D.closedBy);if(r)return r;if(i.name.length==1){let n=t.indexOf(i.name);if(n>-1&&n%2==(e<0?1:0))return[t[n+e]]}return null}function pc(i){let e=i.type.prop($w);return e?e(i.node):i}function ot(i,e,t,r={}){let n=r.maxScanDistance||Rp,s=r.brackets||Ap,o=se(i),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=dc(l.type,t,s);if(c&&l.from<l.to){let h=pc(l);if(h&&(t>0?e>=h.from&&e<h.to:e>h.from&&e<=h.to))return Bw(i,e,t,l,h,c,s)}}return Xw(i,e,t,o,a.type,n,s)}function Bw(i,e,t,r,n,s,o){let a=r.parent,l={from:n.from,to:n.to},c=0,h=a?.cursor();if(h&&(t<0?h.childBefore(r.from):h.childAfter(r.to)))do if(t<0?h.to<=r.from:h.from>=r.to){if(c==0&&s.indexOf(h.type.name)>-1&&h.from<h.to){let u=pc(h);return{start:l,end:u?{from:u.from,to:u.to}:void 0,matched:!0}}else if(dc(h.type,t,o))c++;else if(dc(h.type,-t,o)){if(c==0){let u=pc(h);return{start:l,end:u&&u.from<u.to?{from:u.from,to:u.to}:void 0,matched:!1}}c--}}while(t<0?h.prevSibling():h.nextSibling());return{start:l,matched:!1}}function Xw(i,e,t,r,n,s,o){let a=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),l=o.indexOf(a);if(l<0||l%2==0!=t>0)return null;let c={from:t<0?e-1:e,to:t>0?e+1:e},h=i.doc.iterRange(e,t>0?i.doc.length:0),u=0;for(let f=0;!h.next().done&&f<=s;){let d=h.value;t<0&&(f+=d.length);let m=e+f*t;for(let p=t>0?0:d.length-1,g=t>0?d.length:-1;p!=g;p+=t){let O=o.indexOf(d[p]);if(!(O<0||r.resolveInner(m+p,1).type!=n))if(O%2==0==t>0)u++;else{if(u==1)return{start:c,end:{from:m+p,to:m+p+1},matched:O>>1==l>>1};u--}}t>0&&(f+=d.length)}return h.done?{start:c,matched:!1}:null}var Nw=Object.create(null),fp=[xe.none];var dp=[],pp=Object.create(null),jw=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])jw[i]=Iw(Nw,e);function oc(i,e){dp.indexOf(i)>-1||(dp.push(i),console.warn(e))}function Iw(i,e){let t=[];for(let a of e.split(" ")){let l=[];for(let c of a.split(".")){let h=i[c]||b[c];h?typeof h=="function"?l.length?l=l.map(h):oc(c,`Modifier ${c} used at start of tag`):l.length?oc(c,`Tag ${c} used as modifier`):l=Array.isArray(h)?h:[h]:oc(c,`Unknown highlighting tag ${c}`)}for(let c of l)t.push(c)}if(!t.length)return 0;let r=e.replace(/ /g,"_"),n=r+" "+t.map(a=>a.id),s=pp[n];if(s)return s.id;let o=pp[n]=xe.define({id:fp.length,name:r,props:[sr({[r]:t})]});return fp.push(o),o.id}var XT={rtl:Q.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"rtl"},bidiIsolate:F.RTL}),ltr:Q.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"ltr"},bidiIsolate:F.LTR}),auto:Q.mark({class:"cm-iso",inclusive:!0,attributes:{dir:"auto"},bidiIsolate:null})};var Ww=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),r=xc(i.state,t.from);return r.line?zw(i):r.block?Fw(i):!1};function vc(i,e){return({state:t,dispatch:r})=>{if(t.readOnly)return!1;let n=i(e,t);return n?(r(t.update(n)),!0):!1}}var zw=vc(Yw,0);var Uw=vc(Xp,0);var Fw=vc((i,e)=>Xp(i,e,Gw(e)),0);function xc(i,e){let t=i.languageDataAt("commentTokens",e);return t.length?t[0]:{}}var vn=50;function Hw(i,{open:e,close:t},r,n){let s=i.sliceDoc(r-vn,r),o=i.sliceDoc(n,n+vn),a=/\s*$/.exec(s)[0].length,l=/^\s*/.exec(o)[0].length,c=s.length-a;if(s.slice(c-e.length,c)==e&&o.slice(l,l+t.length)==t)return{open:{pos:r-a,margin:a&&1},close:{pos:n+l,margin:l&&1}};let h,u;n-r<=2*vn?h=u=i.sliceDoc(r,n):(h=i.sliceDoc(r,r+vn),u=i.sliceDoc(n-vn,n));let f=/^\s*/.exec(h)[0].length,d=/\s*$/.exec(u)[0].length,m=u.length-d-t.length;return h.slice(f,f+e.length)==e&&u.slice(m,m+t.length)==t?{open:{pos:r+f+e.length,margin:/\s/.test(h.charAt(f+e.length))?1:0},close:{pos:n-d-t.length,margin:/\s/.test(u.charAt(m-1))?1:0}}:null}function Gw(i){let e=[];for(let t of i.selection.ranges){let r=i.doc.lineAt(t.from),n=t.to<=r.to?r:i.doc.lineAt(t.to),s=e.length-1;s>=0&&e[s].to>r.from?e[s].to=n.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:n.to})}return e}function Xp(i,e,t=e.selection.ranges){let r=t.map(s=>xc(e,s.from).block);if(!r.every(s=>s))return null;let n=t.map((s,o)=>Hw(e,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:e.changes(t.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+" "},{from:s.to,insert:" "+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,a;o<n.length;o++)if(a=n[o]){let l=r[o],{open:c,close:h}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:h.pos-h.margin,to:h.pos+l.close.length})}return{changes:s}}return null}function Yw(i,e,t=e.selection.ranges){let r=[],n=-1;for(let{from:s,to:o}of t){let a=r.length,l=1e9,c=xc(e,s).line;if(c){for(let h=s;h<=o;){let u=e.doc.lineAt(h);if(u.from>n&&(s==o||o>u.from)){n=u.from;let f=/^\s*/.exec(u.text)[0].length,d=f==u.length,m=u.text.slice(f,f+c.length)==c?f:-1;f<u.text.length&&f<l&&(l=f),r.push({line:u,comment:m,token:c,indent:f,empty:d,single:!1})}h=u.to+1}if(l<1e9)for(let h=a;h<r.length;h++)r[h].indent<r[h].line.text.length&&(r[h].indent=l);r.length==a+1&&(r[a].single=!0)}}if(i!=2&&r.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:h,single:u}of r)(u||!h)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of r)if(a>=0){let c=o.from+a,h=c+l.length;o.text[h-o.from]==" "&&h++,s.push({from:c,to:h})}return{changes:s}}return null}var Oc=De.define(),Zw=De.define(),Jw=R.define(),Np=R.define({combine(i){return ve(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(r,n)=>e(r,n)||t(r,n)})}}),jp=K.define({create(){return Ri.empty},update(i,e){let t=e.state.facet(Np),r=e.annotation(Oc);if(r){let l=at.fromTransaction(e,r.selection),c=r.side,h=c==0?i.undone:i.done;return l?h=ro(h,h.length,t.minDepth,l):h=Up(h,e.startState.selection),new Ri(c==0?r.rest:h,c==0?h:r.rest)}let n=e.annotation(Zw);if((n=="full"||n=="before")&&(i=i.isolate()),e.annotation(ae.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let s=at.fromTransaction(e),o=e.annotation(ae.time),a=e.annotation(ae.userEvent);return s?i=i.addChanges(s,o,a,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(n=="full"||n=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new Ri(i.done.map(at.fromJSON),i.undone.map(at.fromJSON))}});function Ip(i={}){return[jp,Np.of(i),E.domEventHandlers({beforeinput(e,t){let r=e.inputType=="historyUndo"?Wp:e.inputType=="historyRedo"?yc:null;return r?(e.preventDefault(),r(t)):!1}})]}function no(i,e){return function({state:t,dispatch:r}){if(!e&&t.readOnly)return!1;let n=t.field(jp,!1);if(!n)return!1;let s=n.pop(i,t,e);return s?(r(s),!0):!1}}var Wp=no(0,!1),yc=no(1,!1),Kw=no(0,!0),ev=no(1,!0);var at=class i{constructor(e,t,r,n,s){this.changes=e,this.effects=t,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(e){return new i(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(e){return new i(e.changes&&Pe.fromJSON(e.changes),[],e.mapped&&Pt.fromJSON(e.mapped),e.startSelection&&k.fromJSON(e.startSelection),e.selectionsAfter.map(k.fromJSON))}static fromTransaction(e,t){let r=et;for(let n of e.startState.facet(Jw)){let s=n(e);s.length&&(r=r.concat(s))}return!r.length&&e.changes.empty?null:new i(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,et)}static selection(e){return new i(void 0,et,void 0,void 0,e)}};function ro(i,e,t,r){let n=e+1>t+20?e-t-1:0,s=i.slice(n,e);return s.push(r),s}function tv(i,e){let t=[],r=!1;return i.iterChangedRanges((n,s)=>t.push(n,s)),e.iterChangedRanges((n,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],h=t[l++];a>=c&&o<=h&&(r=!0)}}),r}function iv(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,r)=>t.empty!=e.ranges[r].empty).length===0}function zp(i,e){return i.length?e.length?i.concat(e):i:e}var et=[],rv=200;function Up(i,e){if(i.length){let t=i[i.length-1],r=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-rv));return r.length&&r[r.length-1].eq(e)?i:(r.push(e),ro(i,i.length-1,1e9,t.setSelAfter(r)))}else return[at.selection([e])]}function nv(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function gc(i,e){if(!i.length)return i;let t=i.length,r=et;for(;t;){let n=sv(i[t-1],e,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,t);return s[t-1]=n,s}else e=n.mapped,t--,r=n.selectionsAfter}return r.length?[at.selection(r)]:et}function sv(i,e,t){let r=zp(i.selectionsAfter.length?i.selectionsAfter.map(a=>a.map(e)):et,t);if(!i.changes)return at.selection(r);let n=i.changes.map(e),s=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new at(n,_.mapEffects(i.effects,e),o,i.startSelection.map(s),r)}var ov=/^(input\.type|delete)($|\.)/,Ri=class i{constructor(e,t,r=0,n=void 0){this.done=e,this.undone=t,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(e,t,r,n,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!r||ov.test(r))&&(!a.selectionsAfter.length&&t-this.prevTime<n.newGroupDelay&&n.joinToEvent(s,tv(a.changes,e.changes))||r=="input.type.compose")?o=ro(o,o.length-1,n.minDepth,new at(e.changes.compose(a.changes),zp(e.effects,a.effects),a.mapped,a.startSelection,et)):o=ro(o,o.length,n.minDepth,e),new i(o,et,t,r)}addSelection(e,t,r,n){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:et;return s.length>0&&t-this.prevTime<n&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&iv(s[s.length-1],e)?this:new i(Up(this.done,e),this.undone,t,r)}addMapping(e){return new i(gc(this.done,e),gc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,r){let n=e==0?this.done:this.undone;if(n.length==0)return null;let s=n[n.length-1],o=s.selectionsAfter[0]||t.selection;if(r&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Oc.of({side:e,rest:nv(n),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let a=n.length==1?et:n.slice(0,n.length-1);return s.mapped&&(a=gc(a,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Oc.of({side:e,rest:a,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Ri.empty=new Ri(et,et);var Fp=[{key:"Mod-z",run:Wp,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:yc,preventDefault:!0},{linux:"Ctrl-Shift-z",run:yc,preventDefault:!0},{key:"Mod-u",run:Kw,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:ev,preventDefault:!0}];function ur(i,e){return k.create(i.ranges.map(e),i.mainIndex)}function vt(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function lt({state:i,dispatch:e},t){let r=ur(i.selection,t);return r.eq(i.selection,!0)?!1:(e(vt(i,r)),!0)}function so(i,e){return k.cursor(e?i.to:i.from)}function Hp(i,e){return lt(i,t=>t.empty?i.moveByChar(t,e):so(t,e))}function Se(i){return i.textDirectionAt(i.state.selection.main.head)==F.LTR}var Gp=i=>Hp(i,!Se(i)),Yp=i=>Hp(i,Se(i));function Zp(i,e){return lt(i,t=>t.empty?i.moveByGroup(t,e):so(t,e))}var av=i=>Zp(i,!Se(i)),lv=i=>Zp(i,Se(i));var GT=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function cv(i,e,t){if(e.type.prop(t))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function oo(i,e,t){let r=se(i).resolveInner(e.head),n=t?D.closedBy:D.openedBy;for(let l=e.head;;){let c=t?r.childAfter(l):r.childBefore(l);if(!c)break;cv(i,c,n)?r=c:l=t?c.to:c.from}let s=r.type.prop(n),o,a;return s&&(o=t?ot(i,r.from,1):ot(i,r.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?r.to:r.from,k.cursor(a,t?-1:1)}var hv=i=>lt(i,e=>oo(i.state,e,!Se(i))),uv=i=>lt(i,e=>oo(i.state,e,Se(i)));function Jp(i,e){return lt(i,t=>{if(!t.empty)return so(t,e);let r=i.moveVertically(t,e);return r.head!=t.head?r:i.moveToLineBoundary(t,e)})}var Kp=i=>Jp(i,!1),em=i=>Jp(i,!0);function tm(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,r=0,n;if(e){for(let s of i.state.facet(E.scrollMargins)){let o=s(i);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(r=Math.max(o?.bottom,r))}n=i.scrollDOM.clientHeight-t-r}else n=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:r,selfScroll:e,height:Math.max(i.defaultLineHeight,n-5)}}function im(i,e){let t=tm(i),{state:r}=i,n=ur(r.selection,o=>o.empty?i.moveVertically(o,e,t.height):so(o,e));if(n.eq(r.selection))return!1;let s;if(t.selfScroll){let o=i.coordsAtPos(r.selection.main.head),a=i.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=E.scrollIntoView(n.main.head,{y:"start",yMargin:o.top-l}))}return i.dispatch(vt(r,n),{effects:s}),!0}var _p=i=>im(i,!1),bc=i=>im(i,!0);function Zt(i,e,t){let r=i.lineBlockAt(e.head),n=i.moveToLineBoundary(e,t);if(n.head==e.head&&n.head!=(t?r.to:r.from)&&(n=i.moveToLineBoundary(e,t,!1)),!t&&n.head==r.from&&r.length){let s=/^\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&e.head!=r.from+s&&(n=k.cursor(r.from+s))}return n}var fv=i=>lt(i,e=>Zt(i,e,!0)),dv=i=>lt(i,e=>Zt(i,e,!1)),pv=i=>lt(i,e=>Zt(i,e,!Se(i))),mv=i=>lt(i,e=>Zt(i,e,Se(i))),gv=i=>lt(i,e=>k.cursor(i.lineBlockAt(e.head).from,1)),Ov=i=>lt(i,e=>k.cursor(i.lineBlockAt(e.head).to,-1));function yv(i,e,t){let r=!1,n=ur(i.selection,s=>{let o=ot(i,s.head,-1)||ot(i,s.head,1)||s.head>0&&ot(i,s.head-1,1)||s.head<i.doc.length&&ot(i,s.head+1,-1);if(!o||!o.end)return s;r=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return t?k.range(s.anchor,a):k.cursor(a)});return r?(e(vt(i,n)),!0):!1}var bv=({state:i,dispatch:e})=>yv(i,e,!1);function tt(i,e){let t=ur(i.state.selection,r=>{let n=e(r);return k.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(vt(i.state,t)),!0)}function rm(i,e){return tt(i,t=>i.moveByChar(t,e))}var nm=i=>rm(i,!Se(i)),sm=i=>rm(i,Se(i));function om(i,e){return tt(i,t=>i.moveByGroup(t,e))}var wv=i=>om(i,!Se(i)),vv=i=>om(i,Se(i));var xv=i=>tt(i,e=>oo(i.state,e,!Se(i))),Sv=i=>tt(i,e=>oo(i.state,e,Se(i)));function am(i,e){return tt(i,t=>i.moveVertically(t,e))}var lm=i=>am(i,!1),cm=i=>am(i,!0);function hm(i,e){return tt(i,t=>i.moveVertically(t,e,tm(i).height))}var Dp=i=>hm(i,!1),Lp=i=>hm(i,!0),kv=i=>tt(i,e=>Zt(i,e,!0)),Tv=i=>tt(i,e=>Zt(i,e,!1)),Pv=i=>tt(i,e=>Zt(i,e,!Se(i))),Cv=i=>tt(i,e=>Zt(i,e,Se(i))),Ev=i=>tt(i,e=>k.cursor(i.lineBlockAt(e.head).from)),Rv=i=>tt(i,e=>k.cursor(i.lineBlockAt(e.head).to)),qp=({state:i,dispatch:e})=>(e(vt(i,{anchor:0})),!0),Vp=({state:i,dispatch:e})=>(e(vt(i,{anchor:i.doc.length})),!0),$p=({state:i,dispatch:e})=>(e(vt(i,{anchor:i.selection.main.anchor,head:0})),!0),Bp=({state:i,dispatch:e})=>(e(vt(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Av=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),Qv=({state:i,dispatch:e})=>{let t=ao(i).map(({from:r,to:n})=>k.range(r,Math.min(n+1,i.doc.length)));return e(i.update({selection:k.create(t),userEvent:"select"})),!0},Mv=({state:i,dispatch:e})=>{let t=ur(i.selection,r=>{var n;let s=se(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<r.from&&a.to>=r.to||a.to>r.to&&a.from<=r.from)&&(!((n=a.parent)===null||n===void 0)&&n.parent))return k.range(a.to,a.from)}return r});return e(vt(i,t)),!0},_v=({state:i,dispatch:e})=>{let t=i.selection,r=null;return t.ranges.length>1?r=k.create([t.main]):t.main.empty||(r=k.create([k.cursor(t.main.head)])),r?(e(vt(i,r)),!0):!1};function xn(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=io(i,l,!1)):l>o&&(t="delete.forward",l=io(i,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=io(i,o,!1),a=io(i,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:k.cursor(o,o<s.head?-1:1)}});return n.changes.empty?!1:(i.dispatch(r.update(n,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?E.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function io(i,e,t){if(i instanceof E)for(let r of i.state.facet(E.atomicRanges).map(n=>n(i)))r.between(e,e,(n,s)=>{n<e&&s>e&&(e=t?s:n)});return e}var um=(i,e,t)=>xn(i,r=>{let n=r.from,{state:s}=i,o=s.doc.lineAt(n),a,l;if(t&&!e&&n>o.from&&n<o.from+200&&!/[^ \t]/.test(a=o.text.slice(0,n-o.from))){if(a[a.length-1]=="	")return n-1;let c=Et(a,s.tabSize),h=c%gn(s)||gn(s);for(let u=0;u<h&&a[a.length-1-u]==" ";u++)n--;l=n}else l=le(o.text,n-o.from,e,e)+o.from,l==n&&o.number!=(e?s.doc.lines:1)?l+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(l-o.from,n-o.from))&&(l=le(o.text,l-o.from,!1,!1)+o.from);return l}),wc=i=>um(i,!1,!0);var fm=i=>um(i,!0,!1),dm=(i,e)=>xn(i,t=>{let r=t.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let a=null;;){if(r==(e?s.to:s.from)){r==t.head&&s.number!=(e?n.doc.lines:1)&&(r+=e?1:-1);break}let l=le(s.text,r-s.from,e)+s.from,c=s.text.slice(Math.min(r,l)-s.from,Math.max(r,l)-s.from),h=o(c);if(a!=null&&h!=a)break;(c!=" "||r!=t.head)&&(a=h),r=l}return r}),pm=i=>dm(i,!1),Dv=i=>dm(i,!0),Lv=i=>xn(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)});var qv=i=>xn(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Vv=i=>xn(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)});var $v=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:X.of(["",""])},range:k.cursor(r.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Bv=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:le(s.text,n-s.from,!1)+s.from,a=n==s.to?n+1:le(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:i.doc.slice(n,a).append(i.doc.slice(o,n))},range:k.cursor(a)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ao(i){let e=[],t=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),t>=n.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(r)}else e.push({from:n.from,to:s.to,ranges:[r]});t=s.number+1}return e}function mm(i,e,t){if(i.readOnly)return!1;let r=[],n=[];for(let s of ao(i)){if(t?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let l of s.ranges)n.push(k.range(Math.min(i.doc.length,l.anchor+a),Math.min(i.doc.length,l.head+a)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let l of s.ranges)n.push(k.range(l.anchor-a,l.head-a))}}return r.length?(e(i.update({changes:r,scrollIntoView:!0,selection:k.create(n,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}var Xv=({state:i,dispatch:e})=>mm(i,e,!1),Nv=({state:i,dispatch:e})=>mm(i,e,!0);function gm(i,e,t){if(i.readOnly)return!1;let r=[];for(let n of ao(i))t?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return e(i.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var jv=({state:i,dispatch:e})=>gm(i,e,!1),Iv=({state:i,dispatch:e})=>gm(i,e,!0),Wv=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(ao(e).map(({from:n,to:s})=>(n>0?n--:s<e.doc.length&&s++,{from:n,to:s}))),r=ur(e.selection,n=>{let s;if(i.lineWrapping){let o=i.lineBlockAt(n.head),a=i.coordsAtPos(n.head,n.assoc||1);a&&(s=o.bottom+i.documentTop-a.bottom+i.defaultLineHeight/2)}return i.moveVertically(n,!0,s)}).map(t);return i.dispatch({changes:t,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function zv(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=se(i).resolveInner(e),r=t.childBefore(e),n=t.childAfter(e),s;return r&&n&&r.to<=e&&n.from>=e&&(s=r.type.prop(D.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Uv=Om(!1),Fv=Om(!0);function Om(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{let{from:s,to:o}=n,a=e.doc.lineAt(s),l=!i&&s==o&&zv(e,s);i&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new Pi(e,{simulateBreak:s,simulateDoubleBreak:!!l}),h=Ks(c,s);for(h==null&&(h=Et(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));o<a.to&&/\s/.test(a.text[o-a.from]);)o++;l?{from:s,to:o}=l:s>a.from&&s<a.from+100&&!/\S/.test(a.text.slice(0,s))&&(s=a.from);let u=["",hr(e,h)];return l&&u.push(hr(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:X.of(u)},range:k.cursor(s+1+u[1].length)}});return t(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Sc(i,e){let t=-1;return i.changeByRange(r=>{let n=[];for(let o=r.from;o<=r.to;){let a=i.doc.lineAt(o);a.number>t&&(r.empty||r.to>a.from)&&(e(a,n,r),t=a.number),o=a.to+1}let s=i.changes(n);return{changes:n,range:k.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var Hv=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),r=new Pi(i,{overrideIndentation:s=>{let o=t[s];return o??-1}}),n=Sc(i,(s,o,a)=>{let l=Ks(r,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],h=hr(i,l);(c!=h||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:h}))});return n.changes.empty||e(i.update(n,{userEvent:"indent"})),!0},Gv=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(Sc(i,(t,r)=>{r.push({from:t.from,insert:i.facet(cr)})}),{userEvent:"input.indent"})),!0),Yv=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(Sc(i,(t,r)=>{let n=/^\s*/.exec(t.text)[0];if(!n)return;let s=Et(n,i.tabSize),o=0,a=hr(i,Math.max(0,s-gn(i)));for(;o<n.length&&o<a.length&&n.charCodeAt(o)==a.charCodeAt(o);)o++;r.push({from:t.from+o,to:t.from+n.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),Zv=i=>(i.setTabFocusMode(),!0);var Jv=[{key:"Ctrl-b",run:Gp,shift:nm,preventDefault:!0},{key:"Ctrl-f",run:Yp,shift:sm},{key:"Ctrl-p",run:Kp,shift:lm},{key:"Ctrl-n",run:em,shift:cm},{key:"Ctrl-a",run:gv,shift:Ev},{key:"Ctrl-e",run:Ov,shift:Rv},{key:"Ctrl-d",run:fm},{key:"Ctrl-h",run:wc},{key:"Ctrl-k",run:Lv},{key:"Ctrl-Alt-h",run:pm},{key:"Ctrl-o",run:$v},{key:"Ctrl-t",run:Bv},{key:"Ctrl-v",run:bc}],Kv=[{key:"ArrowLeft",run:Gp,shift:nm,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:av,shift:wv,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:pv,shift:Pv,preventDefault:!0},{key:"ArrowRight",run:Yp,shift:sm,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:lv,shift:vv,preventDefault:!0},{mac:"Cmd-ArrowRight",run:mv,shift:Cv,preventDefault:!0},{key:"ArrowUp",run:Kp,shift:lm,preventDefault:!0},{mac:"Cmd-ArrowUp",run:qp,shift:$p},{mac:"Ctrl-ArrowUp",run:_p,shift:Dp},{key:"ArrowDown",run:em,shift:cm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Vp,shift:Bp},{mac:"Ctrl-ArrowDown",run:bc,shift:Lp},{key:"PageUp",run:_p,shift:Dp},{key:"PageDown",run:bc,shift:Lp},{key:"Home",run:dv,shift:Tv,preventDefault:!0},{key:"Mod-Home",run:qp,shift:$p},{key:"End",run:fv,shift:kv,preventDefault:!0},{key:"Mod-End",run:Vp,shift:Bp},{key:"Enter",run:Uv},{key:"Mod-a",run:Av},{key:"Backspace",run:wc,shift:wc},{key:"Delete",run:fm},{key:"Mod-Backspace",mac:"Alt-Backspace",run:pm},{key:"Mod-Delete",mac:"Alt-Delete",run:Dv},{mac:"Mod-Backspace",run:qv},{mac:"Mod-Delete",run:Vv}].concat(Jv.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),ym=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hv,shift:xv},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:uv,shift:Sv},{key:"Alt-ArrowUp",run:Xv},{key:"Shift-Alt-ArrowUp",run:jv},{key:"Alt-ArrowDown",run:Nv},{key:"Shift-Alt-ArrowDown",run:Iv},{key:"Escape",run:_v},{key:"Mod-Enter",run:Fv},{key:"Alt-l",mac:"Ctrl-l",run:Qv},{key:"Mod-i",run:Mv,preventDefault:!0},{key:"Mod-[",run:Yv},{key:"Mod-]",run:Gv},{key:"Mod-Alt-\\",run:Hv},{key:"Shift-Mod-k",run:Wv},{key:"Shift-Mod-\\",run:bv},{key:"Mod-/",run:Ww},{key:"Alt-A",run:Uw},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Zv}].concat(Kv);function z(){var i=arguments[0];typeof i=="string"&&(i=document.createElement(i));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];typeof n=="string"?i.setAttribute(r,n):n!=null&&(i[r]=n)}e++}for(;e<arguments.length;e++)bm(i,arguments[e]);return i}function bm(i,e){if(typeof e=="string")i.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)i.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)bm(i,e[t]);else throw new RangeError("Unsupported child node: "+e)}var wm=typeof String.prototype.normalize=="function"?i=>i.normalize("NFKD"):i=>i,Kt=class{constructor(e,t,r=0,n=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,n),this.bufferStart=r,this.normalize=s?a=>s(wm(a)):wm,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return oe(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=qr(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Te(e);let n=this.normalize(t);for(let s=0,o=r;;s++){let a=n.charCodeAt(s),l=this.match(a,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(l)return this.value=l,this;break}o==r&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t,r){let n=null;for(let s=0;s<this.matches.length;s+=2){let o=this.matches[s],a=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?n={from:this.matches[s+1],to:r}:(this.matches[s]++,a=!0)),a||(this.matches.splice(s,2),s-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:t,to:r}:this.matches.push(1,t)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}};typeof Symbol<"u"&&(Kt.prototype[Symbol.iterator]=function(){return this});var km={from:-1,to:-1,match:/.*/.exec("")},Ac="gm"+(/x/.unicode==null?"":"u"),ho=class{constructor(e,t,r,n=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=km,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new fo(e,t,r,n,s);this.re=new RegExp(t,Ac+(r?.ignoreCase?"i":"")),this.test=r?.test,this.iter=e.iter();let o=e.lineAt(n);this.curLineStart=o.from,this.matchPos=po(e,n),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let r=this.curLineStart+t.index,n=r+t[0].length;if(this.matchPos=po(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(r<n||r>this.value.to)&&(!this.test||this.test(r,n,t)))return this.value={from:r,to:n,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},kc=new WeakMap,uo=class i{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,r){let n=kc.get(e);if(!n||n.from>=r||n.to<=t){let a=new i(t,e.sliceString(t,r));return kc.set(e,a),a}if(n.from==t&&n.to==r)return n;let{text:s,from:o}=n;return o>t&&(s=e.sliceString(t,o)+s,o=t),n.to<r&&(s+=e.sliceString(n.to,r)),kc.set(e,new i(o,s)),new i(t,s.slice(t-o,r-o))}},fo=class{constructor(e,t,r,n,s){this.text=e,this.to=s,this.done=!1,this.value=km,this.matchPos=po(e,n),this.re=new RegExp(t,Ac+(r?.ignoreCase?"i":"")),this.test=r?.test,this.flat=uo.get(e,n,this.chunkEnd(n+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let r=this.flat.from+t.index,n=r+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,t)))return this.value={from:r,to:n,match:t},this.matchPos=po(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=uo.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(ho.prototype[Symbol.iterator]=fo.prototype[Symbol.iterator]=function(){return this});function ex(i){try{return new RegExp(i,Ac),!0}catch{return!1}}function po(i,e){if(e>=i.length)return e;let t=i.lineAt(e),r;for(;e<t.to&&(r=t.text.charCodeAt(e-t.from))>=56320&&r<57344;)e++;return e}function Tc(i){let e=String(i.state.doc.lineAt(i.state.selection.main.head).number),t=z("input",{class:"cm-textfield",name:"line",value:e}),r=z("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:mo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},z("label",i.state.phrase("Go to line"),": ",t)," ",z("button",{class:"cm-button",type:"submit"},i.state.phrase("go")));function n(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=i,a=o.doc.lineAt(o.selection.main.head),[,l,c,h,u]=s,f=h?+h.slice(1):0,d=c?+c:a.number;if(c&&u){let g=d/100;l&&(g=g*(l=="-"?-1:1)+a.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else c&&l&&(d=d*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),p=k.cursor(m.from+Math.max(0,Math.min(f,m.length)));i.dispatch({effects:[mo.of(!1),E.scrollIntoView(p.from,{y:"center"})],selection:p}),i.focus()}return{dom:r}}var mo=_.define(),vm=K.define({create(){return!0},update(i,e){for(let t of e.effects)t.is(mo)&&(i=t.value);return i},provide:i=>vi.from(i,e=>e?Tc:null)}),tx=i=>{let e=xi(i,Tc);if(!e){let t=[mo.of(!0)];i.state.field(vm,!1)==null&&t.push(_.appendConfig.of([vm,ix])),i.dispatch({effects:t}),e=xi(i,Tc)}return e&&e.dom.querySelector("input").select(),!0},ix=E.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),rx={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Tm=R.define({combine(i){return ve(i,rx,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Pm(i){let e=[lx,ax];return i&&e.push(Tm.of(i)),e}var nx=Q.mark({class:"cm-selectionMatch"}),sx=Q.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function xm(i,e,t,r){return(t==0||i(e.sliceDoc(t-1,t))!=U.Word)&&(r==e.doc.length||i(e.sliceDoc(r,r+1))!=U.Word)}function ox(i,e,t,r){return i(e.sliceDoc(t,t+1))==U.Word&&i(e.sliceDoc(r-1,r))==U.Word}var ax=te.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=i.state.facet(Tm),{state:t}=i,r=t.selection;if(r.ranges.length>1)return Q.none;let n=r.main,s,o=null;if(n.empty){if(!e.highlightWordAroundCursor)return Q.none;let l=t.wordAt(n.head);if(!l)return Q.none;o=t.charCategorizer(n.head),s=t.sliceDoc(l.from,l.to)}else{let l=n.to-n.from;if(l<e.minSelectionLength||l>200)return Q.none;if(e.wholeWords){if(s=t.sliceDoc(n.from,n.to),o=t.charCategorizer(n.head),!(xm(o,t,n.from,n.to)&&ox(o,t,n.from,n.to)))return Q.none}else if(s=t.sliceDoc(n.from,n.to),!s)return Q.none}let a=[];for(let l of i.visibleRanges){let c=new Kt(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:h,to:u}=c.value;if((!o||xm(o,t,h,u))&&(n.empty&&h<=n.from&&u>=n.to?a.push(sx.range(h,u)):(h>=n.to||u<=n.from)&&a.push(nx.range(h,u)),a.length>e.maxMatches))return Q.none}}return Q.set(a)}},{decorations:i=>i.decorations}),lx=E.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),cx=({state:i,dispatch:e})=>{let{selection:t}=i,r=k.create(t.ranges.map(n=>i.wordAt(n.head)||k.cursor(n.head)),t.mainIndex);return r.eq(t)?!1:(e(i.update({selection:r})),!0)};function hx(i,e){let{main:t,ranges:r}=i.selection,n=i.wordAt(t.head),s=n&&n.from==t.from&&n.to==t.to;for(let o=!1,a=new Kt(i.doc,e,r[r.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new Kt(i.doc,e,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(l=>l.from==a.value.from))continue;if(s){let l=i.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var ux=({state:i,dispatch:e})=>{let{ranges:t}=i.selection;if(t.some(s=>s.from===s.to))return cx({state:i,dispatch:e});let r=i.sliceDoc(t[0].from,t[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=hx(i,r);return n?(e(i.update({selection:i.selection.addRange(k.range(n.from,n.to),!1),effects:E.scrollIntoView(n.to)})),!0):!1},pr=R.define({combine(i){return ve(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Rc(e),scrollToMatch:e=>E.scrollIntoView(e)})}});var go=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||ex(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,r)=>r=="n"?`
`:r=="r"?"\r":r=="t"?"	":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Cc(this):new Pc(this)}getCursor(e,t=0,r){let n=e.doc?e:j.create({doc:e});return r==null&&(r=n.doc.length),this.regexp?dr(this,n,t,r):fr(this,n,t,r)}},Oo=class{constructor(e){this.spec=e}};function fr(i,e,t,r){return new Kt(e.doc,i.unquoted,t,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?fx(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function fx(i,e){return(t,r,n,s)=>((s>t||s+n.length<r)&&(s=Math.max(0,t-2),n=i.sliceString(s,Math.min(i.length,r+2))),(e(yo(n,t-s))!=U.Word||e(bo(n,t-s))!=U.Word)&&(e(bo(n,r-s))!=U.Word||e(yo(n,r-s))!=U.Word))}var Pc=class extends Oo{constructor(e){super(e)}nextMatch(e,t,r){let n=fr(this.spec,e,r,e.doc.length).nextOverlapping();return n.done&&(n=fr(this.spec,e,0,t).nextOverlapping()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=r;;){let s=Math.max(t,n-1e4-this.spec.unquoted.length),o=fr(this.spec,e,s,n),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;n-=1e4}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let r=fr(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=fr(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function dr(i,e,t,r){return new ho(e.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?dx(e.charCategorizer(e.selection.main.head)):void 0},t,r)}function yo(i,e){return i.slice(le(i,e,!1),e)}function bo(i,e){return i.slice(e,le(i,e))}function dx(i){return(e,t,r)=>!r[0].length||(i(yo(r.input,r.index))!=U.Word||i(bo(r.input,r.index))!=U.Word)&&(i(bo(r.input,r.index+r[0].length))!=U.Word||i(yo(r.input,r.index+r[0].length))!=U.Word)}var Cc=class extends Oo{nextMatch(e,t,r){let n=dr(this.spec,e,r,e.doc.length).next();return n.done&&(n=dr(this.spec,e,0,t).next()),n.done?null:n.value}prevMatchInRange(e,t,r){for(let n=1;;n++){let s=Math.max(t,r-n*1e4),o=dr(this.spec,e,s,r),a=null;for(;!o.next().done;)a=o.value;if(a&&(s==t||a.from>s+10))return a;if(s==t)return null}}prevMatch(e,t,r){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&\d+])/g,(t,r)=>r=="$"?"$":r=="&"?e.match[0]:r!="0"&&+r<e.match.length?e.match[r]:t)}matchAll(e,t){let r=dr(this.spec,e,0,e.doc.length),n=[];for(;!r.next().done;){if(n.length>=t)return null;n.push(r.value)}return n}highlight(e,t,r,n){let s=dr(this.spec,e,Math.max(0,t-250),Math.min(r+250,e.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},kn=_.define(),Qc=_.define(),Jt=K.define({create(i){return new Sn(Ec(i).create(),null)},update(i,e){for(let t of e.effects)t.is(kn)?i=new Sn(t.value.create(),i.panel):t.is(Qc)&&(i=new Sn(i.query,t.value?Mc:null));return i},provide:i=>vi.from(i,e=>e.panel)});var Sn=class{constructor(e,t){this.query=e,this.panel=t}},px=Q.mark({class:"cm-searchMatch"}),mx=Q.mark({class:"cm-searchMatch cm-searchMatch-selected"}),gx=te.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Jt))}update(i){let e=i.state.field(Jt);(e!=i.startState.field(Jt)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:i,panel:e}){if(!e||!i.spec.valid)return Q.none;let{view:t}=this,r=new nt;for(let n=0,s=t.visibleRanges,o=s.length;n<o;n++){let{from:a,to:l}=s[n];for(;n<o-1&&l>s[n+1].from-2*250;)l=s[++n].to;i.highlight(t.state,a,l,(c,h)=>{let u=t.state.selection.ranges.some(f=>f.from==c&&f.to==h);r.add(c,h,u?mx:px)})}return r.finish()}},{decorations:i=>i.decorations});function Tn(i){return e=>{let t=e.state.field(Jt,!1);return t&&t.query.spec.valid?i(e,t):Rm(e)}}var wo=Tn((i,{query:e})=>{let{to:t}=i.state.selection.main,r=e.nextMatch(i.state,t,t);if(!r)return!1;let n=k.single(r.from,r.to),s=i.state.facet(pr);return i.dispatch({selection:n,effects:[_c(i,r),s.scrollToMatch(n.main,i)],userEvent:"select.search"}),Em(i),!0}),vo=Tn((i,{query:e})=>{let{state:t}=i,{from:r}=t.selection.main,n=e.prevMatch(t,r,r);if(!n)return!1;let s=k.single(n.from,n.to),o=i.state.facet(pr);return i.dispatch({selection:s,effects:[_c(i,n),o.scrollToMatch(s.main,i)],userEvent:"select.search"}),Em(i),!0}),Ox=Tn((i,{query:e})=>{let t=e.matchAll(i.state,1e3);return!t||!t.length?!1:(i.dispatch({selection:k.create(t.map(r=>k.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),yx=({state:i,dispatch:e})=>{let t=i.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:r,to:n}=t.main,s=[],o=0;for(let a=new Kt(i.doc,i.sliceDoc(r,n));!a.next().done;){if(s.length>1e3)return!1;a.value.from==r&&(o=s.length),s.push(k.range(a.value.from,a.value.to))}return e(i.update({selection:k.create(s,o),userEvent:"select.search.matches"})),!0},Sm=Tn((i,{query:e})=>{let{state:t}=i,{from:r,to:n}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,r,r);if(!s)return!1;let o=[],a,l,c=[];if(s.from==r&&s.to==n&&(l=t.toText(e.getReplacement(s)),o.push({from:s.from,to:s.to,insert:l}),s=e.nextMatch(t,s.from,s.to),c.push(E.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(r).number)+"."))),s){let h=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=k.single(s.from-h,s.to-h),c.push(_c(i,s)),c.push(t.facet(pr).scrollToMatch(a.main,i))}return i.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),bx=Tn((i,{query:e})=>{if(i.state.readOnly)return!1;let t=e.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:e.getReplacement(n)}});if(!t.length)return!1;let r=i.state.phrase("replaced $ matches",t.length)+".";return i.dispatch({changes:t,effects:E.announce.of(r),userEvent:"input.replace.all"}),!0});function Mc(i){return i.state.facet(pr).createPanel(i)}function Ec(i,e){var t,r,n,s,o;let a=i.selection.main,l=a.empty||a.to>a.from+100?"":i.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=i.facet(pr);return new go({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:c.caseSensitive,literal:(n=e?.literal)!==null&&n!==void 0?n:c.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function Cm(i){let e=xi(i,Mc);return e&&e.dom.querySelector("[main-field]")}function Em(i){let e=Cm(i);e&&e==i.root.activeElement&&e.select()}var Rm=i=>{let e=i.state.field(Jt,!1);if(e&&e.panel){let t=Cm(i);if(t&&t!=i.root.activeElement){let r=Ec(i.state,e.query.spec);r.valid&&i.dispatch({effects:kn.of(r)}),t.focus(),t.select()}}else i.dispatch({effects:[Qc.of(!0),e?kn.of(Ec(i.state,e.query.spec)):_.appendConfig.of(vx)]});return!0},Am=i=>{let e=i.state.field(Jt,!1);if(!e||!e.panel)return!1;let t=xi(i,Mc);return t&&t.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:Qc.of(!1)}),!0},Qm=[{key:"Mod-f",run:Rm,scope:"editor search-panel"},{key:"F3",run:wo,shift:vo,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:wo,shift:vo,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Am,scope:"editor search-panel"},{key:"Mod-Shift-l",run:yx},{key:"Mod-Alt-g",run:tx},{key:"Mod-d",run:ux,preventDefault:!0}],Rc=class{constructor(e){this.view=e;let t=this.query=e.state.field(Jt).query.spec;this.commit=this.commit.bind(this),this.searchField=z("input",{value:t.search,placeholder:We(e,"Find"),"aria-label":We(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=z("input",{value:t.replace,placeholder:We(e,"Replace"),"aria-label":We(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=z("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=z("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=z("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function r(n,s,o){return z("button",{class:"cm-button",name:n,onclick:s,type:"button"},o)}this.dom=z("div",{onkeydown:n=>this.keydown(n),class:"cm-search"},[this.searchField,r("next",()=>wo(e),[We(e,"next")]),r("prev",()=>vo(e),[We(e,"previous")]),r("select",()=>Ox(e),[We(e,"all")]),z("label",null,[this.caseField,We(e,"match case")]),z("label",null,[this.reField,We(e,"regexp")]),z("label",null,[this.wordField,We(e,"by word")]),...e.state.readOnly?[]:[z("br"),this.replaceField,r("replace",()=>Sm(e),[We(e,"replace")]),r("replaceAll",()=>bx(e),[We(e,"replace all")])],z("button",{name:"close",onclick:()=>Am(e),"aria-label":We(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new go({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:kn.of(e)}))}keydown(e){Vd(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?vo:wo)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Sm(this.view))}update(e){for(let t of e.transactions)for(let r of t.effects)r.is(kn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(pr).top}};function We(i,e){return i.state.phrase(e)}var lo=30,co=/[\s\.,:;?!]/;function _c(i,{from:e,to:t}){let r=i.state.doc.lineAt(e),n=i.state.doc.lineAt(t).to,s=Math.max(r.from,e-lo),o=Math.min(n,t+lo),a=i.state.sliceDoc(s,o);if(s!=r.from){for(let l=0;l<lo;l++)if(!co.test(a[l+1])&&co.test(a[l])){a=a.slice(l);break}}if(o!=n){for(let l=a.length-1;l>a.length-lo;l--)if(!co.test(a[l-1])&&co.test(a[l])){a=a.slice(0,l);break}}return E.announce.of(`${i.state.phrase("current match")}. ${a} ${i.state.phrase("on line")} ${r.number}.`)}var wx=E.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),vx=[Jt,Ce.low(gx),wx];var So=class{constructor(e,t,r){this.state=e,this.pos=t,this.explicit=r,this.abortListeners=[]}tokenBefore(e){let t=se(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),r=Math.max(t.from,this.pos-250),n=t.text.slice(r-t.from,this.pos-t.from),s=n.search(Nm(e,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}};function Mm(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function xx(i){let e=Object.create(null),t=Object.create(null);for(let{label:n}of i){e[n[0]]=!0;for(let s=1;s<n.length;s++)t[n[s]]=!0}let r=Mm(e)+Mm(t)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function Uc(i){let e=i.map(n=>typeof n=="string"?{label:n}:n),[t,r]=e.every(n=>/^\w+$/.test(n.label))?[/\w*$/,/\w+$/]:xx(e);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:e,validFor:t}:null}}function Xm(i,e){return t=>{for(let r=se(t.state).resolveInner(t.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(t)}}var ko=class{constructor(e,t,r,n){this.completion=e,this.source=t,this.match=r,this.score=n}};function ei(i){return i.selection.main.from}function Nm(i,e){var t;let{source:r}=i,n=e&&r[0]!="^",s=r[r.length-1]!="$";return!n&&!s?i:new RegExp(`${n?"^":""}(?:${r})${s?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}var Fc=De.define();function Sx(i,e,t,r){let{main:n}=i.selection,s=t-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(a=>a!=n&&t!=r&&i.sliceDoc(a.from+s,a.from+o)!=i.sliceDoc(t,r)?{range:a}:{changes:{from:a.from+s,to:r==n.from?a.to:a.from+o,insert:e},range:k.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}var _m=new WeakMap;function kx(i){if(!Array.isArray(i))return i;let e=_m.get(i);return e||_m.set(i,e=Uc(i)),e}var To=_.define(),Pn=_.define(),qc=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let r=oe(e,t),n=Te(r);this.chars.push(r);let s=e.slice(t,t+n),o=s.toUpperCase();this.folded.push(oe(o==s?s.toLowerCase():o,0)),t+=n}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:r,any:n,precise:s,byWord:o}=this;if(t.length==1){let y=oe(e,0),x=Te(y),v=x==e.length?0:-100;if(y!=t[0])if(y==r[0])v+=-200;else return null;return this.ret(v,[0,x])}let a=e.indexOf(this.pattern);if(a==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,c=0;if(a<0){for(let y=0,x=Math.min(e.length,200);y<x&&c<l;){let v=oe(e,y);(v==t[c]||v==r[c])&&(n[c++]=y),y+=Te(v)}if(c<l)return null}let h=0,u=0,f=!1,d=0,m=-1,p=-1,g=/[a-z]/.test(e),O=!0;for(let y=0,x=Math.min(e.length,200),v=0;y<x&&u<l;){let w=oe(e,y);a<0&&(h<l&&w==t[h]&&(s[h++]=y),d<l&&(w==t[d]||w==r[d]?(d==0&&(m=y),p=y+1,d++):d=0));let T,P=w<255?w>=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(T=qr(w))!=T.toLowerCase()?1:T!=T.toUpperCase()?2:0;(!y||P==1&&g||v==0&&P!=0)&&(t[u]==w||r[u]==w&&(f=!0)?o[u++]=y:o.length&&(O=!1)),v=P,y+=Te(w)}return u==l&&o[0]==0&&O?this.result(-100+(f?-200:0),o,e):d==l&&m==0?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):d==l?this.ret(-900-e.length,[m,p]):u==l?this.result(-100+(f?-200:0)+-700+(O?0:-1100),o,e):t.length==2?null:this.result((n[0]?-700:0)+-200+-1100,n,e)}result(e,t,r){let n=[],s=0;for(let o of t){let a=o+(this.astral?Te(oe(r,o)):1);s&&n[s-1]==o?n[s-1]=a:(n[s++]=o,n[s++]=a)}return this.ret(e-r.length,n)}},Vc=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),r=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,t.length],this.score=r+(e.length==this.pattern.length?0:-100),this)}},ye=R.define({combine(i){return ve(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Tx,filterStrict:!1,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>r=>Dm(e(r),t(r)),optionClass:(e,t)=>r=>Dm(e(r),t(r)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function Dm(i,e){return i?e?i+" "+e:i:e}function Tx(i,e,t,r,n,s){let o=i.textDirection==F.RTL,a=o,l=!1,c="top",h,u,f=e.left-n.left,d=n.right-e.right,m=r.right-r.left,p=r.bottom-r.top;if(a&&f<Math.min(m,d)?a=!1:!a&&d<Math.min(m,f)&&(a=!0),m<=(a?f:d))h=Math.max(n.top,Math.min(t.top,n.bottom-p))-e.top,u=Math.min(400,a?f:d);else{l=!0,u=Math.min(400,(o?e.right:n.right-e.left)-30);let y=n.bottom-e.bottom;y>=p||y>e.top?h=t.bottom-e.top:(c="bottom",h=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,O=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${h/g}px; max-width: ${u/O}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function Px(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),t.type&&r.classList.add(...t.type.split(/\s+/g).map(n=>"cm-completionIcon-"+n)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(t,r,n,s){let o=document.createElement("span");o.className="cm-completionLabel";let a=t.displayLabel||t.label,l=0;for(let c=0;c<s.length;){let h=s[c++],u=s[c++];h>l&&o.appendChild(document.createTextNode(a.slice(l,h)));let f=o.appendChild(document.createElement("span"));f.appendChild(document.createTextNode(a.slice(h,u))),f.className="cm-completionMatchedText",l=u}return l<a.length&&o.appendChild(document.createTextNode(a.slice(l))),o},position:50},{render(t){if(!t.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=t.detail,r},position:80}),e.sort((t,r)=>t.position-r.position).map(t=>t.render)}function Dc(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let n=Math.floor(e/t);return{from:n*t,to:(n+1)*t}}let r=Math.floor((i-e)/t);return{from:i-(r+1)*t,to:i-r*t}}var $c=class{constructor(e,t,r){this.view=e,this.stateField=t,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let n=e.state.field(t),{options:s,selected:o}=n.open,a=e.state.facet(ye);this.optionContent=Px(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=Dc(s.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(t).open;for(let h=l.target,u;h&&h!=this.dom;h=h.parentNode)if(h.nodeName=="LI"&&(u=/-(\d+)$/.exec(h.id))&&+u[1]<c.length){this.applyCompletion(e,c[+u[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(ye).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Pn.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let r=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=n){let{options:s,selected:o,disabled:a}=r.open;(!n.open||n.open.options!=s)&&(this.range=Dc(s.length,o,e.state.facet(ye).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),a!=((t=n.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of t.split(" "))r&&this.dom.classList.add(r);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Dc(t.options.length,t.selected,this.view.state.facet(ye).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:n}=r;if(!n)return;let s=typeof n=="string"?document.createTextNode(n):n(r);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,r)}).catch(o=>Oe(this.view.state,o,"completion info")):this.addInfoPane(s,r)}}addInfoPane(e,t){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:n,destroy:s}=e;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!="LI"||!r.id?n--:n==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),t=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return t&&Ex(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,t.bottom)-10||n.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(ye).positionInfo(this.view,t,n,r,s,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,r){let n=document.createElement("ul");n.id=t,n.setAttribute("role","listbox"),n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=r.from;o<r.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let f=typeof c=="string"?c:c.name;if(f!=s&&(o>r.from||r.from==0))if(s=f,typeof c!="string"&&c.header)n.appendChild(c.header(c));else{let d=n.appendChild(document.createElement("completion-section"));d.textContent=f}}let h=n.appendChild(document.createElement("li"));h.id=t+"-"+o,h.setAttribute("role","option");let u=this.optionClass(a);u&&(h.className=u);for(let f of this.optionContent){let d=f(a,this.view.state,this.view,l);d&&h.appendChild(d)}}return r.from&&n.classList.add("cm-completionListIncompleteTop"),r.to<e.length&&n.classList.add("cm-completionListIncompleteBottom"),n}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}};function Cx(i,e){return t=>new $c(t,i,e)}function Ex(i,e){let t=i.getBoundingClientRect(),r=e.getBoundingClientRect(),n=t.height/i.offsetHeight;r.top<t.top?i.scrollTop-=(t.top-r.top)/n:r.bottom>t.bottom&&(i.scrollTop+=(r.bottom-t.bottom)/n)}function Lm(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function Rx(i,e){let t=[],r=null,n=c=>{t.push(c);let{section:h}=c.completion;if(h){r||(r=[]);let u=typeof h=="string"?h:h.name;r.some(f=>f.name==u)||r.push(typeof h=="string"?{name:u}:h)}},s=e.facet(ye);for(let c of i)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)n(new ko(u,c.source,h?h(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),f,d=s.filterStrict?new Vc(u):new qc(u);for(let m of c.result.options)if(f=d.match(m.label)){let p=m.displayLabel?h?h(m,f.matched):[]:f.matched;n(new ko(m,c.source,p,f.score+(m.boost||0)))}}}if(r){let c=Object.create(null),h=0,u=(f,d)=>{var m,p;return((m=f.rank)!==null&&m!==void 0?m:1e9)-((p=d.rank)!==null&&p!==void 0?p:1e9)||(f.name<d.name?-1:1)};for(let f of r.sort(u))h-=1e5,c[f.name]=h;for(let f of t){let{section:d}=f.completion;d&&(f.score+=c[typeof d=="string"?d:d.name])}}let o=[],a=null,l=s.compareCompletions;for(let c of t.sort((h,u)=>u.score-h.score||l(h.completion,u.completion))){let h=c.completion;!a||a.label!=h.label||a.detail!=h.detail||a.type!=null&&h.type!=null&&a.type!=h.type||a.apply!=h.apply||a.boost!=h.boost?o.push(c):Lm(c.completion)>Lm(a)&&(o[o.length-1]=c),a=c.completion}return o}var Bc=class i{constructor(e,t,r,n,s,o){this.options=e,this.attrs=t,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new i(this.options,qm(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,r,n,s){let o=Rx(e,t);if(!o.length)return n&&e.some(l=>l.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let a=t.facet(ye).selectOnOpen?0:-1;if(n&&n.selected!=a&&n.selected!=-1){let l=n.options[n.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new i(o,qm(r,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:Lx,above:s.aboveCursor},n?n.timestamp:Date.now(),a,!1)}map(e){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},Xc=class i{constructor(e,t,r){this.active=e,this.id=t,this.open=r}static start(){return new i(_x,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,r=t.facet(ye),s=(r.override||t.languageDataAt("autocomplete",ei(t)).map(kx)).map(a=>(this.active.find(c=>c.source==a)||new xt(a,this.active.some(c=>c.state!=0)?1:0)).update(e,r));s.length==this.active.length&&s.every((a,l)=>a==this.active[l])&&(s=this.active);let o=this.open;o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!Ax(s,this.active)?o=Bc.build(s,t,this.id,o,r):o&&o.disabled&&!s.some(a=>a.state==1)&&(o=null),!o&&s.every(a=>a.state!=1)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new xt(a.source,0):a));for(let a of e.effects)a.is(Im)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Qx:Mx}};function Ax(i,e){if(i==e)return!0;for(let t=0,r=0;;){for(;t<i.length&&!i[t].hasResult;)t++;for(;r<e.length&&!e[r].hasResult;)r++;let n=t==i.length,s=r==e.length;if(n||s)return n==s;if(i[t++].result!=e[r++].result)return!1}}var Qx={"aria-autocomplete":"list"},Mx={};function qm(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}var _x=[];function Nc(i,e){if(i.isUserEvent("input.complete")){let t=i.annotation(Fc);if(t&&e.activateOnCompletion(t))return"input"}return i.isUserEvent("input.type")?"input":i.isUserEvent("delete.backward")?"delete":null}var xt=class i{constructor(e,t,r=-1){this.source=e,this.state=t,this.explicitPos=r}hasResult(){return!1}update(e,t){let r=Nc(e,t),n=this;r?n=n.handleUserEvent(e,r,t):e.docChanged?n=n.handleChange(e):e.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of e.effects)if(s.is(To))n=new i(n.source,1,s.value?ei(e.state):-1);else if(s.is(Pn))n=new i(n.source,0);else if(s.is(jm))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(e,t,r){return t=="delete"||!r.activateOnTyping?this.map(e.changes):new i(this.source,1)}handleChange(e){return e.changes.touchesRange(ei(e.startState))?new i(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new i(this.source,this.state,e.mapPos(this.explicitPos))}},Po=class i extends xt{constructor(e,t,r,n,s){super(e,2,t),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(e,t,r){var n;let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),l=ei(e.state);if((this.explicitPos<0?l<=o:l<this.from)||l>a||!s||t=="delete"&&ei(e.startState)==this.from)return new xt(this.source,t=="input"&&r.activateOnTyping?1:0);let c=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return Dx(s.validFor,e.state,o,a)?new i(this.source,c,s,o,a):s.update&&(s=s.update(s,o,a,new So(e.state,l,c>=0)))?new i(this.source,c,s,s.from,(n=s.to)!==null&&n!==void 0?n:ei(e.state)):new xt(this.source,1,c)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new xt(this.source,0):this.map(e.changes)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new i(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new xt(this.source,0)}};function Dx(i,e,t,r){if(!i)return!1;let n=e.sliceDoc(t,r);return typeof i=="function"?i(n,t,r,e):Nm(i,!0).test(n)}var jm=_.define({map(i,e){return i.map(t=>t.map(e))}}),Im=_.define(),Ve=K.define({create(){return Xc.start()},update(i,e){return i.update(e)},provide:i=>[on.from(i,e=>e.tooltip),E.contentAttributes.from(i,e=>e.attrs)]});function Hc(i,e){let t=e.completion.apply||e.completion.label,r=i.state.field(Ve).active.find(n=>n.source==e.source);return r instanceof Po?(typeof t=="string"?i.dispatch(Object.assign(Object.assign({},Sx(i.state,t,r.from,r.to)),{annotations:Fc.of(e.completion)})):t(i,e.completion,r.from,r.to),!0):!1}var Lx=Cx(Ve,Hc);function xo(i,e="option"){return t=>{let r=t.state.field(Ve,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<t.state.facet(ye).interactionDelay)return!1;let n=1,s;e=="page"&&(s=Il(t,r.open.tooltip))&&(n=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=r.open.options,a=r.open.selected>-1?r.open.selected+n*(i?1:-1):i?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:Im.of(a)}),!0}}var qx=i=>{let e=i.state.field(Ve,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(ye).interactionDelay?!1:Hc(i,e.open.options[e.open.selected])},Vx=i=>i.state.field(Ve,!1)?(i.dispatch({effects:To.of(!0)}),!0):!1,$x=i=>{let e=i.state.field(Ve,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:Pn.of(null)}),!0)},jc=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},Bx=50,Xx=1e3,Nx=te.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(Ve).active)e.state==1&&this.startQuery(e)}update(i){let e=i.state.field(Ve),t=i.state.facet(ye);if(!i.selectionSet&&!i.docChanged&&i.startState.field(Ve)==e)return;let r=i.transactions.some(s=>(s.selection||s.docChanged)&&!Nc(s,t));for(let s=0;s<this.running.length;s++){let o=this.running[s];if(r||o.updates.length+i.transactions.length>Bx&&Date.now()-o.time>Xx){for(let a of o.context.abortListeners)try{a()}catch(l){Oe(this.view.state,l)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(s=>s.effects.some(o=>o.is(To)))&&(this.pendingStart=!0);let n=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.state==1&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),n):-1,this.composing!=0)for(let s of i.transactions)Nc(s,t)=="input"?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(Ve);for(let t of e.active)t.state==1&&!this.running.some(r=>r.active.source==t.source)&&this.startQuery(t)}startQuery(i){let{state:e}=this.view,t=ei(e),r=new So(e,t,i.explicitPos==t),n=new jc(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Pn.of(null)}),Oe(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ye).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(ye);for(let r=0;r<this.running.length;r++){let n=this.running[r];if(n.done===void 0)continue;if(this.running.splice(r--,1),n.done){let o=new Po(n.active.source,n.active.explicitPos,n.done,n.done.from,(i=n.done.to)!==null&&i!==void 0?i:ei(n.updates.length?n.updates[0].startState:this.view.state));for(let a of n.updates)o=o.update(a,t);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(Ve).active.find(o=>o.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new xt(n.active.source,0);for(let a of n.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:jm.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(Ve,!1);if(e&&e.tooltip&&this.view.state.facet(ye).closeOnBlur){let t=e.open&&Il(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Pn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:To.of(!1)}),20),this.composing=0}}}),jx=typeof navigator=="object"&&/Win/.test(navigator.platform),Ix=Ce.highest(E.domEventHandlers({keydown(i,e){let t=e.state.field(Ve,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(jx&&i.altKey)||i.metaKey)return!1;let r=t.open.options[t.open.selected],n=t.active.find(o=>o.source==r.source),s=r.completion.commitCharacters||n.result.commitCharacters;return s&&s.indexOf(i.key)>-1&&Hc(e,r),!1}})),Wm=E.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Ic=class{constructor(e,t,r,n){this.field=e,this.line=t,this.from=r,this.to=n}},Wc=class i{constructor(e,t,r){this.field=e,this.from=t,this.to=r}map(e){let t=e.mapPos(this.from,-1,de.TrackDel),r=e.mapPos(this.to,1,de.TrackDel);return t==null||r==null?null:new i(this.field,t,r)}},zc=class i{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let r=[],n=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=o,h=/^\t*/.exec(l)[0].length;for(let u=0;u<h;u++)c+=e.facet(cr);n.push(t+c.length-h),l=c+l.slice(h)}r.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new Wc(l.field,n[l.line]+l.from,n[l.line]+l.to));return{text:r,ranges:a}}static parse(e){let t=[],r=[],n=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(o);){let a=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,h=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u<t.length;u++)(a!=null?t[u].seq==a:h&&t[u].name==h)&&(c=u);if(c<0){let u=0;for(;u<t.length&&(a==null||t[u].seq!=null&&t[u].seq<a);)u++;t.splice(u,0,{seq:a,name:h}),c=u;for(let f of n)f.field>=c&&f.field++}n.push(new Ic(c,r.length,s.index,s.index+h.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let h of n)h.line==r.length&&h.from>c&&(h.from--,h.to--);return l}),r.push(o)}return new i(r,n)}},Wx=Q.widget({widget:new class extends qe{toDOM(){let i=document.createElement("span");return i.className="cm-snippetFieldPosition",i}ignoreEvent(){return!1}}}),zx=Q.mark({class:"cm-snippetField"}),mr=class i{constructor(e,t){this.ranges=e,this.active=t,this.deco=Q.set(e.map(r=>(r.from==r.to?Wx:zx).range(r.from,r.to)))}map(e){let t=[];for(let r of this.ranges){let n=r.map(e);if(!n)return null;t.push(n)}return new i(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(r=>r.field==this.active&&r.from<=t.from&&r.to>=t.to))}},Rn=_.define({map(i,e){return i&&i.map(e)}}),Ux=_.define(),Cn=K.define({create(){return null},update(i,e){for(let t of e.effects){if(t.is(Rn))return t.value;if(t.is(Ux)&&i)return new mr(i.ranges,t.value)}return i&&e.docChanged&&(i=i.map(e.changes)),i&&e.selection&&!i.selectionInsideField(e.selection)&&(i=null),i},provide:i=>E.decorations.from(i,e=>e?e.deco:Q.none)});function Gc(i,e){return k.create(i.filter(t=>t.field==e).map(t=>k.range(t.from,t.to)))}function Fx(i){let e=zc.parse(i);return(t,r,n,s)=>{let{text:o,ranges:a}=e.instantiate(t.state,n),l={changes:{from:n,to:s,insert:X.of(o)},scrollIntoView:!0,annotations:r?[Fc.of(r),ae.userEvent.of("input.complete")]:void 0};if(a.length&&(l.selection=Gc(a,0)),a.some(c=>c.field>0)){let c=new mr(a,0),h=l.effects=[Rn.of(c)];t.state.field(Cn,!1)===void 0&&h.push(_.appendConfig.of([Cn,Jx,Kx,Wm]))}t.dispatch(t.state.update(l))}}function zm(i){return({state:e,dispatch:t})=>{let r=e.field(Cn,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return t(e.update({selection:Gc(r.ranges,n),effects:Rn.of(s?null:new mr(r.ranges,n)),scrollIntoView:!0})),!0}}var Hx=({state:i,dispatch:e})=>i.field(Cn,!1)?(e(i.update({effects:Rn.of(null)})),!0):!1,Gx=zm(1),Yx=zm(-1);var Zx=[{key:"Tab",run:Gx,shift:Yx},{key:"Escape",run:Hx}],Vm=R.define({combine(i){return i.length?i[0]:Zx}}),Jx=Ce.highest(Qt.compute([Vm],i=>i.facet(Vm)));function St(i,e){return Object.assign(Object.assign({},e),{apply:Fx(i)})}var Kx=E.domEventHandlers({mousedown(i,e){let t=e.state.field(Cn,!1),r;if(!t||(r=e.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=t.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==t.active?!1:(e.dispatch({selection:Gc(t.ranges,n.field),effects:Rn.of(t.ranges.some(s=>s.field>n.field)?new mr(t.ranges,n.field):null),scrollIntoView:!0}),!0)}});var En={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ai=_.define({map(i,e){let t=e.mapPos(i,-1,de.TrackAfter);return t??void 0}}),Yc=new class extends rt{};Yc.startSide=1;Yc.endSide=-1;var Um=K.define({create(){return I.empty},update(i,e){if(i=i.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);i=i.update({filter:r=>r>=t.from&&r<=t.to})}for(let t of e.effects)t.is(Ai)&&(i=i.update({add:[Yc.range(t.value,t.value+1)]}));return i}});function Fm(){return[t1,Um]}var Lc="()[]{}<>";function Hm(i){for(let e=0;e<Lc.length;e+=2)if(Lc.charCodeAt(e)==i)return Lc.charAt(e+1);return qr(i<128?i:i+1)}function Gm(i,e){return i.languageDataAt("closeBrackets",e)[0]||En}var e1=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),t1=E.inputHandler.of((i,e,t,r)=>{if((e1?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&Te(oe(r,0))==1||e!=n.from||t!=n.to)return!1;let s=r1(i.state,r);return s?(i.dispatch(s),!0):!1}),i1=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let r=Gm(i,i.selection.main.head).brackets||En.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let a=n1(i.doc,o.head);for(let l of r)if(l==a&&Co(i.doc,o.head)==Hm(oe(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:k.cursor(o.head-l.length)}}return{range:n=o}});return n||e(i.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!n},Ym=[{key:"Backspace",run:i1}];function r1(i,e){let t=Gm(i,i.selection.main.head),r=t.brackets||En.brackets;for(let n of r){let s=Hm(oe(n,0));if(e==n)return s==n?a1(i,n,r.indexOf(n+n+n)>-1,t):s1(i,n,s,t.before||En.before);if(e==s&&Zm(i,i.selection.main.from))return o1(i,n,s)}return null}function Zm(i,e){let t=!1;return i.field(Um).between(0,i.doc.length,r=>{r==e&&(t=!0)}),t}function Co(i,e){let t=i.sliceString(e,e+2);return t.slice(0,Te(oe(t,0)))}function n1(i,e){let t=i.sliceString(e-2,e);return Te(oe(t,0))==t.length?t:t.slice(1)}function s1(i,e,t,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ai.of(o.to+e.length),range:k.range(o.anchor+e.length,o.head+e.length)};let a=Co(i.doc,o.head);return!a||/\s/.test(a)||r.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Ai.of(o.head+e.length),range:k.cursor(o.head+e.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function o1(i,e,t){let r=null,n=i.changeByRange(s=>s.empty&&Co(i.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:k.cursor(s.head+t.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:"input.type"})}function a1(i,e,t,r){let n=r.stringPrefixes||En.stringPrefixes,s=null,o=i.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ai.of(a.to+e.length),range:k.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Co(i.doc,l),h;if(c==e){if($m(i,l))return{changes:{insert:e+e,from:l},effects:Ai.of(l+e.length),range:k.cursor(l+e.length)};if(Zm(i,l)){let f=t&&i.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+f.length,insert:f},range:k.cursor(l+f.length)}}}else{if(t&&i.sliceDoc(l-2*e.length,l)==e+e&&(h=Bm(i,l-2*e.length,n))>-1&&$m(i,h))return{changes:{insert:e+e+e+e,from:l},effects:Ai.of(l+e.length),range:k.cursor(l+e.length)};if(i.charCategorizer(l)(c)!=U.Word&&Bm(i,l,n)>-1&&!l1(i,l,e,n))return{changes:{insert:e+e,from:l},effects:Ai.of(l+e.length),range:k.cursor(l+e.length)}}return{range:s=a}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function $m(i,e){let t=se(i).resolveInner(e+1);return t.parent&&t.from==e}function l1(i,e,t,r){let n=se(i).resolveInner(e,-1),s=r.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=i.sliceDoc(n.from,Math.min(n.to,n.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&r.indexOf(a.slice(0,l))>-1){let h=n.firstChild;for(;h&&h.from==n.from&&h.to-h.from>t.length+l;){if(i.sliceDoc(h.to-t.length,h.to)==t)return!1;h=h.firstChild}return!0}let c=n.to==e&&n.parent;if(!c)break;n=c}return!1}function Bm(i,e,t){let r=i.charCategorizer(e);if(r(i.sliceDoc(e-1,e))!=U.Word)return e;for(let n of t){let s=e-n.length;if(i.sliceDoc(s,e)==n&&r(i.sliceDoc(s-1,s))!=U.Word)return s}return-1}function An(i={}){return[Ix,Ve,ye.of(i),Nx,c1,Wm]}var Zc=[{key:"Ctrl-Space",run:Vx},{key:"Escape",run:$x},{key:"ArrowDown",run:xo(!0)},{key:"ArrowUp",run:xo(!1)},{key:"PageDown",run:xo(!0,"page")},{key:"PageUp",run:xo(!1,"page")},{key:"Enter",run:qx}],c1=Ce.highest(Qt.computeN([ye],i=>i.facet(ye).defaultKeymap?[Zc]:[]));var Jc=class{constructor(e,t,r){this.from=e,this.to=t,this.diagnostic=r}},Qi=class i{constructor(e,t,r){this.diagnostics=e,this.panel=t,this.selected=r}static init(e,t,r){let n=e,s=r.facet(Qn).markerFilter;s&&(n=s(n,r));let o=Q.set(n.map(a=>a.from==a.to||a.from==a.to-1&&r.doc.lineAt(a.from).to==a.from?Q.widget({widget:new Kc(a),diagnostic:a}).range(a.from):Q.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new i(o,t,gr(o))}};function gr(i,e=null,t=0){let r=null;return i.between(t,1e9,(n,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return r=new Jc(n,s,o.diagnostic),!1}),r}function h1(i,e){let t=e.pos,r=e.end||t,n=i.state.facet(Qn).hideOn(i,t,r);if(n!=null)return n;let s=i.startState.doc.lineAt(e.pos);return!!(i.effects.some(o=>o.is(Km))||i.changes.touchesRange(s.from,Math.max(s.to,r)))}function u1(i,e){return i.field(ze,!1)?e:e.concat(_.appendConfig.of(b1))}var Km=_.define(),eh=_.define(),eg=_.define(),ze=K.define({create(){return new Qi(Q.none,null,null)},update(i,e){if(e.docChanged&&i.diagnostics.size){let t=i.diagnostics.map(e.changes),r=null,n=i.panel;if(i.selected){let s=e.changes.mapPos(i.selected.from,1);r=gr(t,i.selected.diagnostic,s)||gr(t,null,s)}!t.size&&n&&e.state.facet(Qn).autoPanel&&(n=null),i=new Qi(t,n,r)}for(let t of e.effects)if(t.is(Km)){let r=e.state.facet(Qn).autoPanel?t.value.length?Mn.open:null:i.panel;i=Qi.init(t.value,r,e.state)}else t.is(eh)?i=new Qi(i.diagnostics,t.value?Mn.open:null,i.selected):t.is(eg)&&(i=new Qi(i.diagnostics,i.panel,t.value));return i},provide:i=>[vi.from(i,e=>e.panel),E.decorations.from(i,e=>e.diagnostics)]});var f1=Q.mark({class:"cm-lintRange cm-lintRange-active"});function d1(i,e,t){let{diagnostics:r}=i.state.field(ze),n=[],s=2e8,o=0;r.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:h})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0))&&(n.push(h.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=i.state.facet(Qn).tooltipFilter;return a&&(n=a(n,i.state)),n.length?{pos:s,end:o,above:i.state.doc.lineAt(s).to<o,create(){return{dom:p1(i,n)}}}:null}function p1(i,e){return z("ul",{class:"cm-tooltip-lint"},e.map(t=>rg(i,t,!1)))}var m1=i=>{let e=i.state.field(ze,!1);(!e||!e.panel)&&i.dispatch({effects:u1(i.state,[eh.of(!0)])});let t=xi(i,Mn.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Jm=i=>{let e=i.state.field(ze,!1);return!e||!e.panel?!1:(i.dispatch({effects:eh.of(!1)}),!0)},g1=i=>{let e=i.state.field(ze,!1);if(!e)return!1;let t=i.state.selection.main,r=e.diagnostics.iter(t.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==t.from&&r.to==t.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var tg=[{key:"Mod-Shift-m",run:m1,preventDefault:!0},{key:"F8",run:g1}];var Qn=R.define({combine(i){return Object.assign({sources:i.map(e=>e.source).filter(e=>e!=null)},ve(i.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{needsRefresh:(e,t)=>e?t?r=>e(r)||t(r):e:t}))}});function ig(i){let e=[];if(i)e:for(let{name:t}of i){for(let r=0;r<t.length;r++){let n=t[r];if(/[a-zA-Z]/.test(n)&&!e.some(s=>s.toLowerCase()==n.toLowerCase())){e.push(n);continue e}}e.push("")}return e}function rg(i,e,t){var r;let n=t?ig(e.actions):[];return z("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},z("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(i):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((s,o)=>{let a=!1,l=f=>{if(f.preventDefault(),a)return;a=!0;let d=gr(i.state.field(ze).diagnostics,e);d&&s.apply(i,d.from,d.to)},{name:c}=s,h=n[o]?c.indexOf(n[o]):-1,u=h<0?c:[c.slice(0,h),z("u",c.slice(h,h+1)),c.slice(h+1)];return z("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${h<0?"":` (access key "${n[o]})"`}.`},u)}),e.source&&z("div",{class:"cm-diagnosticSource"},e.source))}var Kc=class extends qe{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return z("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}},Ro=class{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=rg(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}},Mn=class i{constructor(e){this.view=e,this.items=[];let t=n=>{if(n.keyCode==27)Jm(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=ig(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==n.keyCode){let l=gr(this.view.state.field(ze).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;n.preventDefault()},r=n=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(n.target)&&this.moveSelection(s)};this.list=z("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:r}),this.dom=z("div",{class:"cm-panel-lint"},this.list,z("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Jm(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(ze).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(ze),r=0,n=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,h;for(let u=r;u<this.items.length;u++)if(this.items[u].diagnostic==l.diagnostic){c=u;break}c<0?(h=new Ro(this.view,l.diagnostic),this.items.splice(r,0,h),n=!0):(h=this.items[c],c>r&&(this.items.splice(r,c-r),n=!0)),t&&h.diagnostic==t.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),r++});r<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)n=!0,this.items.pop();this.items.length==0&&(this.items.push(new Ro(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),n=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:()=>({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:a})=>{let l=a.height/this.list.offsetHeight;o.top<a.top?this.list.scrollTop-=(a.top-o.top)/l:o.bottom>a.bottom&&(this.list.scrollTop+=(o.bottom-a.bottom)/l)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),n&&this.sync()}sync(){let e=this.list.firstChild;function t(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)t();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(ze),r=gr(t.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:eg.of(r)})}static open(e){return new i(e)}};function O1(i,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(i)}</svg>')`}function Eo(i){return O1(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${i}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}var y1=E.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Eo("#d11")},".cm-lintRange-warning":{backgroundImage:Eo("orange")},".cm-lintRange-info":{backgroundImage:Eo("#999")},".cm-lintRange-hint":{backgroundImage:Eo("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});var b1=[ze,E.decorations.compute([ze],i=>{let{selected:e,panel:t}=i.field(ze);return!e||!t||e.from==e.to?Q.none:Q.set([f1.range(e.from,e.to)])}),Yd(d1,{hideOn:h1}),y1];var ng=[Kd(),ep(),Ud(),Ip(),Pp(),jd(),zd(),j.allowMultipleSelections.of(!0),yp(),wn(Ep,{fallback:!0}),Mp(),Fm(),An(),Hd(),Gd(),Fd(),Pm(),Qt.of([...Ym,...ym,...Qm,...Fp,...Sp,...Zc,...tg])];var rh=class i{constructor(e,t,r,n,s,o,a,l,c,h=0,u){this.p=e,this.stack=t,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=h,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,r=0){let n=e.parser.context;return new i(e,[],t,r,r,0,[],0,n?new Ao(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let r=e>>19,n=e&65535,{parser:s}=this.p;this.reducePos<this.pos-25&&this.setLookAhead(this.pos);let o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n<s.minRepeatTerm&&this.storeNode(n,this.reducePos,this.reducePos,4,!0),this.reduceContext(n,this.reducePos);return}let a=this.stack.length-(r-1)*3-(e&262144?6:0),l=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-l;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[n])===null||t===void 0)&&t.isAnonymous)&&(l==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=l,this.p.lastBigReductionSize=c));let h=a?this.stack[a-1]:0,u=this.bufferBase+this.buffer.length-h;if(n<s.minRepeatTerm||e&131072){let f=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(n,l,f,u+4,!0)}if(e&262144)this.state=this.stack[a];else{let f=this.stack[a-3];this.state=s.getGoto(f,n,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(n,l)}storeNode(e,t,r,n=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,a=this.buffer.length;if(a==0&&o.parent&&(a=o.bufferBase-o.parent.bufferBase,o=o.parent),a>0&&o.buffer[a-4]==0&&o.buffer[a-1]>-1){if(t==r)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(e,t,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(e,t,r,n){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;(n>this.pos||t<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(t,r),t<=o.maxNode&&this.buffer.push(t,r,n,4)}else this.pos=n,this.shiftContext(t,r),t<=this.p.parser.maxNode&&this.buffer.push(t,r,n,4)}apply(e,t,r,n){e&65536?this.reduce(e):this.shift(e,t,r,n)}useNode(e,t){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let n=this.pos;this.reducePos=this.pos=n+e.length,this.pushState(t,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let r=e.buffer.slice(t),n=e.bufferBase+t;for(;e&&n==e.bufferBase;)e=e.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,r?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new nh(this);;){let r=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(r==0)return!1;if((r&65536)==0)return!0;t.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&n.push(t[s],o);if(this.stack.length<120)for(let s=0;n.length<8&&s<t.length;s+=2){let o=t[s+1];n.some((a,l)=>l&1&&a==o)||n.push(t[s],o)}t=n}let r=[];for(let n=0;n<t.length&&r.length<4;n+=2){let s=t[n+1];if(s==this.state)continue;let o=this.split();o.pushState(s,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[n],this.pos),o.reducePos=this.pos,o.score-=200,r.push(o)}return r}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let r=t>>19,n=t&65535,s=this.stack.length-r*3;if(s<0||e.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],r=(n,s)=>{if(!t.includes(n))return t.push(n),e.allActions(n,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-s;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=r(o,s+1);if(a!=null)return a}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Ao(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){e>this.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},Ao=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},nh=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=n}},sh=class i{constructor(e,t,r){this.stack=e,this.pos=t,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new i(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function _n(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let r=0,n=0;r<i.length;){let s=0;for(;;){let o=i.charCodeAt(r++),a=!1;if(o==126){s=65535;break}o>=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),s+=l,a)break;s*=46}t?t[n++]=s:t=new e(s)}return t}var Or=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},sg=new Or,oh=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=sg,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let r=this.range,n=this.rangeIndex,s=this.pos+e;for(;s<r.from;){if(!n)return null;let o=this.ranges[--n];s-=r.from-o.to,r=o}for(;t<0?s>r.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,r,n;if(t>=0&&t<this.chunk.length)r=this.pos+e,n=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(r=s,r>=this.chunk2Pos&&r<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(r-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=r;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=r),r+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(e,t=0){let r=t?this.resolveOffset(t,-1):this.pos;if(r==null||r<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=r}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=sg,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let r="";for(let n of this.ranges){if(n.from>=t)break;n.to>e&&(r+=this.input.read(Math.max(n.from,e),Math.min(n.to,t)))}return r}},ti=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:r}=t.p;hg(this.data,e,t,this.id,r.data,r.tokenPrecTable)}};ti.prototype.contextual=ti.prototype.fallback=ti.prototype.extend=!1;var ah=class{constructor(e,t,r){this.precTable=t,this.elseToken=r,this.data=typeof e=="string"?_n(e):e}token(e,t){let r=e.pos,n=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(hg(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;e.reset(o,e.token)}n&&(e.reset(r,e.token),e.acceptToken(this.elseToken,n))}};ah.prototype.contextual=ti.prototype.fallback=ti.prototype.extend=!1;var Mi=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function hg(i,e,t,r,n,s){let o=0,a=1<<r,{dialect:l}=t.p.parser;e:for(;(a&i[o])!=0;){let c=i[o+1];for(let d=o+3;d<c;d+=2)if((i[d+1]&a)>0){let m=i[d];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||v1(m,e.token.value,n,s))){e.acceptToken(m);break}}let h=e.next,u=0,f=i[o+2];if(e.next<0&&f>u&&i[c+f*3-3]==65535){o=i[c+f*3-1];continue e}for(;u<f;){let d=u+f>>1,m=c+d+(d<<1),p=i[m],g=i[m+1]||65536;if(h<p)f=d;else if(h>=g)u=d+1;else{o=i[m+2],e.advance();continue e}}break}}function og(i,e,t){for(let r=e,n;(n=i[r])!=65535;r++)if(n==t)return r-e;return-1}function v1(i,e,t,r){let n=og(t,r,e);return n<0||og(t,r,i)<n}var Ue=typeof process<"u"&&process.env&&/\bparse\b/.test(process.env.LOG),th=null;function ag(i,e,t){let r=i.cursor(ie.IncludeAnonymous);for(r.moveTo(e);;)if(!(t<0?r.childBefore(e):r.childAfter(e)))for(;;){if((t<0?r.to<e:r.from>e)&&!r.type.isError)return t<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(i.length,Math.max(r.from+1,e+25));if(t<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return t<0?0:i.length}}var lh=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ag(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ag(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let r=this.trees[t],n=this.index[t];if(n==r.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=r.children[n],o=this.start[t]+r.positions[n];if(o>e)return this.nextStart=o,null;if(s instanceof ne){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(D.lookAhead);if(!l||a+l<this.fragment.to)return s}}this.index[t]++,o+s.length>=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}},ch=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new Or)}getActions(e){let t=0,r=null,{parser:n}=e.p,{tokenizers:s}=n,o=n.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;c<s.length;c++){if((1<<c&o)==0)continue;let h=s[c],u=this.tokens[c];if(!(r&&!h.fallback)&&((h.contextual||u.start!=e.pos||u.mask!=o||u.context!=a)&&(this.updateCachedToken(u,h,e),u.mask=o,u.context=a),u.lookAhead>u.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let f=t;if(u.extended>-1&&(t=this.addActions(e,u.extended,u.end,t)),t=this.addActions(e,u.value,u.end,t),!h.extend&&(r=u,t>f))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!r&&e.pos==this.stream.end&&(r=new Or,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,t=this.addActions(e,r.value,r.end,t)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Or,{pos:r,p:n}=e;return t.start=r,t.end=Math.min(r+1,n.stream.end),t.value=r==n.stream.end?n.parser.eofTerm:0,t}updateCachedToken(e,t,r){let n=this.stream.clipPos(r.pos);if(t.token(this.stream.reset(n,e),r),e.value>-1){let{parser:s}=r.p;for(let o=0;o<s.specialized.length;o++)if(s.specialized[o]==e.value){let a=s.specializers[o](this.stream.read(e.start,e.end),r);if(a>=0&&r.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(n+1)}putAction(e,t,r,n){for(let s=0;s<n;s+=3)if(this.actions[s]==e)return n;return this.actions[n++]=e,this.actions[n++]=t,this.actions[n++]=r,n}addActions(e,t,r,n){let{state:s}=e,{parser:o}=e.p,{data:a}=o;for(let l=0;l<2;l++)for(let c=o.stateSlot(s,l?2:1);;c+=3){if(a[c]==65535)if(a[c+1]==1)c=Mt(a,c+2);else{n==0&&a[c+1]==2&&(n=this.putAction(Mt(a,c+2),t,r,n));break}a[c]==t&&(n=this.putAction(Mt(a,c+1),t,r,n))}return n}},hh=class{constructor(e,t,r,n){this.parser=e,this.input=t,this.ranges=n,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new oh(t,n),this.tokens=new ch(e,this.stream),this.topTerm=e.top[1];let{from:s}=n[0];this.stacks=[rh.start(this,e.top[0],s)],this.fragments=r.length&&this.stream.end-s>e.bufferLength*4?new lh(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let a=e[o];for(;;){if(this.tokens.mainToken=null,a.pos>t)r.push(a);else{if(this.advanceStack(a,r,e))continue;{n||(n=[],s=[]),n.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!r.length){let o=n&&x1(n);if(o)return Ue&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ue&&n&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Ue&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((a,l)=>l.score-a.score);r.length>o;)r.pop();r.some(a=>a.reducePos>t)&&this.recovering--}else if(r.length>1){e:for(let o=0;o<r.length-1;o++){let a=r[o];for(let l=o+1;l<r.length;l++){let c=r[l];if(a.sameState(c)||a.buffer.length>500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)r.splice(l--,1);else{r.splice(o--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o<r.length;o++)r[o].pos<this.minStackPos&&(this.minStackPos=r[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,r){let n=e.pos,{parser:s}=this,o=Ue?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&n>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,h=c?e.curContext.hash:0;for(let u=this.fragments.nodeAt(n);u;){let f=this.parser.nodeSet.types[u.type.id]==u.type?s.getGoto(e.state,u.type.id):-1;if(f>-1&&u.length&&(!c||(u.prop(D.contextHash)||0)==h))return e.useNode(u,f),Ue&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(u.type.id)})`),!0;if(!(u instanceof ne)||u.children.length==0||u.positions[0]>0)break;let d=u.children[0];if(d instanceof ne&&u.positions[0]==0)u=d;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),Ue&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let h=l[c++],u=l[c++],f=l[c++],d=c==l.length||!r,m=d?e:e.split(),p=this.tokens.mainToken;if(m.apply(h,u,p?p.start:m.pos,f),Ue&&console.log(o+this.stackID(m)+` (via ${(h&65536)==0?"shift":`reduce of ${s.getName(h&65535)}`} for ${s.getName(u)} @ ${n}${m==e?"":", split"})`),d)return!0;m.pos>n?t.push(m):r.push(m)}return!1}advanceFully(e,t){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return lg(e,t),!0}}runRecovery(e,t,r){let n=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],h=Ue?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),Ue&&console.log(h+this.stackID(a)+" (restarted)"),this.advanceFully(a,r))))continue;let u=a.split(),f=h;for(let d=0;u.forceReduce()&&d<10&&(Ue&&console.log(f+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,r));d++)Ue&&(f=this.stackID(u)+" -> ");for(let d of a.recoverByInsert(l))Ue&&console.log(h+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,r);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Ue&&console.log(h+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),lg(a,r)):(!n||n.score<a.score)&&(n=a)}return n}stackToTree(e){return e.close(),ne.build({buffer:sh.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(th||(th=new WeakMap)).get(e);return t||th.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}};function lg(i,e){for(let t=0;t<e.length;t++){let r=e[t];if(r.pos==i.pos&&r.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}var uh=class{constructor(e,t,r){this.source=e,this.flags=t,this.disabled=r}allows(e){return!this.disabled||this.disabled[e]==0}},ih=i=>i,Qo=class{constructor(e){this.start=e.start,this.shift=e.shift||ih,this.reduce=e.reduce||ih,this.reuse=e.reuse||ih,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},yr=class i extends rr{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let a=0;a<e.repeatNodeCount;a++)t.push("");let r=Object.keys(e.topRules).map(a=>e.topRules[a][1]),n=[];for(let a=0;a<t.length;a++)n.push([]);function s(a,l,c){n[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=D[l]);for(let c=1;c<a.length;){let h=a[c++];if(h>=0)s(h,l,a[c++]);else{let u=a[c+-h];for(let f=-h;f>0;f--)s(a[c++],l,u);c++}}}this.nodeSet=new ln(t.map((a,l)=>xe.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:n[l],top:r.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=_n(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;a<this.specializerSpecs.length;a++)this.specialized[a]=this.specializerSpecs[a].term;this.specializers=this.specializerSpecs.map(cg),this.states=_n(e.states,Uint32Array),this.data=_n(e.stateData),this.goto=_n(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new ti(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,r){let n=new hh(this,e,t,r);for(let s of this.wrappers)n=s(n,e,t,r);return n}getGoto(e,t,r=!1){let n=this.goto;if(t>=n[0])return-1;for(let s=n[t+1];;){let o=n[s++],a=o&1,l=n[s++];if(a&&r)return l;for(let c=s+(o>>1);s<c;s++)if(n[s]==e)return l;if(a)return-1}}hasAction(e,t){let r=this.data;for(let n=0;n<2;n++)for(let s=this.stateSlot(e,n?2:1),o;;s+=3){if((o=r[s])==65535)if(r[s+1]==1)o=r[s=Mt(r,s+2)];else{if(r[s+1]==2)return Mt(r,s+2);break}if(o==t||o==0)return Mt(r,s+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,r=>r==t?!0:null)}allActions(e,t){let r=this.stateSlot(e,4),n=r?t(r):void 0;for(let s=this.stateSlot(e,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Mt(this.data,s+2);else break;n=t(Mt(this.data,s+1))}return n}nextStates(e){let t=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Mt(this.data,r+2);else break;if((this.data[r+2]&1)==0){let n=this.data[r+1];t.some((s,o)=>o&1&&s==n)||t.push(this.data[r],n)}}return t}configure(e){let t=Object.assign(Object.create(i.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=r}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(r=>{let n=e.tokenizers.find(s=>s.from==r);return n?n.to:r})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=e.specializers.find(a=>a.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return t.specializers[n]=cg(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),r=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;s<t.length;s++)if(!r[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(n||(n=new Uint8Array(this.maxTerm+1)))[a]=1;return new uh(e,r,n)}static deserialize(e){return new i(e)}};function Mt(i,e){return i[e]|i[e+1]<<16}function x1(i){let e=null;for(let t of i){let r=t.p.stoppedAt;(t.pos==t.p.stream.end||r!=null&&t.pos>r)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function cg(i){if(i.external){let e=i.extend?1:0;return(t,r)=>i.external(t,r)<<1|e}return i.get}var S1=sr({"repeat while for if else return break next in":b.controlKeyword,"Logical!":b.bool,function:b.definitionKeyword,"FunctionCall/Identifier FunctionCall/String":b.function(b.variableName),"NamedArg!":b.function(b.attributeName),Comment:b.lineComment,"Numeric Integer Complex Inf":b.number,"SpecialConstant!":b.literal,String:b.string,"ArithOp MatrixOp":b.arithmeticOperator,BitOp:b.bitwiseOperator,CompareOp:b.compareOperator,"ExtractionOp NamespaceOp":b.operator,AssignmentOperator:b.definitionOperator,"...":b.punctuation,"( )":b.paren,"[ ]":b.squareBracket,"{ }":b.brace,$:b.derefOperator,", ;":b.separator}),k1={__proto__:null,TRUE:12,T:14,FALSE:18,F:20,NULL:30,NA:34,Inf:38,NaN:42,function:46,"...":50,return:60,break:64,next:68,if:80,else:82,repeat:86,while:90,for:94,in:96},Mo=yr.deserialize({version:14,states:"7dOYQPOOOOQO'#Dx'#DxOOQO'#Dw'#DwO$aQPO'#DwOOQO'#Dy'#DyO(]QPO'#DvOOQO'#Dv'#DvOOQO'#Cx'#CxO*UQPO'#CwO,YQPO'#DmO/rQPO'#DaO1kQPO'#D`OOQO'#Dz'#DzOOQO'#Du'#DuQYQPOOOOQO'#Ca'#CaOOQO'#Cd'#CdOOQO'#Cj'#CjOOQO'#Cl'#ClOOQO'#Cn'#CnOOQO'#Cp'#CpO1|QPO'#CrO2RQPO'#DTO!bQPO'#DWO2WQPO'#DYO2]QPO'#D[O3oQPO'#DROOQO,59l,59lO3yQPO'#DoOOQO'#Do'#DoO*UQPO,59cOOQO'#DP'#DPOOQO,59c,59cO5fQPO'#CyO5kQPO'#C{O7XQPO'#C}O8uQPO,59yO:ZQQO,59yOOQO'#Dd'#DdOOQO'#De'#DeOOQO'#Df'#DfOOQO'#Dg'#DgOOQO'#Dh'#DhOOQO'#Di'#DiOOQO'#Dj'#DjOOQO'#Dk'#DkOOQO'#Dl'#DlOYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OYQPO,59}OOQO'#Db'#DbOYQPO,59zOOQO-E7k-E7kO:bQPO'#CtO!bQPO,59^OYQPO,59oOOQO,59r,59rOYQPO,59tOYQPO,59vO:mQPO'#DwO:tQPO'#DvO:{QPO'#ESO;VQPO'#ESO;aQPO,59mO;fQPO'#ESOOQO-E7m-E7mOOQO1G.}1G.}O;nQPO,59eO;uQPO,59gO;zQPO,59iO<PQPO'#EUO<ZQPO1G/eO<`QQO'#D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return BreakStatement break NextStatement next BlockCloseBrace FunctionCall ArgList NamedArg IfStatement if else RepeatStatement repeat WhileStatement while ForStatement for in IndexStatement VariableAssignment Assignable AssignmentOperator BinaryStatement NamespaceOp ExtractionOp ArithOp ArithOp ArithOp CompareOp MatrixOp LogicOp LogicOp",maxTerm:116,nodeProps:[["group",-11,3,22,27,36,39,42,44,46,49,50,53,"Expression",-4,4,11,12,13,"Constant Expression",-2,5,8,"Constant Expression Logical",-4,14,16,18,20,"Expression SpecialConstant"]],propSources:[S1],skippedNodes:[0,1],repeatNodeCount:5,tokenData:"6[~RzX^#upq#uqr$jrs$ust%itu%tuv%yvw'twx(Rxy(pyz(uz{(z{|)P|})U}!O)Z!O!P)p!P!Q.b!Q!R.g!R![0^![!]2x!^!_3]!_!`4O!`!a4]!b!c4h!c!}*|!}#O4m#P#Q4z#Q#R5X#R#S*|#S#T5^#T#o*|#o#p5s#p#q5x#q#r6V#y#z#u$f$g#u#BY#BZ#u$IS$I_#u$I|$JO#u$JT$JU#u$KV$KW#u&FU&FV#u~#zY!h~X^#upq#u#y#z#u$f$g#u#BY#BZ#u$IS$I_#u$I|$JO#u$JT$JU#u$KV$KW#u&FU&FV#u~$mP!_!`$p~$uO#]~~$zU[~OY$uZr$urs%^s#O$u#O#P%c#P~$u~%cO[~~%fPO~$u~%nQP~OY%iZ~%i~%yO#S~~%|Uuv&`z{&e!P!Q&p#]#^&{#c#d'^#l#m'i~&eO#X~~&hPuv&k~&pO#b~~&sPuv&v~&{O#a~~'OP#b#c'R~'UPuv'X~'^O#`~~'aPuv'd~'iO#c~~'lPuv'o~'tO#d~~'yP#g~vw'|~(RO#h~~(WU[~OY(RZw(Rwx%^x#O(R#O#P(j#P~(R~(mPO~(R~(uO!p~~(zO!o~~)PO#V~~)UO#Y~~)ZO!s~~)`P#Z~!`!a)c~)hP!}~!`!a)k~)pO#P~~)uTR~!O!P*U!Q![+b!c!}*|#R#S*|#T#o*|~*ZZR~O!O*|!O!P*|!P!Q*|!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195,P1=196,ug=197,C1=198,E1=199,R1=200,A1=2,Og=3,fg=201,Q1=24,M1=25,_1=49,D1=50,L1=55,q1=56,V1=57,$1=59,B1=60,X1=61,N1=62,j1=63,I1=65,W1=238,z1=71,U1=241,F1=242,H1=243,G1=244,Y1=245,Z1=246,J1=247,K1=248,yg=72,eS=249,tS=250,iS=251,rS=252,nS=253,sS=254,oS=255,aS=256,lS=73,cS=77,hS=263,uS=112,fS=130,dS=151,pS=152,mS=155,_i=10,Dn=13,mh=32,Lo=9,gh=35,gS=40,OS=46,ph=123,dg=125,bg=39,wg=34,yS=92,bS=111,wS=120,vS=78,xS=117,SS=85,kS=new Set([M1,_1,D1,hS,I1,fS,q1,V1,W1,N1,j1,yg,lS,cS,B1,X1,dS,pS,mS,uS]);function fh(i){return i==_i||i==Dn}function dh(i){return i>=48&&i<=57||i>=65&&i<=70||i>=97&&i<=102}var TS=new Mi((i,e)=>{let t;if(i.next<0)i.acceptToken(E1);else if(e.context.flags&_o)fh(i.next)&&i.acceptToken(C1,1);else if(((t=i.peek(-1))<0||fh(t))&&e.canShift(ug)){let r=0;for(;i.next==mh||i.next==Lo;)i.advance(),r++;(i.next==_i||i.next==Dn||i.next==gh)&&i.acceptToken(ug,-r)}else fh(i.next)&&i.acceptToken(P1,1)},{contextual:!0}),PS=new Mi((i,e)=>{let t=e.context;if(t.flags)return;let r=i.peek(-1);if(r==_i||r==Dn){let n=0,s=0;for(;;){if(i.next==mh)n++;else if(i.next==Lo)n+=8-n%8;else break;i.advance(),s++}n!=t.indent&&i.next!=_i&&i.next!=Dn&&i.next!=gh&&(n<t.indent?i.acceptToken(gg,-s):i.acceptToken(mg))}}),_o=1,vg=2,_t=4,Dt=8,Lt=16,qt=32;function Do(i,e,t){this.parent=i,this.indent=e,this.flags=t,this.hash=(i?i.hash+i.hash<<8:0)+e+(e<<4)+t+(t<<6)}var CS=new Do(null,0,0);function ES(i){let e=0;for(let t=0;t<i.length;t++)e+=i.charCodeAt(t)==Lo?8-e%8:1;return e}var pg=new Map([[U1,0],[F1,_t],[H1,Dt],[G1,Dt|_t],[Y1,Lt],[Z1,Lt|_t],[J1,Lt|Dt],[K1,Lt|Dt|_t],[eS,qt],[tS,qt|_t],[iS,qt|Dt],[rS,qt|Dt|_t],[nS,qt|Lt],[sS,qt|Lt|_t],[oS,qt|Lt|Dt],[aS,qt|Lt|Dt|_t]].map(([i,e])=>[i,e|vg])),RS=new Qo({start:CS,reduce(i,e,t,r){return i.flags&_o&&kS.has(e)||(e==z1||e==yg)&&i.flags&vg?i.parent:i},shift(i,e,t,r){return e==mg?new Do(i,ES(r.read(r.pos,t.pos)),0):e==gg?i.parent:e==Q1||e==L1||e==$1||e==Og?new Do(i,0,_o):pg.has(e)?new Do(i,0,pg.get(e)|i.flags&_o):i},hash(i){return i.hash}}),AS=new Mi(i=>{for(let e=0;e<5;e++){if(i.next!="print".charCodeAt(e))return;i.advance()}if(!/\w/.test(String.fromCharCode(i.next)))for(let e=0;;e++){let t=i.peek(e);if(!(t==mh||t==Lo)){t!=gS&&t!=OS&&t!=_i&&t!=Dn&&t!=gh&&i.acceptToken(T1);return}}}),QS=new Mi((i,e)=>{let{flags:t}=e.context,r=t&_t?wg:bg,n=(t&Dt)>0,s=!(t&Lt),o=(t&qt)>0,a=i.pos;for(;!(i.next<0);)if(o&&i.next==ph)if(i.peek(1)==ph)i.advance(2);else{if(i.pos==a){i.acceptToken(Og,1);return}break}else if(s&&i.next==yS){if(i.pos==a){i.advance();let l=i.next;l>=0&&(i.advance(),MS(i,l)),i.acceptToken(A1);return}break}else if(i.next==r&&(!n||i.peek(1)==r&&i.peek(2)==r)){if(i.pos==a){i.acceptToken(fg,n?3:1);return}break}else if(i.next==_i){if(n)i.advance();else if(i.pos==a){i.acceptToken(fg);return}break}else i.advance();i.pos>a&&i.acceptToken(R1)});function MS(i,e){if(e==bS)for(let t=0;t<2&&i.next>=48&&i.next<=55;t++)i.advance();else if(e==wS)for(let t=0;t<2&&dh(i.next);t++)i.advance();else if(e==xS)for(let t=0;t<4&&dh(i.next);t++)i.advance();else if(e==SS)for(let t=0;t<8&&dh(i.next);t++)i.advance();else if(e==vS&&i.next==ph){for(i.advance();i.next>=0&&i.next!=dg&&i.next!=bg&&i.next!=wg&&i.next!=_i;)i.advance();i.next==dg&&i.advance()}}var _S=sr({'async "*" "**" FormatConversion FormatSpec':b.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":b.controlKeyword,"in not and or is del":b.operatorKeyword,"from def class global nonlocal lambda":b.definitionKeyword,import:b.moduleKeyword,"with as print":b.keyword,Boolean:b.bool,None:b.null,VariableName:b.variableName,"CallExpression/VariableName":b.function(b.variableName),"FunctionDefinition/VariableName":b.function(b.definition(b.variableName)),"ClassDefinition/VariableName":b.definition(b.className),PropertyName:b.propertyName,"CallExpression/MemberExpression/PropertyName":b.function(b.propertyName),Comment:b.lineComment,Number:b.number,String:b.string,FormatString:b.special(b.string),Escape:b.escape,UpdateOp:b.updateOperator,"ArithOp!":b.arithmeticOperator,BitOp:b.bitwiseOperator,CompareOp:b.compareOperator,AssignOp:b.definitionOperator,Ellipsis:b.punctuation,At:b.meta,"( )":b.paren,"[ ]":b.squareBracket,"{ }":b.brace,".":b.derefOperator,", ;":b.separator}),DS={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},qo=yr.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#Gt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S%^%`%g%l%n%w&Z&j&k&u&x'P'W'Z'l'm'p'r's(O(W(^(d(g(z)^)e)g)p)z*O*Y*d*g*h*k*q*t*v*y*z*}+U+V+Y+a+d+k,X,Y,],g,h,i,k,l,o,s,u,w,y,z-O-d-f-m-p.f.g/Z0i0j0kQ#qpW%W!o!s0d0nQ%X!pQ%Y!qQ%[!tQ%f0cS'v%Z0hQ'x0eQ'y0fQ,p*rQ-u,qS.i-s/sR0p0rU#uq.k0qR(w&][cOn#g$j)t,PZ!xY#[#}$Q+YQ#W[Q#zrR$TxQ%b!yQ%i!}Q%o#RQ'j${Q(V%eQ(Z%jQ(c%pQ(f%qQ*|(`Q,f*bQ-t,pQ.m-uR/].lQ$StQ(R%cR*s(SQ.l-sR/}/sR#QZR#V[R%Q!iQ%O!iV*c'm*d,g!]!lQ!n#c#p$R$d$p$u$v$w$x$y$z%e%j%p%q&`'O'g(q(|)j*o*x+w,v/q0gR%T!kT#]^#_Q%x#[R,{+YQ(m%xS+_(n(oQ,}+`Q-x,{S.n-y-zR/^.oT+Z(k+]Q$`}Q&g$QQ)o'PR+{)pQ$XzQ)W&qR+i)XQ$XzQ&o$WQ)W&qR+i)XQ#khW$Vz$W&q)XQ$[{Q&r$ZZ)R&l)S+f+g-RR$^|R)c&wXlOn)t,PQ$f!RR'Q$gQ$m!UR'R$hR*X'_Q*V'_V-g,`-h.TQ.d-lQ/P.^R/Q._U.]-l.^._Q/U.aQ/b.tQ/g.zU/i.|/j/yQ/n/RQ/|/oQ0O/tU0Q/u0S0[Q0]0UQ0a0ZR0b0^R/T.`R/d.t",nodeNames:"\u26A0 print Escape { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:277,context:RS,nodeProps:[["isolate",-5,4,71,72,73,77,""],["group",-15,6,85,87,88,90,92,94,96,98,99,100,102,105,108,110,"Statement Statement",-22,8,18,21,25,40,49,50,56,57,60,61,62,63,64,67,70,71,72,79,80,81,82,"Expression",-10,114,116,119,121,122,126,128,133,135,138,"Statement",-9,143,144,147,148,150,151,152,153,154,"Pattern"],["openedBy",23,"(",54,"[",58,"{"],["closedBy",24,")",55,"]",59,"}"]],propSources:[_S],skippedNodes:[0,4],repeatNodeCount:34,tokenData:"!2|~R!`OX%TXY%oY[%T[]%o]p%Tpq%oqr'ars)Yst*xtu%Tuv,dvw-hwx.Uxy/tyz0[z{0r{|2S|}2p}!O3W!O!P4_!P!Q:Z!Q!R;k!R![>_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%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!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[AS,PS,TS,QS,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:i=>DS[i]||-1}],tokenPrec:7652});var Ln=fn([{tag:b.keyword,class:"tok-keyword"},{tag:b.operator,class:"tok-operator"},{tag:b.definitionOperator,class:"tok-definitionOperator"},{tag:b.compareOperator,class:"tok-compareOperator"},{tag:b.attributeName,class:"tok-attributeName"},{tag:b.controlKeyword,class:"tok-controlKeyword"},{tag:b.comment,class:"tok-comment"},{tag:b.string,class:"tok-string"},{tag:b.regexp,class:"tok-string2"},{tag:b.variableName,class:"tok-variableName"},{tag:b.bool,class:"tok-bool"},{tag:b.separator,class:"tok-separator"},{tag:b.literal,class:"tok-literal"},{tag:[b.number,b.integer],class:"tok-number"},{tag:b.function(b.variableName),class:"tok-function-variableName"},{tag:b.function(b.attributeName),class:"tok-function-attributeName"}]);function br(i){let e=document.createElement("code");e.className="sourceCode r";function t(n,s){let o=document.createTextNode(n);if(s){let a=document.createElement("span");a.appendChild(o),a.className=s,o=a}e.appendChild(o)}function r(){e.appendChild(document.createTextNode(`
`))}return ic(i,Mo.parse(i),Ln,t,r),e}function wr(i){let e=document.createElement("code");e.className="sourceCode python";function t(n,s){let o=document.createTextNode(n);if(s){let a=document.createElement("span");a.appendChild(o),a.className=s,o=a}e.appendChild(o)}function r(){e.appendChild(document.createTextNode(`
`))}return ic(i,qo.parse(i),Ln,t,r),e}function Oh(i,e,t,r){if(typeof t=="number"&&(t=t.toLocaleString()),i.textContent.includes(e)){let n=!1;for(let s of i.children)n||=Oh(s,e,t,r);if(!n)switch(i.textContent=i.textContent.replaceAll(e,()=>t),r){case"none":break;case"r":i.innerHTML=br(i.textContent).innerHTML;break;case"python":i.innerHTML=wr(i.textContent).innerHTML;break;default:throw new Error(`Can't highlight interpolation, unknown language \`${r}\`.`)}return!0}return!1}var xg=new zs,Pg=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Vo(i){return(e,t,r)=>{if(r)return!1;let n=e.node.getChild("VariableName");return n&&t(n,i),!0}}var LS={FunctionDefinition:Vo("function"),ClassDefinition:Vo("class"),ForStatement(i,e,t){if(t){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(i,e){var t,r;let{node:n}=i,s=((t=n.firstChild)===null||t===void 0?void 0:t.name)=="from";for(let o=n.getChild("import");o;o=o.nextSibling)o.name=="VariableName"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(o,s?"variable":"namespace")},AssignStatement(i,e){for(let t=i.node.firstChild;t;t=t.nextSibling)if(t.name=="VariableName")e(t,"variable");else if(t.name==":"||t.name=="AssignOp")break},ParamList(i,e){for(let t=null,r=i.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!t||!/\*|AssignOp/.test(t.name))&&e(r,"variable"),t=r},CapturePattern:Vo("variable"),AsPattern:Vo("variable"),__proto__:null};function Cg(i,e){let t=xg.get(e);if(t)return t;let r=[],n=!0;function s(o,a){let l=i.sliceString(o.from,o.to);r.push({label:l,type:a})}return e.cursor(ie.IncludeAnonymous).iterate(o=>{if(o.name){let a=LS[o.name];if(a&&a(o,s,n)||!n&&Pg.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let a of Cg(i,o.node))r.push(a);return!1}}),xg.set(e,r),r}var Sg=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Eg=["String","FormatString","Comment","PropertyName"];function qS(i){let e=se(i.state).resolveInner(i.pos,-1);if(Eg.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Sg.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let r=[];for(let n=e;n;n=n.parent)Pg.has(n.name)&&(r=r.concat(Cg(i.state.doc,n)));return{options:r,from:t?e.from:i.pos,validFor:Sg}}var VS=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(i=>({label:i,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(i=>({label:i,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(i=>({label:i,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(i=>({label:i,type:"function"}))),$S=[St("def ${name}(${params}):\n	${}",{label:"def",detail:"function",type:"keyword"}),St("for ${name} in ${collection}:\n	${}",{label:"for",detail:"loop",type:"keyword"}),St("while ${}:\n	${}",{label:"while",detail:"loop",type:"keyword"}),St("try:\n	${}\nexcept ${error}:\n	${}",{label:"try",detail:"/ except block",type:"keyword"}),St(`if \${}:
	
`,{label:"if",detail:"block",type:"keyword"}),St("if ${}:\n	${}\nelse:\n	${}",{label:"if",detail:"/ else block",type:"keyword"}),St("class ${name}:\n	def __init__(self, ${params}):\n			${}",{label:"class",detail:"definition",type:"keyword"}),St("import ${module}",{label:"import",detail:"statement",type:"keyword"}),St("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],BS=Xm(Eg,Uc(VS.concat($S)));function kg(i){let{node:e,pos:t}=i,r=i.lineIndent(t,-1),n=null;for(;;){let s=e.childBefore(t);if(s)if(s.name=="Comment")t=s.from;else if(s.name=="Body")i.baseIndentFor(s)+i.unit<=r&&(n=s),e=s;else if(s.type.is("Statement"))e=s;else break;else break}return n}function Tg(i,e){let t=i.baseIndentFor(e),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&i.node.to<n+100&&!/\S/.test(i.state.sliceDoc(n,i.node.to))&&i.lineIndent(i.pos,-1)<=t||/^\s*(else:|elif |except |finally:)/.test(i.textAfter)&&i.lineIndent(i.pos,-1)>t?null:t+i.unit}var yh=ar.define({name:"python",parser:qo.configure({props:[On.add({Body:i=>{var e;let t=kg(i);return(e=Tg(i,t||i.node))!==null&&e!==void 0?e:i.continue()},IfStatement:i=>/^\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),"ForStatement WhileStatement":i=>/^\s*else:/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Ei({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Ei({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Ei({closing:"]"}),"String FormatString":()=>null,Script:i=>{var e;let t=kg(i);return(e=t&&Tg(i,t))!==null&&e!==void 0?e:i.continue()}}),yn.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":eo,Body:(i,e)=>({from:i.from+1,to:i.to-(i.to==e.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/}});function Rg(){return new lr(yh,[yh.data.of({autocomplete:qS}),yh.data.of({autocomplete:BS})])}var XS=ar.define({parser:Mo.configure({props:[On.add({Block:Ei({closing:"}"}),"ParamList ArgList":Ei({closing:")"})}),yn.add({Block:eo})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"']},commentTokens:{line:"#"}}});function Ag(){return new lr(XS)}var zS={"arrow-repeat":Qg(),"exclamation-circle":Mg(),lightbulb:_g(),play:Dg()};function US(){let i=document.querySelectorAll(".tab-content > .tab-pane");Array.from(i).forEach(t=>{t.innerHTML.trim()==""&&(t.classList.add("d-none"),document.querySelector(`.nav-item > a[data-bs-target="#${t.id}"]`)?.parentElement?.classList.add("d-none"))});let e=document.querySelectorAll(".tab-content");Array.from(e).forEach(t=>{if(Array.from(t.children).reduce((n,s)=>s.classList.contains("d-none")?n:n+1,0)==1){let n=t.querySelector(".tab-pane:not(.d-none)"),s=t.parentElement;s.appendChild(n),s.querySelector(".nav.nav-tabs").remove(),t.remove()}})}var $o=class{constructor(e,t){if(typeof e!="string")throw new Error("Can't create editor, `code` must be a string.");this.container=document.createElement("div"),this.initialCode=e,this.options=Object.assign({autorun:!1,canvas:!0,completion:!0,runbutton:!0,startover:!0,persist:!1},t),this.storageKey=`editor-${window.location.href}#${this.options.id}`;let r=[ng,this.languageExtensions(),E.updateListener.of(a=>this.onViewUpdate(a))];if(this.options.persist){let a=window.localStorage.getItem(this.storageKey);a&&(e=a)}this.state=j.create({doc:e,extensions:r}),this.view=new E({state:this.state});let n=this.render(),s=String(t["min-lines"]||0),o=String(t["max-lines"])||"infinity";n.style.setProperty("--exercise-min-lines",s),n.style.setProperty("--exercise-max-lines",o),this.container.oninput=a=>this.onInput(a),this.container.appendChild(n),this.container.value={code:this.options.autorun?e:null,options:this.options},this.container.value.indicator=this.indicator=new Ge({runningCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-eval-indicator")).forEach(a=>a.classList.remove("d-none"))},finishedCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-eval-indicator")).forEach(a=>a.classList.add("d-none"))},busyCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-btn-run-code")).forEach(a=>a.classList.add("disabled"))},idleCallback:()=>{Array.from(this.container.getElementsByClassName("exercise-editor-btn-run-code")).forEach(a=>a.classList.remove("disabled"))}})}onInput(e){if(this.options.runbutton&&!e.detail.commit){e.preventDefault(),e.stopImmediatePropagation();return}this.container.value.code=this.view.state.doc.toString(),"code"in e.detail&&(this.container.value.code=e.detail.code),this.options.persist&&window.localStorage.setItem(this.storageKey,this.container.value.code)}onViewUpdate(e){e.docChanged&&this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!1}}))}renderButton(e){let t=document.createElement("a"),r=document.createElement("span");return t.className=`d-flex align-items-center gap-1 btn btn-exercise-editor ${e.className} text-nowrap`,t.setAttribute("role","button"),t.setAttribute("tabindex","0"),t.setAttribute("aria-label",e.text),r.className="btn-label-exercise-editor",r.innerText=e.text,t.innerHTML=zS[e.icon],t.appendChild(r),t.onclick=e.onclick||null,t.onkeydown=e.onclick||null,t}renderButtonGroup(e){let t=document.createElement("div");return t.className="btn-group btn-group-exercise-editor btn-group-sm",e.forEach(r=>t.appendChild(r)),t}renderSpinner(){let e=document.createElement("div");return e.className="exercise-editor-eval-indicator spinner-grow spinner-grow-sm",e.setAttribute("role","status"),e}renderHintButton(e,t){return Array.from(e).reduceRight((r,n,s,o)=>this.renderButton({text:s===0?"Show Hint":"Next Hint",icon:"lightbulb",className:"btn-outline-dark btn-sm",onclick:function(){s>0&&o[s-1].classList.add("d-none"),n.classList.remove("d-none"),r?this.replaceWith(r):this.remove()}}),t)}renderSolutionButton(e,t){return this.renderButton({text:"Show Solution",icon:"exclamation-circle",className:"btn-exercise-solution btn-outline-dark btn-sm",onclick:function(){t&&t.forEach(r=>r.classList.add("d-none")),Array.from(e).forEach(r=>{r.classList.remove("d-none")}),this.remove()}})}renderHintsTabset(e,t){let r=new Set;e.forEach(s=>{let o=s.parentElement;o.id.includes("tabset-")&&r.add(o)});let n=new Set;return t.forEach(s=>{let o=s.parentElement;o.id.includes("tabset-")&&n.add(o)}),r.forEach(s=>{let o=document.createElement("div");o.className="d-flex justify-content-between exercise-tab-pane-header";let a=s.querySelectorAll(`.exercise-hint[data-exercise="${this.options.exercise}"]`);o.appendChild(this.renderHintButton(a,null)),s.prepend(o)}),n.forEach(s=>{let o=document.createElement("div");o.className="d-flex justify-content-between exercise-tab-pane-header";let a=s.querySelectorAll(`.exercise-solution[data-exercise="${this.options.exercise}"]`);o.appendChild(this.renderSolutionButton(a,null)),s.prepend(o)}),null}renderHints(){let e=document.querySelectorAll(`.d-none.exercise-hint[data-exercise="${this.options.exercise}"]`),t=document.querySelectorAll(`.d-none.exercise-solution[data-exercise="${this.options.exercise}"]`),r=Array.from(e).some(s=>s.parentElement.id.includes("tabset-"))||Array.from(t).some(s=>s.parentElement.id.includes("tabset-")),n=null;if(r)this.renderHintsTabset(e,t);else{let s;t.length>0&&(s=this.renderSolutionButton(t,e)),n=this.renderHintButton(e,s)}return US(),n}render(){let e=document.createElement("div"),t=document.createElement("div"),r=document.createElement("div");e.className="card exercise-editor my-3",t.className="card-header exercise-editor-header d-flex justify-content-between",r.className="card-body exercise-editor-body p-0";let n=document.createElement("div");n.className="d-flex align-items-center gap-3";let s=document.createElement("div");s.innerHTML="caption"in this.options?this.options.caption:this.defaultCaption,n.appendChild(s);let o=[];this.options.startover&&o.push(this.renderButton({text:"Start Over",icon:"arrow-repeat",className:"btn-outline-dark",onclick:()=>{if(this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:this.initialCode}}),this.options.runbutton){let h=this.options.autorun?this.initialCode:null;this.container.dispatchEvent(new CustomEvent("input",{detail:{code:h,commit:!0}}))}}}));let a=this.renderHints();a&&o.push(a),o.length>0&&n.appendChild(this.renderButtonGroup(o)),t.appendChild(n);let l=document.createElement("div");l.className="d-flex align-items-center gap-3";let c=[];return this.options.runbutton&&c.push(this.renderButton({text:"Run Code",icon:"play",className:"btn-primary disabled exercise-editor-btn-run-code",onclick:()=>{this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!0}}))}})),l.appendChild(this.renderSpinner()),c.length>0&&l.appendChild(this.renderButtonGroup(c)),t.appendChild(l),e.appendChild(t),r.appendChild(this.view.dom),e.appendChild(r),e}},Bo=class extends $o{constructor(e,t,r){super(t,r),this.webRPromise=e,this.completionMethods=this.setupCompletion()}languageExtensions(){let e=new Ct,t=new Ct;return[wn(Ln),An({override:[(...r)=>this.doCompletion(...r)]}),e.of(Ag()),t.of(j.tabSize.of(2)),Ce.high(Qt.of([{key:"Mod-Enter",run:()=>(this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!0}})),!0)},{key:"Mod-Shift-m",run:()=>(this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:this.view.state.doc.toString().trimEnd()+" |> "}}),!0)}]))]}render(){return this.defaultCaption="R Code",super.render()}async setupCompletion(){let e=await this.webRPromise;return await e.evalRVoid("rc.settings(func=TRUE, fuzzy=TRUE)"),{assignLineBuffer:await e.evalR("utils:::.assignLinebuffer"),assignToken:await e.evalR("utils:::.assignToken"),assignStart:await e.evalR("utils:::.assignStart"),assignEnd:await e.evalR("utils:::.assignEnd"),completeToken:await e.evalR("utils:::.completeToken"),retrieveCompletions:await e.evalR("utils:::.retrieveCompletions")}}async doCompletion(e){if(!this.options.completion)return null;let t=await this.completionMethods,r=e.state.doc.lineAt(e.state.selection.main.head).text,{from:n,to:s,text:o}=e.matchBefore(/[a-zA-Z0-9_.:]*/)??{from:0,to:0,text:""};if(n===s&&!e.explicit)return null;await t.assignLineBuffer(r.replace(/\)+$/,"")),await t.assignToken(o),await t.assignStart(n+1),await t.assignEnd(s+1),await t.completeToken();let l=(await t.retrieveCompletions()).values.map(c=>{if(!c)throw new Error("Missing values in completion result.");return{label:c,boost:c.endsWith("=")?10:0}});return{from:n,options:l}}},Xo=class extends $o{constructor(e,t,r){super(t,r),this.pyodidePromise=e}render(){return this.defaultCaption="Python Code",super.render()}languageExtensions(){let e=new Ct,t=new Ct,r=[wn(Ln),e.of(Rg()),t.of(j.tabSize.of(2)),Ce.high(Qt.of([{key:"Mod-Enter",run:()=>(this.container.dispatchEvent(new CustomEvent("input",{detail:{commit:!0}})),!0)}]))];return this.options.completion||r.push(An({override:[(...n)=>null]})),r}};function vr(i){for(var e="",t=new Uint8Array(i),r=t.byteLength,n=0;n<r;n++)e+=String.fromCharCode(t[n]);return window.btoa(e)}function Lg(i){return btoa(encodeURIComponent(i).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))))}function ii(i){return decodeURIComponent(atob(i).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))}function bh(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}function qn(i,e,t,...r){return i==null||bh(i)||i instanceof ArrayBuffer||ArrayBuffer.isView(i)?i:e(i)?t(i,...r):Array.isArray(i)?i.map(n=>qn(n,e,t,...r)):typeof i=="object"?Object.fromEntries(Object.entries(i).map(([n,s])=>[n,qn(s,e,t,...r)])):i}function No(i){for(let e of i.getElementsByTagName("script"))if(!e.type||e.type=="text/javascript"||e.type=="module"){let t=document.createElement("script");e.async&&(t.async=e.async),e.crossOrigin&&(t.crossOrigin=e.crossOrigin),e.defer&&(t.defer=e.async),e.integrity&&(t.integrity=e.integrity),e.src&&(t.src=e.src),e.text&&(t.text=e.text),e.type&&(t.type=e.type),e.parentNode.replaceChild(t,e)}}function wh(i){return new Promise(function(e,t){var r=document.createElement("script");r.onload=()=>e(i),r.onerror=()=>t(`Can't load script: "${i}".`),r.async=!0,r.src=i,document.getElementsByTagName("head")[0].appendChild(r)})}function qg(i){let e=i.replace(/\/+/g,"/").split("/"),t=[];for(let r of e)r==="."||r===""||(r===".."?t.pop():t.push(r));return t.join("/")}var Vg=[];async function Vn(i){let e=await i.toJs({depth:-1}),t=await Promise.all(e.names.map(async(r,n)=>[r,await e.values[n].toString()]));return Object.fromEntries(t)}async function vh(i,e){let t=await i.toJs({depth:-1});return await Promise.all(t.values.map(async r=>({[e]:await r.toString()})))}async function xh(i){let e=await i.toJs({depth:-1});return await Promise.all(e.values.map(t=>Vn(t)))}async function FS(i){if(!(await(await i.class()).toArray()).includes("html_dependency"))throw new Error("Can't interpret R object of class `${classes}` as HTML dependency.");let t=await i.get("attachment"),r=await i.get("head"),n=await i.get("meta"),s=await(await i.get("name")).toString(),o=await i.get("package"),a=await i.get("restyle"),l=await i.get("script"),c=await i.get("src"),h=await i.get("stylesheet"),u=await(await i.get("version")).toString(),f={attachment:[],head:ke(r)?void 0:await r.toString(),meta:[],name:s,pkg:ke(o)?void 0:await o.toString(),restyle:ke(a)?void 0:await a.toBoolean(),script:[],src:{},stylesheet:[],version:u};if(Ni(c)?f.src={file:await c.toString()}:it(c)&&(f.src=await Vn(c)),!ke(n)){let d=await n.toObject();f.meta=await Promise.all(Object.entries(d).map(async([m,p])=>({name:m,content:await p.toString()})))}if(Ni(h))f.stylesheet=(await h.toArray()).map(d=>({href:d}));else if(it(h)){let d=await h.toJs({depth:-1});d.names?d.names.includes("href")?f.stylesheet=[await Vn(h)]:f.stylesheet=await xh(h):f.stylesheet=await vh(h,"href")}if(Ni(l))f.script=(await l.toArray()).map(d=>({src:d}));else if(it(l)){let d=await l.toJs({depth:-1});d.names?d.names.includes("src")?f.script=[await Vn(l)]:f.script=await xh(l):f.script=await vh(l,"src")}if(Ni(t))f.attachment=(await t.toArray()).map((d,m)=>({key:(m+1).toString(),href:d}));else if(it(t)){let d=await t.toJs({depth:-1});d.names?d.names.includes("href")?(f.attachment=[await Vn(t)],f.attachment[0].key="1"):(f.attachment=await xh(t),f.attachment.forEach((m,p)=>{m.key=(p+1).toString()})):(f.attachment=await vh(t,"href"),f.attachment.forEach((m,p)=>{m.key=(p+1).toString()}))}return f}async function Sh(i,e){let t=await FS(e),r=t.pkg?await i.evalRString(`find.package("${t.pkg}")`):"";if(t.name in Vg)return!1;if(Vg[t.name]=t.version,t.head){let n=document.createElement("div");n.innerHTML=t.head,n.childNodes.forEach(s=>document.head.appendChild(s))}if(t.meta&&t.meta.forEach(async n=>{let s=document.createElement("meta");Object.entries(n).map(([o,a])=>{s.setAttribute(o,a||"")}),document.head.appendChild(s)}),t.stylesheet&&t.stylesheet.forEach(async n=>{let s=document.createElement("link");if(t.src.file){let o=await i.FS.readFile(`${r}/${t.src.file}/${n.href}`);n.href=`data:text/css;base64,${vr(o)}`}else n.href=`${t.src.href}/${n.href}`;n.rel||(s.rel="stylesheet"),n.type||(s.type="text/css"),Object.entries(n).map(([o,a])=>{s.setAttribute(o,a||"")}),document.head.appendChild(s)}),t.script){let n=t.script.map(async s=>{let o=document.createElement("script");if(t.src.file){let l=await i.FS.readFile(`${r}/${t.src.file}/${s.src}`);s.src=`data:text/javascript;base64,${vr(l)}`}else s.src=`${t.src.href}/${s.src}`;o.async=!1,Object.entries(s).map(([l,c])=>{l==="async"&&(o.async=c==="true"),o.setAttribute(l,c||"")});let a=new Promise((l,c)=>{o.onload=()=>l(null),o.onerror=h=>c(h)});return document.head.appendChild(o),a});await Promise.allSettled(n)}return!0}var xr=class{constructor(e,t){this.manager=e;let r=t.options;!r.exercise||r.envir==="global"?(this.labels={prep:r.envir,result:r.envir,grading:r.envir,solution:r.envir,global:"global"},this.discard=!1):(this.labels={prep:`${r.envir}-prep`,result:`${r.envir}-result`,grading:`${r.envir}-grading`,solution:`${r.envir}-solution`,global:"global"},this.discard=r.envir===`exercise-env-${r.exercise}`)}get(e="global"){return this.manager.get(this.labels[e])}bind(e,t,r="global"){return this.manager.bind(e,t,this.labels[r])}create(e,t){return this.manager.create(this.labels[e],this.labels[t],this.discard)}destroy(e){return this.manager.destroy(this.labels[e])}},Sr=class i{constructor(e){this.env={};this.shelter=new e.Shelter,this.env.global=Promise.resolve().then(()=>e.objs.globalEnv)}static#e;static instance(e){return i.#e||(i.#e=new i(e)),i.#e}async toR(e){if(!e||J(e))return e;let t=await this.shelter;if(e.constructor===Object)try{return await new t.RObject(e)}catch(r){let n=r;if(!n.message.includes("Can't construct `data.frame`"))throw n;return await new t.RList(Object.fromEntries(await Promise.all(Object.entries(e).map(async([s,o])=>[s,await this.toR(o)]))))}if(e.constructor===Array)try{return await new t.RObject(e)}catch(r){let n=r;if(!n.message.includes("Can't construct `data.frame`"))throw n;return await new t.RList(await Promise.all(e.map(s=>this.toR(s))))}return e}async get(e="global"){let t=await this.shelter;return e in this.env||(this.env[e]=t.evalR("new.env(parent = globalenv())")),await this.env[e]}async bind(e,t,r="global"){let n=await this.get(r);t=await this.toR(t),await n.bind(e,t)}async create(e,t,r=!0){if(e===t||e==="global")return this.get(e);if(e in this.env){if(!r)return this.get(e);await this.destroy(e)}let n=await this.shelter,s=await this.get(t);return this.env[e]=n.evalR("new.env(parent = parent)",{env:{parent:s}}),await this.env[e]}async destroy(e){if(e=="global"||!(e in this.env))return;let t=await this.shelter,r=await this.env[e];try{await t.destroy(r)}catch(n){let s=n;if(!s.message.includes("Can't find object in shelter."))throw s}delete this.env[e]}},kr=class i{constructor(e){this.env={};this.pyodide=e,this.env.global=Promise.resolve().then(()=>e.toPy({}))}static#e;static instance(e){return i.#e||(i.#e=new i(e)),i.#e}async get(e="global"){return e in this.env||(this.env[e]=this.pyodide.toPy({})),await this.env[e]}async bind(e,t,r="global"){let n=await this.get(r),s=await this.pyodide.toPy({environment:n,key:e,value:t});await this.pyodide.runPythonAsync("environment[key] = value",{locals:s}),s.destroy()}async create(e,t,r=!0){if(e===t||e==="global")return this.get(e);r&&e in this.env&&await this.destroy(e);let n=await this.get(e),s=await this.get(t),o=await this.pyodide.toPy({target:n,parent:s});return await this.pyodide.runPythonAsync("target.update(parent)",{locals:o}),o.destroy(),await this.env[e]}async destroy(e){if(e=="global"||!(e in this.env))return;await(await this.env[e]).destroy(),delete this.env[e]}};var fO=_h(Ah(),1),Go=class{constructor(e,t){this.container=this.newContainer(),this.nullResult={result:null,evaluate_result:null,evaluator:this},this.container.value=this.nullResult,this.webR=e,this.context=t,this.shelter=new e.Shelter,this.envManager=new xr(Sr.instance(e),t),this.context.code&&(this.context.code=this.context.code.replace(/\n\n+$/,`
`)),this.options=Object.assign({envir:"global",eval:!0,echo:!1,warning:!0,error:!0,include:!0,output:!0,timelimit:30},t.options)}newContainer(){let e=document.createElement("div");return e.classList.add("cell-output-container"),e.classList.add("cell-output-container-webr"),e}async purge(){(await this.shelter).purge()}getSetupCode(){let e=this.options.exercise,t=document.querySelectorAll(`script[type="exercise-setup-${e}-contents"]`);if(t.length>0)return t.length>1&&console.warn(`Multiple \`setup\` blocks found for exercise "${e}", using the first.`),JSON.parse(ii(t[0].textContent)).code}async process(e){if(!this.options.eval){this.container=this.asSourceHTML(this.context.code),this.container.value=this.nullResult;return}if(this.options.exercise&&this.context.code&&this.context.code.match(/_{6}_*/g)){this.container.value.result=null;return}let t=this.context.indicator;this.context.indicator||(t=new Ge),t.running();try{await Promise.all(Object.entries(e).map(async([l,c])=>{await this.envManager.bind(l,c,"prep")}));let r=this.getSetupCode();await this.evaluate(r,"prep"),await this.envManager.create("result","prep");let n=await this.evaluate(this.context.code,"result");if(!n)this.container.value.result=null;else if(this.options.output==="asis"){let l=await n.toArray(),c=await l[l.length-1].get("value");this.container.innerHTML=await c.toString()}else if(this.container=await this.asHtml(n),!this.options.output){let l=this.container.value;this.container=this.newContainer(),this.container.value=l}let s=await this.envManager.get("result"),a=await(await this.webR.objs.globalEnv.get(".webr_ojs")).toObject({depth:-1});typeof this.options.define=="string"?a[this.options.define]=await s.get(this.options.define):this.options.define&&Object.assign(a,Object.fromEntries(await Promise.all(this.options.define.map(async l=>{let c=await s.get(l);return[l,c]})))),Object.keys(a).forEach(async l=>{let c=await this.asOjs(a[l]);window._ojs.ojsConnector.mainModule._scope.has(l)?window._ojs.ojsConnector.mainModule.redefine(l,()=>c):window._ojs.ojsConnector.define(l)(c)}),await this.webR.evalRVoid("rm(list = ls(.webr_ojs), envir = .webr_ojs)")}finally{this.purge(),t.finished(),this.context.indicator||t.destroy()}}async evaluate(e,t,r=this.options){return e==null?null:(await(await this.shelter).captureR(`
        setTimeLimit(elapsed = timelimit)
        on.exit(setTimeLimit(elapsed = Inf))
        eval_result <- evaluate::evaluate(
          code,
          envir = envir,
          keep_message = warning,
          keep_warning = warning,
          stop_on_error = error,
          filename = "User code",
          output_handler = getOption("webr.evaluate.handler")
        )
        knitr:::merge_low_plot(eval_result)
      `,{env:{code:e,timelimit:Number(r.timelimit),envir:await this.envManager.get(t),warning:r.warning,error:r.error?0:1}})).result}asSourceHTML(e){let t=document.createElement("div"),r=document.createElement("pre");t.className="sourceCode",r.className="sourceCode r";let n=br(e);return r.appendChild(n),t.appendChild(r),t}async asHtml(e,t=this.options){let r=[],n=this.newContainer();n.value=this.nullResult;let s=()=>{if(t.echo&&r.length){let p=document.createElement("div"),g=document.createElement("pre");p.className="sourceCode",g.className="sourceCode r";let O=br(r.join(""));g.appendChild(O),p.appendChild(g),n.appendChild(p)}r.length=0},o=new fO.default({escapeXML:!0}),a=p=>{let g=document.createElement("div");g.className="exercise-cell-output cell-output cell-output-webr cell-output-stdout",g.innerHTML="<pre><code></code></pre>";let O=g.querySelector("code");O.textContent=p,O.innerHTML=o.toHtml(O.textContent),t.output&&(s(),n.appendChild(g))},l=p=>{let g=document.createElement("div");g.className="exercise-cell-output cell-output cell-output-webr cell-output-stderr",g.innerHTML="<pre><code></code></pre>";let O=g.querySelector("code");O.textContent=p,O.innerHTML=o.toHtml(O.textContent),t.output&&(s(),n.appendChild(g))},c=p=>{let g=document.createElement("canvas");g.width=p.width,g.height=p.height,g.className="img-fluid figure-img",g.style.width=`${2*p.width/3}px`,g.getContext("bitmaprenderer").transferFromImageBitmap(p);let O=document.createElement("div");O.className="cell-output-display cell-output-webr",O.appendChild(g),t.output&&(s(),n.appendChild(O))},h=async(p,g,O)=>{if(t.output){s();let y=await d.evalR("format(cnd, backtrace = FALSE)",{env:{cnd:p}}),x=await y.names(),v="",w="";if(x&&x.includes("message")){let P=await p.get("message"),M=await p.get("call");w=await Un(M)?` in \`${await M.deparse()}\``:": ",v=`${O}: ${await P.toString()}`}else v=await y.toString();let T=document.createElement("div");T.innerHTML=`
        <div class="callout-${g} callout callout-style-default callout-captioned">
          <div class="callout-header d-flex align-content-center">
            <div class="callout-icon-container"><i class="callout-icon"></i></div>
            <div class="callout-caption-container flex-fill">R ${O}${w}</div>
          </div>
          <div class="callout-body-container callout-body">
            <pre></pre>
          </div>
        </div>
        `,T.querySelector(".callout-body pre").appendChild(document.createTextNode(v)),n.appendChild(T)}},u=async p=>{if(t.output){let g=await p.toString(),O=await(await p.attrs()).get("knit_meta"),y=document.createElement("div");if(y.className="cell-output cell-output-webr",y.innerHTML=g,No(y),s(),n.appendChild(y),it(O)){let x=await O.toArray();for(let v=0;v<x.length;v++)await Sh(this.webR,x[v])}}},f=async(p,g)=>{if(t.output){let O=document.createElement("div"),y=document.createElement("img");O.className="cell-output-display cell-output-pyodide",y.src=`data:${p};base64, ${g}`,y.style.maxWidth="100%",O.appendChild(y),n.appendChild(O)}},d=await this.shelter,m=await e.toArray();for(let p=0;p<m.length;p++){let g=await m[p].type(),O=await(await m[p].class()).toArray();switch(g){case"character":{a(await m[p].toString());break}case"list":{if(O.includes("warning"))await h(m[p],"warning","Warning");else if(O.includes("error"))await h(m[p],"important","Error");else if(O.includes("condition")){let y=await m[p].get("message");l(await y.toString())}if(O.includes("source")){let y=await m[p].get("src");r.push(await y.toString())}if(O.includes("result")){let y=await(await m[p].get("visible")).toBoolean(),x=await m[p].get("value"),v=await(await m[p].get("class")).toArray();y&&v.includes("knit_asis")&&await u(x)}if(O.includes("recordedplot")){let y=await this.webR.evalRNumber('getOption("webr.fig.width")');"fig-width"in this.options&&(y=Number(this.options["fig-width"]));let x=await this.webR.evalRNumber('getOption("webr.fig.height")');if("fig-height"in this.options&&(x=Number(this.options["fig-height"])),typeof OffscreenCanvas<"u"&&this.options.canvas){let v=await d.captureR("replayPlot(plot)",{captureGraphics:{width:72*y,height:72*x},env:{plot:m[p]}});c(v.images[0])}else{let w=await(await d.evalR(`
                tmp_dir <- tempdir()
                filename <- paste0(tmp_dir, ".webr-plot.png")
                if (requireNamespace("ragg", quietly = TRUE)) {
                  ragg::agg_png(file = filename, width = width, height = height, units = "in", res = 300)
                } else {
                  png(file = filename, width = width, height = height, units = "in", res = 300)
                }
                replayPlot(plot)
                dev.off()
                filesize <- file.info(filename)[["size"]]
                readBin(filename, "raw", n = filesize)
              `,{env:{plot:m[p],width:y,height:x}})).toTypedArray();f("image/png",vr(w))}}break}default:throw new Error(`Unexpected list item type "${g}" in evaluation result`)}}return s(),n.value.result=await m[m.length-1].get("value"),n.value.evaluate_result=e,n}async asOjs(e){if(e instanceof ImageBitmap){let s=document.createElement("canvas");s.width=e.width,s.height=e.height;let o=s.getContext("2d");return o.drawImage(e,0,0,e.width,e.height),e.close(),s.style.width=`${2*o.canvas.width/3}px`,s}if(!J(e))return e;let n=(await(await this.shelter).captureR(`
      knitr::knit_print(value, options = list(screenshot.force = FALSE))
    `,{env:{value:e}})).result;if(Fn(n)||Un(n))return async(...s)=>{try{let o=await this.webR.evalRNumber('72 * getOption("webr.fig.width")'),a=await this.webR.evalRNumber('72 * getOption("webr.fig.height")'),l=[],c=this.options.canvas&&typeof OffscreenCanvas<"u";c||this.webR.evalRVoid(`
              while (dev.cur() > 1) dev.off()
              options(device = function() {
                png(file = "/tmp/.webr-plot.png", width = width, height = height)
              })
            `,{env:{width:o,height:a}});let h=await n.capture({withAutoprint:!0,captureGraphics:c?{width:o,height:a}:!1},...s);if(c)l=h.images;else{let u=await this.webR.evalR(`
              while (dev.cur() > 1) dev.off()
              filename <- "/tmp/.webr-plot.png"
              if (file.exists(filename)) {
                filesize <- file.info(filename)[["size"]]
                readBin(filename, "raw", n = filesize)
              } else NULL
            `);if(Oa(u)){let f=await u.toTypedArray(),d=document.createElement("img");d.src=`data:image/png;base64, ${vr(f)}`,l=[d]}}if(l.length){let u=await this.asOjs(l[l.length-1]);return u.value=await this.asOjs(h.result),u}return await this.asOjs(h.result)}finally{this.webR.globalShelter.purge()}};switch(n._payload.obj.type){case"null":return null;case"character":if((await(await n.class()).toArray()).includes("knit_asis")){let o=await n.toString(),a=await(await n.attrs()).get("knit_meta"),l=document.createElement("div");if(l.className="cell-output",l.innerHTML=o,it(a)){let c=await a.toArray();for(let h=0;h<c.length;h++)await Sh(this.webR,c[h])}return window.HTMLWidgets&&setTimeout(()=>{window.HTMLWidgets.staticRender()},250),l}case"logical":case"double":case"raw":case"integer":return await n.toArray();case"list":{let o=await(await n.attrs()).get("class");if(!ke(o)&&(await o.toArray()).includes("data.frame"))return await n.toD3()}case"environment":case"pairlist":{let s={},o=await n.toJs({depth:-1});for(let a=0;a<o.values.length;a++){let l=o.names?o.names[a]:a;s[l]=await this.asOjs(o.values[a])}return s}default:throw new Error(`Unsupported type: ${e._payload.obj.type}`)}}};var mO=_h(Ah(),1),Tr,pO=!1,Yo=class{constructor(e,t){this.container=this.newContainer(),this.nullResult={result:null,evaluate_result:null,evaluator:this},this.container.value=this.nullResult,this.container.className="cell-output-container",this.pyodide=e,this.context=t,this.envManager=new xr(kr.instance(e),t),this.options=Object.assign({envir:"global",eval:!0,echo:!1,warning:!0,error:!0,include:!0,output:!0,timelimit:30},t.options)}newContainer(){let e=document.createElement("div");return e.classList.add("cell-output-container"),e.classList.add("cell-output-container-pyodide"),e}getSetupCode(){let e=this.options.exercise,t=document.querySelectorAll(`script[type="exercise-setup-${e}-contents"]`);if(t.length>0)return t.length>1&&console.warn(`Multiple \`setup\` blocks found for exercise "${e}", using the first.`),JSON.parse(ii(t[0].textContent)).code}async process(e){if(!this.options.eval){this.container=this.asSourceHTML(this.context.code),this.container.value=this.nullResult;return}if(this.options.exercise&&this.context.code&&this.context.code.match(/_{6}_*/g)){this.container.value.result=null;return}let t=this.context.indicator;this.context.indicator||(t=new Ge),t.running();try{await Promise.all(Object.entries(e).map(async([a,l])=>{await this.envManager.bind(a,l,"prep")}));let r=this.getSetupCode();await this.evaluate(r,"prep"),await this.envManager.create("result","prep");let n=await this.evaluate(this.context.code,"result");if(!n)this.container.value.result=null;else if(this.options.output==="asis")this.container.innerHTML=await n.stdout;else if(this.container=await this.asHtml(n),!this.options.output){let a=this.container.value;this.container=this.newContainer(),this.container.value=a}let s=await this.envManager.get("result"),o={};typeof this.options.define=="string"?o[this.options.define]=await s.get(this.options.define):this.options.define&&Object.assign(o,Object.fromEntries(await Promise.all(this.options.define.map(async a=>{let l=await s.get(a);return[a,l]})))),Object.keys(o).forEach(async a=>{let l=await this.asOjs(o[a]);window._ojs.ojsConnector.mainModule._scope.has(a)?window._ojs.ojsConnector.mainModule.redefine(a,()=>l):window._ojs.ojsConnector.define(a)(l)})}finally{t.finished(),this.context.indicator||t.destroy()}}async evaluate(e,t,r=this.options){if(e==null)return null;await this.pyodide.loadPackagesFromImports(e);let[n,s,o]=[7,5,100];"fig-width"in this.options&&(n=Number(this.options["fig-width"])),"fig-height"in this.options&&(s=Number(this.options["fig-height"])),"fig-dpi"in this.options&&(o=Number(this.options["fig-dpi"]));let a=await this.pyodide.toPy({code:e,dpi:o,width:n,height:s,environment:await this.envManager.get(t)}),l=await this.pyodide.runPythonAsync(atob(dO()),{locals:a});a.destroy();let c=await l.get("value"),h=await l.get("stdout"),u=await l.get("stderr"),f=await l.get("outputs");return{value:c,stdout:h,stderr:u,outputs:f}}asSourceHTML(e){let t=document.createElement("div"),r=document.createElement("pre");t.className="sourceCode",r.className="sourceCode python";let n=wr(e);return r.appendChild(n),t.appendChild(r),t}async asOjs(e){return Object.getOwnPropertyNames(e).includes("toJs")?e.toJs():e}async asHtml(e,t=this.options){let r=this.newContainer();if(r.value=this.nullResult,!e)return r;let n=u=>{if(u.width<=1&&u.height<=1)return;let f=document.createElement("canvas");f.width=u.width,f.height=u.height,f.className="img-fluid figure-img",f.style.width=`${2*u.width/3}px`,f.getContext("bitmaprenderer").transferFromImageBitmap(u);let d=document.createElement("div");d.className="cell-output-display cell-output-pyodide",d.appendChild(f),t.output&&r.appendChild(d)},s=u=>{if(t.output){let f=document.createElement("div");f.appendChild(document.createTextNode(u)),f.className="cell-output cell-output-pyodide",f.innerHTML=`<pre><code>${f.innerHTML}</code></pre>`,r.appendChild(f)}},o=async u=>{let f=await this.pyodide.runPythonAsync(`
        import ipywidgets as widgets
        import json
        json.dumps(widgets.Widget.get_manager_state())
      `);Tr||(Tr=document.createElement("script"),Tr.type="application/vnd.jupyter.widget-state+json",Tr=document.body.appendChild(Tr),await wh("https://cdn.jsdelivr.net/npm/@jupyter-widgets/html-manager@1.0.11/dist/embed.js")),Tr.innerHTML=f;let d=await this.pyodide.toPy({widget:u}),m=await this.pyodide.runPythonAsync(`
        import json
        json.dumps(widget)
      `,{locals:d});d.destroy();let p=document.createElement("script");p.type="application/vnd.jupyter.widget-view+json",p.innerHTML=m,r.appendChild(p),dispatchEvent(new Event("load"))},a=async u=>{let f=await this.pyodide.toPy({figure:u}),d=await this.pyodide.runPythonAsync(`
        import json
        json.dumps(figure)
      `,{locals:f});pO||(await wh("https://cdn.plot.ly/plotly-2.35.2.min.js"),pO=!0);var m=JSON.parse(d);let p=document.createElement("div");window.Plotly.newPlot(p,m.data,m.layout),r.appendChild(p)},l=async u=>{if(t.output){let f=document.createElement("div");f.className="cell-output cell-output-pyodide",f.innerHTML=u,No(f),r.appendChild(f)}},c=async(u,f)=>{if(t.output){let d=document.createElement("div"),m=document.createElement("img");d.className="cell-output-display cell-output-pyodide",m.src=`data:${u};base64, ${f}`,d.appendChild(m),r.appendChild(d)}};if(t.echo){let u=document.createElement("div"),f=document.createElement("pre");u.className="sourceCode",f.className="sourceCode python";let d=wr(this.context.code);f.appendChild(d),u.appendChild(f),r.appendChild(u)}let h=new mO.default({escapeXML:!0});if(e.stdout){let u=document.createElement("div");u.className="exercise-cell-output cell-output cell-output-pyodide cell-output-stdout",u.innerHTML="<pre><code></code></pre>";let f=u.querySelector("code");f.textContent=e.stdout,f.innerHTML=h.toHtml(f.textContent),r.appendChild(u)}if(e.stderr){let u=document.createElement("div");u.className="exercise-cell-output cell-output cell-output-pyodide cell-output-stderr",u.innerHTML="<pre><code></code></pre>";let f=u.querySelector("code");f.textContent=e.stderr,f.innerHTML=h.toHtml(f.textContent),r.appendChild(u)}for(let u=0;u<await e.outputs.length;u++){let f=await e.outputs.get(u),d=await f._repr_mime_("application/html-imagebitmap"),m=await f._repr_mime_("text/html"),p=await f._repr_mime_("application/vnd.jupyter.widget-view+json"),g=await f._repr_mime_("application/vnd.plotly.v1+json"),O=await f._repr_mime_("text/plain"),y=await f._repr_mime_("image/png"),x=await f._repr_mime_("image/jpeg"),v=await f._repr_mime_("image/gif"),w=await f._repr_mime_("image/svg+xml");d?n(d):m?l(m):p?o(p):g?a(g):y?c("image/png",y):x?c("image/jpeg",x):v?c("image/gif",v):w?l(w):O&&s(O),f.destroy()}return r.value.result=e,r}};var Pr=class{constructor(e){this.evaluator=e,this.envManager=this.evaluator.envManager,this.context=this.evaluator.context,this.options={envir:this.evaluator.options.envir,eval:!0,echo:!1,warning:!0,error:!1,include:!0,output:!0,timelimit:600}}getCheckingAlgorithm(){let e=this.evaluator.options.exercise,t=document.querySelectorAll(`script[type="exercise-check-${e}-contents"]`);if(t.length>0)return t.length>1&&console.warn(`Multiple \`check\` blocks found for exercise "${e}", using the first.`),JSON.parse(ii(t[0].textContent)).code}};var Zo=class extends Pr{constructor(e){super(e),this.webR=this.evaluator.webR}async gradeExercise(){let e=this.context.code;if(!e)return null;let t=await this.blankCheck(e);if(!ke(t))return await this.feedbackAsHtmlAlert(t);if(t=await this.parseCheck(e),!ke(t))return await this.feedbackAsHtmlAlert(t);let r=this.context.indicator;this.context.indicator||(r=new Ge),r.running();try{if(t=await this.evaluateExercise(),ke(t))return null;let n=await this.evaluator.asHtml(t,this.options),s=await n.value.result,o=await(await s.class()).toArray();if(o.includes("gradethis_graded")||o.includes("gradethis_feedback"))return await this.feedbackAsHtmlAlert(s);if(it(s)){let a=await s.get("message"),l=await s.get("correct");if(!ke(a)&&!ke(l))return await this.feedbackAsHtmlAlert(s)}return n}finally{r.finished(),this.context.indicator||r.destroy()}}async parseCheck(e,t){let r=await this.evaluator.shelter;try{return await r.evalR("parse(text = user_code)",{env:{user_code:e}}),this.evaluator.webR.objs.null}catch{return await new r.RList({message:await r.evalR(`htmltools::HTML("
          It looks like this might not be valid R code.
          R cannot determine how to turn your text into a complete command.
          You may have forgotten to fill in a blank,
          to remove an underscore, to include a comma between arguments,
          or to close an opening <code>&quot;</code>, <code>'</code>, <code>(</code>
          or <code>{</code> with a matching <code>&quot;</code>, <code>'</code>,
          <code>)</code> or <code>}</code>.
        ")`),correct:!1,location:"append",type:"error"})}finally{r.purge()}}async blankCheck(e){let t=await this.evaluator.shelter;return e.match(/_{6}_*/g)?await new t.RList({message:"Please replace ______ with valid code.",correct:!1,location:"append",type:"info"}):this.evaluator.webR.objs.null}async evaluateSolution(){let e=this.evaluator.options.exercise,t=document.querySelectorAll(`.exercise-solution[data-exercise="${e}"] > code.solution-code`);if(t.length>0){t.length>1&&console.warn(`Multiple solutions found for exercise "${e}", using first solution.`);let r=await this.evaluator.shelter;await this.envManager.create("solution","prep");let n=await this.envManager.get("solution"),s=t[0].textContent,o=await r.evalR(s,{env:n});return{envir:n,code:s,result:o}}return null}async evaluateExercise(){await this.envManager.create("grading","result");let e=await this.evaluator.shelter;try{let t=await this.envManager.get("result"),r=this.evaluator.container.value.evaluate_result,n=await this.envManager.get("prep"),s=this.evaluator.container.value.result,o={user_code:this.context.code,stage:"check",engine:"r",label:this.context.options.exercise||this.webR.objs.null,check_code:this.getCheckingAlgorithm()||this.webR.objs.null,envir_result:t,evaluate_result:r,envir_prep:n,last_value:s,solution_code:this.webR.objs.null,solution_code_all:this.webR.objs.null,envir_solution:this.webR.objs.null,solution:this.webR.objs.null},a=await this.evaluateSolution();a&&(o.solution_code=a.code,o.solution_code_all=[a.code],o.envir_solution=a.envir,o.solution=a.result);let l=await new e.RList(o);await this.envManager.bind(".checker_args",l,"grading");let c={...this.options};return c.error=!1,c.output=!0,await this.evaluator.evaluate(`.checker <- getOption('webr.exercise.checker')
        environment(.checker) <- environment()
        do.call(.checker, .checker_args)`,"grading",c)}finally{e.purge()}}async feedbackAsHtmlAlert(e){let t=await this.evaluator.shelter,r=document.createElement("div"),n=await e.get("type"),s=await e.get("correct");switch(r.classList.add("alert"),r.classList.add("exercise-grade"),await n.toString()){case"success":r.classList.add("alert-success");break;case"info":r.classList.add("alert-info");break;case"warning":r.classList.add("alert-warning");break;case"error":case"danger":r.classList.add("alert-danger");break;default:{let f=await s.toArray();f.length>0&&f[0]?r.classList.add("alert-success"):r.classList.add("alert-danger")}}let o=document.createElement("span");o.className="exercise-feedback";let a=await e.get("message");a=(await t.captureR("knitr::knit_print(grade$message)",{env:{grade:e}})).result;let c=await a.toString(),h=document.createElement("div");h.innerHTML=c,r.append(...h.childNodes);let u=await e.get("error");if(!ke(u)){a=await u.get("message"),c=await a.toString();let f=await u.get("call"),d=await u.get("gradethis_call"),m=document.createElement("p"),p=document.createElement("pre");p.appendChild(document.createTextNode(`Error: ${c}`)),m.appendChild(p),r.appendChild(m);let g=document.createElement("details");p=document.createElement("pre"),p.appendChild(document.createTextNode(await f.toString())),g.appendChild(p),p=document.createElement("pre"),p.appendChild(document.createTextNode(await d.toString())),g.appendChild(p),r.appendChild(g)}return r}};var Jo=class extends Pr{constructor(e){super(e),this.pyodide=this.evaluator.pyodide}async gradeExercise(){let e=this.context.code;if(!e)return null;let t=await this.blankCheck(e);if(t)return await this.feedbackAsHtmlAlert(t);if(t=await this.parseCheck(e),t)return await this.feedbackAsHtmlAlert(t);let r=this.context.indicator;this.context.indicator||(r=new Ge),r.running();try{let n=await this.evaluateExercise();if(!n.value)return null;let s=await this.evaluator.asHtml(n,this.options),o=await s.value.result.value,a,l;return await o.type==="dict"&&(a=await o.get("message"),l=await o.get("correct")),a&&l!==void 0?await this.feedbackAsHtmlAlert(o):s}finally{r.finished(),this.context.indicator||r.destroy()}}async parseCheck(e,t){try{return await this.pyodide.runPythonAsync(`
        from ast import parse
        parse(user_code)
      `,{locals:await this.pyodide.toPy({user_code:e})}),null}catch{return await this.pyodide.toPy({message:`
          It looks like this might not be valid Python code.
          Python cannot determine how to turn your text into a complete command.
          Your code may be indented incorrectly, or you may have forgotten to
          fill in a blank, to remove an underscore, to include a comma between
          arguments, or to close an opening <code>&quot;</code>, <code>'</code>,
          <code>(</code> or <code>{</code> with a matching <code>&quot;</code>,
          <code>'</code>, <code>)</code> or <code>}</code>.
        `,correct:!1,location:"append",type:"error"})}}async blankCheck(e){return e.match(/_{6}_*/g)?await this.pyodide.toPy({message:"Please replace ______ with valid code.",correct:!1,location:"append",type:"info"}):null}async evaluateSolution(){let e=this.evaluator.options.exercise,t=document.querySelectorAll(`.exercise-solution[data-exercise="${e}"] > code.solution-code`);if(t.length>0){t.length>1&&console.warn(`Multiple solutions found for exercise "${e}", using first solution.`),await this.envManager.create("solution","prep");let r=await this.envManager.get("solution"),n=t[0].textContent,s=await this.pyodide.runPythonAsync(n,{globals:r});return{envir:r,code:n,result:s}}return null}async evaluateExercise(){await this.envManager.create("grading","result");let e=await this.envManager.get("result"),t=this.evaluator.container.value.evaluate_result,r=await this.envManager.get("prep"),n=this.evaluator.container.value.result.value,s={user_code:this.context.code,stage:"check",engine:"python",label:this.context.options.exercise,check_code:this.getCheckingAlgorithm(),envir_result:e,evaluate_result:t,envir_prep:r,last_value:n,result:n,solution_code:null,solution_code_all:null,envir_solution:null,solution:null},o=await this.evaluateSolution();o&&(s.solution_code=o.code,s.solution_code_all=[o.code],s.envir_solution=o.envir,s.solution=o.result);let a=await this.pyodide.toPy(s);await this.envManager.bind("_checker_env",a,"grading"),a.destroy();let l={...this.options};return l.error=!1,l.output=!0,await this.evaluator.evaluate(`
        import pyodide
        feedback = None
        if (_checker_env["check_code"]):
          try:
            feedback = pyodide.code.eval_code(
              _checker_env["check_code"],
              globals = globals(),
              locals = _checker_env
            )
          except Exception as error:
            feedback = {
              'correct': False,
              'message': 'Error while checking \`{}\`: "{}"'.format(_checker_env["label"], error),
              'type': 'error'
            }
        feedback
      `,"grading",l)}async feedbackAsHtmlAlert(e){let t=document.createElement("div"),r=await e.get("type"),n=await e.get("correct"),s=await e.get("message");switch(t.classList.add("alert"),t.classList.add("exercise-grade"),r){case"success":t.classList.add("alert-success");break;case"info":t.classList.add("alert-info");break;case"warning":t.classList.add("alert-warning");break;case"error":case"danger":t.classList.add("alert-danger");break;default:t.classList.add(n?"alert-success":"alert-danger")}let o=document.createElement("span");return o.className="exercise-feedback",o.innerHTML=s,t.appendChild(o),t}};function Rk(i){return i&&i[Symbol.toStringTag]=="PyProxy"}function gO(i){return i&&!!i[va]}function Ak(i){return i&&typeof i=="object"&&"_comlinkProxy"in i&&"ptr"in i}function Qk(i){return i&&i[Symbol.toStringTag]=="Map"}function Qh(i){if(gO(i))return!0;if(i==null||i instanceof ArrayBuffer||ArrayBuffer.isView(i))return!1;if(i instanceof Array)return i.some(e=>Qh(e));if(typeof i=="object")return Object.entries(i).some(([e,t])=>Qh(t))}var OO={},yO={canHandle:Rk,serialize(i){let e=self.pyodide._module.PyProxy_getPtr(i);OO[e]=i;let{port1:t,port2:r}=new MessageChannel;return Kn(i,t),[[r,e],[r]]},deserialize([i,e]){i.start();let t=Ar(i);return new Proxy(t,{get:(n,s)=>s==="_ptr"?e:n[s]})}},bO={canHandle:Qh,serialize(i){return[qn(i,gO,e=>({_comlinkProxy:!0,ptr:e._ptr})),[]]},deserialize(i){return qn(i,Ak,e=>OO[e.ptr])}},wO={canHandle:bh,serialize(i){if(i.width==0&&i.height==0){let e=new OffscreenCanvas(1,1);e.getContext("2d"),i=e.transferToImageBitmap()}return[i,[i]]},deserialize(i){return i}},vO={canHandle:Qk,serialize(i){return[Object.fromEntries(i.entries()),[]]},deserialize(i){return i}};async function Lk(i,e){return await i.evalRVoid('options("webr.render.df" = x)',{env:{x:e.render_df||"default"}}),await i.evalRVoid(atob(xO()))}async function qk(i){await i.runPythonAsync(atob(SO()));let e=atob(kO());await i.FS.mkdirTree("/pyodide"),await i.FS.writeFile("/pyodide/matplotlib_display.py",e)}async function Vk(i){let e=new URL("./pyodide-worker.js",import.meta.url),t=new Worker(e,{type:"module"}),n=await Ar(t).init(i);return Bt.set("PyProxy",yO),Bt.set("Comlink",bO),Bt.set("ImageBitmap",wO),Bt.set("Map",vO),Bt.delete("throw"),n}window._exercise_ojs_runtime={PyodideExerciseEditor:Xo,PyodideEvaluator:Yo,PyodideEnvironment:kr,PyodideGrader:Jo,WebR:ya,WebRExerciseEditor:Bo,WebREvaluator:Go,WebRGrader:Zo,WebREnvironment:Sr,highlightR:br,highlightPython:wr,interpolate:Oh,setupR:Lk,setupPython:qk,startPyodideWorker:Vk,b64Encode:Lg,b64Decode:ii,collapsePath:qg};export{kr as PyodideEnvironment,Yo as PyodideEvaluator,Xo as PyodideExerciseEditor,Jo as PyodideGrader,ya as WebR,Sr as WebREnvironment,Go as WebREvaluator,Bo as WebRExerciseEditor,Zo as WebRGrader,ii as b64Decode,Lg as b64Encode,qg as collapsePath,wr as highlightPython,br as highlightR,Oh as interpolate,qk as setupPython,Lk as setupR,Vk as startPyodideWorker};
/*! Bundled license information:

comlink/dist/esm/comlink.mjs:
  (**
   * @license
   * Copyright 2019 Google LLC
   * SPDX-License-Identifier: Apache-2.0
   *)
*/
