@redocly/openapi-docs 3.0.0-alpha.76 → 3.0.0-alpha.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/console.redocly-openapi-docs.min.js +56 -57
- package/dist/oauth2-redirect.js +1 -1
- package/dist/redocly-openapi-docs.min.js +323 -312
- package/lib/components/ContentItems/ContentItems.js +1 -1
- package/lib/components/rightPanel/CodemirrorInput/helpers.js +1 -1
- package/lib/components/rightPanel/CodemirrorInput/styled.js +1 -1
- package/lib/utils/path.d.ts +1 -0
- package/lib/utils/path.js +1 -1
- package/lib-esm/components/ContentItems/ContentItems.js +1 -1
- package/lib-esm/components/rightPanel/CodemirrorInput/helpers.js +1 -1
- package/lib-esm/components/rightPanel/CodemirrorInput/styled.js +1 -1
- package/lib-esm/utils/path.d.ts +1 -0
- package/lib-esm/utils/path.js +1 -1
- package/package.json +2 -2
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Redocly OpenAPI Docs
|
|
3
3
|
* (c) Copyright 2018 Redocly LLC, all rights reserved.
|
|
4
4
|
* -------------------------------------------------------------
|
|
5
|
-
* Version: "3.0.0-alpha.
|
|
5
|
+
* Version: "3.0.0-alpha.78"
|
|
6
6
|
*/(this.webpackChunkRedoclyOpenAPIDocs=this.webpackChunkRedoclyOpenAPIDocs||[]).push([[290],{26179:(v,C)=>{"use strict";/*!
|
|
7
7
|
* cookie
|
|
8
8
|
* Copyright(c) 2012-2014 Roman Shtylman
|
|
9
9
|
* Copyright(c) 2015 Douglas Christopher Wilson
|
|
10
10
|
* MIT Licensed
|
|
11
|
-
*/C.parse=b,C.serialize=x;var f=Object.prototype.toString,g=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(I,B){if(typeof I!="string")throw new TypeError("argument str must be a string");for(var z={},Y=B||{},_=Y.decode||k,X=0;X<I.length;){var G=I.indexOf("=",X);if(G===-1)break;var te=I.indexOf(";",X);if(te===-1)te=I.length;else if(te<G){X=I.lastIndexOf(";",G-1)+1;continue}var se=I.slice(X,G).trim();if(z[se]===void 0){var R=I.slice(G+1,te).trim();R.charCodeAt(0)===34&&(R=R.slice(1,-1)),z[se]=N(R,_)}X=te+1}return z}function x(I,B,z){var Y=z||{},_=Y.encode||O;if(typeof _!="function")throw new TypeError("option encode is invalid");if(!g.test(I))throw new TypeError("argument name is invalid");var X=_(B);if(X&&!g.test(X))throw new TypeError("argument val is invalid");var G=I+"="+X;if(Y.maxAge!=null){var te=Y.maxAge-0;if(isNaN(te)||!isFinite(te))throw new TypeError("option maxAge is invalid");G+="; Max-Age="+Math.floor(te)}if(Y.domain){if(!g.test(Y.domain))throw new TypeError("option domain is invalid");G+="; Domain="+Y.domain}if(Y.path){if(!g.test(Y.path))throw new TypeError("option path is invalid");G+="; Path="+Y.path}if(Y.expires){var se=Y.expires;if(!E(se)||isNaN(se.valueOf()))throw new TypeError("option expires is invalid");G+="; Expires="+se.toUTCString()}if(Y.httpOnly&&(G+="; HttpOnly"),Y.secure&&(G+="; Secure"),Y.priority){var R=typeof Y.priority=="string"?Y.priority.toLowerCase():Y.priority;switch(R){case"low":G+="; Priority=Low";break;case"medium":G+="; Priority=Medium";break;case"high":G+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(Y.sameSite){var ee=typeof Y.sameSite=="string"?Y.sameSite.toLowerCase():Y.sameSite;switch(ee){case!0:G+="; SameSite=Strict";break;case"lax":G+="; SameSite=Lax";break;case"strict":G+="; SameSite=Strict";break;case"none":G+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return G}function k(I){return I.indexOf("%")!==-1?decodeURIComponent(I):I}function O(I){return encodeURIComponent(I)}function E(I){return f.call(I)==="[object Date]"||I instanceof Date}function N(I,B){try{return B(I)}catch{return I}}},97529:(v,C,f)=>{var g=f(44928);v.exports=g},75342:(v,C,f)=>{var g=f(26087);v.exports=g},64218:(v,C,f)=>{var g=f(11783);v.exports=g},95050:(v,C,f)=>{var g=f(88462);v.exports=g},84779:(v,C,f)=>{var g=f(83531);v.exports=g},17190:(v,C,f)=>{var g=f(19941);v.exports=g},96589:(v,C,f)=>{var g=f(25081);v.exports=g},32276:(v,C,f)=>{var g=f(22145);v.exports=g},15064:(v,C,f)=>{var g=f(93690);v.exports=g},31986:(v,C,f)=>{var g=f(8429);f(42319),v.exports=g},69635:(v,C,f)=>{var g=f(13099);v.exports=g},3529:(v,C,f)=>{var g=f(44931);v.exports=g},85373:(v,C,f)=>{f(17802);var g=f(70291);v.exports=g("Array").filter},94537:(v,C,f)=>{f(64009);var g=f(70291);v.exports=g("Array").forEach},27794:(v,C,f)=>{f(32449);var g=f(70291);v.exports=g("Array").indexOf},55794:(v,C,f)=>{var g=f(15166),b=f(85373),x=Array.prototype;v.exports=function(k){var O=k.filter;return k===x||g(x,k)&&O===x.filter?b:O}},85838:(v,C,f)=>{var g=f(15166),b=f(27794),x=Array.prototype;v.exports=function(k){var O=k.indexOf;return k===x||g(x,k)&&O===x.indexOf?b:O}},95617:(v,C,f)=>{f(28135);var g=f(59921),b=g.Object,x=v.exports=function(O,E){return b.defineProperties(O,E)};b.defineProperties.sham&&(x.sham=!0)},11906:(v,C,f)=>{f(70829);var g=f(59921),b=g.Object,x=v.exports=function(O,E,N){return b.defineProperty(O,E,N)};b.defineProperty.sham&&(x.sham=!0)},59123:(v,C,f)=>{f(51964);var g=f(59921),b=g.Object,x=v.exports=function(O,E){return b.getOwnPropertyDescriptor(O,E)};b.getOwnPropertyDescriptor.sham&&(x.sham=!0)},63332:(v,C,f)=>{f(723);var g=f(59921);v.exports=g.Object.getOwnPropertyDescriptors},83606:(v,C,f)=>{f(68030);var g=f(59921);v.exports=g.Object.getOwnPropertySymbols},90660:(v,C,f)=>{f(38339);var g=f(59921);v.exports=g.Object.keys},49198:(v,C,f)=>{f(69825),f(97829),f(68030),f(95353),f(63906),f(39542),f(47882),f(84911),f(88725),f(47954),f(67703),f(2220),f(48990),f(50240),f(99921),f(3502),f(80220),f(23870),f(5828),f(5708);var g=f(59921);v.exports=g.Symbol},15413:(v,C,f)=>{f(44390),f(97829),f(27626),f(84911);var g=f(39378);v.exports=g.f("iterator")},4793:(v,C,f)=>{f(91667),f(99921);var g=f(39378);v.exports=g.f("toPrimitive")},24018:(v,C,f)=>{v.exports=f(11226)},27411:(v,C,f)=>{v.exports=f(39743)},79155:(v,C,f)=>{v.exports=f(17018)},13375:(v,C,f)=>{v.exports=f(45057)},95442:(v,C,f)=>{v.exports=f(97947)},55334:(v,C,f)=>{v.exports=f(26452)},48261:(v,C,f)=>{v.exports=f(4477)},92864:(v,C,f)=>{v.exports=f(74013)},27923:(v,C,f)=>{v.exports=f(17685)},89225:(v,C,f)=>{v.exports=f(2371)},95281:(v,C,f)=>{v.exports=f(89061)},55468:(v,C,f)=>{v.exports=f(51553)},11226:(v,C,f)=>{var g=f(97529);v.exports=g},39743:(v,C,f)=>{var g=f(75342);v.exports=g},17018:(v,C,f)=>{var g=f(64218);v.exports=g},45057:(v,C,f)=>{var g=f(95050);v.exports=g},97947:(v,C,f)=>{var g=f(84779);v.exports=g},26452:(v,C,f)=>{var g=f(17190);v.exports=g},4477:(v,C,f)=>{var g=f(96589);v.exports=g},74013:(v,C,f)=>{var g=f(32276);v.exports=g},17685:(v,C,f)=>{var g=f(15064);v.exports=g},2371:(v,C,f)=>{var g=f(31986);f(45987),f(58052),f(90181),f(25129),f(90397),f(18097),f(82793),f(52100),f(99742),v.exports=g},89061:(v,C,f)=>{var g=f(69635);v.exports=g},51553:(v,C,f)=>{var g=f(3529);v.exports=g},81970:(v,C,f)=>{var g=f(43152),b=f(18342),x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not a function")}},72185:(v,C,f)=>{var g=f(43152),b=String,x=TypeError;v.exports=function(k){if(typeof k=="object"||g(k))return k;throw x("Can't set "+b(k)+" as a prototype")}},20844:v=>{v.exports=function(){}},35970:(v,C,f)=>{var g=f(92548),b=String,x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not an object")}},24782:(v,C,f)=>{"use strict";var g=f(93935).forEach,b=f(10454),x=b("forEach");v.exports=x?[].forEach:function(O){return g(this,O,arguments.length>1?arguments[1]:void 0)}},66322:(v,C,f)=>{var g=f(88966),b=f(13249),x=f(53387),k=function(O){return function(E,N,I){var B=g(E),z=x(B),Y=b(I,z),_;if(O&&N!=N){for(;z>Y;)if(_=B[Y++],_!=_)return!0}else for(;z>Y;Y++)if((O||Y in B)&&B[Y]===N)return O||Y||0;return!O&&-1}};v.exports={includes:k(!0),indexOf:k(!1)}},93935:(v,C,f)=>{var g=f(7416),b=f(90406),x=f(38622),k=f(53254),O=f(53387),E=f(69573),N=b([].push),I=function(B){var z=B==1,Y=B==2,_=B==3,X=B==4,G=B==6,te=B==7,se=B==5||G;return function(R,ee,U,re){for(var ne=k(R),ae=x(ne),ce=g(ee,U),V=O(ae),K=0,le=re||E,pe=z?le(R,V):Y||te?le(R,0):void 0,ge,me;V>K;K++)if((se||K in ae)&&(ge=ae[K],me=ce(ge,K,ne),B))if(z)pe[K]=me;else if(me)switch(B){case 3:return!0;case 5:return ge;case 6:return K;case 2:N(pe,ge)}else switch(B){case 4:return!1;case 7:N(pe,ge)}return G?-1:_||X?X:pe}};v.exports={forEach:I(0),map:I(1),filter:I(2),some:I(3),every:I(4),find:I(5),findIndex:I(6),filterReject:I(7)}},36844:(v,C,f)=>{var g=f(31982),b=f(33538),x=f(32438),k=b("species");v.exports=function(O){return x>=51||!g(function(){var E=[],N=E.constructor={};return N[k]=function(){return{foo:1}},E[O](Boolean).foo!==1})}},10454:(v,C,f)=>{"use strict";var g=f(31982);v.exports=function(b,x){var k=[][b];return!!k&&g(function(){k.call(null,x||function(){return 1},1)})}},67932:(v,C,f)=>{var g=f(13249),b=f(53387),x=f(53437),k=Array,O=Math.max;v.exports=function(E,N,I){for(var B=b(E),z=g(N,B),Y=g(I===void 0?B:I,B),_=k(O(Y-z,0)),X=0;z<Y;z++,X++)x(_,X,E[z]);return _.length=X,_}},53160:(v,C,f)=>{var g=f(90406);v.exports=g([].slice)},76562:(v,C,f)=>{var g=f(93053),b=f(43455),x=f(92548),k=f(33538),O=k("species"),E=Array;v.exports=function(N){var I;return g(N)&&(I=N.constructor,b(I)&&(I===E||g(I.prototype))?I=void 0:x(I)&&(I=I[O],I===null&&(I=void 0))),I===void 0?E:I}},69573:(v,C,f)=>{var g=f(76562);v.exports=function(b,x){return new(g(b))(x===0?0:x)}},58310:(v,C,f)=>{var g=f(90406),b=g({}.toString),x=g("".slice);v.exports=function(k){return x(b(k),8,-1)}},82059:(v,C,f)=>{var g=f(48448),b=f(43152),x=f(58310),k=f(33538),O=k("toStringTag"),E=Object,N=x(function(){return arguments}())=="Arguments",I=function(B,z){try{return B[z]}catch{}};v.exports=g?x:function(B){var z,Y,_;return B===void 0?"Undefined":B===null?"Null":typeof(Y=I(z=E(B),O))=="string"?Y:N?x(z):(_=x(z))=="Object"&&b(z.callee)?"Arguments":_}},74838:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){function b(){}return b.prototype.constructor=null,Object.getPrototypeOf(new b)!==b.prototype})},10248:v=>{v.exports=function(C,f){return{value:C,done:f}}},20410:(v,C,f)=>{var g=f(56049),b=f(36133),x=f(54686);v.exports=g?function(k,O,E){return b.f(k,O,x(1,E))}:function(k,O,E){return k[O]=E,k}},54686:v=>{v.exports=function(C,f){return{enumerable:!(C&1),configurable:!(C&2),writable:!(C&4),value:f}}},53437:(v,C,f)=>{"use strict";var g=f(5135),b=f(36133),x=f(54686);v.exports=function(k,O,E){var N=g(O);N in k?b.f(k,N,x(0,E)):k[N]=E}},37912:(v,C,f)=>{var g=f(36133);v.exports=function(b,x,k){return g.f(b,x,k)}},27519:(v,C,f)=>{var g=f(20410);v.exports=function(b,x,k,O){return O&&O.enumerable?b[x]=k:g(b,x,k),b}},9267:(v,C,f)=>{var g=f(62447),b=Object.defineProperty;v.exports=function(x,k){try{b(g,x,{value:k,configurable:!0,writable:!0})}catch{g[x]=k}return k}},56049:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},51647:v=>{var C=typeof document=="object"&&document.all,f=typeof C>"u"&&C!==void 0;v.exports={all:C,IS_HTMLDDA:f}},45511:(v,C,f)=>{var g=f(62447),b=f(92548),x=g.document,k=b(x)&&b(x.createElement);v.exports=function(O){return k?x.createElement(O):{}}},11452:v=>{var C=TypeError,f=9007199254740991;v.exports=function(g){if(g>f)throw C("Maximum allowed index exceeded");return g}},81595:v=>{v.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},90740:v=>{v.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},32438:(v,C,f)=>{var g=f(62447),b=f(90740),x=g.process,k=g.Deno,O=x&&x.versions||k&&k.version,E=O&&O.v8,N,I;E&&(N=E.split("."),I=N[0]>0&&N[0]<4?1:+(N[0]+N[1])),!I&&b&&(N=b.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=b.match(/Chrome\/(\d+)/),N&&(I=+N[1]))),v.exports=I},70291:(v,C,f)=>{var g=f(59921);v.exports=function(b){return g[b+"Prototype"]}},11792:v=>{v.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30080:(v,C,f)=>{"use strict";var g=f(62447),b=f(82768),x=f(57953),k=f(43152),O=f(80016).f,E=f(51585),N=f(59921),I=f(7416),B=f(20410),z=f(18768),Y=function(_){var X=function(G,te,se){if(this instanceof X){switch(arguments.length){case 0:return new _;case 1:return new _(G);case 2:return new _(G,te)}return new _(G,te,se)}return b(_,this,arguments)};return X.prototype=_.prototype,X};v.exports=function(_,X){var G=_.target,te=_.global,se=_.stat,R=_.proto,ee=te?g:se?g[G]:(g[G]||{}).prototype,U=te?N:N[G]||B(N,G,{})[G],re=U.prototype,ne,ae,ce,V,K,le,pe,ge,me;for(V in X)ne=E(te?V:G+(se?".":"#")+V,_.forced),ae=!ne&&ee&&z(ee,V),le=U[V],ae&&(_.dontCallGetSet?(me=O(ee,V),pe=me&&me.value):pe=ee[V]),K=ae&&pe?pe:X[V],!(ae&&typeof le==typeof K)&&(_.bind&&ae?ge=I(K,g):_.wrap&&ae?ge=Y(K):R&&k(K)?ge=x(K):ge=K,(_.sham||K&&K.sham||le&&le.sham)&&B(ge,"sham",!0),B(U,V,ge),R&&(ce=G+"Prototype",z(N,ce)||B(N,ce,{}),B(N[ce],V,K),_.real&&re&&(ne||!re[V])&&B(re,V,K)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.apply,k=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(g?k.bind(x):function(){return k.apply(x,arguments)})},7416:(v,C,f)=>{var g=f(57953),b=f(81970),x=f(97966),k=g(g.bind);v.exports=function(O,E){return b(O),E===void 0?O:x?k(O,E):function(){return O.apply(E,arguments)}}},97966:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){var b=function(){}.bind();return typeof b!="function"||b.hasOwnProperty("prototype")})},12461:(v,C,f)=>{var g=f(97966),b=Function.prototype.call;v.exports=g?b.bind(b):function(){return b.apply(b,arguments)}},58100:(v,C,f)=>{var g=f(56049),b=f(18768),x=Function.prototype,k=g&&Object.getOwnPropertyDescriptor,O=b(x,"name"),E=O&&function(){}.name==="something",N=O&&(!g||g&&k(x,"name").configurable);v.exports={EXISTS:O,PROPER:E,CONFIGURABLE:N}},54518:(v,C,f)=>{var g=f(90406),b=f(81970);v.exports=function(x,k,O){try{return g(b(Object.getOwnPropertyDescriptor(x,k)[O]))}catch{}}},57953:(v,C,f)=>{var g=f(58310),b=f(90406);v.exports=function(x){if(g(x)==="Function")return b(x)}},90406:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.call,k=g&&b.bind.bind(x,x);v.exports=g?k:function(O){return function(){return x.apply(O,arguments)}}},97080:(v,C,f)=>{var g=f(59921),b=f(62447),x=f(43152),k=function(O){return x(O)?O:void 0};v.exports=function(O,E){return arguments.length<2?k(g[O])||k(b[O]):g[O]&&g[O][E]||b[O]&&b[O][E]}},82850:(v,C,f)=>{var g=f(90406),b=f(93053),x=f(43152),k=f(58310),O=f(46025),E=g([].push);v.exports=function(N){if(x(N))return N;if(b(N)){for(var I=N.length,B=[],z=0;z<I;z++){var Y=N[z];typeof Y=="string"?E(B,Y):(typeof Y=="number"||k(Y)=="Number"||k(Y)=="String")&&E(B,O(Y))}var _=B.length,X=!0;return function(G,te){if(X)return X=!1,te;if(b(this))return te;for(var se=0;se<_;se++)if(B[se]===G)return te}}}},27529:(v,C,f)=>{var g=f(81970),b=f(71365);v.exports=function(x,k){var O=x[k];return b(O)?void 0:g(O)}},62447:(v,C,f)=>{var g=function(b){return b&&b.Math==Math&&b};v.exports=g(typeof globalThis=="object"&&globalThis)||g(typeof window=="object"&&window)||g(typeof self=="object"&&self)||g(typeof f.g=="object"&&f.g)||function(){return this}()||Function("return this")()},18768:(v,C,f)=>{var g=f(90406),b=f(53254),x=g({}.hasOwnProperty);v.exports=Object.hasOwn||function(O,E){return x(b(O),E)}},13477:v=>{v.exports={}},19552:(v,C,f)=>{var g=f(97080);v.exports=g("document","documentElement")},11314:(v,C,f)=>{var g=f(56049),b=f(31982),x=f(45511);v.exports=!g&&!b(function(){return Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a!=7})},38622:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(58310),k=Object,O=g("".split);v.exports=b(function(){return!k("z").propertyIsEnumerable(0)})?function(E){return x(E)=="String"?O(E,""):k(E)}:k},41524:(v,C,f)=>{var g=f(90406),b=f(43152),x=f(70716),k=g(Function.toString);b(x.inspectSource)||(x.inspectSource=function(O){return k(O)}),v.exports=x.inspectSource},44083:(v,C,f)=>{var g=f(57761),b=f(62447),x=f(92548),k=f(20410),O=f(18768),E=f(70716),N=f(4580),I=f(13477),B="Object already initialized",z=b.TypeError,Y=b.WeakMap,_,X,G,te=function(U){return G(U)?X(U):_(U,{})},se=function(U){return function(re){var ne;if(!x(re)||(ne=X(re)).type!==U)throw z("Incompatible receiver, "+U+" required");return ne}};if(g||E.state){var R=E.state||(E.state=new Y);R.get=R.get,R.has=R.has,R.set=R.set,_=function(U,re){if(R.has(U))throw z(B);return re.facade=U,R.set(U,re),re},X=function(U){return R.get(U)||{}},G=function(U){return R.has(U)}}else{var ee=N("state");I[ee]=!0,_=function(U,re){if(O(U,ee))throw z(B);return re.facade=U,k(U,ee,re),re},X=function(U){return O(U,ee)?U[ee]:{}},G=function(U){return O(U,ee)}}v.exports={set:_,get:X,has:G,enforce:te,getterFor:se}},93053:(v,C,f)=>{var g=f(58310);v.exports=Array.isArray||function(x){return g(x)=="Array"}},43152:(v,C,f)=>{var g=f(51647),b=g.all;v.exports=g.IS_HTMLDDA?function(x){return typeof x=="function"||x===b}:function(x){return typeof x=="function"}},43455:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(43152),k=f(82059),O=f(97080),E=f(41524),N=function(){},I=[],B=O("Reflect","construct"),z=/^\s*(?:class|function)\b/,Y=g(z.exec),_=!z.exec(N),X=function(se){if(!x(se))return!1;try{return B(N,I,se),!0}catch{return!1}},G=function(se){if(!x(se))return!1;switch(k(se)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _||!!Y(z,E(se))}catch{return!0}};G.sham=!0,v.exports=!B||b(function(){var te;return X(X.call)||!X(Object)||!X(function(){te=!0})||te})?G:X},51585:(v,C,f)=>{var g=f(31982),b=f(43152),x=/#|\.prototype\./,k=function(B,z){var Y=E[O(B)];return Y==I?!0:Y==N?!1:b(z)?g(z):!!z},O=k.normalize=function(B){return String(B).replace(x,".").toLowerCase()},E=k.data={},N=k.NATIVE="N",I=k.POLYFILL="P";v.exports=k},71365:v=>{v.exports=function(C){return C==null}},92548:(v,C,f)=>{var g=f(43152),b=f(51647),x=b.all;v.exports=b.IS_HTMLDDA?function(k){return typeof k=="object"?k!==null:g(k)||k===x}:function(k){return typeof k=="object"?k!==null:g(k)}},39839:v=>{v.exports=!0},28609:(v,C,f)=>{var g=f(97080),b=f(43152),x=f(15166),k=f(27237),O=Object;v.exports=k?function(E){return typeof E=="symbol"}:function(E){var N=g("Symbol");return b(N)&&x(N.prototype,O(E))}},41709:(v,C,f)=>{"use strict";var g=f(98488).IteratorPrototype,b=f(73270),x=f(54686),k=f(98889),O=f(94609),E=function(){return this};v.exports=function(N,I,B,z){var Y=I+" Iterator";return N.prototype=b(g,{next:x(+!z,B)}),k(N,Y,!1,!0),O[Y]=E,N}},78107:(v,C,f)=>{"use strict";var g=f(30080),b=f(12461),x=f(39839),k=f(58100),O=f(43152),E=f(41709),N=f(90851),I=f(70738),B=f(98889),z=f(20410),Y=f(27519),_=f(33538),X=f(94609),G=f(98488),te=k.PROPER,se=k.CONFIGURABLE,R=G.IteratorPrototype,ee=G.BUGGY_SAFARI_ITERATORS,U=_("iterator"),re="keys",ne="values",ae="entries",ce=function(){return this};v.exports=function(V,K,le,pe,ge,me,$e){E(le,K,pe);var Ve=function(Ot){if(Ot===ge&&At)return At;if(!ee&&Ot in at)return at[Ot];switch(Ot){case re:return function(){return new le(this,Ot)};case ne:return function(){return new le(this,Ot)};case ae:return function(){return new le(this,Ot)}}return function(){return new le(this)}},Ye=K+" Iterator",Fe=!1,at=V.prototype,Dt=at[U]||at["@@iterator"]||ge&&at[ge],At=!ee&&Dt||Ve(ge),qt=K=="Array"&&at.entries||Dt,Xe,Ct,xt;if(qt&&(Xe=N(qt.call(new V)),Xe!==Object.prototype&&Xe.next&&(!x&&N(Xe)!==R&&(I?I(Xe,R):O(Xe[U])||Y(Xe,U,ce)),B(Xe,Ye,!0,!0),x&&(X[Ye]=ce))),te&&ge==ne&&Dt&&Dt.name!==ne&&(!x&&se?z(at,"name",ne):(Fe=!0,At=function(){return b(Dt,this)})),ge)if(Ct={values:Ve(ne),keys:me?At:Ve(re),entries:Ve(ae)},$e)for(xt in Ct)(ee||Fe||!(xt in at))&&Y(at,xt,Ct[xt]);else g({target:K,proto:!0,forced:ee||Fe},Ct);return(!x||$e)&&at[U]!==At&&Y(at,U,At,{name:ge}),X[K]=At,Ct}},98488:(v,C,f)=>{"use strict";var g=f(31982),b=f(43152),x=f(92548),k=f(73270),O=f(90851),E=f(27519),N=f(33538),I=f(39839),B=N("iterator"),z=!1,Y,_,X;[].keys&&(X=[].keys(),"next"in X?(_=O(O(X)),_!==Object.prototype&&(Y=_)):z=!0);var G=!x(Y)||g(function(){var te={};return Y[B].call(te)!==te});G?Y={}:I&&(Y=k(Y)),b(Y[B])||E(Y,B,function(){return this}),v.exports={IteratorPrototype:Y,BUGGY_SAFARI_ITERATORS:z}},94609:v=>{v.exports={}},53387:(v,C,f)=>{var g=f(62567);v.exports=function(b){return g(b.length)}},99295:v=>{var C=Math.ceil,f=Math.floor;v.exports=Math.trunc||function(b){var x=+b;return(x>0?f:C)(x)}},73270:(v,C,f)=>{var g=f(35970),b=f(98911),x=f(11792),k=f(13477),O=f(19552),E=f(45511),N=f(4580),I=">",B="<",z="prototype",Y="script",_=N("IE_PROTO"),X=function(){},G=function(U){return B+Y+I+U+B+"/"+Y+I},te=function(U){U.write(G("")),U.close();var re=U.parentWindow.Object;return U=null,re},se=function(){var U=E("iframe"),re="java"+Y+":",ne;return U.style.display="none",O.appendChild(U),U.src=String(re),ne=U.contentWindow.document,ne.open(),ne.write(G("document.F=Object")),ne.close(),ne.F},R,ee=function(){try{R=new ActiveXObject("htmlfile")}catch{}ee=typeof document<"u"?document.domain&&R?te(R):se():te(R);for(var U=x.length;U--;)delete ee[z][x[U]];return ee()};k[_]=!0,v.exports=Object.create||function(re,ne){var ae;return re!==null?(X[z]=g(re),ae=new X,X[z]=null,ae[_]=re):ae=ee(),ne===void 0?ae:b.f(ae,ne)}},98911:(v,C,f)=>{var g=f(56049),b=f(98715),x=f(36133),k=f(35970),O=f(88966),E=f(16619);C.f=g&&!b?Object.defineProperties:function(I,B){k(I);for(var z=O(B),Y=E(B),_=Y.length,X=0,G;_>X;)x.f(I,G=Y[X++],z[G]);return I}},36133:(v,C,f)=>{var g=f(56049),b=f(11314),x=f(98715),k=f(35970),O=f(5135),E=TypeError,N=Object.defineProperty,I=Object.getOwnPropertyDescriptor,B="enumerable",z="configurable",Y="writable";C.f=g?x?function(X,G,te){if(k(X),G=O(G),k(te),typeof X=="function"&&G==="prototype"&&"value"in te&&Y in te&&!te[Y]){var se=I(X,G);se&&se[Y]&&(X[G]=te.value,te={configurable:z in te?te[z]:se[z],enumerable:B in te?te[B]:se[B],writable:!1})}return N(X,G,te)}:N:function(X,G,te){if(k(X),G=O(G),k(te),b)try{return N(X,G,te)}catch{}if("get"in te||"set"in te)throw E("Accessors not supported");return"value"in te&&(X[G]=te.value),X}},80016:(v,C,f)=>{var g=f(56049),b=f(12461),x=f(16457),k=f(54686),O=f(88966),E=f(5135),N=f(18768),I=f(11314),B=Object.getOwnPropertyDescriptor;C.f=g?B:function(Y,_){if(Y=O(Y),_=E(_),I)try{return B(Y,_)}catch{}if(N(Y,_))return k(!b(x.f,Y,_),Y[_])}},53515:(v,C,f)=>{var g=f(58310),b=f(88966),x=f(51203).f,k=f(67932),O=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],E=function(N){try{return x(N)}catch{return k(O)}};v.exports.f=function(I){return O&&g(I)=="Window"?E(I):x(b(I))}},51203:(v,C,f)=>{var g=f(4541),b=f(11792),x=b.concat("length","prototype");C.f=Object.getOwnPropertyNames||function(O){return g(O,x)}},97620:(v,C)=>{C.f=Object.getOwnPropertySymbols},90851:(v,C,f)=>{var g=f(18768),b=f(43152),x=f(53254),k=f(4580),O=f(74838),E=k("IE_PROTO"),N=Object,I=N.prototype;v.exports=O?N.getPrototypeOf:function(B){var z=x(B);if(g(z,E))return z[E];var Y=z.constructor;return b(Y)&&z instanceof Y?Y.prototype:z instanceof N?I:null}},15166:(v,C,f)=>{var g=f(90406);v.exports=g({}.isPrototypeOf)},4541:(v,C,f)=>{var g=f(90406),b=f(18768),x=f(88966),k=f(66322).indexOf,O=f(13477),E=g([].push);v.exports=function(N,I){var B=x(N),z=0,Y=[],_;for(_ in B)!b(O,_)&&b(B,_)&&E(Y,_);for(;I.length>z;)b(B,_=I[z++])&&(~k(Y,_)||E(Y,_));return Y}},16619:(v,C,f)=>{var g=f(4541),b=f(11792);v.exports=Object.keys||function(k){return g(k,b)}},16457:(v,C)=>{"use strict";var f={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,b=g&&!f.call({1:2},1);C.f=b?function(k){var O=g(this,k);return!!O&&O.enumerable}:f},70738:(v,C,f)=>{var g=f(54518),b=f(35970),x=f(72185);v.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var k=!1,O={},E;try{E=g(Object.prototype,"__proto__","set"),E(O,[]),k=O instanceof Array}catch{}return function(I,B){return b(I),x(B),k?E(I,B):I.__proto__=B,I}}():void 0)},68399:(v,C,f)=>{"use strict";var g=f(48448),b=f(82059);v.exports=g?{}.toString:function(){return"[object "+b(this)+"]"}},96380:(v,C,f)=>{var g=f(12461),b=f(43152),x=f(92548),k=TypeError;v.exports=function(O,E){var N,I;if(E==="string"&&b(N=O.toString)&&!x(I=g(N,O))||b(N=O.valueOf)&&!x(I=g(N,O))||E!=="string"&&b(N=O.toString)&&!x(I=g(N,O)))return I;throw k("Can't convert object to primitive value")}},47813:(v,C,f)=>{var g=f(97080),b=f(90406),x=f(51203),k=f(97620),O=f(35970),E=b([].concat);v.exports=g("Reflect","ownKeys")||function(I){var B=x.f(O(I)),z=k.f;return z?E(B,z(I)):B}},59921:v=>{v.exports={}},31251:(v,C,f)=>{var g=f(71365),b=TypeError;v.exports=function(x){if(g(x))throw b("Can't call method on "+x);return x}},98889:(v,C,f)=>{var g=f(48448),b=f(36133).f,x=f(20410),k=f(18768),O=f(68399),E=f(33538),N=E("toStringTag");v.exports=function(I,B,z,Y){if(I){var _=z?I:I.prototype;k(_,N)||b(_,N,{configurable:!0,value:B}),Y&&!g&&x(_,"toString",O)}}},4580:(v,C,f)=>{var g=f(95976),b=f(91248),x=g("keys");v.exports=function(k){return x[k]||(x[k]=b(k))}},70716:(v,C,f)=>{var g=f(62447),b=f(9267),x="__core-js_shared__",k=g[x]||b(x,{});v.exports=k},95976:(v,C,f)=>{var g=f(39839),b=f(70716);(v.exports=function(x,k){return b[x]||(b[x]=k!==void 0?k:{})})("versions",[]).push({version:"3.29.1",mode:g?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},18143:(v,C,f)=>{var g=f(90406),b=f(32041),x=f(46025),k=f(31251),O=g("".charAt),E=g("".charCodeAt),N=g("".slice),I=function(B){return function(z,Y){var _=x(k(z)),X=b(Y),G=_.length,te,se;return X<0||X>=G?B?"":void 0:(te=E(_,X),te<55296||te>56319||X+1===G||(se=E(_,X+1))<56320||se>57343?B?O(_,X):te:B?N(_,X,X+2):(te-55296<<10)+(se-56320)+65536)}};v.exports={codeAt:I(!1),charAt:I(!0)}},71775:(v,C,f)=>{var g=f(32438),b=f(31982);v.exports=!!Object.getOwnPropertySymbols&&!b(function(){var x=Symbol();return!String(x)||!(Object(x)instanceof Symbol)||!Symbol.sham&&g&&g<41})},95679:(v,C,f)=>{var g=f(12461),b=f(97080),x=f(33538),k=f(27519);v.exports=function(){var O=b("Symbol"),E=O&&O.prototype,N=E&&E.valueOf,I=x("toPrimitive");E&&!E[I]&&k(E,I,function(B){return g(N,this)},{arity:1})}},82294:(v,C,f)=>{var g=f(71775);v.exports=g&&!!Symbol.for&&!!Symbol.keyFor},13249:(v,C,f)=>{var g=f(32041),b=Math.max,x=Math.min;v.exports=function(k,O){var E=g(k);return E<0?b(E+O,0):x(E,O)}},88966:(v,C,f)=>{var g=f(38622),b=f(31251);v.exports=function(x){return g(b(x))}},32041:(v,C,f)=>{var g=f(99295);v.exports=function(b){var x=+b;return x!==x||x===0?0:g(x)}},62567:(v,C,f)=>{var g=f(32041),b=Math.min;v.exports=function(x){return x>0?b(g(x),9007199254740991):0}},53254:(v,C,f)=>{var g=f(31251),b=Object;v.exports=function(x){return b(g(x))}},37505:(v,C,f)=>{var g=f(12461),b=f(92548),x=f(28609),k=f(27529),O=f(96380),E=f(33538),N=TypeError,I=E("toPrimitive");v.exports=function(B,z){if(!b(B)||x(B))return B;var Y=k(B,I),_;if(Y){if(z===void 0&&(z="default"),_=g(Y,B,z),!b(_)||x(_))return _;throw N("Can't convert object to primitive value")}return z===void 0&&(z="number"),O(B,z)}},5135:(v,C,f)=>{var g=f(37505),b=f(28609);v.exports=function(x){var k=g(x,"string");return b(k)?k:k+""}},48448:(v,C,f)=>{var g=f(33538),b=g("toStringTag"),x={};x[b]="z",v.exports=String(x)==="[object z]"},46025:(v,C,f)=>{var g=f(82059),b=String;v.exports=function(x){if(g(x)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return b(x)}},18342:v=>{var C=String;v.exports=function(f){try{return C(f)}catch{return"Object"}}},91248:(v,C,f)=>{var g=f(90406),b=0,x=Math.random(),k=g(1 .toString);v.exports=function(O){return"Symbol("+(O===void 0?"":O)+")_"+k(++b+x,36)}},27237:(v,C,f)=>{var g=f(71775);v.exports=g&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},98715:(v,C,f)=>{var g=f(56049),b=f(31982);v.exports=g&&b(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})},57761:(v,C,f)=>{var g=f(62447),b=f(43152),x=g.WeakMap;v.exports=b(x)&&/native code/.test(String(x))},64832:(v,C,f)=>{var g=f(59921),b=f(18768),x=f(39378),k=f(36133).f;v.exports=function(O){var E=g.Symbol||(g.Symbol={});b(E,O)||k(E,O,{value:x.f(O)})}},39378:(v,C,f)=>{var g=f(33538);C.f=g},33538:(v,C,f)=>{var g=f(62447),b=f(95976),x=f(18768),k=f(91248),O=f(71775),E=f(27237),N=g.Symbol,I=b("wks"),B=E?N.for||N:N&&N.withoutSetter||k;v.exports=function(z){return x(I,z)||(I[z]=O&&x(N,z)?N[z]:B("Symbol."+z)),I[z]}},69825:(v,C,f)=>{"use strict";var g=f(30080),b=f(31982),x=f(93053),k=f(92548),O=f(53254),E=f(53387),N=f(11452),I=f(53437),B=f(69573),z=f(36844),Y=f(33538),_=f(32438),X=Y("isConcatSpreadable"),G=_>=51||!b(function(){var R=[];return R[X]=!1,R.concat()[0]!==R}),te=function(R){if(!k(R))return!1;var ee=R[X];return ee!==void 0?!!ee:x(R)},se=!G||!z("concat");g({target:"Array",proto:!0,arity:1,forced:se},{concat:function(ee){var U=O(this),re=B(U,0),ne=0,ae,ce,V,K,le;for(ae=-1,V=arguments.length;ae<V;ae++)if(le=ae===-1?U:arguments[ae],te(le))for(K=E(le),N(ne+K),ce=0;ce<K;ce++,ne++)ce in le&&I(re,ne,le[ce]);else N(ne+1),I(re,ne++,le);return re.length=ne,re}})},17802:(v,C,f)=>{"use strict";var g=f(30080),b=f(93935).filter,x=f(36844),k=x("filter");g({target:"Array",proto:!0,forced:!k},{filter:function(E){return b(this,E,arguments.length>1?arguments[1]:void 0)}})},64009:(v,C,f)=>{"use strict";var g=f(30080),b=f(24782);g({target:"Array",proto:!0,forced:[].forEach!=b},{forEach:b})},32449:(v,C,f)=>{"use strict";var g=f(30080),b=f(57953),x=f(66322).indexOf,k=f(10454),O=b([].indexOf),E=!!O&&1/O([1],1,-0)<0,N=E||!k("indexOf");g({target:"Array",proto:!0,forced:N},{indexOf:function(B){var z=arguments.length>1?arguments[1]:void 0;return E?O(this,B,z)||0:x(this,B,z)}})},44390:(v,C,f)=>{"use strict";var g=f(88966),b=f(20844),x=f(94609),k=f(44083),O=f(36133).f,E=f(78107),N=f(10248),I=f(39839),B=f(56049),z="Array Iterator",Y=k.set,_=k.getterFor(z);v.exports=E(Array,"Array",function(G,te){Y(this,{type:z,target:g(G),index:0,kind:te})},function(){var G=_(this),te=G.target,se=G.kind,R=G.index++;return!te||R>=te.length?(G.target=void 0,N(void 0,!0)):se=="keys"?N(R,!1):se=="values"?N(te[R],!1):N([R,te[R]],!1)},"values");var X=x.Arguments=x.Array;if(b("keys"),b("values"),b("entries"),!I&&B&&X.name!=="values")try{O(X,"name",{value:"values"})}catch{}},91667:()=>{},9754:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(82768),k=f(12461),O=f(90406),E=f(31982),N=f(43152),I=f(28609),B=f(53160),z=f(82850),Y=f(71775),_=String,X=b("JSON","stringify"),G=O(/./.exec),te=O("".charAt),se=O("".charCodeAt),R=O("".replace),ee=O(1 .toString),U=/[\uD800-\uDFFF]/g,re=/^[\uD800-\uDBFF]$/,ne=/^[\uDC00-\uDFFF]$/,ae=!Y||E(function(){var le=b("Symbol")();return X([le])!="[null]"||X({a:le})!="{}"||X(Object(le))!="{}"}),ce=E(function(){return X("\uDF06\uD834")!=='"\\udf06\\ud834"'||X("\uDEAD")!=='"\\udead"'}),V=function(le,pe){var ge=B(arguments),me=z(pe);if(!(!N(me)&&(le===void 0||I(le))))return ge[1]=function($e,Ve){if(N(me)&&(Ve=k(me,this,_($e),Ve)),!I(Ve))return Ve},x(X,null,ge)},K=function(le,pe,ge){var me=te(ge,pe-1),$e=te(ge,pe+1);return G(re,le)&&!G(ne,$e)||G(ne,le)&&!G(re,me)?"\\u"+ee(se(le,0),16):le};X&&g({target:"JSON",stat:!0,arity:3,forced:ae||ce},{stringify:function(pe,ge,me){var $e=B(arguments),Ve=x(ae?V:X,null,$e);return ce&&typeof Ve=="string"?R(Ve,U,K):Ve}})},23870:(v,C,f)=>{var g=f(62447),b=f(98889);b(g.JSON,"JSON",!0)},5828:()=>{},28135:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(98911).f;g({target:"Object",stat:!0,forced:Object.defineProperties!==x,sham:!b},{defineProperties:x})},70829:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(36133).f;g({target:"Object",stat:!0,forced:Object.defineProperty!==x,sham:!b},{defineProperty:x})},51964:(v,C,f)=>{var g=f(30080),b=f(31982),x=f(88966),k=f(80016).f,O=f(56049),E=!O||b(function(){k(1)});g({target:"Object",stat:!0,forced:E,sham:!O},{getOwnPropertyDescriptor:function(I,B){return k(x(I),B)}})},723:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(47813),k=f(88966),O=f(80016),E=f(53437);g({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(I){for(var B=k(I),z=O.f,Y=x(B),_={},X=0,G,te;Y.length>X;)te=z(B,G=Y[X++]),te!==void 0&&E(_,G,te);return _}})},86884:(v,C,f)=>{var g=f(30080),b=f(71775),x=f(31982),k=f(97620),O=f(53254),E=!b||x(function(){k.f(1)});g({target:"Object",stat:!0,forced:E},{getOwnPropertySymbols:function(I){var B=k.f;return B?B(O(I)):[]}})},38339:(v,C,f)=>{var g=f(30080),b=f(53254),x=f(16619),k=f(31982),O=k(function(){x(1)});g({target:"Object",stat:!0,forced:O},{keys:function(N){return x(b(N))}})},97829:()=>{},5708:()=>{},27626:(v,C,f)=>{"use strict";var g=f(18143).charAt,b=f(46025),x=f(44083),k=f(78107),O=f(10248),E="String Iterator",N=x.set,I=x.getterFor(E);k(String,"String",function(B){N(this,{type:E,string:b(B),index:0})},function(){var z=I(this),Y=z.string,_=z.index,X;return _>=Y.length?O(void 0,!0):(X=g(Y,_),z.index+=X.length,O(X,!1))})},95353:(v,C,f)=>{var g=f(64832);g("asyncIterator")},16212:(v,C,f)=>{"use strict";var g=f(30080),b=f(62447),x=f(12461),k=f(90406),O=f(39839),E=f(56049),N=f(71775),I=f(31982),B=f(18768),z=f(15166),Y=f(35970),_=f(88966),X=f(5135),G=f(46025),te=f(54686),se=f(73270),R=f(16619),ee=f(51203),U=f(53515),re=f(97620),ne=f(80016),ae=f(36133),ce=f(98911),V=f(16457),K=f(27519),le=f(37912),pe=f(95976),ge=f(4580),me=f(13477),$e=f(91248),Ve=f(33538),Ye=f(39378),Fe=f(64832),at=f(95679),Dt=f(98889),At=f(44083),qt=f(93935).forEach,Xe=ge("hidden"),Ct="Symbol",xt="prototype",Ot=At.set,fr=At.getterFor(Ct),Ne=Object[xt],wt=b.Symbol,$t=wt&&wt[xt],ht=b.TypeError,Tr=b.QObject,hr=ne.f,Vr=ae.f,Ri=U.f,Pr=V.f,dr=k([].push),pr=pe("symbols"),Kr=pe("op-symbols"),dt=pe("wks"),In=!Tr||!Tr[xt]||!Tr[xt].findChild,ui=E&&I(function(){return se(Vr({},"a",{get:function(){return Vr(this,"a",{value:7}).a}})).a!=7})?function(Ze,Ce,Le){var Pe=hr(Ne,Ce);Pe&&delete Ne[Ce],Vr(Ze,Ce,Le),Pe&&Ze!==Ne&&Vr(Ne,Ce,Pe)}:Vr,bn=function(Ze,Ce){var Le=pr[Ze]=se($t);return Ot(Le,{type:Ct,tag:Ze,description:Ce}),E||(Le.description=Ce),Le},xn=function(Ce,Le,Pe){Ce===Ne&&xn(Kr,Le,Pe),Y(Ce);var $=X(Le);return Y(Pe),B(pr,$)?(Pe.enumerable?(B(Ce,Xe)&&Ce[Xe][$]&&(Ce[Xe][$]=!1),Pe=se(Pe,{enumerable:te(0,!1)})):(B(Ce,Xe)||Vr(Ce,Xe,te(1,{})),Ce[Xe][$]=!0),ui(Ce,$,Pe)):Vr(Ce,$,Pe)},Dn=function(Ce,Le){Y(Ce);var Pe=_(Le),$=R(Pe).concat(hi(Pe));return qt($,function(Z){(!E||x(Nn,Pe,Z))&&xn(Ce,Z,Pe[Z])}),Ce},fi=function(Ce,Le){return Le===void 0?se(Ce):Dn(se(Ce),Le)},Nn=function(Ce){var Le=X(Ce),Pe=x(Pr,this,Le);return this===Ne&&B(pr,Le)&&!B(Kr,Le)?!1:Pe||!B(this,Le)||!B(pr,Le)||B(this,Xe)&&this[Xe][Le]?Pe:!0},Wr=function(Ce,Le){var Pe=_(Ce),$=X(Le);if(!(Pe===Ne&&B(pr,$)&&!B(Kr,$))){var Z=hr(Pe,$);return Z&&B(pr,$)&&!(B(Pe,Xe)&&Pe[Xe][$])&&(Z.enumerable=!0),Z}},Rn=function(Ce){var Le=Ri(_(Ce)),Pe=[];return qt(Le,function($){!B(pr,$)&&!B(me,$)&&dr(Pe,$)}),Pe},hi=function(Ze){var Ce=Ze===Ne,Le=Ri(Ce?Kr:_(Ze)),Pe=[];return qt(Le,function($){B(pr,$)&&(!Ce||B(Ne,$))&&dr(Pe,pr[$])}),Pe};N||(wt=function(){if(z($t,this))throw ht("Symbol is not a constructor");var Ce=!arguments.length||arguments[0]===void 0?void 0:G(arguments[0]),Le=$e(Ce),Pe=function($){this===Ne&&x(Pe,Kr,$),B(this,Xe)&&B(this[Xe],Le)&&(this[Xe][Le]=!1),ui(this,Le,te(1,$))};return E&&In&&ui(Ne,Le,{configurable:!0,set:Pe}),bn(Le,Ce)},$t=wt[xt],K($t,"toString",function(){return fr(this).tag}),K(wt,"withoutSetter",function(Ze){return bn($e(Ze),Ze)}),V.f=Nn,ae.f=xn,ce.f=Dn,ne.f=Wr,ee.f=U.f=Rn,re.f=hi,Ye.f=function(Ze){return bn(Ve(Ze),Ze)},E&&(le($t,"description",{configurable:!0,get:function(){return fr(this).description}}),O||K(Ne,"propertyIsEnumerable",Nn,{unsafe:!0}))),g({global:!0,constructor:!0,wrap:!0,forced:!N,sham:!N},{Symbol:wt}),qt(R(dt),function(Ze){Fe(Ze)}),g({target:Ct,stat:!0,forced:!N},{useSetter:function(){In=!0},useSimple:function(){In=!1}}),g({target:"Object",stat:!0,forced:!N,sham:!E},{create:fi,defineProperty:xn,defineProperties:Dn,getOwnPropertyDescriptor:Wr}),g({target:"Object",stat:!0,forced:!N},{getOwnPropertyNames:Rn}),at(),Dt(wt,Ct),me[Xe]=!0},63906:()=>{},3598:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(18768),k=f(46025),O=f(95976),E=f(82294),N=O("string-to-symbol-registry"),I=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!E},{for:function(B){var z=k(B);if(x(N,z))return N[z];var Y=b("Symbol")(z);return N[z]=Y,I[Y]=z,Y}})},39542:(v,C,f)=>{var g=f(64832);g("hasInstance")},47882:(v,C,f)=>{var g=f(64832);g("isConcatSpreadable")},84911:(v,C,f)=>{var g=f(64832);g("iterator")},68030:(v,C,f)=>{f(16212),f(3598),f(50338),f(9754),f(86884)},50338:(v,C,f)=>{var g=f(30080),b=f(18768),x=f(28609),k=f(18342),O=f(95976),E=f(82294),N=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!E},{keyFor:function(B){if(!x(B))throw TypeError(k(B)+" is not a symbol");if(b(N,B))return N[B]}})},47954:(v,C,f)=>{var g=f(64832);g("matchAll")},88725:(v,C,f)=>{var g=f(64832);g("match")},67703:(v,C,f)=>{var g=f(64832);g("replace")},2220:(v,C,f)=>{var g=f(64832);g("search")},48990:(v,C,f)=>{var g=f(64832);g("species")},50240:(v,C,f)=>{var g=f(64832);g("split")},99921:(v,C,f)=>{var g=f(64832),b=f(95679);g("toPrimitive"),b()},3502:(v,C,f)=>{var g=f(97080),b=f(64832),x=f(98889);b("toStringTag"),x(g("Symbol"),"Symbol")},80220:(v,C,f)=>{var g=f(64832);g("unscopables")},45987:(v,C,f)=>{var g=f(64832);g("asyncDispose")},42319:(v,C,f)=>{var g=f(64832);g("dispose")},58052:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(90406),k=b("Symbol"),O=k.keyFor,E=x(k.prototype.valueOf);g({target:"Symbol",stat:!0},{isRegistered:function(I){try{return O(E(I))!==void 0}catch{return!1}}})},90181:(v,C,f)=>{for(var g=f(30080),b=f(95976),x=f(97080),k=f(90406),O=f(28609),E=f(33538),N=x("Symbol"),I=N.isWellKnown,B=x("Object","getOwnPropertyNames"),z=k(N.prototype.valueOf),Y=b("wks"),_=0,X=B(N),G=X.length;_<G;_++)try{var te=X[_];O(N[te])&&E(te)}catch{}g({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(R){if(I&&I(R))return!0;try{for(var ee=z(R),U=0,re=B(Y),ne=re.length;U<ne;U++)if(Y[re[U]]==ee)return!0}catch{}return!1}})},25129:(v,C,f)=>{var g=f(64832);g("matcher")},90397:(v,C,f)=>{var g=f(64832);g("metadataKey")},82793:(v,C,f)=>{var g=f(64832);g("metadata")},18097:(v,C,f)=>{var g=f(64832);g("observable")},52100:(v,C,f)=>{var g=f(64832);g("patternMatch")},99742:(v,C,f)=>{var g=f(64832);g("replaceAll")},48713:(v,C,f)=>{f(44390);var g=f(81595),b=f(62447),x=f(82059),k=f(20410),O=f(94609),E=f(33538),N=E("toStringTag");for(var I in g){var B=b[I],z=B&&B.prototype;z&&x(z)!==N&&k(z,N,I),O[I]=O.Array}},41544:(v,C,f)=>{var g=f(94537);v.exports=g},44928:(v,C,f)=>{var g=f(55794);v.exports=g},26087:(v,C,f)=>{f(48713);var g=f(82059),b=f(18768),x=f(15166),k=f(41544),O=Array.prototype,E={DOMTokenList:!0,NodeList:!0};v.exports=function(N){var I=N.forEach;return N===O||x(O,N)&&I===O.forEach||b(E,g(N))?k:I}},11783:(v,C,f)=>{var g=f(85838);v.exports=g},88462:(v,C,f)=>{var g=f(95617);v.exports=g},83531:(v,C,f)=>{var g=f(11906);v.exports=g},19941:(v,C,f)=>{var g=f(59123);v.exports=g},25081:(v,C,f)=>{var g=f(63332);v.exports=g},22145:(v,C,f)=>{var g=f(83606);v.exports=g},93690:(v,C,f)=>{var g=f(90660);v.exports=g},8429:(v,C,f)=>{var g=f(49198);f(48713),v.exports=g},13099:(v,C,f)=>{var g=f(15413);f(48713),v.exports=g},44931:(v,C,f)=>{var g=f(4793);v.exports=g},81933:function(){(function(v){var C=function(f){var g={searchParams:"URLSearchParams"in v,iterable:"Symbol"in v&&"iterator"in Symbol,blob:"FileReader"in v&&"Blob"in v&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in v,arrayBuffer:"ArrayBuffer"in v};function b(V){return V&&DataView.prototype.isPrototypeOf(V)}if(g.arrayBuffer)var x=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k=ArrayBuffer.isView||function(V){return V&&x.indexOf(Object.prototype.toString.call(V))>-1};function O(V){if(typeof V!="string"&&(V=String(V)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(V))throw new TypeError("Invalid character in header field name");return V.toLowerCase()}function E(V){return typeof V!="string"&&(V=String(V)),V}function N(V){var K={next:function(){var le=V.shift();return{done:le===void 0,value:le}}};return g.iterable&&(K[Symbol.iterator]=function(){return K}),K}function I(V){this.map={},V instanceof I?V.forEach(function(K,le){this.append(le,K)},this):Array.isArray(V)?V.forEach(function(K){this.append(K[0],K[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(K){this.append(K,V[K])},this)}I.prototype.append=function(V,K){V=O(V),K=E(K);var le=this.map[V];this.map[V]=le?le+", "+K:K},I.prototype.delete=function(V){delete this.map[O(V)]},I.prototype.get=function(V){return V=O(V),this.has(V)?this.map[V]:null},I.prototype.has=function(V){return this.map.hasOwnProperty(O(V))},I.prototype.set=function(V,K){this.map[O(V)]=E(K)},I.prototype.forEach=function(V,K){for(var le in this.map)this.map.hasOwnProperty(le)&&V.call(K,this.map[le],le,this)},I.prototype.keys=function(){var V=[];return this.forEach(function(K,le){V.push(le)}),N(V)},I.prototype.values=function(){var V=[];return this.forEach(function(K){V.push(K)}),N(V)},I.prototype.entries=function(){var V=[];return this.forEach(function(K,le){V.push([le,K])}),N(V)},g.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function B(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function z(V){return new Promise(function(K,le){V.onload=function(){K(V.result)},V.onerror=function(){le(V.error)}})}function Y(V){var K=new FileReader,le=z(K);return K.readAsArrayBuffer(V),le}function _(V){var K=new FileReader,le=z(K);return K.readAsText(V),le}function X(V){for(var K=new Uint8Array(V),le=new Array(K.length),pe=0;pe<K.length;pe++)le[pe]=String.fromCharCode(K[pe]);return le.join("")}function G(V){if(V.slice)return V.slice(0);var K=new Uint8Array(V.byteLength);return K.set(new Uint8Array(V)),K.buffer}function te(){return this.bodyUsed=!1,this._initBody=function(V){this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:g.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:g.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():g.arrayBuffer&&g.blob&&b(V)?(this._bodyArrayBuffer=G(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):g.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||k(V))?this._bodyArrayBuffer=G(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var V=B(this);if(V)return V;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var V=B(this);if(V)return V;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(X(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var se=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(V){var K=V.toUpperCase();return se.indexOf(K)>-1?K:V}function ee(V,K){K=K||{};var le=K.body;if(V instanceof ee){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,K.headers||(this.headers=new I(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!le&&V._bodyInit!=null&&(le=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=K.credentials||this.credentials||"same-origin",(K.headers||!this.headers)&&(this.headers=new I(K.headers)),this.method=R(K.method||this.method||"GET"),this.mode=K.mode||this.mode||null,this.signal=K.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(le)}ee.prototype.clone=function(){return new ee(this,{body:this._bodyInit})};function U(V){var K=new FormData;return V.trim().split("&").forEach(function(le){if(le){var pe=le.split("="),ge=pe.shift().replace(/\+/g," "),me=pe.join("=").replace(/\+/g," ");K.append(decodeURIComponent(ge),decodeURIComponent(me))}}),K}function re(V){var K=new I,le=V.replace(/\r?\n[\t ]+/g," ");return le.split(/\r?\n/).forEach(function(pe){var ge=pe.split(":"),me=ge.shift().trim();if(me){var $e=ge.join(":").trim();K.append(me,$e)}}),K}te.call(ee.prototype);function ne(V,K){K||(K={}),this.type="default",this.status=K.status===void 0?200:K.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in K?K.statusText:"OK",this.headers=new I(K.headers),this.url=K.url||"",this._initBody(V)}te.call(ne.prototype),ne.prototype.clone=function(){return new ne(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},ne.error=function(){var V=new ne(null,{status:0,statusText:""});return V.type="error",V};var ae=[301,302,303,307,308];ne.redirect=function(V,K){if(ae.indexOf(K)===-1)throw new RangeError("Invalid status code");return new ne(null,{status:K,headers:{location:V}})},f.DOMException=v.DOMException;try{new f.DOMException}catch{f.DOMException=function(K,le){this.message=K,this.name=le;var pe=Error(K);this.stack=pe.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function ce(V,K){return new Promise(function(le,pe){var ge=new ee(V,K);if(ge.signal&&ge.signal.aborted)return pe(new f.DOMException("Aborted","AbortError"));var me=new XMLHttpRequest;function $e(){me.abort()}me.onload=function(){var Ve={status:me.status,statusText:me.statusText,headers:re(me.getAllResponseHeaders()||"")};Ve.url="responseURL"in me?me.responseURL:Ve.headers.get("X-Request-URL");var Ye="response"in me?me.response:me.responseText;le(new ne(Ye,Ve))},me.onerror=function(){pe(new TypeError("Network request failed"))},me.ontimeout=function(){pe(new TypeError("Network request failed"))},me.onabort=function(){pe(new f.DOMException("Aborted","AbortError"))},me.open(ge.method,ge.url,!0),ge.credentials==="include"?me.withCredentials=!0:ge.credentials==="omit"&&(me.withCredentials=!1),"responseType"in me&&g.blob&&(me.responseType="blob"),ge.headers.forEach(function(Ve,Ye){me.setRequestHeader(Ye,Ve)}),ge.signal&&(ge.signal.addEventListener("abort",$e),me.onreadystatechange=function(){me.readyState===4&&ge.signal.removeEventListener("abort",$e)}),me.send(typeof ge._bodyInit>"u"?null:ge._bodyInit)})}return ce.polyfill=!0,v.fetch||(v.fetch=ce,v.Headers=I,v.Request=ee,v.Response=ne),f.Headers=I,f.Request=ee,f.Response=ne,f.fetch=ce,Object.defineProperty(f,"__esModule",{value:!0}),f}({})})(typeof self<"u"?self:this)},16068:(v,C,f)=>{"use strict";f.r(C),f.d(C,{Console:()=>WI});var g={};f.r(g),f.d(g,{cookie:()=>Fx,header:()=>Bx,path:()=>Nx,query:()=>Rx});var b=f(10954),x=f(70762),k=f(93652),O=f(11099),E=f(10017),N=f(86351),I=f(86751),B=f(12953),z=f(55839),Y=f(23422);function _(r){return _=typeof z=="function"&&typeof Y=="symbol"?function(e){return typeof e}:function(e){return e&&typeof z=="function"&&e.constructor===z&&e!==z.prototype?"symbol":typeof e},_(r)}var X=f(47319);function G(r,e){if(_(r)!=="object"||r===null)return r;var t=r[X];if(t!==void 0){var n=t.call(r,e||"default");if(_(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function te(r){var e=G(r,"string");return _(e)==="symbol"?e:String(e)}function se(r,e,t){return e=te(e),e in r?B(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function R(r,e){var t=b(r);if(x){var n=x(r);e&&(n=k(n).call(n,function(i){return O(r,i).enumerable})),t.push.apply(t,n)}return t}function ee(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?E(t=R(Object(i),!0)).call(t,function(s){se(r,s,i[s])}):N?I(r,N(i)):E(n=R(Object(i))).call(n,function(s){B(r,s,O(i,s))})}return r}var U=f(34961);function re(r,e){if(r==null)return{};var t={},n=b(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(U(e).call(e,i)>=0)&&(t[i]=r[i]);return t}function ne(r,e){if(r==null)return{};var t=re(r,e),n,i;if(x){var s=x(r);for(i=0;i<s.length;i++)n=s[i],!(U(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}var ae=f(13546),ce=f.n(ae),V=f(51121),K=f(26179);/*!
|
|
11
|
+
*/C.parse=b,C.serialize=x;var f=Object.prototype.toString,g=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;function b(I,B){if(typeof I!="string")throw new TypeError("argument str must be a string");for(var z={},Y=B||{},_=Y.decode||k,X=0;X<I.length;){var G=I.indexOf("=",X);if(G===-1)break;var te=I.indexOf(";",X);if(te===-1)te=I.length;else if(te<G){X=I.lastIndexOf(";",G-1)+1;continue}var se=I.slice(X,G).trim();if(z[se]===void 0){var R=I.slice(G+1,te).trim();R.charCodeAt(0)===34&&(R=R.slice(1,-1)),z[se]=N(R,_)}X=te+1}return z}function x(I,B,z){var Y=z||{},_=Y.encode||O;if(typeof _!="function")throw new TypeError("option encode is invalid");if(!g.test(I))throw new TypeError("argument name is invalid");var X=_(B);if(X&&!g.test(X))throw new TypeError("argument val is invalid");var G=I+"="+X;if(Y.maxAge!=null){var te=Y.maxAge-0;if(isNaN(te)||!isFinite(te))throw new TypeError("option maxAge is invalid");G+="; Max-Age="+Math.floor(te)}if(Y.domain){if(!g.test(Y.domain))throw new TypeError("option domain is invalid");G+="; Domain="+Y.domain}if(Y.path){if(!g.test(Y.path))throw new TypeError("option path is invalid");G+="; Path="+Y.path}if(Y.expires){var se=Y.expires;if(!E(se)||isNaN(se.valueOf()))throw new TypeError("option expires is invalid");G+="; Expires="+se.toUTCString()}if(Y.httpOnly&&(G+="; HttpOnly"),Y.secure&&(G+="; Secure"),Y.priority){var R=typeof Y.priority=="string"?Y.priority.toLowerCase():Y.priority;switch(R){case"low":G+="; Priority=Low";break;case"medium":G+="; Priority=Medium";break;case"high":G+="; Priority=High";break;default:throw new TypeError("option priority is invalid")}}if(Y.sameSite){var ee=typeof Y.sameSite=="string"?Y.sameSite.toLowerCase():Y.sameSite;switch(ee){case!0:G+="; SameSite=Strict";break;case"lax":G+="; SameSite=Lax";break;case"strict":G+="; SameSite=Strict";break;case"none":G+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return G}function k(I){return I.indexOf("%")!==-1?decodeURIComponent(I):I}function O(I){return encodeURIComponent(I)}function E(I){return f.call(I)==="[object Date]"||I instanceof Date}function N(I,B){try{return B(I)}catch{return I}}},97529:(v,C,f)=>{var g=f(44928);v.exports=g},75342:(v,C,f)=>{var g=f(26087);v.exports=g},64218:(v,C,f)=>{var g=f(11783);v.exports=g},95050:(v,C,f)=>{var g=f(88462);v.exports=g},84779:(v,C,f)=>{var g=f(83531);v.exports=g},17190:(v,C,f)=>{var g=f(19941);v.exports=g},96589:(v,C,f)=>{var g=f(25081);v.exports=g},32276:(v,C,f)=>{var g=f(22145);v.exports=g},15064:(v,C,f)=>{var g=f(93690);v.exports=g},31986:(v,C,f)=>{var g=f(8429);f(42319),v.exports=g},69635:(v,C,f)=>{var g=f(13099);v.exports=g},3529:(v,C,f)=>{var g=f(44931);v.exports=g},85373:(v,C,f)=>{f(17802);var g=f(70291);v.exports=g("Array").filter},94537:(v,C,f)=>{f(64009);var g=f(70291);v.exports=g("Array").forEach},27794:(v,C,f)=>{f(32449);var g=f(70291);v.exports=g("Array").indexOf},55794:(v,C,f)=>{var g=f(15166),b=f(85373),x=Array.prototype;v.exports=function(k){var O=k.filter;return k===x||g(x,k)&&O===x.filter?b:O}},85838:(v,C,f)=>{var g=f(15166),b=f(27794),x=Array.prototype;v.exports=function(k){var O=k.indexOf;return k===x||g(x,k)&&O===x.indexOf?b:O}},95617:(v,C,f)=>{f(28135);var g=f(59921),b=g.Object,x=v.exports=function(O,E){return b.defineProperties(O,E)};b.defineProperties.sham&&(x.sham=!0)},11906:(v,C,f)=>{f(70829);var g=f(59921),b=g.Object,x=v.exports=function(O,E,N){return b.defineProperty(O,E,N)};b.defineProperty.sham&&(x.sham=!0)},59123:(v,C,f)=>{f(51964);var g=f(59921),b=g.Object,x=v.exports=function(O,E){return b.getOwnPropertyDescriptor(O,E)};b.getOwnPropertyDescriptor.sham&&(x.sham=!0)},63332:(v,C,f)=>{f(723);var g=f(59921);v.exports=g.Object.getOwnPropertyDescriptors},83606:(v,C,f)=>{f(68030);var g=f(59921);v.exports=g.Object.getOwnPropertySymbols},90660:(v,C,f)=>{f(38339);var g=f(59921);v.exports=g.Object.keys},49198:(v,C,f)=>{f(69825),f(97829),f(68030),f(95353),f(63906),f(39542),f(47882),f(84911),f(88725),f(47954),f(67703),f(2220),f(48990),f(50240),f(99921),f(3502),f(80220),f(23870),f(5828),f(5708);var g=f(59921);v.exports=g.Symbol},15413:(v,C,f)=>{f(44390),f(97829),f(27626),f(84911);var g=f(39378);v.exports=g.f("iterator")},4793:(v,C,f)=>{f(91667),f(99921);var g=f(39378);v.exports=g.f("toPrimitive")},24018:(v,C,f)=>{v.exports=f(11226)},27411:(v,C,f)=>{v.exports=f(39743)},79155:(v,C,f)=>{v.exports=f(17018)},13375:(v,C,f)=>{v.exports=f(45057)},95442:(v,C,f)=>{v.exports=f(97947)},55334:(v,C,f)=>{v.exports=f(26452)},48261:(v,C,f)=>{v.exports=f(4477)},92864:(v,C,f)=>{v.exports=f(74013)},27923:(v,C,f)=>{v.exports=f(17685)},89225:(v,C,f)=>{v.exports=f(2371)},95281:(v,C,f)=>{v.exports=f(89061)},55468:(v,C,f)=>{v.exports=f(51553)},11226:(v,C,f)=>{var g=f(97529);v.exports=g},39743:(v,C,f)=>{var g=f(75342);v.exports=g},17018:(v,C,f)=>{var g=f(64218);v.exports=g},45057:(v,C,f)=>{var g=f(95050);v.exports=g},97947:(v,C,f)=>{var g=f(84779);v.exports=g},26452:(v,C,f)=>{var g=f(17190);v.exports=g},4477:(v,C,f)=>{var g=f(96589);v.exports=g},74013:(v,C,f)=>{var g=f(32276);v.exports=g},17685:(v,C,f)=>{var g=f(15064);v.exports=g},2371:(v,C,f)=>{var g=f(31986);f(45987),f(58052),f(90181),f(25129),f(90397),f(18097),f(82793),f(52100),f(99742),v.exports=g},89061:(v,C,f)=>{var g=f(69635);v.exports=g},51553:(v,C,f)=>{var g=f(3529);v.exports=g},81970:(v,C,f)=>{var g=f(43152),b=f(18342),x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not a function")}},72185:(v,C,f)=>{var g=f(43152),b=String,x=TypeError;v.exports=function(k){if(typeof k=="object"||g(k))return k;throw x("Can't set "+b(k)+" as a prototype")}},20844:v=>{v.exports=function(){}},35970:(v,C,f)=>{var g=f(92548),b=String,x=TypeError;v.exports=function(k){if(g(k))return k;throw x(b(k)+" is not an object")}},24782:(v,C,f)=>{"use strict";var g=f(93935).forEach,b=f(10454),x=b("forEach");v.exports=x?[].forEach:function(O){return g(this,O,arguments.length>1?arguments[1]:void 0)}},66322:(v,C,f)=>{var g=f(88966),b=f(13249),x=f(53387),k=function(O){return function(E,N,I){var B=g(E),z=x(B),Y=b(I,z),_;if(O&&N!=N){for(;z>Y;)if(_=B[Y++],_!=_)return!0}else for(;z>Y;Y++)if((O||Y in B)&&B[Y]===N)return O||Y||0;return!O&&-1}};v.exports={includes:k(!0),indexOf:k(!1)}},93935:(v,C,f)=>{var g=f(7416),b=f(90406),x=f(38622),k=f(53254),O=f(53387),E=f(69573),N=b([].push),I=function(B){var z=B==1,Y=B==2,_=B==3,X=B==4,G=B==6,te=B==7,se=B==5||G;return function(R,ee,U,re){for(var ne=k(R),ae=x(ne),ce=g(ee,U),V=O(ae),K=0,le=re||E,pe=z?le(R,V):Y||te?le(R,0):void 0,ge,me;V>K;K++)if((se||K in ae)&&(ge=ae[K],me=ce(ge,K,ne),B))if(z)pe[K]=me;else if(me)switch(B){case 3:return!0;case 5:return ge;case 6:return K;case 2:N(pe,ge)}else switch(B){case 4:return!1;case 7:N(pe,ge)}return G?-1:_||X?X:pe}};v.exports={forEach:I(0),map:I(1),filter:I(2),some:I(3),every:I(4),find:I(5),findIndex:I(6),filterReject:I(7)}},36844:(v,C,f)=>{var g=f(31982),b=f(33538),x=f(32438),k=b("species");v.exports=function(O){return x>=51||!g(function(){var E=[],N=E.constructor={};return N[k]=function(){return{foo:1}},E[O](Boolean).foo!==1})}},10454:(v,C,f)=>{"use strict";var g=f(31982);v.exports=function(b,x){var k=[][b];return!!k&&g(function(){k.call(null,x||function(){return 1},1)})}},67932:(v,C,f)=>{var g=f(13249),b=f(53387),x=f(53437),k=Array,O=Math.max;v.exports=function(E,N,I){for(var B=b(E),z=g(N,B),Y=g(I===void 0?B:I,B),_=k(O(Y-z,0)),X=0;z<Y;z++,X++)x(_,X,E[z]);return _.length=X,_}},53160:(v,C,f)=>{var g=f(90406);v.exports=g([].slice)},76562:(v,C,f)=>{var g=f(93053),b=f(43455),x=f(92548),k=f(33538),O=k("species"),E=Array;v.exports=function(N){var I;return g(N)&&(I=N.constructor,b(I)&&(I===E||g(I.prototype))?I=void 0:x(I)&&(I=I[O],I===null&&(I=void 0))),I===void 0?E:I}},69573:(v,C,f)=>{var g=f(76562);v.exports=function(b,x){return new(g(b))(x===0?0:x)}},58310:(v,C,f)=>{var g=f(90406),b=g({}.toString),x=g("".slice);v.exports=function(k){return x(b(k),8,-1)}},82059:(v,C,f)=>{var g=f(48448),b=f(43152),x=f(58310),k=f(33538),O=k("toStringTag"),E=Object,N=x(function(){return arguments}())=="Arguments",I=function(B,z){try{return B[z]}catch{}};v.exports=g?x:function(B){var z,Y,_;return B===void 0?"Undefined":B===null?"Null":typeof(Y=I(z=E(B),O))=="string"?Y:N?x(z):(_=x(z))=="Object"&&b(z.callee)?"Arguments":_}},74838:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){function b(){}return b.prototype.constructor=null,Object.getPrototypeOf(new b)!==b.prototype})},10248:v=>{v.exports=function(C,f){return{value:C,done:f}}},20410:(v,C,f)=>{var g=f(56049),b=f(36133),x=f(54686);v.exports=g?function(k,O,E){return b.f(k,O,x(1,E))}:function(k,O,E){return k[O]=E,k}},54686:v=>{v.exports=function(C,f){return{enumerable:!(C&1),configurable:!(C&2),writable:!(C&4),value:f}}},53437:(v,C,f)=>{"use strict";var g=f(5135),b=f(36133),x=f(54686);v.exports=function(k,O,E){var N=g(O);N in k?b.f(k,N,x(0,E)):k[N]=E}},37912:(v,C,f)=>{var g=f(36133);v.exports=function(b,x,k){return g.f(b,x,k)}},27519:(v,C,f)=>{var g=f(20410);v.exports=function(b,x,k,O){return O&&O.enumerable?b[x]=k:g(b,x,k),b}},9267:(v,C,f)=>{var g=f(62447),b=Object.defineProperty;v.exports=function(x,k){try{b(g,x,{value:k,configurable:!0,writable:!0})}catch{g[x]=k}return k}},56049:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!=7})},51647:v=>{var C=typeof document=="object"&&document.all,f=typeof C>"u"&&C!==void 0;v.exports={all:C,IS_HTMLDDA:f}},45511:(v,C,f)=>{var g=f(62447),b=f(92548),x=g.document,k=b(x)&&b(x.createElement);v.exports=function(O){return k?x.createElement(O):{}}},11452:v=>{var C=TypeError,f=9007199254740991;v.exports=function(g){if(g>f)throw C("Maximum allowed index exceeded");return g}},81595:v=>{v.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},90740:v=>{v.exports=typeof navigator<"u"&&String(navigator.userAgent)||""},32438:(v,C,f)=>{var g=f(62447),b=f(90740),x=g.process,k=g.Deno,O=x&&x.versions||k&&k.version,E=O&&O.v8,N,I;E&&(N=E.split("."),I=N[0]>0&&N[0]<4?1:+(N[0]+N[1])),!I&&b&&(N=b.match(/Edge\/(\d+)/),(!N||N[1]>=74)&&(N=b.match(/Chrome\/(\d+)/),N&&(I=+N[1]))),v.exports=I},70291:(v,C,f)=>{var g=f(59921);v.exports=function(b){return g[b+"Prototype"]}},11792:v=>{v.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},30080:(v,C,f)=>{"use strict";var g=f(62447),b=f(82768),x=f(57953),k=f(43152),O=f(80016).f,E=f(51585),N=f(59921),I=f(7416),B=f(20410),z=f(18768),Y=function(_){var X=function(G,te,se){if(this instanceof X){switch(arguments.length){case 0:return new _;case 1:return new _(G);case 2:return new _(G,te)}return new _(G,te,se)}return b(_,this,arguments)};return X.prototype=_.prototype,X};v.exports=function(_,X){var G=_.target,te=_.global,se=_.stat,R=_.proto,ee=te?g:se?g[G]:(g[G]||{}).prototype,U=te?N:N[G]||B(N,G,{})[G],re=U.prototype,ne,ae,ce,V,K,le,pe,ge,me;for(V in X)ne=E(te?V:G+(se?".":"#")+V,_.forced),ae=!ne&&ee&&z(ee,V),le=U[V],ae&&(_.dontCallGetSet?(me=O(ee,V),pe=me&&me.value):pe=ee[V]),K=ae&&pe?pe:X[V],!(ae&&typeof le==typeof K)&&(_.bind&&ae?ge=I(K,g):_.wrap&&ae?ge=Y(K):R&&k(K)?ge=x(K):ge=K,(_.sham||K&&K.sham||le&&le.sham)&&B(ge,"sham",!0),B(U,V,ge),R&&(ce=G+"Prototype",z(N,ce)||B(N,ce,{}),B(N[ce],V,K),_.real&&re&&(ne||!re[V])&&B(re,V,K)))}},31982:v=>{v.exports=function(C){try{return!!C()}catch{return!0}}},82768:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.apply,k=b.call;v.exports=typeof Reflect=="object"&&Reflect.apply||(g?k.bind(x):function(){return k.apply(x,arguments)})},7416:(v,C,f)=>{var g=f(57953),b=f(81970),x=f(97966),k=g(g.bind);v.exports=function(O,E){return b(O),E===void 0?O:x?k(O,E):function(){return O.apply(E,arguments)}}},97966:(v,C,f)=>{var g=f(31982);v.exports=!g(function(){var b=function(){}.bind();return typeof b!="function"||b.hasOwnProperty("prototype")})},12461:(v,C,f)=>{var g=f(97966),b=Function.prototype.call;v.exports=g?b.bind(b):function(){return b.apply(b,arguments)}},58100:(v,C,f)=>{var g=f(56049),b=f(18768),x=Function.prototype,k=g&&Object.getOwnPropertyDescriptor,O=b(x,"name"),E=O&&function(){}.name==="something",N=O&&(!g||g&&k(x,"name").configurable);v.exports={EXISTS:O,PROPER:E,CONFIGURABLE:N}},54518:(v,C,f)=>{var g=f(90406),b=f(81970);v.exports=function(x,k,O){try{return g(b(Object.getOwnPropertyDescriptor(x,k)[O]))}catch{}}},57953:(v,C,f)=>{var g=f(58310),b=f(90406);v.exports=function(x){if(g(x)==="Function")return b(x)}},90406:(v,C,f)=>{var g=f(97966),b=Function.prototype,x=b.call,k=g&&b.bind.bind(x,x);v.exports=g?k:function(O){return function(){return x.apply(O,arguments)}}},97080:(v,C,f)=>{var g=f(59921),b=f(62447),x=f(43152),k=function(O){return x(O)?O:void 0};v.exports=function(O,E){return arguments.length<2?k(g[O])||k(b[O]):g[O]&&g[O][E]||b[O]&&b[O][E]}},82850:(v,C,f)=>{var g=f(90406),b=f(93053),x=f(43152),k=f(58310),O=f(46025),E=g([].push);v.exports=function(N){if(x(N))return N;if(b(N)){for(var I=N.length,B=[],z=0;z<I;z++){var Y=N[z];typeof Y=="string"?E(B,Y):(typeof Y=="number"||k(Y)=="Number"||k(Y)=="String")&&E(B,O(Y))}var _=B.length,X=!0;return function(G,te){if(X)return X=!1,te;if(b(this))return te;for(var se=0;se<_;se++)if(B[se]===G)return te}}}},27529:(v,C,f)=>{var g=f(81970),b=f(71365);v.exports=function(x,k){var O=x[k];return b(O)?void 0:g(O)}},62447:(v,C,f)=>{var g=function(b){return b&&b.Math==Math&&b};v.exports=g(typeof globalThis=="object"&&globalThis)||g(typeof window=="object"&&window)||g(typeof self=="object"&&self)||g(typeof f.g=="object"&&f.g)||function(){return this}()||Function("return this")()},18768:(v,C,f)=>{var g=f(90406),b=f(53254),x=g({}.hasOwnProperty);v.exports=Object.hasOwn||function(O,E){return x(b(O),E)}},13477:v=>{v.exports={}},19552:(v,C,f)=>{var g=f(97080);v.exports=g("document","documentElement")},11314:(v,C,f)=>{var g=f(56049),b=f(31982),x=f(45511);v.exports=!g&&!b(function(){return Object.defineProperty(x("div"),"a",{get:function(){return 7}}).a!=7})},38622:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(58310),k=Object,O=g("".split);v.exports=b(function(){return!k("z").propertyIsEnumerable(0)})?function(E){return x(E)=="String"?O(E,""):k(E)}:k},41524:(v,C,f)=>{var g=f(90406),b=f(43152),x=f(70716),k=g(Function.toString);b(x.inspectSource)||(x.inspectSource=function(O){return k(O)}),v.exports=x.inspectSource},44083:(v,C,f)=>{var g=f(57761),b=f(62447),x=f(92548),k=f(20410),O=f(18768),E=f(70716),N=f(4580),I=f(13477),B="Object already initialized",z=b.TypeError,Y=b.WeakMap,_,X,G,te=function(U){return G(U)?X(U):_(U,{})},se=function(U){return function(re){var ne;if(!x(re)||(ne=X(re)).type!==U)throw z("Incompatible receiver, "+U+" required");return ne}};if(g||E.state){var R=E.state||(E.state=new Y);R.get=R.get,R.has=R.has,R.set=R.set,_=function(U,re){if(R.has(U))throw z(B);return re.facade=U,R.set(U,re),re},X=function(U){return R.get(U)||{}},G=function(U){return R.has(U)}}else{var ee=N("state");I[ee]=!0,_=function(U,re){if(O(U,ee))throw z(B);return re.facade=U,k(U,ee,re),re},X=function(U){return O(U,ee)?U[ee]:{}},G=function(U){return O(U,ee)}}v.exports={set:_,get:X,has:G,enforce:te,getterFor:se}},93053:(v,C,f)=>{var g=f(58310);v.exports=Array.isArray||function(x){return g(x)=="Array"}},43152:(v,C,f)=>{var g=f(51647),b=g.all;v.exports=g.IS_HTMLDDA?function(x){return typeof x=="function"||x===b}:function(x){return typeof x=="function"}},43455:(v,C,f)=>{var g=f(90406),b=f(31982),x=f(43152),k=f(82059),O=f(97080),E=f(41524),N=function(){},I=[],B=O("Reflect","construct"),z=/^\s*(?:class|function)\b/,Y=g(z.exec),_=!z.exec(N),X=function(se){if(!x(se))return!1;try{return B(N,I,se),!0}catch{return!1}},G=function(se){if(!x(se))return!1;switch(k(se)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _||!!Y(z,E(se))}catch{return!0}};G.sham=!0,v.exports=!B||b(function(){var te;return X(X.call)||!X(Object)||!X(function(){te=!0})||te})?G:X},51585:(v,C,f)=>{var g=f(31982),b=f(43152),x=/#|\.prototype\./,k=function(B,z){var Y=E[O(B)];return Y==I?!0:Y==N?!1:b(z)?g(z):!!z},O=k.normalize=function(B){return String(B).replace(x,".").toLowerCase()},E=k.data={},N=k.NATIVE="N",I=k.POLYFILL="P";v.exports=k},71365:v=>{v.exports=function(C){return C==null}},92548:(v,C,f)=>{var g=f(43152),b=f(51647),x=b.all;v.exports=b.IS_HTMLDDA?function(k){return typeof k=="object"?k!==null:g(k)||k===x}:function(k){return typeof k=="object"?k!==null:g(k)}},39839:v=>{v.exports=!0},28609:(v,C,f)=>{var g=f(97080),b=f(43152),x=f(15166),k=f(27237),O=Object;v.exports=k?function(E){return typeof E=="symbol"}:function(E){var N=g("Symbol");return b(N)&&x(N.prototype,O(E))}},41709:(v,C,f)=>{"use strict";var g=f(98488).IteratorPrototype,b=f(73270),x=f(54686),k=f(98889),O=f(94609),E=function(){return this};v.exports=function(N,I,B,z){var Y=I+" Iterator";return N.prototype=b(g,{next:x(+!z,B)}),k(N,Y,!1,!0),O[Y]=E,N}},78107:(v,C,f)=>{"use strict";var g=f(30080),b=f(12461),x=f(39839),k=f(58100),O=f(43152),E=f(41709),N=f(90851),I=f(70738),B=f(98889),z=f(20410),Y=f(27519),_=f(33538),X=f(94609),G=f(98488),te=k.PROPER,se=k.CONFIGURABLE,R=G.IteratorPrototype,ee=G.BUGGY_SAFARI_ITERATORS,U=_("iterator"),re="keys",ne="values",ae="entries",ce=function(){return this};v.exports=function(V,K,le,pe,ge,me,$e){E(le,K,pe);var Ve=function(Ot){if(Ot===ge&&At)return At;if(!ee&&Ot in at)return at[Ot];switch(Ot){case re:return function(){return new le(this,Ot)};case ne:return function(){return new le(this,Ot)};case ae:return function(){return new le(this,Ot)}}return function(){return new le(this)}},Ye=K+" Iterator",Fe=!1,at=V.prototype,Dt=at[U]||at["@@iterator"]||ge&&at[ge],At=!ee&&Dt||Ve(ge),qt=K=="Array"&&at.entries||Dt,Xe,Ct,xt;if(qt&&(Xe=N(qt.call(new V)),Xe!==Object.prototype&&Xe.next&&(!x&&N(Xe)!==R&&(I?I(Xe,R):O(Xe[U])||Y(Xe,U,ce)),B(Xe,Ye,!0,!0),x&&(X[Ye]=ce))),te&&ge==ne&&Dt&&Dt.name!==ne&&(!x&&se?z(at,"name",ne):(Fe=!0,At=function(){return b(Dt,this)})),ge)if(Ct={values:Ve(ne),keys:me?At:Ve(re),entries:Ve(ae)},$e)for(xt in Ct)(ee||Fe||!(xt in at))&&Y(at,xt,Ct[xt]);else g({target:K,proto:!0,forced:ee||Fe},Ct);return(!x||$e)&&at[U]!==At&&Y(at,U,At,{name:ge}),X[K]=At,Ct}},98488:(v,C,f)=>{"use strict";var g=f(31982),b=f(43152),x=f(92548),k=f(73270),O=f(90851),E=f(27519),N=f(33538),I=f(39839),B=N("iterator"),z=!1,Y,_,X;[].keys&&(X=[].keys(),"next"in X?(_=O(O(X)),_!==Object.prototype&&(Y=_)):z=!0);var G=!x(Y)||g(function(){var te={};return Y[B].call(te)!==te});G?Y={}:I&&(Y=k(Y)),b(Y[B])||E(Y,B,function(){return this}),v.exports={IteratorPrototype:Y,BUGGY_SAFARI_ITERATORS:z}},94609:v=>{v.exports={}},53387:(v,C,f)=>{var g=f(62567);v.exports=function(b){return g(b.length)}},99295:v=>{var C=Math.ceil,f=Math.floor;v.exports=Math.trunc||function(b){var x=+b;return(x>0?f:C)(x)}},73270:(v,C,f)=>{var g=f(35970),b=f(98911),x=f(11792),k=f(13477),O=f(19552),E=f(45511),N=f(4580),I=">",B="<",z="prototype",Y="script",_=N("IE_PROTO"),X=function(){},G=function(U){return B+Y+I+U+B+"/"+Y+I},te=function(U){U.write(G("")),U.close();var re=U.parentWindow.Object;return U=null,re},se=function(){var U=E("iframe"),re="java"+Y+":",ne;return U.style.display="none",O.appendChild(U),U.src=String(re),ne=U.contentWindow.document,ne.open(),ne.write(G("document.F=Object")),ne.close(),ne.F},R,ee=function(){try{R=new ActiveXObject("htmlfile")}catch{}ee=typeof document<"u"?document.domain&&R?te(R):se():te(R);for(var U=x.length;U--;)delete ee[z][x[U]];return ee()};k[_]=!0,v.exports=Object.create||function(re,ne){var ae;return re!==null?(X[z]=g(re),ae=new X,X[z]=null,ae[_]=re):ae=ee(),ne===void 0?ae:b.f(ae,ne)}},98911:(v,C,f)=>{var g=f(56049),b=f(98715),x=f(36133),k=f(35970),O=f(88966),E=f(16619);C.f=g&&!b?Object.defineProperties:function(I,B){k(I);for(var z=O(B),Y=E(B),_=Y.length,X=0,G;_>X;)x.f(I,G=Y[X++],z[G]);return I}},36133:(v,C,f)=>{var g=f(56049),b=f(11314),x=f(98715),k=f(35970),O=f(5135),E=TypeError,N=Object.defineProperty,I=Object.getOwnPropertyDescriptor,B="enumerable",z="configurable",Y="writable";C.f=g?x?function(X,G,te){if(k(X),G=O(G),k(te),typeof X=="function"&&G==="prototype"&&"value"in te&&Y in te&&!te[Y]){var se=I(X,G);se&&se[Y]&&(X[G]=te.value,te={configurable:z in te?te[z]:se[z],enumerable:B in te?te[B]:se[B],writable:!1})}return N(X,G,te)}:N:function(X,G,te){if(k(X),G=O(G),k(te),b)try{return N(X,G,te)}catch{}if("get"in te||"set"in te)throw E("Accessors not supported");return"value"in te&&(X[G]=te.value),X}},80016:(v,C,f)=>{var g=f(56049),b=f(12461),x=f(16457),k=f(54686),O=f(88966),E=f(5135),N=f(18768),I=f(11314),B=Object.getOwnPropertyDescriptor;C.f=g?B:function(Y,_){if(Y=O(Y),_=E(_),I)try{return B(Y,_)}catch{}if(N(Y,_))return k(!b(x.f,Y,_),Y[_])}},53515:(v,C,f)=>{var g=f(58310),b=f(88966),x=f(51203).f,k=f(67932),O=typeof window=="object"&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],E=function(N){try{return x(N)}catch{return k(O)}};v.exports.f=function(I){return O&&g(I)=="Window"?E(I):x(b(I))}},51203:(v,C,f)=>{var g=f(4541),b=f(11792),x=b.concat("length","prototype");C.f=Object.getOwnPropertyNames||function(O){return g(O,x)}},97620:(v,C)=>{C.f=Object.getOwnPropertySymbols},90851:(v,C,f)=>{var g=f(18768),b=f(43152),x=f(53254),k=f(4580),O=f(74838),E=k("IE_PROTO"),N=Object,I=N.prototype;v.exports=O?N.getPrototypeOf:function(B){var z=x(B);if(g(z,E))return z[E];var Y=z.constructor;return b(Y)&&z instanceof Y?Y.prototype:z instanceof N?I:null}},15166:(v,C,f)=>{var g=f(90406);v.exports=g({}.isPrototypeOf)},4541:(v,C,f)=>{var g=f(90406),b=f(18768),x=f(88966),k=f(66322).indexOf,O=f(13477),E=g([].push);v.exports=function(N,I){var B=x(N),z=0,Y=[],_;for(_ in B)!b(O,_)&&b(B,_)&&E(Y,_);for(;I.length>z;)b(B,_=I[z++])&&(~k(Y,_)||E(Y,_));return Y}},16619:(v,C,f)=>{var g=f(4541),b=f(11792);v.exports=Object.keys||function(k){return g(k,b)}},16457:(v,C)=>{"use strict";var f={}.propertyIsEnumerable,g=Object.getOwnPropertyDescriptor,b=g&&!f.call({1:2},1);C.f=b?function(k){var O=g(this,k);return!!O&&O.enumerable}:f},70738:(v,C,f)=>{var g=f(54518),b=f(35970),x=f(72185);v.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var k=!1,O={},E;try{E=g(Object.prototype,"__proto__","set"),E(O,[]),k=O instanceof Array}catch{}return function(I,B){return b(I),x(B),k?E(I,B):I.__proto__=B,I}}():void 0)},68399:(v,C,f)=>{"use strict";var g=f(48448),b=f(82059);v.exports=g?{}.toString:function(){return"[object "+b(this)+"]"}},96380:(v,C,f)=>{var g=f(12461),b=f(43152),x=f(92548),k=TypeError;v.exports=function(O,E){var N,I;if(E==="string"&&b(N=O.toString)&&!x(I=g(N,O))||b(N=O.valueOf)&&!x(I=g(N,O))||E!=="string"&&b(N=O.toString)&&!x(I=g(N,O)))return I;throw k("Can't convert object to primitive value")}},47813:(v,C,f)=>{var g=f(97080),b=f(90406),x=f(51203),k=f(97620),O=f(35970),E=b([].concat);v.exports=g("Reflect","ownKeys")||function(I){var B=x.f(O(I)),z=k.f;return z?E(B,z(I)):B}},59921:v=>{v.exports={}},31251:(v,C,f)=>{var g=f(71365),b=TypeError;v.exports=function(x){if(g(x))throw b("Can't call method on "+x);return x}},98889:(v,C,f)=>{var g=f(48448),b=f(36133).f,x=f(20410),k=f(18768),O=f(68399),E=f(33538),N=E("toStringTag");v.exports=function(I,B,z,Y){if(I){var _=z?I:I.prototype;k(_,N)||b(_,N,{configurable:!0,value:B}),Y&&!g&&x(_,"toString",O)}}},4580:(v,C,f)=>{var g=f(95976),b=f(91248),x=g("keys");v.exports=function(k){return x[k]||(x[k]=b(k))}},70716:(v,C,f)=>{var g=f(62447),b=f(9267),x="__core-js_shared__",k=g[x]||b(x,{});v.exports=k},95976:(v,C,f)=>{var g=f(39839),b=f(70716);(v.exports=function(x,k){return b[x]||(b[x]=k!==void 0?k:{})})("versions",[]).push({version:"3.29.1",mode:g?"pure":"global",copyright:"\xA9 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},18143:(v,C,f)=>{var g=f(90406),b=f(32041),x=f(46025),k=f(31251),O=g("".charAt),E=g("".charCodeAt),N=g("".slice),I=function(B){return function(z,Y){var _=x(k(z)),X=b(Y),G=_.length,te,se;return X<0||X>=G?B?"":void 0:(te=E(_,X),te<55296||te>56319||X+1===G||(se=E(_,X+1))<56320||se>57343?B?O(_,X):te:B?N(_,X,X+2):(te-55296<<10)+(se-56320)+65536)}};v.exports={codeAt:I(!1),charAt:I(!0)}},71775:(v,C,f)=>{var g=f(32438),b=f(31982);v.exports=!!Object.getOwnPropertySymbols&&!b(function(){var x=Symbol();return!String(x)||!(Object(x)instanceof Symbol)||!Symbol.sham&&g&&g<41})},95679:(v,C,f)=>{var g=f(12461),b=f(97080),x=f(33538),k=f(27519);v.exports=function(){var O=b("Symbol"),E=O&&O.prototype,N=E&&E.valueOf,I=x("toPrimitive");E&&!E[I]&&k(E,I,function(B){return g(N,this)},{arity:1})}},82294:(v,C,f)=>{var g=f(71775);v.exports=g&&!!Symbol.for&&!!Symbol.keyFor},13249:(v,C,f)=>{var g=f(32041),b=Math.max,x=Math.min;v.exports=function(k,O){var E=g(k);return E<0?b(E+O,0):x(E,O)}},88966:(v,C,f)=>{var g=f(38622),b=f(31251);v.exports=function(x){return g(b(x))}},32041:(v,C,f)=>{var g=f(99295);v.exports=function(b){var x=+b;return x!==x||x===0?0:g(x)}},62567:(v,C,f)=>{var g=f(32041),b=Math.min;v.exports=function(x){return x>0?b(g(x),9007199254740991):0}},53254:(v,C,f)=>{var g=f(31251),b=Object;v.exports=function(x){return b(g(x))}},37505:(v,C,f)=>{var g=f(12461),b=f(92548),x=f(28609),k=f(27529),O=f(96380),E=f(33538),N=TypeError,I=E("toPrimitive");v.exports=function(B,z){if(!b(B)||x(B))return B;var Y=k(B,I),_;if(Y){if(z===void 0&&(z="default"),_=g(Y,B,z),!b(_)||x(_))return _;throw N("Can't convert object to primitive value")}return z===void 0&&(z="number"),O(B,z)}},5135:(v,C,f)=>{var g=f(37505),b=f(28609);v.exports=function(x){var k=g(x,"string");return b(k)?k:k+""}},48448:(v,C,f)=>{var g=f(33538),b=g("toStringTag"),x={};x[b]="z",v.exports=String(x)==="[object z]"},46025:(v,C,f)=>{var g=f(82059),b=String;v.exports=function(x){if(g(x)==="Symbol")throw TypeError("Cannot convert a Symbol value to a string");return b(x)}},18342:v=>{var C=String;v.exports=function(f){try{return C(f)}catch{return"Object"}}},91248:(v,C,f)=>{var g=f(90406),b=0,x=Math.random(),k=g(1 .toString);v.exports=function(O){return"Symbol("+(O===void 0?"":O)+")_"+k(++b+x,36)}},27237:(v,C,f)=>{var g=f(71775);v.exports=g&&!Symbol.sham&&typeof Symbol.iterator=="symbol"},98715:(v,C,f)=>{var g=f(56049),b=f(31982);v.exports=g&&b(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!=42})},57761:(v,C,f)=>{var g=f(62447),b=f(43152),x=g.WeakMap;v.exports=b(x)&&/native code/.test(String(x))},64832:(v,C,f)=>{var g=f(59921),b=f(18768),x=f(39378),k=f(36133).f;v.exports=function(O){var E=g.Symbol||(g.Symbol={});b(E,O)||k(E,O,{value:x.f(O)})}},39378:(v,C,f)=>{var g=f(33538);C.f=g},33538:(v,C,f)=>{var g=f(62447),b=f(95976),x=f(18768),k=f(91248),O=f(71775),E=f(27237),N=g.Symbol,I=b("wks"),B=E?N.for||N:N&&N.withoutSetter||k;v.exports=function(z){return x(I,z)||(I[z]=O&&x(N,z)?N[z]:B("Symbol."+z)),I[z]}},69825:(v,C,f)=>{"use strict";var g=f(30080),b=f(31982),x=f(93053),k=f(92548),O=f(53254),E=f(53387),N=f(11452),I=f(53437),B=f(69573),z=f(36844),Y=f(33538),_=f(32438),X=Y("isConcatSpreadable"),G=_>=51||!b(function(){var R=[];return R[X]=!1,R.concat()[0]!==R}),te=function(R){if(!k(R))return!1;var ee=R[X];return ee!==void 0?!!ee:x(R)},se=!G||!z("concat");g({target:"Array",proto:!0,arity:1,forced:se},{concat:function(ee){var U=O(this),re=B(U,0),ne=0,ae,ce,V,K,le;for(ae=-1,V=arguments.length;ae<V;ae++)if(le=ae===-1?U:arguments[ae],te(le))for(K=E(le),N(ne+K),ce=0;ce<K;ce++,ne++)ce in le&&I(re,ne,le[ce]);else N(ne+1),I(re,ne++,le);return re.length=ne,re}})},17802:(v,C,f)=>{"use strict";var g=f(30080),b=f(93935).filter,x=f(36844),k=x("filter");g({target:"Array",proto:!0,forced:!k},{filter:function(E){return b(this,E,arguments.length>1?arguments[1]:void 0)}})},64009:(v,C,f)=>{"use strict";var g=f(30080),b=f(24782);g({target:"Array",proto:!0,forced:[].forEach!=b},{forEach:b})},32449:(v,C,f)=>{"use strict";var g=f(30080),b=f(57953),x=f(66322).indexOf,k=f(10454),O=b([].indexOf),E=!!O&&1/O([1],1,-0)<0,N=E||!k("indexOf");g({target:"Array",proto:!0,forced:N},{indexOf:function(B){var z=arguments.length>1?arguments[1]:void 0;return E?O(this,B,z)||0:x(this,B,z)}})},44390:(v,C,f)=>{"use strict";var g=f(88966),b=f(20844),x=f(94609),k=f(44083),O=f(36133).f,E=f(78107),N=f(10248),I=f(39839),B=f(56049),z="Array Iterator",Y=k.set,_=k.getterFor(z);v.exports=E(Array,"Array",function(G,te){Y(this,{type:z,target:g(G),index:0,kind:te})},function(){var G=_(this),te=G.target,se=G.kind,R=G.index++;return!te||R>=te.length?(G.target=void 0,N(void 0,!0)):se=="keys"?N(R,!1):se=="values"?N(te[R],!1):N([R,te[R]],!1)},"values");var X=x.Arguments=x.Array;if(b("keys"),b("values"),b("entries"),!I&&B&&X.name!=="values")try{O(X,"name",{value:"values"})}catch{}},91667:()=>{},9754:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(82768),k=f(12461),O=f(90406),E=f(31982),N=f(43152),I=f(28609),B=f(53160),z=f(82850),Y=f(71775),_=String,X=b("JSON","stringify"),G=O(/./.exec),te=O("".charAt),se=O("".charCodeAt),R=O("".replace),ee=O(1 .toString),U=/[\uD800-\uDFFF]/g,re=/^[\uD800-\uDBFF]$/,ne=/^[\uDC00-\uDFFF]$/,ae=!Y||E(function(){var le=b("Symbol")();return X([le])!="[null]"||X({a:le})!="{}"||X(Object(le))!="{}"}),ce=E(function(){return X("\uDF06\uD834")!=='"\\udf06\\ud834"'||X("\uDEAD")!=='"\\udead"'}),V=function(le,pe){var ge=B(arguments),me=z(pe);if(!(!N(me)&&(le===void 0||I(le))))return ge[1]=function($e,Ve){if(N(me)&&(Ve=k(me,this,_($e),Ve)),!I(Ve))return Ve},x(X,null,ge)},K=function(le,pe,ge){var me=te(ge,pe-1),$e=te(ge,pe+1);return G(re,le)&&!G(ne,$e)||G(ne,le)&&!G(re,me)?"\\u"+ee(se(le,0),16):le};X&&g({target:"JSON",stat:!0,arity:3,forced:ae||ce},{stringify:function(pe,ge,me){var $e=B(arguments),Ve=x(ae?V:X,null,$e);return ce&&typeof Ve=="string"?R(Ve,U,K):Ve}})},23870:(v,C,f)=>{var g=f(62447),b=f(98889);b(g.JSON,"JSON",!0)},5828:()=>{},28135:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(98911).f;g({target:"Object",stat:!0,forced:Object.defineProperties!==x,sham:!b},{defineProperties:x})},70829:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(36133).f;g({target:"Object",stat:!0,forced:Object.defineProperty!==x,sham:!b},{defineProperty:x})},51964:(v,C,f)=>{var g=f(30080),b=f(31982),x=f(88966),k=f(80016).f,O=f(56049),E=!O||b(function(){k(1)});g({target:"Object",stat:!0,forced:E,sham:!O},{getOwnPropertyDescriptor:function(I,B){return k(x(I),B)}})},723:(v,C,f)=>{var g=f(30080),b=f(56049),x=f(47813),k=f(88966),O=f(80016),E=f(53437);g({target:"Object",stat:!0,sham:!b},{getOwnPropertyDescriptors:function(I){for(var B=k(I),z=O.f,Y=x(B),_={},X=0,G,te;Y.length>X;)te=z(B,G=Y[X++]),te!==void 0&&E(_,G,te);return _}})},86884:(v,C,f)=>{var g=f(30080),b=f(71775),x=f(31982),k=f(97620),O=f(53254),E=!b||x(function(){k.f(1)});g({target:"Object",stat:!0,forced:E},{getOwnPropertySymbols:function(I){var B=k.f;return B?B(O(I)):[]}})},38339:(v,C,f)=>{var g=f(30080),b=f(53254),x=f(16619),k=f(31982),O=k(function(){x(1)});g({target:"Object",stat:!0,forced:O},{keys:function(N){return x(b(N))}})},97829:()=>{},5708:()=>{},27626:(v,C,f)=>{"use strict";var g=f(18143).charAt,b=f(46025),x=f(44083),k=f(78107),O=f(10248),E="String Iterator",N=x.set,I=x.getterFor(E);k(String,"String",function(B){N(this,{type:E,string:b(B),index:0})},function(){var z=I(this),Y=z.string,_=z.index,X;return _>=Y.length?O(void 0,!0):(X=g(Y,_),z.index+=X.length,O(X,!1))})},95353:(v,C,f)=>{var g=f(64832);g("asyncIterator")},16212:(v,C,f)=>{"use strict";var g=f(30080),b=f(62447),x=f(12461),k=f(90406),O=f(39839),E=f(56049),N=f(71775),I=f(31982),B=f(18768),z=f(15166),Y=f(35970),_=f(88966),X=f(5135),G=f(46025),te=f(54686),se=f(73270),R=f(16619),ee=f(51203),U=f(53515),re=f(97620),ne=f(80016),ae=f(36133),ce=f(98911),V=f(16457),K=f(27519),le=f(37912),pe=f(95976),ge=f(4580),me=f(13477),$e=f(91248),Ve=f(33538),Ye=f(39378),Fe=f(64832),at=f(95679),Dt=f(98889),At=f(44083),qt=f(93935).forEach,Xe=ge("hidden"),Ct="Symbol",xt="prototype",Ot=At.set,fr=At.getterFor(Ct),Ne=Object[xt],wt=b.Symbol,$t=wt&&wt[xt],ht=b.TypeError,Tr=b.QObject,hr=ne.f,Vr=ae.f,Ri=U.f,Pr=V.f,dr=k([].push),pr=pe("symbols"),Kr=pe("op-symbols"),dt=pe("wks"),In=!Tr||!Tr[xt]||!Tr[xt].findChild,ui=E&&I(function(){return se(Vr({},"a",{get:function(){return Vr(this,"a",{value:7}).a}})).a!=7})?function(Ze,Ce,Le){var Pe=hr(Ne,Ce);Pe&&delete Ne[Ce],Vr(Ze,Ce,Le),Pe&&Ze!==Ne&&Vr(Ne,Ce,Pe)}:Vr,bn=function(Ze,Ce){var Le=pr[Ze]=se($t);return Ot(Le,{type:Ct,tag:Ze,description:Ce}),E||(Le.description=Ce),Le},xn=function(Ce,Le,Pe){Ce===Ne&&xn(Kr,Le,Pe),Y(Ce);var $=X(Le);return Y(Pe),B(pr,$)?(Pe.enumerable?(B(Ce,Xe)&&Ce[Xe][$]&&(Ce[Xe][$]=!1),Pe=se(Pe,{enumerable:te(0,!1)})):(B(Ce,Xe)||Vr(Ce,Xe,te(1,{})),Ce[Xe][$]=!0),ui(Ce,$,Pe)):Vr(Ce,$,Pe)},Dn=function(Ce,Le){Y(Ce);var Pe=_(Le),$=R(Pe).concat(hi(Pe));return qt($,function(Z){(!E||x(Nn,Pe,Z))&&xn(Ce,Z,Pe[Z])}),Ce},fi=function(Ce,Le){return Le===void 0?se(Ce):Dn(se(Ce),Le)},Nn=function(Ce){var Le=X(Ce),Pe=x(Pr,this,Le);return this===Ne&&B(pr,Le)&&!B(Kr,Le)?!1:Pe||!B(this,Le)||!B(pr,Le)||B(this,Xe)&&this[Xe][Le]?Pe:!0},Wr=function(Ce,Le){var Pe=_(Ce),$=X(Le);if(!(Pe===Ne&&B(pr,$)&&!B(Kr,$))){var Z=hr(Pe,$);return Z&&B(pr,$)&&!(B(Pe,Xe)&&Pe[Xe][$])&&(Z.enumerable=!0),Z}},Rn=function(Ce){var Le=Ri(_(Ce)),Pe=[];return qt(Le,function($){!B(pr,$)&&!B(me,$)&&dr(Pe,$)}),Pe},hi=function(Ze){var Ce=Ze===Ne,Le=Ri(Ce?Kr:_(Ze)),Pe=[];return qt(Le,function($){B(pr,$)&&(!Ce||B(Ne,$))&&dr(Pe,pr[$])}),Pe};N||(wt=function(){if(z($t,this))throw ht("Symbol is not a constructor");var Ce=!arguments.length||arguments[0]===void 0?void 0:G(arguments[0]),Le=$e(Ce),Pe=function($){this===Ne&&x(Pe,Kr,$),B(this,Xe)&&B(this[Xe],Le)&&(this[Xe][Le]=!1),ui(this,Le,te(1,$))};return E&&In&&ui(Ne,Le,{configurable:!0,set:Pe}),bn(Le,Ce)},$t=wt[xt],K($t,"toString",function(){return fr(this).tag}),K(wt,"withoutSetter",function(Ze){return bn($e(Ze),Ze)}),V.f=Nn,ae.f=xn,ce.f=Dn,ne.f=Wr,ee.f=U.f=Rn,re.f=hi,Ye.f=function(Ze){return bn(Ve(Ze),Ze)},E&&(le($t,"description",{configurable:!0,get:function(){return fr(this).description}}),O||K(Ne,"propertyIsEnumerable",Nn,{unsafe:!0}))),g({global:!0,constructor:!0,wrap:!0,forced:!N,sham:!N},{Symbol:wt}),qt(R(dt),function(Ze){Fe(Ze)}),g({target:Ct,stat:!0,forced:!N},{useSetter:function(){In=!0},useSimple:function(){In=!1}}),g({target:"Object",stat:!0,forced:!N,sham:!E},{create:fi,defineProperty:xn,defineProperties:Dn,getOwnPropertyDescriptor:Wr}),g({target:"Object",stat:!0,forced:!N},{getOwnPropertyNames:Rn}),at(),Dt(wt,Ct),me[Xe]=!0},63906:()=>{},3598:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(18768),k=f(46025),O=f(95976),E=f(82294),N=O("string-to-symbol-registry"),I=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!E},{for:function(B){var z=k(B);if(x(N,z))return N[z];var Y=b("Symbol")(z);return N[z]=Y,I[Y]=z,Y}})},39542:(v,C,f)=>{var g=f(64832);g("hasInstance")},47882:(v,C,f)=>{var g=f(64832);g("isConcatSpreadable")},84911:(v,C,f)=>{var g=f(64832);g("iterator")},68030:(v,C,f)=>{f(16212),f(3598),f(50338),f(9754),f(86884)},50338:(v,C,f)=>{var g=f(30080),b=f(18768),x=f(28609),k=f(18342),O=f(95976),E=f(82294),N=O("symbol-to-string-registry");g({target:"Symbol",stat:!0,forced:!E},{keyFor:function(B){if(!x(B))throw TypeError(k(B)+" is not a symbol");if(b(N,B))return N[B]}})},47954:(v,C,f)=>{var g=f(64832);g("matchAll")},88725:(v,C,f)=>{var g=f(64832);g("match")},67703:(v,C,f)=>{var g=f(64832);g("replace")},2220:(v,C,f)=>{var g=f(64832);g("search")},48990:(v,C,f)=>{var g=f(64832);g("species")},50240:(v,C,f)=>{var g=f(64832);g("split")},99921:(v,C,f)=>{var g=f(64832),b=f(95679);g("toPrimitive"),b()},3502:(v,C,f)=>{var g=f(97080),b=f(64832),x=f(98889);b("toStringTag"),x(g("Symbol"),"Symbol")},80220:(v,C,f)=>{var g=f(64832);g("unscopables")},45987:(v,C,f)=>{var g=f(64832);g("asyncDispose")},42319:(v,C,f)=>{var g=f(64832);g("dispose")},58052:(v,C,f)=>{var g=f(30080),b=f(97080),x=f(90406),k=b("Symbol"),O=k.keyFor,E=x(k.prototype.valueOf);g({target:"Symbol",stat:!0},{isRegistered:function(I){try{return O(E(I))!==void 0}catch{return!1}}})},90181:(v,C,f)=>{for(var g=f(30080),b=f(95976),x=f(97080),k=f(90406),O=f(28609),E=f(33538),N=x("Symbol"),I=N.isWellKnown,B=x("Object","getOwnPropertyNames"),z=k(N.prototype.valueOf),Y=b("wks"),_=0,X=B(N),G=X.length;_<G;_++)try{var te=X[_];O(N[te])&&E(te)}catch{}g({target:"Symbol",stat:!0,forced:!0},{isWellKnown:function(R){if(I&&I(R))return!0;try{for(var ee=z(R),U=0,re=B(Y),ne=re.length;U<ne;U++)if(Y[re[U]]==ee)return!0}catch{}return!1}})},25129:(v,C,f)=>{var g=f(64832);g("matcher")},90397:(v,C,f)=>{var g=f(64832);g("metadataKey")},82793:(v,C,f)=>{var g=f(64832);g("metadata")},18097:(v,C,f)=>{var g=f(64832);g("observable")},52100:(v,C,f)=>{var g=f(64832);g("patternMatch")},99742:(v,C,f)=>{var g=f(64832);g("replaceAll")},48713:(v,C,f)=>{f(44390);var g=f(81595),b=f(62447),x=f(82059),k=f(20410),O=f(94609),E=f(33538),N=E("toStringTag");for(var I in g){var B=b[I],z=B&&B.prototype;z&&x(z)!==N&&k(z,N,I),O[I]=O.Array}},41544:(v,C,f)=>{var g=f(94537);v.exports=g},44928:(v,C,f)=>{var g=f(55794);v.exports=g},26087:(v,C,f)=>{f(48713);var g=f(82059),b=f(18768),x=f(15166),k=f(41544),O=Array.prototype,E={DOMTokenList:!0,NodeList:!0};v.exports=function(N){var I=N.forEach;return N===O||x(O,N)&&I===O.forEach||b(E,g(N))?k:I}},11783:(v,C,f)=>{var g=f(85838);v.exports=g},88462:(v,C,f)=>{var g=f(95617);v.exports=g},83531:(v,C,f)=>{var g=f(11906);v.exports=g},19941:(v,C,f)=>{var g=f(59123);v.exports=g},25081:(v,C,f)=>{var g=f(63332);v.exports=g},22145:(v,C,f)=>{var g=f(83606);v.exports=g},93690:(v,C,f)=>{var g=f(90660);v.exports=g},8429:(v,C,f)=>{var g=f(49198);f(48713),v.exports=g},13099:(v,C,f)=>{var g=f(15413);f(48713),v.exports=g},44931:(v,C,f)=>{var g=f(4793);v.exports=g},81933:function(){(function(v){var C=function(f){var g={searchParams:"URLSearchParams"in v,iterable:"Symbol"in v&&"iterator"in Symbol,blob:"FileReader"in v&&"Blob"in v&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in v,arrayBuffer:"ArrayBuffer"in v};function b(V){return V&&DataView.prototype.isPrototypeOf(V)}if(g.arrayBuffer)var x=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],k=ArrayBuffer.isView||function(V){return V&&x.indexOf(Object.prototype.toString.call(V))>-1};function O(V){if(typeof V!="string"&&(V=String(V)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(V))throw new TypeError("Invalid character in header field name");return V.toLowerCase()}function E(V){return typeof V!="string"&&(V=String(V)),V}function N(V){var K={next:function(){var le=V.shift();return{done:le===void 0,value:le}}};return g.iterable&&(K[Symbol.iterator]=function(){return K}),K}function I(V){this.map={},V instanceof I?V.forEach(function(K,le){this.append(le,K)},this):Array.isArray(V)?V.forEach(function(K){this.append(K[0],K[1])},this):V&&Object.getOwnPropertyNames(V).forEach(function(K){this.append(K,V[K])},this)}I.prototype.append=function(V,K){V=O(V),K=E(K);var le=this.map[V];this.map[V]=le?le+", "+K:K},I.prototype.delete=function(V){delete this.map[O(V)]},I.prototype.get=function(V){return V=O(V),this.has(V)?this.map[V]:null},I.prototype.has=function(V){return this.map.hasOwnProperty(O(V))},I.prototype.set=function(V,K){this.map[O(V)]=E(K)},I.prototype.forEach=function(V,K){for(var le in this.map)this.map.hasOwnProperty(le)&&V.call(K,this.map[le],le,this)},I.prototype.keys=function(){var V=[];return this.forEach(function(K,le){V.push(le)}),N(V)},I.prototype.values=function(){var V=[];return this.forEach(function(K){V.push(K)}),N(V)},I.prototype.entries=function(){var V=[];return this.forEach(function(K,le){V.push([le,K])}),N(V)},g.iterable&&(I.prototype[Symbol.iterator]=I.prototype.entries);function B(V){if(V.bodyUsed)return Promise.reject(new TypeError("Already read"));V.bodyUsed=!0}function z(V){return new Promise(function(K,le){V.onload=function(){K(V.result)},V.onerror=function(){le(V.error)}})}function Y(V){var K=new FileReader,le=z(K);return K.readAsArrayBuffer(V),le}function _(V){var K=new FileReader,le=z(K);return K.readAsText(V),le}function X(V){for(var K=new Uint8Array(V),le=new Array(K.length),pe=0;pe<K.length;pe++)le[pe]=String.fromCharCode(K[pe]);return le.join("")}function G(V){if(V.slice)return V.slice(0);var K=new Uint8Array(V.byteLength);return K.set(new Uint8Array(V)),K.buffer}function te(){return this.bodyUsed=!1,this._initBody=function(V){this._bodyInit=V,V?typeof V=="string"?this._bodyText=V:g.blob&&Blob.prototype.isPrototypeOf(V)?this._bodyBlob=V:g.formData&&FormData.prototype.isPrototypeOf(V)?this._bodyFormData=V:g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)?this._bodyText=V.toString():g.arrayBuffer&&g.blob&&b(V)?(this._bodyArrayBuffer=G(V.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):g.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(V)||k(V))?this._bodyArrayBuffer=G(V):this._bodyText=V=Object.prototype.toString.call(V):this._bodyText="",this.headers.get("content-type")||(typeof V=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(V)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var V=B(this);if(V)return V;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?B(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(Y)}),this.text=function(){var V=B(this);if(V)return V;if(this._bodyBlob)return _(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(X(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(U)}),this.json=function(){return this.text().then(JSON.parse)},this}var se=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function R(V){var K=V.toUpperCase();return se.indexOf(K)>-1?K:V}function ee(V,K){K=K||{};var le=K.body;if(V instanceof ee){if(V.bodyUsed)throw new TypeError("Already read");this.url=V.url,this.credentials=V.credentials,K.headers||(this.headers=new I(V.headers)),this.method=V.method,this.mode=V.mode,this.signal=V.signal,!le&&V._bodyInit!=null&&(le=V._bodyInit,V.bodyUsed=!0)}else this.url=String(V);if(this.credentials=K.credentials||this.credentials||"same-origin",(K.headers||!this.headers)&&(this.headers=new I(K.headers)),this.method=R(K.method||this.method||"GET"),this.mode=K.mode||this.mode||null,this.signal=K.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&le)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(le)}ee.prototype.clone=function(){return new ee(this,{body:this._bodyInit})};function U(V){var K=new FormData;return V.trim().split("&").forEach(function(le){if(le){var pe=le.split("="),ge=pe.shift().replace(/\+/g," "),me=pe.join("=").replace(/\+/g," ");K.append(decodeURIComponent(ge),decodeURIComponent(me))}}),K}function re(V){var K=new I,le=V.replace(/\r?\n[\t ]+/g," ");return le.split(/\r?\n/).forEach(function(pe){var ge=pe.split(":"),me=ge.shift().trim();if(me){var $e=ge.join(":").trim();K.append(me,$e)}}),K}te.call(ee.prototype);function ne(V,K){K||(K={}),this.type="default",this.status=K.status===void 0?200:K.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in K?K.statusText:"OK",this.headers=new I(K.headers),this.url=K.url||"",this._initBody(V)}te.call(ne.prototype),ne.prototype.clone=function(){return new ne(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new I(this.headers),url:this.url})},ne.error=function(){var V=new ne(null,{status:0,statusText:""});return V.type="error",V};var ae=[301,302,303,307,308];ne.redirect=function(V,K){if(ae.indexOf(K)===-1)throw new RangeError("Invalid status code");return new ne(null,{status:K,headers:{location:V}})},f.DOMException=v.DOMException;try{new f.DOMException}catch{f.DOMException=function(K,le){this.message=K,this.name=le;var pe=Error(K);this.stack=pe.stack},f.DOMException.prototype=Object.create(Error.prototype),f.DOMException.prototype.constructor=f.DOMException}function ce(V,K){return new Promise(function(le,pe){var ge=new ee(V,K);if(ge.signal&&ge.signal.aborted)return pe(new f.DOMException("Aborted","AbortError"));var me=new XMLHttpRequest;function $e(){me.abort()}me.onload=function(){var Ve={status:me.status,statusText:me.statusText,headers:re(me.getAllResponseHeaders()||"")};Ve.url="responseURL"in me?me.responseURL:Ve.headers.get("X-Request-URL");var Ye="response"in me?me.response:me.responseText;le(new ne(Ye,Ve))},me.onerror=function(){pe(new TypeError("Network request failed"))},me.ontimeout=function(){pe(new TypeError("Network request failed"))},me.onabort=function(){pe(new f.DOMException("Aborted","AbortError"))},me.open(ge.method,ge.url,!0),ge.credentials==="include"?me.withCredentials=!0:ge.credentials==="omit"&&(me.withCredentials=!1),"responseType"in me&&g.blob&&(me.responseType="blob"),ge.headers.forEach(function(Ve,Ye){me.setRequestHeader(Ye,Ve)}),ge.signal&&(ge.signal.addEventListener("abort",$e),me.onreadystatechange=function(){me.readyState===4&&ge.signal.removeEventListener("abort",$e)}),me.send(typeof ge._bodyInit>"u"?null:ge._bodyInit)})}return ce.polyfill=!0,v.fetch||(v.fetch=ce,v.Headers=I,v.Request=ee,v.Response=ne),f.Headers=I,f.Request=ee,f.Response=ne,f.fetch=ce,Object.defineProperty(f,"__esModule",{value:!0}),f}({})})(typeof self<"u"?self:this)},16068:(v,C,f)=>{"use strict";f.r(C),f.d(C,{Console:()=>$I});var g={};f.r(g),f.d(g,{cookie:()=>jx,header:()=>Fx,path:()=>Rx,query:()=>Lx});var b=f(10954),x=f(70762),k=f(93652),O=f(11099),E=f(10017),N=f(86351),I=f(86751),B=f(12953),z=f(55839),Y=f(23422);function _(r){return _=typeof z=="function"&&typeof Y=="symbol"?function(e){return typeof e}:function(e){return e&&typeof z=="function"&&e.constructor===z&&e!==z.prototype?"symbol":typeof e},_(r)}var X=f(47319);function G(r,e){if(_(r)!=="object"||r===null)return r;var t=r[X];if(t!==void 0){var n=t.call(r,e||"default");if(_(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function te(r){var e=G(r,"string");return _(e)==="symbol"?e:String(e)}function se(r,e,t){return e=te(e),e in r?B(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function R(r,e){var t=b(r);if(x){var n=x(r);e&&(n=k(n).call(n,function(i){return O(r,i).enumerable})),t.push.apply(t,n)}return t}function ee(r){for(var e=1;e<arguments.length;e++){var t,n,i=arguments[e]!=null?arguments[e]:{};e%2?E(t=R(Object(i),!0)).call(t,function(s){se(r,s,i[s])}):N?I(r,N(i)):E(n=R(Object(i))).call(n,function(s){B(r,s,O(i,s))})}return r}var U=f(34961);function re(r,e){if(r==null)return{};var t={},n=b(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(U(e).call(e,i)>=0)&&(t[i]=r[i]);return t}function ne(r,e){if(r==null)return{};var t=re(r,e),n,i;if(x){var s=x(r);for(i=0;i<s.length;i++)n=s[i],!(U(e).call(e,n)>=0)&&Object.prototype.propertyIsEnumerable.call(r,n)&&(t[n]=r[n])}return t}var ae=f(13546),ce=f.n(ae),V=f(51121),K=f(26179);/*!
|
|
12
12
|
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
13
13
|
*
|
|
14
14
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
@@ -20,31 +20,31 @@
|
|
|
20
20
|
`,a+=Ne.repeat("-",e.indent+u+3+c.pos)+`^
|
|
21
21
|
`,l=1;l<=e.linesAfter&&!(o+l>=i.length);l++)c=Tr(r.buffer,n[o+l],i[o+l],r.position-(n[o]-n[o+l]),h),a+=Ne.repeat(" ",e.indent)+hr((r.line+l+1).toString(),u)+" | "+c.str+`
|
|
22
22
|
`;return a.replace(/\n$/,"")}var Ri=Vr,Pr=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],dr=["scalar","sequence","mapping"];function pr(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(n){e[String(n)]=t})}),e}function Kr(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(Pr.indexOf(t)===-1)throw new ht('Unknown option "'+t+'" is met in definition of "'+r+'" YAML type.')}),this.options=e,this.tag=r,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.representName=e.representName||null,this.defaultStyle=e.defaultStyle||null,this.multi=e.multi||!1,this.styleAliases=pr(e.styleAliases||null),dr.indexOf(this.kind)===-1)throw new ht('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}var dt=Kr;function In(r,e){var t=[];return r[e].forEach(function(n){var i=t.length;t.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&s.multi===n.multi&&(i=o)}),t[i]=n}),t}function ui(){var r={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},e,t;function n(i){i.multi?(r.multi[i.kind].push(i),r.multi.fallback.push(i)):r[i.kind][i.tag]=r.fallback[i.tag]=i}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(n);return r}function bn(r){return this.extend(r)}bn.prototype.extend=function(e){var t=[],n=[];if(e instanceof dt)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new ht("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(s){if(!(s instanceof dt))throw new ht("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new ht("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new ht("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(s){if(!(s instanceof dt))throw new ht("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(bn.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=In(i,"implicit"),i.compiledExplicit=In(i,"explicit"),i.compiledTypeMap=ui(i.compiledImplicit,i.compiledExplicit),i};var xn=bn,Dn=new dt("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}}),fi=new dt("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}}),Nn=new dt("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}}),Wr=new xn({explicit:[Dn,fi,Nn]});function Rn(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function hi(){return null}function Ze(r){return r===null}var Ce=new dt("tag:yaml.org,2002:null",{kind:"scalar",resolve:Rn,construct:hi,predicate:Ze,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function Le(r){if(r===null)return!1;var e=r.length;return e===4&&(r==="true"||r==="True"||r==="TRUE")||e===5&&(r==="false"||r==="False"||r==="FALSE")}function Pe(r){return r==="true"||r==="True"||r==="TRUE"}function $(r){return Object.prototype.toString.call(r)==="[object Boolean]"}var Z=new dt("tag:yaml.org,2002:bool",{kind:"scalar",resolve:Le,construct:Pe,predicate:$,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"});function ze(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function _e(r){return 48<=r&&r<=55}function lt(r){return 48<=r&&r<=57}function Me(r){if(r===null)return!1;var e=r.length,t=0,n=!1,i;if(!e)return!1;if(i=r[t],(i==="-"||i==="+")&&(i=r[++t]),i==="0"){if(t+1===e)return!0;if(i=r[++t],i==="b"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(i!=="0"&&i!=="1")return!1;n=!0}return n&&i!=="_"}if(i==="x"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(!ze(r.charCodeAt(t)))return!1;n=!0}return n&&i!=="_"}if(i==="o"){for(t++;t<e;t++)if(i=r[t],i!=="_"){if(!_e(r.charCodeAt(t)))return!1;n=!0}return n&&i!=="_"}}if(i==="_")return!1;for(;t<e;t++)if(i=r[t],i!=="_"){if(!lt(r.charCodeAt(t)))return!1;n=!0}return!(!n||i==="_")}function Yr(r){var e=r,t=1,n;if(e.indexOf("_")!==-1&&(e=e.replace(/_/g,"")),n=e[0],(n==="-"||n==="+")&&(n==="-"&&(t=-1),e=e.slice(1),n=e[0]),e==="0")return 0;if(n==="0"){if(e[1]==="b")return t*parseInt(e.slice(2),2);if(e[1]==="x")return t*parseInt(e.slice(2),16);if(e[1]==="o")return t*parseInt(e.slice(2),8)}return t*parseInt(e,10)}function wn(r){return Object.prototype.toString.call(r)==="[object Number]"&&r%1===0&&!Ne.isNegativeZero(r)}var Ht=new dt("tag:yaml.org,2002:int",{kind:"scalar",resolve:Me,construct:Yr,predicate:wn,represent:{binary:function(r){return r>=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0o"+r.toString(8):"-0o"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Jr=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Ts(r){return!(r===null||!Jr.test(r)||r[r.length-1]==="_")}function Ln(r){var e,t;return e=r.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:t*parseFloat(e,10)}var gr=/^[-+]?[0-9]+e/;function Vo(r,e){var t;if(isNaN(r))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ne.isNegativeZero(r))return"-0.0";return t=r.toString(10),gr.test(t)?t.replace("e",".e"):t}function Wo(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||Ne.isNegativeZero(r))}var Ps=new dt("tag:yaml.org,2002:float",{kind:"scalar",resolve:Ts,construct:Ln,predicate:Wo,represent:Vo,defaultStyle:"lowercase"}),Bn=Wr.extend({implicit:[Ce,Z,Ht,Ps]}),Li=Bn,di=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),Bi=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Ms(r){return r===null?!1:di.exec(r)!==null||Bi.exec(r)!==null}function $o(r){var e,t,n,i,s,o,a,l=0,c=null,u,h,d;if(e=di.exec(r),e===null&&(e=Bi.exec(r)),e===null)throw new Error("Date resolve error");if(t=+e[1],n=+e[2]-1,i=+e[3],!e[4])return new Date(Date.UTC(t,n,i));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],h=+(e[11]||0),c=(u*60+h)*6e4,e[9]==="-"&&(c=-c)),d=new Date(Date.UTC(t,n,i,s,o,a,l)),c&&d.setTime(d.getTime()-c),d}function Ho(r){return r.toISOString()}var Fi=new dt("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Ms,construct:$o,instanceOf:Date,represent:Ho});function zo(r){return r==="<<"||r===null}var ji=new dt("tag:yaml.org,2002:merge",{kind:"scalar",resolve:zo}),Vi=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
23
|
-
\r`;function Yl(r){if(r===null)return!1;var e,t,n=0,i=r.length,s=Vi;for(t=0;t<i;t++)if(e=s.indexOf(r.charAt(t)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function Is(r){var e,t,n=r.replace(/[\r\n=]/g,""),i=n.length,s=Vi,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return t=i%4*6,t===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):t===18?(a.push(o>>10&255),a.push(o>>2&255)):t===12&&a.push(o>>4&255),new Uint8Array(a)}function Fn(r){var e="",t=0,n,i,s=r.length,o=Vi;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+r[n];return i=s%3,i===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):i===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):i===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}function Wi(r){return Object.prototype.toString.call(r)==="[object Uint8Array]"}var Uo=new dt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Yl,construct:Is,predicate:Wi,represent:Fn}),Go=Object.prototype.hasOwnProperty,
|
|
24
|
-
`:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"\x85":r===95?"\xA0":r===76?"\u2028":r===80?"\u2029":""}function
|
|
25
|
-
`,e-1))}function
|
|
23
|
+
\r`;function Yl(r){if(r===null)return!1;var e,t,n=0,i=r.length,s=Vi;for(t=0;t<i;t++)if(e=s.indexOf(r.charAt(t)),!(e>64)){if(e<0)return!1;n+=6}return n%8===0}function Is(r){var e,t,n=r.replace(/[\r\n=]/g,""),i=n.length,s=Vi,o=0,a=[];for(e=0;e<i;e++)e%4===0&&e&&(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(n.charAt(e));return t=i%4*6,t===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):t===18?(a.push(o>>10&255),a.push(o>>2&255)):t===12&&a.push(o>>4&255),new Uint8Array(a)}function Fn(r){var e="",t=0,n,i,s=r.length,o=Vi;for(n=0;n<s;n++)n%3===0&&n&&(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+r[n];return i=s%3,i===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):i===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):i===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}function Wi(r){return Object.prototype.toString.call(r)==="[object Uint8Array]"}var Uo=new dt("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Yl,construct:Is,predicate:Wi,represent:Fn}),Go=Object.prototype.hasOwnProperty,Lb=Object.prototype.toString;function Bb(r){if(r===null)return!0;var e=[],t,n,i,s,o,a=r;for(t=0,n=a.length;t<n;t+=1){if(i=a[t],o=!1,Lb.call(i)!=="[object Object]")return!1;for(s in i)if(Go.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(e.indexOf(s)===-1)e.push(s);else return!1}return!0}function Fb(r){return r!==null?r:[]}var Jf=new dt("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Bb,construct:Fb}),jb=Object.prototype.toString;function Vb(r){if(r===null)return!0;var e,t,n,i,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1){if(n=o[e],jb.call(n)!=="[object Object]"||(i=Object.keys(n),i.length!==1))return!1;s[e]=[i[0],n[i[0]]]}return!0}function Wb(r){if(r===null)return[];var e,t,n,i,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e<t;e+=1)n=o[e],i=Object.keys(n),s[e]=[i[0],n[i[0]]];return s}var Qf=new dt("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Vb,construct:Wb}),$b=Object.prototype.hasOwnProperty;function Hb(r){if(r===null)return!0;var e,t=r;for(e in t)if($b.call(t,e)&&t[e]!==null)return!1;return!0}function zb(r){return r!==null?r:{}}var Xf=new dt("tag:yaml.org,2002:set",{kind:"mapping",resolve:Hb,construct:zb}),Jl=Li.extend({implicit:[Fi,ji],explicit:[Uo,Jf,Qf,Xf]}),jn=Object.prototype.hasOwnProperty,Ko=1,Zf=2,_f=3,Yo=4,Ql=1,Ub=2,qf=3,Gb=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Kb=/[\x85\u2028\u2029]/,Yb=/[,\[\]\{\}]/,eh=/^(?:!|!!|![a-z\-]+!)$/i,th=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function rh(r){return Object.prototype.toString.call(r)}function Qr(r){return r===10||r===13}function pi(r){return r===9||r===32}function or(r){return r===9||r===32||r===10||r===13}function $i(r){return r===44||r===91||r===93||r===123||r===125}function Jb(r){var e;return 48<=r&&r<=57?r-48:(e=r|32,97<=e&&e<=102?e-97+10:-1)}function Qb(r){return r===120?2:r===117?4:r===85?8:0}function Xb(r){return 48<=r&&r<=57?r-48:-1}function nh(r){return r===48?"\0":r===97?"\x07":r===98?"\b":r===116||r===9?" ":r===110?`
|
|
24
|
+
`:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"\x85":r===95?"\xA0":r===76?"\u2028":r===80?"\u2029":""}function Zb(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}for(var ih=new Array(256),sh=new Array(256),Hi=0;Hi<256;Hi++)ih[Hi]=nh(Hi)?1:0,sh[Hi]=nh(Hi);function _b(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||Jl,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=r.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function oh(r,e){var t={name:r.filename,buffer:r.input.slice(0,-1),position:r.position,line:r.line,column:r.position-r.lineStart};return t.snippet=Ri(t),new ht(e,t)}function xe(r,e){throw oh(r,e)}function Jo(r,e){r.onWarning&&r.onWarning.call(null,oh(r,e))}var ah={YAML:function(e,t,n){var i,s,o;e.version!==null&&xe(e,"duplication of %YAML directive"),n.length!==1&&xe(e,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]),i===null&&xe(e,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&xe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&Jo(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,s;n.length!==2&&xe(e,"TAG directive accepts exactly two arguments"),i=n[0],s=n[1],eh.test(i)||xe(e,"ill-formed tag handle (first argument) of the TAG directive"),jn.call(e.tagMap,i)&&xe(e,'there is a previously declared suffix for "'+i+'" tag handle'),th.test(s)||xe(e,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{xe(e,"tag prefix is malformed: "+s)}e.tagMap[i]=s}};function Vn(r,e,t,n){var i,s,o,a;if(e<t){if(a=r.input.slice(e,t),n)for(i=0,s=a.length;i<s;i+=1)o=a.charCodeAt(i),o===9||32<=o&&o<=1114111||xe(r,"expected valid JSON character");else Gb.test(a)&&xe(r,"the stream contains non-printable characters");r.result+=a}}function lh(r,e,t,n){var i,s,o,a;for(Ne.isObject(t)||xe(r,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(t),o=0,a=i.length;o<a;o+=1)s=i[o],jn.call(e,s)||(e[s]=t[s],n[s]=!0)}function zi(r,e,t,n,i,s,o,a,l){var c,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),c=0,u=i.length;c<u;c+=1)Array.isArray(i[c])&&xe(r,"nested arrays are not supported inside keys"),typeof i=="object"&&rh(i[c])==="[object Object]"&&(i[c]="[object Object]");if(typeof i=="object"&&rh(i)==="[object Object]"&&(i="[object Object]"),i=String(i),e===null&&(e={}),n==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(c=0,u=s.length;c<u;c+=1)lh(r,e,s[c],t);else lh(r,e,s,t);else!r.json&&!jn.call(t,i)&&jn.call(e,i)&&(r.line=o||r.line,r.lineStart=a||r.lineStart,r.position=l||r.position,xe(r,"duplicated mapping key")),i==="__proto__"?Object.defineProperty(e,i,{configurable:!0,enumerable:!0,writable:!0,value:s}):e[i]=s,delete t[i];return e}function Xl(r){var e;e=r.input.charCodeAt(r.position),e===10?r.position++:e===13?(r.position++,r.input.charCodeAt(r.position)===10&&r.position++):xe(r,"a line break is expected"),r.line+=1,r.lineStart=r.position,r.firstTabInLine=-1}function St(r,e,t){for(var n=0,i=r.input.charCodeAt(r.position);i!==0;){for(;pi(i);)i===9&&r.firstTabInLine===-1&&(r.firstTabInLine=r.position),i=r.input.charCodeAt(++r.position);if(e&&i===35)do i=r.input.charCodeAt(++r.position);while(i!==10&&i!==13&&i!==0);if(Qr(i))for(Xl(r),i=r.input.charCodeAt(r.position),n++,r.lineIndent=0;i===32;)r.lineIndent++,i=r.input.charCodeAt(++r.position);else break}return t!==-1&&n!==0&&r.lineIndent<t&&Jo(r,"deficient indentation"),n}function Qo(r){var e=r.position,t;return t=r.input.charCodeAt(e),!!((t===45||t===46)&&t===r.input.charCodeAt(e+1)&&t===r.input.charCodeAt(e+2)&&(e+=3,t=r.input.charCodeAt(e),t===0||or(t)))}function Zl(r,e){e===1?r.result+=" ":e>1&&(r.result+=Ne.repeat(`
|
|
25
|
+
`,e-1))}function qb(r,e,t){var n,i,s,o,a,l,c,u,h=r.kind,d=r.result,p;if(p=r.input.charCodeAt(r.position),or(p)||$i(p)||p===35||p===38||p===42||p===33||p===124||p===62||p===39||p===34||p===37||p===64||p===96||(p===63||p===45)&&(i=r.input.charCodeAt(r.position+1),or(i)||t&&$i(i)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,a=!1;p!==0;){if(p===58){if(i=r.input.charCodeAt(r.position+1),or(i)||t&&$i(i))break}else if(p===35){if(n=r.input.charCodeAt(r.position-1),or(n))break}else{if(r.position===r.lineStart&&Qo(r)||t&&$i(p))break;if(Qr(p))if(l=r.line,c=r.lineStart,u=r.lineIndent,St(r,!1,-1),r.lineIndent>=e){a=!0,p=r.input.charCodeAt(r.position);continue}else{r.position=o,r.line=l,r.lineStart=c,r.lineIndent=u;break}}a&&(Vn(r,s,o,!1),Zl(r,r.line-l),s=o=r.position,a=!1),pi(p)||(o=r.position+1),p=r.input.charCodeAt(++r.position)}return Vn(r,s,o,!1),r.result?!0:(r.kind=h,r.result=d,!1)}function e1(r,e){var t,n,i;if(t=r.input.charCodeAt(r.position),t!==39)return!1;for(r.kind="scalar",r.result="",r.position++,n=i=r.position;(t=r.input.charCodeAt(r.position))!==0;)if(t===39)if(Vn(r,n,r.position,!0),t=r.input.charCodeAt(++r.position),t===39)n=r.position,r.position++,i=r.position;else return!0;else Qr(t)?(Vn(r,n,i,!0),Zl(r,St(r,!1,e)),n=i=r.position):r.position===r.lineStart&&Qo(r)?xe(r,"unexpected end of the document within a single quoted scalar"):(r.position++,i=r.position);xe(r,"unexpected end of the stream within a single quoted scalar")}function t1(r,e){var t,n,i,s,o,a;if(a=r.input.charCodeAt(r.position),a!==34)return!1;for(r.kind="scalar",r.result="",r.position++,t=n=r.position;(a=r.input.charCodeAt(r.position))!==0;){if(a===34)return Vn(r,t,r.position,!0),r.position++,!0;if(a===92){if(Vn(r,t,r.position,!0),a=r.input.charCodeAt(++r.position),Qr(a))St(r,!1,e);else if(a<256&&ih[a])r.result+=sh[a],r.position++;else if((o=Qb(a))>0){for(i=o,s=0;i>0;i--)a=r.input.charCodeAt(++r.position),(o=Jb(a))>=0?s=(s<<4)+o:xe(r,"expected hexadecimal character");r.result+=Zb(s),r.position++}else xe(r,"unknown escape sequence");t=n=r.position}else Qr(a)?(Vn(r,t,n,!0),Zl(r,St(r,!1,e)),t=n=r.position):r.position===r.lineStart&&Qo(r)?xe(r,"unexpected end of the document within a double quoted scalar"):(r.position++,n=r.position)}xe(r,"unexpected end of the stream within a double quoted scalar")}function r1(r,e){var t=!0,n,i,s,o=r.tag,a,l=r.anchor,c,u,h,d,p,m=Object.create(null),y,w,A,T;if(T=r.input.charCodeAt(r.position),T===91)u=93,p=!1,a=[];else if(T===123)u=125,p=!0,a={};else return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=a),T=r.input.charCodeAt(++r.position);T!==0;){if(St(r,!0,e),T=r.input.charCodeAt(r.position),T===u)return r.position++,r.tag=o,r.anchor=l,r.kind=p?"mapping":"sequence",r.result=a,!0;t?T===44&&xe(r,"expected the node content, but found ','"):xe(r,"missed comma between flow collection entries"),w=y=A=null,h=d=!1,T===63&&(c=r.input.charCodeAt(r.position+1),or(c)&&(h=d=!0,r.position++,St(r,!0,e))),n=r.line,i=r.lineStart,s=r.position,Ui(r,e,Ko,!1,!0),w=r.tag,y=r.result,St(r,!0,e),T=r.input.charCodeAt(r.position),(d||r.line===n)&&T===58&&(h=!0,T=r.input.charCodeAt(++r.position),St(r,!0,e),Ui(r,e,Ko,!1,!0),A=r.result),p?zi(r,a,m,w,y,A,n,i,s):h?a.push(zi(r,null,m,w,y,A,n,i,s)):a.push(y),St(r,!0,e),T=r.input.charCodeAt(r.position),T===44?(t=!0,T=r.input.charCodeAt(++r.position)):t=!1}xe(r,"unexpected end of the stream within a flow collection")}function n1(r,e){var t,n,i=Ql,s=!1,o=!1,a=e,l=0,c=!1,u,h;if(h=r.input.charCodeAt(r.position),h===124)n=!1;else if(h===62)n=!0;else return!1;for(r.kind="scalar",r.result="";h!==0;)if(h=r.input.charCodeAt(++r.position),h===43||h===45)Ql===i?i=h===43?qf:Ub:xe(r,"repeat of a chomping mode identifier");else if((u=Xb(h))>=0)u===0?xe(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?xe(r,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(pi(h)){do h=r.input.charCodeAt(++r.position);while(pi(h));if(h===35)do h=r.input.charCodeAt(++r.position);while(!Qr(h)&&h!==0)}for(;h!==0;){for(Xl(r),r.lineIndent=0,h=r.input.charCodeAt(r.position);(!o||r.lineIndent<a)&&h===32;)r.lineIndent++,h=r.input.charCodeAt(++r.position);if(!o&&r.lineIndent>a&&(a=r.lineIndent),Qr(h)){l++;continue}if(r.lineIndent<a){i===qf?r.result+=Ne.repeat(`
|
|
26
26
|
`,s?1+l:l):i===Ql&&s&&(r.result+=`
|
|
27
27
|
`);break}for(n?pi(h)?(c=!0,r.result+=Ne.repeat(`
|
|
28
28
|
`,s?1+l:l)):c?(c=!1,r.result+=Ne.repeat(`
|
|
29
29
|
`,l+1)):l===0?s&&(r.result+=" "):r.result+=Ne.repeat(`
|
|
30
30
|
`,l):r.result+=Ne.repeat(`
|
|
31
|
-
`,s?1+l:l),s=!0,o=!0,l=0,t=r.position;!Qr(h)&&h!==0;)h=r.input.charCodeAt(++r.position);Vn(r,t,r.position,!1)}return!0}function ch(r,e){var t,n=r.tag,i=r.anchor,s=[],o,a=!1,l;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),l=r.input.charCodeAt(r.position);l!==0&&(r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,xe(r,"tab characters must not be used in indentation")),!(l!==45||(o=r.input.charCodeAt(r.position+1),!or(o))));){if(a=!0,r.position++,St(r,!0,-1)&&r.lineIndent<=e){s.push(null),l=r.input.charCodeAt(r.position);continue}if(t=r.line,Ui(r,e,_f,!1,!0),s.push(r.result),St(r,!0,-1),l=r.input.charCodeAt(r.position),(r.line===t||r.lineIndent>e)&&l!==0)xe(r,"bad indentation of a sequence entry");else if(r.lineIndent<e)break}return a?(r.tag=n,r.anchor=i,r.kind="sequence",r.result=s,!0):!1}function
|
|
32
|
-
`),r.charCodeAt(0)===65279&&(r=r.slice(1)));var t=new
|
|
31
|
+
`,s?1+l:l),s=!0,o=!0,l=0,t=r.position;!Qr(h)&&h!==0;)h=r.input.charCodeAt(++r.position);Vn(r,t,r.position,!1)}return!0}function ch(r,e){var t,n=r.tag,i=r.anchor,s=[],o,a=!1,l;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),l=r.input.charCodeAt(r.position);l!==0&&(r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,xe(r,"tab characters must not be used in indentation")),!(l!==45||(o=r.input.charCodeAt(r.position+1),!or(o))));){if(a=!0,r.position++,St(r,!0,-1)&&r.lineIndent<=e){s.push(null),l=r.input.charCodeAt(r.position);continue}if(t=r.line,Ui(r,e,_f,!1,!0),s.push(r.result),St(r,!0,-1),l=r.input.charCodeAt(r.position),(r.line===t||r.lineIndent>e)&&l!==0)xe(r,"bad indentation of a sequence entry");else if(r.lineIndent<e)break}return a?(r.tag=n,r.anchor=i,r.kind="sequence",r.result=s,!0):!1}function i1(r,e,t){var n,i,s,o,a,l,c=r.tag,u=r.anchor,h={},d=Object.create(null),p=null,m=null,y=null,w=!1,A=!1,T;if(r.firstTabInLine!==-1)return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=h),T=r.input.charCodeAt(r.position);T!==0;){if(!w&&r.firstTabInLine!==-1&&(r.position=r.firstTabInLine,xe(r,"tab characters must not be used in indentation")),n=r.input.charCodeAt(r.position+1),s=r.line,(T===63||T===58)&&or(n))T===63?(w&&(zi(r,h,d,p,m,null,o,a,l),p=m=y=null),A=!0,w=!0,i=!0):w?(w=!1,i=!0):xe(r,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),r.position+=1,T=n;else{if(o=r.line,a=r.lineStart,l=r.position,!Ui(r,t,Zf,!1,!0))break;if(r.line===s){for(T=r.input.charCodeAt(r.position);pi(T);)T=r.input.charCodeAt(++r.position);if(T===58)T=r.input.charCodeAt(++r.position),or(T)||xe(r,"a whitespace character is expected after the key-value separator within a block mapping"),w&&(zi(r,h,d,p,m,null,o,a,l),p=m=y=null),A=!0,w=!1,i=!1,p=r.tag,m=r.result;else if(A)xe(r,"can not read an implicit mapping pair; a colon is missed");else return r.tag=c,r.anchor=u,!0}else if(A)xe(r,"can not read a block mapping entry; a multiline key may not be an implicit key");else return r.tag=c,r.anchor=u,!0}if((r.line===s||r.lineIndent>e)&&(w&&(o=r.line,a=r.lineStart,l=r.position),Ui(r,e,Yo,!0,i)&&(w?m=r.result:y=r.result),w||(zi(r,h,d,p,m,y,o,a,l),p=m=y=null),St(r,!0,-1),T=r.input.charCodeAt(r.position)),(r.line===s||r.lineIndent>e)&&T!==0)xe(r,"bad indentation of a mapping entry");else if(r.lineIndent<e)break}return w&&zi(r,h,d,p,m,null,o,a,l),A&&(r.tag=c,r.anchor=u,r.kind="mapping",r.result=h),A}function s1(r){var e,t=!1,n=!1,i,s,o;if(o=r.input.charCodeAt(r.position),o!==33)return!1;if(r.tag!==null&&xe(r,"duplication of a tag property"),o=r.input.charCodeAt(++r.position),o===60?(t=!0,o=r.input.charCodeAt(++r.position)):o===33?(n=!0,i="!!",o=r.input.charCodeAt(++r.position)):i="!",e=r.position,t){do o=r.input.charCodeAt(++r.position);while(o!==0&&o!==62);r.position<r.length?(s=r.input.slice(e,r.position),o=r.input.charCodeAt(++r.position)):xe(r,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!or(o);)o===33&&(n?xe(r,"tag suffix cannot contain exclamation marks"):(i=r.input.slice(e-1,r.position+1),eh.test(i)||xe(r,"named tag handle cannot contain such characters"),n=!0,e=r.position+1)),o=r.input.charCodeAt(++r.position);s=r.input.slice(e,r.position),Yb.test(s)&&xe(r,"tag suffix cannot contain flow indicator characters")}s&&!th.test(s)&&xe(r,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{xe(r,"tag name is malformed: "+s)}return t?r.tag=s:jn.call(r.tagMap,i)?r.tag=r.tagMap[i]+s:i==="!"?r.tag="!"+s:i==="!!"?r.tag="tag:yaml.org,2002:"+s:xe(r,'undeclared tag handle "'+i+'"'),!0}function o1(r){var e,t;if(t=r.input.charCodeAt(r.position),t!==38)return!1;for(r.anchor!==null&&xe(r,"duplication of an anchor property"),t=r.input.charCodeAt(++r.position),e=r.position;t!==0&&!or(t)&&!$i(t);)t=r.input.charCodeAt(++r.position);return r.position===e&&xe(r,"name of an anchor node must contain at least one character"),r.anchor=r.input.slice(e,r.position),!0}function a1(r){var e,t,n;if(n=r.input.charCodeAt(r.position),n!==42)return!1;for(n=r.input.charCodeAt(++r.position),e=r.position;n!==0&&!or(n)&&!$i(n);)n=r.input.charCodeAt(++r.position);return r.position===e&&xe(r,"name of an alias node must contain at least one character"),t=r.input.slice(e,r.position),jn.call(r.anchorMap,t)||xe(r,'unidentified alias "'+t+'"'),r.result=r.anchorMap[t],St(r,!0,-1),!0}function Ui(r,e,t,n,i){var s,o,a,l=1,c=!1,u=!1,h,d,p,m,y,w;if(r.listener!==null&&r.listener("open",r),r.tag=null,r.anchor=null,r.kind=null,r.result=null,s=o=a=Yo===t||_f===t,n&&St(r,!0,-1)&&(c=!0,r.lineIndent>e?l=1:r.lineIndent===e?l=0:r.lineIndent<e&&(l=-1)),l===1)for(;s1(r)||o1(r);)St(r,!0,-1)?(c=!0,a=s,r.lineIndent>e?l=1:r.lineIndent===e?l=0:r.lineIndent<e&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||Yo===t)&&(Ko===t||Zf===t?y=e:y=e+1,w=r.position-r.lineStart,l===1?a&&(ch(r,w)||i1(r,w,y))||r1(r,y)?u=!0:(o&&n1(r,y)||e1(r,y)||t1(r,y)?u=!0:a1(r)?(u=!0,(r.tag!==null||r.anchor!==null)&&xe(r,"alias node should not have any properties")):qb(r,y,Ko===t)&&(u=!0,r.tag===null&&(r.tag="?")),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):l===0&&(u=a&&ch(r,w))),r.tag===null)r.anchor!==null&&(r.anchorMap[r.anchor]=r.result);else if(r.tag==="?"){for(r.result!==null&&r.kind!=="scalar"&&xe(r,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+r.kind+'"'),h=0,d=r.implicitTypes.length;h<d;h+=1)if(m=r.implicitTypes[h],m.resolve(r.result)){r.result=m.construct(r.result),r.tag=m.tag,r.anchor!==null&&(r.anchorMap[r.anchor]=r.result);break}}else if(r.tag!=="!"){if(jn.call(r.typeMap[r.kind||"fallback"],r.tag))m=r.typeMap[r.kind||"fallback"][r.tag];else for(m=null,p=r.typeMap.multi[r.kind||"fallback"],h=0,d=p.length;h<d;h+=1)if(r.tag.slice(0,p[h].tag.length)===p[h].tag){m=p[h];break}m||xe(r,"unknown tag !<"+r.tag+">"),r.result!==null&&m.kind!==r.kind&&xe(r,"unacceptable node kind for !<"+r.tag+'> tag; it should be "'+m.kind+'", not "'+r.kind+'"'),m.resolve(r.result,r.tag)?(r.result=m.construct(r.result,r.tag),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):xe(r,"cannot resolve a node with !<"+r.tag+"> explicit tag")}return r.listener!==null&&r.listener("close",r),r.tag!==null||r.anchor!==null||u}function l1(r){var e=r.position,t,n,i,s=!1,o;for(r.version=null,r.checkLineBreaks=r.legacy,r.tagMap=Object.create(null),r.anchorMap=Object.create(null);(o=r.input.charCodeAt(r.position))!==0&&(St(r,!0,-1),o=r.input.charCodeAt(r.position),!(r.lineIndent>0||o!==37));){for(s=!0,o=r.input.charCodeAt(++r.position),t=r.position;o!==0&&!or(o);)o=r.input.charCodeAt(++r.position);for(n=r.input.slice(t,r.position),i=[],n.length<1&&xe(r,"directive name must not be less than one character in length");o!==0;){for(;pi(o);)o=r.input.charCodeAt(++r.position);if(o===35){do o=r.input.charCodeAt(++r.position);while(o!==0&&!Qr(o));break}if(Qr(o))break;for(t=r.position;o!==0&&!or(o);)o=r.input.charCodeAt(++r.position);i.push(r.input.slice(t,r.position))}o!==0&&Xl(r),jn.call(ah,n)?ah[n](r,n,i):Jo(r,'unknown document directive "'+n+'"')}if(St(r,!0,-1),r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45?(r.position+=3,St(r,!0,-1)):s&&xe(r,"directives end mark is expected"),Ui(r,r.lineIndent-1,Yo,!1,!0),St(r,!0,-1),r.checkLineBreaks&&Kb.test(r.input.slice(e,r.position))&&Jo(r,"non-ASCII line breaks are interpreted as content"),r.documents.push(r.result),r.position===r.lineStart&&Qo(r)){r.input.charCodeAt(r.position)===46&&(r.position+=3,St(r,!0,-1));return}if(r.position<r.length-1)xe(r,"end of the stream or a document separator is expected");else return}function uh(r,e){r=String(r),e=e||{},r.length!==0&&(r.charCodeAt(r.length-1)!==10&&r.charCodeAt(r.length-1)!==13&&(r+=`
|
|
32
|
+
`),r.charCodeAt(0)===65279&&(r=r.slice(1)));var t=new _b(r,e),n=r.indexOf("\0");for(n!==-1&&(t.position=n,xe(t,"null byte is not allowed in input")),t.input+="\0";t.input.charCodeAt(t.position)===32;)t.lineIndent+=1,t.position+=1;for(;t.position<t.length-1;)l1(t);return t.documents}function c1(r,e,t){e!==null&&typeof e=="object"&&typeof t>"u"&&(t=e,e=null);var n=uh(r,t);if(typeof e!="function")return n;for(var i=0,s=n.length;i<s;i+=1)e(n[i])}function u1(r,e){var t=uh(r,e);if(t.length!==0){if(t.length===1)return t[0];throw new ht("expected a single document in the stream, but found more")}}var f1=c1,h1=u1,fh={loadAll:f1,load:h1},hh=Object.prototype.toString,dh=Object.prototype.hasOwnProperty,_l=65279,d1=9,Ds=10,p1=13,g1=32,m1=33,v1=34,ql=35,y1=37,b1=38,x1=39,w1=42,ph=44,S1=45,Xo=58,k1=61,A1=62,C1=63,O1=64,gh=91,mh=93,E1=96,vh=123,T1=124,yh=125,zt={};zt[0]="\\0",zt[7]="\\a",zt[8]="\\b",zt[9]="\\t",zt[10]="\\n",zt[11]="\\v",zt[12]="\\f",zt[13]="\\r",zt[27]="\\e",zt[34]='\\"',zt[92]="\\\\",zt[133]="\\N",zt[160]="\\_",zt[8232]="\\L",zt[8233]="\\P";var P1=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],M1=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function I1(r,e){var t,n,i,s,o,a,l;if(e===null)return{};for(t={},n=Object.keys(e),i=0,s=n.length;i<s;i+=1)o=n[i],a=String(e[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),l=r.compiledTypeMap.fallback[o],l&&dh.call(l.styleAliases,a)&&(a=l.styleAliases[a]),t[o]=a;return t}function D1(r){var e,t,n;if(e=r.toString(16).toUpperCase(),r<=255)t="x",n=2;else if(r<=65535)t="u",n=4;else if(r<=4294967295)t="U",n=8;else throw new ht("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+t+Ne.repeat("0",n-e.length)+e}var N1=1,Ns=2;function R1(r){this.schema=r.schema||Jl,this.indent=Math.max(1,r.indent||2),this.noArrayIndent=r.noArrayIndent||!1,this.skipInvalid=r.skipInvalid||!1,this.flowLevel=Ne.isNothing(r.flowLevel)?-1:r.flowLevel,this.styleMap=I1(this.schema,r.styles||null),this.sortKeys=r.sortKeys||!1,this.lineWidth=r.lineWidth||80,this.noRefs=r.noRefs||!1,this.noCompatMode=r.noCompatMode||!1,this.condenseFlow=r.condenseFlow||!1,this.quotingType=r.quotingType==='"'?Ns:N1,this.forceQuotes=r.forceQuotes||!1,this.replacer=typeof r.replacer=="function"?r.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function bh(r,e){for(var t=Ne.repeat(" ",e),n=0,i=-1,s="",o,a=r.length;n<a;)i=r.indexOf(`
|
|
33
33
|
`,n),i===-1?(o=r.slice(n),n=a):(o=r.slice(n,i+1),n=i+1),o.length&&o!==`
|
|
34
34
|
`&&(s+=t),s+=o;return s}function ec(r,e){return`
|
|
35
|
-
`+Ne.repeat(" ",r.indent*e)}function
|
|
35
|
+
`+Ne.repeat(" ",r.indent*e)}function L1(r,e){var t,n,i;for(t=0,n=r.implicitTypes.length;t<n;t+=1)if(i=r.implicitTypes[t],i.resolve(e))return!0;return!1}function Zo(r){return r===g1||r===d1}function Rs(r){return 32<=r&&r<=126||161<=r&&r<=55295&&r!==8232&&r!==8233||57344<=r&&r<=65533&&r!==_l||65536<=r&&r<=1114111}function xh(r){return Rs(r)&&r!==_l&&r!==p1&&r!==Ds}function wh(r,e,t){var n=xh(r),i=n&&!Zo(r);return(t?n:n&&r!==ph&&r!==gh&&r!==mh&&r!==vh&&r!==yh)&&r!==ql&&!(e===Xo&&!i)||xh(e)&&!Zo(e)&&r===ql||e===Xo&&i}function B1(r){return Rs(r)&&r!==_l&&!Zo(r)&&r!==S1&&r!==C1&&r!==Xo&&r!==ph&&r!==gh&&r!==mh&&r!==vh&&r!==yh&&r!==ql&&r!==b1&&r!==w1&&r!==m1&&r!==T1&&r!==k1&&r!==A1&&r!==x1&&r!==v1&&r!==y1&&r!==O1&&r!==E1}function F1(r){return!Zo(r)&&r!==Xo}function Ls(r,e){var t=r.charCodeAt(e),n;return t>=55296&&t<=56319&&e+1<r.length&&(n=r.charCodeAt(e+1),n>=56320&&n<=57343)?(t-55296)*1024+n-56320+65536:t}function Sh(r){var e=/^\n* /;return e.test(r)}var kh=1,tc=2,Ah=3,Ch=4,Gi=5;function j1(r,e,t,n,i,s,o,a){var l,c=0,u=null,h=!1,d=!1,p=n!==-1,m=-1,y=B1(Ls(r,0))&&F1(Ls(r,r.length-1));if(e||o)for(l=0;l<r.length;c>=65536?l+=2:l++){if(c=Ls(r,l),!Rs(c))return Gi;y=y&&wh(c,u,a),u=c}else{for(l=0;l<r.length;c>=65536?l+=2:l++){if(c=Ls(r,l),c===Ds)h=!0,p&&(d=d||l-m-1>n&&r[m+1]!==" ",m=l);else if(!Rs(c))return Gi;y=y&&wh(c,u,a),u=c}d=d||p&&l-m-1>n&&r[m+1]!==" "}return!h&&!d?y&&!o&&!i(r)?kh:s===Ns?Gi:tc:t>9&&Sh(r)?Gi:o?s===Ns?Gi:tc:d?Ch:Ah}function V1(r,e,t,n,i){r.dump=function(){if(e.length===0)return r.quotingType===Ns?'""':"''";if(!r.noCompatMode&&(P1.indexOf(e)!==-1||M1.test(e)))return r.quotingType===Ns?'"'+e+'"':"'"+e+"'";var s=r.indent*Math.max(1,t),o=r.lineWidth===-1?-1:Math.max(Math.min(r.lineWidth,40),r.lineWidth-s),a=n||r.flowLevel>-1&&t>=r.flowLevel;function l(c){return L1(r,c)}switch(j1(e,a,r.indent,o,l,r.quotingType,r.forceQuotes&&!n,i)){case kh:return e;case tc:return"'"+e.replace(/'/g,"''")+"'";case Ah:return"|"+Oh(e,r.indent)+Eh(bh(e,s));case Ch:return">"+Oh(e,r.indent)+Eh(bh(W1(e,o),s));case Gi:return'"'+$1(e)+'"';default:throw new ht("impossible error: invalid scalar style")}}()}function Oh(r,e){var t=Sh(r)?String(e):"",n=r[r.length-1]===`
|
|
36
36
|
`,i=n&&(r[r.length-2]===`
|
|
37
37
|
`||r===`
|
|
38
38
|
`),s=i?"+":n?"":"-";return t+s+`
|
|
39
39
|
`}function Eh(r){return r[r.length-1]===`
|
|
40
|
-
`?r.slice(0,-1):r}function
|
|
40
|
+
`?r.slice(0,-1):r}function W1(r,e){for(var t=/(\n+)([^\n]*)/g,n=function(){var c=r.indexOf(`
|
|
41
41
|
`);return c=c!==-1?c:r.length,t.lastIndex=c,Th(r.slice(0,c),e)}(),i=r[0]===`
|
|
42
42
|
`||r[0]===" ",s,o;o=t.exec(r);){var a=o[1],l=o[2];s=l[0]===" ",n+=a+(!i&&!s&&l!==""?`
|
|
43
43
|
`:"")+Th(l,e),i=s}return n}function Th(r,e){if(r===""||r[0]===" ")return r;for(var t=/ [^ ]/g,n,i=0,s,o=0,a=0,l="";n=t.exec(r);)a=n.index,a-i>e&&(s=o>i?o:a,l+=`
|
|
44
44
|
`+r.slice(i,s),i=s+1),o=a;return l+=`
|
|
45
45
|
`,r.length-i>e&&o>i?l+=r.slice(i,o)+`
|
|
46
|
-
`+r.slice(o+1):l+=r.slice(i),l.slice(1)}function
|
|
47
|
-
`:""}var K1=G1,Y1={dump:K1};function nc(r,e){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var J1=dt,Q1=xn,X1=Wr,Z1=Bn,_1=Li,q1=Jl,ex=fh.load,tx=fh.loadAll,rx=Y1.dump,nx=ht,ix={binary:Uo,float:Ps,map:Nn,null:Ce,pairs:Qf,set:Xf,timestamp:Fi,bool:Z,int:Ht,merge:ji,omap:Jf,seq:fi,str:Dn},sx=nc("safeLoad","load"),ox=nc("safeLoadAll","loadAll"),ax=nc("safeDump","dump"),lx={Type:J1,Schema:Q1,FAILSAFE_SCHEMA:X1,JSON_SCHEMA:Z1,CORE_SCHEMA:_1,DEFAULT_SCHEMA:q1,load:ex,loadAll:tx,dump:rx,YAMLException:nx,types:ix,safeLoad:sx,safeLoadAll:ox,safeDump:ax};const cx=lx,ux=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Ih,Blob:_o,File:Dh}=ux,fx=r=>":/?#[]@!$&'()*+,;=".indexOf(r)>-1,hx=r=>/^[a-z0-9\-._~]+$/i.test(r);function Ki(r){let{escape:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return typeof r=="number"&&(r=r.toString()),typeof r!="string"||!r.length||!e?r:t?JSON.parse(r):[...r].map(n=>{if(hx(n)||fx(n)&&e==="unsafe")return n;const i=new TextEncoder;return Array.from(i.encode(n)).map(o=>`0${o.toString(16).toUpperCase()}`.slice(-2)).map(o=>`%${o}`).join("")}).join("")}function ic(r){const{value:e}=r;return Array.isArray(e)?dx(r):typeof e=="object"?px(r):gx(r)}function dx(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=a=>Ki(a,{escape:s});if(n==="simple")return t.map(a=>o(a)).join(",");if(n==="label")return`.${t.map(a=>o(a)).join(".")}`;if(n==="matrix")return t.map(a=>o(a)).reduce((a,l)=>!a||i?`${a||""};${e}=${l}`:`${a},${l}`,"");if(n==="form"){const a=i?`&${e}=`:",";return t.map(l=>o(l)).join(a)}if(n==="spaceDelimited"){const a=i?`${e}=`:"";return t.map(l=>o(l)).join(` ${a}`)}if(n==="pipeDelimited"){const a=i?`${e}=`:"";return t.map(l=>o(l)).join(`|${a}`)}}function px(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=l=>Ki(l,{escape:s}),a=Object.keys(t);if(n==="simple")return a.reduce((l,c)=>{const u=o(t[c]),h=i?"=":",";return`${l?`${l},`:""}${c}${h}${u}`},"");if(n==="label")return a.reduce((l,c)=>{const u=o(t[c]),h=i?"=":".";return`${l?`${l}.`:"."}${c}${h}${u}`},"");if(n==="matrix"&&i)return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l};`:";"}${c}=${u}`},"");if(n==="matrix")return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l},`:`;${e}=`}${c},${u}`},"");if(n==="form")return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l}${i?"&":","}`:""}${c}${i?"=":","}${u}`},"")}function gx(r){let{key:e,value:t,style:n,escape:i}=r;const s=o=>Ki(o,{escape:i});if(n==="simple")return s(t);if(n==="label")return`.${s(t)}`;if(n==="matrix")return`;${e}=${s(t)}`;if(n==="form")return s(t);if(n==="deepObject")return s(t,{},!0)}const mx=(r,e)=>{e.body=r},sc={serializeRes:xx,mergeInQueryOrForm:Fh};async function vx(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof r=="object"&&(e=r,r=e.url),e.headers=e.headers||{},sc.mergeInQueryOrForm(e),e.headers&&Object.keys(e.headers).forEach(i=>{const s=e.headers[i];typeof s=="string"&&(e.headers[i]=s.replace(/\n+/g," "))}),e.requestInterceptor&&(e=await e.requestInterceptor(e)||e);const t=e.headers["content-type"]||e.headers["Content-Type"];/multipart\/form-data/i.test(t)&&e.body instanceof Ih&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await sc.serializeRes(n,r,e),e.responseInterceptor&&(n=await e.responseInterceptor(n)||n)}catch(i){if(!n)throw i;const s=new Error(n.statusText||`response status is ${n.status}`);throw s.status=n.status,s.statusCode=n.status,s.responseError=i,s}if(!n.ok){const i=new Error(n.statusText||`response status is ${n.status}`);throw i.status=n.status,i.statusCode=n.status,i.response=n,i}return n}const yx=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(r)};function bx(r,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(r):cx.load(r)}function xx(r,e){let{loadSpec:t=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n={ok:r.ok,url:r.url||e,status:r.status,statusText:r.statusText,headers:Sx(r.headers)},i=n.headers["content-type"],s=t||yx(i);return(s?r.text:r.blob||r.buffer).call(r).then(a=>{if(n.text=a,n.data=a,s)try{const l=bx(a,i);n.body=l,n.obj=l}catch(l){n.parseError=l}return n})}function wx(r){return r.includes(", ")?r.split(", "):r}function Sx(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return typeof r.entries!="function"?{}:Array.from(r.entries()).reduce((e,t)=>{let[n,i]=t;return e[n]=wx(i),e},{})}function oc(r,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(r&&typeof r=="object"&&typeof r.uri=="string"):typeof Dh<"u"&&r instanceof Dh||typeof _o<"u"&&r instanceof _o||ArrayBuffer.isView(r)?!0:r!==null&&typeof r=="object"&&typeof r.pipe=="function"}function Nh(r,e){return Array.isArray(r)&&r.some(t=>oc(t,e))}const kx={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Ax={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Rh(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{collectionFormat:n,allowEmptyValue:i,serializationOption:s,encoding:o}=e,a=typeof e=="object"&&!Array.isArray(e)?e.value:e,l=t?u=>u.toString():u=>encodeURIComponent(u),c=l(r);if(typeof a>"u"&&i)return[[c,""]];if(oc(a)||Nh(a))return[[c,a]];if(s)return Lh(r,a,t,s);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some(u=>u!=="undefined")){const{style:u,explode:h,allowReserved:d}=o;return Lh(r,a,t,{style:u,explode:h,allowReserved:d})}if(o.contentType){if(o.contentType==="application/json"){const u=typeof a=="string"?a:JSON.stringify(a);return[[c,l(u)]]}return[[c,l(a.toString())]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)&&a.every(u=>typeof u!="object")?[[c,a.map(l).join(",")]]:[[c,l(JSON.stringify(a))]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)?n==="multi"?[[c,a.map(l)]]:[[c,a.map(l).join(Ax[n||"csv"])]]:[[c,""]]}function Lh(r,e,t,n){const i=n.style||"form",s=typeof n.explode>"u"?i==="form":n.explode,o=t?!1:n&&n.allowReserved?"unsafe":"reserved",a=c=>Ki(c,{escape:o}),l=t?c=>c:c=>Ki(c,{escape:o});return typeof e!="object"?[[l(r),a(e)]]:Array.isArray(e)?s?[[l(r),e.map(a)]]:[[l(r),e.map(a).join(kx[i])]]:i==="deepObject"?Object.keys(e).map(c=>[l(`${r}[${c}]`),a(e[c])]):s?Object.keys(e).map(c=>[l(c),a(e[c])]):[[l(r),Object.keys(e).map(c=>[`${l(c)},${a(e[c])}`]).join(",")]]}function Cx(r){return Object.entries(r).reduce((e,t)=>{let[n,i]=t;for(const[s,o]of Rh(n,i,!0))if(Array.isArray(o))for(const a of o)if(ArrayBuffer.isView(a)){const l=new _o([a]);e.append(s,l)}else e.append(s,a);else if(ArrayBuffer.isView(o)){const a=new _o([o]);e.append(s,a)}else e.append(s,o);return e},new Ih)}function Bh(r){const e=Object.keys(r).reduce((t,n)=>{for(const[i,s]of Rh(n,r[n]))t[i]=s;return t},{});return $e().stringify(e,{encode:!1,indices:!1})||""}function Fh(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{url:e="",query:t,form:n}=r,i=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];const l=o.filter(c=>c).join("&");return l?`?${l}`:""};if(n){const s=Object.keys(n).some(a=>{const{value:l}=n[a];return oc(l)||Nh(l)}),o=r.headers["content-type"]||r.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const a=Cx(r.form);mx(a,r)}else r.body=Bh(n);delete r.form}if(t){const[s,o]=e.split("?");let a="";if(o){const c=$e().parse(o);Object.keys(t).forEach(h=>delete c[h]),a=$e().stringify(c,{encode:!0})}const l=i(a,Bh(t));r.url=s+l,delete r.query}return r}function UI(r,e,t){return t=t||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),sc.mergeInQueryOrForm(n),n=e(n),t(r(n)))}function Ox(r,e){function t(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack;for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];[this.message]=i,e&&e.apply(this,i)}return t.prototype=new Error,t.prototype.name=r,t.prototype.constructor=t,t}const Ex={body:Tx,header:Mx,query:Dx,path:Ix,formData:Px};function Tx(r){let{req:e,value:t}=r;e.body=t}function Px(r){let{req:e,value:t,parameter:n}=r;(t||n.allowEmptyValue)&&(e.form=e.form||{},e.form[n.name]={value:t,allowEmptyValue:n.allowEmptyValue,collectionFormat:n.collectionFormat})}function Mx(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{},typeof n<"u"&&(e.headers[t.name]=n)}function Ix(r){let{req:e,value:t,parameter:n}=r;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(t))}function Dx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},t===!1&&n.type==="boolean"&&(t="false"),t===0&&["number","integer"].indexOf(n.type)>-1&&(t="0"),t)e.query[n.name]={collectionFormat:n.collectionFormat,value:t};else if(n.allowEmptyValue&&t!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}function qo(r,e){return e.includes("application/json")?typeof r=="string"?r:JSON.stringify(r):r.toString()}function Nx(r){let{req:e,value:t,parameter:n}=r;const{name:i,style:s,explode:o,content:a}=n;if(a){const c=Object.keys(a)[0];e.url=e.url.split(`{${i}}`).join(Ki(qo(t,c),{escape:!0}));return}const l=ic({key:n.name,value:t,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(l)}function Rx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=qo(t,i);if(s)e.query[n.name]=s;else if(n.allowEmptyValue&&t!==void 0){const o=n.name;e.query[o]=e.query[o]||{},e.query[o].allowEmptyValue=!0}return}if(t===!1&&(t="false"),t===0&&(t="0"),t){const{style:i,explode:s,allowReserved:o}=n;e.query[n.name]={value:t,serializationOption:{style:i,explode:s,allowReserved:o}}}else if(n.allowEmptyValue&&t!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}const Lx=["accept","authorization","content-type"];function Bx(r){let{req:e,parameter:t,value:n}=r;if(e.headers=e.headers||{},!(Lx.indexOf(t.name.toLowerCase())>-1)){if(t.content){const i=Object.keys(t.content)[0];e.headers[t.name]=qo(n,i);return}typeof n<"u"&&(e.headers[t.name]=ic({key:t.name,value:n,style:t.style||"simple",explode:typeof t.explode>"u"?!1:t.explode,escape:!1}))}}function Fx(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{};const i=typeof n;if(t.content){const s=Object.keys(t.content)[0];e.headers.Cookie=`${t.name}=${qo(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&t.explode?"":`${t.name}=`;e.headers.Cookie=s+ic({key:t.name,value:n,escape:!1,style:t.style||"form",explode:typeof t.explode>"u"?!1:t.explode})}}const jx=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:Vx}=jx,jh=Vx;function Wx(r,e){const{operation:t,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=r;let{requestContentType:a}=r;e=$x({request:e,securities:i,operation:t,spec:s});const l=t.requestBody||{},c=Object.keys(l.content||{}),u=a&&c.indexOf(a)>-1;if(n||o){if(a&&u)e.headers["Content-Type"]=a;else if(!a){const h=c[0];h&&(e.headers["Content-Type"]=h,a=h)}}else a&&u&&(e.headers["Content-Type"]=a);if(!r.responseContentType&&t.responses){const h=Object.entries(t.responses).filter(d=>{let[p,m]=d;const y=parseInt(p,10);return y>=200&&y<300&&pe(m.content)}).reduce((d,p)=>{let[,m]=p;return d.concat(Object.keys(m.content))},[]);h.length>0&&(e.headers.accept=h.join(", "))}if(n)if(a){if(c.indexOf(a)>-1)if(a==="application/x-www-form-urlencoded"||a==="multipart/form-data")if(typeof n=="object"){const h=(l.content[a]||{}).encoding||{};e.form={},Object.keys(n).forEach(d=>{e.form[d]={value:n[d],encoding:h[d]||{}}})}else e.form=n;else e.body=n}else e.body=n;return e}function $x(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=ee({},e),{authorized:o={}}=t,a=n.security||i.security||[],l=o&&!!Object.keys(o).length,c=ce()(i,["components","securitySchemes"])||{};return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!l||!a||Array.isArray(n.security)&&!n.security.length?e:(a.forEach(u=>{Object.keys(u).forEach(h=>{const d=o[h],p=c[h];if(!d)return;const m=d.value||d,{type:y}=p;if(d){if(y==="apiKey")p.in==="query"&&(s.query[p.name]=m),p.in==="header"&&(s.headers[p.name]=m),p.in==="cookie"&&(s.cookies[p.name]=m);else if(y==="http"){if(/^basic$/i.test(p.scheme)){const w=m.username||"",A=m.password||"",T=jh(`${w}:${A}`);s.headers.Authorization=`Basic ${T}`}/^bearer$/i.test(p.scheme)&&(s.headers.Authorization=`Bearer ${m}`)}else if(y==="oauth2"||y==="openIdConnect"){const w=d.token||{},A=p["x-tokenName"]||"access_token",T=w[A];let P=w.token_type;(!P||P.toLowerCase()==="bearer")&&(P="Bearer"),s.headers.Authorization=`${P} ${T}`}}})}),s)}function Hx(r,e){const{spec:t,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:a}=r;if(e=zx({request:e,securities:i,operation:n,spec:t}),e.body||e.form||a)s?e.headers["Content-Type"]=s:Array.isArray(n.consumes)?[e.headers["Content-Type"]]=n.consumes:Array.isArray(t.consumes)?[e.headers["Content-Type"]]=t.consumes:n.parameters&&n.parameters.filter(l=>l.type==="file").length?e.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter(l=>l.in==="formData").length&&(e.headers["Content-Type"]="application/x-www-form-urlencoded");else if(s){const l=n.parameters&&n.parameters.filter(u=>u.in==="body").length>0,c=n.parameters&&n.parameters.filter(u=>u.in==="formData").length>0;(l||c)&&(e.headers["Content-Type"]=s)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(e.headers.accept=n.produces.join(", ")),e}function zx(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=ee({},e),{authorized:o={},specSecurity:a=[]}=t,l=n.security||a,c=o&&!!Object.keys(o).length,u=i.securityDefinitions;return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!c||!l||Array.isArray(n.security)&&!n.security.length?e:(l.forEach(h=>{Object.keys(h).forEach(d=>{const p=o[d];if(!p)return;const{token:m}=p,y=p.value||p,w=u[d],{type:A}=w,T=w["x-tokenName"]||"access_token",P=m&&m[T];let L=m&&m.token_type;if(p)if(A==="apiKey"){const D=w.in==="query"?"query":"headers";s[D]=s[D]||{},s[D][w.name]=y}else if(A==="basic")if(y.header)s.headers.authorization=y.header;else{const D=y.username||"",j=y.password||"";y.base64=jh(`${D}:${j}`),s.headers.authorization=`Basic ${y.base64}`}else A==="oauth2"&&P&&(L=!L||L.toLowerCase()==="bearer"?"Bearer":L,s.headers.authorization=`${L} ${P}`)})}),s)}function Vh(r,e){return`${e.toLowerCase()}-${r}`}function Ux(r,e,t){if(!r||typeof r!="object"||!r.paths||typeof r.paths!="object")return null;const{paths:n}=r;for(const i in n)for(const s in n[i]){if(s.toUpperCase()==="PARAMETERS")continue;const o=n[i][s];if(!o||typeof o!="object")continue;const a={spec:r,pathName:i,method:s.toUpperCase(),operation:o},l=e(a);if(t&&l)return a}}function Gx(r,e){return Ux(r,e,!0)||null}const Wh=r=>r.replace(/\W/gi,"_");function Kx(r,e){let{v2OperationIdCompatibilityMode:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(t){let n=`${e.toLowerCase()}_${r}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return n=n||`${r.substring(1)}_${e}`,n.replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return`${e.toLowerCase()}${Wh(r)}`}function Yx(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{v2OperationIdCompatibilityMode:n}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return!r||typeof r!="object"?null:(r.operationId||"").replace(/\s/g,"").length?Wh(r.operationId):Kx(e,t,{v2OperationIdCompatibilityMode:n})}function Jx(r,e){return!r||!r.paths?null:Gx(r,t=>{let{pathName:n,method:i,operation:s}=t;if(!s||typeof s!="object")return!1;const o=s.operationId,a=Yx(s,n,i),l=Vh(n,i);return[a,l,o].some(c=>c&&c===e)})}const KI=r=>{try{const{swagger:e}=r;return e==="2.0"}catch{return!1}},Qx=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},Xx=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},$h=r=>Qx(r)||Xx(r),Zx=["http","fetch","spec","operationId","pathName","method","parameters","securities"],Hh=r=>Array.isArray(r)?r:[],_x=Ox("OperationNotFoundError",function(e,t,n){this.originalError=n,Object.assign(this,t||{})}),qx=(r,e)=>e.filter(t=>t.name===r),ew=r=>{const e={};r.forEach(n=>{e[n.in]||(e[n.in]={}),e[n.in][n.name]=n});const t=[];return Object.keys(e).forEach(n=>{Object.keys(e[n]).forEach(i=>{t.push(e[n][i])})}),t},tw={buildRequest:nw};function rw(r){let{http:e,fetch:t,spec:n,operationId:i,pathName:s,method:o,parameters:a,securities:l}=r,c=ne(r,Zx);const u=e||t||vx;s&&o&&!i&&(i=Vh(s,o));const h=tw.buildRequest(ee({spec:n,operationId:i,parameters:a,securities:l,http:u},c));return h.body&&(pe(h.body)||Array.isArray(h.body))&&(h.body=JSON.stringify(h.body)),u(h)}function nw(r){const{spec:e,operationId:t,responseContentType:n,scheme:i,requestInterceptor:s,responseInterceptor:o,contextUrl:a,userFetch:l,server:c,serverVariables:u,http:h,signal:d}=r;let{parameters:p,parameterBuilders:m}=r;const y=$h(e);m||(y?m=g:m=Ex);let A={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};d&&(A.signal=d),s&&(A.requestInterceptor=s),o&&(A.responseInterceptor=o),l&&(A.userFetch=l);const T=Jx(e,t);if(!T)throw new _x(`Operation ${t} not found`);const{operation:P={},method:L,pathName:D}=T;if(A.url+=iw({spec:e,scheme:i,contextUrl:a,server:c,serverVariables:u,pathName:D,method:L}),!t)return delete A.cookies,A;A.url+=D,A.method=`${L}`.toUpperCase(),p=p||{};const j=e.paths[D]||{};n&&(A.headers.accept=n);const W=ew([].concat(Hh(P.parameters)).concat(Hh(j.parameters)));W.forEach(F=>{const H=m[F.in];let Q;if(F.in==="body"&&F.schema&&F.schema.properties&&(Q=p),Q=F&&F.name&&p[F.name],typeof Q>"u"?Q=F&&F.name&&p[`${F.in}.${F.name}`]:qx(F.name,W).length>1&&console.warn(`Parameter '${F.name}' is ambiguous because the defined spec has more than one parameter with the name: '${F.name}' and the passed-in parameter values did not define an 'in' value.`),Q!==null){if(typeof F.default<"u"&&typeof Q>"u"&&(Q=F.default),typeof Q>"u"&&F.required&&!F.allowEmptyValue)throw new Error(`Required parameter ${F.name} is not provided`);if(y&&F.schema&&F.schema.type==="object"&&typeof Q=="string")try{Q=JSON.parse(Q)}catch{throw new Error("Could not parse object parameter value string as JSON")}H&&H({req:A,parameter:F,value:Q,operation:P,spec:e})}});const q=ee(ee({},r),{},{operation:P});if(y?A=Wx(q,A):A=Hx(q,A),A.cookies&&Object.keys(A.cookies).length){const F=Object.keys(A.cookies).reduce((H,Q)=>{const oe=A.cookies[Q],fe=H?"&":"",be=K.serialize(Q,oe);return H+fe+be},"");A.headers.Cookie=F}return A.cookies&&delete A.cookies,Fh(A),A}const ac=r=>r?r.replace(/\W/g,""):null;function iw(r){return $h(r.spec)?sw(r):lw(r)}function sw(r){let{spec:e,pathName:t,method:n,server:i,contextUrl:s,serverVariables:o={}}=r;const a=ce()(e,["paths",t,(n||"").toLowerCase(),"servers"])||ce()(e,["paths",t,"servers"])||ce()(e,["servers"]);let l="",c=null;if(i&&a&&a.length){const u=a.map(h=>h.url);u.indexOf(i)>-1&&(l=i,c=a[u.indexOf(i)])}return!l&&a&&a.length&&(l=a[0].url,[c]=a),l.indexOf("{")>-1&&aw(l).forEach(h=>{if(c.variables&&c.variables[h]){const d=c.variables[h],p=o[h]||d.default,m=new RegExp(`{${h}}`,"g");l=l.replace(m,p)}}),ow(l,s)}function ow(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const t=r&&e?V.parse(V.resolve(e,r)):V.parse(r),n=V.parse(e),i=ac(t.protocol)||ac(n.protocol)||"",s=t.host||n.host,o=t.pathname||"";let a;return i&&s?a=`${i}://${s+o}`:a=o,a[a.length-1]==="/"?a.slice(0,-1):a}function aw(r){const e=[],t=/{([^}]+)}/g;let n;for(;n=t.exec(r);)e.push(n[1]);return e}function lw(r){let{spec:e,scheme:t,contextUrl:n=""}=r;const i=V.parse(n),s=Array.isArray(e.schemes)?e.schemes[0]:null,o=t||s||ac(i.protocol)||"http",a=e.host||i.host||"",l=e.basePath||"";let c;return o&&a?c=`${o}://${a+l}`:c=l,c[c.length-1]==="/"?c.slice(0,-1):c}var S=f(29901),pt=f(20202),$r=f(44411),gt=f(88606),cw=f(81570),uw=f(74025),fw=f(2526),hw=Object.defineProperty,dw=Object.defineProperties,pw=Object.getOwnPropertyDescriptors,zh=Object.getOwnPropertySymbols,gw=Object.prototype.hasOwnProperty,mw=Object.prototype.propertyIsEnumerable,Uh=(r,e,t)=>e in r?hw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,vw=(r,e)=>{for(var t in e||(e={}))gw.call(e,t)&&Uh(r,t,e[t]);if(zh)for(var t of zh(e))mw.call(e,t)&&Uh(r,t,e[t]);return r},yw=(r,e)=>dw(r,pw(e)),bw=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function xw(r,e){return bw(this,null,function*(){var t,n,i,s;const o=JSON.parse(JSON.stringify(e)),a=o.openapi?{openapi:o.openapi}:o.swagger?{swagger:o.swagger}:{},l=yw(vw({},a),{components:o.components,paths:{[r.path]:{[r.httpVerb]:(n=(t=o.paths)==null?void 0:t[r.path])==null?void 0:n[r.httpVerb],parameters:(s=(i=o.paths)==null?void 0:i[r.path])==null?void 0:s.parameters}}}),c=new uw.Config({}),u=(0,fw.I)(l),h={config:c,doc:u,dereference:!0};return yield(0,cw.bundle)(h),o})}var ww=f(98910),ea=f(84862),Xr=f(53134),Gh=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const Kh=Object.values(Xr.FileUploadFormats),Sw=["application/octet-stream","application/pdf","application/gzip","application/zip"],Yh=["image/","audio/","video/"];function Jh(r){if(Yh.some(e=>r.startsWith(e)))return r}function ta(r){return Sw.includes(r)?!0:Yh.some(e=>r.startsWith(e))}function kw(r){const e=r.type==="array"?r.items:r;if(!e||!e.type||e?.type==="any")return!0;const t=e.contentMediaType||"",n=e.format||e.contentEncoding||(ta(t)?"binary":"");return e.type===Xr.DefinitionTypes.STRING&&Kh.includes(n)}function Qh(r,e){if(!r||!r.type||r.type==="any")return ta(e);const t=r.format||r.contentEncoding||"";return r.type===Xr.DefinitionTypes.STRING&&Kh.includes(t)}function Xh(r){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{const s=n.result.replace(/data:.*\/.*;base64,/g,"");e(s)},n.onerror=()=>t(n.error),n.readAsDataURL(r)})}function Zh({format:r,contentEncoding:e,contentMediaType:t}){return[r,e,t].includes(Xr.FileUploadFormats.BASE64)}function Aw(r,e){return Gh(this,null,function*(){const t=Object.values(r);let n=t.length===1?t[0]:t;return e.type===Xr.DefinitionTypes.STRING&&Zh(e)?n=yield Xh(t[0]):e.type===Xr.DefinitionTypes.ARRAY&&e.items&&(Zh(e.items)?n=yield Promise.all(t.map(s=>Gh(this,null,function*(){return yield Xh(s)}))):n=t),n})}var lc=f(84622),je=f(38612),Je=f(97495),Ee=f(85739),Mr=f(71608),Cw=f(64393),Wn=f(60991);function Ow({response:r}){const{jsonSampleExpandLevel:e}=(0,$r.Dv)(Wn.qd);return S.createElement(S.Fragment,null,S.createElement(Mr.EE,null," Body: "),Ew(r,e))}function Ew(r,e){return r.body?S.createElement(pt.JsonViewer,{data:r.body,jsonSampleExpandLevel:e}):r.fileInfo?S.createElement(Cw.s,{fileInfo:r.fileInfo}):r.data!==null?r.data?S.createElement(pt.CodeBlock,{lang:(0,Ee.M)(r.headers["Content-Type"]||"text/plain"),source:r.data,header:{controls:{copy:{}}}}):S.createElement(pt.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Tw({headers:r}){const e=(0,$r.Dv)(Wn.qd),[t,n]=(0,S.useState)(!0),{maxResponseHeadersToShowInTryIt:i}=e,s=Object.keys(r),o=!!i&&s.length>i,a=o&&t?[...s].splice(0,i):[...s],l=()=>{n(!t)};return S.createElement(S.Fragment,null,S.createElement(Mr.EE,null," Headers: "),S.createElement(pt.CodeBlockContainer,{withControls:!0},a.map(c=>S.createElement("div",{key:c},S.createElement(_h,null,c,":"),S.createElement("code",null,r[c]))),o&&S.createElement(qh,{onClick:l},t?"Show more...":"Hide headers")))}const _h=Je.ZP.strong`
|
|
46
|
+
`+r.slice(o+1):l+=r.slice(i),l.slice(1)}function $1(r){for(var e="",t=0,n,i=0;i<r.length;t>=65536?i+=2:i++)t=Ls(r,i),n=zt[t],!n&&Rs(t)?(e+=r[i],t>=65536&&(e+=r[i+1])):e+=n||D1(t);return e}function H1(r,e,t){var n="",i=r.tag,s,o,a;for(s=0,o=t.length;s<o;s+=1)a=t[s],r.replacer&&(a=r.replacer.call(t,String(s),a)),(Sn(r,e,a,!1,!1)||typeof a>"u"&&Sn(r,e,null,!1,!1))&&(n!==""&&(n+=","+(r.condenseFlow?"":" ")),n+=r.dump);r.tag=i,r.dump="["+n+"]"}function Ph(r,e,t,n){var i="",s=r.tag,o,a,l;for(o=0,a=t.length;o<a;o+=1)l=t[o],r.replacer&&(l=r.replacer.call(t,String(o),l)),(Sn(r,e+1,l,!0,!0,!1,!0)||typeof l>"u"&&Sn(r,e+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=ec(r,e)),r.dump&&Ds===r.dump.charCodeAt(0)?i+="-":i+="- ",i+=r.dump);r.tag=s,r.dump=i||"[]"}function z1(r,e,t){var n="",i=r.tag,s=Object.keys(t),o,a,l,c,u;for(o=0,a=s.length;o<a;o+=1)u="",n!==""&&(u+=", "),r.condenseFlow&&(u+='"'),l=s[o],c=t[l],r.replacer&&(c=r.replacer.call(t,l,c)),Sn(r,e,l,!1,!1)&&(r.dump.length>1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),Sn(r,e,c,!1,!1)&&(u+=r.dump,n+=u));r.tag=i,r.dump="{"+n+"}"}function U1(r,e,t,n){var i="",s=r.tag,o=Object.keys(t),a,l,c,u,h,d;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new ht("sortKeys must be a boolean or a function");for(a=0,l=o.length;a<l;a+=1)d="",(!n||i!=="")&&(d+=ec(r,e)),c=o[a],u=t[c],r.replacer&&(u=r.replacer.call(t,c,u)),Sn(r,e+1,c,!0,!0,!0)&&(h=r.tag!==null&&r.tag!=="?"||r.dump&&r.dump.length>1024,h&&(r.dump&&Ds===r.dump.charCodeAt(0)?d+="?":d+="? "),d+=r.dump,h&&(d+=ec(r,e)),Sn(r,e+1,u,!0,h)&&(r.dump&&Ds===r.dump.charCodeAt(0)?d+=":":d+=": ",d+=r.dump,i+=d));r.tag=s,r.dump=i||"{}"}function Mh(r,e,t){var n,i,s,o,a,l;for(i=t?r.explicitTypes:r.implicitTypes,s=0,o=i.length;s<o;s+=1)if(a=i[s],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof e=="object"&&e instanceof a.instanceOf)&&(!a.predicate||a.predicate(e))){if(t?a.multi&&a.representName?r.tag=a.representName(e):r.tag=a.tag:r.tag="?",a.represent){if(l=r.styleMap[a.tag]||a.defaultStyle,hh.call(a.represent)==="[object Function]")n=a.represent(e,l);else if(dh.call(a.represent,l))n=a.represent[l](e,l);else throw new ht("!<"+a.tag+'> tag resolver accepts not "'+l+'" style');r.dump=n}return!0}return!1}function Sn(r,e,t,n,i,s,o){r.tag=null,r.dump=t,Mh(r,t,!1)||Mh(r,t,!0);var a=hh.call(r.dump),l=n,c;n&&(n=r.flowLevel<0||r.flowLevel>e);var u=a==="[object Object]"||a==="[object Array]",h,d;if(u&&(h=r.duplicates.indexOf(t),d=h!==-1),(r.tag!==null&&r.tag!=="?"||d||r.indent!==2&&e>0)&&(i=!1),d&&r.usedDuplicates[h])r.dump="*ref_"+h;else{if(u&&d&&!r.usedDuplicates[h]&&(r.usedDuplicates[h]=!0),a==="[object Object]")n&&Object.keys(r.dump).length!==0?(U1(r,e,r.dump,i),d&&(r.dump="&ref_"+h+r.dump)):(z1(r,e,r.dump),d&&(r.dump="&ref_"+h+" "+r.dump));else if(a==="[object Array]")n&&r.dump.length!==0?(r.noArrayIndent&&!o&&e>0?Ph(r,e-1,r.dump,i):Ph(r,e,r.dump,i),d&&(r.dump="&ref_"+h+r.dump)):(H1(r,e,r.dump),d&&(r.dump="&ref_"+h+" "+r.dump));else if(a==="[object String]")r.tag!=="?"&&V1(r,r.dump,e,s,l);else{if(a==="[object Undefined]")return!1;if(r.skipInvalid)return!1;throw new ht("unacceptable kind of an object to dump "+a)}r.tag!==null&&r.tag!=="?"&&(c=encodeURI(r.tag[0]==="!"?r.tag.slice(1):r.tag).replace(/!/g,"%21"),r.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",r.dump=c+" "+r.dump)}return!0}function G1(r,e){var t=[],n=[],i,s;for(rc(r,t,n),i=0,s=n.length;i<s;i+=1)e.duplicates.push(t[n[i]]);e.usedDuplicates=new Array(s)}function rc(r,e,t){var n,i,s;if(r!==null&&typeof r=="object")if(i=e.indexOf(r),i!==-1)t.indexOf(i)===-1&&t.push(i);else if(e.push(r),Array.isArray(r))for(i=0,s=r.length;i<s;i+=1)rc(r[i],e,t);else for(n=Object.keys(r),i=0,s=n.length;i<s;i+=1)rc(r[n[i]],e,t)}function K1(r,e){e=e||{};var t=new R1(e);t.noRefs||G1(r,t);var n=r;return t.replacer&&(n=t.replacer.call({"":n},"",n)),Sn(t,0,n,!0,!0)?t.dump+`
|
|
47
|
+
`:""}var Y1=K1,J1={dump:Y1};function nc(r,e){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+e+" instead, which is now safe by default.")}}var Q1=dt,X1=xn,Z1=Wr,_1=Bn,q1=Li,ex=Jl,tx=fh.load,rx=fh.loadAll,nx=J1.dump,ix=ht,sx={binary:Uo,float:Ps,map:Nn,null:Ce,pairs:Qf,set:Xf,timestamp:Fi,bool:Z,int:Ht,merge:ji,omap:Jf,seq:fi,str:Dn},ox=nc("safeLoad","load"),ax=nc("safeLoadAll","loadAll"),lx=nc("safeDump","dump"),cx={Type:Q1,Schema:X1,FAILSAFE_SCHEMA:Z1,JSON_SCHEMA:_1,CORE_SCHEMA:q1,DEFAULT_SCHEMA:ex,load:tx,loadAll:rx,dump:nx,YAMLException:ix,types:sx,safeLoad:ox,safeLoadAll:ax,safeDump:lx};const ux=cx,fx=function(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:window}(),{FormData:Ih,Blob:_o,File:Dh}=fx,hx=r=>":/?#[]@!$&'()*+,;=".indexOf(r)>-1,dx=r=>/^[a-z0-9\-._~]+$/i.test(r);function Ki(r){let{escape:e}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2?arguments[2]:void 0;return typeof r=="number"&&(r=r.toString()),typeof r!="string"||!r.length||!e?r:t?JSON.parse(r):[...r].map(n=>{if(dx(n)||hx(n)&&e==="unsafe")return n;const i=new TextEncoder;return Array.from(i.encode(n)).map(o=>`0${o.toString(16).toUpperCase()}`.slice(-2)).map(o=>`%${o}`).join("")}).join("")}function ic(r){const{value:e}=r;return Array.isArray(e)?px(r):typeof e=="object"?gx(r):mx(r)}function px(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=a=>Ki(a,{escape:s});if(n==="simple")return t.map(a=>o(a)).join(",");if(n==="label")return`.${t.map(a=>o(a)).join(".")}`;if(n==="matrix")return t.map(a=>o(a)).reduce((a,l)=>!a||i?`${a||""};${e}=${l}`:`${a},${l}`,"");if(n==="form"){const a=i?`&${e}=`:",";return t.map(l=>o(l)).join(a)}if(n==="spaceDelimited"){const a=i?`${e}=`:"";return t.map(l=>o(l)).join(` ${a}`)}if(n==="pipeDelimited"){const a=i?`${e}=`:"";return t.map(l=>o(l)).join(`|${a}`)}}function gx(r){let{key:e,value:t,style:n,explode:i,escape:s}=r;const o=l=>Ki(l,{escape:s}),a=Object.keys(t);if(n==="simple")return a.reduce((l,c)=>{const u=o(t[c]),h=i?"=":",";return`${l?`${l},`:""}${c}${h}${u}`},"");if(n==="label")return a.reduce((l,c)=>{const u=o(t[c]),h=i?"=":".";return`${l?`${l}.`:"."}${c}${h}${u}`},"");if(n==="matrix"&&i)return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l};`:";"}${c}=${u}`},"");if(n==="matrix")return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l},`:`;${e}=`}${c},${u}`},"");if(n==="form")return a.reduce((l,c)=>{const u=o(t[c]);return`${l?`${l}${i?"&":","}`:""}${c}${i?"=":","}${u}`},"")}function mx(r){let{key:e,value:t,style:n,escape:i}=r;const s=o=>Ki(o,{escape:i});if(n==="simple")return s(t);if(n==="label")return`.${s(t)}`;if(n==="matrix")return`;${e}=${s(t)}`;if(n==="form")return s(t);if(n==="deepObject")return s(t,{},!0)}const vx=(r,e)=>{e.body=r},sc={serializeRes:wx,mergeInQueryOrForm:Fh};async function yx(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof r=="object"&&(e=r,r=e.url),e.headers=e.headers||{},sc.mergeInQueryOrForm(e),e.headers&&Object.keys(e.headers).forEach(i=>{const s=e.headers[i];typeof s=="string"&&(e.headers[i]=s.replace(/\n+/g," "))}),e.requestInterceptor&&(e=await e.requestInterceptor(e)||e);const t=e.headers["content-type"]||e.headers["Content-Type"];/multipart\/form-data/i.test(t)&&e.body instanceof Ih&&(delete e.headers["content-type"],delete e.headers["Content-Type"]);let n;try{n=await(e.userFetch||fetch)(e.url,e),n=await sc.serializeRes(n,r,e),e.responseInterceptor&&(n=await e.responseInterceptor(n)||n)}catch(i){if(!n)throw i;const s=new Error(n.statusText||`response status is ${n.status}`);throw s.status=n.status,s.statusCode=n.status,s.responseError=i,s}if(!n.ok){const i=new Error(n.statusText||`response status is ${n.status}`);throw i.status=n.status,i.statusCode=n.status,i.response=n,i}return n}const bx=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";return/(json|xml|yaml|text)\b/.test(r)};function xx(r,e){return e&&(e.indexOf("application/json")===0||e.indexOf("+json")>0)?JSON.parse(r):ux.load(r)}function wx(r,e){let{loadSpec:t=!1}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n={ok:r.ok,url:r.url||e,status:r.status,statusText:r.statusText,headers:kx(r.headers)},i=n.headers["content-type"],s=t||bx(i);return(s?r.text:r.blob||r.buffer).call(r).then(a=>{if(n.text=a,n.data=a,s)try{const l=xx(a,i);n.body=l,n.obj=l}catch(l){n.parseError=l}return n})}function Sx(r){return r.includes(", ")?r.split(", "):r}function kx(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return typeof r.entries!="function"?{}:Array.from(r.entries()).reduce((e,t)=>{let[n,i]=t;return e[n]=Sx(i),e},{})}function oc(r,e){return!e&&typeof navigator<"u"&&(e=navigator),e&&e.product==="ReactNative"?!!(r&&typeof r=="object"&&typeof r.uri=="string"):typeof Dh<"u"&&r instanceof Dh||typeof _o<"u"&&r instanceof _o||ArrayBuffer.isView(r)?!0:r!==null&&typeof r=="object"&&typeof r.pipe=="function"}function Nh(r,e){return Array.isArray(r)&&r.some(t=>oc(t,e))}const Ax={form:",",spaceDelimited:"%20",pipeDelimited:"|"},Cx={csv:",",ssv:"%20",tsv:"%09",pipes:"|"};function Rh(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const{collectionFormat:n,allowEmptyValue:i,serializationOption:s,encoding:o}=e,a=typeof e=="object"&&!Array.isArray(e)?e.value:e,l=t?u=>u.toString():u=>encodeURIComponent(u),c=l(r);if(typeof a>"u"&&i)return[[c,""]];if(oc(a)||Nh(a))return[[c,a]];if(s)return Lh(r,a,t,s);if(o){if([typeof o.style,typeof o.explode,typeof o.allowReserved].some(u=>u!=="undefined")){const{style:u,explode:h,allowReserved:d}=o;return Lh(r,a,t,{style:u,explode:h,allowReserved:d})}if(o.contentType){if(o.contentType==="application/json"){const u=typeof a=="string"?a:JSON.stringify(a);return[[c,l(u)]]}return[[c,l(a.toString())]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)&&a.every(u=>typeof u!="object")?[[c,a.map(l).join(",")]]:[[c,l(JSON.stringify(a))]]}return typeof a!="object"?[[c,l(a)]]:Array.isArray(a)?n==="multi"?[[c,a.map(l)]]:[[c,a.map(l).join(Cx[n||"csv"])]]:[[c,""]]}function Lh(r,e,t,n){const i=n.style||"form",s=typeof n.explode>"u"?i==="form":n.explode,o=t?!1:n&&n.allowReserved?"unsafe":"reserved",a=c=>Ki(c,{escape:o}),l=t?c=>c:c=>Ki(c,{escape:o});return typeof e!="object"?[[l(r),a(e)]]:Array.isArray(e)?s?[[l(r),e.map(a)]]:[[l(r),e.map(a).join(Ax[i])]]:i==="deepObject"?Object.keys(e).map(c=>[l(`${r}[${c}]`),a(e[c])]):s?Object.keys(e).map(c=>[l(c),a(e[c])]):[[l(r),Object.keys(e).map(c=>[`${l(c)},${a(e[c])}`]).join(",")]]}function Ox(r){return Object.entries(r).reduce((e,t)=>{let[n,i]=t;for(const[s,o]of Rh(n,i,!0))if(Array.isArray(o))for(const a of o)if(ArrayBuffer.isView(a)){const l=new _o([a]);e.append(s,l)}else e.append(s,a);else if(ArrayBuffer.isView(o)){const a=new _o([o]);e.append(s,a)}else e.append(s,o);return e},new Ih)}function Bh(r){const e=Object.keys(r).reduce((t,n)=>{for(const[i,s]of Rh(n,r[n]))t[i]=s;return t},{});return $e().stringify(e,{encode:!1,indices:!1})||""}function Fh(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{url:e="",query:t,form:n}=r,i=function(){for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];const l=o.filter(c=>c).join("&");return l?`?${l}`:""};if(n){const s=Object.keys(n).some(a=>{const{value:l}=n[a];return oc(l)||Nh(l)}),o=r.headers["content-type"]||r.headers["Content-Type"];if(s||/multipart\/form-data/i.test(o)){const a=Ox(r.form);vx(a,r)}else r.body=Bh(n);delete r.form}if(t){const[s,o]=e.split("?");let a="";if(o){const c=$e().parse(o);Object.keys(t).forEach(h=>delete c[h]),a=$e().stringify(c,{encode:!0})}const l=i(a,Bh(t));r.url=s+l,delete r.query}return r}function GI(r,e,t){return t=t||(n=>n),e=e||(n=>n),n=>(typeof n=="string"&&(n={url:n}),sc.mergeInQueryOrForm(n),n=e(n),t(r(n)))}function Ex(r,e){function t(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack;for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];[this.message]=i,e&&e.apply(this,i)}return t.prototype=new Error,t.prototype.name=r,t.prototype.constructor=t,t}const Tx={body:Px,header:Ix,query:Nx,path:Dx,formData:Mx};function Px(r){let{req:e,value:t}=r;e.body=t}function Mx(r){let{req:e,value:t,parameter:n}=r;(t||n.allowEmptyValue)&&(e.form=e.form||{},e.form[n.name]={value:t,allowEmptyValue:n.allowEmptyValue,collectionFormat:n.collectionFormat})}function Ix(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{},typeof n<"u"&&(e.headers[t.name]=n)}function Dx(r){let{req:e,value:t,parameter:n}=r;e.url=e.url.split(`{${n.name}}`).join(encodeURIComponent(t))}function Nx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},t===!1&&n.type==="boolean"&&(t="false"),t===0&&["number","integer"].indexOf(n.type)>-1&&(t="0"),t)e.query[n.name]={collectionFormat:n.collectionFormat,value:t};else if(n.allowEmptyValue&&t!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}function qo(r,e){return e.includes("application/json")?typeof r=="string"?r:JSON.stringify(r):r.toString()}function Rx(r){let{req:e,value:t,parameter:n}=r;const{name:i,style:s,explode:o,content:a}=n;if(a){const c=Object.keys(a)[0];e.url=e.url.split(`{${i}}`).join(Ki(qo(t,c),{escape:!0}));return}const l=ic({key:n.name,value:t,style:s||"simple",explode:o||!1,escape:!0});e.url=e.url.split(`{${i}}`).join(l)}function Lx(r){let{req:e,value:t,parameter:n}=r;if(e.query=e.query||{},n.content){const i=Object.keys(n.content)[0],s=qo(t,i);if(s)e.query[n.name]=s;else if(n.allowEmptyValue&&t!==void 0){const o=n.name;e.query[o]=e.query[o]||{},e.query[o].allowEmptyValue=!0}return}if(t===!1&&(t="false"),t===0&&(t="0"),t){const{style:i,explode:s,allowReserved:o}=n;e.query[n.name]={value:t,serializationOption:{style:i,explode:s,allowReserved:o}}}else if(n.allowEmptyValue&&t!==void 0){const i=n.name;e.query[i]=e.query[i]||{},e.query[i].allowEmptyValue=!0}}const Bx=["accept","authorization","content-type"];function Fx(r){let{req:e,parameter:t,value:n}=r;if(e.headers=e.headers||{},!(Bx.indexOf(t.name.toLowerCase())>-1)){if(t.content){const i=Object.keys(t.content)[0];e.headers[t.name]=qo(n,i);return}typeof n<"u"&&(e.headers[t.name]=ic({key:t.name,value:n,style:t.style||"simple",explode:typeof t.explode>"u"?!1:t.explode,escape:!1}))}}function jx(r){let{req:e,parameter:t,value:n}=r;e.headers=e.headers||{};const i=typeof n;if(t.content){const s=Object.keys(t.content)[0];e.headers.Cookie=`${t.name}=${qo(n,s)}`;return}if(i!=="undefined"){const s=i==="object"&&!Array.isArray(n)&&t.explode?"":`${t.name}=`;e.headers.Cookie=s+ic({key:t.name,value:n,escape:!1,style:t.style||"form",explode:typeof t.explode>"u"?!1:t.explode})}}const Vx=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:window)(),{btoa:Wx}=Vx,jh=Wx;function $x(r,e){const{operation:t,requestBody:n,securities:i,spec:s,attachContentTypeForEmptyPayload:o}=r;let{requestContentType:a}=r;e=Hx({request:e,securities:i,operation:t,spec:s});const l=t.requestBody||{},c=Object.keys(l.content||{}),u=a&&c.indexOf(a)>-1;if(n||o){if(a&&u)e.headers["Content-Type"]=a;else if(!a){const h=c[0];h&&(e.headers["Content-Type"]=h,a=h)}}else a&&u&&(e.headers["Content-Type"]=a);if(!r.responseContentType&&t.responses){const h=Object.entries(t.responses).filter(d=>{let[p,m]=d;const y=parseInt(p,10);return y>=200&&y<300&&pe(m.content)}).reduce((d,p)=>{let[,m]=p;return d.concat(Object.keys(m.content))},[]);h.length>0&&(e.headers.accept=h.join(", "))}if(n)if(a){if(c.indexOf(a)>-1)if(a==="application/x-www-form-urlencoded"||a==="multipart/form-data")if(typeof n=="object"){const h=(l.content[a]||{}).encoding||{};e.form={},Object.keys(n).forEach(d=>{e.form[d]={value:n[d],encoding:h[d]||{}}})}else e.form=n;else e.body=n}else e.body=n;return e}function Hx(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=ee({},e),{authorized:o={}}=t,a=n.security||i.security||[],l=o&&!!Object.keys(o).length,c=ce()(i,["components","securitySchemes"])||{};return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!l||!a||Array.isArray(n.security)&&!n.security.length?e:(a.forEach(u=>{Object.keys(u).forEach(h=>{const d=o[h],p=c[h];if(!d)return;const m=d.value||d,{type:y}=p;if(d){if(y==="apiKey")p.in==="query"&&(s.query[p.name]=m),p.in==="header"&&(s.headers[p.name]=m),p.in==="cookie"&&(s.cookies[p.name]=m);else if(y==="http"){if(/^basic$/i.test(p.scheme)){const w=m.username||"",A=m.password||"",T=jh(`${w}:${A}`);s.headers.Authorization=`Basic ${T}`}/^bearer$/i.test(p.scheme)&&(s.headers.Authorization=`Bearer ${m}`)}else if(y==="oauth2"||y==="openIdConnect"){const w=d.token||{},A=p["x-tokenName"]||"access_token",T=w[A];let P=w.token_type;(!P||P.toLowerCase()==="bearer")&&(P="Bearer"),s.headers.Authorization=`${P} ${T}`}}})}),s)}function zx(r,e){const{spec:t,operation:n,securities:i,requestContentType:s,responseContentType:o,attachContentTypeForEmptyPayload:a}=r;if(e=Ux({request:e,securities:i,operation:n,spec:t}),e.body||e.form||a)s?e.headers["Content-Type"]=s:Array.isArray(n.consumes)?[e.headers["Content-Type"]]=n.consumes:Array.isArray(t.consumes)?[e.headers["Content-Type"]]=t.consumes:n.parameters&&n.parameters.filter(l=>l.type==="file").length?e.headers["Content-Type"]="multipart/form-data":n.parameters&&n.parameters.filter(l=>l.in==="formData").length&&(e.headers["Content-Type"]="application/x-www-form-urlencoded");else if(s){const l=n.parameters&&n.parameters.filter(u=>u.in==="body").length>0,c=n.parameters&&n.parameters.filter(u=>u.in==="formData").length>0;(l||c)&&(e.headers["Content-Type"]=s)}return!o&&Array.isArray(n.produces)&&n.produces.length>0&&(e.headers.accept=n.produces.join(", ")),e}function Ux(r){let{request:e,securities:t={},operation:n={},spec:i}=r;const s=ee({},e),{authorized:o={},specSecurity:a=[]}=t,l=n.security||a,c=o&&!!Object.keys(o).length,u=i.securityDefinitions;return s.headers=s.headers||{},s.query=s.query||{},!Object.keys(t).length||!c||!l||Array.isArray(n.security)&&!n.security.length?e:(l.forEach(h=>{Object.keys(h).forEach(d=>{const p=o[d];if(!p)return;const{token:m}=p,y=p.value||p,w=u[d],{type:A}=w,T=w["x-tokenName"]||"access_token",P=m&&m[T];let L=m&&m.token_type;if(p)if(A==="apiKey"){const D=w.in==="query"?"query":"headers";s[D]=s[D]||{},s[D][w.name]=y}else if(A==="basic")if(y.header)s.headers.authorization=y.header;else{const D=y.username||"",j=y.password||"";y.base64=jh(`${D}:${j}`),s.headers.authorization=`Basic ${y.base64}`}else A==="oauth2"&&P&&(L=!L||L.toLowerCase()==="bearer"?"Bearer":L,s.headers.authorization=`${L} ${P}`)})}),s)}function Vh(r,e){return`${e.toLowerCase()}-${r}`}function Gx(r,e,t){if(!r||typeof r!="object"||!r.paths||typeof r.paths!="object")return null;const{paths:n}=r;for(const i in n)for(const s in n[i]){if(s.toUpperCase()==="PARAMETERS")continue;const o=n[i][s];if(!o||typeof o!="object")continue;const a={spec:r,pathName:i,method:s.toUpperCase(),operation:o},l=e(a);if(t&&l)return a}}function Kx(r,e){return Gx(r,e,!0)||null}const Wh=r=>r.replace(/\W/gi,"_");function Yx(r,e){let{v2OperationIdCompatibilityMode:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(t){let n=`${e.toLowerCase()}_${r}`.replace(/[\s!@#$%^&*()_+=[{\]};:<>|./?,\\'""-]/g,"_");return n=n||`${r.substring(1)}_${e}`,n.replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return`${e.toLowerCase()}${Wh(r)}`}function Jx(r,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"",{v2OperationIdCompatibilityMode:n}=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return!r||typeof r!="object"?null:(r.operationId||"").replace(/\s/g,"").length?Wh(r.operationId):Yx(e,t,{v2OperationIdCompatibilityMode:n})}function Qx(r,e){return!r||!r.paths?null:Kx(r,t=>{let{pathName:n,method:i,operation:s}=t;if(!s||typeof s!="object")return!1;const o=s.operationId,a=Jx(s,n,i),l=Vh(n,i);return[a,l,o].some(c=>c&&c===e)})}const YI=r=>{try{const{swagger:e}=r;return e==="2.0"}catch{return!1}},Xx=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.0\.([0123])(?:-rc[012])?$/.test(e)}catch{return!1}},Zx=r=>{try{const{openapi:e}=r;return typeof e=="string"&&/^3\.1\.(?:[1-9]\d*|0)$/.test(e)}catch{return!1}},$h=r=>Xx(r)||Zx(r),_x=["http","fetch","spec","operationId","pathName","method","parameters","securities"],Hh=r=>Array.isArray(r)?r:[],qx=Ex("OperationNotFoundError",function(e,t,n){this.originalError=n,Object.assign(this,t||{})}),ew=(r,e)=>e.filter(t=>t.name===r),tw=r=>{const e={};r.forEach(n=>{e[n.in]||(e[n.in]={}),e[n.in][n.name]=n});const t=[];return Object.keys(e).forEach(n=>{Object.keys(e[n]).forEach(i=>{t.push(e[n][i])})}),t},rw={buildRequest:iw};function nw(r){let{http:e,fetch:t,spec:n,operationId:i,pathName:s,method:o,parameters:a,securities:l}=r,c=ne(r,_x);const u=e||t||yx;s&&o&&!i&&(i=Vh(s,o));const h=rw.buildRequest(ee({spec:n,operationId:i,parameters:a,securities:l,http:u},c));return h.body&&(pe(h.body)||Array.isArray(h.body))&&(h.body=JSON.stringify(h.body)),u(h)}function iw(r){const{spec:e,operationId:t,responseContentType:n,scheme:i,requestInterceptor:s,responseInterceptor:o,contextUrl:a,userFetch:l,server:c,serverVariables:u,http:h,signal:d}=r;let{parameters:p,parameterBuilders:m}=r;const y=$h(e);m||(y?m=g:m=Tx);let A={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};d&&(A.signal=d),s&&(A.requestInterceptor=s),o&&(A.responseInterceptor=o),l&&(A.userFetch=l);const T=Qx(e,t);if(!T)throw new qx(`Operation ${t} not found`);const{operation:P={},method:L,pathName:D}=T;if(A.url+=sw({spec:e,scheme:i,contextUrl:a,server:c,serverVariables:u,pathName:D,method:L}),!t)return delete A.cookies,A;A.url+=D,A.method=`${L}`.toUpperCase(),p=p||{};const j=e.paths[D]||{};n&&(A.headers.accept=n);const W=tw([].concat(Hh(P.parameters)).concat(Hh(j.parameters)));W.forEach(F=>{const H=m[F.in];let Q;if(F.in==="body"&&F.schema&&F.schema.properties&&(Q=p),Q=F&&F.name&&p[F.name],typeof Q>"u"?Q=F&&F.name&&p[`${F.in}.${F.name}`]:ew(F.name,W).length>1&&console.warn(`Parameter '${F.name}' is ambiguous because the defined spec has more than one parameter with the name: '${F.name}' and the passed-in parameter values did not define an 'in' value.`),Q!==null){if(typeof F.default<"u"&&typeof Q>"u"&&(Q=F.default),typeof Q>"u"&&F.required&&!F.allowEmptyValue)throw new Error(`Required parameter ${F.name} is not provided`);if(y&&F.schema&&F.schema.type==="object"&&typeof Q=="string")try{Q=JSON.parse(Q)}catch{throw new Error("Could not parse object parameter value string as JSON")}H&&H({req:A,parameter:F,value:Q,operation:P,spec:e})}});const q=ee(ee({},r),{},{operation:P});if(y?A=$x(q,A):A=zx(q,A),A.cookies&&Object.keys(A.cookies).length){const F=Object.keys(A.cookies).reduce((H,Q)=>{const oe=A.cookies[Q],fe=H?"&":"",be=K.serialize(Q,oe);return H+fe+be},"");A.headers.Cookie=F}return A.cookies&&delete A.cookies,Fh(A),A}const ac=r=>r?r.replace(/\W/g,""):null;function sw(r){return $h(r.spec)?ow(r):cw(r)}function ow(r){let{spec:e,pathName:t,method:n,server:i,contextUrl:s,serverVariables:o={}}=r;const a=ce()(e,["paths",t,(n||"").toLowerCase(),"servers"])||ce()(e,["paths",t,"servers"])||ce()(e,["servers"]);let l="",c=null;if(i&&a&&a.length){const u=a.map(h=>h.url);u.indexOf(i)>-1&&(l=i,c=a[u.indexOf(i)])}return!l&&a&&a.length&&(l=a[0].url,[c]=a),l.indexOf("{")>-1&&lw(l).forEach(h=>{if(c.variables&&c.variables[h]){const d=c.variables[h],p=o[h]||d.default,m=new RegExp(`{${h}}`,"g");l=l.replace(m,p)}}),aw(l,s)}function aw(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const t=r&&e?V.parse(V.resolve(e,r)):V.parse(r),n=V.parse(e),i=ac(t.protocol)||ac(n.protocol)||"",s=t.host||n.host,o=t.pathname||"";let a;return i&&s?a=`${i}://${s+o}`:a=o,a[a.length-1]==="/"?a.slice(0,-1):a}function lw(r){const e=[],t=/{([^}]+)}/g;let n;for(;n=t.exec(r);)e.push(n[1]);return e}function cw(r){let{spec:e,scheme:t,contextUrl:n=""}=r;const i=V.parse(n),s=Array.isArray(e.schemes)?e.schemes[0]:null,o=t||s||ac(i.protocol)||"http",a=e.host||i.host||"",l=e.basePath||"";let c;return o&&a?c=`${o}://${a+l}`:c=l,c[c.length-1]==="/"?c.slice(0,-1):c}var S=f(29901),pt=f(20202),$r=f(44411),gt=f(88606),uw=f(81570),fw=f(74025),hw=f(2526),dw=Object.defineProperty,pw=Object.defineProperties,gw=Object.getOwnPropertyDescriptors,zh=Object.getOwnPropertySymbols,mw=Object.prototype.hasOwnProperty,vw=Object.prototype.propertyIsEnumerable,Uh=(r,e,t)=>e in r?dw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,yw=(r,e)=>{for(var t in e||(e={}))mw.call(e,t)&&Uh(r,t,e[t]);if(zh)for(var t of zh(e))vw.call(e,t)&&Uh(r,t,e[t]);return r},bw=(r,e)=>pw(r,gw(e)),xw=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function ww(r,e){return xw(this,null,function*(){var t,n,i,s;const o=JSON.parse(JSON.stringify(e)),a=o.openapi?{openapi:o.openapi}:o.swagger?{swagger:o.swagger}:{},l=bw(yw({},a),{components:o.components,paths:{[r.path]:{[r.httpVerb]:(n=(t=o.paths)==null?void 0:t[r.path])==null?void 0:n[r.httpVerb],parameters:(s=(i=o.paths)==null?void 0:i[r.path])==null?void 0:s.parameters}}}),c=new fw.Config({}),u=(0,hw.I)(l),h={config:c,doc:u,dereference:!0};return yield(0,uw.bundle)(h),o})}var Sw=f(98910),ea=f(84862),Xr=f(53134),Gh=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const Kh=Object.values(Xr.FileUploadFormats),kw=["application/octet-stream","application/pdf","application/gzip","application/zip"],Yh=["image/","audio/","video/"];function Jh(r){if(Yh.some(e=>r.startsWith(e)))return r}function ta(r){return kw.includes(r)?!0:Yh.some(e=>r.startsWith(e))}function Aw(r){const e=r.type==="array"?r.items:r;if(!e||!e.type||e?.type==="any")return!0;const t=e.contentMediaType||"",n=e.format||e.contentEncoding||(ta(t)?"binary":"");return e.type===Xr.DefinitionTypes.STRING&&Kh.includes(n)}function Qh(r,e){if(!r||!r.type||r.type==="any")return ta(e);const t=r.format||r.contentEncoding||"";return r.type===Xr.DefinitionTypes.STRING&&Kh.includes(t)}function Xh(r){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{const s=n.result.replace(/data:.*\/.*;base64,/g,"");e(s)},n.onerror=()=>t(n.error),n.readAsDataURL(r)})}function Zh({format:r,contentEncoding:e,contentMediaType:t}){return[r,e,t].includes(Xr.FileUploadFormats.BASE64)}function Cw(r,e){return Gh(this,null,function*(){const t=Object.values(r);let n=t.length===1?t[0]:t;return e.type===Xr.DefinitionTypes.STRING&&Zh(e)?n=yield Xh(t[0]):e.type===Xr.DefinitionTypes.ARRAY&&e.items&&(Zh(e.items)?n=yield Promise.all(t.map(s=>Gh(this,null,function*(){return yield Xh(s)}))):n=t),n})}var lc=f(84622),je=f(38612),Je=f(97495),Ee=f(85739),Mr=f(71608),Ow=f(64393),Wn=f(60991);function Ew({response:r}){const{jsonSampleExpandLevel:e}=(0,$r.Dv)(Wn.qd);return S.createElement(S.Fragment,null,S.createElement(Mr.EE,null," Body: "),Tw(r,e))}function Tw(r,e){return r.body?S.createElement(pt.JsonViewer,{data:r.body,jsonSampleExpandLevel:e}):r.fileInfo?S.createElement(Ow.s,{fileInfo:r.fileInfo}):r.data!==null?r.data?S.createElement(pt.CodeBlock,{lang:(0,Ee.M)(r.headers["Content-Type"]||"text/plain"),source:r.data,header:{controls:{copy:{}}}}):S.createElement(pt.CodeBlockContainer,{withControls:!0},S.createElement("i",null,"(no content)")):null}function Pw({headers:r}){const e=(0,$r.Dv)(Wn.qd),[t,n]=(0,S.useState)(!0),{maxResponseHeadersToShowInTryIt:i}=e,s=Object.keys(r),o=!!i&&s.length>i,a=o&&t?[...s].splice(0,i):[...s],l=()=>{n(!t)};return S.createElement(S.Fragment,null,S.createElement(Mr.EE,null," Headers: "),S.createElement(pt.CodeBlockContainer,{withControls:!0},a.map(c=>S.createElement("div",{key:c},S.createElement(_h,null,c,":"),S.createElement("code",null,r[c]))),o&&S.createElement(qh,{onClick:l},t?"Show more...":"Hide headers")))}const _h=Je.ZP.strong`
|
|
48
48
|
text-transform: capitalize;
|
|
49
49
|
display: inline-block;
|
|
50
50
|
padding-right: 5px;
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
cursor: pointer;
|
|
53
53
|
margin-top: 5px;
|
|
54
54
|
font-size: 14px;
|
|
55
|
-
`;_h.displayName="HeaderName",qh.displayName="StyledShowMoreLabel";const
|
|
55
|
+
`;_h.displayName="HeaderName",qh.displayName="StyledShowMoreLabel";const Mw=Je.ZP.div`
|
|
56
56
|
margin-bottom: 10px;
|
|
57
57
|
`,cc=Je.ZP.div`
|
|
58
58
|
display: inline-block;
|
|
@@ -60,15 +60,15 @@
|
|
|
60
60
|
padding: 2px 0;
|
|
61
61
|
text-align: center;
|
|
62
62
|
color: var(--text-primary);
|
|
63
|
-
`,
|
|
63
|
+
`,Iw=(0,Je.ZP)(cc)`
|
|
64
64
|
color: ${({code:r})=>r>=200&&r<300?"var(--response-success-text-color)":r>=300&&r<400?"var(--response-redirect-text-color)":r>400?"var(--response-error-text-color)":"var(--response-info-text-color)"};
|
|
65
65
|
`,ed=Je.ZP.header`
|
|
66
66
|
font-weight: bold;
|
|
67
67
|
margin-bottom: 10px;
|
|
68
|
-
`,
|
|
68
|
+
`,Dw=Je.ZP.code`
|
|
69
69
|
border-left: 3px solid #ff4040;
|
|
70
70
|
padding-left: 5px;
|
|
71
|
-
`,
|
|
71
|
+
`,Nw=({error:r,response:e,time:t})=>{const n=e||r&&r.response,i=n&&n.data&&n.data.length||0;let s;return i>1e6?s=(i/1e6).toFixed(2)+" MB":i>1e3?s=(i/1e3).toFixed(2)+" KB":s=i+" B",r&&!r.response||!n?S.createElement(S.Fragment,null,S.createElement(ed,null," Could not get any response "),S.createElement(Dw,null,r&&r.message||"Unknown error"),S.createElement("br",null),S.createElement(ed,null," Why this might have happened:"),S.createElement("div",null," - CORS is misconfigured on the server"),S.createElement("div",null," - The server couldn't send a response"),S.createElement("div",null," - No internet access"),S.createElement("div",null," - Documentation issue - contact API owner"),S.createElement("div",null," - Misconfigured security definition")):n?S.createElement(S.Fragment,null,S.createElement(Mw,null,S.createElement(Iw,{code:n.status},S.createElement("span",null," Status: "),n.status," ",n.statusText),S.createElement(cc,null,S.createElement("span",null," Time: "),t,"ms"),S.createElement(cc,null,S.createElement("span",null," Size: "),s)),S.createElement("div",null,S.createElement(Pw,{headers:n.headers}),S.createElement(Ew,{response:n}))):S.createElement(S.Fragment,null,"Something went wrong")},Rw=Je.ZP.div`
|
|
72
72
|
display: flex;
|
|
73
73
|
font-size: 12px;
|
|
74
74
|
button {
|
|
@@ -104,17 +104,17 @@
|
|
|
104
104
|
background-color: var(--panel-try-it-tabs-disabled-background-color);
|
|
105
105
|
color: var(--panel-try-it-tabs-disabled-text-color);
|
|
106
106
|
`||""}
|
|
107
|
-
`;function
|
|
107
|
+
`;function Lw({onChange:r,active:e,hasResponse:t}){return S.createElement(Rw,null,S.createElement(td,{onClick:()=>r(0),active:e===0},t?"Edit Request":"Request"),S.createElement(td,{onClick:()=>t&&r(1),active:e===1,disabled:!t}," ","Response"," "))}var uc=f(82155),rd=f(79198);function Bw(r,e,t){const n=e.path||{},i=e.query||{},s=Object.keys(i);let o=(0,je.v5)(r,n);const a=l=>t.find(c=>c.name===l&&c.in==="query");return s.length&&(o+="?"+s.map(l=>{if(!i[l])return"";const c=a(l);return c?(0,Ee.d$)(c,i[l]):`${l}=${encodeURIComponent(i[l])}`}).filter(Boolean).join("&")),o}const Fw=({loading:r,operation:e,hasResponse:t,onSubmit:n,params:i={}})=>S.createElement(ea.k1,null,S.createElement(uc.__,null,S.createElement(rd.FH,{color:e.httpVerb},e.httpVerb),S.createElement(uc.y$,{wrap:"true"},Bw(e.path,i,e.parameters))),S.createElement(jw,{"data-cy":"send-button",color:"primary",type:"submit",blinking:r,onClick:()=>!r&&n()},r?"Sending...":t?"Resend":"Send")),jw=(0,Je.ZP)(uc.ev)`
|
|
108
108
|
width: var(--panel-try-it-action-button-width);
|
|
109
|
-
`,
|
|
109
|
+
`,Vw=(0,S.memo)(Fw);var gi=f(26225),Ww=Object.defineProperty,$w=Object.defineProperties,Hw=Object.getOwnPropertyDescriptors,nd=Object.getOwnPropertySymbols,zw=Object.prototype.hasOwnProperty,Uw=Object.prototype.propertyIsEnumerable,id=(r,e,t)=>e in r?Ww(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bs=(r,e)=>{for(var t in e||(e={}))zw.call(e,t)&&id(r,t,e[t]);if(nd)for(var t of nd(e))Uw.call(e,t)&&id(r,t,e[t]);return r},Gw=(r,e)=>$w(r,Hw(e)),ra=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const sd="/oauth2-redirect.html";class Hr{static authorizeImplicit({authorizationUrl:e,clientId:t,scopes:n,extraParams:i={},routingBasePath:s,redirectUri:o,successCallback:a,errorCallback:l}){const c=(0,gi.p8)({date:new Date().toString()}),u=new URL(e),h=s==="/"?"":s,d=`${window.location.origin}${h}${sd}`;u.searchParams.set("client_id",t),u.searchParams.set("redirect_uri",o||d),u.searchParams.set("response_type","token"),u.searchParams.set("state",c),Array.isArray(n)&&u.searchParams.set("scope",n.join(" "));for(const p in i)u.searchParams.set(p,i[p]);window.redirectOAuth2={flow:"implicit",data:{authorizationUrl:e,clientId:t,scopes:n},state:c,successCallback:p=>{a(p),Hr.clearRedirectData("implicit")},errorCallback:p=>{l(p),Hr.clearRedirectData("implicit")}},window.open(u.toString())}static authorizeAuthorizationCode({authorizationUrl:e,tokenUrl:t,clientId:n,clientSecret:i,codeVerifier:s,codeChallenge:o,scopes:a,extraParams:l={},extraHeaders:c={},routingBasePath:u,redirectUri:h,successCallback:d,errorCallback:p}){const m=new URL(e),y=u==="/"?"":u,w=`${window.location.origin}${y}${sd}`,A=(0,gi.p8)({date:new Date().toString()});m.searchParams.set("client_id",n),m.searchParams.set("redirect_uri",h||w),m.searchParams.set("response_type","code"),m.searchParams.set("state",A),Array.isArray(a)&&m.searchParams.set("scope",a.join(" ")),o&&(m.searchParams.set("code_challenge",o),m.searchParams.set("code_challenge_method","S256"));for(const T in l)m.searchParams.set(T,l[T]);window.redirectOAuth2={flow:"authorizationCode",data:{authorizationUrl:e,clientId:n,scopes:a},state:A,successCallback:T=>ra(this,[T],function*({auth_code:P}){try{const L=yield fetch(t,{method:"POST",headers:Bs({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},c),body:Ee.uM.stringify(Bs(Gw(Bs({client_id:n,client_secret:i},s&&{code_verifier:s}),{code:P,grant_type:"authorization_code",redirect_uri:h||w}),l))});yield od(L,d,p)}catch(L){p(L)}Hr.clearRedirectData("authorizationCode")}),errorCallback:T=>{p(T),Hr.clearRedirectData("authorizationCode")}},window.open(m.toString())}static clearRedirectData(e){window.redirectOAuth2={flow:e,data:{authorizationUrl:"",clientId:"",scopes:[]},state:"",successCallback:()=>{},errorCallback:()=>{}}}static authorizeClientCredentials(e){return ra(this,arguments,function*({tokenUrl:t,clientId:n,clientSecret:i,scopes:s=[],extraParams:o={},extraHeaders:a={},successCallback:l,errorCallback:c}){try{const u=JSON.parse(JSON.stringify(Bs({client_id:n,client_secret:i,grant_type:"client_credentials",scope:Array.isArray(s)&&s.length?s.join(" "):void 0},o))),h=yield fetch(t,{method:"POST",headers:Bs({"Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"},a),body:Ee.uM.stringify(u)});yield od(h,l,c)}catch(u){c(u)}})}}const JI=new Hr;function od(r,e,t){return ra(this,null,function*(){if(r.ok){const n=yield r.json();e(n)}else t(new Error((r.headers.get("Content-Type")||"").indexOf("json")>-1?JSON.stringify(yield r.json()):yield r.text()))})}function ad(r){return ra(this,null,function*(){return(0,gi.rS)(yield(0,gi.JQ)(r))})}var Fs=f(95709),ve=f(9612),Kw=f(39012),it=f(54597);function Yw({name:r,value:e,description:t,variableEnum:n,onChange:i,defaultValue:s}){const o=(0,S.useCallback)(c=>i(c.target.value),[i]),a=(0,S.useCallback)(c=>i(c.value),[i]),l=n?n.map((c,u)=>({value:c,idx:u})):[];return S.createElement(ve.NI,null,S.createElement(ve.lX,null,r,":"),l&&l.length?S.createElement(Mr.VD,{fullWidth:!0,variant:"dark",value:e,options:l,onChange:a}):S.createElement(it.nv,{fullWidth:!0,value:e,onChange:o,placeholder:s,panel:"try-it"}),t&&S.createElement(Jw,{source:t}))}const Jw=(0,Je.ZP)(Kw.Markdown)`
|
|
110
110
|
margin-top: 5px;
|
|
111
111
|
color: #d0d0d0;
|
|
112
|
-
`;var
|
|
112
|
+
`;var Qw=Object.defineProperty,Xw=Object.defineProperties,Zw=Object.getOwnPropertyDescriptors,ld=Object.getOwnPropertySymbols,_w=Object.prototype.hasOwnProperty,qw=Object.prototype.propertyIsEnumerable,cd=(r,e,t)=>e in r?Qw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ud=(r,e)=>{for(var t in e||(e={}))_w.call(e,t)&&cd(r,t,e[t]);if(ld)for(var t of ld(e))qw.call(e,t)&&cd(r,t,e[t]);return r},fd=(r,e)=>Xw(r,Zw(e));function eS({operation:r,onChange:e}){var t;const{control:n,watch:i}=(0,gt.Gc)(),{events:s}=(0,$r.Dv)(Wn.qd),{servers:o}=r,a=i("server");(0,pt.useMount)(()=>{const d=(0,Ee.YQ)("serverUrl"),p=o.findIndex(y=>y.url===d),m=(0,je.fz)(o,p<0?0:p);e(m)});const l=(0,S.useCallback)(({serverUrl:d=""})=>{var p;const m=o.find(A=>A.url===d),y=(0,je.mj)(m);e({url:d,variables:y}),(0,Ee.WW)("serverUrl",d);const w=(0,lc.Ze)({operation:r,serverUrl:d});(p=s.targetServerSwitch)==null||p.call(s,w)},[e,s,r,o]),c=(d,p)=>{const m=p||p===""?p:(0,je.mj)(a)[d],y=fd(ud({},a.variables),{[d]:m});(0,je.UY)(d,m),e(fd(ud({},a),{variables:y}))},u=(0,S.useMemo)(()=>o.map((d,p)=>({idx:p,serverUrl:d.url,value:`
|
|
113
113
|
${(0,je.nq)((0,je.v5)(d.url,d.variables),d.variables)}
|
|
114
114
|
- ${(0,Ee.bG)(d.description)||"Default"}
|
|
115
|
-
`})),[o]),h=Object.keys(((t=o.find(({url:d})=>d===a?.url))==null?void 0:t.variables)||{});return S.createElement(
|
|
115
|
+
`})),[o]),h=Object.keys(((t=o.find(({url:d})=>d===a?.url))==null?void 0:t.variables)||{});return S.createElement(rS,{"data-cy":"console-target-server"},S.createElement(ve.lX,{htmlFor:"server"},"Target server: "),S.createElement(ve.NI,null,S.createElement(gt.Qr,{control:n,name:"server",render:({field:{value:d}})=>{var p;const m=(p=u.find(({serverUrl:y})=>y===d?.url))==null?void 0:p.value;return S.createElement(Mr.VD,{variant:"dark",value:m,options:u,fullWidth:!0,onChange:l})}})),h?.map(d=>{var p;const m=(p=a?.variables)==null?void 0:p[d];return S.createElement(Yw,{key:d,name:d,value:a.variables[d],defaultValue:m.default,onChange:y=>c(d,y),variableEnum:m.enum,description:m.description})}))}const tS=(0,S.memo)(eS),rS=Je.ZP.div`
|
|
116
116
|
margin-bottom: 20px;
|
|
117
|
-
`;var hd=f(86220),
|
|
117
|
+
`;var hd=f(86220),nS=Object.defineProperty,iS=Object.defineProperties,sS=Object.getOwnPropertyDescriptors,na=Object.getOwnPropertySymbols,dd=Object.prototype.hasOwnProperty,pd=Object.prototype.propertyIsEnumerable,gd=(r,e,t)=>e in r?nS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,oS=(r,e)=>{for(var t in e||(e={}))dd.call(e,t)&&gd(r,t,e[t]);if(na)for(var t of na(e))pd.call(e,t)&&gd(r,t,e[t]);return r},aS=(r,e)=>iS(r,sS(e)),lS=(r,e)=>{var t={};for(var n in r)dd.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&na)for(var n of na(r))e.indexOf(n)<0&&pd.call(r,n)&&(t[n]=r[n]);return t};function fc(r){var e=r,{header:t,error:n,success:i}=e,s=lS(e,["header","error","success"]);const o=({toggle:a,expanded:l=!1})=>S.createElement(pt.PanelHeader,{onClick:a,expanded:l,"data-cy":s["data-cy"]},S.createElement(ea.xz,null,S.createElement(pt.PanelHeaderTitle,null,t),S.createElement(pt.ShelfIcon,{direction:l?"down":"right"})),n&&S.createElement(hd.CrossIcon,{size:"14px",color:"--color-error"})||null,i&&S.createElement(hd.LockIcon,{size:"14px",color:"--color-success"})||null);return S.createElement(cS,aS(oS({className:"panel-try-it-nested"},s),{header:o}))}const cS=(0,Je.ZP)(pt.Panel)`
|
|
118
118
|
${pt.PanelHeader} {
|
|
119
119
|
border: 1px solid
|
|
120
120
|
${({error:r})=>r?"var(--color-error-border)":"var(--panel-try-it-nested-heading-border-color)"};
|
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
${({error:r})=>r?"var(--color-error-border)":"var(--panel-try-it-nested-body-border-color)"};
|
|
127
127
|
border-top: 0;
|
|
128
128
|
}
|
|
129
|
-
`;var
|
|
129
|
+
`;var uS=f(4296),fS=f(62701),hS=f(18373);const dS=(0,Je.ZP)(rd.A3)`
|
|
130
130
|
border-radius: var(--panel-border-radius);
|
|
131
131
|
margin-bottom: 10px;
|
|
132
|
-
`;var ia=f(42112),hc=f(34716),
|
|
132
|
+
`;var ia=f(42112),hc=f(34716),pS=f(54955),gS=Object.defineProperty,mS=Object.defineProperties,vS=Object.getOwnPropertyDescriptors,md=Object.getOwnPropertySymbols,yS=Object.prototype.hasOwnProperty,bS=Object.prototype.propertyIsEnumerable,vd=(r,e,t)=>e in r?gS(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xS=(r,e)=>{for(var t in e||(e={}))yS.call(e,t)&&vd(r,t,e[t]);if(md)for(var t of md(e))bS.call(e,t)&&vd(r,t,e[t]);return r},wS=(r,e)=>mS(r,vS(e)),SS=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const yd=(0,S.forwardRef)(({schema:r,contentName:e,onChange:t,fieldName:n,className:i,accept:s,multiple:o},a)=>{const{register:l}=(0,gt.Gc)(),c=u=>SS(void 0,null,function*(){const h=yield Cw(u.target.files,r);t(e,h)});return S.createElement("input",wS(xS({},l(n)),{"data-cy":"file-upload-input",type:"file",id:n,className:i,name:n,onChange:c,multiple:o,accept:s,ref:a}))});yd.displayName="FileUpload";var dc=f(21156);function kS({mediaType:r,onChange:e}){var t;const{setValue:n}=(0,gt.Gc)(),i=r.examples||{},{exampleKey:s}=(0,hc.C6)(r.operation,i),o=(t=i[s])==null?void 0:t.rawValue,a=CS(r);(0,S.useEffect)(()=>n&&a.forEach(c=>{var u,h;const d=o?.[c.name],p=(h=(u=c.example)!=null?u:d?.example)!=null?h:d,m=typeof p=="object"?JSON.stringify(p):p;p!==void 0&&n("body."+c.name,`${m}`)}),[s]);const l=r.schema||{};return Qh(l,r.name)?S.createElement(bd,null,S.createElement(ve.NI,null,S.createElement(xd,{fullWidth:!0,fieldName:`body.${r.name}`,accept:Jh(r.name),schema:l,contentName:r.name,onChange:e}))):l.type!==Xr.DefinitionTypes.OBJECT&&!a?(console.warn(`Invalid schema for request body and mime type: "${r.name}"`,l),null):S.createElement(bd,null,a.map(c=>{const u=c.schema||{contentMediaType:"",type:"",description:""},h=r.name===ia.Tr.MULTIPART&&Aw(u),d=u.contentMediaType||"",p=h?S.createElement(xd,{fullWidth:!0,fieldName:"body."+c.name,accept:Jh(d),multiple:u.type==="array",schema:u,contentName:c.name,onChange:e}):S.createElement(it.Xn,{fullWidth:!0,id:"body."+c.name,fieldName:"body."+c.name,placeholder:(0,Ee.bG)(u.description)||c.name,panel:"try-it"});return S.createElement(ve.NI,{key:c.name},S.createElement(ve.lX,null,c.name,":"),p)}))}const AS=(0,S.memo)(kS);function CS(r){var e,t,n,i,s,o;const{activeOneOf:a}=(0,pS.Sb)((0,dc.N)(r.operation.pointer)),l=(t=a[((e=r.schema)==null?void 0:e.pointer)||""])!=null?t:0;return((i=(n=r.schema)==null?void 0:n.oneOf)!=null&&i.length?((s=r.schema)==null?void 0:s.oneOf[l].fields)||[]:((o=r.schema)==null?void 0:o.fields)||[]).filter(c=>!c.schema.readOnly)}const bd=Je.ZP.div`
|
|
133
133
|
> div {
|
|
134
134
|
margin-top: 10px;
|
|
135
135
|
}
|
|
@@ -137,19 +137,19 @@
|
|
|
137
137
|
${(0,it.Hu)("try-it")};
|
|
138
138
|
${({inputType:r})=>r==="password"?"padding-right: 40px;":""};
|
|
139
139
|
${({fullWidth:r})=>r?"width: 100%;":""}
|
|
140
|
-
`,wd=1024;let CS=0;class Ir{constructor(e,t){this.from=e,this.to=t}}class Be{constructor(e={}){this.id=CS++,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=er.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Be.closedBy=new Be({deserialize:r=>r.split(" ")}),Be.openedBy=new Be({deserialize:r=>r.split(" ")}),Be.group=new Be({deserialize:r=>r.split(" ")}),Be.contextHash=new Be({perNode:!0}),Be.lookAhead=new Be({perNode:!0}),Be.mounted=new Be({perNode:!0});class js{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Be.mounted.id]}}const OS=Object.create(null);class er{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):OS,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new er(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),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 i}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(Be.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(Be.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}}er.none=new er("",Object.create(null),0,8);class sa{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 n of this.types){let i=null;for(let s of e){let o=s(n);o&&(i||(i=Object.assign({},n.props)),i[o[0].id]=o[1])}t.push(i?new er(n.name,i,n.id,n.flags):n)}return new sa(t)}}const oa=new WeakMap,Sd=new WeakMap;var st;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(st||(st={}));class ct{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,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=js.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();i&&(t&&(t+=","),t+=i)}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 aa(this.topNode,e)}cursorAt(e,t=0,n=0){let i=oa.get(this)||this.topNode,s=new aa(i);return s.moveTo(e,t),oa.set(this,s._tree),s}get topNode(){return new tr(this,0,0,null)}resolve(e,t=0){let n=Vs(oa.get(this)||this.topNode,e,t,!1);return oa.set(this,n),n}resolveInner(e,t=0){let n=Vs(Sd.get(this)||this.topNode,e,t,!0);return Sd.set(this,n),n}resolveStack(e,t=0){return PS(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&st.IncludeAnonymous)>0;for(let l=this.cursor(o|st.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(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:vc(er.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new ct(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new ct(er.none,t,n,i)))}static build(e){return MS(e)}}ct.empty=new ct(er.none,[],[],0);class pc{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 pc(this.buffer,this.index)}}class mi{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return er.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],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,n,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(kd(s,i,o[l+1],o[l+2])&&(a=l,n>0));l=o[l+3]);return a}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=i[a++],s[l++]=i[a++]-n;let c=s[l++]=i[a++]-n;s[l++]=i[a++]-e,o=Math.max(o,c)}return new mi(s,o,this.set)}}function kd(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Vs(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!n&&r instanceof tr&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:st.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof tr&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=a);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class Ad{cursor(e=0){return new aa(this,e)}getChild(e,t=null,n=null){let i=Cd(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Cd(this,e,t,n)}resolve(e,t=0){return Vs(this,e,t,!1)}resolveInner(e,t=0){return Vs(this,e,t,!0)}matchContext(e){return gc(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}}class tr extends Ad{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,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 u=a[e],h=l[e]+o.from;if(kd(i,n,h,h+u.length)){if(u instanceof mi){if(s&st.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-h,i);if(d>-1)return new Zr(new ES(o,u,e,h),null,d)}else if(s&st.IncludeAnonymous||!u.type.isAnonymous||mc(u)){let d;if(!(s&st.IgnoreMounts)&&(d=js.get(u))&&!d.overlay)return new tr(d.tree,h,e,o);let p=new tr(u,h,e,o);return s&st.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?u.children.length-1:0,t,n,i)}}}if(s&st.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,n=0){let i;if(!(n&st.IgnoreOverlays)&&(i=js.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new tr(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}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 Cd(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(;!i.type.is(t);)if(!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function gc(r,e,t=e.length-1){for(let n=r.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class ES{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Zr extends Ad{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,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new Zr(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,n=0){if(n&st.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Zr(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 Zr(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 Zr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),t.push(0)}return new ct(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Od(r){if(!r.length)return null;if(r.length==1)return r[0];let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let n=t instanceof tr&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new TS(i,t)}class TS{constructor(e,t){this.heads=e,this.node=t}get next(){return Od(this.heads)}}function PS(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof tr?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,t)),s=o}else{let o=js.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new tr(o.tree,o.overlay[0].from+s.from,0,null);(i||(i=[n])).push(Vs(a,e,t,!1))}}return i?Od(i):n}class aa{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 tr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.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:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof tr?(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,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);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,n=this.mode){return this.buffer?n&st.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&st.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,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<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,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&st.IncludeAnonymous||a instanceof mi||!a.type.isAnonymous||mc(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,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)t=new Zr(this.buffer,t,this.stack[i]);return this.bufferNode=new Zr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&t&&t(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return gc(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return gc(this.node,e,i);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function mc(r){return r.children.some(e=>e instanceof mi||!e.type.isAnonymous||mc(e))}function MS(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=wd,reused:s=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new pc(t,t.length):t,l=n.types,c=0,u=0;function h(L,D,j,W,q){let{id:F,start:H,end:Q,size:oe}=a,fe=u;for(;oe<0;)if(a.next(),oe==-1){let Oe=s[F];j.push(Oe),W.push(H-L);return}else if(oe==-3){c=F;return}else if(oe==-4){u=F;return}else throw new RangeError(`Unrecognized record size: ${oe}`);let be=l[F],ke,Re,Se=H-L;if(Q-H<=i&&(Re=y(a.pos-D,q))){let Oe=new Uint16Array(Re.size-Re.skip),Te=a.pos-Re.size,De=Oe.length;for(;a.pos>Te;)De=w(Re.start,Oe,De);ke=new mi(Oe,Q-Re.start,n),Se=Re.start-L}else{let Oe=a.pos-oe;a.next();let Te=[],De=[],bt=F>=o?F:-1,Rt=0,ir=Q;for(;a.pos>Oe;)bt>=0&&a.id==bt&&a.size>=0?(a.end<=ir-i&&(p(Te,De,H,Rt,a.end,ir,bt,fe),Rt=Te.length,ir=a.end),a.next()):h(H,Oe,Te,De,bt);if(bt>=0&&Rt>0&&Rt<Te.length&&p(Te,De,H,Rt,H,ir,bt,fe),Te.reverse(),De.reverse(),bt>-1&&Rt>0){let jr=d(be);ke=vc(be,Te,De,0,Te.length,0,Q-H,jr,jr)}else ke=m(be,Te,De,Q-H,fe-Q)}j.push(ke),W.push(Se)}function d(L){return(D,j,W)=>{let q=0,F=D.length-1,H,Q;if(F>=0&&(H=D[F])instanceof ct){if(!F&&H.type==L&&H.length==W)return H;(Q=H.prop(Be.lookAhead))&&(q=j[F]+H.length+Q)}return m(L,D,j,W,q)}}function p(L,D,j,W,q,F,H,Q){let oe=[],fe=[];for(;L.length>W;)oe.push(L.pop()),fe.push(D.pop()+j-q);L.push(m(n.types[H],oe,fe,F-q,Q-F)),D.push(q-j)}function m(L,D,j,W,q=0,F){if(c){let H=[Be.contextHash,c];F=F?[H].concat(F):[H]}if(q>25){let H=[Be.lookAhead,q];F=F?[H].concat(F):[H]}return new ct(L,D,j,W,F)}function y(L,D){let j=a.fork(),W=0,q=0,F=0,H=j.end-i,Q={size:0,start:0,skip:0};e:for(let oe=j.pos-L;j.pos>oe;){let fe=j.size;if(j.id==D&&fe>=0){Q.size=W,Q.start=q,Q.skip=F,F+=4,W+=4,j.next();continue}let be=j.pos-fe;if(fe<0||be<oe||j.start<H)break;let ke=j.id>=o?4:0,Re=j.start;for(j.next();j.pos>be;){if(j.size<0)if(j.size==-3)ke+=4;else break e;else j.id>=o&&(ke+=4);j.next()}q=Re,W+=fe,F+=ke}return(D<0||W==L)&&(Q.size=W,Q.start=q,Q.skip=F),Q.size>4?Q:void 0}function w(L,D,j){let{id:W,start:q,end:F,size:H}=a;if(a.next(),H>=0&&W<o){let Q=j;if(H>4){let oe=a.pos-(H-4);for(;a.pos>oe;)j=w(L,D,j)}D[--j]=Q,D[--j]=F-L,D[--j]=q-L,D[--j]=W}else H==-3?c=W:H==-4&&(u=W);return j}let A=[],T=[];for(;a.pos>0;)h(r.start||0,r.bufferStart||0,A,T,-1);let P=(e=r.length)!==null&&e!==void 0?e:A.length?T[0]+A[0].length:0;return new ct(l[r.topID],A.reverse(),T.reverse(),P)}const Ed=new WeakMap;function la(r,e){if(!r.isAnonymous||e instanceof mi||e.type!=r)return 1;let t=Ed.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof ct)){t=1;break}t+=la(r,n)}Ed.set(e,t)}return t}function vc(r,e,t,n,i,s,o,a,l){let c=0;for(let m=n;m<i;m++)c+=la(r,e[m]);let u=Math.ceil(c*1.5/8),h=[],d=[];function p(m,y,w,A,T){for(let P=w;P<A;){let L=P,D=y[P],j=la(r,m[P]);for(P++;P<A;P++){let W=la(r,m[P]);if(j+W>=u)break;j+=W}if(P==L+1){if(j>u){let W=m[L];p(W.children,W.positions,0,W.children.length,y[L]+T);continue}h.push(m[L])}else{let W=y[P-1]+m[P-1].length-D;h.push(vc(r,m,y,L,P,D,W,null,l))}d.push(D+T-s)}}return p(e,t,n,i,0),(a||l)(h,d,o)}class JI{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Zr?this.setBuffer(e.context.buffer,e.index,t):e instanceof tr&&this.map.set(e.tree,t)}get(e){return e instanceof Zr?this.getBuffer(e.context.buffer,e.index):e instanceof tr?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)}}class kn{constructor(e,t,n,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,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=[],n=!1){let i=[new kn(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<t.length?t[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let p=Math.max(d.from,l)-c,m=Math.min(d.to,h)-c;d=p>=m?null:new kn(p,m,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class Td{startParse(e,t,n){return typeof e=="string"&&(e=new IS(e)),n=n?n.length?n.map(i=>new Ir(i.from,i.to)):[new Ir(0,0)]:[new Ir(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let s=i.advance();if(s)return s}}}class IS{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)}}function QI(r){return(e,t,n,i)=>new NS(e,r,t,n,i)}class Pd{constructor(e,t,n,i,s){if(this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.ranges=s,!s.length||s.some(o=>o.from>=o.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}}class DS{constructor(e,t,n,i,s,o,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const yc=new Be({perNode:!0});class NS{constructor(e,t,n,i,s){this.nest=t,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new ct(n.type,n.children,n.positions,n.length,n.propValues.concat([[yc,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Be.mounted.id]=new js(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].ranges[0].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new BS(this.fragments),t=null,n=null,i=new aa(new tr(this.baseTree,this.ranges[0].from,0,null),st.IncludeAnonymous|st.IgnoreMounts);e:for(let s,o;this.stoppedAt==null||i.from<this.stoppedAt;){let a=!0,l;if(e.hasNode(i)){if(t){let c=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!t.ranges.some(p=>p.from<d&&p.to>h)&&t.ranges.push({from:h,to:d})}}a=!1}else if(n&&(o=RS(n.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&i.from<i.to&&(s=this.nest(i,this.input))){i.tree||LS(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new DS(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,t);else{let u=Dd(this.ranges,s.overlay||[new Ir(i.from,i.to)]);u.length&&this.inner.push(new Pd(s.parser,s.parser.startParse(this.input,Nd(c,u),u),s.overlay?s.overlay.map(h=>new Ir(h.from-i.from,h.to-i.from)):null,i.tree,u)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else t&&(l=t.predicate(i))&&(l===!0&&(l=new Ir(i.from,i.to)),l.from<l.to&&t.ranges.push(l));if(a&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let c=Dd(this.ranges,t.ranges);c.length&&this.inner.splice(t.index,0,new Pd(t.parser,t.parser.startParse(this.input,Nd(t.mounts,c),c),t.ranges.map(u=>new Ir(u.from-t.start,u.to-t.start)),t.target,c)),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function RS(r,e,t){for(let n of r){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function Md(r,e,t,n,i,s){if(e<t){let o=r.buffer[e+1];n.push(r.slice(e,t,o)),i.push(o-s)}}function LS(r){let{node:e}=r,t=0;do r.parent(),t++;while(!r.tree);let n=0,i=r.tree,s=0;for(;s=i.positions[n]+r.from,!(s<=e.from&&s+i.children[n].length>=e.to);n++);let o=i.children[n],a=o.buffer;function l(c,u,h,d,p){let m=c;for(;a[m+2]+s<=e.from;)m=a[m+3];let y=[],w=[];Md(o,c,m,y,w,d);let A=a[m+1],T=a[m+2],P=A+s==e.from&&T+s==e.to&&a[m]==e.type.id;return y.push(P?e.toTree():l(m+4,a[m+3],o.set.types[a[m]],A,T-A)),w.push(A-d),Md(o,a[m+3],u,y,w,d),new ct(h,y,w,p)}i.children[n]=l(0,a.length,er.none,0,o.length);for(let c=0;c<=t;c++)r.childAfter(e.from)}class Id{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(st.IncludeAnonymous|st.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,st.IgnoreOverlays|st.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof ct)t=t.children[0];else break}return!1}}class BS{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(yc))!==null&&t!==void 0?t:n.to,this.inner=new Id(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(yc))!==null&&e!==void 0?e:t.to,this.inner=new Id(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(Be.mounted);if(o&&o.parser==t)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}}function Dd(r,e){let t=null,n=e;for(let i=1,s=0;i<r.length;i++){let o=r[i-1].to,a=r[i].from;for(;s<n.length;s++){let l=n[s];if(l.from>=a)break;l.to<=o||(t||(n=t=e.slice()),l.from<o?(t[s]=new Ir(l.from,o),l.to>a&&t.splice(s+1,0,new Ir(a,l.to))):l.to>a?t[s--]=new Ir(a,l.to):t.splice(s--,1))}}return n}function FS(r,e,t,n){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==r.length?1e9:o?r[i].to:r[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,t),p=Math.min(u,h,n);d<p&&c.push(new Ir(d,p))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function Nd(r,e){let t=[];for(let{pos:n,mount:i,frag:s}of r){let o=n+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new Ir(d.from+n,d.to+n)),h=FS(e,u,l,c);for(let d=0,p=l;;d++){let m=d==h.length,y=m?c:h[d].from;if(y>p&&t.push(new kn(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),m)break;p=h[d].to}}else t.push(new kn(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return t}class ca{constructor(e,t,n,i,s,o,a,l,c,u=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new ca(e,[],t,n,n,0,[],0,i?new Rd(i,i.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 n=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),n==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(n-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[i])===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 u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,d,h+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=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==n)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)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,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(e,t,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){e&65536?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,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 n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new ca(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new jS(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<4<<1&&s<t.length;s+=2){let o=t[s+1];i.some((a,l)=>l&1&&a==o)||i.push(t[s],o)}t=i}let n=[];for(let i=0;i<t.length&&n.length<4;i+=2){let s=t[i+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[i],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!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=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,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=n(o,s+1);if(a!=null)return a}})};return n(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 Rd(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()}}class Rd{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class jS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class ua{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ua(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 ua(this.stack,this.pos,this.index)}}function Ws(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,i=0;n<r.length;){let s=0;for(;;){let o=r.charCodeAt(n++),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[i++]=s:t=new e(s)}return t}class fa{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Ld=new fa;class VS{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Ld,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 n=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!i)return null;let o=this.ranges[--i];s-=n.from-o.to,n=o}for(;t<0?s>n.to:s>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-n.to,n=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,n,i;if(t>=0&&t<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}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=Ld,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 n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Yi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Bd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Yi.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class WS{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Ws(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Bd(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}WS.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class XI{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Bd(r,e,t,n,i,s){let o=0,a=1<<n,{dialect:l}=t.p.parser;e:for(;a&r[o];){let c=r[o+1];for(let p=o+3;p<c;p+=2)if((r[p+1]&a)>0){let m=r[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||$S(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,h=0,d=r[o+2];if(e.next<0&&d>h&&r[c+d*3-3]==65535&&r[c+d*3-3]==65535){o=r[c+d*3-1];continue e}for(;h<d;){let p=h+d>>1,m=c+p+(p<<1),y=r[m],w=r[m+1]||65536;if(u<y)d=p;else if(u>=w)h=p+1;else{o=r[m+2],e.advance();continue e}}break}}function Fd(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function $S(r,e,t,n){let i=Fd(t,n,e);return i<0||Fd(t,n,r)<i}const mr=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let bc=null;function jd(r,e,t){let n=r.cursor(st.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}class HS{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?jd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?jd(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 n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[i],o=this.start[t]+n.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof ct){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(Be.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}}}class zS{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new fa)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.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))continue;let u=s[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let d=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!u.extend&&(n=h,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new fa,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new fa,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.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),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){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=An(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(An(a,c+2),t,n,i));break}a[c]==t&&(i=this.putAction(An(a,c+1),t,n,i))}return i}}class US{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,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 VS(t,i),this.tokens=new zS(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ca.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new HS(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],i,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)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let o=i&&KS(i);if(o)return mr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw mr&&i&&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&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(o)return mr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let l=o+1;l<n.length;l++){let c=n[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)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[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,n){let i=e.pos,{parser:s}=this,o=mr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let d=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(d>-1&&h.length&&(!c||(h.prop(Be.contextHash)||0)==u))return e.useNode(h,d),mr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof ct)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ct&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),mr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=9e3)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],h=l[c++],d=l[c++],p=c==l.length||!n,m=p?e:e.split(),y=this.tokens.mainToken;if(m.apply(u,h,y?y.start:m.pos,d),mr&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(h)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?t.push(m):n.push(m)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Vd(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],u=mr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),mr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let h=a.split(),d=u;for(let p=0;h.forceReduce()&&p<10&&(mr&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)mr&&(d=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))mr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),mr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Vd(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),ct.build({buffer:ua.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=(bc||(bc=new WeakMap)).get(e);return t||bc.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Vd(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class GS{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const xc=r=>r;class ZI{constructor(e){this.start=e.start,this.shift=e.shift||xc,this.reduce=e.reduce||xc,this.reuse=e.reuse||xc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ha extends Td{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 n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Be[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let h=a[c+-u];for(let d=-u;d>0;d--)s(a[c++],l,h);c++}}}this.nodeSet=new sa(t.map((a,l)=>er.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:n.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=wd;let o=Ws(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(Wd),this.states=Ws(e.states,Uint32Array),this.data=Ws(e.stateData),this.goto=Ws(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Yi(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,n){let i=new US(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&n)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=An(n,s+2)];else{if(n[s+1]==2)return An(n,s+2);break}if(o==t||o==0)return An(n,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,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=An(this.data,s+2);else break;i=t(An(this.data,s+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=An(this.data,n+2);else break;if(!(this.data[n+2]&1)){let i=this.data[n+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[n],i)}}return t}configure(e){let t=Object.assign(Object.create(ha.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=Wd(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),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!n[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new GS(e,n,i)}static deserialize(e){return new ha(e)}}function An(r,e){return r[e]|r[e+1]<<16}function KS(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Wd(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}let YS=0;class _r{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=YS++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new _r([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new da;return t=>t.modified.indexOf(e)>-1?t:da.get(t.base||t,t.modified.concat(e).sort((n,i)=>n.id-i.id))}}let JS=0;class da{constructor(){this.instances=[],this.id=JS++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&QS(t,a.modified));if(n)return n;let i=[],s=new _r(i,e,t);for(let a of t)a.instances.push(s);let o=XS(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(da.get(a,l));return s}}function QS(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function XS(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function $d(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new pa(n,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Hd.add(e)}const Hd=new Be;class pa{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}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}}pa.empty=new pa([],2,null);function zd(r,e){let t=Object.create(null);for(let s of r)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:n,all:i=null}=e||{};return{style:s=>{let o=i;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:n}}function ZS(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function _S(r,e,t,n=0,i=r.length){let s=new qS(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i)}class qS{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,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,n,i,s){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=ek(e)||pa.empty,h=ZS(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Be.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),m=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),y=e.firstChild();for(let w=0,A=a;;w++){let T=w<d.overlay.length?d.overlay[w]:null,P=T?T.from+a:l,L=Math.max(t,A),D=Math.min(n,P);if(L<D&&y)for(;e.from<D&&(this.highlightRange(e,L,D,i,s),this.startSpan(Math.min(D,e.to),c),!(e.to>=P||!e.nextSibling())););if(!T||P>n)break;A=T.to+a,A>t&&(this.highlightRange(p.cursor(),Math.max(t,T.from+a),Math.min(n,A),"",m),this.startSpan(Math.min(n,A),c))}y&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function ek(r){let e=r.type.prop(Hd);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const ue=_r.define,ga=ue(),$n=ue(),Ud=ue($n),Gd=ue($n),Hn=ue(),ma=ue(Hn),wc=ue(Hn),qr=ue(),vi=ue(qr),en=ue(),tn=ue(),Sc=ue(),$s=ue(Sc),va=ue(),M={comment:ga,lineComment:ue(ga),blockComment:ue(ga),docComment:ue(ga),name:$n,variableName:ue($n),typeName:Ud,tagName:ue(Ud),propertyName:Gd,attributeName:ue(Gd),className:ue($n),labelName:ue($n),namespace:ue($n),macroName:ue($n),literal:Hn,string:ma,docString:ue(ma),character:ue(ma),attributeValue:ue(ma),number:wc,integer:ue(wc),float:ue(wc),bool:ue(Hn),regexp:ue(Hn),escape:ue(Hn),color:ue(Hn),url:ue(Hn),keyword:en,self:ue(en),null:ue(en),atom:ue(en),unit:ue(en),modifier:ue(en),operatorKeyword:ue(en),controlKeyword:ue(en),definitionKeyword:ue(en),moduleKeyword:ue(en),operator:tn,derefOperator:ue(tn),arithmeticOperator:ue(tn),logicOperator:ue(tn),bitwiseOperator:ue(tn),compareOperator:ue(tn),updateOperator:ue(tn),definitionOperator:ue(tn),typeOperator:ue(tn),controlOperator:ue(tn),punctuation:Sc,separator:ue(Sc),bracket:$s,angleBracket:ue($s),squareBracket:ue($s),paren:ue($s),brace:ue($s),content:qr,heading:vi,heading1:ue(vi),heading2:ue(vi),heading3:ue(vi),heading4:ue(vi),heading5:ue(vi),heading6:ue(vi),contentSeparator:ue(qr),list:ue(qr),quote:ue(qr),emphasis:ue(qr),strong:ue(qr),link:ue(qr),monospace:ue(qr),strikethrough:ue(qr),inserted:ue(),deleted:ue(),changed:ue(),invalid:ue(),meta:va,documentMeta:ue(va),annotation:ue(va),processingInstruction:ue(va),definition:_r.defineModifier(),constant:_r.defineModifier(),function:_r.defineModifier(),standard:_r.defineModifier(),local:_r.defineModifier(),special:_r.defineModifier()},_I=zd([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]),tk=$d({String:M.string,Number:M.number,"True False":M.bool,PropertyName:M.propertyName,Null:M.null,",":M.separator,"[ ]":M.squareBracket,"{ }":M.brace}),rk=ha.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[tk],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});class Qe{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,n){let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),rn.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let n=[];return this.decompose(e,t,n,0),rn.from(n,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),n=this.length-this.scanIdentical(e,-1),i=new Hs(this),s=new Hs(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=n)return!0}}iter(e=1){return new Hs(this,e)}iterRange(e,t=this.length){return new Yd(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Jd(n)}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]?Qe.empty:e.length<=32?new mt(e):rn.from(mt.split(e,[]))}}class mt extends Qe{constructor(e,t=nk(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?n:a)>=e)return new ik(i,a,n,o);i=a+1,n++}}decompose(e,t,n,i){let s=e<=0&&t>=this.length?this:new mt(Kd(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),a=ya(s.text,o.text.slice(),0,s.length);if(a.length<=32)n.push(new mt(a,o.length+s.length));else{let l=a.length>>1;n.push(new mt(a.slice(0,l)),new mt(a.slice(l)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof mt))return super.replace(e,t,n);let i=ya(this.text,ya(n.text,Kd(this.text,0,e)),t),s=this.length+n.length-(t-e);return i.length<=32?new mt(i,s):rn.from(mt.split(i,[]),s)}sliceString(e,t=this.length,n=`
|
|
140
|
+
`,wd=1024;let OS=0;class Ir{constructor(e,t){this.from=e,this.to=t}}class Be{constructor(e={}){this.id=OS++,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=er.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Be.closedBy=new Be({deserialize:r=>r.split(" ")}),Be.openedBy=new Be({deserialize:r=>r.split(" ")}),Be.group=new Be({deserialize:r=>r.split(" ")}),Be.contextHash=new Be({perNode:!0}),Be.lookAhead=new Be({perNode:!0}),Be.mounted=new Be({perNode:!0});class js{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Be.mounted.id]}}const ES=Object.create(null);class er{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):ES,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),i=new er(e.name||"",t,e.id,n);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(i)),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 i}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(Be.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return n=>{for(let i=n.prop(Be.group),s=-1;s<(i?i.length:0);s++){let o=t[s<0?n.name:i[s]];if(o)return o}}}}er.none=new er("",Object.create(null),0,8);class sa{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 n of this.types){let i=null;for(let s of e){let o=s(n);o&&(i||(i=Object.assign({},n.props)),i[o[0].id]=o[1])}t.push(i?new er(n.name,i,n.id,n.flags):n)}return new sa(t)}}const oa=new WeakMap,Sd=new WeakMap;var st;(function(r){r[r.ExcludeBuffers=1]="ExcludeBuffers",r[r.IncludeAnonymous=2]="IncludeAnonymous",r[r.IgnoreMounts=4]="IgnoreMounts",r[r.IgnoreOverlays=8]="IgnoreOverlays"})(st||(st={}));class ct{constructor(e,t,n,i,s){if(this.type=e,this.children=t,this.positions=n,this.length=i,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=js.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let i=n.toString();i&&(t&&(t+=","),t+=i)}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 aa(this.topNode,e)}cursorAt(e,t=0,n=0){let i=oa.get(this)||this.topNode,s=new aa(i);return s.moveTo(e,t),oa.set(this,s._tree),s}get topNode(){return new tr(this,0,0,null)}resolve(e,t=0){let n=Vs(oa.get(this)||this.topNode,e,t,!1);return oa.set(this,n),n}resolveInner(e,t=0){let n=Vs(Sd.get(this)||this.topNode,e,t,!0);return Sd.set(this,n),n}resolveStack(e,t=0){return MS(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:s=this.length}=e,o=e.mode||0,a=(o&st.IncludeAnonymous)>0;for(let l=this.cursor(o|st.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!a&&l.type.isAnonymous||t(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&n&&(a||!l.type.isAnonymous)&&n(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:vc(er.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,i)=>new ct(this.type,t,n,i,this.propValues),e.makeTree||((t,n,i)=>new ct(er.none,t,n,i)))}static build(e){return IS(e)}}ct.empty=new ct(er.none,[],[],0);class pc{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 pc(this.buffer,this.index)}}class mi{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return er.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],n=this.buffer[e+3],i=this.set.types[t],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),e+=4,n==e)return s;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return s+"("+o.join(",")+")"}findChild(e,t,n,i,s){let{buffer:o}=this,a=-1;for(let l=e;l!=t&&!(kd(s,i,o[l+1],o[l+2])&&(a=l,n>0));l=o[l+3]);return a}slice(e,t,n){let i=this.buffer,s=new Uint16Array(t-e),o=0;for(let a=e,l=0;a<t;){s[l++]=i[a++],s[l++]=i[a++]-n;let c=s[l++]=i[a++]-n;s[l++]=i[a++]-e,o=Math.max(o,c)}return new mi(s,o,this.set)}}function kd(r,e,t,n){switch(r){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function Vs(r,e,t,n){for(var i;r.from==r.to||(t<1?r.from>=e:r.from>e)||(t>-1?r.to<=e:r.to<e);){let o=!n&&r instanceof tr&&r.index<0?null:r.parent;if(!o)return r;r=o}let s=n?0:st.IgnoreOverlays;if(n)for(let o=r,a=o.parent;a;o=a,a=o.parent)o instanceof tr&&o.index<0&&((i=a.enter(e,t,s))===null||i===void 0?void 0:i.from)!=o.from&&(r=a);for(;;){let o=r.enter(e,t,s);if(!o)return r;r=o}}class Ad{cursor(e=0){return new aa(this,e)}getChild(e,t=null,n=null){let i=Cd(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return Cd(this,e,t,n)}resolve(e,t=0){return Vs(this,e,t,!1)}resolveInner(e,t=0){return Vs(this,e,t,!0)}matchContext(e){return gc(this,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let i=t.lastChild;if(!i||i.to!=t.to)break;i.type.isError&&i.from==i.to?(n=t,t=i.prevSibling):t=i}return n}get node(){return this}get next(){return this.parent}}class tr extends Ad{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,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 u=a[e],h=l[e]+o.from;if(kd(i,n,h,h+u.length)){if(u instanceof mi){if(s&st.ExcludeBuffers)continue;let d=u.findChild(0,u.buffer.length,t,n-h,i);if(d>-1)return new Zr(new TS(o,u,e,h),null,d)}else if(s&st.IncludeAnonymous||!u.type.isAnonymous||mc(u)){let d;if(!(s&st.IgnoreMounts)&&(d=js.get(u))&&!d.overlay)return new tr(d.tree,h,e,o);let p=new tr(u,h,e,o);return s&st.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?u.children.length-1:0,t,n,i)}}}if(s&st.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,n=0){let i;if(!(n&st.IgnoreOverlays)&&(i=js.get(this._tree))&&i.overlay){let s=e-this.from;for(let{from:o,to:a}of i.overlay)if((t>0?o<=s:o<s)&&(t<0?a>=s:a>s))return new tr(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}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 Cd(r,e,t,n){let i=r.cursor(),s=[];if(!i.firstChild())return s;if(t!=null){for(;!i.type.is(t);)if(!i.nextSibling())return s}for(;;){if(n!=null&&i.type.is(n))return s;if(i.type.is(e)&&s.push(i.node),!i.nextSibling())return n==null?s:[]}}function gc(r,e,t=e.length-1){for(let n=r.parent;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class TS{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Zr extends Ad{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,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return s<0?null:new Zr(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,n=0){if(n&st.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new Zr(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 Zr(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 Zr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,s=n.buffer[this.index+3];if(s>i){let o=n.buffer[this.index+1];e.push(n.slice(i,s,o)),t.push(0)}return new ct(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Od(r){if(!r.length)return null;if(r.length==1)return r[0];let e=0,t=r[0];for(let s=1;s<r.length;s++){let o=r[s];(o.from>t.from||o.to<t.to)&&(t=o,e=s)}let n=t instanceof tr&&t.index<0?null:t.parent,i=r.slice();return n?i[e]=n:i.splice(e,1),new PS(i,t)}class PS{constructor(e,t){this.heads=e,this.node=t}get next(){return Od(this.heads)}}function MS(r,e,t){let n=r.resolveInner(e,t),i=null;for(let s=n instanceof tr?n:n.context.parent;s;s=s.parent)if(s.index<0){let o=s.parent;(i||(i=[n])).push(o.resolve(e,t)),s=o}else{let o=js.get(s.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let a=new tr(o.tree,o.overlay[0].from+s.from,0,null);(i||(i=[n])).push(Vs(a,e,t,!1))}}return i?Od(i):n}class aa{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 tr)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.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:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return e?e instanceof tr?(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,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);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,n=this.mode){return this.buffer?n&st.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&st.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,n=this.stack.length-1;if(e<0){let i=n<0?0:this.stack[n]+4;if(this.index!=i)return this.yieldBuf(t.findChild(i,this.index,-1,0,4))}else{let i=t.buffer[this.index+3];if(i<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(i)}return n<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,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let s=t+e,o=e<0?-1:n._tree.children.length;s!=o;s+=e){let a=n._tree.children[s];if(this.mode&st.IncludeAnonymous||a instanceof mi||!a.type.isAnonymous||mc(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,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let o=e;o;o=o._parent)if(o.index==i){if(i==this.index)return o;t=o,n=s+1;break e}i=this.stack[--s]}for(let i=n;i<this.stack.length;i++)t=new Zr(this.buffer,t,this.stack[i]);return this.bufferNode=new Zr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;i&&t&&t(this),i=this.type.isAnonymous,!this.nextSibling();){if(!n)return;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return gc(this.node,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return gc(this.node,e,i);let o=n[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[i]&&e[i]!=o.name)return!1;i--}}return!0}}function mc(r){return r.children.some(e=>e instanceof mi||!e.type.isAnonymous||mc(e))}function IS(r){var e;let{buffer:t,nodeSet:n,maxBufferLength:i=wd,reused:s=[],minRepeatType:o=n.types.length}=r,a=Array.isArray(t)?new pc(t,t.length):t,l=n.types,c=0,u=0;function h(L,D,j,W,q){let{id:F,start:H,end:Q,size:oe}=a,fe=u;for(;oe<0;)if(a.next(),oe==-1){let Oe=s[F];j.push(Oe),W.push(H-L);return}else if(oe==-3){c=F;return}else if(oe==-4){u=F;return}else throw new RangeError(`Unrecognized record size: ${oe}`);let be=l[F],ke,Re,Se=H-L;if(Q-H<=i&&(Re=y(a.pos-D,q))){let Oe=new Uint16Array(Re.size-Re.skip),Te=a.pos-Re.size,De=Oe.length;for(;a.pos>Te;)De=w(Re.start,Oe,De);ke=new mi(Oe,Q-Re.start,n),Se=Re.start-L}else{let Oe=a.pos-oe;a.next();let Te=[],De=[],bt=F>=o?F:-1,Rt=0,ir=Q;for(;a.pos>Oe;)bt>=0&&a.id==bt&&a.size>=0?(a.end<=ir-i&&(p(Te,De,H,Rt,a.end,ir,bt,fe),Rt=Te.length,ir=a.end),a.next()):h(H,Oe,Te,De,bt);if(bt>=0&&Rt>0&&Rt<Te.length&&p(Te,De,H,Rt,H,ir,bt,fe),Te.reverse(),De.reverse(),bt>-1&&Rt>0){let jr=d(be);ke=vc(be,Te,De,0,Te.length,0,Q-H,jr,jr)}else ke=m(be,Te,De,Q-H,fe-Q)}j.push(ke),W.push(Se)}function d(L){return(D,j,W)=>{let q=0,F=D.length-1,H,Q;if(F>=0&&(H=D[F])instanceof ct){if(!F&&H.type==L&&H.length==W)return H;(Q=H.prop(Be.lookAhead))&&(q=j[F]+H.length+Q)}return m(L,D,j,W,q)}}function p(L,D,j,W,q,F,H,Q){let oe=[],fe=[];for(;L.length>W;)oe.push(L.pop()),fe.push(D.pop()+j-q);L.push(m(n.types[H],oe,fe,F-q,Q-F)),D.push(q-j)}function m(L,D,j,W,q=0,F){if(c){let H=[Be.contextHash,c];F=F?[H].concat(F):[H]}if(q>25){let H=[Be.lookAhead,q];F=F?[H].concat(F):[H]}return new ct(L,D,j,W,F)}function y(L,D){let j=a.fork(),W=0,q=0,F=0,H=j.end-i,Q={size:0,start:0,skip:0};e:for(let oe=j.pos-L;j.pos>oe;){let fe=j.size;if(j.id==D&&fe>=0){Q.size=W,Q.start=q,Q.skip=F,F+=4,W+=4,j.next();continue}let be=j.pos-fe;if(fe<0||be<oe||j.start<H)break;let ke=j.id>=o?4:0,Re=j.start;for(j.next();j.pos>be;){if(j.size<0)if(j.size==-3)ke+=4;else break e;else j.id>=o&&(ke+=4);j.next()}q=Re,W+=fe,F+=ke}return(D<0||W==L)&&(Q.size=W,Q.start=q,Q.skip=F),Q.size>4?Q:void 0}function w(L,D,j){let{id:W,start:q,end:F,size:H}=a;if(a.next(),H>=0&&W<o){let Q=j;if(H>4){let oe=a.pos-(H-4);for(;a.pos>oe;)j=w(L,D,j)}D[--j]=Q,D[--j]=F-L,D[--j]=q-L,D[--j]=W}else H==-3?c=W:H==-4&&(u=W);return j}let A=[],T=[];for(;a.pos>0;)h(r.start||0,r.bufferStart||0,A,T,-1);let P=(e=r.length)!==null&&e!==void 0?e:A.length?T[0]+A[0].length:0;return new ct(l[r.topID],A.reverse(),T.reverse(),P)}const Ed=new WeakMap;function la(r,e){if(!r.isAnonymous||e instanceof mi||e.type!=r)return 1;let t=Ed.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=r||!(n instanceof ct)){t=1;break}t+=la(r,n)}Ed.set(e,t)}return t}function vc(r,e,t,n,i,s,o,a,l){let c=0;for(let m=n;m<i;m++)c+=la(r,e[m]);let u=Math.ceil(c*1.5/8),h=[],d=[];function p(m,y,w,A,T){for(let P=w;P<A;){let L=P,D=y[P],j=la(r,m[P]);for(P++;P<A;P++){let W=la(r,m[P]);if(j+W>=u)break;j+=W}if(P==L+1){if(j>u){let W=m[L];p(W.children,W.positions,0,W.children.length,y[L]+T);continue}h.push(m[L])}else{let W=y[P-1]+m[P-1].length-D;h.push(vc(r,m,y,L,P,D,W,null,l))}d.push(D+T-s)}}return p(e,t,n,i,0),(a||l)(h,d,o)}class QI{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof Zr?this.setBuffer(e.context.buffer,e.index,t):e instanceof tr&&this.map.set(e.tree,t)}get(e){return e instanceof Zr?this.getBuffer(e.context.buffer,e.index):e instanceof tr?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)}}class kn{constructor(e,t,n,i,s=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,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=[],n=!1){let i=[new kn(0,e.length,e,0,!1,n)];for(let s of t)s.to>e.length&&i.push(s);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],s=1,o=e.length?e[0]:null;for(let a=0,l=0,c=0;;a++){let u=a<t.length?t[a]:null,h=u?u.fromA:1e9;if(h-l>=n)for(;o&&o.from<h;){let d=o;if(l>=d.from||h<=d.to||c){let p=Math.max(d.from,l)-c,m=Math.min(d.to,h)-c;d=p>=m?null:new kn(p,m,d.tree,d.offset+c,a>0,!!u)}if(d&&i.push(d),o.to>h)break;o=s<e.length?e[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}class Td{startParse(e,t,n){return typeof e=="string"&&(e=new DS(e)),n=n?n.length?n.map(i=>new Ir(i.from,i.to)):[new Ir(0,0)]:[new Ir(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let s=i.advance();if(s)return s}}}class DS{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)}}function XI(r){return(e,t,n,i)=>new RS(e,r,t,n,i)}class Pd{constructor(e,t,n,i,s){if(this.parser=e,this.parse=t,this.overlay=n,this.target=i,this.ranges=s,!s.length||s.some(o=>o.from>=o.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(s))}}class NS{constructor(e,t,n,i,s,o,a){this.parser=e,this.predicate=t,this.mounts=n,this.index=i,this.start=s,this.target=o,this.prev=a,this.depth=0,this.ranges=[]}}const yc=new Be({perNode:!0});class RS{constructor(e,t,n,i,s){this.nest=t,this.input=n,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let n=this.baseParse.advance();if(!n)return null;if(this.baseParse=null,this.baseTree=n,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let n=this.baseTree;return this.stoppedAt!=null&&(n=new ct(n.type,n.children,n.positions,n.length,n.propValues.concat([[yc,this.stoppedAt]]))),n}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Be.mounted.id]=new js(t,e.overlay,e.parser),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].ranges[0].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new FS(this.fragments),t=null,n=null,i=new aa(new tr(this.baseTree,this.ranges[0].from,0,null),st.IncludeAnonymous|st.IgnoreMounts);e:for(let s,o;this.stoppedAt==null||i.from<this.stoppedAt;){let a=!0,l;if(e.hasNode(i)){if(t){let c=t.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let h=u.from+c.pos,d=u.to+c.pos;h>=i.from&&d<=i.to&&!t.ranges.some(p=>p.from<d&&p.to>h)&&t.ranges.push({from:h,to:d})}}a=!1}else if(n&&(o=LS(n.ranges,i.from,i.to)))a=o!=2;else if(!i.type.isAnonymous&&i.from<i.to&&(s=this.nest(i,this.input))){i.tree||BS(i);let c=e.findMounts(i.from,s.parser);if(typeof s.overlay=="function")t=new NS(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,t);else{let u=Dd(this.ranges,s.overlay||[new Ir(i.from,i.to)]);u.length&&this.inner.push(new Pd(s.parser,s.parser.startParse(this.input,Nd(c,u),u),s.overlay?s.overlay.map(h=>new Ir(h.from-i.from,h.to-i.from)):null,i.tree,u)),s.overlay?u.length&&(n={ranges:u,depth:0,prev:n}):a=!1}}else t&&(l=t.predicate(i))&&(l===!0&&(l=new Ir(i.from,i.to)),l.from<l.to&&t.ranges.push(l));if(a&&i.firstChild())t&&t.depth++,n&&n.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(t&&!--t.depth){let c=Dd(this.ranges,t.ranges);c.length&&this.inner.splice(t.index,0,new Pd(t.parser,t.parser.startParse(this.input,Nd(t.mounts,c),c),t.ranges.map(u=>new Ir(u.from-t.start,u.to-t.start)),t.target,c)),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}}function LS(r,e,t){for(let n of r){if(n.from>=t)break;if(n.to>e)return n.from<=e&&n.to>=t?2:1}return 0}function Md(r,e,t,n,i,s){if(e<t){let o=r.buffer[e+1];n.push(r.slice(e,t,o)),i.push(o-s)}}function BS(r){let{node:e}=r,t=0;do r.parent(),t++;while(!r.tree);let n=0,i=r.tree,s=0;for(;s=i.positions[n]+r.from,!(s<=e.from&&s+i.children[n].length>=e.to);n++);let o=i.children[n],a=o.buffer;function l(c,u,h,d,p){let m=c;for(;a[m+2]+s<=e.from;)m=a[m+3];let y=[],w=[];Md(o,c,m,y,w,d);let A=a[m+1],T=a[m+2],P=A+s==e.from&&T+s==e.to&&a[m]==e.type.id;return y.push(P?e.toTree():l(m+4,a[m+3],o.set.types[a[m]],A,T-A)),w.push(A-d),Md(o,a[m+3],u,y,w,d),new ct(h,y,w,p)}i.children[n]=l(0,a.length,er.none,0,o.length);for(let c=0;c<=t;c++)r.childAfter(e.from)}class Id{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(st.IncludeAnonymous|st.IgnoreMounts)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)t.to>=e&&t.enter(n,1,st.IgnoreOverlays|st.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof ct)t=t.children[0];else break}return!1}}class FS{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let n=this.curFrag=e[0];this.curTo=(t=n.tree.prop(yc))!==null&&t!==void 0?t:n.to,this.inner=new Id(n.tree,-n.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(yc))!==null&&e!==void 0?e:t.to,this.inner=new Id(t.tree,-t.offset)}}findMounts(e,t){var n;let i=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(n=s.tree)===null||n===void 0?void 0:n.prop(Be.mounted);if(o&&o.parser==t)for(let a=this.fragI;a<this.fragments.length;a++){let l=this.fragments[a];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:o})}}}return i}}function Dd(r,e){let t=null,n=e;for(let i=1,s=0;i<r.length;i++){let o=r[i-1].to,a=r[i].from;for(;s<n.length;s++){let l=n[s];if(l.from>=a)break;l.to<=o||(t||(n=t=e.slice()),l.from<o?(t[s]=new Ir(l.from,o),l.to>a&&t.splice(s+1,0,new Ir(a,l.to))):l.to>a?t[s--]=new Ir(a,l.to):t.splice(s--,1))}}return n}function jS(r,e,t,n){let i=0,s=0,o=!1,a=!1,l=-1e9,c=[];for(;;){let u=i==r.length?1e9:o?r[i].to:r[i].from,h=s==e.length?1e9:a?e[s].to:e[s].from;if(o!=a){let d=Math.max(l,t),p=Math.min(u,h,n);d<p&&c.push(new Ir(d,p))}if(l=Math.min(u,h),l==1e9)break;u==l&&(o?(o=!1,i++):o=!0),h==l&&(a?(a=!1,s++):a=!0)}return c}function Nd(r,e){let t=[];for(let{pos:n,mount:i,frag:s}of r){let o=n+(i.overlay?i.overlay[0].from:0),a=o+i.tree.length,l=Math.max(s.from,o),c=Math.min(s.to,a);if(i.overlay){let u=i.overlay.map(d=>new Ir(d.from+n,d.to+n)),h=jS(e,u,l,c);for(let d=0,p=l;;d++){let m=d==h.length,y=m?c:h[d].from;if(y>p&&t.push(new kn(p,y,i.tree,-o,s.from>=p||s.openStart,s.to<=y||s.openEnd)),m)break;p=h[d].to}}else t.push(new kn(l,c,i.tree,-o,s.from>=o||s.openStart,s.to<=a||s.openEnd))}return t}class ca{constructor(e,t,n,i,s,o,a,l,c,u=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=s,this.score=o,this.buffer=a,this.bufferBase=l,this.curContext=c,this.lookAhead=u,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new ca(e,[],t,n,n,0,[],0,i?new Rd(i,i.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 n=e>>19,i=e&65535,{parser:s}=this.p,o=s.dynamicPrecedence(i);if(o&&(this.score+=o),n==0){this.pushState(s.getGoto(this.state,i,!0),this.reducePos),i<s.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,4,!0),this.reduceContext(i,this.reducePos);return}let a=this.stack.length-(n-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[i])===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 u=a?this.stack[a-1]:0,h=this.bufferBase+this.buffer.length-u;if(i<s.minRepeatTerm||e&131072){let d=s.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,l,d,h+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=s.getGoto(d,i,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(i,l)}storeNode(e,t,n,i=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==n)return;if(o.buffer[a-2]>=t){o.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,t,n,i);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>n;)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,i>4&&(i-=4);this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=i}}shift(e,t,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let s=e,{parser:o}=this.p;(i>this.pos||t<=o.maxNode)&&(this.pos=i,o.stateFlag(s,1)||(this.reducePos=i)),this.pushState(s,n),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){e&65536?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,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 n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new ca(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new VS(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>4<<1||this.stack.length>=120){let i=[];for(let s=0,o;s<t.length;s+=2)(o=t[s+1])!=this.state&&this.p.parser.hasAction(o,e)&&i.push(t[s],o);if(this.stack.length<120)for(let s=0;i.length<4<<1&&s<t.length;s+=2){let o=t[s+1];i.some((a,l)=>l&1&&a==o)||i.push(t[s],o)}t=i}let n=[];for(let i=0;i<t.length&&n.length<4;i+=2){let s=t[i+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[i],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(t&65536))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=t&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!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=[],n=(i,s)=>{if(!t.includes(i))return t.push(i),e.allActions(i,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=n(o,s+1);if(a!=null)return a}})};return n(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 Rd(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()}}class Rd{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class VS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class ua{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new ua(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 ua(this.stack,this.pos,this.index)}}function Ws(r,e=Uint16Array){if(typeof r!="string")return r;let t=null;for(let n=0,i=0;n<r.length;){let s=0;for(;;){let o=r.charCodeAt(n++),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[i++]=s:t=new e(s)}return t}class fa{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Ld=new fa;class WS{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Ld,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 n=this.range,i=this.rangeIndex,s=this.pos+e;for(;s<n.from;){if(!i)return null;let o=this.ranges[--i];s-=n.from-o.to,n=o}for(;t<0?s>n.to:s>=n.to;){if(i==this.ranges.length-1)return null;let o=this.ranges[++i];s+=o.from-n.to,n=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,n,i;if(t>=0&&t<this.chunk.length)n=this.pos+e,i=this.chunk.charCodeAt(t);else{let s=this.resolveOffset(e,1);if(s==null)return-1;if(n=s,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)i=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,a=this.range;for(;a.to<=n;)a=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>a.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}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=Ld,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 n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Yi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Bd(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Yi.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class $S{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e=="string"?Ws(e):e}token(e,t){let n=e.pos,i=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Bd(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,o==null)break;e.reset(o,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}$S.prototype.contextual=Yi.prototype.fallback=Yi.prototype.extend=!1;class ZI{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Bd(r,e,t,n,i,s){let o=0,a=1<<n,{dialect:l}=t.p.parser;e:for(;a&r[o];){let c=r[o+1];for(let p=o+3;p<c;p+=2)if((r[p+1]&a)>0){let m=r[p];if(l.allows(m)&&(e.token.value==-1||e.token.value==m||HS(m,e.token.value,i,s))){e.acceptToken(m);break}}let u=e.next,h=0,d=r[o+2];if(e.next<0&&d>h&&r[c+d*3-3]==65535&&r[c+d*3-3]==65535){o=r[c+d*3-1];continue e}for(;h<d;){let p=h+d>>1,m=c+p+(p<<1),y=r[m],w=r[m+1]||65536;if(u<y)d=p;else if(u>=w)h=p+1;else{o=r[m+2],e.advance();continue e}}break}}function Fd(r,e,t){for(let n=e,i;(i=r[n])!=65535;n++)if(i==t)return n-e;return-1}function HS(r,e,t,n){let i=Fd(t,n,e);return i<0||Fd(t,n,r)<i}const mr=typeof process<"u"&&{}&&/\bparse\b/.test({}.LOG);let bc=null;function jd(r,e,t){let n=r.cursor(st.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(r.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:r.length}}class zS{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?jd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?jd(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 n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let s=n.children[i],o=this.start[t]+n.positions[i];if(o>e)return this.nextStart=o,null;if(s instanceof ct){if(o==e){if(o<this.safeFrom)return null;let a=o+s.length;if(a<=this.safeTo){let l=s.prop(Be.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}}}class US{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new fa)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,o=i.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))continue;let u=s[c],h=this.tokens[c];if(!(n&&!u.fallback)&&((u.contextual||h.start!=e.pos||h.mask!=o||h.context!=a)&&(this.updateCachedToken(h,u,e),h.mask=o,h.context=a),h.lookAhead>h.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let d=t;if(h.extended>-1&&(t=this.addActions(e,h.extended,h.end,t)),t=this.addActions(e,h.value,h.end,t),!u.extend&&(n=h,t>d))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new fa,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new fa,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.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),n);if(a>=0&&n.p.parser.dialect.allows(a>>1)){a&1?e.extended=a>>1:e.value=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let s=0;s<i;s+=3)if(this.actions[s]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){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=An(a,c+2);else{i==0&&a[c+1]==2&&(i=this.putAction(An(a,c+2),t,n,i));break}a[c]==t&&(i=this.putAction(An(a,c+1),t,n,i))}return i}}class GS{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,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 WS(t,i),this.tokens=new US(e,this.stream),this.topTerm=e.top[1];let{from:s}=i[0];this.stacks=[ca.start(this,e.top[0],s)],this.fragments=n.length&&this.stream.end-s>e.bufferLength*4?new zS(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],i,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)n.push(a);else{if(this.advanceStack(a,n,e))continue;{i||(i=[],s=[]),i.push(a);let l=this.tokens.getMainToken(a);s.push(l.value,l.end)}}break}}if(!n.length){let o=i&&YS(i);if(o)return mr&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw mr&&i&&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&&i){let o=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(o)return mr&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let a=n[o];for(let l=o+1;l<n.length;l++){let c=n[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)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[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,n){let i=e.pos,{parser:s}=this,o=mr?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.curContext&&e.curContext.tracker.strict,u=c?e.curContext.hash:0;for(let h=this.fragments.nodeAt(i);h;){let d=this.parser.nodeSet.types[h.type.id]==h.type?s.getGoto(e.state,h.type.id):-1;if(d>-1&&h.length&&(!c||(h.prop(Be.contextHash)||0)==u))return e.useNode(h,d),mr&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(h.type.id)})`),!0;if(!(h instanceof ct)||h.children.length==0||h.positions[0]>0)break;let p=h.children[0];if(p instanceof ct&&h.positions[0]==0)h=p;else break}}let a=s.stateSlot(e.state,4);if(a>0)return e.reduce(a),mr&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(a&65535)})`),!0;if(e.stack.length>=9e3)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;c<l.length;){let u=l[c++],h=l[c++],d=l[c++],p=c==l.length||!n,m=p?e:e.split(),y=this.tokens.mainToken;if(m.apply(u,h,y?y.start:m.pos,d),mr&&console.log(o+this.stackID(m)+` (via ${u&65536?`reduce of ${s.getName(u&65535)}`:"shift"} for ${s.getName(h)} @ ${i}${m==e?"":", split"})`),p)return!0;m.pos>i?t.push(m):n.push(m)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Vd(e,t),!0}}runRecovery(e,t,n){let i=null,s=!1;for(let o=0;o<e.length;o++){let a=e[o],l=t[o<<1],c=t[(o<<1)+1],u=mr?this.stackID(a)+" -> ":"";if(a.deadEnd&&(s||(s=!0,a.restart(),mr&&console.log(u+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let h=a.split(),d=u;for(let p=0;h.forceReduce()&&p<10&&(mr&&console.log(d+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));p++)mr&&(d=this.stackID(h)+" -> ");for(let p of a.recoverByInsert(l))mr&&console.log(u+this.stackID(p)+" (via recover-insert)"),this.advanceFully(p,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),mr&&console.log(u+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),Vd(a,n)):(!i||i.score<a.score)&&(i=a)}return i}stackToTree(e){return e.close(),ct.build({buffer:ua.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=(bc||(bc=new WeakMap)).get(e);return t||bc.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Vd(r,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==r.pos&&n.sameState(r)){e[t].score<r.score&&(e[t]=r);return}}e.push(r)}class KS{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}const xc=r=>r;class _I{constructor(e){this.start=e.start,this.shift=e.shift||xc,this.reduce=e.reduce||xc,this.reuse=e.reuse||xc,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class ha extends Td{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 n=Object.keys(e.topRules).map(a=>e.topRules[a][1]),i=[];for(let a=0;a<t.length;a++)i.push([]);function s(a,l,c){i[a].push([l,l.deserialize(String(c))])}if(e.nodeProps)for(let a of e.nodeProps){let l=a[0];typeof l=="string"&&(l=Be[l]);for(let c=1;c<a.length;){let u=a[c++];if(u>=0)s(u,l,a[c++]);else{let h=a[c+-u];for(let d=-u;d>0;d--)s(a[c++],l,h);c++}}}this.nodeSet=new sa(t.map((a,l)=>er.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:i[l],top:n.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=wd;let o=Ws(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(Wd),this.states=Ws(e.states,Uint32Array),this.data=Ws(e.stateData),this.goto=Ws(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(a=>typeof a=="number"?new Yi(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,n){let i=new GS(this,e,t,n);for(let s of this.wrappers)i=s(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let s=i[t+1];;){let o=i[s++],a=o&1,l=i[s++];if(a&&n)return l;for(let c=s+(o>>1);s<c;s++)if(i[s]==e)return l;if(a)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let s=this.stateSlot(e,i?2:1),o;;s+=3){if((o=n[s])==65535)if(n[s+1]==1)o=n[s=An(n,s+2)];else{if(n[s+1]==2)return An(n,s+2);break}if(o==t||o==0)return An(n,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,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=An(this.data,s+2);else break;i=t(An(this.data,s+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=An(this.data,n+2);else break;if(!(this.data[n+2]&1)){let i=this.data[n+1];t.some((s,o)=>o&1&&s==i)||t.push(this.data[n],i)}}return t}configure(e){let t=Object.assign(Object.create(ha.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(a=>a.from==n.external);if(!s)return n;let o=Object.assign(Object.assign({},n),{external:s.to});return t.specializers[i]=Wd(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),n=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(n[o]=!0)}let i=null;for(let s=0;s<t.length;s++)if(!n[s])for(let o=this.dialects[t[s]],a;(a=this.data[o++])!=65535;)(i||(i=new Uint8Array(this.maxTerm+1)))[a]=1;return new KS(e,n,i)}static deserialize(e){return new ha(e)}}function An(r,e){return r[e]|r[e+1]<<16}function YS(r){let e=null;for(let t of r){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function Wd(r){if(r.external){let e=r.extend?1:0;return(t,n)=>r.external(t,n)<<1|e}return r.get}let JS=0;class _r{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=JS++}static define(e){if(e?.base)throw new Error("Can not derive from a modified tag");let t=new _r([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new da;return t=>t.modified.indexOf(e)>-1?t:da.get(t.base||t,t.modified.concat(e).sort((n,i)=>n.id-i.id))}}let QS=0;class da{constructor(){this.instances=[],this.id=QS++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(a=>a.base==e&&XS(t,a.modified));if(n)return n;let i=[],s=new _r(i,e,t);for(let a of t)a.instances.push(s);let o=ZS(t);for(let a of e.set)if(!a.modified.length)for(let l of o)i.push(da.get(a,l));return s}}function XS(r,e){return r.length==e.length&&r.every((t,n)=>t==e[n])}function ZS(r){let e=[[]];for(let t=0;t<r.length;t++)for(let n=0,i=e.length;n<i;n++)e.push(e[n].concat(r[t]));return e.sort((t,n)=>n.length-t.length)}function $d(r){let e=Object.create(null);for(let t in r){let n=r[t];Array.isArray(n)||(n=[n]);for(let i of t.split(" "))if(i){let s=[],o=2,a=i;for(let h=0;;){if(a=="..."&&h>0&&h+3==i.length){o=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!d)throw new RangeError("Invalid path: "+i);if(s.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),h+=d[0].length,h==i.length)break;let p=i[h++];if(h==i.length&&p=="!"){o=0;break}if(p!="/")throw new RangeError("Invalid path: "+i);a=i.slice(h)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new pa(n,o,l>0?s.slice(0,l):null);e[c]=u.sort(e[c])}}return Hd.add(e)}const Hd=new Be;class pa{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}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}}pa.empty=new pa([],2,null);function zd(r,e){let t=Object.create(null);for(let s of r)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:n,all:i=null}=e||{};return{style:s=>{let o=i;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:n}}function _S(r,e){let t=null;for(let n of r){let i=n.style(e);i&&(t=t?t+" "+i:i)}return t}function qS(r,e,t,n=0,i=r.length){let s=new ek(n,Array.isArray(e)?e:[e],t);s.highlightRange(r.cursor(),n,i,"",s.highlighters),s.flush(i)}class ek{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,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,n,i,s){let{type:o,from:a,to:l}=e;if(a>=n||l<=t)return;o.isTop&&(s=this.highlighters.filter(p=>!p.scope||p.scope(o)));let c=i,u=tk(e)||pa.empty,h=_S(s,u.tags);if(h&&(c&&(c+=" "),c+=h,u.mode==1&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,a),c),u.opaque)return;let d=e.tree&&e.tree.prop(Be.mounted);if(d&&d.overlay){let p=e.node.enter(d.overlay[0].from+a,1),m=this.highlighters.filter(w=>!w.scope||w.scope(d.tree.type)),y=e.firstChild();for(let w=0,A=a;;w++){let T=w<d.overlay.length?d.overlay[w]:null,P=T?T.from+a:l,L=Math.max(t,A),D=Math.min(n,P);if(L<D&&y)for(;e.from<D&&(this.highlightRange(e,L,D,i,s),this.startSpan(Math.min(D,e.to),c),!(e.to>=P||!e.nextSibling())););if(!T||P>n)break;A=T.to+a,A>t&&(this.highlightRange(p.cursor(),Math.max(t,T.from+a),Math.min(n,A),"",m),this.startSpan(Math.min(n,A),c))}y&&e.parent()}else if(e.firstChild()){d&&(i="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,s),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}}function tk(r){let e=r.type.prop(Hd);for(;e&&e.context&&!r.matchContext(e.context);)e=e.next;return e||null}const ue=_r.define,ga=ue(),$n=ue(),Ud=ue($n),Gd=ue($n),Hn=ue(),ma=ue(Hn),wc=ue(Hn),qr=ue(),vi=ue(qr),en=ue(),tn=ue(),Sc=ue(),$s=ue(Sc),va=ue(),M={comment:ga,lineComment:ue(ga),blockComment:ue(ga),docComment:ue(ga),name:$n,variableName:ue($n),typeName:Ud,tagName:ue(Ud),propertyName:Gd,attributeName:ue(Gd),className:ue($n),labelName:ue($n),namespace:ue($n),macroName:ue($n),literal:Hn,string:ma,docString:ue(ma),character:ue(ma),attributeValue:ue(ma),number:wc,integer:ue(wc),float:ue(wc),bool:ue(Hn),regexp:ue(Hn),escape:ue(Hn),color:ue(Hn),url:ue(Hn),keyword:en,self:ue(en),null:ue(en),atom:ue(en),unit:ue(en),modifier:ue(en),operatorKeyword:ue(en),controlKeyword:ue(en),definitionKeyword:ue(en),moduleKeyword:ue(en),operator:tn,derefOperator:ue(tn),arithmeticOperator:ue(tn),logicOperator:ue(tn),bitwiseOperator:ue(tn),compareOperator:ue(tn),updateOperator:ue(tn),definitionOperator:ue(tn),typeOperator:ue(tn),controlOperator:ue(tn),punctuation:Sc,separator:ue(Sc),bracket:$s,angleBracket:ue($s),squareBracket:ue($s),paren:ue($s),brace:ue($s),content:qr,heading:vi,heading1:ue(vi),heading2:ue(vi),heading3:ue(vi),heading4:ue(vi),heading5:ue(vi),heading6:ue(vi),contentSeparator:ue(qr),list:ue(qr),quote:ue(qr),emphasis:ue(qr),strong:ue(qr),link:ue(qr),monospace:ue(qr),strikethrough:ue(qr),inserted:ue(),deleted:ue(),changed:ue(),invalid:ue(),meta:va,documentMeta:ue(va),annotation:ue(va),processingInstruction:ue(va),definition:_r.defineModifier(),constant:_r.defineModifier(),function:_r.defineModifier(),standard:_r.defineModifier(),local:_r.defineModifier(),special:_r.defineModifier()},qI=zd([{tag:M.link,class:"tok-link"},{tag:M.heading,class:"tok-heading"},{tag:M.emphasis,class:"tok-emphasis"},{tag:M.strong,class:"tok-strong"},{tag:M.keyword,class:"tok-keyword"},{tag:M.atom,class:"tok-atom"},{tag:M.bool,class:"tok-bool"},{tag:M.url,class:"tok-url"},{tag:M.labelName,class:"tok-labelName"},{tag:M.inserted,class:"tok-inserted"},{tag:M.deleted,class:"tok-deleted"},{tag:M.literal,class:"tok-literal"},{tag:M.string,class:"tok-string"},{tag:M.number,class:"tok-number"},{tag:[M.regexp,M.escape,M.special(M.string)],class:"tok-string2"},{tag:M.variableName,class:"tok-variableName"},{tag:M.local(M.variableName),class:"tok-variableName tok-local"},{tag:M.definition(M.variableName),class:"tok-variableName tok-definition"},{tag:M.special(M.variableName),class:"tok-variableName2"},{tag:M.definition(M.propertyName),class:"tok-propertyName tok-definition"},{tag:M.typeName,class:"tok-typeName"},{tag:M.namespace,class:"tok-namespace"},{tag:M.className,class:"tok-className"},{tag:M.macroName,class:"tok-macroName"},{tag:M.propertyName,class:"tok-propertyName"},{tag:M.operator,class:"tok-operator"},{tag:M.comment,class:"tok-comment"},{tag:M.meta,class:"tok-meta"},{tag:M.invalid,class:"tok-invalid"},{tag:M.punctuation,class:"tok-punctuation"}]),rk=$d({String:M.string,Number:M.number,"True False":M.bool,PropertyName:M.propertyName,Null:M.null,",":M.separator,"[ ]":M.squareBracket,"{ }":M.brace}),nk=ha.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"\u26A0 JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[rk],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0});class Qe{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,n){let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),rn.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let n=[];return this.decompose(e,t,n,0),rn.from(n,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),n=this.length-this.scanIdentical(e,-1),i=new Hs(this),s=new Hs(e);for(let o=t,a=t;;){if(i.next(o),s.next(o),o=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(a+=i.value.length,i.done||a>=n)return!0}}iter(e=1){return new Hs(this,e)}iterRange(e,t=this.length){return new Yd(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Jd(n)}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]?Qe.empty:e.length<=32?new mt(e):rn.from(mt.split(e,[]))}}class mt extends Qe{constructor(e,t=ik(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.text[s],a=i+o.length;if((t?n:a)>=e)return new sk(i,a,n,o);i=a+1,n++}}decompose(e,t,n,i){let s=e<=0&&t>=this.length?this:new mt(Kd(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(i&1){let o=n.pop(),a=ya(s.text,o.text.slice(),0,s.length);if(a.length<=32)n.push(new mt(a,o.length+s.length));else{let l=a.length>>1;n.push(new mt(a.slice(0,l)),new mt(a.slice(l)))}}else n.push(s)}replace(e,t,n){if(!(n instanceof mt))return super.replace(e,t,n);let i=ya(this.text,ya(n.text,Kd(this.text,0,e)),t),s=this.length+n.length-(t-e);return i.length<=32?new mt(i,s):rn.from(mt.split(i,[]),s)}sliceString(e,t=this.length,n=`
|
|
141
141
|
`){let i="";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&&(i+=n),e<l&&t>s&&(i+=a.slice(Math.max(0,e-s),t-s)),s=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let s of e)n.push(s),i+=s.length+1,n.length==32&&(t.push(new mt(n,i)),n=[],i=-1);return i>-1&&t.push(new mt(n,i)),t}}class rn extends Qe{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,i){for(let s=0;;s++){let o=this.children[s],a=i+o.length,l=n+o.lines-1;if((t?l:a)>=e)return o.lineInner(e,t,n,i);i=a+1,n=l+1}}decompose(e,t,n,i){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=i&((o<=e?1:0)|(l>=t?2:0));o>=e&&l<=t&&!c?n.push(a):a.decompose(e-o,t-o,n,c)}o=l+1}}replace(e,t,n){if(n.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let o=this.children[i],a=s+o.length;if(e>=s&&t<=a){let l=o.replace(e-s,t-s,n),c=this.lines-o.lines+l.lines;if(l.lines<c>>5-1&&l.lines>c>>5+1){let u=this.children.slice();return u[i]=l,new rn(u,this.length-(t-e)+n.length)}return super.replace(s,a,l)}s=a+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
|
|
142
|
-
`){let i="";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&&(i+=n),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,n)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof rn))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let l=this.children[i],c=e.children[s];if(l!=c)return n+l.scanIdentical(c,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let p of e)n+=p.lines;if(n<32){let p=[];for(let m of e)m.flatten(p);return new mt(p,t)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function h(p){let m;if(p.lines>s&&p instanceof rn)for(let y of p.children)h(y);else p.lines>o&&(l>o||!l)?(d(),a.push(p)):p instanceof mt&&l&&(m=u[u.length-1])instanceof mt&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,u[u.length-1]=new mt(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&d(),l+=p.lines,c+=p.length+1,u.push(p))}function d(){l!=0&&(a.push(u.length==1?u[0]:rn.from(u,c)),c=-1,l=u.length=0)}for(let p of e)h(p);return d(),a.length==1?a[0]:new rn(a,t)}}Qe.empty=new mt([""],0);function
|
|
143
|
-
`,this;e--}else if(i instanceof mt){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=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=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof mt?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)}}class Yd{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Hs(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),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!=""}}class Jd{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},Hs.prototype[Symbol.iterator]=Yd.prototype[Symbol.iterator]=Jd.prototype[Symbol.iterator]=function(){return this});class ik{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}let Ji="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,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(r=>r?parseInt(r,36):1);for(let r=1;r<Ji.length;r++)Ji[r]+=Ji[r-1];function sk(r){for(let e=1;e<Ji.length;e+=2)if(Ji[e]>r)return Ji[e-1]<=r;return!1}function Qd(r){return r>=127462&&r<=127487}const Xd=8205;function Ut(r,e,t=!0,n=!0){return(t?Zd:ok)(r,e,n)}function Zd(r,e,t){if(e==r.length)return e;e&&_d(r.charCodeAt(e))&&qd(r.charCodeAt(e-1))&&e--;let n=Lt(r,e);for(e+=Dr(n);e<r.length;){let i=Lt(r,e);if(n==Xd||i==Xd||t&&sk(i))e+=Dr(i),n=i;else if(Qd(i)){let s=0,o=e-2;for(;o>=0&&Qd(Lt(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function ok(r,e,t){for(;e>0;){let n=Zd(r,e-2,t);if(n<e)return n;e--}return 0}function _d(r){return r>=56320&&r<57344}function qd(r){return r>=55296&&r<56320}function Lt(r,e){let t=r.charCodeAt(e);if(!qd(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return _d(n)?(t-55296<<10)+(n-56320)+65536:t}function kc(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Dr(r){return r<65536?1:2}const Ac=/\r\n?|\n/;var rr=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(rr||(rr={}));class nn{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 n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,t=!1){Cc(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new nn(e)}composeDesc(e){return this.empty?e:e.empty?this:ep(this,e)}mapDesc(e,t=!1){return e.empty?this:Oc(this,e,t)}mapPos(e,t=-1,n=rr.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=rr.Simple&&c>=e&&(n==rr.TrackDel&&i<e&&c>e||n==rr.TrackBefore&&i<e||n==rr.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}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 nn(e)}static create(e){return new nn(e)}}class Et extends nn{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 Cc(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return Oc(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Qe.empty);n.push(o?e.slice(s,s+o):Qe.empty)}s+=o}return new Et(t,n)}compose(e){return this.empty?e:e.empty?this:ep(this,e,!0)}map(e,t=!1){return e.empty?this:Oc(this,e,t,!0)}iterChanges(e,t=!1){Cc(this,e,t)}get desc(){return nn.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new zs(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 u=Math.min(s.len,l-a);Gt(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Gt(t,u,h),h>0&&zn(n,t,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Gt(t,u,-1),Gt(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Et(t,n),filtered:nn.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<t&&Gt(i,t-o,-1);let h=new Et(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof Et){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:d=h,insert:p}=u;if(h>d||h<0||d>t)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${t})`);let m=p?typeof p=="string"?Qe.of(p.split(n||Ac)):p:Qe.empty,y=m.length;if(h==d&&y==0)return;h<o&&l(),h>o&&Gt(i,h-o,-1),Gt(i,d-h,y),zn(s,i,m),o=d}}return c(e),l(!a),a}static empty(e){return new Et(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];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(;n.length<i;)n.push(Qe.empty);n[i]=Qe.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new Et(t,n)}static createSet(e,t){return new Et(e,t)}}function Gt(r,e,t,n=!1){if(e==0&&t<=0)return;let i=r.length-2;i>=0&&t<=0&&t==r[i+1]?r[i]+=e:e==0&&r[i]==0?r[i+1]+=t:n?(r[i]+=e,r[i+1]+=t):r.push(e,t)}function zn(r,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<n;)r.push(Qe.empty);r.push(t)}}function Cc(r,e,t){let n=r.inserted;for(let i=0,s=0,o=0;o<r.sections.length;){let a=r.sections[o++],l=r.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,h=Qe.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)a=r.sections[o++],l=r.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function Oc(r,e,t,n=!1){let i=[],s=n?[]:null,o=new zs(r),a=new zs(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Gt(i,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(Gt(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Gt(i,0,o.ins),s&&zn(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Gt(i,c,l<o.i?o.ins:0),s&&l<o.i&&zn(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Et.createSet(i,s):nn.create(i);throw new Error("Mismatched change set lengths")}}function ep(r,e,t=!1){let n=[],i=t?[]:null,s=new zs(r),o=new zs(e);for(let a=!1;;){if(s.done&&o.done)return i?Et.createSet(n,i):nn.create(n);if(s.ins==0)Gt(n,s.len,0,a),s.next();else if(o.len==0&&!o.done)Gt(n,0,o.ins,a),i&&zn(i,n,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=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Gt(n,l,u,a),i&&u&&zn(i,n,o.text)}else o.ins==-1?(Gt(n,s.off?0:s.len,l,a),i&&zn(i,n,s.textBit(l))):(Gt(n,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&zn(i,n,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||n.length>c),s.forward2(l),o.forward(l)}}}}class zs{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?Qe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Qe.empty:t[n].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)}}class yi{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}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 n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new yi(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ie.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ie.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}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 ie.range(e.anchor,e.head)}static create(e,t,n){return new yi(e,t,n)}}class ie{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ie.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ie([this.main],0)}addRange(e,t=!0){return ie.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,ie.create(n,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 ie(e.ranges.map(t=>yi.fromJSON(t)),e.main)}static single(e,t=e){return new ie([ie.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 n=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return ie.normalized(e.slice(),t);n=s.to}return new ie(e,t)}static cursor(e,t=0,n,i){return yi.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,t,n,i){let s=(n??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?yi.create(t,e,48|s):yi.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?ie.range(l,a):ie.range(a,l))}}return new ie(e,t)}}function tp(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ec=0;class de{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Ec++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new de(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Tc),!!e.static,e.enables)}of(e){return new ba([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ba(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ba(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Tc(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class ba{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Ec++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((t=e[h.id])!==null&&t!==void 0?t:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||Pc(h,u)){let p=n(h);if(a?!rp(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,d)=>{let p,m=d.config.address[s];if(m!=null){let y=Sa(d,m);if(this.dependencies.every(w=>w instanceof de?d.facet(w)===h.facet(w):w instanceof kt?d.field(w,!1)==h.field(w,!1):!0)||(a?rp(p=n(h),y,i):i(p=n(h),y)))return h.values[o]=y,0}else p=n(h);return h.values[o]=p,1}}}}function rp(r,e,t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function Pc(r,e){let t=!1;for(let n of e)Gs(r,n)&1&&(t=!0);return t}function ak(r,e,t){let n=t.map(l=>r[l.id]),i=t.map(l=>l.type),s=n.filter(l=>!(l&1)),o=r[e.id]>>1;function a(l){let c=[];for(let u=0;u<n.length;u++){let h=Sa(l,n[u]);if(i[u]==2)for(let d of h)c.push(d);else c.push(h)}return e.combine(c)}return{create(l){for(let c of n)Gs(l,c);return l.values[o]=a(l),1},update(l,c){if(!Pc(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Pc(l,n),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Tc(t,h))return l.values[o]=d,0;let p=a(l);return e.compare(p,d)?(l.values[o]=d,0):(l.values[o]=p,1)}}}const np=de.define({static:!0});class kt{constructor(e,t,n,i,s){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new kt(Ec++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(np).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,i)=>{let s=n.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,i)=>i.config.address[this.id]!=null?(n.values[t]=i.field(this),0):(n.values[t]=this.create(n),1)}}init(e){return[this,np.of({field:this,create:e})]}get extension(){return this}}const bi={lowest:4,low:3,default:2,high:1,highest:0};function Us(r){return e=>new ip(e,r)}const xi={highest:Us(bi.highest),high:Us(bi.high),default:Us(bi.default),low:Us(bi.low),lowest:Us(bi.lowest)};class ip{constructor(e,t){this.inner=e,this.prec=t}}class xa{of(e){return new Mc(this,e)}reconfigure(e){return xa.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Mc{constructor(e,t){this.compartment=e,this.inner=t}}class wa{constructor(e,t,n,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.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,n){let i=[],s=Object.create(null),o=new Map;for(let d of lk(e,t,o))d instanceof kt?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of i)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=n?.config.facets;for(let d in s){let p=s[d],m=p[0].facet,y=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[m.id]=l.length<<1|1,Tc(y,p))l.push(n.facet(m));else{let w=m.combine(p.map(A=>A.value));l.push(n&&m.compare(w,n.facet(m))?n.facet(m):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(A=>w.dynamicSlot(A)));a[m.id]=c.length<<1,c.push(w=>ak(w,m,p))}}let h=c.map(d=>d(a));return new wa(e,o,h,a,l,s)}}function lk(r,e,t){let n=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=n[l].indexOf(o);c>-1&&n[l].splice(c,1),o instanceof Mc&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Mc){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 ip)s(o.inner,o.prec);else if(o instanceof kt)n[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof ba)n[a].push(o),o.facet.extensions&&s(o.facet.extensions,bi.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(r,bi.default),n.reduce((o,a)=>o.concat(a))}function Gs(r,e){if(e&1)return 2;let t=e>>1,n=r.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[t]=4;let i=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|i}function Sa(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const sp=de.define(),op=de.define({combine:r=>r.some(e=>e),static:!0}),ap=de.define({combine:r=>r.length?r[0]:void 0,static:!0}),lp=de.define(),cp=de.define(),up=de.define(),fp=de.define({combine:r=>r.length?r[0]:!1});class sn{constructor(e,t){this.type=e,this.value=t}static define(){return new ck}}class ck{of(e){return new sn(this,e)}}class uk{constructor(e){this.map=e}of(e){return new Ae(this,e)}}class Ae{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 Ae(this.type,t)}is(e){return this.type==e}static define(e={}){return new uk(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(t);s&&n.push(s)}return n}}Ae.reconfigure=Ae.define(),Ae.appendConfig=Ae.define();class Tt{constructor(e,t,n,i,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&tp(n,t.newLength),s.some(a=>a.type==Tt.time)||(this.annotations=s.concat(Tt.time.of(Date.now())))}static create(e,t,n,i,s,o){return new Tt(e,t,n,i,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(Tt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Tt.time=sn.define(),Tt.userEvent=sn.define(),Tt.addToHistory=sn.define(),Tt.remote=sn.define();function fk(r,e){let t=[];for(let n=0,i=0;;){let s,o;if(n<r.length&&(i==e.length||e[i]>=r[n]))s=r[n++],o=r[n++];else if(i<e.length)s=e[i++],o=e[i++];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 hp(r,e,t){var n;let i,s,o;return t?(i=e.changes,s=Et.empty(e.changes.length),o=r.changes.compose(e.changes)):(i=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),o=r.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(n=r.selection)===null||n===void 0?void 0:n.map(i),effects:Ae.mapEffects(r.effects,i).concat(Ae.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Ic(r,e,t){let n=e.selection,i=Qi(e.annotations);return e.userEvent&&(i=i.concat(Tt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Et?e.changes:Et.of(e.changes||[],t,r.facet(ap)),selection:n&&(n instanceof ie?n:ie.single(n.anchor,n.head)),effects:Qi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function dp(r,e,t){let n=Ic(r,e.length?e[0]:{},r.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;n=hp(n,Ic(r,e[s],o?n.changes.newLength:r.doc.length),o)}let i=Tt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return dk(t?hk(i):i)}function hk(r){let e=r.startState,t=!0;for(let i of e.facet(lp)){let s=i(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:fk(t,s))}if(t!==!0){let i,s;if(t===!1)s=r.changes.invertedDesc,i=Et.empty(e.doc.length);else{let o=r.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=Tt.create(e,i,r.selection&&r.selection.map(s),Ae.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let n=e.facet(cp);for(let i=n.length-1;i>=0;i--){let s=n[i](r);s instanceof Tt?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Tt?r=s[0]:r=dp(e,Qi(s),!1)}return r}function dk(r){let e=r.startState,t=e.facet(up),n=r;for(let i=t.length-1;i>=0;i--){let s=t[i](r);s&&Object.keys(s).length&&(n=hp(n,Ic(e,s,r.changes.newLength),!0))}return n==r?r:Tt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const pk=[];function Qi(r){return r==null?pk:Array.isArray(r)?r:[r]}var ot=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(ot||(ot={}));const gk=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Dc;try{Dc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function mk(r){if(Dc)return Dc.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||gk.test(t)))return!0}return!1}function vk(r){return e=>{if(!/\S/.test(e))return ot.Space;if(mk(e))return ot.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return ot.Word;return ot.Other}}class We{constructor(e,t,n,i,s,o){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Gs(this,a<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Gs(this,n),Sa(this,n)}update(...e){return dp(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let o of e.effects)o.is(xa.reconfigure)?(t&&(i=new Map,t.compartments.forEach((a,l)=>i.set(l,a)),t=null),i.set(o.value.compartment,o.value.extension)):o.is(Ae.reconfigure)?(t=null,n=o.value):o.is(Ae.appendConfig)&&(t=null,n=Qi(n).concat(o.value));let s;t?s=e.startState.values.slice():(t=wa.resolve(n,i,this),s=new We(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new We(t,e.newDoc,e.newSelection,s,(o,a)=>a.update(o,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:ie.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],o=Qi(n.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let d=0;d<a;d++)s[d]=s[d].map(u);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(u),o=Ae.mapEffects(o,u).concat(Ae.mapEffects(Qi(l.effects),h))}return{changes:i,selection:ie.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Et?e:Et.of(e,this.doc.length,this.facet(We.lineSeparator))}toText(e){return Qe.of(e.split(this.facet(We.lineSeparator)||Ac))}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:(Gs(this,t),Sa(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof kt&&this.config.address[i.id]!=null&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let o=n[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return We.create({doc:e.doc,selection:ie.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=wa.resolve(e.extensions||[],new Map),n=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(t.staticFacet(We.lineSeparator)||Ac)),i=e.selection?e.selection instanceof ie?e.selection:ie.single(e.selection.anchor,e.selection.head):ie.single(0);return tp(i,n.length),t.staticFacet(op)||(i=i.asSingle()),new We(t,n,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(We.tabSize)}get lineBreak(){return this.facet(We.lineSeparator)||`
|
|
144
|
-
`}get readOnly(){return this.facet(fp)}phrase(e,...t){for(let n of this.facet(We.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(sp))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return vk(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=Ut(t,o,!1);if(s(t.slice(l,o))!=ot.Word)break;o=l}for(;a<i;){let l=Ut(t,a);if(s(t.slice(a,l))!=ot.Word)break;a=l}return o==a?null:ie.range(o+n,a+n)}}We.allowMultipleSelections=op,We.tabSize=de.define({combine:r=>r.length?r[0]:4}),We.lineSeparator=ap,We.readOnly=fp,We.phrases=de.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(i=>r[i]==e[i])}}),We.languageData=sp,We.changeFilter=lp,We.transactionFilter=cp,We.transactionExtender=up,xa.reconfigure=Ae.define();function zr(r,e,t={}){let n={};for(let i of r)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class wi{eq(e){return this==e}range(e,t=e){return Ks.create(e,t,this)}}wi.prototype.startSide=wi.prototype.endSide=0,wi.prototype.point=!1,wi.prototype.mapMode=rr.TrackDel;class Ks{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Ks(e,t,n)}}function Nc(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Rc{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?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,n,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,h=this.to[l]+e,d,p;if(u==h){let m=t.mapPos(u,c.startSide,c.mapMode);if(m==null||(d=p=m,c.startSide!=c.endSide&&(p=t.mapPos(u,c.endSide),p<d)))continue}else if(d=t.mapPos(u,c.startSide),p=t.mapPos(h,c.endSide),d>p||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,p-d)),n.push(c),i.push(d-o),s.push(p-o))}return{mapped:n.length?new Rc(i,s,n,a):null,pos:o}}}class Ge{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Ge(e,t,n,i)}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:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Nc)),this.isEmpty)return t.length?Ge.of(t):this;let a=new gp(this,null,-1).goto(0),l=0,c=[],u=new Un;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];u.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Ks.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Ge.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-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)i=Math.max(i,l.maxPoint),t.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new Ge(n,t,s||Ge.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Ys.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ys.from(e).goto(t)}static compare(e,t,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=pp(o,a,n),c=new Js(o,l,s),u=new Js(a,l,s);n.iterGaps((h,d,p)=>mp(c,h,u,d,p,i)),n.empty&&n.length==0&&mp(c,0,u,0,0,i)}static eq(e,t,n=0,i){i==null&&(i=1e9-1);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=pp(s,o),l=new Js(s,a,0).goto(n),c=new Js(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Bc(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,t,n,i,s=-1){let o=new Js(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:Math.min(u.length,l);i.point(a,c,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>n)return l+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,t=!1){let n=new Un;for(let i of e instanceof Ks?[e]:t?yk(e):e)n.add(i.from,i.to,i.value);return n.finish()}}Ge.empty=new Ge([],[],null,-1);function yk(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Nc(e,n)>0)return r.slice().sort(Nc);e=n}return r}Ge.empty.nextLayer=Ge.empty;class Un{finishChunk(e){this.chunks.push(new Rc(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,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Un)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<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=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.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 n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function pp(r,e,t){let n=new Map;for(let s of r)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&n.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=n.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class gp{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}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,n){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}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],n=e+t.from[this.rangeIndex];if(this.from=n,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}}class Ys{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new gp(o,t,n,s));return i.length==1?i[0]:new Ys(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Lc(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Lc(this.heap,n);(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(),Lc(this.heap,0)}}}function Lc(r,e){for(let t=r[e];;){let n=(e<<1)+1;if(n>=r.length)break;let i=r[n];if(n+1<r.length&&i.compare(r[n+1])>=0&&(i=r[n+1],n++),t.compare(i)<0)break;r[n]=t,r[e]=i,e=n}}class Js{constructor(e,t,n){this.minPoint=n,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=Ys.from(e,t,n)}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){ka(this.active,e),ka(this.activeTo,e),ka(this.activeRank,e),this.minActive=vp(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&this.activeRank[t]<=s;)t++;Aa(this.active,t,n),Aa(this.activeTo,t,i),Aa(this.activeRank,t,s),e&&Aa(e,t,this.cursor.from),this.minActive=vp(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&ka(n,i)}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(n),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(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function mp(r,e,t,n,i,s){r.goto(e),t.goto(n);let o=n+i,a=n,l=n-e;for(;;){let c=r.to+l-t.to||r.endSide-t.endSide,u=c<0?r.to+l:t.to,h=Math.min(u,o);if(r.point||t.point?r.point&&t.point&&(r.point==t.point||r.point.eq(t.point))&&Bc(r.activeForPoint(r.to),t.activeForPoint(t.to))||s.comparePoint(a,h,r.point,t.point):h>a&&!Bc(r.active,t.active)&&s.compareRange(a,h,r.active,t.active),u>o)break;a=u,c<=0&&r.next(),c>=0&&t.next()}}function Bc(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t]&&!r[t].eq(e[t]))return!1;return!0}function ka(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function Aa(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function vp(r,e){let t=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||r[i].endSide-r[t].endSide)<0&&(t=i,n=e[i]);return t}function Xi(r,e,t=r.length){let n=0;for(let i=0;i<t;)r.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Ut(r,i));return n}function Fc(r,e,t,n){for(let i=0,s=0;;){if(s>=e)return i;if(i==r.length)break;s+=r.charCodeAt(i)==9?t-s%t:1,i=Ut(r,i)}return n===!0?-1:r.length}const jc="\u037C",yp=typeof Symbol>"u"?"__"+jc:Symbol.for(jc),Vc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gn{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,u,d)}else m!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
145
|
-
`)}static newName(){let e=bp[yp]||1;return bp[yp]=e+1,jc+e.toString(36)}static mount(e,t,n){let i=e[Vc],s=n&&n.nonce;i?s&&i.setNonce(s):i=new
|
|
146
|
-
`;this.styleTag.textContent=s}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Kn={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:"'"},Qs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xk=typeof navigator<"u"&&/Mac/.test(navigator.platform),wk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Bt=0;Bt<10;Bt++)Kn[48+Bt]=Kn[96+Bt]=String(Bt);for(var Bt=1;Bt<=24;Bt++)Kn[Bt+111]="F"+Bt;for(var Bt=65;Bt<=90;Bt++)Kn[Bt]=String.fromCharCode(Bt+32),Qs[Bt]=String.fromCharCode(Bt);for(var Wc in Kn)Qs.hasOwnProperty(Wc)||(Qs[Wc]=Kn[Wc]);function Sk(r){var e=xk&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||wk&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Qs:Kn)[r.keyCode]||r.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 Ca(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function $c(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function kk(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Oa(r,e){if(!e.anchorNode)return!1;try{return $c(r,e.anchorNode)}catch{return!1}}function Zi(r){return r.nodeType==3?Si(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Ea(r,e,t,n){return t?wp(r,e,t,n,-1)||wp(r,e,t,n,1):!1}function Xs(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function wp(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Cn(r))){if(r.nodeName=="DIV")return!1;let s=r.parentNode;if(!s||s.nodeType!=1)return!1;e=Xs(r)+(i<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(i<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;e=i<0?Cn(r):0}else return!1}}function Cn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ta(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function Ak(r){return{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Ck(r,e,t,n,i,s,o,a){let l=r.ownerDocument,c=l.defaultView||window;for(let u=r,h=!1;u&&!h;)if(u.nodeType==1){let d,p=u==l.body,m=1,y=1;if(p)d=Ak(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let T=u.getBoundingClientRect();m=T.width/u.offsetWidth,y=T.height/u.offsetHeight,d={left:T.left,right:T.left+u.clientWidth*m,top:T.top,bottom:T.top+u.clientHeight*y}}let w=0,A=0;if(i=="nearest")e.top<d.top?(A=-(d.top-e.top+o),t>0&&e.bottom>d.bottom+A&&(A=e.bottom-d.bottom+A+o)):e.bottom>d.bottom&&(A=e.bottom-d.bottom+o,t<0&&e.top-A<d.top&&(A=-(d.top+A-e.top+o)));else{let T=e.bottom-e.top,P=d.bottom-d.top;A=(i=="center"&&T<=P?e.top+T/2-P/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-P+o)-d.top}if(n=="nearest"?e.left<d.left?(w=-(d.left-e.left+s),t>0&&e.right>d.right+w&&(w=e.right-d.right+w+s)):e.right>d.right&&(w=e.right-d.right+s,t<0&&e.left<d.left+w&&(w=-(d.left+w-e.left+s))):w=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-s:e.right-(d.right-d.left)+s)-d.left,w||A)if(p)c.scrollBy(w,A);else{let T=0,P=0;if(A){let L=u.scrollTop;u.scrollTop+=A/y,P=(u.scrollTop-L)*y}if(w){let L=u.scrollLeft;u.scrollLeft+=w/m,T=(u.scrollLeft-L)*m}e={left:e.left-T,top:e.top-P,right:e.right-T,bottom:e.bottom-P},T&&Math.abs(T-w)<1&&(n="nearest"),P&&Math.abs(P-A)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Ok(r){let e=r.ownerDocument;for(let t=r.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}class Ek{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:n}=e;this.set(t,Math.min(e.anchorOffset,t?Cn(t):0),n,Math.min(e.focusOffset,n?Cn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let _i=null;function Sp(r){if(r.setActive)return r.setActive();if(_i)return r.focus(_i);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(_i==null?{get preventScroll(){return _i={preventScroll:!0},!0}}:void 0),!_i){_i=!1;for(let t=0;t<e.length;){let n=e[t++],i=e[t++],s=e[t++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=s&&(n.scrollLeft=s)}}}let kp;function Si(r,e,t=e){let n=kp||(kp=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function qi(r,e,t){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0},i=new KeyboardEvent("keydown",n);i.synthetic=!0,r.dispatchEvent(i);let s=new KeyboardEvent("keyup",n);return s.synthetic=!0,r.dispatchEvent(s),i.defaultPrevented||s.defaultPrevented}function Tk(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Ap(r){for(;r.attributes.length;)r.removeAttributeNode(r.attributes[0])}function Pk(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,Cn(t));;)if(n){if(t.nodeType!=1)return!1;let i=t.childNodes[n-1];i.contentEditable=="false"?n--:(t=i,n=Cn(t))}else{if(t==r)return!0;n=Xs(t),t=t.parentNode}}function Cp(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}class Kt{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Kt(e.parentNode,Xs(e),t)}static after(e,t){return new Kt(e.parentNode,Xs(e)+1,t)}}const Hc=[];class nt{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 n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:n.firstChild)){let a=nt.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=i?i.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&s!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=Op(s);else n.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:n.firstChild,s&&t&&t.node==n&&(t.written=!0);s;)s=Op(s)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=Cn(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!nt.get(n);)n=n.nextSibling;if(!n)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==n)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=n,u=n;l<this.children.length;l++){let h=this.children[l],d=c+h.length;if(c<e&&d>t)return h.domBoundsAround(e,t,c);if(d>=e&&i==-1&&(i=l,s=c),c>t&&h.dom.parentNode==this.dom){o=l,a=u;break}u=d,c=d+h.breakAfter}return{from:s,to:a<0?n+this.length:a,startDOM:(i?this.children[i-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,n=Hc){this.markDirty();for(let i=e;i<t;i++){let s=this.children[i];s.parent==this&&s.destroy()}this.children.splice(e,t-e,...n);for(let i=0;i<n.length;i++)n[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ep(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,n,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){this.parent=null}}nt.prototype.breakAfter=0;function Op(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Ep{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,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 n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Tp(r,e,t,n,i,s,o,a,l){let{children:c}=r,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,d=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!d&&s.length<2&&u.merge(t,i,s.length?h:null,t==0,a,l))){if(n<c.length){let p=c[n];p&&(i<p.length||p.breakAfter&&h?.breakAfter)?(e==n&&(p=p.split(i),i=0),!d&&h&&p.merge(0,i,h,!0,0,l)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,l),s.push(p))):p?.breakAfter&&(h?h.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,a,0)?u.breakAfter=s.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,a,0),e++));e<n&&s.length;)if(c[n-1].become(s[s.length-1]))n--,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&&n<c.length&&!c[e-1].breakAfter&&c[n].merge(0,0,c[e-1],!1,a,l)&&e--,(e<n||s.length)&&r.replaceChildren(e,n,s)}}function Pp(r,e,t,n,i,s){let o=r.childCursor(),{i:a,off:l}=o.findPos(t,1),{i:c,off:u}=o.findPos(e,-1),h=e-t;for(let d of n)h+=d.length;r.length+=h,Tp(r,c,u,a,l,n,0,i,s)}let vr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},zc=typeof document<"u"?document:{documentElement:{style:{}}};const Uc=/Edge\/(\d+)/.exec(vr.userAgent),Mp=/MSIE \d/.test(vr.userAgent),Gc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vr.userAgent),Pa=!!(Mp||Gc||Uc),Ip=!Pa&&/gecko\/(\d+)/i.test(vr.userAgent),Kc=!Pa&&/Chrome\/(\d+)/.exec(vr.userAgent),Dp="webkitFontSmoothing"in zc.documentElement.style,Np=!Pa&&/Apple Computer/.test(vr.vendor),Rp=Np&&(/Mobile\/\w+/.test(vr.userAgent)||vr.maxTouchPoints>2);var ye={mac:Rp||/Mac/.test(vr.platform),windows:/Win/.test(vr.platform),linux:/Linux|X11/.test(vr.platform),ie:Pa,ie_version:Mp?zc.documentMode||6:Gc?+Gc[1]:Uc?+Uc[1]:0,gecko:Ip,gecko_version:Ip?+(/Firefox\/(\d+)/.exec(vr.userAgent)||[0,0])[1]:0,chrome:!!Kc,chrome_version:Kc?+Kc[1]:0,ios:Rp,android:/Android\b/.test(vr.userAgent),webkit:Dp,safari:Np,webkit_version:Dp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:zc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Mk=256;class On extends nt{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,n){return this.flags&8||n&&(!(n instanceof On)||this.length-(t-e)+n.length>Mk||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new On(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 Kt(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Ik(this.dom,e,t)}}class En extends nt{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let i of t)i.setParent(this)}setAttrs(e){if(Ap(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,n,i,s,o){return n&&(!(n instanceof En&&n.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(Pp(this,e,t,n?n.children:[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,i=-1,s=0;for(let a of this.children){let l=n+a.length;l>e&&t.push(n<e?a.split(e-n):a),i<0&&n>=e&&(i=s),n=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new En(this.mark,t,o)}domAtPos(e){return Lp(this,e)}coordsAt(e,t){return Fp(this,e,t)}}function Ik(r,e,t){let n=r.nodeValue.length;e>n&&(e=n);let i=e,s=e,o=0;e==0&&t<0||e==n&&t>=0?ye.chrome||ye.gecko||(e?(i--,o=1):s<n&&(s++,o=-1)):t<0?i--:s<n&&s++;let a=Si(r,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return ye.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Ta(l,o<0):l||null}class Yn extends nt{static create(e,t,n){return new Yn(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Yn.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.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,n,i,s,o){return n&&(!(n instanceof Yn)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Yn&&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 Qe.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):Qe.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Kt.before(this.dom):Kt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top<s.bottom);a+=o?-1:1);return Ta(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)}}class es extends nt{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof es&&e.side==this.side}split(){return new es(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?Kt.before(this.dom):Kt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Qe.empty}get isHidden(){return!0}}On.prototype.children=Yn.prototype.children=es.prototype.children=Hc;function Lp(r,e){let t=r.dom,{children:n}=r,i=0;for(let s=0;i<n.length;i++){let o=n[i],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=i;s>0;s--){let o=n[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=i;s<n.length;s++){let o=n[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Kt(t,0)}function Bp(r,e,t){let n,{children:i}=r;t>0&&e instanceof En&&i.length&&(n=i[i.length-1])instanceof En&&n.mark.eq(e.mark)?Bp(n,e.children[0],t-1):(i.push(e),e.setParent(r)),r.length+=e.length}function Fp(r,e,t){let n=null,i=-1,s=null,o=-1;function a(c,u){for(let h=0,d=0;h<c.children.length&&d<=u;h++){let p=c.children[h],m=d+p.length;m>=u&&(p.children.length?a(p,u-d):(!s||s.isHidden&&t>0)&&(m>u||d==m&&p.getSide()>0)?(s=p,o=u-d):(d<u||d==m&&p.getSide()<0&&!p.isHidden)&&(n=p,i=u-d)),d=m}}a(r,e);let l=(t<0?n:s)||n||s;return l?l.coordsAt(Math.max(0,l==n?i:o),t):Dk(r)}function Dk(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=Zi(e);return t[t.length-1]||null}function Yc(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}const jp=Object.create(null);function Jc(r,e,t){if(r==e)return!0;r||(r=jp),e||(e=jp);let n=Object.keys(r),i=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(i.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function Qc(r,e,t){let n=!1;if(e)for(let i in e)t&&i in t||(n=!0,i=="style"?r.style.cssText="":r.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(n=!0,i=="style"?r.style.cssText=t[i]:r.setAttribute(i,t[i]));return n}function Nk(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}class Pt extends nt{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,s,o){if(n){if(!(n instanceof Pt))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Pp(this,e,t,n?n.children:[],s,o),!0}split(e){let t=new Pt;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let s=n;s<this.children.length;s++)t.append(this.children[s],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,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){Jc(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Bp(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Yc(t,this.attrs||{})),n&&(this.attrs=Yc({class:n},this.attrs||{}))}domAtPos(e){return Lp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Ap(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&&(Qc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&nt.get(i)instanceof En;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=nt.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!ye.ios||!this.children.some(s=>s instanceof On))){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 n of this.children){if(!(n instanceof On)||/[^ -~]/.test(n.text))return null;let i=Zi(n.dom);if(i.length!=1)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=Fp(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=n.bottom-n.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return!1}covers(){return!0}static find(e,t){for(let n=0,i=0;n<e.children.length;n++){let s=e.children[n],o=i+s.length;if(o>=t){if(s instanceof Pt)return s;if(o>t)break}i=o+s.breakAfter}return null}}class Jn extends nt{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,s,o){return n&&(!(n instanceof Jn)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Kt.before(this.dom):Kt.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Jn(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Hc}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.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Qe.empty}domBoundsAround(){return null}become(e){return e instanceof Jn&&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:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class on{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,n){return null}get isHidden(){return!1}destroy(e){}}var nr=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(nr||(nr={}));class we extends wi{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Zs(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Qn(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:s,end:o}=Vp(e,t);n=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Qn(e,n,i,t,e.widget||null,!0)}static line(e){return new _s(e)}static set(e,t=!1){return Ge.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=Ge.empty;class Zs extends we{constructor(e){let{start:t,end:n}=Vp(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof Zs&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Jc(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)}}Zs.prototype.point=!1;class _s extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _s&&this.spec.class==e.spec.class&&Jc(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)}}_s.prototype.mapMode=rr.TrackBefore,_s.prototype.point=!0;class Qn extends we{constructor(e,t,n,i,s,o){super(t,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?rr.TrackBefore:rr.TrackAfter:rr.TrackDel}get type(){return this.startSide!=this.endSide?nr.WidgetRange:this.startSide<=0?nr.WidgetBefore:nr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Qn&&Rk(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)}}Qn.prototype.point=!0;function Vp(r,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=r;return t==null&&(t=r.inclusive),n==null&&(n=r.inclusive),{start:t??e,end:n??e}}function Rk(r,e){return r==e||!!(r&&e&&r.compare(e))}function Xc(r,e,t,n=0){let i=t.length-1;i>=0&&t[i]+n>=r?t[i]=Math.max(t[i],e):t.push(r,e)}class qs{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,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 Jn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Pt),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Ma(new es(-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 Jn)&&this.getLine()}buildText(e,t,n){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 i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Ma(new On(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,s,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Qn){if(n.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(n instanceof Qn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Jn(n.widget||new Wp("div"),a,n));else{let l=Yn.create(n.widget||new Wp("span"),a,a?0:n.startSide),c=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e<t||n.startSide>0),u=!l.isEditable&&(e<t||s>i.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(Ma(new es(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Ma(l,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<t||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);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,n,i,s){let o=new qs(e,t,n,s);return o.openEnd=Ge.spans(i,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Ma(r,e){for(let t of e)r=new En(t,[r],r.length);return r}class Wp extends on{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}}const $p=de.define(),Hp=de.define(),zp=de.define(),Up=de.define(),Zc=de.define(),Gp=de.define(),Kp=de.define(),Yp=de.define({combine:r=>r.some(e=>e)}),Jp=de.define({combine:r=>r.some(e=>e)});class Ia{constructor(e,t="nearest",n="nearest",i=5,s=5){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=s}map(e){return e.empty?this:new Ia(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Qp=Ae.define({map:(r,e)=>r.map(e)});function Nr(r,e,t){let n=r.facet(Up);n.length?n[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const Da=de.define({combine:r=>r.length?r[0]:!0});let Lk=0;const eo=de.define();class ut{constructor(e,t,n,i,s){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:s,decorations:o}=t||{};return new ut(Lk++,e,n,i,a=>{let l=[eo.of(a)];return o&&l.push(to.of(c=>{let u=c.plugin(a);return u?o(u):we.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return ut.define(n=>new e(n),t)}}class _c{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(n){if(Nr(t.state,n,"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){Nr(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(n){Nr(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Xp=de.define(),Na=de.define(),to=de.define(),qc=de.define(),Zp=de.define();function _p(r,e,t){let n=r.state.facet(Zp);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(r):o),s=[];return Ge.spans(i,e,t,{point(){},span(o,a,l,c){let u=s;for(let h=l.length-1;h>=0;h--,c--){let d=l[h].spec.bidiIsolate,p;if(d!=null)if(c>0&&u.length&&(p=u[u.length-1]).to==o&&p.direction==d)p.to=a,u=p.inner;else{let m={from:o,to:a,direction:d,inner:[]};u.push(m),u=m.inner}}}}),s}const qp=de.define();function eg(r){let e=0,t=0,n=0,i=0;for(let s of r.state.facet(qp)){let o=s(r);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:n,bottom:i}}const ro=de.define();class yr{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new yr(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,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,s=0,o=0,a=0;;i++){let l=i==e.length?null:e[i],c=o-a,u=l?l.fromB:1e9;for(;s<t.length&&t[s]<u;){let h=t[s],d=t[s+1],p=Math.max(a,h),m=Math.min(u,d);if(p<=m&&new yr(p+c,m+c,p,m).addToSet(n),d>u)break;s+=2}if(!l)return n;new yr(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,a=l.toB}}}class Ra{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Et.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new yr(s,o,a,l))),this.changedRanges=i}static create(e,t,n){return new Ra(e,t,n)}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}}var ft=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(ft||(ft={}));const no=ft.LTR,tg=ft.RTL;function rg(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const Bk=rg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Fk=rg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),eu=Object.create(null),an=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);eu[e]=t,eu[t]=-e}function jk(r){return r<=247?Bk[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?Fk[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8203?256:64336<=r&&r<=65023?4:r==8204?256:1}const Vk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Xn{get dir(){return this.level%2?tg:no}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}static find(e,t,n,i){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==n)return o;(s<0||(i!=0?i<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 ng(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!ng(n.inner,i.inner))return!1}return!0}const qe=[];function Wk(r,e,t,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t,l=s?256:i;for(let c=o,u=l,h=l;c<a;c++){let d=jk(r.charCodeAt(c));d==512?d=u:d==8&&h==4&&(d=16),qe[c]=d==4?2:d,d&7&&(h=d),u=d}for(let c=o,u=l,h=l;c<a;c++){let d=qe[c];if(d==128)c<a-1&&u==qe[c+1]&&u&24?d=qe[c]=u:qe[c]=256;else if(d==64){let p=c+1;for(;p<a&&qe[p]==64;)p++;let m=c&&u==8||p<t&&qe[p]==8?h==1?1:8:256;for(let y=c;y<p;y++)qe[y]=m;c=p-1}else d==8&&h==1&&(qe[c]=1);u=d,d&7&&(h=d)}}}function $k(r,e,t,n,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let h=c,d,p,m;h<u;h++)if(p=eu[d=r.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(an[y+1]==-p){let w=an[y+2],A=w&2?i:w&4?w&1?s:i:0;A&&(qe[h]=qe[an[y]]=A),a=y;break}}else{if(an.length==189)break;an[a++]=h,an[a++]=d,an[a++]=l}else if((m=qe[h])==2||m==1){let y=m==i;l=y?0:1;for(let w=a-3;w>=0;w-=3){let A=an[w+2];if(A&2)break;if(y)an[w+2]|=2;else{if(A&4)break;an[w+2]|=4}}}}}function Hk(r,e,t,n){for(let i=0,s=n;i<=t.length;i++){let o=i?t[i-1].to:r,a=i<t.length?t[i].from:e;for(let l=o;l<a;){let c=qe[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==t.length)break;u=t[i++].to,a=i<t.length?t[i].from:e}else if(qe[u]==256)u++;else break;let h=s==1,d=(u<e?qe[u]:n)==1,p=h==d?h?1:2:n;for(let m=u,y=i,w=y?t[y-1].to:r;m>l;)m==w&&(m=t[--y].from,w=y?t[y-1].to:r),qe[--m]=p;l=u}else s=c,l++}}}function tu(r,e,t,n,i,s,o){let a=n%2?2:1;if(n%2==i%2)for(let l=e,c=0;l<t;){let u=!0,h=!1;if(c==s.length||l<s[c].from){let y=qe[l];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let y=s[c];if(!u)for(let w=y.to,A=c+1;;){if(w==t)break e;if(A<s.length&&s[A].from==w)w=s[A++].to;else{if(qe[w]==a)break e;break}}if(c++,d)d.push(y);else{y.from>l&&o.push(new Xn(l,y.from,p));let w=y.direction==no!=!(p%2);ru(r,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.to}m=y.to}else{if(m==t||(u?qe[m]!=a:qe[m]==a))break;m++}d?tu(r,l,m,n+1,i,d,o):l<m&&o.push(new Xn(l,m,p)),l=m}else for(let l=t,c=s.length;l>e;){let u=!0,h=!1;if(!c||l>s[c-1].to){let y=qe[l-1];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let y=s[--c];if(!u)for(let w=y.from,A=c;;){if(w==e)break e;if(A&&s[A-1].to==w)w=s[--A].from;else{if(qe[w-1]==a)break e;break}}if(d)d.push(y);else{y.to<l&&o.push(new Xn(y.to,l,p));let w=y.direction==no!=!(p%2);ru(r,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.from}m=y.from}else{if(m==e||(u?qe[m-1]!=a:qe[m-1]==a))break;m--}d?tu(r,m,l,n+1,i,d,o):m<l&&o.push(new Xn(m,l,p)),l=m}}function ru(r,e,t,n,i,s,o){let a=e%2?2:1;Wk(r,i,s,n,a),$k(r,i,s,n,a),Hk(i,s,n,a),tu(r,i,s,e,t,n,o)}function ig(r,e,t){if(!r)return[new Xn(0,0,e==tg?1:0)];if(e==no&&!t.length&&!Vk.test(r))return sg(r.length);if(t.length)for(;r.length>qe.length;)qe[qe.length]=256;let n=[],i=e==no?0:1;return ru(r,i,i,t,0,r.length,n),n}function sg(r){return[new Xn(0,r,0)]}let og="";function ag(r,e,t,n,i){var s;let o=n.head-r.from,a=-1;if(o==0){if(!i||!r.length)return null;e[0].level!=t&&(o=e[0].side(!1,t),a=0)}else if(o==r.length){if(i)return null;let d=e[e.length-1];d.level!=t&&(o=d.side(!0,t),a=e.length-1)}a<0&&(a=Xn.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc));let l=e[a];o==l.side(i,t)&&(l=e[a+=i?1:-1],o=l.side(!i,t));let c=i==(l.dir==t),u=Ut(r.text,o,c);if(og=r.text.slice(Math.min(o,u),Math.max(o,u)),u!=l.side(i,t))return ie.cursor(u+r.from,c?-1:1,l.level);let h=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return!h&&l.level!=t?ie.cursor(i?r.to:r.from,i?-1:1,t):h&&h.level<l.level?ie.cursor(h.side(!i,t)+r.from,i?1:-1,h.level):ie.cursor(u+r.from,i?-1:1,l.level)}class lg extends nt{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,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 Pt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new yr(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<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);let i=-1;this.view.inputState.composing>=0&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!Qk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Uk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new yr(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ye.ie||ye.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Yk(o,a,e.changes);return n=yr.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ye.chrome||ye.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.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 Jn&&o.widget instanceof cg&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,t,n){let i=n?n.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=i.length-1;;o--){let a=o>=0?i[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:h}=a,d,p,m,y;if(n&&n.range.fromB<h&&n.range.toB>u){let L=qs.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),D=qs.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);p=L.breakAtStart,m=L.openStart,y=D.openEnd;let j=this.compositionView(n);D.breakAtStart?j.breakAfter=1:D.content.length&&j.merge(j.length,j.length,D.content[0],!1,D.openStart,0)&&(j.breakAfter=D.content[0].breakAfter,D.content.shift()),L.content.length&&j.merge(0,0,L.content[L.content.length-1],!0,0,L.openEnd)&&L.content.pop(),d=L.content.concat(j).concat(D.content)}else({content:d,breakAtStart:p,openStart:m,openEnd:y}=qs.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:w,off:A}=s.findPos(c,1),{i:T,off:P}=s.findPos(l,-1);Tp(this,T,P,w,A,d,p,m,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new On(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new En(i,[t],t.length);let n=new Pt;return n.append(t,0),n}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=nt.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&Oa(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||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(ye.gecko&&a.empty&&!this.hasComposition&&zk(l)){let h=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(h,l.node.childNodes[l.offset]||null)),l=c=new Kt(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||!Ea(l.node,l.offset,u.anchorNode,u.anchorOffset)||!Ea(c.node,c.offset,u.focusNode,u.focusOffset))&&(this.view.observer.ignore(()=>{ye.android&&ye.chrome&&this.dom.contains(u.focusNode)&&Jk(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Ca(this.view.root);if(h)if(a.empty){if(ye.gecko){let d=Gk(l.node,l.offset);if(d&&d!=3){let p=fg(l.node,l.offset,d==1?1:-1);p&&(l=new Kt(p.node,p.offset))}}h.collapse(l.node,l.offset),a.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=a.bidiLevel)}else if(h.extend){h.collapse(l.node,l.offset);try{h.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),d.setEnd(c.node,c.offset),d.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Kt(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Kt(u.focusNode,u.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ca(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Pt.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 u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,s)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let i=e.offset;!n&&i<t.childNodes.length;i++){let s=nt.get(t.childNodes[i]);s instanceof Pt&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=nt.get(t.childNodes[i]);s instanceof Pt&&(n=s.domAtPos(s.length))}return n?new Kt(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=nt.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let i=this.children[t];if(n<i.length||i instanceof Pt)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,i=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;c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!n||a instanceof Pt&&!(n instanceof Pt&&t>=0))&&(n=a,i=c),s=c}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof Pt))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(n,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}n=l}if(!(i instanceof On))return null;let s=Ut(i.text,n);if(s==n)return null;let o=Si(i.dom,n,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:n,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ft.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],d=c+h.length;if(d>i)break;if(c>=n){let p=h.dom.getBoundingClientRect();if(t.push(p.height),o){let m=h.dom.lastChild,y=m?Zi(m):[];if(y.length){let w=y[y.length-1],A=l?w.right-p.left:p.right-w.left;A>a&&(a=A,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ft.RTL:ft.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Pt){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,i;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=Zi(e.firstChild)[0];t=e.getBoundingClientRect().height,n=s?s.width/27:7,i=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ep(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.length;if(o>n){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(we.replace({widget:new cg(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return we.set(e)}updateDeco(){let e=this.view.state.facet(to).map((t,n)=>(this.dynamicDecorationMap[n]=typeof t=="function")?t(this.view):t);for(let t=e.length;t<e.length+3;t++)this.dynamicDecorationMap[t]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!n)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let s=eg(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom};Ck(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==ft.LTR)}}function zk(r){return r.node.nodeType==1&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}class cg extends on{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function ug(r,e){let t=r.observer.selectionRange,n=t.focusNode&&fg(t.focusNode,t.focusOffset,0);if(!n)return null;let i=e-n.offset;return{from:i,to:i+n.node.nodeValue.length,node:n.node}}function Uk(r,e,t){let n=ug(r,t);if(!n)return null;let{node:i,from:s,to:o}=n,a=i.nodeValue;if(/[\n\r]/.test(a)||r.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,c=new yr(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let d=nt.get(h);if(d instanceof En)u.push({node:h,deco:d.mark});else{if(d instanceof Pt||h.nodeName=="DIV"&&h.parentNode==r.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=r.contentDOM)u.push({node:h,deco:new Zs({inclusive:!0,attributes:Nk(h),tagName:h.tagName.toLowerCase()})});else return null}}}function fg(r,e,t){if(t<=0)for(let n=r,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i>0)n=n.childNodes[i-1],i=Cn(n);else break}if(t>=0)for(let n=r,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length&&t>=0)n=n.childNodes[i],i=0;else break}return null}function Gk(r,e){return r.nodeType!=1?0:(e&&r.childNodes[e-1].contentEditable=="false"?1:0)|(e<r.childNodes.length&&r.childNodes[e].contentEditable=="false"?2:0)}let Kk=class{constructor(){this.changes=[]}compareRange(e,t){Xc(e,t,this.changes)}comparePoint(e,t){Xc(e,t,this.changes)}};function Yk(r,e,t){let n=new Kk;return Ge.compare(r,e,t,n),n.changes}function Jk(r,e){for(let t=r;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Qk(r,e){let t=!1;return e&&r.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(t=!0)}),t}function Xk(r,e,t=1){let n=r.charCategorizer(e),i=r.doc.lineAt(e),s=e-i.from;if(i.length==0)return ie.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Ut(i.text,s,!1):a=Ut(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let c=Ut(i.text,o,!1);if(n(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Ut(i.text,a);if(n(i.text.slice(a,c))!=l)break;a=c}return ie.range(o+i.from,a+i.from)}function Zk(r,e){return e.left>r?e.left-r:Math.max(0,r-e.right)}function _k(r,e){return e.top>r?e.top-r:Math.max(0,r-e.bottom)}function nu(r,e){return r.top<e.bottom-1&&r.bottom>e.top+1}function hg(r,e){return e<r.top?{top:e,left:r.left,right:r.right,bottom:r.bottom}:r}function dg(r,e){return e>r.bottom?{top:r.top,left:r.left,right:r.right,bottom:e}:r}function iu(r,e,t){let n,i,s,o,a=!1,l,c,u,h;for(let m=r.firstChild;m;m=m.nextSibling){let y=Zi(m);for(let w=0;w<y.length;w++){let A=y[w];i&&nu(i,A)&&(A=hg(dg(A,i.bottom),i.top));let T=Zk(e,A),P=_k(t,A);if(T==0&&P==0)return m.nodeType==3?pg(m,e,t):iu(m,e,t);if(!n||o>P||o==P&&s>T){n=m,i=A,s=T,o=P;let L=P?t<A.top?-1:1:T?e<A.left?-1:1:0;a=!L||(L>0?w<y.length-1:w>0)}T==0?t>A.bottom&&(!u||u.bottom<A.bottom)?(l=m,u=A):t<A.top&&(!h||h.top>A.top)&&(c=m,h=A):u&&nu(u,A)?u=dg(u,A.bottom):h&&nu(h,A)&&(h=hg(h,A.top))}}if(u&&u.bottom>=t?(n=l,i=u):h&&h.top<=t&&(n=c,i=h),!n)return{node:r,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(n.nodeType==3)return pg(n,d,t);if(a&&n.contentEditable!="false")return iu(n,d,t);let p=Array.prototype.indexOf.call(r.childNodes,n)+(e>=(i.left+i.right)/2?1:0);return{node:r,offset:p}}function pg(r,e,t){let n=r.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;a<n;a++){let l=Si(r,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let d=e>=(u.left+u.right)/2,p=d;if((ye.chrome||ye.gecko)&&Si(r,a).getBoundingClientRect().left==u.right&&(p=!d),h<=0)return{node:r,offset:a+(p?1:0)};i=a+(p?1:0),s=h}}}return{node:r,offset:i>-1?i:o>0?r.nodeValue.length:0}}function gg(r,e,t,n=-1){var i,s;let o=r.contentDOM.getBoundingClientRect(),a=o.top+r.viewState.paddingTop,l,{docHeight:c}=r.viewState,{x:u,y:h}=e,d=h-a;if(d<0)return 0;if(d>c)return r.state.doc.length;for(let L=r.viewState.heightOracle.textHeight/2,D=!1;l=r.elementAtHeight(d),l.type!=nr.Text;)for(;d=n>0?l.bottom+L:l.top-L,!(d>=0&&d<=c);){if(D)return t?null:0;D=!0,n=-n}h=a+d;let p=l.from;if(p<r.viewport.from)return r.viewport.from==0?0:t?null:mg(r,o,l,u,h);if(p>r.viewport.to)return r.viewport.to==r.state.doc.length?r.state.doc.length:t?null:mg(r,o,l,u,h);let m=r.dom.ownerDocument,y=r.root.elementFromPoint?r.root:m,w=y.elementFromPoint(u,h);w&&!r.contentDOM.contains(w)&&(w=null),w||(u=Math.max(o.left+1,Math.min(o.right-1,u)),w=y.elementFromPoint(u,h),w&&!r.contentDOM.contains(w)&&(w=null));let A,T=-1;if(w&&((i=r.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(m.caretPositionFromPoint){let L=m.caretPositionFromPoint(u,h);L&&({offsetNode:A,offset:T}=L)}else if(m.caretRangeFromPoint){let L=m.caretRangeFromPoint(u,h);L&&({startContainer:A,startOffset:T}=L,(!r.contentDOM.contains(A)||ye.safari&&qk(A,T,u)||ye.chrome&&eA(A,T,u))&&(A=void 0))}}if(!A||!r.docView.dom.contains(A)){let L=Pt.find(r.docView,p);if(!L)return d>l.top+l.height/2?l.to:l.from;({node:A,offset:T}=iu(L.dom,u,h))}let P=r.docView.nearest(A);if(!P)return null;if(P.isWidget&&((s=P.dom)===null||s===void 0?void 0:s.nodeType)==1){let L=P.dom.getBoundingClientRect();return e.y<L.top||e.y<=L.bottom&&e.x<=(L.left+L.right)/2?P.posAtStart:P.posAtEnd}else return P.localPosFromDOM(A,T)+P.posAtStart}function mg(r,e,t,n,i){let s=Math.round((n-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let a=r.viewState.heightOracle.textHeight,l=Math.floor((i-t.top-(r.defaultLineHeight-a)*.5)/a);s+=l*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(t.from,t.to);return t.from+Fc(o,s,r.state.tabSize)}function qk(r,e,t){let n;if(r.nodeType!=3||e!=(n=r.nodeValue.length))return!1;for(let i=r.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Si(r,n-1,n).getBoundingClientRect().left>t}function eA(r,e,t){if(e!=0)return!1;for(let i=r;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let n=r.nodeType==1?r.getBoundingClientRect():Si(r,0,Math.max(r.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function su(r,e){let t=r.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==nr.Text))return n}return t}function tA(r,e,t,n){let i=su(r,e.head),s=!n||i.type!=nr.Text||!(r.lineWrapping||i.widgetLineBreaks)?null:r.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=r.dom.getBoundingClientRect(),a=r.textDirectionAt(i.from),l=r.posAtCoords({x:t==(a==ft.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return ie.cursor(l,t?-1:1)}return ie.cursor(t?i.to:i.from,t?-1:1)}function vg(r,e,t,n){let i=r.state.doc.lineAt(e.head),s=r.bidiSpans(i),o=r.textDirectionAt(i.from);for(let a=e,l=null;;){let c=ag(i,s,o,a,t),u=og;if(!c){if(i.number==(t?r.state.doc.lines:1))return a;u=`
|
|
147
|
-
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),c=ie.cursor(t?i.from:i.to)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function rA(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==ot.Space&&(i=o),i==o}}function nA(r,e,t,n){let i=e.head,s=t?1:-1;if(i==(t?r.state.doc.length:0))return ie.cursor(i,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(i,e.assoc||-1),u=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=r.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let h=l.left+o,d=n??r.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(d+p)*s,y=gg(r,{x:h,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?y<i:y>i)){let w=r.docView.coordsForChar(y),A=!w||m<w.top?-1:1;return ie.cursor(y,A,void 0,o)}}}function La(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||t||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function ou(r,e,t){let n=La(r.state.facet(qc).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:ie.cursor(n,n<t.from?1:-1)}class iA{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.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=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.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ye.safari&&e.contentDOM.addEventListener("input",()=>null),ye.gecko&&xA(e.contentDOM.ownerDocument)}handleEvent(e){!hA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=sA(e),n=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=n[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(e.keyCode!=27&&xg.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),ye.android&&ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=bg.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||oA.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(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,qi(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ye.safari&&!ye.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.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function yg(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(i){Nr(t.state,i)}}}function sA(r){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of r){let i=n.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&t(s).handlers.push(yg(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&t(s).observers.push(yg(n.value,o))}}for(let n in ln)t(n).handlers.push(ln[n]);for(let n in Ur)t(n).observers.push(Ur[n]);return e}const bg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],oA="dthko",xg=[16,17,18,20,91,92,224,225],Ba=6;function Fa(r){return Math.max(0,r)*.7+8}function aA(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class lA{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=Ok(e.contentDOM),this.atoms=e.state.facet(qc).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(We.allowMultipleSelections)&&cA(e,t),this.dragging=fA(e,t)&&Mg(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&&aA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=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=eg(this.view);e.clientX-o.left<=s.left+Ba?n=-Fa(s.left-e.clientX):e.clientX+o.right>=s.right-Ba&&(n=Fa(e.clientX-s.right)),e.clientY-o.top<=s.top+Ba?i=-Fa(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Ba&&(i=Fa(e.clientY-s.bottom)),this.setScrollSpeed(n,i)}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=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 n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=La(this.atoms,i.from,0);o!=i.from&&(s=ie.cursor(o,-1))}else{let o=La(this.atoms,i.from,-1),a=La(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=ie.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?ie.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection)||n.main.assoc!=t.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function cA(r,e){let t=r.state.facet($p);return t.length?t[0](e):ye.mac?e.metaKey:e.ctrlKey}function uA(r,e){let t=r.state.facet(Hp);return t.length?t[0](e):ye.mac?!e.altKey:!e.ctrlKey}function fA(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=Ca(r.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function hA(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=r.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=nt.get(t))&&n.ignoreEvent(e))return!1;return!0}const ln=Object.create(null),Ur=Object.create(null),wg=ye.ie&&ye.ie_version<15||ye.ios&&ye.webkit_version<604;function dA(r){let e=r.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{r.focus(),t.remove(),Sg(r,t.value)},50)}function Sg(r,e){let{state:t}=r,n,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(au!=null&&t.selection.ranges.every(l=>l.empty)&&au==s.toString()){let l=-1;n=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:ie.cursor(c.from+h.length)}})}else o?n=t.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:ie.cursor(l.from+c.length)}}):n=t.replaceSelection(s);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ur.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft},ln.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&(r.inputState.lastEscPress=Date.now()),!1),Ur.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")},Ur.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")},ln.mousedown=(r,e)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of r.state.facet(zp))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=mA(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new lA(r,e,t,n)),n&&r.observer.ignore(()=>Sp(r.contentDOM));let i=r.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function kg(r,e,t,n){if(n==1)return ie.cursor(e,t);if(n==2)return Xk(r.state,e,t);{let i=Pt.find(r.docView,e),s=r.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<r.state.doc.length&&a==s.to&&a++,ie.range(o,a)}}let Ag=(r,e)=>r>=e.top&&r<=e.bottom,Cg=(r,e,t)=>Ag(e,t)&&r>=t.left&&r<=t.right;function pA(r,e,t,n){let i=Pt.find(r.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&Cg(t,n,o))return-1;let a=i.coordsAt(s,1);return a&&Cg(t,n,a)?1:o&&Ag(n,o)?-1:1}function Og(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:pA(r,t,e.clientX,e.clientY)}}const gA=ye.ie&&ye.ie_version<=11;let Eg=null,Tg=0,Pg=0;function Mg(r){if(!gA)return r.detail;let e=Eg,t=Pg;return Eg=r,Pg=Date.now(),Tg=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(Tg+1)%3:1}function mA(r,e){let t=Og(r,e),n=Mg(e),i=r.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let l=Og(r,s),c,u=kg(r,l.pos,l.bias,n);if(t.pos!=l.pos&&!o){let h=kg(r,t.pos,t.bias,n),d=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=d<u.from?ie.range(d,p):ie.range(p,d)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&n==1&&i.ranges.length>1&&(c=vA(i,l.pos))?c:a?i.addRange(u):ie.create([u])}}}function vA(r,e){for(let t=0;t<r.ranges.length;t++){let{from:n,to:i}=r.ranges[t];if(n<=e&&i>=e)return ie.create(r.ranges.slice(0,t).concat(r.ranges.slice(t+1)),r.mainIndex==t?0:r.mainIndex-(r.mainIndex>t?1:0))}return null}ln.dragstart=(r,e)=>{let{selection:{main:t}}=r.state,{mouseSelection:n}=r.inputState;return n&&(n.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",r.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};function Ig(r,e,t,n){if(!t)return;let i=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{mouseSelection:s}=r.inputState,o=n&&s&&s.dragging&&uA(r,e)?{from:s.dragging.from,to:s.dragging.to}:null,a={from:i,insert:t},l=r.state.changes(o?[o,a]:a);r.focus(),r.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"})}ln.drop=(r,e)=>{if(!e.dataTransfer)return!1;if(r.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),i=0,s=()=>{++i==t.length&&Ig(r,e,n.filter(o=>o!=null).join(r.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)||(n[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ig(r,e,n,!0),!0}return!1},ln.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=wg?null:e.clipboardData;return t?(Sg(r,t.getData("text/plain")||t.getData("text/uri-text")),!0):(dA(r),!1)};function yA(r,e){let t=r.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function bA(r){let e=[],t=[],n=!1;for(let i of r.selection.ranges)i.empty||(e.push(r.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of r.selection.ranges){let o=r.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),i=o.number}n=!0}return{text:e.join(r.lineBreak),ranges:t,linewise:n}}let au=null;ln.copy=ln.cut=(r,e)=>{let{text:t,ranges:n,linewise:i}=bA(r.state);if(!t&&!i)return!1;au=i?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=wg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(yA(r,t),!1)};const Dg=sn.define();function Ng(r,e){let t=[];for(let n of r.facet(Kp)){let i=n(r,e);i&&t.push(i)}return t?r.update({effects:t,annotations:Dg.of(!0)}):null}function Rg(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=Ng(r.state,e);t?r.dispatch(t):r.update([])}},10)}Ur.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),Rg(r)},Ur.blur=r=>{r.observer.clearSelectionRange(),Rg(r)},Ur.compositionstart=Ur.compositionupdate=r=>{r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0)},Ur.compositionend=r=>{r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,ye.chrome&&ye.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50)},Ur.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()},ln.beforeinput=(r,e)=>{var t;let n;if(ye.chrome&&ye.android&&(n=bg.find(i=>i.inputType==e.inputType))&&(r.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let i=((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)>i+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return!1};const Lg=new Set;function xA(r){Lg.has(r)||(Lg.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const Bg=["pre-wrap","normal","pre-line","break-spaces"];class Fg{constructor(e){this.lineWrapping=e,this.doc=Qe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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 Bg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,n,i,s,o){let a=Bg.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class jg{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class cn{constructor(e,t,n,i,s){this.from=e,this.length=t,this.top=n,this.height=i,this._content=s}get type(){return typeof this._content=="number"?nr.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 Qn?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 cn(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var tt=function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r}(tt||(tt={}));const ja=.001;class Yt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}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)>ja&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return Yt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let s=this,o=n.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=i[a],d=s.lineAt(l,tt.ByPosNoHeight,n.setDoc(t),0,0),p=d.to>=c?d:s.lineAt(c,tt.ByPosNoHeight,n,0,0);for(h+=p.to-c,c=p.to;a>0&&d.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,tt.ByPosNoHeight,n,0,0));u+=d.from-l,l=d.from;let m=lu.build(n.setDoc(o),e,u,h);s=s.replace(l,c,m)}return s.updateHeight(n,0)}static empty(){return new br(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,s=0;for(;;)if(t==n)if(i>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),n+=1+a.break,i-=a.size}else if(s>i*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--n];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new wA(Yt.of(e.slice(0,t)),o,Yt.of(e.slice(n)))}}Yt.prototype.size=1;class Vg extends Yt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new cn(i,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,i,s){return this.blockAt(0,n,i,s)}forEachLine(e,t,n,i,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,n,i,s))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class br extends Vg{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new cn(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return n.length==1&&(i instanceof br||i instanceof Ft&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ft?i=new br(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Yt.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(e,i.heights[i.index++]):(n||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:""})`}}class Ft extends Yt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-n+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:n,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,n,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=t.doc.lineAt(c),h=a+u.length*l,d=Math.max(n,e-h/2);return new cn(u.from,u.length,d,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-n)/a))),{from:u,length:h}=t.doc.line(s+c);return new cn(u,h,n+a*c,a,0)}}lineAt(e,t,n,i,s){if(t==tt.ByHeight)return this.blockAt(e,n,i,s);if(t==tt.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(e);return new cn(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s),c=n.doc.lineAt(e),u=a+c.length*l,h=c.number-o,d=i+a*h+l*(c.from-s-h);return new cn(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,t,n,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);for(let u=e,h=i;u<=t;){let d=n.doc.lineAt(u);if(u==e){let m=d.number-a;h+=l*m+c*(e-s-m)}let p=l+c*d.length;o(new cn(d.from,d.length,h,p,0)),h+=p,u=d.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let s=n[n.length-1];s instanceof Ft?n[n.length-1]=new Ft(s.length+i):n.push(null,new Ft(i-1))}if(e>0){let s=n[0];s instanceof Ft?n[0]=new Ft(e+s.length):n.unshift(new Ft(e-1),null)}return Yt.of(n)}decomposeLeft(e,t){t.push(new Ft(e-1),null)}decomposeRight(e,t){t.push(null,new Ft(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),l=-1;for(i.from>t&&o.push(new Ft(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++];l==-1?l=h:Math.abs(h-l)>=ja&&(l=-2);let d=new br(u,h);d.outdated=!1,o.push(d),a+=u+1}a<=s&&o.push(null,new Ft(s-a).updateHeight(e,a));let c=Yt.of(o);return(l<0||Math.abs(c.height-this.height)>=ja||Math.abs(l-this.heightMetrics(e,t).perLine)>=ja)&&(e.heightChanged=!0),c}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class wA extends Yt{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let s=n+this.left.height;return e<s?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,n,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=t==tt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,n,i,s):this.right.lineAt(e,t,n,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=t==tt.ByPosNoHeight?tt.ByPosNoHeight:tt.ByPos;return l?c.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,i,s).join(c)}forEachLine(e,t,n,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,s,o),t>=l&&this.right.forEachLine(e,t,n,a,l,o);else{let c=this.lineAt(l,tt.ByPos,n,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,n,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,a,l,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of n)s.push(a);if(e>0&&Wg(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Wg(s,a)}return Yt.of(s)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Yt.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,n=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return i&&i.from<=t+s.length&&i.more?l=s=s.updateHeight(e,t,n,i):s.updateHeight(e,t,n),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,n,i):o.updateHeight(e,a,n),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 Wg(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof Ft&&(n=r[e+1])instanceof Ft&&r.splice(e-1,3,new Ft(t.length+1+n.length))}const SA=5;class lu{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 n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof br?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new br(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,s=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Vg(o,i,n)):(o||s||i>=SA)&&this.addLineDeco(i,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 br(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Ft(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof br)return e;let t=new br(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,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof br)&&!this.isCovered?this.nodes.push(new br(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof br&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,t,n,i){let s=new lu(n,e);return Ge.spans(t,n,i,s,0),s.finish(n)}}function kA(r,e,t){let n=new AA;return Ge.compare(r,e,t,n,0),n.changes}class AA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&Xc(e,t,this.changes,5)}}function CA(r,e){let t=r.getBoundingClientRect(),n=r.ownerDocument,i=n.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(i.innerHeight,t.bottom);for(let c=r.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=c==r.parentNode?d.bottom:Math.min(l,d.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.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 OA(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class cu{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],s=t[n];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new EA(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class EA extends on{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}}class $g{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=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Hg,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ft.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Na).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Fg(t),this.stateDeco=e.facet(to).filter(n=>typeof n!="function"),this.heightMap=Yt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle.setDoc(e.doc),[new yr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Va(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?Hg:new MA(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:io(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(to).filter(u=>typeof u!="function");let i=e.changedRanges,s=yr.extendWithRanges(i,kA(n,this.stateDeco,e?e.changes:Et.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=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&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(Jp)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ft.RTL:ft.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,u=0;if(a.width&&a.height){let L=a.width/t.offsetWidth,D=a.height/t.offsetHeight;(L>.995&&L<1.005||!isFinite(L)||Math.abs(a.width-t.offsetWidth)<1)&&(L=1),(D>.995&&D<1.005||!isFinite(D)||Math.abs(a.height-t.offsetHeight)<1)&&(D=1),(this.scaleX!=L||this.scaleY!=D)&&(this.scaleX=L,this.scaleY=D,c|=8,o=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Cp(e.scrollDOM);let m=(this.printing?OA:CA)(t,this.paddingTop),y=m.top-this.pixelViewport.top,w=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let L=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(L)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:D,charWidth:j,textHeight:W}=e.docView.measureTextSize();o=D>0&&i.refresh(s,D,j,W,T/j,L),o&&(e.docView.minWidth=0,c|=8)}y>0&&w>0?u=Math.max(y,w):y<0&&w<0&&(u=Math.min(y,w)),i.heightChanged=!1;for(let D of this.viewports){let j=D.from==this.viewport.from?L:e.docView.measureVisibleLineHeights(D);this.heightMap=(o?Yt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle,[new yr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new jg(D.from,j))}i.heightChanged&&(c|=2)}let P=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return P&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||P)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&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 n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Va(i.lineAt(o-n*1e3,tt.ByHeight,s,0,0).from,i.lineAt(a+(1-n)*1e3,tt.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,tt.ByPos,s,0,0),d;t.y=="center"?d=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<l.from?d=h.top:d=h.bottom-u,l=new Va(i.lineAt(d-1e3/2,tt.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,tt.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Va(this.heightMap.lineAt(n,tt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,tt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(n,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new cu(t.mapPos(i.from),t.mapPos(i.to),i.size));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=ft.LTR&&!n)return[];let a=[],l=(c,u,h,d)=>{if(u-c<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let w of m)if(w>c&&w<u){l(c,w-10,h,d),l(w+10,u,h,d);return}let y=PA(e,w=>w.from>=h.from&&w.to<=h.to&&Math.abs(w.from-c)<s&&Math.abs(w.to-u)<s&&!m.some(A=>w.from<A&&w.to>A));if(!y){if(u<h.to&&t&&n&&t.visibleRanges.some(w=>w.from<=u&&w.to>=u)){let w=t.moveToLineBoundary(ie.cursor(u),!1,!0).head;w>c&&(u=w)}y=new cu(c,u,this.gapSize(h,c,u,d))}a.push(y)};for(let c of this.viewportLines){if(c.length<o)continue;let u=TA(c.from,c.to,this.stateDeco);if(u.total<o)continue;let h=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,w;if(h!=null){let A=$a(u,h),T=((this.visibleBottom-this.visibleTop)/2+m)/c.height;y=A-T,w=A+T}else y=(this.visibleTop-c.top-m)/c.height,w=(this.visibleBottom-c.top+m)/c.height;d=Wa(u,y),p=Wa(u,w)}else{let m=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,w,A;if(h!=null){let T=$a(u,h),P=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/m;w=T-P,A=T+P}else w=(this.pixelViewport.left-y)/m,A=(this.pixelViewport.right+y)/m;d=Wa(u,w),p=Wa(u,A)}d>c.from&&l(c.from,d,c,u),p<c.to&&l(p,c.to,c,u)}return a}gapSize(e,t,n,i){let s=$a(i,n)-$a(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){cu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.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=[];Ge.spans(e,this.viewport.from,this.viewport.to,{span(i,s){t.push({from:i,to:s})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=t[s].from||i.to!=t[s].to);return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||io(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return io(this.heightMap.lineAt(this.scaler.fromDOM(e),tt.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 io(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}}class Va{constructor(e,t){this.from=e,this.to=t}}function TA(r,e,t){let n=[],i=r,s=0;return Ge.spans(t,r,e,{span(){},point(o,a){o>i&&(n.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(n.push({from:i,to:e}),s+=e-i),{total:s,ranges:n}}function Wa({total:r,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(r*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(n<=a)return s+n;n-=a}}function $a(r,e){let t=0;for(let{from:n,to:i}of r.ranges){if(e<=i){t+=e-n;break}t+=i-n}return t/r.total}function PA(r,e){for(let t of r)if(e(t))return t}const Hg={toDOM(r){return r},fromDOM(r){return r},scale:1};class MA{constructor(e,t,n){let i=0,s=0,o=0;this.viewports=n.map(({from:a,to:l})=>{let c=t.lineAt(a,tt.ByPos,e,0,0).top,u=t.lineAt(l,tt.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);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,n=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-n)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);n=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return n+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);n=s.bottom,i=s.domBottom}}}function io(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new cn(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(i=>io(i,e)):r._content)}const Ha=de.define({combine:r=>r.join(" ")}),uu=de.define({combine:r=>r.indexOf(!0)>-1}),fu=Gn.newName(),zg=Gn.newName(),Ug=Gn.newName(),Gg={"&light":"."+zg,"&dark":"."+Ug};function hu(r,e,t){return new Gn(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return r;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):r+" "+n}})}const IA=hu("."+fu,{"&":{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"},"&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"}},Gg),so="\uFFFF";class DA{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(We.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=so}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let a=nt.get(i),l=nt.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Kg(i))||Kg(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(n,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);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=nt.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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 n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(NA(e,n.node,n.offset)?t:0))}}function NA(r,e,t){for(;;){if(!e||t<Cn(e))return!1;if(e==r)return!0;t=Xs(e)+1,e=e.parentNode}}function Kg(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}class Yg{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class RA{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="";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,n,0))){let a=s||o?[]:FA(e),l=new DA(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=jA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!$c(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||!$c(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=ie.single(c,l)}}}function Jg(r,e){let t,{newSel:n}=e,i=r.state.selection.main,s=r.inputState.lastKeyTime>Date.now()-100?r.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||ye.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=BA(r.state.doc.sliceString(o,a,so),e.text,l-o,c);u&&(ye.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==so+so&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Qe.of(e.text.slice(u.from,u.toB).split(so))})}else n&&(!r.hasFocus&&r.state.facet(Da)||n.main.eq(i))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!i.empty&&n&&n.main.empty?t={from:i.from,to:i.to,insert:r.state.doc.slice(i.from,i.to)}:t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:r.state.doc.slice(i.from,t.from).append(t.insert).append(r.state.doc.slice(t.to,i.to))}:(ye.mac||ye.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=ie.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Qe.of([" "])}):ye.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
|
|
148
|
-
`&&r.lineWrapping&&(n&&(n=ie.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Qe.of([" "])}),t){if(ye.ios&&r.inputState.flushIOSKey()||ye.android&&(t.from==i.from&&t.to==i.to&&t.insert.length==1&&t.insert.lines==2&&qi(r.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&qi(r.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&qi(r.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let a,l=()=>a||(a=LA(r,t,n));return r.state.facet(Gp).some(c=>c(r,t.from,t.to,o,l))||r.dispatch(l()),!0}else if(n&&!n.main.eq(i)){let o=!1,a="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),a=r.inputState.lastSelectionOrigin),r.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function LA(r,e,t){let n,i=r.state,s=i.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)&&r.inputState.composing<0){let a=s.from<e.from?i.sliceDoc(s.from,e.from):"",l=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(r.state.toText(a+e.insert.sliceString(0,void 0,r.state.lineBreak)+l))}else{let a=i.changes(e),l=t&&t.main.to<=a.newLength?t.main:void 0;if(i.selection.ranges.length>1&&r.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=r.state.sliceDoc(e.from,e.to),u,h=t&&ug(r,t.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=r.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let y=m.to-d,w=y-c.length;if(m.to-m.from!=p||r.state.sliceDoc(w,y)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let A=i.changes({from:w,to:y,insert:e.insert}),T=m.to-s.to;return{changes:A,range:l?ie.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):m.map(A)}})}else n={changes:a,selection:l&&i.selection.replaceRange(l)}}let o="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,o+=".compose",r.inputState.compositionFirstChange&&(o+=".start",r.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:o,scrollIntoView:!0})}function BA(r,e,t,n){let i=Math.min(r.length,e.length),s=0;for(;s<i&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.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 FA(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new Yg(t,n)),(i!=t||s!=n)&&e.push(new Yg(i,s))),e}function jA(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t>-1&&n>-1?ie.single(t+e,n+e):null}const VA={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},du=ye.ie&&ye.ie_version<=11;class WA{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Ek,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.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(ye.ie&&ye.ie_version<=11||ye.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),du&&(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),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.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){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,n)=>t!=e[n]))){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:n}=this,i=this.selectionRange;if(n.state.facet(Da)?n.root.activeElement!=this.dom:!Oa(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ye.ie&&ye.ie_version<=11||ye.android&&ye.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Ea(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ye.safari&&e.root.nodeType==11&&kk(this.dom.ownerDocument)==this.dom&&$A(this.view)||Ca(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=Oa(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Pk(this.dom,t)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(t),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 n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.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,VA),du&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),du&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&qi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.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,n=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Oa(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new RA(this.view,e,t,n);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 n=this.view.state,i=Jg(this.view,t);return this.view.state==n&&this.view.update([]),i}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 n=Qg(t,e.previousSibling||e.target.previousSibling,-1),i=Qg(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):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),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),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.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 Qg(r,e,t){for(;e;){let n=nt.get(e);if(n&&n.parent==r)return n;let i=e.parentNode;e=i!=r.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function $A(r){let e=null;function t(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(r.contentDOM.addEventListener("beforeinput",t,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let n=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,a=r.docView.domAtPos(r.state.selection.main.anchor);return Ea(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class he{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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(n=>n.forEach(i=>t(i,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Tk(e.parent)||document,this.viewState=new $g(e.state||We.create(e)),this.plugins=this.state.facet(eo).map(n=>new _c(n));for(let n of this.plugins)n.update(this);this.observer=new WA(this),this.inputState=new iA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new lg(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let t=e.length==1&&e[0]instanceof Tt?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,n=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Dg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Ng(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(We.phrases)!=this.state.facet(We.phrases))return this.setState(s);i=Ra.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;h=new Ia(p.empty?p:ie.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Qp)&&(h=p.value)}this.viewState.update(i,h),this.bidiCache=za.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(ro)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ha)!=i.state.facet(Ha)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let d of this.state.facet(Zc))d(i);(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!Jg(this,u)&&c.force&&qi(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 n of this.plugins)n.destroy(this);this.viewState=new $g(e),this.plugins=e.facet(eo).map(n=>new _c(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView=new lg(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(eo),n=e.state.facet(eo);if(t!=n){let i=[];for(let s of n){let o=t.indexOf(s);if(o<0)i.push(new _c(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}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,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Cp(n))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.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 u=c.map(p=>{try{return p.read(this)}catch(m){return Nr(this.state,m),Xg}}),h=Ra.create(this,this.state,[]),d=!1;h.flags|=l,t?t.flags|=l:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h));for(let p=0;p<c.length;p++)if(u[p]!=Xg)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){Nr(this.state,m)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,n.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Zc))a(t)}get themeClasses(){return fu+" "+(this.state.facet(uu)?Ug:zg)+" "+this.state.facet(Ha)}updateAttrs(){let e=Zg(this,Xp,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Da)?"true":"false",class:"cm-content",style:`${ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Zg(this,Na,t);let n=this.observer.ignore(()=>{let i=Qc(this.contentDOM,this.contentAttrs,t),s=Qc(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(he.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(ro);let e=this.state.facet(he.cspNonce);Gn.mount(this.root,this.styleModules.concat(IA).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(n=>n.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,n){return ou(this,e,vg(this,e,t,n))}moveByGroup(e,t){return ou(this,e,vg(this,e,t,n=>rA(this,e.head,n)))}moveToLineBoundary(e,t,n=!0){return tA(this,e,t,n)}moveVertically(e,t,n){return ou(this,e,nA(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),gg(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Xn.find(s,e-i.from,-1,t)];return Ta(n,o.dir==ft.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(Yp)||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>HA)return sg(e.length);let t=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||ng(s.isolates,n=_p(this,e.from,e.to))))return s.order;n||(n=_p(this,e.from,e.to));let i=ig(e.text,t,n);return this.bidiCache.push(new za(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Sp(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(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Qp.of(new Ia(typeof e=="number"?ie.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return ut.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ut.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Gn.newName(),i=[Ha.of(n),ro.of(hu(`.${n}`,e))];return t&&t.dark&&i.push(uu.of(!0)),i}static baseTheme(e){return xi.lowest(ro.of(hu("."+fu,e,Gg)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&nt.get(n)||nt.get(e);return((t=i?.rootView)===null||t===void 0?void 0:t.view)||null}}he.styleModule=ro,he.inputHandler=Gp,he.focusChangeEffect=Kp,he.perLineTextDirection=Yp,he.exceptionSink=Up,he.updateListener=Zc,he.editable=Da,he.mouseSelectionStyle=zp,he.dragMovesSelection=Hp,he.clickAddsSelectionRange=$p,he.decorations=to,he.atomicRanges=qc,he.bidiIsolatedRanges=Zp,he.scrollMargins=qp,he.darkTheme=uu,he.cspNonce=de.define({combine:r=>r.length?r[0]:""}),he.contentAttributes=Na,he.editorAttributes=Xp,he.lineWrapping=he.contentAttributes.of({class:"cm-lineWrapping"}),he.announce=Ae.define();const HA=4096,Xg={};class za{constructor(e,t,n,i,s,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:ft.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&n.push(new za(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Zg(r,e,t){for(let n=r.state.facet(e),i=n.length-1;i>=0;i--){let s=n[i],o=typeof s=="function"?s(r):s;o&&Yc(o,t)}return t}const zA=ye.mac?"mac":ye.windows?"win":ye.linux?"linux":"key";function UA(r,e){const t=r.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let i,s,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!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 i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ua(r,e,t){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t!==!1&&e.shiftKey&&(r="Shift-"+r),r}const GA=xi.default(he.domEventHandlers({keydown(r,e){return em(qg(e.state),r,e,"editor")}})),oo=de.define({enables:GA}),_g=new WeakMap;function qg(r){let e=r.facet(oo),t=_g.get(e);return t||_g.set(e,t=JA(e.reduce((n,i)=>n.concat(i),[]))),t}function KA(r,e,t){return em(qg(r.state),e,r,t)}let Zn=null;const YA=4e3;function JA(r,e=zA){let t=Object.create(null),n=Object.create(null),i=(o,a)=>{let l=n[o];if(l==null)n[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,u)=>{var h,d;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(A=>UA(A,e));for(let A=1;A<m.length;A++){let T=m.slice(0,A).join(" ");i(T,!0),p[T]||(p[T]={preventDefault:!0,stopPropagation:!1,run:[P=>{let L=Zn={view:P,prefix:T,scope:o};return setTimeout(()=>{Zn==L&&(Zn=null)},YA),!0}]})}let y=m.join(" ");i(y,!1);let w=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(h=p._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let o of r){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let h in u)u[h].run.push(o.any)}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}function em(r,e,t,n){let i=Sk(e),s=Lt(i,0),o=Dr(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;Zn&&Zn.view==t&&Zn.scope==n&&(a=Zn.prefix+" ",xg.indexOf(e.keyCode)<0&&(c=!0,Zn=null));let h=new Set,d=w=>{if(w){for(let A of w.run)if(!h.has(A)&&(h.add(A),A(t,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=r[n],m,y;return p&&(d(p[a+Ua(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ye.windows&&e.ctrlKey&&e.altKey)&&(m=Kn[e.keyCode])&&m!=i?(d(p[a+Ua(m,e,!0)])||e.shiftKey&&(y=Qs[e.keyCode])!=i&&y!=m&&d(p[a+Ua(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Ua(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}class ao{constructor(e,t,n,i,s){this.className=e,this.left=t,this.top=n,this.width=i,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,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=tm(e);return[new ao(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return QA(e,t,n)}}function tm(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==ft.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function rm(r,e,t){let n=ie.cursor(e);return{from:Math.max(t.from,r.moveToLineBoundary(n,!1,!0).from),to:Math.min(t.to,r.moveToLineBoundary(n,!0,!0).from),type:nr.Text}}function QA(r,e,t){if(t.to<=r.viewport.from||t.from>=r.viewport.to)return[];let n=Math.max(t.from,r.viewport.from),i=Math.min(t.to,r.viewport.to),s=r.textDirection==ft.LTR,o=r.contentDOM,a=o.getBoundingClientRect(),l=tm(r),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=su(r,n),m=su(r,i),y=p.type==nr.Text?p:null,w=m.type==nr.Text?m:null;if(y&&(r.lineWrapping||p.widgetLineBreaks)&&(y=rm(r,n,y)),w&&(r.lineWrapping||m.widgetLineBreaks)&&(w=rm(r,i,w)),y&&w&&y.from==w.from)return T(P(t.from,t.to,y));{let D=y?P(t.from,null,y):L(p,!1),j=w?P(null,t.to,w):L(m,!0),W=[];return(y||p).to<(w||m).from-(y&&w?1:0)||p.widgetLineBreaks>1&&D.bottom+r.defaultLineHeight/2<j.top?W.push(A(h,D.bottom,d,j.top)):D.bottom<j.top&&r.elementAtHeight((D.bottom+j.top)/2).type==nr.Text&&(D.bottom=j.top=(D.bottom+j.top)/2),T(D).concat(W).concat(T(j))}function A(D,j,W,q){return new ao(e,D-l.left,j-l.top-.01,W-D,q-j+.01)}function T({top:D,bottom:j,horizontal:W}){let q=[];for(let F=0;F<W.length;F+=2)q.push(A(W[F],D,W[F+1],j));return q}function P(D,j,W){let q=1e9,F=-1e9,H=[];function Q(be,ke,Re,Se,Oe){let Te=r.coordsAtPos(be,be==W.to?-2:2),De=r.coordsAtPos(Re,Re==W.from?2:-2);!Te||!De||(q=Math.min(Te.top,De.top,q),F=Math.max(Te.bottom,De.bottom,F),Oe==ft.LTR?H.push(s&&ke?h:Te.left,s&&Se?d:De.right):H.push(!s&&Se?h:De.left,!s&&ke?d:Te.right))}let oe=D??W.from,fe=j??W.to;for(let be of r.visibleRanges)if(be.to>oe&&be.from<fe)for(let ke=Math.max(be.from,oe),Re=Math.min(be.to,fe);;){let Se=r.state.doc.lineAt(ke);for(let Oe of r.bidiSpans(Se)){let Te=Oe.from+Se.from,De=Oe.to+Se.from;if(Te>=Re)break;De>ke&&Q(Math.max(Te,ke),D==null&&Te<=oe,Math.min(De,Re),j==null&&De>=fe,Oe.dir)}if(ke=Se.to+1,ke>=Re)break}return H.length==0&&Q(oe,D==null,fe,j==null,r.textDirection),{top:q,bottom:F,horizontal:H}}function L(D,j){let W=a.top+(j?D.top:D.bottom);return{top:W,bottom:W,horizontal:[]}}}function XA(r,e){return r.constructor==e.constructor&&r.eq(e)}class ZA{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(Ga)!=e.state.facet(Ga)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,n=e.facet(Ga);for(;t<n.length&&n[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,n)=>!XA(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ga=de.define();function nm(r){return[ut.define(e=>new ZA(e,r)),Ga.of(r)]}const im=!ye.ios,ts=de.define({combine(r){return zr(r,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function _A(r={}){return[ts.of(r),qA,eC,tC,Jp.of(!0)]}function qI(r){return r.facet(ts)}function sm(r){return r.startState.facet(ts)!=r.state.facet(ts)}const qA=nm({above:!0,markers(r){let{state:e}=r,t=e.facet(ts),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||im:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:ie.cursor(i.head,i.head>i.anchor?-1:1);for(let l of ao.forRange(r,o,a))n.push(l)}}return n},update(r,e){r.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=sm(r);return t&&om(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){om(e.state,r)},class:"cm-cursorLayer"});function om(r,e){e.style.animationDuration=r.facet(ts).cursorBlinkRate+"ms"}const eC=nm({above:!1,markers(r){return r.state.selection.ranges.map(e=>e.empty?[]:ao.forRange(r,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||sm(r)},class:"cm-selectionLayer"}),am={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};im&&(am[".cm-line"].caretColor="transparent !important");const tC=xi.highest(he.theme(am)),lm=Ae.define({map(r,e){return r==null?null:e.mapPos(r)}}),lo=kt.define({create(){return null},update(r,e){return r!=null&&(r=e.changes.mapPos(r)),e.effects.reduce((t,n)=>n.is(lm)?n.value:t,r)}}),rC=ut.fromClass(class{constructor(r){this.view=r,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(r){var e;let t=r.state.field(lo);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"),(r.startState.field(lo)!=t||r.docChanged||r.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:r}=this,e=r.state.field(lo),t=e!=null&&r.coordsAtPos(e);if(!t)return null;let n=r.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+r.scrollDOM.scrollLeft*r.scaleX,top:t.top-n.top+r.scrollDOM.scrollTop*r.scaleY,height:t.bottom-t.top}}drawCursor(r){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;r?(this.cursor.style.left=r.left/e+"px",this.cursor.style.top=r.top/t+"px",this.cursor.style.height=r.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(r){this.view.state.field(lo)!=r&&this.view.dispatch({effects:lm.of(r)})}},{eventObservers:{dragover(r){this.setDropPos(this.view.posAtCoords({x:r.clientX,y:r.clientY}))},dragleave(r){(r.target==this.view.contentDOM||!this.view.contentDOM.contains(r.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function nC(){return[lo,rC]}function cm(r,e,t,n,i){e.lastIndex=0;for(let s=r.iterRange(t,n),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function iC(r,e){let t=r.visibleRanges;if(t.length==1&&t[0].from==r.viewport.from&&t[0].to==r.viewport.to)return t;let n=[];for(let{from:i,to:s}of t)i=Math.max(r.state.doc.lineAt(i).from,i-e),s=Math.min(r.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=s:n.push({from:i,to:s});return n}class pu{constructor(e){const{regexp:t,decoration:n,decorate:i,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,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,c,u)=>{let h=n(a,l,c);h&&u(c,c+a[0].length,h)};else if(n)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Un,n=t.add.bind(t);for(let{from:i,to:s}of iC(e,this.maxLength))cm(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(n=Math.min(a,n),i=Math.max(l,i))}),e.viewportChanged||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let s of e.visibleRanges){let o=Math.max(s.from,n),a=Math.min(s.to,i);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let d=[],p,m=(y,w,A)=>d.push(A.range(y,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else cm(e.state.doc,this.regexp,u,h,(y,w)=>this.addMatch(w,e,y,m));t=t.update({filterFrom:u,filterTo:h,filter:(y,w)=>y<u||w>h,add:d})}}return t}}const gu=/x/.unicode!=null?"gu":"g",sC=new RegExp(`[\0-\b
|
|
149
|
-
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,gu),oC={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"};let mu=null;function aC(){var r;if(mu==null&&typeof document<"u"&&document.body){let e=document.body.style;mu=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return mu||!1}const Ka=de.define({combine(r){let e=zr(r,{render:null,specialChars:sC,addSpecialChars:null});return(e.replaceTabs=!aC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gu)),e}});function lC(r={}){return[Ka.of(r),cC()]}let um=null;function cC(){return um||(um=ut.fromClass(class{constructor(r){this.view=r,this.decorations=we.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(Ka)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new pu({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=Lt(e[0],0);if(s==9){let o=i.lineAt(n),a=t.state.tabSize,l=Xi(o.text,a,n-o.from);return we.replace({widget:new dC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=we.replace({widget:new hC(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(Ka);r.startState.facet(Ka)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}const uC="\u2022";function fC(r){return r>=32?uC:r==10?"\u2424":String.fromCharCode(9216+r)}class hC extends on{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=fC(this.code),n=e.state.phrase("Control character")+" "+(oC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class dC extends on{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}}const fm=null;function eD(){return[fm,Na.of(r=>{var e;return((e=r.plugin(fm))===null||e===void 0?void 0:e.attrs)||null})]}function pC(){return mC}const gC=we.line({class:"cm-activeLine"}),mC=ut.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let i=r.lineBlockAt(n.head);i.from>e&&(t.push(gC.range(i.from)),e=i.from)}return we.set(t)}},{decorations:r=>r.decorations});class vC extends on{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?Zi(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Ta(t[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function yC(r){return ut.fromClass(class{constructor(e){this.view=e,this.placeholder=r?we.set([we.widget({widget:new vC(r),side:1}).range(0)]):we.none}get decorations(){return this.view.state.doc.length?we.none:this.placeholder}},{decorations:e=>e.decorations})}const vu=2e3;function bC(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>vu||t.off>vu||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=n;l<=i;l++){let c=r.doc.line(l);c.length<=a&&s.push(ie.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=n;l<=i;l++){let c=r.doc.line(l),u=Fc(c.text,o,r.tabSize,!0);if(u<0)s.push(ie.cursor(c.to));else{let h=Fc(c.text,a,r.tabSize);s.push(ie.range(c.from+u,c.from+h))}}}return s}function xC(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function hm(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),n=r.state.doc.lineAt(t),i=t-n.from,s=i>vu?-1:i==n.length?xC(r,e.clientX):Xi(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function wC(r,e){let t=hm(r,e),n=r.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=hm(r,i);if(!a)return n;let l=bC(r.state,t,a);return l.length?o?ie.create(l.concat(n.ranges)):ie.create(l):n}}:null}function SC(r){let e=r?.eventFilter||(t=>t.altKey&&t.button==0);return he.mouseSelectionStyle.of((t,n)=>e(n)?wC(t,n):null)}const kC={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},AC={style:"cursor: crosshair"};function CC(r={}){let[e,t]=kC[r.key||"Alt"],n=ut.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[n,he.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?AC:null})]}const co="-10000px";class dm{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===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],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=t[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(l.dom.remove(),(n=l.destroy)===null||n===void 0||n.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function tD(r={}){return Ya.of(r)}function OC(r){let{win:e}=r;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ya=de.define({combine:r=>{var e,t,n;return{position:ye.ios?"absolute":((e=r.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=r.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=r.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||OC}}}),pm=new WeakMap,yu=ut.fromClass(class{constructor(r){this.view=r,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=r.state.facet(Ya);this.position=e.position,this.parent=e.parent,this.classes=r.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new dm(r,Ja,t=>this.createTooltip(t)),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(),r.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 r of this.manager.tooltipViews)this.intersectionObserver.observe(r.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(r){r.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(r,this.above);e&&this.observeIntersection();let t=e||r.geometryChanged,n=r.state.facet(Ya);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(r){let e=r.create(this.view);if(e.dom.classList.add("cm-tooltip"),r.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=co,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var r,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(r=t.destroy)===null||r===void 0||r.call(t);this.parent&&this.container.remove(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let r=this.view.dom.getBoundingClientRect(),e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(ye.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(this.view.scaleX!=1||this.view.scaleY!=1)n=!0;else if(i.style.top==co&&i.style.left=="0px"){let s=i.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:r,parent:this.parent?this.container.getBoundingClientRect():r,pos:this.manager.tooltips.map((i,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ya).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(r){var e;if(r.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:t,space:n,scaleX:i,scaleY:s}=r,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=r.pos[a],d=r.size[a];if(!h||h.bottom<=Math.max(t.top,n.top)||h.top>=Math.min(t.bottom,n.bottom)||h.right<Math.max(t.left,n.left)-.1||h.left>Math.min(t.right,n.right)+.1){u.style.top=co;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=d.right-d.left,w=(e=pm.get(c))!==null&&e!==void 0?e:d.bottom-d.top,A=c.offset||TC,T=this.view.textDirection==ft.LTR,P=d.width>n.right-n.left?T?n.left:n.right-d.width:T?Math.min(h.left-(p?14:0)+A.x,n.right-y):Math.max(n.left,h.left-y+(p?14:0)-A.x),L=this.above[a];!l.strictSide&&(L?h.top-(d.bottom-d.top)-A.y<n.top:h.bottom+(d.bottom-d.top)+A.y>n.bottom)&&L==n.bottom-h.bottom>h.top-n.top&&(L=this.above[a]=!L);let D=(L?h.top-n.top:n.bottom-h.bottom)-m;if(D<w&&c.resize!==!1){if(D<this.view.defaultLineHeight){u.style.top=co;continue}pm.set(c,w),u.style.height=(w=D)/s+"px"}else u.style.height&&(u.style.height="");let j=L?h.top-w-m-A.y:h.bottom+m+A.y,W=P+y;if(c.overlap!==!0)for(let q of o)q.left<W&&q.right>P&&q.top<j+w&&q.bottom>j&&(j=L?q.top-w-2-m:q.bottom+m+2);if(this.position=="absolute"?(u.style.top=(j-r.parent.top)/s+"px",u.style.left=(P-r.parent.left)/i+"px"):(u.style.top=j/s+"px",u.style.left=P/i+"px"),p){let q=h.left+(T?A.x:-A.x)-(P+14-7);p.style.left=q/i+"px"}c.overlap!==!0&&o.push({left:P,top:j,right:W,bottom:j+w}),u.classList.toggle("cm-tooltip-above",L),u.classList.toggle("cm-tooltip-below",!L),c.positioned&&c.positioned(r.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 r of this.manager.tooltipViews)r.dom.style.top=co}},{eventObservers:{scroll(){this.maybeMeasure()}}}),EC=he.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"}}}),TC={x:0,y:0},Ja=de.define({enables:[yu,EC]}),uo=de.define();class bu{static create(e){return new bu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new dm(e,uo,t=>this.createHostedView(t))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}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 n of this.manager.tooltipViews){let i=n[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)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")}}const PC=Ja.compute([uo],r=>{let e=r.facet(uo).filter(t=>t);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>t.end!=null).map(t=>t.end)),create:bu.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class MC{constructor(e,t,n,i,s){this.view=e,this.source=t,this.field=n,this.setHover=i,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)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,n=e.docView.nearest(t.target);if(!n)return;let i,s=1;if(n instanceof Yn)i=n.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let a=e.coordsAtPos(i);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(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==ft.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&e.dispatch({effects:this.setHover.of(l)}))},l=>Nr(e.state,l,"hover tooltip"))}else o&&e.dispatch({effects:this.setHover.of(o)})}mousemove(e){var t;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 n=this.active;if(n&&!gm(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,s=(t=n?.end)!==null&&t!==void 0?t:i;(i==s?this.view.posAtCoords(this.lastMove)!=i:!IC(this.view,i,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!gm(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function gm(r){for(let e=r;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function IC(r,e,t,n,i,s){let o=r.scrollDOM.getBoundingClientRect(),a=r.documentTop+r.documentPadding.top+r.contentHeight;if(o.left>n||o.right<n||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=r.posAtCoords({x:n,y:i},!1);return l>=e&&l<=t}function DC(r,e={}){let t=Ae.define(),n=kt.define({create(){return null},update(i,s){if(i&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,i)))return null;if(i&&s.docChanged){let o=s.changes.mapPos(i.pos,-1,rr.TrackDel);if(o==null)return null;let a=Object.assign(Object.create(null),i);a.pos=o,i.end!=null&&(a.end=s.changes.mapPos(i.end)),i=a}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(NC)&&(i=null);return i},provide:i=>uo.from(i)});return[n,ut.define(i=>new MC(i,r,n,t,e.hoverTime||300)),PC]}function mm(r,e){let t=r.plugin(yu);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}function rD(r){return r.facet(uo).some(e=>e)}const NC=Ae.define(),nD=null;function iD(r){let e=r.plugin(yu);e&&e.maybeMeasure()}const xu=de.define({combine(r){let e,t;for(let n of r)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function sD(r){return r?[xu.of(r)]:[]}function fo(r,e){let t=r.plugin(vm),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const vm=ut.fromClass(class{constructor(r){this.input=r.state.facet(ho),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(r));let e=r.state.facet(xu);this.top=new Qa(r,!0,e.topContainer),this.bottom=new Qa(r,!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(r){let e=r.state.facet(xu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Qa(r.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Qa(r.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=r.state.facet(ho);if(t!=this.input){let n=t.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of n){let c=this.specs.indexOf(l),u;c<0?(u=l(r.view),a.push(u)):(u=this.panels[c],u.update&&u.update(r)),i.push(u),(u.top?s:o).push(u)}this.specs=n,this.panels=i,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 n of this.panels)n.update&&n.update(r)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:r=>he.scrollMargins.of(e=>{let t=e.plugin(r);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Qa{constructor(e,t,n){this.view=e,this.top=t,this.container=n,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=ym(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ym(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 ym(r){let e=r.nextSibling;return r.remove(),e}const ho=de.define({enables:vm});class un extends wi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}un.prototype.elementClass="",un.prototype.toDOM=void 0,un.prototype.mapMode=rr.TrackBefore,un.prototype.startSide=un.prototype.endSide=-1,un.prototype.point=!0;const Xa=de.define(),RC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},po=de.define();function bm(r){return[xm(),po.of(Object.assign(Object.assign({},RC),r))]}const wu=de.define({combine:r=>r.some(e=>e)});function xm(r){let e=[LC];return r&&r.fixed===!1&&e.push(wu.of(!0)),e}const LC=ut.fromClass(class{constructor(r){this.view=r,this.prevViewport=r.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=r.state.facet(po).map(e=>new Sm(r,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!r.state.facet(wu),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),r.scrollDOM.insertBefore(this.dom,r.contentDOM)}update(r){if(this.updateGutters(r)){let e=this.prevViewport,t=r.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}r.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(wu)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=r.view.viewport}syncGutters(r){let e=this.dom.nextSibling;r&&this.dom.remove();let t=Ge.iter(this.view.state.facet(Xa),this.view.viewport.from),n=[],i=this.gutters.map(s=>new BC(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==nr.Text&&o){Su(t,n,a.from);for(let l of i)l.line(this.view,a,n);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==nr.Text){Su(t,n,s.from);for(let o of i)o.line(this.view,s,n)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();r&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(r){let e=r.startState.facet(po),t=r.state.facet(po),n=r.docChanged||r.heightChanged||r.viewportChanged||!Ge.eq(r.startState.facet(Xa),r.state.facet(Xa),r.view.viewport.from,r.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(r)&&(n=!0);else{n=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new Sm(this.view,s)):(this.gutters[o].update(r),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return n}destroy(){for(let r of this.gutters)r.destroy();this.dom.remove()}},{provide:r=>he.scrollMargins.of(e=>{let t=e.plugin(r);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==ft.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function wm(r){return Array.isArray(r)?r:[r]}function Su(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class BC{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ge.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new km(e,o,s,n);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Su(this.cursor,i,t.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Sm{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 n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let s=i.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=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,i)&&i.preventDefault()});this.markers=wm(t.markers(e)),t.initialSpacer&&(this.spacer=new km(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=wm(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let n=e.view.viewport;return!Ge.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class km{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),FC(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function FC(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].compare(e[t]))return!1;return!0}const jC=de.define(),rs=de.define({combine(r){return zr(r,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let i in t){let s=n[i],o=t[i];n[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return n}})}});class ku extends un{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Au(r,e){return r.state.facet(rs).formatNumber(e,r.state)}const VC=po.compute([rs],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(jC)},lineMarker(e,t,n){return n.some(i=>i.toDOM)?null:new ku(Au(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(rs)!=e.state.facet(rs),initialSpacer(e){return new ku(Au(e,Am(e.state.doc.lines)))},updateSpacer(e,t){let n=Au(t.view,Am(t.view.state.doc.lines));return n==e.number?e:new ku(n)},domEventHandlers:r.facet(rs).domEventHandlers}));function WC(r={}){return[rs.of(r),xm(),VC]}function Am(r){let e=9;for(;e<r;)e=e*10+9;return e}const $C=new class extends un{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},HC=Xa.compute(["selection"],r=>{let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.head).from;i>t&&(t=i,e.push($C.range(i)))}return Ge.of(e)});function zC(){return HC}const Cm=new Map;function UC(r){let e=Cm.get(r);return e||Cm.set(r,e=we.mark({attributes:r===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":r.replace(/ /g,"\xB7")}})),e}function Om(r){return ut.define(e=>({decorations:r.createDeco(e),update(t){this.decorations=r.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const GC=Om(new pu({regexp:/\t| +/g,decoration:r=>UC(r[0]),boundary:/\S/}));function oD(){return GC}const KC=Om(new pu({regexp:/\s+$/g,decoration:we.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function aD(){return KC}const lD={HeightMap:Yt,HeightOracle:Fg,MeasuredHeights:jg,QueryType:tt,ChangedRange:yr,computeOrder:ig,moveVisually:ag};var Cu;const ki=new Be;function Em(r){return de.define({combine:r?e=>e.concat(r):void 0})}const YC=new Be;class xr{constructor(e,t,n=[],i=""){this.data=e,this.name=i,We.prototype.hasOwnProperty("tree")||Object.defineProperty(We.prototype,"tree",{get(){return Nt(this)}}),this.parser=t,this.extension=[_n.of(this),We.languageData.of((s,o,a)=>{let l=Tm(s,o,a),c=l.type.prop(ki);if(!c)return[];let u=s.facet(c),h=l.type.prop(YC);if(h){let d=l.resolve(o-l.from,a);for(let p of h)if(p.test(d,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Tm(e,t,n).type.prop(ki)==this.data}findRegions(e){let t=e.facet(_n);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(s,o)=>{if(s.prop(ki)==this.data){n.push({from:o,to:o+s.length});return}let a=s.prop(Be.mounted);if(a){if(a.tree.prop(ki)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+s.length});return}else if(a.overlay){let l=n.length;if(i(a.tree,a.overlay[0].from+o),n.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ct&&i(c,s.positions[l]+o)}};return i(Nt(e),0),n}get allowsNesting(){return!0}}xr.setState=Ae.define();function Tm(r,e,t){let n=r.facet(_n),i=Nt(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,st.ExcludeBuffers))s.type.isTop&&(i=s);return i}class Za extends xr{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Em(e.languageData);return new Za(t,e.parser.configure({props:[ki.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Za(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Nt(r){let e=r.field(xr.state,!1);return e?e.tree:ct.empty}function JC(r,e,t=50){var n;let i=(n=r.field(xr.state,!1))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let o=i.isDone(e)||i.work(t,e)?i.tree:null;return i.updateViewport(s),o}function cD(r,e=r.doc.length){var t;return((t=r.field(xr.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function uD(r,e=r.viewport.to,t=100){let n=JC(r.state,e,t);return n!=Nt(r.state)&&r.dispatch({}),!!n}function fD(r){var e;return((e=r.plugin(Im))===null||e===void 0?void 0:e.isWorking())||!1}class QC{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 n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let go=null;class ns{constructor(e,t,n=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ns(e,t,[],ct.empty,0,n,[],null)}startParse(){return this.parser.startParse(new QC(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ct.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}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 i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(kn.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,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(kn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=go;go=this;try{return e()}finally{go=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Pm(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),n=kn.applyChanges(n,l),i=ct.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 u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new ns(this.parser,t,n,i,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 n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Pm(this.fragments,i,s),this.skipped.splice(n--,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 Td{createParse(t,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=go;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ct(er.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 go}}function Pm(r,e,t){return kn.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class is{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),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new is(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ns.create(e.facet(_n).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new is(n)}}xr.state=kt.define({create:is.init,update(r,e){for(let t of e.effects)if(t.is(xr.setState))return t.value;return e.startState.facet(_n)!=e.state.facet(_n)?is.init(e.state):r.apply(e)}});let Mm=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Mm=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ou=typeof navigator<"u"&&(!((Cu=navigator.scheduling)===null||Cu===void 0)&&Cu.isInputPending)?()=>navigator.scheduling.isInputPending():null,Im=ut.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(xr.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(xr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Mm(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:n,viewport:{to:i}}=this.view,s=n.field(xr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ou?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&n.doc.length>i+1e3,l=s.context.work(()=>Ou&&Ou()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:xr.setState.of(new is(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=>Nr(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()}}}),_n=de.define({combine(r){return r.length?r[0]:null},enables:r=>[xr.state,Im,he.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class XC{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Dm{constructor(e,t,n,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new Dm(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let n=/\.([^.]+)$/.exec(t);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(n)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const Nm=de.define(),_a=de.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function Ai(r){let e=r.facet(_a);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function ss(r,e){let t="",n=r.tabSize,i=r.facet(_a)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function qa(r,e){r instanceof We&&(r=new mo(r));for(let n of r.state.facet(Nm)){let i=n(r,e);if(i!==void 0)return i}let t=Nt(r.state);return t.length>=e?ZC(r,t,e):null}function hD(r,e,t){let n=Object.create(null),i=new mo(r,{overrideIndentation:o=>{var a;return(a=n[o])!==null&&a!==void 0?a:-1}}),s=[];for(let o=e;o<=t;){let a=r.doc.lineAt(o);o=a.to+1;let l=qa(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let c=/^\s*/.exec(a.text)[0],u=ss(r,l);c!=u&&(n[a.from]=l,s.push({from:a.from,to:a.from+c.length,insert:u}))}return r.changes(s)}class mo{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ai(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Xi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Rm=new Be;function ZC(r,e,t){let n=e.resolveStack(t),i=n.node.enterUnfinishedNodesBefore(t);if(i!=n.node){let s=[];for(let o=i;o!=n.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return Lm(n,r,t)}function Lm(r,e,t){for(let n=r;n;n=n.next){let i=qC(n.node);if(i)return i(Eu.create(e,t,n))}return 0}function _C(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function qC(r){let e=r.type.prop(Rm);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(Be.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>Bm(o,!0,1,void 0,s&&!_C(o)?i.from:void 0)}return r.parent==null?eO:null}function eO(){return 0}class Eu extends mo{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Eu(e,t,n)}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 n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(tO(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Lm(this.context.next,this.base,this.pos)}}function tO(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function rO(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let i=r.options.simulateBreak,s=r.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from<o?t:null;a=l.to}}function dD({closing:r,align:e=!0,units:t=1}){return n=>Bm(n,e,t,r)}function Bm(r,e,t,n,i){let s=r.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||i==r.pos+o,l=e?rO(r):null;return l?a?r.column(l.from):r.column(l.to):r.baseIndent+(a?0:r.unit*t)}const pD=r=>r.baseIndent;function Fm({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const nO=200;function iO(){return We.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,i=t.lineAt(n);if(n>i.from+nO)return r;let s=t.sliceString(i.from,n);if(!e.some(c=>c.test(s)))return r;let{state:o}=r,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=qa(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],p=ss(o,h);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[r,{changes:l,sequential:!0}]:r})}const sO=de.define(),jm=new Be;function oO(r){let e=r.firstChild,t=r.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?r.to:t.from}:null}function aO(r,e,t){let n=Nt(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let o=i;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(jm);if(l&&(a.to<n.length-50||n.length==r.doc.length||!lO(a))){let c=l(a,r);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function lO(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function vo(r,e,t){for(let n of r.facet(sO)){let i=n(r,e,t);if(i)return i}return aO(r,e,t)}function Vm(r,e){let t=e.mapPos(r.from,1),n=e.mapPos(r.to,-1);return t>=n?void 0:{from:t,to:n}}const yo=Ae.define({map:Vm}),os=Ae.define({map:Vm});function Tu(r){let e=[];for(let{head:t}of r.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(r.lineBlockAt(t));return e}const qn=kt.define({create(){return we.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(yo)&&!cO(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Mu),i=n?we.replace({widget:new vO(n(e.state,t.value))}):Hm;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(os)&&(r=r.update({filter:(n,i)=>t.value.from!=n||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;r.between(n,n,(i,s)=>{i<n&&s>n&&(t=!0)}),t&&(r=r.update({filterFrom:n,filterTo:n,filter:(i,s)=>s<=n||i>=n}))}return r},provide:r=>he.decorations.from(r),toJSON(r,e){let t=[];return r.between(0,e.doc.length,(n,i)=>{t.push(n,i)}),t},fromJSON(r){if(!Array.isArray(r)||r.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<r.length;){let n=r[t++],i=r[t++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Hm.range(n,i))}return we.set(e,!0)}});function gD(r){return r.field(qn,!1)||RangeSet.empty}function bo(r,e,t){var n;let i=null;return(n=r.field(qn,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function cO(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Pu(r,e){return r.field(qn,!1)?e:e.concat(Ae.appendConfig.of(Wm()))}const uO=r=>{for(let e of Tu(r)){let t=vo(r.state,e.from,e.to);if(t)return r.dispatch({effects:Pu(r.state,[yo.of(t),el(r,t)])}),!0}return!1},fO=r=>{if(!r.state.field(qn,!1))return!1;let e=[];for(let t of Tu(r)){let n=bo(r.state,t.from,t.to);n&&e.push(os.of(n),el(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function el(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return he.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}const hO=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=vo(e,i.from,i.to);s&&t.push(yo.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Pu(r.state,t)}),!!t.length},dO=r=>{let e=r.state.field(qn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(os.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function pO(r,e){for(let t=e;;){let n=vo(r.state,t.from,t.to);if(n&&n.to>e.from)return n;if(!t.from)return null;t=r.lineBlockAt(t.from-1)}}const mD=r=>{let e=[];for(let t of Tu(r)){let n=bo(r.state,t.from,t.to);if(n)e.push(os.of(n),el(r,n,!1));else{let i=pO(r,t);i&&e.push(yo.of(i),el(r,i))}}return e.length>0&&r.dispatch({effects:Pu(r.state,e)}),!!e.length},gO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:uO},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:fO},{key:"Ctrl-Alt-[",run:hO},{key:"Ctrl-Alt-]",run:dO}],mO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Mu=de.define({combine(r){return zr(r,mO)}});function Wm(r){let e=[qn,xO];return r&&e.push(Mu.of(r)),e}function $m(r,e){let{state:t}=r,n=t.facet(Mu),i=o=>{let a=r.lineBlockAt(r.posAtDOM(o.target)),l=bo(r.state,a.from,a.to);l&&r.dispatch({effects:os.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(r,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Hm=we.replace({widget:new class extends on{toDOM(r){return $m(r,null)}}});class vO extends on{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $m(e,this.value)}}const yO={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Iu extends un{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 bO(r={}){let e=Object.assign(Object.assign({},yO),r),t=new Iu(e,!0),n=new Iu(e,!1),i=ut.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(_n)!=o.state.facet(_n)||o.startState.field(qn,!1)!=o.state.field(qn,!1)||Nt(o.startState)!=Nt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Un;for(let l of o.viewportLineBlocks){let c=bo(o.state,l.from,l.to)?n:vo(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,bm({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Ge.empty},initialSpacer(){return new Iu(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=bo(o.state,a.from,a.to);if(c)return o.dispatch({effects:os.of(c)}),!0;let u=vo(o.state,a.from,a.to);return u?(o.dispatch({effects:yo.of(u)}),!0):!1}})}),Wm()]}const xO=he.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"}});class as{constructor(e,t){this.specs=e;let n;function i(a){let l=Gn.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof xr?a=>a.prop(ki)==o.data:o?a=>a==o:void 0,this.style=zd(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=n?new Gn(n):null,this.themeType=t.themeType}static define(e,t){return new as(e,t||{})}}const Du=de.define(),zm=de.define({combine(r){return r.length?[r[0]]:null}});function tl(r){let e=r.facet(Du);return e.length?e:r.facet(zm)}function Nu(r,e){let t=[SO],n;return r instanceof as&&(r.module&&t.push(he.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(zm.of(r)):n?t.push(Du.computeN([he.darkTheme],i=>i.facet(he.darkTheme)==(n=="dark")?[r]:[])):t.push(Du.of(r)),t}function vD(r,e,t){let n=tl(r),i=null;if(n){for(let s of n)if(!s.scope||t&&s.scope(t)){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}class wO{constructor(e){this.markCache=Object.create(null),this.tree=Nt(e.state),this.decorations=this.buildDeco(e,tl(e.state))}update(e){let t=Nt(e.state),n=tl(e.state),i=n!=tl(e.startState);t.length<e.view.viewport.to&&!i&&t.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,t){if(!t||!this.tree.length)return we.none;let n=new Un;for(let{from:i,to:s}of e.visibleRanges)_S(this.tree,t,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=we.mark({class:l})))},i,s);return n.finish()}}const SO=xi.high(ut.fromClass(wO,{decorations:r=>r.decorations})),kO=as.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),AO=he.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Um=1e4,Gm="()[]{}",Km=de.define({combine(r){return zr(r,{afterCursor:!0,brackets:Gm,maxScanDistance:Um,renderMatch:EO})}}),CO=we.mark({class:"cm-matchingBracket"}),OO=we.mark({class:"cm-nonmatchingBracket"});function EO(r){let e=[],t=r.matched?CO:OO;return e.push(t.range(r.start.from,r.start.to)),r.end&&e.push(t.range(r.end.from,r.end.to)),e}const TO=[kt.define({create(){return we.none},update(r,e){if(!e.docChanged&&!e.selection)return r;let t=[],n=e.state.facet(Km);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=fn(e.state,i.head,-1,n)||i.head>0&&fn(e.state,i.head-1,1,n)||n.afterCursor&&(fn(e.state,i.head,1,n)||i.head<e.state.doc.length&&fn(e.state,i.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return we.set(t,!0)},provide:r=>he.decorations.from(r)}),AO];function PO(r={}){return[Km.of(r),TO]}const MO=new Be;function Ru(r,e,t){let n=r.prop(e<0?Be.openedBy:Be.closedBy);if(n)return n;if(r.name.length==1){let i=t.indexOf(r.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Lu(r){let e=r.type.prop(MO);return e?e(r.node):r}function fn(r,e,t,n={}){let i=n.maxScanDistance||Um,s=n.brackets||Gm,o=Nt(r),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Ru(l.type,t,s);if(c&&l.from<l.to){let u=Lu(l);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return IO(r,e,t,l,u,c,s)}}return DO(r,e,t,o,a.type,i,s)}function IO(r,e,t,n,i,s,o){let a=n.parent,l={from:i.from,to:i.to},c=0,u=a?.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Lu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Ru(u.type,t,o))c++;else if(Ru(u.type,-t,o)){if(c==0){let h=Lu(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function DO(r,e,t,n,i,s,o){let a=t<0?r.sliceDoc(e-1,e):r.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},u=r.doc.iterRange(e,t>0?r.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;t<0&&(d+=p.length);let m=e+d*t;for(let y=t>0?0:p.length-1,w=t>0?p.length:-1;y!=w;y+=t){let A=o.indexOf(p[y]);if(!(A<0||n.resolveInner(m+y,1).type!=i))if(A%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:m+y,to:m+y+1},matched:A>>1==l>>1};h--}}t>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function Ym(r,e,t,n=0,i=0){e==null&&(e=r.search(/[^\s\u00a0]/),e==-1&&(e=r.length));let s=i;for(let o=n;o<e;o++)r.charCodeAt(o)==9?s+=t-s%t:s++;return s}class Jm{constructor(e,t,n,i){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ym(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:Ym(this.string,null,this.tabSize)}match(e,t,n){if(typeof e=="string"){let i=o=>n?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function NO(r){return{name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||RO,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Fu}}function RO(r){if(typeof r!="object")return r;let e={};for(let t in r){let n=r[t];e[t]=n instanceof Array?n.slice():n}return e}const Qm=new WeakMap;class Xm extends null{constructor(e){let t=Em(e.languageData),n=NO(e),i,s=new class extends Parser{createParse(o,a,l){return new BO(i,o,a,l)}};super(t,s,[Nm.of((o,a)=>this.getIndent(o,a))],e.name),this.topNode=VO(t),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new t0(n.tokenTable):jO}static define(e){return new Xm(e)}getIndent(e,t){let n=Nt(e.state),i=n.resolve(t);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let s,{overrideIndentation:o}=e.options;o&&(s=Qm.get(e.state),s!=null&&s<t-1e4&&(s=void 0));let a=Bu(this,n,0,i.from,s??t),l,c;if(a?(c=a.state,l=a.pos+1):(c=this.streamParser.startState(e.unit),l=0),t-l>1e4)return null;for(;l<t;){let h=e.state.doc.lineAt(l),d=Math.min(t,h.to);if(h.length){let p=o?o(h.from):-1,m=new Jm(h.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;m.pos<d-h.from;)_m(this.streamParser.token,m,c)}else this.streamParser.blankLine(c,e.unit);if(d==t)break;l=h.to+1}let u=e.lineAt(t);return o&&s==null&&Qm.set(e.state,u.from),this.streamParser.indent(c,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Bu(r,e,t,n,i){let s=t>=n&&t+e.length<=i&&e.prop(r.stateAfter);if(s)return{state:r.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o],c=a instanceof Tree&&l<i&&Bu(r,a,l,n,i);if(c)return c}return null}function Zm(r,e,t,n,i){if(i&&t<=0&&n>=e.length)return e;!i&&e.type==r.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<n&&a instanceof Tree){if(!(l=Zm(r,a,t-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function LO(r,e,t,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),a=s<=t&&o>t&&Bu(r,i.tree,0-i.offset,t,o),l;if(a&&(l=Zm(r,i.tree,t+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:l}}return{state:r.streamParser.startState(n?Ai(n):4),tree:Tree.empty}}class BO{constructor(e,t,n,i){this.lang=e,this.input=t,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=ns.get(),o=i[0].from,{state:a,tree:l}=LO(e,n,o,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Ai(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=ns.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+2048);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
|
|
142
|
+
`){let i="";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&&(i+=n),e<l&&t>o&&(i+=a.sliceString(e-o,t-o,n)),o=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof rn))return 0;let n=0,[i,s,o,a]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,s+=t){if(i==o||s==a)return n;let l=this.children[i],c=e.children[s];if(l!=c)return n+l.scanIdentical(c,t);n+=l.length+1}}static from(e,t=e.reduce((n,i)=>n+i.length+1,-1)){let n=0;for(let p of e)n+=p.lines;if(n<32){let p=[];for(let m of e)m.flatten(p);return new mt(p,t)}let i=Math.max(32,n>>5),s=i<<1,o=i>>1,a=[],l=0,c=-1,u=[];function h(p){let m;if(p.lines>s&&p instanceof rn)for(let y of p.children)h(y);else p.lines>o&&(l>o||!l)?(d(),a.push(p)):p instanceof mt&&l&&(m=u[u.length-1])instanceof mt&&p.lines+m.lines<=32?(l+=p.lines,c+=p.length+1,u[u.length-1]=new mt(m.text.concat(p.text),m.length+1+p.length)):(l+p.lines>i&&d(),l+=p.lines,c+=p.length+1,u.push(p))}function d(){l!=0&&(a.push(u.length==1?u[0]:rn.from(u,c)),c=-1,l=u.length=0)}for(let p of e)h(p);return d(),a.length==1?a[0]:new rn(a,t)}}Qe.empty=new mt([""],0);function ik(r){let e=-1;for(let t of r)e+=t.length+1;return e}function ya(r,e,t=0,n=1e9){for(let i=0,s=0,o=!0;s<r.length&&i<=n;s++){let a=r[s],l=i+a.length;l>=t&&(l>n&&(a=a.slice(0,n-i)),i<t&&(a=a.slice(t-i)),o?(e[e.length-1]+=a,o=!1):e.push(a)),i=l+1}return e}function Kd(r,e,t){return ya(r,[""],e,t)}class Hs{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 mt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],s=this.offsets[n],o=s>>1,a=i instanceof mt?i.text.length:i.children.length;if(o==(t>0?a:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
143
|
+
`,this;e--}else if(i instanceof mt){let l=i.text[o+(t<0?-1:0)];if(this.offsets[n]+=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=i.children[o+(t<0?-1:0)];e>l.length?(e-=l.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(l),this.offsets.push(t>0?1:(l instanceof mt?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)}}class Yd{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Hs(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}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 n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),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!=""}}class Jd{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Qe.prototype[Symbol.iterator]=function(){return this.iter()},Hs.prototype[Symbol.iterator]=Yd.prototype[Symbol.iterator]=Jd.prototype[Symbol.iterator]=function(){return this});class sk{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}let Ji="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,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(r=>r?parseInt(r,36):1);for(let r=1;r<Ji.length;r++)Ji[r]+=Ji[r-1];function ok(r){for(let e=1;e<Ji.length;e+=2)if(Ji[e]>r)return Ji[e-1]<=r;return!1}function Qd(r){return r>=127462&&r<=127487}const Xd=8205;function Ut(r,e,t=!0,n=!0){return(t?Zd:ak)(r,e,n)}function Zd(r,e,t){if(e==r.length)return e;e&&_d(r.charCodeAt(e))&&qd(r.charCodeAt(e-1))&&e--;let n=Lt(r,e);for(e+=Dr(n);e<r.length;){let i=Lt(r,e);if(n==Xd||i==Xd||t&&ok(i))e+=Dr(i),n=i;else if(Qd(i)){let s=0,o=e-2;for(;o>=0&&Qd(Lt(r,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function ak(r,e,t){for(;e>0;){let n=Zd(r,e-2,t);if(n<e)return n;e--}return 0}function _d(r){return r>=56320&&r<57344}function qd(r){return r>=55296&&r<56320}function Lt(r,e){let t=r.charCodeAt(e);if(!qd(t)||e+1==r.length)return t;let n=r.charCodeAt(e+1);return _d(n)?(t-55296<<10)+(n-56320)+65536:t}function kc(r){return r<=65535?String.fromCharCode(r):(r-=65536,String.fromCharCode((r>>10)+55296,(r&1023)+56320))}function Dr(r){return r<65536?1:2}const Ac=/\r\n?|\n/;var rr=function(r){return r[r.Simple=0]="Simple",r[r.TrackDel=1]="TrackDel",r[r.TrackBefore=2]="TrackBefore",r[r.TrackAfter=3]="TrackAfter",r}(rr||(rr={}));class nn{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 n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(n,i,s),i+=s):i+=o,n+=s}}iterChangedRanges(e,t=!1){Cc(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new nn(e)}composeDesc(e){return this.empty?e:e.empty?this:ep(this,e)}mapDesc(e,t=!1){return e.empty?this:Oc(this,e,t)}mapPos(e,t=-1,n=rr.Simple){let i=0,s=0;for(let o=0;o<this.sections.length;){let a=this.sections[o++],l=this.sections[o++],c=i+a;if(l<0){if(c>e)return s+(e-i);s+=a}else{if(n!=rr.Simple&&c>=e&&(n==rr.TrackDel&&i<e&&c>e||n==rr.TrackBefore&&i<e||n==rr.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!a)return e==i||t<0?s:s+l;s+=l}i=c}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return s}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let s=this.sections[n++],o=this.sections[n++],a=i+s;if(o>=0&&i<=t&&a>=e)return i<e&&a>t?"cover":!0;i=a}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}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 nn(e)}static create(e){return new nn(e)}}class Et extends nn{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 Cc(this,(t,n,i,s,o)=>e=e.replace(i,i+(n-t),o),!1),e}mapDesc(e,t=!1){return Oc(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,s=0;i<t.length;i+=2){let o=t[i],a=t[i+1];if(a>=0){t[i]=a,t[i+1]=o;let l=i>>1;for(;n.length<l;)n.push(Qe.empty);n.push(o?e.slice(s,s+o):Qe.empty)}s+=o}return new Et(t,n)}compose(e){return this.empty?e:e.empty?this:ep(this,e,!0)}map(e,t=!1){return e.empty?this:Oc(this,e,t,!0)}iterChanges(e,t=!1){Cc(this,e,t)}get desc(){return nn.create(this.sections)}filter(e){let t=[],n=[],i=[],s=new zs(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 u=Math.min(s.len,l-a);Gt(i,u,-1);let h=s.ins==-1?-1:s.off==0?s.ins:0;Gt(t,u,h),h>0&&zn(n,t,s.text),s.forward(u),a+=u}let c=e[o++];for(;a<c;){if(s.done)break e;let u=Math.min(s.len,c-a);Gt(t,u,-1),Gt(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),a+=u}}return{changes:new Et(t,n),filtered:nn.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):i==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],s=[],o=0,a=null;function l(u=!1){if(!u&&!i.length)return;o<t&&Gt(i,t-o,-1);let h=new Et(i,s);a=a?a.compose(h.map(a)):h,i=[],s=[],o=0}function c(u){if(Array.isArray(u))for(let h of u)c(h);else if(u instanceof Et){if(u.length!=t)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${t})`);l(),a=a?a.compose(u.map(a)):u}else{let{from:h,to:d=h,insert:p}=u;if(h>d||h<0||d>t)throw new RangeError(`Invalid change range ${h} to ${d} (in doc of length ${t})`);let m=p?typeof p=="string"?Qe.of(p.split(n||Ac)):p:Qe.empty,y=m.length;if(h==d&&y==0)return;h<o&&l(),h>o&&Gt(i,h-o,-1),Gt(i,d-h,y),zn(s,i,m),o=d}}return c(e),l(!a),a}static empty(e){return new Et(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let s=e[i];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(;n.length<i;)n.push(Qe.empty);n[i]=Qe.of(s.slice(1)),t.push(s[0],n[i].length)}}}return new Et(t,n)}static createSet(e,t){return new Et(e,t)}}function Gt(r,e,t,n=!1){if(e==0&&t<=0)return;let i=r.length-2;i>=0&&t<=0&&t==r[i+1]?r[i]+=e:e==0&&r[i]==0?r[i+1]+=t:n?(r[i]+=e,r[i+1]+=t):r.push(e,t)}function zn(r,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<r.length)r[r.length-1]=r[r.length-1].append(t);else{for(;r.length<n;)r.push(Qe.empty);r.push(t)}}function Cc(r,e,t){let n=r.inserted;for(let i=0,s=0,o=0;o<r.sections.length;){let a=r.sections[o++],l=r.sections[o++];if(l<0)i+=a,s+=a;else{let c=i,u=s,h=Qe.empty;for(;c+=a,u+=l,l&&n&&(h=h.append(n[o-2>>1])),!(t||o==r.sections.length||r.sections[o+1]<0);)a=r.sections[o++],l=r.sections[o++];e(i,c,s,u,h),i=c,s=u}}}function Oc(r,e,t,n=!1){let i=[],s=n?[]:null,o=new zs(r),a=new zs(e);for(let l=-1;;)if(o.ins==-1&&a.ins==-1){let c=Math.min(o.len,a.len);Gt(i,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(Gt(i,a.ins,-1);c;){let u=Math.min(o.len,c);o.ins>=0&&l<o.i&&o.len<=u&&(Gt(i,0,o.ins),s&&zn(s,i,o.text),l=o.i),o.forward(u),c-=u}a.next()}else if(o.ins>=0){let c=0,u=o.len;for(;u;)if(a.ins==-1){let h=Math.min(u,a.len);c+=h,u-=h,a.forward(h)}else if(a.ins==0&&a.len<u)u-=a.len,a.next();else break;Gt(i,c,l<o.i?o.ins:0),s&&l<o.i&&zn(s,i,o.text),l=o.i,o.forward(o.len-u)}else{if(o.done&&a.done)return s?Et.createSet(i,s):nn.create(i);throw new Error("Mismatched change set lengths")}}function ep(r,e,t=!1){let n=[],i=t?[]:null,s=new zs(r),o=new zs(e);for(let a=!1;;){if(s.done&&o.done)return i?Et.createSet(n,i):nn.create(n);if(s.ins==0)Gt(n,s.len,0,a),s.next();else if(o.len==0&&!o.done)Gt(n,0,o.ins,a),i&&zn(i,n,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=n.length;if(s.ins==-1){let u=o.ins==-1?-1:o.off?0:o.ins;Gt(n,l,u,a),i&&u&&zn(i,n,o.text)}else o.ins==-1?(Gt(n,s.off?0:s.len,l,a),i&&zn(i,n,s.textBit(l))):(Gt(n,s.off?0:s.len,o.off?0:o.ins,a),i&&!o.off&&zn(i,n,o.text));a=(s.ins>l||o.ins>=0&&o.len>l)&&(a||n.length>c),s.forward2(l),o.forward(l)}}}}class zs{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?Qe.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Qe.empty:t[n].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)}}class yi{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}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 n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new yi(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ie.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ie.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}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 ie.range(e.anchor,e.head)}static create(e,t,n){return new yi(e,t,n)}}class ie{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ie.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;t<this.ranges.length;t++)if(!this.ranges[t].eq(e.ranges[t]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ie([this.main],0)}addRange(e,t=!0){return ie.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,ie.create(n,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 ie(e.ranges.map(t=>yi.fromJSON(t)),e.main)}static single(e,t=e){return new ie([ie.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 n=0,i=0;i<e.length;i++){let s=e[i];if(s.empty?s.from<=n:s.from<n)return ie.normalized(e.slice(),t);n=s.to}return new ie(e,t)}static cursor(e,t=0,n,i){return yi.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(i??16777215)<<6)}static range(e,t,n,i){let s=(n??16777215)<<6|(i==null?7:Math.min(6,i));return t<e?yi.create(t,e,48|s):yi.create(e,t,(t>e?8:0)|s)}static normalized(e,t=0){let n=e[t];e.sort((i,s)=>i.from-s.from),t=e.indexOf(n);for(let i=1;i<e.length;i++){let s=e[i],o=e[i-1];if(s.empty?s.from<=o.to:s.from<o.to){let a=o.from,l=Math.max(s.to,o.to);i<=t&&t--,e.splice(--i,2,s.anchor>s.head?ie.range(l,a):ie.range(a,l))}}return new ie(e,t)}}function tp(r,e){for(let t of r.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ec=0;class de{constructor(e,t,n,i,s){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Ec++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new de(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Tc),!!e.static,e.enables)}of(e){return new ba([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ba(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ba(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Tc(r,e){return r==e||r.length==e.length&&r.every((t,n)=>t===e[n])}class ba{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Ec++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,s=this.id,o=e[s]>>1,a=this.type==2,l=!1,c=!1,u=[];for(let h of this.dependencies)h=="doc"?l=!0:h=="selection"?c=!0:((t=e[h.id])!==null&&t!==void 0?t:1)&1||u.push(e[h.id]);return{create(h){return h.values[o]=n(h),1},update(h,d){if(l&&d.docChanged||c&&(d.docChanged||d.selection)||Pc(h,u)){let p=n(h);if(a?!rp(p,h.values[o],i):!i(p,h.values[o]))return h.values[o]=p,1}return 0},reconfigure:(h,d)=>{let p,m=d.config.address[s];if(m!=null){let y=Sa(d,m);if(this.dependencies.every(w=>w instanceof de?d.facet(w)===h.facet(w):w instanceof kt?d.field(w,!1)==h.field(w,!1):!0)||(a?rp(p=n(h),y,i):i(p=n(h),y)))return h.values[o]=y,0}else p=n(h);return h.values[o]=p,1}}}}function rp(r,e,t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!t(r[n],e[n]))return!1;return!0}function Pc(r,e){let t=!1;for(let n of e)Gs(r,n)&1&&(t=!0);return t}function lk(r,e,t){let n=t.map(l=>r[l.id]),i=t.map(l=>l.type),s=n.filter(l=>!(l&1)),o=r[e.id]>>1;function a(l){let c=[];for(let u=0;u<n.length;u++){let h=Sa(l,n[u]);if(i[u]==2)for(let d of h)c.push(d);else c.push(h)}return e.combine(c)}return{create(l){for(let c of n)Gs(l,c);return l.values[o]=a(l),1},update(l,c){if(!Pc(l,s))return 0;let u=a(l);return e.compare(u,l.values[o])?0:(l.values[o]=u,1)},reconfigure(l,c){let u=Pc(l,n),h=c.config.facets[e.id],d=c.facet(e);if(h&&!u&&Tc(t,h))return l.values[o]=d,0;let p=a(l);return e.compare(p,d)?(l.values[o]=d,0):(l.values[o]=p,1)}}}const np=de.define({static:!0});class kt{constructor(e,t,n,i,s){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=s,this.provides=void 0}static define(e){let t=new kt(Ec++,e.create,e.update,e.compare||((n,i)=>n===i),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(np).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,i)=>{let s=n.values[t],o=this.updateF(s,i);return this.compareF(s,o)?0:(n.values[t]=o,1)},reconfigure:(n,i)=>i.config.address[this.id]!=null?(n.values[t]=i.field(this),0):(n.values[t]=this.create(n),1)}}init(e){return[this,np.of({field:this,create:e})]}get extension(){return this}}const bi={lowest:4,low:3,default:2,high:1,highest:0};function Us(r){return e=>new ip(e,r)}const xi={highest:Us(bi.highest),high:Us(bi.high),default:Us(bi.default),low:Us(bi.low),lowest:Us(bi.lowest)};class ip{constructor(e,t){this.inner=e,this.prec=t}}class xa{of(e){return new Mc(this,e)}reconfigure(e){return xa.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Mc{constructor(e,t){this.compartment=e,this.inner=t}}class wa{constructor(e,t,n,i,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.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,n){let i=[],s=Object.create(null),o=new Map;for(let d of ck(e,t,o))d instanceof kt?i.push(d):(s[d.facet.id]||(s[d.facet.id]=[])).push(d);let a=Object.create(null),l=[],c=[];for(let d of i)a[d.id]=c.length<<1,c.push(p=>d.slot(p));let u=n?.config.facets;for(let d in s){let p=s[d],m=p[0].facet,y=u&&u[d]||[];if(p.every(w=>w.type==0))if(a[m.id]=l.length<<1|1,Tc(y,p))l.push(n.facet(m));else{let w=m.combine(p.map(A=>A.value));l.push(n&&m.compare(w,n.facet(m))?n.facet(m):w)}else{for(let w of p)w.type==0?(a[w.id]=l.length<<1|1,l.push(w.value)):(a[w.id]=c.length<<1,c.push(A=>w.dynamicSlot(A)));a[m.id]=c.length<<1,c.push(w=>lk(w,m,p))}}let h=c.map(d=>d(a));return new wa(e,o,h,a,l,s)}}function ck(r,e,t){let n=[[],[],[],[],[]],i=new Map;function s(o,a){let l=i.get(o);if(l!=null){if(l<=a)return;let c=n[l].indexOf(o);c>-1&&n[l].splice(c,1),o instanceof Mc&&t.delete(o.compartment)}if(i.set(o,a),Array.isArray(o))for(let c of o)s(c,a);else if(o instanceof Mc){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 ip)s(o.inner,o.prec);else if(o instanceof kt)n[a].push(o),o.provides&&s(o.provides,a);else if(o instanceof ba)n[a].push(o),o.facet.extensions&&s(o.facet.extensions,bi.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(r,bi.default),n.reduce((o,a)=>o.concat(a))}function Gs(r,e){if(e&1)return 2;let t=e>>1,n=r.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;r.status[t]=4;let i=r.computeSlot(r,r.config.dynamicSlots[t]);return r.status[t]=2|i}function Sa(r,e){return e&1?r.config.staticValues[e>>1]:r.values[e>>1]}const sp=de.define(),op=de.define({combine:r=>r.some(e=>e),static:!0}),ap=de.define({combine:r=>r.length?r[0]:void 0,static:!0}),lp=de.define(),cp=de.define(),up=de.define(),fp=de.define({combine:r=>r.length?r[0]:!1});class sn{constructor(e,t){this.type=e,this.value=t}static define(){return new uk}}class uk{of(e){return new sn(this,e)}}class fk{constructor(e){this.map=e}of(e){return new Ae(this,e)}}class Ae{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 Ae(this.type,t)}is(e){return this.type==e}static define(e={}){return new fk(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let s=i.map(t);s&&n.push(s)}return n}}Ae.reconfigure=Ae.define(),Ae.appendConfig=Ae.define();class Tt{constructor(e,t,n,i,s,o){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,n&&tp(n,t.newLength),s.some(a=>a.type==Tt.time)||(this.annotations=s.concat(Tt.time.of(Date.now())))}static create(e,t,n,i,s,o){return new Tt(e,t,n,i,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(Tt.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Tt.time=sn.define(),Tt.userEvent=sn.define(),Tt.addToHistory=sn.define(),Tt.remote=sn.define();function hk(r,e){let t=[];for(let n=0,i=0;;){let s,o;if(n<r.length&&(i==e.length||e[i]>=r[n]))s=r[n++],o=r[n++];else if(i<e.length)s=e[i++],o=e[i++];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 hp(r,e,t){var n;let i,s,o;return t?(i=e.changes,s=Et.empty(e.changes.length),o=r.changes.compose(e.changes)):(i=e.changes.map(r.changes),s=r.changes.mapDesc(e.changes,!0),o=r.changes.compose(i)),{changes:o,selection:e.selection?e.selection.map(s):(n=r.selection)===null||n===void 0?void 0:n.map(i),effects:Ae.mapEffects(r.effects,i).concat(Ae.mapEffects(e.effects,s)),annotations:r.annotations.length?r.annotations.concat(e.annotations):e.annotations,scrollIntoView:r.scrollIntoView||e.scrollIntoView}}function Ic(r,e,t){let n=e.selection,i=Qi(e.annotations);return e.userEvent&&(i=i.concat(Tt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Et?e.changes:Et.of(e.changes||[],t,r.facet(ap)),selection:n&&(n instanceof ie?n:ie.single(n.anchor,n.head)),effects:Qi(e.effects),annotations:i,scrollIntoView:!!e.scrollIntoView}}function dp(r,e,t){let n=Ic(r,e.length?e[0]:{},r.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;n=hp(n,Ic(r,e[s],o?n.changes.newLength:r.doc.length),o)}let i=Tt.create(r,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return pk(t?dk(i):i)}function dk(r){let e=r.startState,t=!0;for(let i of e.facet(lp)){let s=i(r);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:hk(t,s))}if(t!==!0){let i,s;if(t===!1)s=r.changes.invertedDesc,i=Et.empty(e.doc.length);else{let o=r.changes.filter(t);i=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}r=Tt.create(e,i,r.selection&&r.selection.map(s),Ae.mapEffects(r.effects,s),r.annotations,r.scrollIntoView)}let n=e.facet(cp);for(let i=n.length-1;i>=0;i--){let s=n[i](r);s instanceof Tt?r=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Tt?r=s[0]:r=dp(e,Qi(s),!1)}return r}function pk(r){let e=r.startState,t=e.facet(up),n=r;for(let i=t.length-1;i>=0;i--){let s=t[i](r);s&&Object.keys(s).length&&(n=hp(n,Ic(e,s,r.changes.newLength),!0))}return n==r?r:Tt.create(e,r.changes,r.selection,n.effects,n.annotations,n.scrollIntoView)}const gk=[];function Qi(r){return r==null?gk:Array.isArray(r)?r:[r]}var ot=function(r){return r[r.Word=0]="Word",r[r.Space=1]="Space",r[r.Other=2]="Other",r}(ot||(ot={}));const mk=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Dc;try{Dc=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function vk(r){if(Dc)return Dc.test(r);for(let e=0;e<r.length;e++){let t=r[e];if(/\w/.test(t)||t>"\x80"&&(t.toUpperCase()!=t.toLowerCase()||mk.test(t)))return!0}return!1}function yk(r){return e=>{if(!/\S/.test(e))return ot.Space;if(vk(e))return ot.Word;for(let t=0;t<r.length;t++)if(e.indexOf(r[t])>-1)return ot.Word;return ot.Other}}class We{constructor(e,t,n,i,s,o){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)Gs(this,a<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Gs(this,n),Sa(this,n)}update(...e){return dp(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:i}=t;for(let o of e.effects)o.is(xa.reconfigure)?(t&&(i=new Map,t.compartments.forEach((a,l)=>i.set(l,a)),t=null),i.set(o.value.compartment,o.value.extension)):o.is(Ae.reconfigure)?(t=null,n=o.value):o.is(Ae.appendConfig)&&(t=null,n=Qi(n).concat(o.value));let s;t?s=e.startState.values.slice():(t=wa.resolve(n,i,this),s=new We(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,l)=>l.reconfigure(a,this),null).values),new We(t,e.newDoc,e.newSelection,s,(o,a)=>a.update(o,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:ie.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),s=[n.range],o=Qi(n.effects);for(let a=1;a<t.ranges.length;a++){let l=e(t.ranges[a]),c=this.changes(l.changes),u=c.map(i);for(let d=0;d<a;d++)s[d]=s[d].map(u);let h=i.mapDesc(c,!0);s.push(l.range.map(h)),i=i.compose(u),o=Ae.mapEffects(o,u).concat(Ae.mapEffects(Qi(l.effects),h))}return{changes:i,selection:ie.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof Et?e:Et.of(e,this.doc.length,this.facet(We.lineSeparator))}toText(e){return Qe.of(e.split(this.facet(We.lineSeparator)||Ac))}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:(Gs(this,t),Sa(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof kt&&this.config.address[i.id]!=null&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n){for(let s in n)if(Object.prototype.hasOwnProperty.call(e,s)){let o=n[s],a=e[s];i.push(o.init(l=>o.spec.fromJSON(a,l)))}}return We.create({doc:e.doc,selection:ie.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=wa.resolve(e.extensions||[],new Map),n=e.doc instanceof Qe?e.doc:Qe.of((e.doc||"").split(t.staticFacet(We.lineSeparator)||Ac)),i=e.selection?e.selection instanceof ie?e.selection:ie.single(e.selection.anchor,e.selection.head):ie.single(0);return tp(i,n.length),t.staticFacet(op)||(i=i.asSingle()),new We(t,n,i,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(We.tabSize)}get lineBreak(){return this.facet(We.lineSeparator)||`
|
|
144
|
+
`}get readOnly(){return this.facet(fp)}phrase(e,...t){for(let n of this.facet(We.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,i)=>{if(i=="$")return"$";let s=+(i||1);return!s||s>t.length?n:t[s-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let s of this.facet(sp))for(let o of s(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&i.push(o[e]);return i}charCategorizer(e){return yk(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-n,a=e-n;for(;o>0;){let l=Ut(t,o,!1);if(s(t.slice(l,o))!=ot.Word)break;o=l}for(;a<i;){let l=Ut(t,a);if(s(t.slice(a,l))!=ot.Word)break;a=l}return o==a?null:ie.range(o+n,a+n)}}We.allowMultipleSelections=op,We.tabSize=de.define({combine:r=>r.length?r[0]:4}),We.lineSeparator=ap,We.readOnly=fp,We.phrases=de.define({compare(r,e){let t=Object.keys(r),n=Object.keys(e);return t.length==n.length&&t.every(i=>r[i]==e[i])}}),We.languageData=sp,We.changeFilter=lp,We.transactionFilter=cp,We.transactionExtender=up,xa.reconfigure=Ae.define();function zr(r,e,t={}){let n={};for(let i of r)for(let s of Object.keys(i)){let o=i[s],a=n[s];if(a===void 0)n[s]=o;else if(!(a===o||o===void 0))if(Object.hasOwnProperty.call(t,s))n[s]=t[s](a,o);else throw new Error("Config merge conflict for field "+s)}for(let i in e)n[i]===void 0&&(n[i]=e[i]);return n}class wi{eq(e){return this==e}range(e,t=e){return Ks.create(e,t,this)}}wi.prototype.startSide=wi.prototype.endSide=0,wi.prototype.point=!1,wi.prototype.mapMode=rr.TrackDel;class Ks{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Ks(e,t,n)}}function Nc(r,e){return r.from-e.from||r.value.startSide-e.value.startSide}class Rc{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let s=n?this.to:this.from;for(let o=i,a=s.length;;){if(o==a)return o;let l=o+a>>1,c=s[l]-e||(n?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,n,i){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,s);s<o;s++)if(i(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t){let n=[],i=[],s=[],o=-1,a=-1;for(let l=0;l<this.value.length;l++){let c=this.value[l],u=this.from[l]+e,h=this.to[l]+e,d,p;if(u==h){let m=t.mapPos(u,c.startSide,c.mapMode);if(m==null||(d=p=m,c.startSide!=c.endSide&&(p=t.mapPos(u,c.endSide),p<d)))continue}else if(d=t.mapPos(u,c.startSide),p=t.mapPos(h,c.endSide),d>p||d==p&&c.startSide>0&&c.endSide<=0)continue;(p-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(a=Math.max(a,p-d)),n.push(c),i.push(d-o),s.push(p-o))}return{mapped:n.length?new Rc(i,s,n,a):null,pos:o}}}class Ge{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Ge(e,t,n,i)}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:n=!1,filterFrom:i=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(Nc)),this.isEmpty)return t.length?Ge.of(t):this;let a=new gp(this,null,-1).goto(0),l=0,c=[],u=new Un;for(;a.value||l<t.length;)if(l<t.length&&(a.from-t[l].from||a.startSide-t[l].value.startSide)>=0){let h=t[l++];u.addInner(h.from,h.to,h.value)||c.push(h)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(a.chunkIndex)<t[l].from)&&(!o||i>this.chunkEnd(a.chunkIndex)||s<this.chunkPos[a.chunkIndex])&&u.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!o||i>a.to||s<a.from||o(a.from,a.to,a.value))&&(u.addInner(a.from,a.to,a.value)||c.push(Ks.create(a.from,a.to,a.value))),a.next());return u.finishInner(this.nextLayer.isEmpty&&!c.length?Ge.empty:this.nextLayer.update({add:c,filter:o,filterFrom:i,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-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)i=Math.max(i,l.maxPoint),t.push(l),n.push(e.mapPos(a));else if(c===!0){let{mapped:u,pos:h}=l.map(a,e);u&&(i=Math.max(i,u.maxPoint),t.push(u),n.push(h))}}let s=this.nextLayer.map(e);return t.length==0?s:new Ge(n,t,s||Ge.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let s=this.chunkPos[i],o=this.chunk[i];if(t>=s&&e<=s+o.length&&o.between(s,e-s,t-s,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Ys.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Ys.from(e).goto(t)}static compare(e,t,n,i,s=-1){let o=e.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),a=t.filter(h=>h.maxPoint>0||!h.isEmpty&&h.maxPoint>=s),l=pp(o,a,n),c=new Js(o,l,s),u=new Js(a,l,s);n.iterGaps((h,d,p)=>mp(c,h,u,d,p,i)),n.empty&&n.length==0&&mp(c,0,u,0,0,i)}static eq(e,t,n=0,i){i==null&&(i=1e9-1);let s=e.filter(u=>!u.isEmpty&&t.indexOf(u)<0),o=t.filter(u=>!u.isEmpty&&e.indexOf(u)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let a=pp(s,o),l=new Js(s,a,0).goto(n),c=new Js(o,a,0).goto(n);for(;;){if(l.to!=c.to||!Bc(l.active,c.active)||l.point&&(!c.point||!l.point.eq(c.point)))return!1;if(l.to>i)return!0;l.next(),c.next()}}static spans(e,t,n,i,s=-1){let o=new Js(e,null,s).goto(t),a=t,l=o.openStart;for(;;){let c=Math.min(o.to,n);if(o.point){let u=o.activeForPoint(o.to),h=o.pointFrom<t?u.length+1:Math.min(u.length,l);i.point(a,c,o.point,u,h,o.pointRank),l=Math.min(o.openEnd(c),u.length)}else c>a&&(i.span(a,c,o.active,l),l=o.openEnd(c));if(o.to>n)return l+(o.point&&o.to>n?1:0);a=o.to,o.next()}}static of(e,t=!1){let n=new Un;for(let i of e instanceof Ks?[e]:t?bk(e):e)n.add(i.from,i.to,i.value);return n.finish()}}Ge.empty=new Ge([],[],null,-1);function bk(r){if(r.length>1)for(let e=r[0],t=1;t<r.length;t++){let n=r[t];if(Nc(e,n)>0)return r.slice().sort(Nc);e=n}return r}Ge.empty.nextLayer=Ge.empty;class Un{finishChunk(e){this.chunks.push(new Rc(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,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Un)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return i<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=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.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 n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ge.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ge.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function pp(r,e,t){let n=new Map;for(let s of r)for(let o=0;o<s.chunk.length;o++)s.chunk[o].maxPoint<=0&&n.set(s.chunk[o],s.chunkPos[o]);let i=new Set;for(let s of e)for(let o=0;o<s.chunk.length;o++){let a=n.get(s.chunk[o]);a!=null&&(t?t.mapPos(a):a)==s.chunkPos[o]&&!t?.touchesRange(a,a+s.chunk[o].length)&&i.add(s.chunk[o])}return i}class gp{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}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,n){for(;this.chunkIndex<this.layer.chunk.length;){let i=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(i)||this.layer.chunkEnd(this.chunkIndex)<e||i.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}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],n=e+t.from[this.rangeIndex];if(this.from=n,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}}class Ys{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let s=0;s<e.length;s++)for(let o=e[s];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&i.push(new gp(o,t,n,s));return i.length==1?i[0]:new Ys(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Lc(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Lc(this.heap,n);(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(),Lc(this.heap,0)}}}function Lc(r,e){for(let t=r[e];;){let n=(e<<1)+1;if(n>=r.length)break;let i=r[n];if(n+1<r.length&&i.compare(r[n+1])>=0&&(i=r[n+1],n++),t.compare(i)<0)break;r[n]=t,r[e]=i,e=n}}class Js{constructor(e,t,n){this.minPoint=n,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=Ys.from(e,t,n)}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){ka(this.active,e),ka(this.activeTo,e),ka(this.activeRank,e),this.minActive=vp(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:s}=this.cursor;for(;t<this.activeRank.length&&this.activeRank[t]<=s;)t++;Aa(this.active,t,n),Aa(this.activeTo,t,i),Aa(this.activeRank,t,s),e&&Aa(e,t,this.cursor.from),this.minActive=vp(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&ka(n,i)}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(n),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(n){this.openStart=0;for(let i=n.length-1;i>=0&&n[i]<e;i--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function mp(r,e,t,n,i,s){r.goto(e),t.goto(n);let o=n+i,a=n,l=n-e;for(;;){let c=r.to+l-t.to||r.endSide-t.endSide,u=c<0?r.to+l:t.to,h=Math.min(u,o);if(r.point||t.point?r.point&&t.point&&(r.point==t.point||r.point.eq(t.point))&&Bc(r.activeForPoint(r.to),t.activeForPoint(t.to))||s.comparePoint(a,h,r.point,t.point):h>a&&!Bc(r.active,t.active)&&s.compareRange(a,h,r.active,t.active),u>o)break;a=u,c<=0&&r.next(),c>=0&&t.next()}}function Bc(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!=e[t]&&!r[t].eq(e[t]))return!1;return!0}function ka(r,e){for(let t=e,n=r.length-1;t<n;t++)r[t]=r[t+1];r.pop()}function Aa(r,e,t){for(let n=r.length-1;n>=e;n--)r[n+1]=r[n];r[e]=t}function vp(r,e){let t=-1,n=1e9;for(let i=0;i<e.length;i++)(e[i]-n||r[i].endSide-r[t].endSide)<0&&(t=i,n=e[i]);return t}function Xi(r,e,t=r.length){let n=0;for(let i=0;i<t;)r.charCodeAt(i)==9?(n+=e-n%e,i++):(n++,i=Ut(r,i));return n}function Fc(r,e,t,n){for(let i=0,s=0;;){if(s>=e)return i;if(i==r.length)break;s+=r.charCodeAt(i)==9?t-s%t:1,i=Ut(r,i)}return n===!0?-1:r.length}const jc="\u037C",yp=typeof Symbol>"u"?"__"+jc:Symbol.for(jc),Vc=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),bp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Gn{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,a,l,c){let u=[],h=/^@(\w+)\b/.exec(o[0]),d=h&&h[1]=="keyframes";if(h&&a==null)return l.push(o[0]+";");for(let p in a){let m=a[p];if(/&/.test(p))s(p.split(/,\s*/).map(y=>o.map(w=>y.replace(/&/,w))).reduce((y,w)=>y.concat(w)),m,l);else if(m&&typeof m=="object"){if(!h)throw new RangeError("The value of a property ("+p+") should be a primitive value.");s(i(p),m,u,d)}else m!=null&&u.push(p.replace(/_.*/,"").replace(/[A-Z]/g,y=>"-"+y.toLowerCase())+": "+m+";")}(u.length||d)&&l.push((n&&!h&&!c?o.map(n):o).join(", ")+" {"+u.join(" ")+"}")}for(let o in e)s(i(o),e[o],this.rules)}getRules(){return this.rules.join(`
|
|
145
|
+
`)}static newName(){let e=bp[yp]||1;return bp[yp]=e+1,jc+e.toString(36)}static mount(e,t,n){let i=e[Vc],s=n&&n.nonce;i?s&&i.setNonce(s):i=new xk(e,s),i.mount(Array.isArray(t)?t:[t])}}let xp=new Map;class xk{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let s=xp.get(n);if(s)return e.adoptedStyleSheets=[s.sheet,...e.adoptedStyleSheets],e[Vc]=s;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],xp.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let s=e.head||e;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],e[Vc]=this}mount(e){let t=this.sheet,n=0,i=0;for(let s=0;s<e.length;s++){let o=e[s],a=this.modules.indexOf(o);if(a<i&&a>-1&&(this.modules.splice(a,1),i--,a=-1),a==-1){if(this.modules.splice(i++,0,o),t)for(let l=0;l<o.rules.length;l++)t.insertRule(o.rules[l],n++)}else{for(;i<a;)n+=this.modules[i++].rules.length;n+=o.rules.length,i++}}if(!t){let s="";for(let o=0;o<this.modules.length;o++)s+=this.modules[o].getRules()+`
|
|
146
|
+
`;this.styleTag.textContent=s}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Kn={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:"'"},Qs={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},wk=typeof navigator<"u"&&/Mac/.test(navigator.platform),Sk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Bt=0;Bt<10;Bt++)Kn[48+Bt]=Kn[96+Bt]=String(Bt);for(var Bt=1;Bt<=24;Bt++)Kn[Bt+111]="F"+Bt;for(var Bt=65;Bt<=90;Bt++)Kn[Bt]=String.fromCharCode(Bt+32),Qs[Bt]=String.fromCharCode(Bt);for(var Wc in Kn)Qs.hasOwnProperty(Wc)||(Qs[Wc]=Kn[Wc]);function kk(r){var e=wk&&r.metaKey&&r.shiftKey&&!r.ctrlKey&&!r.altKey||Sk&&r.shiftKey&&r.key&&r.key.length==1||r.key=="Unidentified",t=!e&&r.key||(r.shiftKey?Qs:Kn)[r.keyCode]||r.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 Ca(r){let e;return r.nodeType==11?e=r.getSelection?r:r.ownerDocument:e=r,e.getSelection()}function $c(r,e){return e?r==e||r.contains(e.nodeType!=1?e.parentNode:e):!1}function Ak(r){let e=r.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Oa(r,e){if(!e.anchorNode)return!1;try{return $c(r,e.anchorNode)}catch{return!1}}function Zi(r){return r.nodeType==3?Si(r,0,r.nodeValue.length).getClientRects():r.nodeType==1?r.getClientRects():[]}function Ea(r,e,t,n){return t?wp(r,e,t,n,-1)||wp(r,e,t,n,1):!1}function Xs(r){for(var e=0;;e++)if(r=r.previousSibling,!r)return e}function wp(r,e,t,n,i){for(;;){if(r==t&&e==n)return!0;if(e==(i<0?0:Cn(r))){if(r.nodeName=="DIV")return!1;let s=r.parentNode;if(!s||s.nodeType!=1)return!1;e=Xs(r)+(i<0?0:1),r=s}else if(r.nodeType==1){if(r=r.childNodes[e+(i<0?-1:0)],r.nodeType==1&&r.contentEditable=="false")return!1;e=i<0?Cn(r):0}else return!1}}function Cn(r){return r.nodeType==3?r.nodeValue.length:r.childNodes.length}function Ta(r,e){let t=e?r.left:r.right;return{left:t,right:t,top:r.top,bottom:r.bottom}}function Ck(r){return{left:0,right:r.innerWidth,top:0,bottom:r.innerHeight}}function Ok(r,e,t,n,i,s,o,a){let l=r.ownerDocument,c=l.defaultView||window;for(let u=r,h=!1;u&&!h;)if(u.nodeType==1){let d,p=u==l.body,m=1,y=1;if(p)d=Ck(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(h=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let T=u.getBoundingClientRect();m=T.width/u.offsetWidth,y=T.height/u.offsetHeight,d={left:T.left,right:T.left+u.clientWidth*m,top:T.top,bottom:T.top+u.clientHeight*y}}let w=0,A=0;if(i=="nearest")e.top<d.top?(A=-(d.top-e.top+o),t>0&&e.bottom>d.bottom+A&&(A=e.bottom-d.bottom+A+o)):e.bottom>d.bottom&&(A=e.bottom-d.bottom+o,t<0&&e.top-A<d.top&&(A=-(d.top+A-e.top+o)));else{let T=e.bottom-e.top,P=d.bottom-d.top;A=(i=="center"&&T<=P?e.top+T/2-P/2:i=="start"||i=="center"&&t<0?e.top-o:e.bottom-P+o)-d.top}if(n=="nearest"?e.left<d.left?(w=-(d.left-e.left+s),t>0&&e.right>d.right+w&&(w=e.right-d.right+w+s)):e.right>d.right&&(w=e.right-d.right+s,t<0&&e.left<d.left+w&&(w=-(d.left+w-e.left+s))):w=(n=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:n=="start"==a?e.left-s:e.right-(d.right-d.left)+s)-d.left,w||A)if(p)c.scrollBy(w,A);else{let T=0,P=0;if(A){let L=u.scrollTop;u.scrollTop+=A/y,P=(u.scrollTop-L)*y}if(w){let L=u.scrollLeft;u.scrollLeft+=w/m,T=(u.scrollLeft-L)*m}e={left:e.left-T,top:e.top-P,right:e.right-T,bottom:e.bottom-P},T&&Math.abs(T-w)<1&&(n="nearest"),P&&Math.abs(P-A)<1&&(i="nearest")}if(p)break;u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function Ek(r){let e=r.ownerDocument;for(let t=r.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}class Tk{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:n}=e;this.set(t,Math.min(e.anchorOffset,t?Cn(t):0),n,Math.min(e.focusOffset,n?Cn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let _i=null;function Sp(r){if(r.setActive)return r.setActive();if(_i)return r.focus(_i);let e=[];for(let t=r;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(r.focus(_i==null?{get preventScroll(){return _i={preventScroll:!0},!0}}:void 0),!_i){_i=!1;for(let t=0;t<e.length;){let n=e[t++],i=e[t++],s=e[t++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=s&&(n.scrollLeft=s)}}}let kp;function Si(r,e,t=e){let n=kp||(kp=document.createRange());return n.setEnd(r,t),n.setStart(r,e),n}function qi(r,e,t){let n={key:e,code:e,keyCode:t,which:t,cancelable:!0},i=new KeyboardEvent("keydown",n);i.synthetic=!0,r.dispatchEvent(i);let s=new KeyboardEvent("keyup",n);return s.synthetic=!0,r.dispatchEvent(s),i.defaultPrevented||s.defaultPrevented}function Pk(r){for(;r;){if(r&&(r.nodeType==9||r.nodeType==11&&r.host))return r;r=r.assignedSlot||r.parentNode}return null}function Ap(r){for(;r.attributes.length;)r.removeAttributeNode(r.attributes[0])}function Mk(r,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,Cn(t));;)if(n){if(t.nodeType!=1)return!1;let i=t.childNodes[n-1];i.contentEditable=="false"?n--:(t=i,n=Cn(t))}else{if(t==r)return!0;n=Xs(t),t=t.parentNode}}function Cp(r){return r.scrollTop>Math.max(1,r.scrollHeight-r.clientHeight-4)}class Kt{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Kt(e.parentNode,Xs(e),t)}static after(e,t){return new Kt(e.parentNode,Xs(e)+1,t)}}const Hc=[];class nt{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 n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(this.flags&2){let n=this.dom,i=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=i?i.nextSibling:n.firstChild)){let a=nt.get(s);(!a||!a.parent&&a.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(e,t),o.flags&=-8}if(s=i?i.nextSibling:n.firstChild,t&&!t.written&&t.node==n&&s!=o.dom&&(t.written=!0),o.dom.parentNode==n)for(;s&&s!=o.dom;)s=Op(s);else n.insertBefore(o.dom,s);i=o.dom}for(s=i?i.nextSibling:n.firstChild,s&&t&&t.node==n&&(t.written=!0);s;)s=Op(s)}else if(this.flags&1)for(let n of this.children)n.flags&7&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=Cn(e)==0?0:t==0?-1:1;for(;;){let s=e.parentNode;if(s==this.dom)break;i==0&&s.firstChild!=s.lastChild&&(e==s.firstChild?i=-1:i=1),e=s}i<0?n=e:n=e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!nt.get(n);)n=n.nextSibling;if(!n)return this.length;for(let i=0,s=0;;i++){let o=this.children[i];if(o.dom==n)return s;s+=o.length+o.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,s=-1,o=-1,a=-1;for(let l=0,c=n,u=n;l<this.children.length;l++){let h=this.children[l],d=c+h.length;if(c<e&&d>t)return h.domBoundsAround(e,t,c);if(d>=e&&i==-1&&(i=l,s=c),c>t&&h.dom.parentNode==this.dom){o=l,a=u;break}u=d,c=d+h.breakAfter}return{from:s,to:a<0?n+this.length:a,startDOM:(i?this.children[i-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,n=Hc){this.markDirty();for(let i=e;i<t;i++){let s=this.children[i];s.parent==this&&s.destroy()}this.children.splice(e,t-e,...n);for(let i=0;i<n.length;i++)n[i].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ep(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,n,i,s,o){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){this.parent=null}}nt.prototype.breakAfter=0;function Op(r){let e=r.nextSibling;return r.parentNode.removeChild(r),e}class Ep{constructor(e,t,n){this.children=e,this.pos=t,this.i=n,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 n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function Tp(r,e,t,n,i,s,o,a,l){let{children:c}=r,u=c.length?c[e]:null,h=s.length?s[s.length-1]:null,d=h?h.breakAfter:o;if(!(e==n&&u&&!o&&!d&&s.length<2&&u.merge(t,i,s.length?h:null,t==0,a,l))){if(n<c.length){let p=c[n];p&&(i<p.length||p.breakAfter&&h?.breakAfter)?(e==n&&(p=p.split(i),i=0),!d&&h&&p.merge(0,i,h,!0,0,l)?s[s.length-1]=p:((i||p.children.length&&!p.children[0].length)&&p.merge(0,i,null,!1,0,l),s.push(p))):p?.breakAfter&&(h?h.breakAfter=1:o=1),n++}for(u&&(u.breakAfter=o,t>0&&(!o&&s.length&&u.merge(t,u.length,s[0],!1,a,0)?u.breakAfter=s.shift().breakAfter:(t<u.length||u.children.length&&u.children[u.children.length-1].length==0)&&u.merge(t,u.length,null,!1,a,0),e++));e<n&&s.length;)if(c[n-1].become(s[s.length-1]))n--,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&&n<c.length&&!c[e-1].breakAfter&&c[n].merge(0,0,c[e-1],!1,a,l)&&e--,(e<n||s.length)&&r.replaceChildren(e,n,s)}}function Pp(r,e,t,n,i,s){let o=r.childCursor(),{i:a,off:l}=o.findPos(t,1),{i:c,off:u}=o.findPos(e,-1),h=e-t;for(let d of n)h+=d.length;r.length+=h,Tp(r,c,u,a,l,n,0,i,s)}let vr=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},zc=typeof document<"u"?document:{documentElement:{style:{}}};const Uc=/Edge\/(\d+)/.exec(vr.userAgent),Mp=/MSIE \d/.test(vr.userAgent),Gc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(vr.userAgent),Pa=!!(Mp||Gc||Uc),Ip=!Pa&&/gecko\/(\d+)/i.test(vr.userAgent),Kc=!Pa&&/Chrome\/(\d+)/.exec(vr.userAgent),Dp="webkitFontSmoothing"in zc.documentElement.style,Np=!Pa&&/Apple Computer/.test(vr.vendor),Rp=Np&&(/Mobile\/\w+/.test(vr.userAgent)||vr.maxTouchPoints>2);var ye={mac:Rp||/Mac/.test(vr.platform),windows:/Win/.test(vr.platform),linux:/Linux|X11/.test(vr.platform),ie:Pa,ie_version:Mp?zc.documentMode||6:Gc?+Gc[1]:Uc?+Uc[1]:0,gecko:Ip,gecko_version:Ip?+(/Firefox\/(\d+)/.exec(vr.userAgent)||[0,0])[1]:0,chrome:!!Kc,chrome_version:Kc?+Kc[1]:0,ios:Rp,android:/Android\b/.test(vr.userAgent),webkit:Dp,safari:Np,webkit_version:Dp?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:zc.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};const Ik=256;class On extends nt{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,n){return this.flags&8||n&&(!(n instanceof On)||this.length-(t-e)+n.length>Ik||n.flags&8)?!1:(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new On(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 Kt(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return Dk(this.dom,e,t)}}class En extends nt{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let i of t)i.setParent(this)}setAttrs(e){if(Ap(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,n,i,s,o){return n&&(!(n instanceof En&&n.mark.eq(this.mark))||e&&s<=0||t<this.length&&o<=0)?!1:(Pp(this,e,t,n?n.children:[],s-1,o-1),this.markDirty(),!0)}split(e){let t=[],n=0,i=-1,s=0;for(let a of this.children){let l=n+a.length;l>e&&t.push(n<e?a.split(e-n):a),i<0&&n>=e&&(i=s),n=l,s++}let o=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new En(this.mark,t,o)}domAtPos(e){return Lp(this,e)}coordsAt(e,t){return Fp(this,e,t)}}function Dk(r,e,t){let n=r.nodeValue.length;e>n&&(e=n);let i=e,s=e,o=0;e==0&&t<0||e==n&&t>=0?ye.chrome||ye.gecko||(e?(i--,o=1):s<n&&(s++,o=-1)):t<0?i--:s<n&&s++;let a=Si(r,i,s).getClientRects();if(!a.length)return null;let l=a[(o?o<0:t>=0)?0:a.length-1];return ye.safari&&!o&&l.width==0&&(l=Array.prototype.find.call(a,c=>c.width)||l),o?Ta(l,o<0):l||null}class Yn extends nt{static create(e,t,n){return new Yn(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Yn.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.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,n,i,s,o){return n&&(!(n instanceof Yn)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}become(e){return e instanceof Yn&&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 Qe.empty;let e=this;for(;e.parent;)e=e.parent;let{view:t}=e,n=t&&t.state.doc,i=this.posAtStart;return n?n.slice(i,i+this.length):Qe.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Kt.before(this.dom):Kt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),s=null;if(!i.length)return null;let o=this.side?this.side<0:e>0;for(let a=o?i.length-1:0;s=i[a],!(e>0?a==0:a==i.length-1||s.top<s.bottom);a+=o?-1:1);return Ta(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)}}class es extends nt{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof es&&e.side==this.side}split(){return new es(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?Kt.before(this.dom):Kt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Qe.empty}get isHidden(){return!0}}On.prototype.children=Yn.prototype.children=es.prototype.children=Hc;function Lp(r,e){let t=r.dom,{children:n}=r,i=0;for(let s=0;i<n.length;i++){let o=n[i],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=i;s>0;s--){let o=n[s-1];if(o.dom.parentNode==t)return o.domAtPos(o.length)}for(let s=i;s<n.length;s++){let o=n[s];if(o.dom.parentNode==t)return o.domAtPos(0)}return new Kt(t,0)}function Bp(r,e,t){let n,{children:i}=r;t>0&&e instanceof En&&i.length&&(n=i[i.length-1])instanceof En&&n.mark.eq(e.mark)?Bp(n,e.children[0],t-1):(i.push(e),e.setParent(r)),r.length+=e.length}function Fp(r,e,t){let n=null,i=-1,s=null,o=-1;function a(c,u){for(let h=0,d=0;h<c.children.length&&d<=u;h++){let p=c.children[h],m=d+p.length;m>=u&&(p.children.length?a(p,u-d):(!s||s.isHidden&&t>0)&&(m>u||d==m&&p.getSide()>0)?(s=p,o=u-d):(d<u||d==m&&p.getSide()<0&&!p.isHidden)&&(n=p,i=u-d)),d=m}}a(r,e);let l=(t<0?n:s)||n||s;return l?l.coordsAt(Math.max(0,l==n?i:o),t):Nk(r)}function Nk(r){let e=r.dom.lastChild;if(!e)return r.dom.getBoundingClientRect();let t=Zi(e);return t[t.length-1]||null}function Yc(r,e){for(let t in r)t=="class"&&e.class?e.class+=" "+r.class:t=="style"&&e.style?e.style+=";"+r.style:e[t]=r[t];return e}const jp=Object.create(null);function Jc(r,e,t){if(r==e)return!0;r||(r=jp),e||(e=jp);let n=Object.keys(r),i=Object.keys(e);if(n.length-(t&&n.indexOf(t)>-1?1:0)!=i.length-(t&&i.indexOf(t)>-1?1:0))return!1;for(let s of n)if(s!=t&&(i.indexOf(s)==-1||r[s]!==e[s]))return!1;return!0}function Qc(r,e,t){let n=!1;if(e)for(let i in e)t&&i in t||(n=!0,i=="style"?r.style.cssText="":r.removeAttribute(i));if(t)for(let i in t)e&&e[i]==t[i]||(n=!0,i=="style"?r.style.cssText=t[i]:r.setAttribute(i,t[i]));return n}function Rk(r){let e=Object.create(null);for(let t=0;t<r.attributes.length;t++){let n=r.attributes[t];e[n.name]=n.value}return e}class Pt extends nt{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,t,n,i,s,o){if(n){if(!(n instanceof Pt))return!1;this.dom||n.transferDOM(this)}return i&&this.setDeco(n?n.attrs:null),Pp(this,e,t,n?n.children:[],s,o),!0}split(e){let t=new Pt;if(t.breakAfter=this.breakAfter,this.length==0)return t;let{i:n,off:i}=this.childPos(e);i&&(t.append(this.children[n].split(i),0),this.children[n].merge(i,this.children[n].length,null,!1,0,0),n++);for(let s=n;s<this.children.length;s++)t.append(this.children[s],0);for(;n>0&&this.children[n-1].length==0;)this.children[--n].destroy();return this.children.length=n,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){Jc(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Bp(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Yc(t,this.attrs||{})),n&&(this.attrs=Yc({class:n},this.attrs||{}))}domAtPos(e){return Lp(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?this.flags&4&&(Ap(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&&(Qc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&nt.get(i)instanceof En;)i=i.lastChild;if(!i||!this.length||i.nodeName!="BR"&&((n=nt.get(i))===null||n===void 0?void 0:n.isEditable)==!1&&(!ye.ios||!this.children.some(s=>s instanceof On))){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 n of this.children){if(!(n instanceof On)||/[^ -~]/.test(n.text))return null;let i=Zi(n.dom);if(i.length!=1)return null;e+=i[0].width,t=i[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=Fp(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:i}=this.parent.view.viewState,s=n.bottom-n.top;if(Math.abs(s-i.lineHeight)<2&&i.textHeight<s){let o=(s-i.textHeight)/2;return{top:n.top+o,bottom:n.bottom-o,left:n.left,right:n.left}}}return n}become(e){return!1}covers(){return!0}static find(e,t){for(let n=0,i=0;n<e.children.length;n++){let s=e.children[n],o=i+s.length;if(o>=t){if(s instanceof Pt)return s;if(o>t)break}i=o+s.breakAfter}return null}}class Jn extends nt{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,s,o){return n&&(!(n instanceof Jn)||!this.widget.compare(n.widget)||e>0&&s<=0||t<this.length&&o<=0)?!1:(this.length=e+(n?n.length:0)+(this.length-t),!0)}domAtPos(e){return e==0?Kt.before(this.dom):Kt.after(this.dom,e==this.length)}split(e){let t=this.length-e;this.length=e;let n=new Jn(this.widget,t,this.deco);return n.breakAfter=this.breakAfter,n}get children(){return Hc}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.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):Qe.empty}domBoundsAround(){return null}become(e){return e instanceof Jn&&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:n}=this.deco;return t==n?!1:e<0?t<0:n>0}}class on{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,n){return null}get isHidden(){return!1}destroy(e){}}var nr=function(r){return r[r.Text=0]="Text",r[r.WidgetBefore=1]="WidgetBefore",r[r.WidgetAfter=2]="WidgetAfter",r[r.WidgetRange=3]="WidgetRange",r}(nr||(nr={}));class we extends wi{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Zs(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Qn(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,i;if(e.isBlockGap)n=-5e8,i=4e8;else{let{start:s,end:o}=Vp(e,t);n=(s?t?-3e8:-1:5e8)-1,i=(o?t?2e8:1:-6e8)+1}return new Qn(e,n,i,t,e.widget||null,!0)}static line(e){return new _s(e)}static set(e,t=!1){return Ge.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}we.none=Ge.empty;class Zs extends we{constructor(e){let{start:t,end:n}=Vp(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof Zs&&this.tagName==e.tagName&&(this.class||((t=this.attrs)===null||t===void 0?void 0:t.class))==(e.class||((n=e.attrs)===null||n===void 0?void 0:n.class))&&Jc(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)}}Zs.prototype.point=!1;class _s extends we{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _s&&this.spec.class==e.spec.class&&Jc(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)}}_s.prototype.mapMode=rr.TrackBefore,_s.prototype.point=!0;class Qn extends we{constructor(e,t,n,i,s,o){super(t,n,s,e),this.block=i,this.isReplace=o,this.mapMode=i?t<=0?rr.TrackBefore:rr.TrackAfter:rr.TrackDel}get type(){return this.startSide!=this.endSide?nr.WidgetRange:this.startSide<=0?nr.WidgetBefore:nr.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Qn&&Lk(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)}}Qn.prototype.point=!0;function Vp(r,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=r;return t==null&&(t=r.inclusive),n==null&&(n=r.inclusive),{start:t??e,end:n??e}}function Lk(r,e){return r==e||!!(r&&e&&r.compare(e))}function Xc(r,e,t,n=0){let i=t.length-1;i>=0&&t[i]+n>=r?t[i]=Math.max(t[i],e):t.push(r,e)}class qs{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,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 Jn&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Pt),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Ma(new es(-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 Jn)&&this.getLine()}buildText(e,t,n){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 i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(Ma(new On(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,s,o){if(this.disallowBlockEffectsFor[o]&&n instanceof Qn){if(n.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(n instanceof Qn)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Jn(n.widget||new Wp("div"),a,n));else{let l=Yn.create(n.widget||new Wp("span"),a,a?0:n.startSide),c=this.atCursorPos&&!l.isEditable&&s<=i.length&&(e<t||n.startSide>0),u=!l.isEditable&&(e<t||s>i.length||n.startSide<=0),h=this.getLine();this.pendingBuffer==2&&!c&&!l.isEditable&&(this.pendingBuffer=0),this.flushBuffer(i),c&&(h.append(Ma(new es(1),i),s),s=i.length+Math.max(0,s-i.length)),h.append(Ma(l,i),s),this.atCursorPos=u,this.pendingBuffer=u?e<t||s>i.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);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,n,i,s){let o=new qs(e,t,n,s);return o.openEnd=Ge.spans(i,t,n,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}}function Ma(r,e){for(let t of e)r=new En(t,[r],r.length);return r}class Wp extends on{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}}const $p=de.define(),Hp=de.define(),zp=de.define(),Up=de.define(),Zc=de.define(),Gp=de.define(),Kp=de.define(),Yp=de.define({combine:r=>r.some(e=>e)}),Jp=de.define({combine:r=>r.some(e=>e)});class Ia{constructor(e,t="nearest",n="nearest",i=5,s=5){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=s}map(e){return e.empty?this:new Ia(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const Qp=Ae.define({map:(r,e)=>r.map(e)});function Nr(r,e,t){let n=r.facet(Up);n.length?n[0](e):window.onerror?window.onerror(String(e),t,void 0,void 0,e):t?console.error(t+":",e):console.error(e)}const Da=de.define({combine:r=>r.length?r[0]:!0});let Bk=0;const eo=de.define();class ut{constructor(e,t,n,i,s){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=s(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:s,decorations:o}=t||{};return new ut(Bk++,e,n,i,a=>{let l=[eo.of(a)];return o&&l.push(to.of(c=>{let u=c.plugin(a);return u?o(u):we.none})),s&&l.push(s(a)),l})}static fromClass(e,t){return ut.define(n=>new e(n),t)}}class _c{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(n){if(Nr(t.state,n,"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){Nr(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(n){Nr(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Xp=de.define(),Na=de.define(),to=de.define(),qc=de.define(),Zp=de.define();function _p(r,e,t){let n=r.state.facet(Zp);if(!n.length)return n;let i=n.map(o=>o instanceof Function?o(r):o),s=[];return Ge.spans(i,e,t,{point(){},span(o,a,l,c){let u=s;for(let h=l.length-1;h>=0;h--,c--){let d=l[h].spec.bidiIsolate,p;if(d!=null)if(c>0&&u.length&&(p=u[u.length-1]).to==o&&p.direction==d)p.to=a,u=p.inner;else{let m={from:o,to:a,direction:d,inner:[]};u.push(m),u=m.inner}}}}),s}const qp=de.define();function eg(r){let e=0,t=0,n=0,i=0;for(let s of r.state.facet(qp)){let o=s(r);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:e,right:t,top:n,bottom:i}}const ro=de.define();class yr{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new yr(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,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let i=0,s=0,o=0,a=0;;i++){let l=i==e.length?null:e[i],c=o-a,u=l?l.fromB:1e9;for(;s<t.length&&t[s]<u;){let h=t[s],d=t[s+1],p=Math.max(a,h),m=Math.min(u,d);if(p<=m&&new yr(p+c,m+c,p,m).addToSet(n),d>u)break;s+=2}if(!l)return n;new yr(l.fromA,l.toA,l.fromB,l.toB).addToSet(n),o=l.toA,a=l.toB}}}class Ra{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Et.empty(this.startState.doc.length);for(let s of n)this.changes=this.changes.compose(s.changes);let i=[];this.changes.iterChangedRanges((s,o,a,l)=>i.push(new yr(s,o,a,l))),this.changedRanges=i}static create(e,t,n){return new Ra(e,t,n)}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}}var ft=function(r){return r[r.LTR=0]="LTR",r[r.RTL=1]="RTL",r}(ft||(ft={}));const no=ft.LTR,tg=ft.RTL;function rg(r){let e=[];for(let t=0;t<r.length;t++)e.push(1<<+r[t]);return e}const Fk=rg("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),jk=rg("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),eu=Object.create(null),an=[];for(let r of["()","[]","{}"]){let e=r.charCodeAt(0),t=r.charCodeAt(1);eu[e]=t,eu[t]=-e}function Vk(r){return r<=247?Fk[r]:1424<=r&&r<=1524?2:1536<=r&&r<=1785?jk[r-1536]:1774<=r&&r<=2220?4:8192<=r&&r<=8203?256:64336<=r&&r<=65023?4:r==8204?256:1}const Wk=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Xn{get dir(){return this.level%2?tg:no}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}static find(e,t,n,i){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==n)return o;(s<0||(i!=0?i<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 ng(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++){let n=r[t],i=e[t];if(n.from!=i.from||n.to!=i.to||n.direction!=i.direction||!ng(n.inner,i.inner))return!1}return!0}const qe=[];function $k(r,e,t,n,i){for(let s=0;s<=n.length;s++){let o=s?n[s-1].to:e,a=s<n.length?n[s].from:t,l=s?256:i;for(let c=o,u=l,h=l;c<a;c++){let d=Vk(r.charCodeAt(c));d==512?d=u:d==8&&h==4&&(d=16),qe[c]=d==4?2:d,d&7&&(h=d),u=d}for(let c=o,u=l,h=l;c<a;c++){let d=qe[c];if(d==128)c<a-1&&u==qe[c+1]&&u&24?d=qe[c]=u:qe[c]=256;else if(d==64){let p=c+1;for(;p<a&&qe[p]==64;)p++;let m=c&&u==8||p<t&&qe[p]==8?h==1?1:8:256;for(let y=c;y<p;y++)qe[y]=m;c=p-1}else d==8&&h==1&&(qe[c]=1);u=d,d&7&&(h=d)}}}function Hk(r,e,t,n,i){let s=i==1?2:1;for(let o=0,a=0,l=0;o<=n.length;o++){let c=o?n[o-1].to:e,u=o<n.length?n[o].from:t;for(let h=c,d,p,m;h<u;h++)if(p=eu[d=r.charCodeAt(h)])if(p<0){for(let y=a-3;y>=0;y-=3)if(an[y+1]==-p){let w=an[y+2],A=w&2?i:w&4?w&1?s:i:0;A&&(qe[h]=qe[an[y]]=A),a=y;break}}else{if(an.length==189)break;an[a++]=h,an[a++]=d,an[a++]=l}else if((m=qe[h])==2||m==1){let y=m==i;l=y?0:1;for(let w=a-3;w>=0;w-=3){let A=an[w+2];if(A&2)break;if(y)an[w+2]|=2;else{if(A&4)break;an[w+2]|=4}}}}}function zk(r,e,t,n){for(let i=0,s=n;i<=t.length;i++){let o=i?t[i-1].to:r,a=i<t.length?t[i].from:e;for(let l=o;l<a;){let c=qe[l];if(c==256){let u=l+1;for(;;)if(u==a){if(i==t.length)break;u=t[i++].to,a=i<t.length?t[i].from:e}else if(qe[u]==256)u++;else break;let h=s==1,d=(u<e?qe[u]:n)==1,p=h==d?h?1:2:n;for(let m=u,y=i,w=y?t[y-1].to:r;m>l;)m==w&&(m=t[--y].from,w=y?t[y-1].to:r),qe[--m]=p;l=u}else s=c,l++}}}function tu(r,e,t,n,i,s,o){let a=n%2?2:1;if(n%2==i%2)for(let l=e,c=0;l<t;){let u=!0,h=!1;if(c==s.length||l<s[c].from){let y=qe[l];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c<s.length&&m==s[c].from){if(h)break e;let y=s[c];if(!u)for(let w=y.to,A=c+1;;){if(w==t)break e;if(A<s.length&&s[A].from==w)w=s[A++].to;else{if(qe[w]==a)break e;break}}if(c++,d)d.push(y);else{y.from>l&&o.push(new Xn(l,y.from,p));let w=y.direction==no!=!(p%2);ru(r,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.to}m=y.to}else{if(m==t||(u?qe[m]!=a:qe[m]==a))break;m++}d?tu(r,l,m,n+1,i,d,o):l<m&&o.push(new Xn(l,m,p)),l=m}else for(let l=t,c=s.length;l>e;){let u=!0,h=!1;if(!c||l>s[c-1].to){let y=qe[l-1];y!=a&&(u=!1,h=y==16)}let d=!u&&a==1?[]:null,p=u?n:n+1,m=l;e:for(;;)if(c&&m==s[c-1].to){if(h)break e;let y=s[--c];if(!u)for(let w=y.from,A=c;;){if(w==e)break e;if(A&&s[A-1].to==w)w=s[--A].from;else{if(qe[w-1]==a)break e;break}}if(d)d.push(y);else{y.to<l&&o.push(new Xn(y.to,l,p));let w=y.direction==no!=!(p%2);ru(r,w?n+1:n,i,y.inner,y.from,y.to,o),l=y.from}m=y.from}else{if(m==e||(u?qe[m-1]!=a:qe[m-1]==a))break;m--}d?tu(r,m,l,n+1,i,d,o):m<l&&o.push(new Xn(m,l,p)),l=m}}function ru(r,e,t,n,i,s,o){let a=e%2?2:1;$k(r,i,s,n,a),Hk(r,i,s,n,a),zk(i,s,n,a),tu(r,i,s,e,t,n,o)}function ig(r,e,t){if(!r)return[new Xn(0,0,e==tg?1:0)];if(e==no&&!t.length&&!Wk.test(r))return sg(r.length);if(t.length)for(;r.length>qe.length;)qe[qe.length]=256;let n=[],i=e==no?0:1;return ru(r,i,i,t,0,r.length,n),n}function sg(r){return[new Xn(0,r,0)]}let og="";function ag(r,e,t,n,i){var s;let o=n.head-r.from,a=-1;if(o==0){if(!i||!r.length)return null;e[0].level!=t&&(o=e[0].side(!1,t),a=0)}else if(o==r.length){if(i)return null;let d=e[e.length-1];d.level!=t&&(o=d.side(!0,t),a=e.length-1)}a<0&&(a=Xn.find(e,o,(s=n.bidiLevel)!==null&&s!==void 0?s:-1,n.assoc));let l=e[a];o==l.side(i,t)&&(l=e[a+=i?1:-1],o=l.side(!i,t));let c=i==(l.dir==t),u=Ut(r.text,o,c);if(og=r.text.slice(Math.min(o,u),Math.max(o,u)),u!=l.side(i,t))return ie.cursor(u+r.from,c?-1:1,l.level);let h=a==(i?e.length-1:0)?null:e[a+(i?1:-1)];return!h&&l.level!=t?ie.cursor(i?r.to:r.from,i?-1:1,t):h&&h.level<l.level?ie.cursor(h.side(!i,t)+r.from,i?1:-1,h.level):ie.cursor(u+r.from,i?-1:1,l.level)}class lg extends nt{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,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 Pt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new yr(0,0,0,e.state.doc.length)],0,null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:c,toA:u})=>u<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);let i=-1;this.view.inputState.composing>=0&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?i=this.domChanged.newSel.head:!Xk(e.changes,this.hasComposition)&&!e.selectionSet&&(i=e.state.selection.main.head));let s=i>-1?Gk(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:c,to:u}=this.hasComposition;n=new yr(c,u,e.changes.mapPos(c,-1),e.changes.mapPos(u,1)).addToSet(n.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(ye.ie||ye.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,a=this.updateDeco(),l=Jk(o,a,e.changes);return n=yr.extendWithRanges(n,l),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ye.chrome||ye.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||i.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 Jn&&o.widget instanceof cg&&s.push(o.dom);i.updateGaps(s)}updateChildren(e,t,n){let i=n?n.range.addToSet(e.slice()):e,s=this.childCursor(t);for(let o=i.length-1;;o--){let a=o>=0?i[o]:null;if(!a)break;let{fromA:l,toA:c,fromB:u,toB:h}=a,d,p,m,y;if(n&&n.range.fromB<h&&n.range.toB>u){let L=qs.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),D=qs.build(this.view.state.doc,n.range.toB,h,this.decorations,this.dynamicDecorationMap);p=L.breakAtStart,m=L.openStart,y=D.openEnd;let j=this.compositionView(n);D.breakAtStart?j.breakAfter=1:D.content.length&&j.merge(j.length,j.length,D.content[0],!1,D.openStart,0)&&(j.breakAfter=D.content[0].breakAfter,D.content.shift()),L.content.length&&j.merge(0,0,L.content[L.content.length-1],!0,0,L.openEnd)&&L.content.pop(),d=L.content.concat(j).concat(D.content)}else({content:d,breakAtStart:p,openStart:m,openEnd:y}=qs.build(this.view.state.doc,u,h,this.decorations,this.dynamicDecorationMap));let{i:w,off:A}=s.findPos(c,1),{i:T,off:P}=s.findPos(l,-1);Tp(this,T,P,w,A,d,p,m,y)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new On(e.text.nodeValue);t.flags|=8;for(let{deco:i}of e.marks)t=new En(i,[t],t.length);let n=new Pt;return n.append(t,0),n}fixCompositionDOM(e){let t=(s,o)=>{o.flags|=8|(o.children.some(l=>l.flags&7)?1:0),this.markedForComposition.add(o);let a=nt.get(s);a&&a!=o&&(a.dom=null),o.setDOM(s)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let s=e.marks.length-1;s>=-1;s--)n=i.childPos(n.off,1),i=i.children[n.i],t(s>=0?e.marks[s].node:e.text,i)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,s=!i&&Oa(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||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(ye.gecko&&a.empty&&!this.hasComposition&&Uk(l)){let h=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(h,l.node.childNodes[l.offset]||null)),l=c=new Kt(h,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||!Ea(l.node,l.offset,u.anchorNode,u.anchorOffset)||!Ea(c.node,c.offset,u.focusNode,u.focusOffset))&&(this.view.observer.ignore(()=>{ye.android&&ye.chrome&&this.dom.contains(u.focusNode)&&Qk(u.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let h=Ca(this.view.root);if(h)if(a.empty){if(ye.gecko){let d=Kk(l.node,l.offset);if(d&&d!=3){let p=fg(l.node,l.offset,d==1?1:-1);p&&(l=new Kt(p.node,p.offset))}}h.collapse(l.node,l.offset),a.bidiLevel!=null&&h.caretBidiLevel!==void 0&&(h.caretBidiLevel=a.bidiLevel)}else if(h.extend){h.collapse(l.node,l.offset);try{h.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([l,c]=[c,l]),d.setEnd(c.node,c.offset),d.setStart(l.node,l.offset),h.removeAllRanges(),h.addRange(d)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(l,c)),this.impreciseAnchor=l.precise?null:new Kt(u.anchorNode,u.anchorOffset),this.impreciseHead=c.precise?null:new Kt(u.focusNode,u.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ca(e.root),{anchorNode:i,anchorOffset:s}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=Pt.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 u=this.domAtPos(t.head+t.assoc);n.collapse(u.node,u.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,s)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let i=e.offset;!n&&i<t.childNodes.length;i++){let s=nt.get(t.childNodes[i]);s instanceof Pt&&(n=s.domAtPos(0))}for(let i=e.offset-1;!n&&i>=0;i--){let s=nt.get(t.childNodes[i]);s instanceof Pt&&(n=s.domAtPos(s.length))}return n?new Kt(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let n=nt.get(t);if(n&&n.rootView==this)return n;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t<this.children.length-1;){let i=this.children[t];if(n<i.length||i instanceof Pt)break;t++,n=0}return this.children[t].domAtPos(n)}coordsAt(e,t){let n=null,i=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;c<=e&&(c<e||a.covers(-1))&&(l>e||a.covers(1))&&(!n||a instanceof Pt&&!(n instanceof Pt&&t>=0))&&(n=a,i=c),s=c}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof Pt))return null;for(;i.children.length;){let{i:a,off:l}=i.childPos(n,1);for(;;a++){if(a==i.children.length)return null;if((i=i.children[a]).length)break}n=l}if(!(i instanceof On))return null;let s=Ut(i.text,n);if(s==n)return null;let o=Si(i.dom,n,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:n,to:i}=e,s=this.view.contentDOM.clientWidth,o=s>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,a=-1,l=this.view.textDirection==ft.LTR;for(let c=0,u=0;u<this.children.length;u++){let h=this.children[u],d=c+h.length;if(d>i)break;if(c>=n){let p=h.dom.getBoundingClientRect();if(t.push(p.height),o){let m=h.dom.lastChild,y=m?Zi(m):[];if(y.length){let w=y[y.length-1],A=l?w.right-p.left:p.right-w.left;A>a&&(a=A,this.minWidth=s,this.minWidthFrom=c,this.minWidthTo=d)}}}c=d+h.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction=="rtl"?ft.RTL:ft.LTR}measureTextSize(){for(let s of this.children)if(s instanceof Pt){let o=s.measureTextSize();if(o)return o}let e=document.createElement("div"),t,n,i;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=Zi(e.firstChild)[0];t=e.getBoundingClientRect().height,n=s?s.width/27:7,i=s?s.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Ep(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let s=i==t.viewports.length?null:t.viewports[i],o=s?s.from-1:this.length;if(o>n){let a=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(we.replace({widget:new cg(a),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!s)break;n=s.to+1}return we.set(e)}updateDeco(){let e=this.view.state.facet(to).map((t,n)=>(this.dynamicDecorationMap[n]=typeof t=="function")?t(this.view):t);for(let t=e.length;t<e.length+3;t++)this.dynamicDecorationMap[t]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),i;if(!n)return;!t.empty&&(i=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,i.left),top:Math.min(n.top,i.top),right:Math.max(n.right,i.right),bottom:Math.max(n.bottom,i.bottom)});let s=eg(this.view),o={left:n.left-s.left,top:n.top-s.top,right:n.right+s.right,bottom:n.bottom+s.bottom};Ok(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==ft.LTR)}}function Uk(r){return r.node.nodeType==1&&r.node.firstChild&&(r.offset==0||r.node.childNodes[r.offset-1].contentEditable=="false")&&(r.offset==r.node.childNodes.length||r.node.childNodes[r.offset].contentEditable=="false")}class cg extends on{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}}function ug(r,e){let t=r.observer.selectionRange,n=t.focusNode&&fg(t.focusNode,t.focusOffset,0);if(!n)return null;let i=e-n.offset;return{from:i,to:i+n.node.nodeValue.length,node:n.node}}function Gk(r,e,t){let n=ug(r,t);if(!n)return null;let{node:i,from:s,to:o}=n,a=i.nodeValue;if(/[\n\r]/.test(a)||r.state.doc.sliceString(n.from,n.to)!=a)return null;let l=e.invertedDesc,c=new yr(l.mapPos(s),l.mapPos(o),s,o),u=[];for(let h=i.parentNode;;h=h.parentNode){let d=nt.get(h);if(d instanceof En)u.push({node:h,deco:d.mark});else{if(d instanceof Pt||h.nodeName=="DIV"&&h.parentNode==r.contentDOM)return{range:c,text:i,marks:u,line:h};if(h!=r.contentDOM)u.push({node:h,deco:new Zs({inclusive:!0,attributes:Rk(h),tagName:h.tagName.toLowerCase()})});else return null}}}function fg(r,e,t){if(t<=0)for(let n=r,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i>0)n=n.childNodes[i-1],i=Cn(n);else break}if(t>=0)for(let n=r,i=e;;){if(n.nodeType==3)return{node:n,offset:i};if(n.nodeType==1&&i<n.childNodes.length&&t>=0)n=n.childNodes[i],i=0;else break}return null}function Kk(r,e){return r.nodeType!=1?0:(e&&r.childNodes[e-1].contentEditable=="false"?1:0)|(e<r.childNodes.length&&r.childNodes[e].contentEditable=="false"?2:0)}let Yk=class{constructor(){this.changes=[]}compareRange(e,t){Xc(e,t,this.changes)}comparePoint(e,t){Xc(e,t,this.changes)}};function Jk(r,e,t){let n=new Yk;return Ge.compare(r,e,t,n),n.changes}function Qk(r,e){for(let t=r;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Xk(r,e){let t=!1;return e&&r.iterChangedRanges((n,i)=>{n<e.to&&i>e.from&&(t=!0)}),t}function Zk(r,e,t=1){let n=r.charCategorizer(e),i=r.doc.lineAt(e),s=e-i.from;if(i.length==0)return ie.cursor(e);s==0?t=1:s==i.length&&(t=-1);let o=s,a=s;t<0?o=Ut(i.text,s,!1):a=Ut(i.text,s);let l=n(i.text.slice(o,a));for(;o>0;){let c=Ut(i.text,o,!1);if(n(i.text.slice(c,o))!=l)break;o=c}for(;a<i.length;){let c=Ut(i.text,a);if(n(i.text.slice(a,c))!=l)break;a=c}return ie.range(o+i.from,a+i.from)}function _k(r,e){return e.left>r?e.left-r:Math.max(0,r-e.right)}function qk(r,e){return e.top>r?e.top-r:Math.max(0,r-e.bottom)}function nu(r,e){return r.top<e.bottom-1&&r.bottom>e.top+1}function hg(r,e){return e<r.top?{top:e,left:r.left,right:r.right,bottom:r.bottom}:r}function dg(r,e){return e>r.bottom?{top:r.top,left:r.left,right:r.right,bottom:e}:r}function iu(r,e,t){let n,i,s,o,a=!1,l,c,u,h;for(let m=r.firstChild;m;m=m.nextSibling){let y=Zi(m);for(let w=0;w<y.length;w++){let A=y[w];i&&nu(i,A)&&(A=hg(dg(A,i.bottom),i.top));let T=_k(e,A),P=qk(t,A);if(T==0&&P==0)return m.nodeType==3?pg(m,e,t):iu(m,e,t);if(!n||o>P||o==P&&s>T){n=m,i=A,s=T,o=P;let L=P?t<A.top?-1:1:T?e<A.left?-1:1:0;a=!L||(L>0?w<y.length-1:w>0)}T==0?t>A.bottom&&(!u||u.bottom<A.bottom)?(l=m,u=A):t<A.top&&(!h||h.top>A.top)&&(c=m,h=A):u&&nu(u,A)?u=dg(u,A.bottom):h&&nu(h,A)&&(h=hg(h,A.top))}}if(u&&u.bottom>=t?(n=l,i=u):h&&h.top<=t&&(n=c,i=h),!n)return{node:r,offset:0};let d=Math.max(i.left,Math.min(i.right,e));if(n.nodeType==3)return pg(n,d,t);if(a&&n.contentEditable!="false")return iu(n,d,t);let p=Array.prototype.indexOf.call(r.childNodes,n)+(e>=(i.left+i.right)/2?1:0);return{node:r,offset:p}}function pg(r,e,t){let n=r.nodeValue.length,i=-1,s=1e9,o=0;for(let a=0;a<n;a++){let l=Si(r,a,a+1).getClientRects();for(let c=0;c<l.length;c++){let u=l[c];if(u.top==u.bottom)continue;o||(o=e-u.left);let h=(u.top>t?u.top-t:t-u.bottom)-1;if(u.left-1<=e&&u.right+1>=e&&h<s){let d=e>=(u.left+u.right)/2,p=d;if((ye.chrome||ye.gecko)&&Si(r,a).getBoundingClientRect().left==u.right&&(p=!d),h<=0)return{node:r,offset:a+(p?1:0)};i=a+(p?1:0),s=h}}}return{node:r,offset:i>-1?i:o>0?r.nodeValue.length:0}}function gg(r,e,t,n=-1){var i,s;let o=r.contentDOM.getBoundingClientRect(),a=o.top+r.viewState.paddingTop,l,{docHeight:c}=r.viewState,{x:u,y:h}=e,d=h-a;if(d<0)return 0;if(d>c)return r.state.doc.length;for(let L=r.viewState.heightOracle.textHeight/2,D=!1;l=r.elementAtHeight(d),l.type!=nr.Text;)for(;d=n>0?l.bottom+L:l.top-L,!(d>=0&&d<=c);){if(D)return t?null:0;D=!0,n=-n}h=a+d;let p=l.from;if(p<r.viewport.from)return r.viewport.from==0?0:t?null:mg(r,o,l,u,h);if(p>r.viewport.to)return r.viewport.to==r.state.doc.length?r.state.doc.length:t?null:mg(r,o,l,u,h);let m=r.dom.ownerDocument,y=r.root.elementFromPoint?r.root:m,w=y.elementFromPoint(u,h);w&&!r.contentDOM.contains(w)&&(w=null),w||(u=Math.max(o.left+1,Math.min(o.right-1,u)),w=y.elementFromPoint(u,h),w&&!r.contentDOM.contains(w)&&(w=null));let A,T=-1;if(w&&((i=r.docView.nearest(w))===null||i===void 0?void 0:i.isEditable)!=!1){if(m.caretPositionFromPoint){let L=m.caretPositionFromPoint(u,h);L&&({offsetNode:A,offset:T}=L)}else if(m.caretRangeFromPoint){let L=m.caretRangeFromPoint(u,h);L&&({startContainer:A,startOffset:T}=L,(!r.contentDOM.contains(A)||ye.safari&&eA(A,T,u)||ye.chrome&&tA(A,T,u))&&(A=void 0))}}if(!A||!r.docView.dom.contains(A)){let L=Pt.find(r.docView,p);if(!L)return d>l.top+l.height/2?l.to:l.from;({node:A,offset:T}=iu(L.dom,u,h))}let P=r.docView.nearest(A);if(!P)return null;if(P.isWidget&&((s=P.dom)===null||s===void 0?void 0:s.nodeType)==1){let L=P.dom.getBoundingClientRect();return e.y<L.top||e.y<=L.bottom&&e.x<=(L.left+L.right)/2?P.posAtStart:P.posAtEnd}else return P.localPosFromDOM(A,T)+P.posAtStart}function mg(r,e,t,n,i){let s=Math.round((n-e.left)*r.defaultCharacterWidth);if(r.lineWrapping&&t.height>r.defaultLineHeight*1.5){let a=r.viewState.heightOracle.textHeight,l=Math.floor((i-t.top-(r.defaultLineHeight-a)*.5)/a);s+=l*r.viewState.heightOracle.lineLength}let o=r.state.sliceDoc(t.from,t.to);return t.from+Fc(o,s,r.state.tabSize)}function eA(r,e,t){let n;if(r.nodeType!=3||e!=(n=r.nodeValue.length))return!1;for(let i=r.nextSibling;i;i=i.nextSibling)if(i.nodeType!=1||i.nodeName!="BR")return!1;return Si(r,n-1,n).getBoundingClientRect().left>t}function tA(r,e,t){if(e!=0)return!1;for(let i=r;;){let s=i.parentNode;if(!s||s.nodeType!=1||s.firstChild!=i)return!1;if(s.classList.contains("cm-line"))break;i=s}let n=r.nodeType==1?r.getBoundingClientRect():Si(r,0,Math.max(r.nodeValue.length,1)).getBoundingClientRect();return t-n.left>5}function su(r,e){let t=r.lineBlockAt(e);if(Array.isArray(t.type)){for(let n of t.type)if(n.to>e||n.to==e&&(n.to==t.to||n.type==nr.Text))return n}return t}function rA(r,e,t,n){let i=su(r,e.head),s=!n||i.type!=nr.Text||!(r.lineWrapping||i.widgetLineBreaks)?null:r.coordsAtPos(e.assoc<0&&e.head>i.from?e.head-1:e.head);if(s){let o=r.dom.getBoundingClientRect(),a=r.textDirectionAt(i.from),l=r.posAtCoords({x:t==(a==ft.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(l!=null)return ie.cursor(l,t?-1:1)}return ie.cursor(t?i.to:i.from,t?-1:1)}function vg(r,e,t,n){let i=r.state.doc.lineAt(e.head),s=r.bidiSpans(i),o=r.textDirectionAt(i.from);for(let a=e,l=null;;){let c=ag(i,s,o,a,t),u=og;if(!c){if(i.number==(t?r.state.doc.lines:1))return a;u=`
|
|
147
|
+
`,i=r.state.doc.line(i.number+(t?1:-1)),s=r.bidiSpans(i),c=ie.cursor(t?i.from:i.to)}if(l){if(!l(u))return a}else{if(!n)return c;l=n(u)}a=c}}function nA(r,e,t){let n=r.state.charCategorizer(e),i=n(t);return s=>{let o=n(s);return i==ot.Space&&(i=o),i==o}}function iA(r,e,t,n){let i=e.head,s=t?1:-1;if(i==(t?r.state.doc.length:0))return ie.cursor(i,e.assoc);let o=e.goalColumn,a,l=r.contentDOM.getBoundingClientRect(),c=r.coordsAtPos(i,e.assoc||-1),u=r.documentTop;if(c)o==null&&(o=c.left-l.left),a=s<0?c.top:c.bottom;else{let p=r.viewState.lineBlockAt(i);o==null&&(o=Math.min(l.right-l.left,r.defaultCharacterWidth*(i-p.from))),a=(s<0?p.top:p.bottom)+u}let h=l.left+o,d=n??r.viewState.heightOracle.textHeight>>1;for(let p=0;;p+=10){let m=a+(d+p)*s,y=gg(r,{x:h,y:m},!1,s);if(m<l.top||m>l.bottom||(s<0?y<i:y>i)){let w=r.docView.coordsForChar(y),A=!w||m<w.top?-1:1;return ie.cursor(y,A,void 0,o)}}}function La(r,e,t){for(;;){let n=0;for(let i of r)i.between(e-1,e+1,(s,o,a)=>{if(e>s&&e<o){let l=n||t||(e-s<o-e?-1:1);e=l<0?s:o,n=l}});if(!n)return e}}function ou(r,e,t){let n=La(r.state.facet(qc).map(i=>i(r)),t.from,e.head>t.from?-1:1);return n==t.from?t:ie.cursor(n,n<t.from?1:-1)}class sA{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.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=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.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ye.safari&&e.contentDOM.addEventListener("input",()=>null),ye.gecko&&wA(e.contentDOM.ownerDocument)}handleEvent(e){!dA(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||this.runHandlers(e.type,e)}runHandlers(e,t){let n=this.handlers[e];if(n){for(let i of n.observers)i(this.view,t);for(let i of n.handlers){if(t.defaultPrevented)break;if(i(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=oA(e),n=this.handlers,i=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,a=n[s];a&&o!=!a.handlers.length&&(i.removeEventListener(s,this.handleEvent),a=null),a||i.addEventListener(s,this.handleEvent,{passive:o})}for(let s in n)s!="scroll"&&!t[s]&&i.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(e.keyCode!=27&&xg.indexOf(e.keyCode)<0&&(this.view.inputState.lastEscPress=0),ye.android&&ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=bg.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||aA.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(){let e=this.pendingIOSKey;return e?(this.pendingIOSKey=void 0,qi(this.view.contentDOM,e.key,e.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:ye.safari&&!ye.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.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function yg(r,e){return(t,n)=>{try{return e.call(r,n,t)}catch(i){Nr(t.state,i)}}}function oA(r){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of r){let i=n.spec;if(i&&i.domEventHandlers)for(let s in i.domEventHandlers){let o=i.domEventHandlers[s];o&&t(s).handlers.push(yg(n.value,o))}if(i&&i.domEventObservers)for(let s in i.domEventObservers){let o=i.domEventObservers[s];o&&t(s).observers.push(yg(n.value,o))}}for(let n in ln)t(n).handlers.push(ln[n]);for(let n in Ur)t(n).observers.push(Ur[n]);return e}const bg=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],aA="dthko",xg=[16,17,18,20,91,92,224,225],Ba=6;function Fa(r){return Math.max(0,r)*.7+8}function lA(r,e){return Math.max(Math.abs(r.clientX-e.clientX),Math.abs(r.clientY-e.clientY))}class cA{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=Ek(e.contentDOM),this.atoms=e.state.facet(qc).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(We.allowMultipleSelections)&&uA(e,t),this.dragging=hA(e,t)&&Mg(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&&lA(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,i=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=eg(this.view);e.clientX-o.left<=s.left+Ba?n=-Fa(s.left-e.clientX):e.clientX+o.right>=s.right-Ba&&(n=Fa(e.clientX-s.right)),e.clientY-o.top<=s.top+Ba?i=-Fa(s.top-e.clientY):e.clientY+o.bottom>=s.bottom-Ba&&(i=Fa(e.clientY-s.bottom)),this.setScrollSpeed(n,i)}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=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 n=0;n<e.ranges.length;n++){let i=e.ranges[n],s=null;if(i.empty){let o=La(this.atoms,i.from,0);o!=i.from&&(s=ie.cursor(o,-1))}else{let o=La(this.atoms,i.from,-1),a=La(this.atoms,i.to,1);(o!=i.from||a!=i.to)&&(s=ie.range(i.from==i.anchor?o:a,i.from==i.head?o:a))}s&&(t||(t=e.ranges.slice()),t[n]=s)}return t?ie.create(t,e.mainIndex):e}select(e){let{view:t}=this,n=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection)||n.main.assoc!=t.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function uA(r,e){let t=r.state.facet($p);return t.length?t[0](e):ye.mac?e.metaKey:e.ctrlKey}function fA(r,e){let t=r.state.facet(Hp);return t.length?t[0](e):ye.mac?!e.altKey:!e.ctrlKey}function hA(r,e){let{main:t}=r.state.selection;if(t.empty)return!1;let n=Ca(r.root);if(!n||n.rangeCount==0)return!0;let i=n.getRangeAt(0).getClientRects();for(let s=0;s<i.length;s++){let o=i[s];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function dA(r,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=r.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=nt.get(t))&&n.ignoreEvent(e))return!1;return!0}const ln=Object.create(null),Ur=Object.create(null),wg=ye.ie&&ye.ie_version<15||ye.ios&&ye.webkit_version<604;function pA(r){let e=r.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{r.focus(),t.remove(),Sg(r,t.value)},50)}function Sg(r,e){let{state:t}=r,n,i=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(au!=null&&t.selection.ranges.every(l=>l.empty)&&au==s.toString()){let l=-1;n=t.changeByRange(c=>{let u=t.doc.lineAt(c.from);if(u.from==l)return{range:c};l=u.from;let h=t.toText((o?s.line(i++).text:e)+t.lineBreak);return{changes:{from:u.from,insert:h},range:ie.cursor(c.from+h.length)}})}else o?n=t.changeByRange(l=>{let c=s.line(i++);return{changes:{from:l.from,to:l.to,insert:c.text},range:ie.cursor(l.from+c.length)}}):n=t.replaceSelection(s);r.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Ur.scroll=r=>{r.inputState.lastScrollTop=r.scrollDOM.scrollTop,r.inputState.lastScrollLeft=r.scrollDOM.scrollLeft},ln.keydown=(r,e)=>(r.inputState.setSelectionOrigin("select"),e.keyCode==27&&(r.inputState.lastEscPress=Date.now()),!1),Ur.touchstart=(r,e)=>{r.inputState.lastTouchTime=Date.now(),r.inputState.setSelectionOrigin("select.pointer")},Ur.touchmove=r=>{r.inputState.setSelectionOrigin("select.pointer")},ln.mousedown=(r,e)=>{if(r.observer.flush(),r.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of r.state.facet(zp))if(t=n(r,e),t)break;if(!t&&e.button==0&&(t=vA(r,e)),t){let n=!r.hasFocus;r.inputState.startMouseSelection(new cA(r,e,t,n)),n&&r.observer.ignore(()=>Sp(r.contentDOM));let i=r.inputState.mouseSelection;if(i)return i.start(e),i.dragging===!1}return!1};function kg(r,e,t,n){if(n==1)return ie.cursor(e,t);if(n==2)return Zk(r.state,e,t);{let i=Pt.find(r.docView,e),s=r.state.doc.lineAt(i?i.posAtEnd:e),o=i?i.posAtStart:s.from,a=i?i.posAtEnd:s.to;return a<r.state.doc.length&&a==s.to&&a++,ie.range(o,a)}}let Ag=(r,e)=>r>=e.top&&r<=e.bottom,Cg=(r,e,t)=>Ag(e,t)&&r>=t.left&&r<=t.right;function gA(r,e,t,n){let i=Pt.find(r.docView,e);if(!i)return 1;let s=e-i.posAtStart;if(s==0)return 1;if(s==i.length)return-1;let o=i.coordsAt(s,-1);if(o&&Cg(t,n,o))return-1;let a=i.coordsAt(s,1);return a&&Cg(t,n,a)?1:o&&Ag(n,o)?-1:1}function Og(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:t,bias:gA(r,t,e.clientX,e.clientY)}}const mA=ye.ie&&ye.ie_version<=11;let Eg=null,Tg=0,Pg=0;function Mg(r){if(!mA)return r.detail;let e=Eg,t=Pg;return Eg=r,Pg=Date.now(),Tg=!e||t>Date.now()-400&&Math.abs(e.clientX-r.clientX)<2&&Math.abs(e.clientY-r.clientY)<2?(Tg+1)%3:1}function vA(r,e){let t=Og(r,e),n=Mg(e),i=r.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),i=i.map(s.changes))},get(s,o,a){let l=Og(r,s),c,u=kg(r,l.pos,l.bias,n);if(t.pos!=l.pos&&!o){let h=kg(r,t.pos,t.bias,n),d=Math.min(h.from,u.from),p=Math.max(h.to,u.to);u=d<u.from?ie.range(d,p):ie.range(p,d)}return o?i.replaceRange(i.main.extend(u.from,u.to)):a&&n==1&&i.ranges.length>1&&(c=yA(i,l.pos))?c:a?i.addRange(u):ie.create([u])}}}function yA(r,e){for(let t=0;t<r.ranges.length;t++){let{from:n,to:i}=r.ranges[t];if(n<=e&&i>=e)return ie.create(r.ranges.slice(0,t).concat(r.ranges.slice(t+1)),r.mainIndex==t?0:r.mainIndex-(r.mainIndex>t?1:0))}return null}ln.dragstart=(r,e)=>{let{selection:{main:t}}=r.state,{mouseSelection:n}=r.inputState;return n&&(n.dragging=t),e.dataTransfer&&(e.dataTransfer.setData("Text",r.state.sliceDoc(t.from,t.to)),e.dataTransfer.effectAllowed="copyMove"),!1};function Ig(r,e,t,n){if(!t)return;let i=r.posAtCoords({x:e.clientX,y:e.clientY},!1),{mouseSelection:s}=r.inputState,o=n&&s&&s.dragging&&fA(r,e)?{from:s.dragging.from,to:s.dragging.to}:null,a={from:i,insert:t},l=r.state.changes(o?[o,a]:a);r.focus(),r.dispatch({changes:l,selection:{anchor:l.mapPos(i,-1),head:l.mapPos(i,1)},userEvent:o?"move.drop":"input.drop"})}ln.drop=(r,e)=>{if(!e.dataTransfer)return!1;if(r.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),i=0,s=()=>{++i==t.length&&Ig(r,e,n.filter(o=>o!=null).join(r.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)||(n[o]=a.result),s()},a.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return Ig(r,e,n,!0),!0}return!1},ln.paste=(r,e)=>{if(r.state.readOnly)return!0;r.observer.flush();let t=wg?null:e.clipboardData;return t?(Sg(r,t.getData("text/plain")||t.getData("text/uri-text")),!0):(pA(r),!1)};function bA(r,e){let t=r.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),r.focus()},50)}function xA(r){let e=[],t=[],n=!1;for(let i of r.selection.ranges)i.empty||(e.push(r.sliceDoc(i.from,i.to)),t.push(i));if(!e.length){let i=-1;for(let{from:s}of r.selection.ranges){let o=r.doc.lineAt(s);o.number>i&&(e.push(o.text),t.push({from:o.from,to:Math.min(r.doc.length,o.to+1)})),i=o.number}n=!0}return{text:e.join(r.lineBreak),ranges:t,linewise:n}}let au=null;ln.copy=ln.cut=(r,e)=>{let{text:t,ranges:n,linewise:i}=xA(r.state);if(!t&&!i)return!1;au=i?t:null,e.type=="cut"&&!r.state.readOnly&&r.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let s=wg?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(bA(r,t),!1)};const Dg=sn.define();function Ng(r,e){let t=[];for(let n of r.facet(Kp)){let i=n(r,e);i&&t.push(i)}return t?r.update({effects:t,annotations:Dg.of(!0)}):null}function Rg(r){setTimeout(()=>{let e=r.hasFocus;if(e!=r.inputState.notifiedFocused){let t=Ng(r.state,e);t?r.dispatch(t):r.update([])}},10)}Ur.focus=r=>{r.inputState.lastFocusTime=Date.now(),!r.scrollDOM.scrollTop&&(r.inputState.lastScrollTop||r.inputState.lastScrollLeft)&&(r.scrollDOM.scrollTop=r.inputState.lastScrollTop,r.scrollDOM.scrollLeft=r.inputState.lastScrollLeft),Rg(r)},Ur.blur=r=>{r.observer.clearSelectionRange(),Rg(r)},Ur.compositionstart=Ur.compositionupdate=r=>{r.inputState.compositionFirstChange==null&&(r.inputState.compositionFirstChange=!0),r.inputState.composing<0&&(r.inputState.composing=0)},Ur.compositionend=r=>{r.inputState.composing=-1,r.inputState.compositionEndedAt=Date.now(),r.inputState.compositionPendingKey=!0,r.inputState.compositionPendingChange=r.observer.pendingRecords().length>0,r.inputState.compositionFirstChange=null,ye.chrome&&ye.android?r.observer.flushSoon():r.inputState.compositionPendingChange?Promise.resolve().then(()=>r.observer.flush()):setTimeout(()=>{r.inputState.composing<0&&r.docView.hasComposition&&r.update([])},50)},Ur.contextmenu=r=>{r.inputState.lastContextMenu=Date.now()},ln.beforeinput=(r,e)=>{var t;let n;if(ye.chrome&&ye.android&&(n=bg.find(i=>i.inputType==e.inputType))&&(r.observer.delayAndroidKey(n.key,n.keyCode),n.key=="Backspace"||n.key=="Delete")){let i=((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)>i+10&&r.hasFocus&&(r.contentDOM.blur(),r.focus())},100)}return!1};const Lg=new Set;function wA(r){Lg.has(r)||(Lg.add(r),r.addEventListener("copy",()=>{}),r.addEventListener("cut",()=>{}))}const Bg=["pre-wrap","normal","pre-line","break-spaces"];class Fg{constructor(e){this.lineWrapping=e,this.doc=Qe.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}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 Bg.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(i*10)]||(t=!0,this.heightSamples[Math.floor(i*10)]=!0)}return t}refresh(e,t,n,i,s,o){let a=Bg.indexOf(e)>-1,l=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=a;if(this.lineWrapping=a,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=s,l){this.heightSamples={};for(let c=0;c<o.length;c++){let u=o[c];u<0?c++:this.heightSamples[Math.floor(u*10)]=!0}}return l}}class jg{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class cn{constructor(e,t,n,i,s){this.from=e,this.length=t,this.top=n,this.height=i,this._content=s}get type(){return typeof this._content=="number"?nr.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 Qn?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 cn(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var tt=function(r){return r[r.ByPos=0]="ByPos",r[r.ByHeight=1]="ByHeight",r[r.ByPosNoHeight=2]="ByPosNoHeight",r}(tt||(tt={}));const ja=.001;class Yt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}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)>ja&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return Yt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let s=this,o=n.doc;for(let a=i.length-1;a>=0;a--){let{fromA:l,toA:c,fromB:u,toB:h}=i[a],d=s.lineAt(l,tt.ByPosNoHeight,n.setDoc(t),0,0),p=d.to>=c?d:s.lineAt(c,tt.ByPosNoHeight,n,0,0);for(h+=p.to-c,c=p.to;a>0&&d.from<=i[a-1].toA;)l=i[a-1].fromA,u=i[a-1].fromB,a--,l<d.from&&(d=s.lineAt(l,tt.ByPosNoHeight,n,0,0));u+=d.from-l,l=d.from;let m=lu.build(n.setDoc(o),e,u,h);s=s.replace(l,c,m)}return s.updateHeight(n,0)}static empty(){return new br(0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,i=0,s=0;for(;;)if(t==n)if(i>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),n+=1+a.break,i-=a.size}else if(s>i*2){let a=e[n];a.break?e.splice(n,1,a.left,null,a.right):e.splice(n,1,a.left,a.right),n+=2+a.break,s-=a.size}else break;else if(i<s){let a=e[t++];a&&(i+=a.size)}else{let a=e[--n];a&&(s+=a.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new SA(Yt.of(e.slice(0,t)),o,Yt.of(e.slice(n)))}}Yt.prototype.size=1;class Vg extends Yt{constructor(e,t,n){super(e,t),this.deco=n}blockAt(e,t,n,i){return new cn(i,this.length,n,this.height,this.deco||0)}lineAt(e,t,n,i,s){return this.blockAt(0,n,i,s)}forEachLine(e,t,n,i,s,o){e<=s+this.length&&t>=s&&o(this.blockAt(0,n,i,s))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class br extends Vg{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new cn(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return n.length==1&&(i instanceof br||i instanceof Ft&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Ft?i=new br(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Yt.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(e,i.heights[i.index++]):(n||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:""})`}}class Ft extends Yt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,i=e.doc.lineAt(t+this.length).number,s=i-n+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:n,lastLine:i,perLine:o,perChar:a}}blockAt(e,t,n,i){let{firstLine:s,lastLine:o,perLine:a,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let c=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),u=t.doc.lineAt(c),h=a+u.length*l,d=Math.max(n,e-h/2);return new cn(u.from,u.length,d,h,0)}else{let c=Math.max(0,Math.min(o-s,Math.floor((e-n)/a))),{from:u,length:h}=t.doc.line(s+c);return new cn(u,h,n+a*c,a,0)}}lineAt(e,t,n,i,s){if(t==tt.ByHeight)return this.blockAt(e,n,i,s);if(t==tt.ByPosNoHeight){let{from:p,to:m}=n.doc.lineAt(e);return new cn(p,m-p,0,0,0)}let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,s),c=n.doc.lineAt(e),u=a+c.length*l,h=c.number-o,d=i+a*h+l*(c.from-s-h);return new cn(c.from,c.length,Math.max(i,Math.min(d,i+this.height-u)),u,0)}forEachLine(e,t,n,i,s,o){e=Math.max(e,s),t=Math.min(t,s+this.length);let{firstLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);for(let u=e,h=i;u<=t;){let d=n.doc.lineAt(u);if(u==e){let m=d.number-a;h+=l*m+c*(e-s-m)}let p=l+c*d.length;o(new cn(d.from,d.length,h,p,0)),h+=p,u=d.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let s=n[n.length-1];s instanceof Ft?n[n.length-1]=new Ft(s.length+i):n.push(null,new Ft(i-1))}if(e>0){let s=n[0];s instanceof Ft?n[0]=new Ft(e+s.length):n.unshift(new Ft(e-1),null)}return Yt.of(n)}decomposeLeft(e,t){t.push(new Ft(e-1),null)}decomposeRight(e,t){t.push(null,new Ft(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let s=t+this.length;if(i&&i.from<=t+this.length&&i.more){let o=[],a=Math.max(t,i.from),l=-1;for(i.from>t&&o.push(new Ft(i.from-t-1).updateHeight(e,t));a<=s&&i.more;){let u=e.doc.lineAt(a).length;o.length&&o.push(null);let h=i.heights[i.index++];l==-1?l=h:Math.abs(h-l)>=ja&&(l=-2);let d=new br(u,h);d.outdated=!1,o.push(d),a+=u+1}a<=s&&o.push(null,new Ft(s-a).updateHeight(e,a));let c=Yt.of(o);return(l<0||Math.abs(c.height-this.height)>=ja||Math.abs(l-this.heightMetrics(e,t).perLine)>=ja)&&(e.heightChanged=!0),c}else(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class SA extends Yt{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,i){let s=n+this.left.height;return e<s?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,s,i+this.left.length+this.break)}lineAt(e,t,n,i,s){let o=i+this.left.height,a=s+this.left.length+this.break,l=t==tt.ByHeight?e<o:e<a,c=l?this.left.lineAt(e,t,n,i,s):this.right.lineAt(e,t,n,o,a);if(this.break||(l?c.to<a:c.from>a))return c;let u=t==tt.ByPosNoHeight?tt.ByPosNoHeight:tt.ByPos;return l?c.join(this.right.lineAt(a,u,n,o,a)):this.left.lineAt(a,u,n,i,s).join(c)}forEachLine(e,t,n,i,s,o){let a=i+this.left.height,l=s+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,s,o),t>=l&&this.right.forEachLine(e,t,n,a,l,o);else{let c=this.lineAt(l,tt.ByPos,n,i,s);e<c.from&&this.left.forEachLine(e,c.from-1,n,i,s,o),c.to>=e&&c.from<=t&&o(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,a,l,o)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let a of n)s.push(a);if(e>0&&Wg(s,o-1),t<this.length){let a=s.length;this.decomposeRight(t,s),Wg(s,a)}return Yt.of(s)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Yt.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,n=!1,i){let{left:s,right:o}=this,a=t+s.length+this.break,l=null;return i&&i.from<=t+s.length&&i.more?l=s=s.updateHeight(e,t,n,i):s.updateHeight(e,t,n),i&&i.from<=a+o.length&&i.more?l=o=o.updateHeight(e,a,n,i):o.updateHeight(e,a,n),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 Wg(r,e){let t,n;r[e]==null&&(t=r[e-1])instanceof Ft&&(n=r[e+1])instanceof Ft&&r.splice(e-1,3,new Ft(t.length+1+n.length))}const kA=5;class lu{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 n=Math.min(t,this.lineEnd),i=this.nodes[this.nodes.length-1];i instanceof br?i.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new br(n-this.pos,-1)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,s=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new Vg(o,i,n)):(o||s||i>=kA)&&this.addLineDeco(i,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 br(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Ft(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof br)return e;let t=new br(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,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof br)&&!this.isCovered?this.nodes.push(new br(0,-1)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let i of this.nodes)i instanceof br&&i.updateHeight(this.oracle,n),n+=i?i.length:1;return this.nodes}static build(e,t,n,i){let s=new lu(n,e);return Ge.spans(t,n,i,s,0),s.finish(n)}}function AA(r,e,t){let n=new CA;return Ge.compare(r,e,t,n,0),n.changes}class CA{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&Xc(e,t,this.changes,5)}}function OA(r,e){let t=r.getBoundingClientRect(),n=r.ownerDocument,i=n.defaultView||window,s=Math.max(0,t.left),o=Math.min(i.innerWidth,t.right),a=Math.max(0,t.top),l=Math.min(i.innerHeight,t.bottom);for(let c=r.parentNode;c&&c!=n.body;)if(c.nodeType==1){let u=c,h=window.getComputedStyle(u);if((u.scrollHeight>u.clientHeight||u.scrollWidth>u.clientWidth)&&h.overflow!="visible"){let d=u.getBoundingClientRect();s=Math.max(s,d.left),o=Math.min(o,d.right),a=Math.max(a,d.top),l=c==r.parentNode?d.bottom:Math.min(l,d.bottom)}c=h.position=="absolute"||h.position=="fixed"?u.offsetParent:u.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 EA(r,e){let t=r.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class cu{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],s=t[n];if(i.from!=s.from||i.to!=s.to||i.size!=s.size)return!1}return!0}draw(e,t){return we.replace({widget:new TA(this.size*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class TA extends on{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}}class $g{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=!0,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Hg,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=ft.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(Na).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new Fg(t),this.stateDeco=e.facet(to).filter(n=>typeof n!="function"),this.heightMap=Yt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle.setDoc(e.doc),[new yr(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=we.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:s,to:o})=>i>=s&&i<=o)){let{from:s,to:o}=this.lineBlockAt(i);e.push(new Va(s,o))}}this.viewports=e.sort((n,i)=>n.from-i.from),this.scaler=this.heightMap.height<=7e6?Hg:new IA(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:io(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(to).filter(u=>typeof u!="function");let i=e.changedRanges,s=yr.extendWithRanges(i,AA(n,this.stateDeco,e?e.changes:Et.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=!e.changes.empty||e.flags&2||l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,this.updateForViewport(),c&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&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(Jp)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,s=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?ft.RTL:ft.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,u=0;if(a.width&&a.height){let L=a.width/t.offsetWidth,D=a.height/t.offsetHeight;(L>.995&&L<1.005||!isFinite(L)||Math.abs(a.width-t.offsetWidth)<1)&&(L=1),(D>.995&&D<1.005||!isFinite(D)||Math.abs(a.height-t.offsetHeight)<1)&&(D=1),(this.scaleX!=L||this.scaleY!=D)&&(this.scaleX=L,this.scaleY=D,c|=8,o=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=h||this.paddingBottom!=d)&&(this.paddingTop=h,this.paddingBottom=d,c|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=8);let p=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=p&&(this.scrollAnchorHeight=-1,this.scrollTop=p),this.scrolledToBottom=Cp(e.scrollDOM);let m=(this.printing?EA:OA)(t,this.paddingTop),y=m.top-this.pixelViewport.top,w=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget)return 0;let T=a.width;if((this.contentDOMWidth!=T||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=a.width,this.editorHeight=e.scrollDOM.clientHeight,c|=8),l){let L=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(L)&&(o=!0),o||i.lineWrapping&&Math.abs(T-this.contentDOMWidth)>i.charWidth){let{lineHeight:D,charWidth:j,textHeight:W}=e.docView.measureTextSize();o=D>0&&i.refresh(s,D,j,W,T/j,L),o&&(e.docView.minWidth=0,c|=8)}y>0&&w>0?u=Math.max(y,w):y<0&&w<0&&(u=Math.min(y,w)),i.heightChanged=!1;for(let D of this.viewports){let j=D.from==this.viewport.from?L:e.docView.measureVisibleLineHeights(D);this.heightMap=(o?Yt.empty().applyChanges(this.stateDeco,Qe.empty,this.heightOracle,[new yr(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,o,new jg(D.from,j))}i.heightChanged&&(c|=2)}let P=!this.viewportIsAppropriate(this.viewport,u)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return P&&(this.viewport=this.getViewport(u,this.scrollTarget)),this.updateForViewport(),(c&2||P)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>2e3<<1)&&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 n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:a}=this,l=new Va(i.lineAt(o-n*1e3,tt.ByHeight,s,0,0).from,i.lineAt(a+(1-n)*1e3,tt.ByHeight,s,0,0).to);if(t){let{head:c}=t.range;if(c<l.from||c>l.to){let u=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),h=i.lineAt(c,tt.ByPos,s,0,0),d;t.y=="center"?d=(h.top+h.bottom)/2-u/2:t.y=="start"||t.y=="nearest"&&c<l.from?d=h.top:d=h.bottom-u,l=new Va(i.lineAt(d-1e3/2,tt.ByHeight,s,0,0).from,i.lineAt(d+u+1e3/2,tt.ByHeight,s,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Va(this.heightMap.lineAt(n,tt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,tt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),{bottom:s}=this.heightMap.lineAt(t,tt.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:a}=this;return(e==0||i<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||s>=a+Math.max(10,Math.min(n,250)))&&i>o-2*1e3&&s<a+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new cu(t.mapPos(i.from),t.mapPos(i.to),i.size));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,s=i>>1,o=i<<1;if(this.defaultTextDirection!=ft.LTR&&!n)return[];let a=[],l=(c,u,h,d)=>{if(u-c<s)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let w of m)if(w>c&&w<u){l(c,w-10,h,d),l(w+10,u,h,d);return}let y=MA(e,w=>w.from>=h.from&&w.to<=h.to&&Math.abs(w.from-c)<s&&Math.abs(w.to-u)<s&&!m.some(A=>w.from<A&&w.to>A));if(!y){if(u<h.to&&t&&n&&t.visibleRanges.some(w=>w.from<=u&&w.to>=u)){let w=t.moveToLineBoundary(ie.cursor(u),!1,!0).head;w>c&&(u=w)}y=new cu(c,u,this.gapSize(h,c,u,d))}a.push(y)};for(let c of this.viewportLines){if(c.length<o)continue;let u=PA(c.from,c.to,this.stateDeco);if(u.total<o)continue;let h=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(n){let m=i/this.heightOracle.lineLength*this.heightOracle.lineHeight,y,w;if(h!=null){let A=$a(u,h),T=((this.visibleBottom-this.visibleTop)/2+m)/c.height;y=A-T,w=A+T}else y=(this.visibleTop-c.top-m)/c.height,w=(this.visibleBottom-c.top+m)/c.height;d=Wa(u,y),p=Wa(u,w)}else{let m=u.total*this.heightOracle.charWidth,y=i*this.heightOracle.charWidth,w,A;if(h!=null){let T=$a(u,h),P=((this.pixelViewport.right-this.pixelViewport.left)/2+y)/m;w=T-P,A=T+P}else w=(this.pixelViewport.left-y)/m,A=(this.pixelViewport.right+y)/m;d=Wa(u,w),p=Wa(u,A)}d>c.from&&l(c.from,d,c,u),p<c.to&&l(p,c.to,c,u)}return a}gapSize(e,t,n,i){let s=$a(i,n)-$a(i,t);return this.heightOracle.lineWrapping?e.height*s:i.total*this.heightOracle.charWidth*s}updateLineGaps(e){cu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=we.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=[];Ge.spans(e,this.viewport.from,this.viewport.to,{span(i,s){t.push({from:i,to:s})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some((i,s)=>i.from!=t[s].from||i.to!=t[s].to);return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||io(this.heightMap.lineAt(e,tt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return io(this.heightMap.lineAt(this.scaler.fromDOM(e),tt.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 io(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}}class Va{constructor(e,t){this.from=e,this.to=t}}function PA(r,e,t){let n=[],i=r,s=0;return Ge.spans(t,r,e,{span(){},point(o,a){o>i&&(n.push({from:i,to:o}),s+=o-i),i=a}},20),i<e&&(n.push({from:i,to:e}),s+=e-i),{total:s,ranges:n}}function Wa({total:r,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(r*t);for(let i=0;;i++){let{from:s,to:o}=e[i],a=o-s;if(n<=a)return s+n;n-=a}}function $a(r,e){let t=0;for(let{from:n,to:i}of r.ranges){if(e<=i){t+=e-n;break}t+=i-n}return t/r.total}function MA(r,e){for(let t of r)if(e(t))return t}const Hg={toDOM(r){return r},fromDOM(r){return r},scale:1};class IA{constructor(e,t,n){let i=0,s=0,o=0;this.viewports=n.map(({from:a,to:l})=>{let c=t.lineAt(a,tt.ByPos,e,0,0).top,u=t.lineAt(l,tt.ByPos,e,0,0).bottom;return i+=u-c,{from:a,to:l,top:c,bottom:u,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);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,n=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.top)return i+(e-n)*this.scale;if(e<=s.bottom)return s.domTop+(e-s.top);n=s.bottom,i=s.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let s=t<this.viewports.length?this.viewports[t]:null;if(!s||e<s.domTop)return n+(e-i)/this.scale;if(e<=s.domBottom)return s.top+(e-s.domTop);n=s.bottom,i=s.domBottom}}}function io(r,e){if(e.scale==1)return r;let t=e.toDOM(r.top),n=e.toDOM(r.bottom);return new cn(r.from,r.length,t,n-t,Array.isArray(r._content)?r._content.map(i=>io(i,e)):r._content)}const Ha=de.define({combine:r=>r.join(" ")}),uu=de.define({combine:r=>r.indexOf(!0)>-1}),fu=Gn.newName(),zg=Gn.newName(),Ug=Gn.newName(),Gg={"&light":"."+zg,"&dark":"."+Ug};function hu(r,e,t){return new Gn(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,i=>{if(i=="&")return r;if(!t||!t[i])throw new RangeError(`Unsupported selector: ${i}`);return t[i]}):r+" "+n}})}const DA=hu("."+fu,{"&":{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"},"&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"}},Gg),so="\uFFFF";class NA{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(We.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=so}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let s=this.text.length;this.readNode(i);let o=i.nextSibling;if(o==t)break;let a=nt.get(i),l=nt.get(o);(a&&l?a.breakAfter:(a?a.breakAfter:Kg(i))||Kg(o)&&(i.nodeName!="BR"||i.cmIgnore)&&this.text.length>s)&&this.lineBreak(),i=o}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,a;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(a=i.exec(t))&&(s=a.index,o=a[0].length),this.append(t.slice(n,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);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=nt.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let i=n.iter();!i.next().done;)i.lineBreak?this.lineBreak():this.append(i.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 n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(RA(e,n.node,n.offset)?t:0))}}function RA(r,e,t){for(;;){if(!e||t<Cn(e))return!1;if(e==r)return!0;t=Xs(e)+1,e=e.parentNode}}function Kg(r){return r.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(r.nodeName)}class Yg{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class LA{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="";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,n,0))){let a=s||o?[]:jA(e),l=new NA(a,e.state);l.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=l.text,this.newSel=VA(a,this.bounds.from)}else{let a=e.observer.selectionRange,l=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!$c(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||!$c(e.contentDOM,a.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset);this.newSel=ie.single(c,l)}}}function Jg(r,e){let t,{newSel:n}=e,i=r.state.selection.main,s=r.inputState.lastKeyTime>Date.now()-100?r.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:a}=e.bounds,l=i.from,c=null;(s===8||ye.android&&e.text.length<a-o)&&(l=i.to,c="end");let u=FA(r.state.doc.sliceString(o,a,so),e.text,l-o,c);u&&(ye.chrome&&s==13&&u.toB==u.from+2&&e.text.slice(u.from,u.toB)==so+so&&u.toB--,t={from:o+u.from,to:o+u.toA,insert:Qe.of(e.text.slice(u.from,u.toB).split(so))})}else n&&(!r.hasFocus&&r.state.facet(Da)||n.main.eq(i))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!i.empty&&n&&n.main.empty?t={from:i.from,to:i.to,insert:r.state.doc.slice(i.from,i.to)}:t&&t.from>=i.from&&t.to<=i.to&&(t.from!=i.from||t.to!=i.to)&&i.to-i.from-(t.to-t.from)<=4?t={from:i.from,to:i.to,insert:r.state.doc.slice(i.from,t.from).append(t.insert).append(r.state.doc.slice(t.to,i.to))}:(ye.mac||ye.android)&&t&&t.from==t.to&&t.from==i.head-1&&/^\. ?$/.test(t.insert.toString())&&r.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=ie.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Qe.of([" "])}):ye.chrome&&t&&t.from==t.to&&t.from==i.head&&t.insert.toString()==`
|
|
148
|
+
`&&r.lineWrapping&&(n&&(n=ie.single(n.main.anchor-1,n.main.head-1)),t={from:i.from,to:i.to,insert:Qe.of([" "])}),t){if(ye.ios&&r.inputState.flushIOSKey()||ye.android&&(t.from==i.from&&t.to==i.to&&t.insert.length==1&&t.insert.lines==2&&qi(r.contentDOM,"Enter",13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||s==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&qi(r.contentDOM,"Backspace",8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&qi(r.contentDOM,"Delete",46)))return!0;let o=t.insert.toString();r.inputState.composing>=0&&r.inputState.composing++;let a,l=()=>a||(a=BA(r,t,n));return r.state.facet(Gp).some(c=>c(r,t.from,t.to,o,l))||r.dispatch(l()),!0}else if(n&&!n.main.eq(i)){let o=!1,a="select";return r.inputState.lastSelectionTime>Date.now()-50&&(r.inputState.lastSelectionOrigin=="select"&&(o=!0),a=r.inputState.lastSelectionOrigin),r.dispatch({selection:n,scrollIntoView:o,userEvent:a}),!0}else return!1}function BA(r,e,t){let n,i=r.state,s=i.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)&&r.inputState.composing<0){let a=s.from<e.from?i.sliceDoc(s.from,e.from):"",l=s.to>e.to?i.sliceDoc(e.to,s.to):"";n=i.replaceSelection(r.state.toText(a+e.insert.sliceString(0,void 0,r.state.lineBreak)+l))}else{let a=i.changes(e),l=t&&t.main.to<=a.newLength?t.main:void 0;if(i.selection.ranges.length>1&&r.inputState.composing>=0&&e.to<=s.to&&e.to>=s.to-10){let c=r.state.sliceDoc(e.from,e.to),u,h=t&&ug(r,t.main.head);if(h){let m=e.insert.length-(e.to-e.from);u={from:h.from,to:h.to-m}}else u=r.state.doc.lineAt(s.head);let d=s.to-e.to,p=s.to-s.from;n=i.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:a,range:l||m.map(a)};let y=m.to-d,w=y-c.length;if(m.to-m.from!=p||r.state.sliceDoc(w,y)!=c||m.to>=u.from&&m.from<=u.to)return{range:m};let A=i.changes({from:w,to:y,insert:e.insert}),T=m.to-s.to;return{changes:A,range:l?ie.range(Math.max(0,l.anchor+T),Math.max(0,l.head+T)):m.map(A)}})}else n={changes:a,selection:l&&i.selection.replaceRange(l)}}let o="input.type";return(r.composing||r.inputState.compositionPendingChange&&r.inputState.compositionEndedAt>Date.now()-50)&&(r.inputState.compositionPendingChange=!1,o+=".compose",r.inputState.compositionFirstChange&&(o+=".start",r.inputState.compositionFirstChange=!1)),i.update(n,{userEvent:o,scrollIntoView:!0})}function FA(r,e,t,n){let i=Math.min(r.length,e.length),s=0;for(;s<i&&r.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==i&&r.length==e.length)return null;let o=r.length,a=e.length;for(;o>0&&a>0&&r.charCodeAt(o-1)==e.charCodeAt(a-1);)o--,a--;if(n=="end"){let l=Math.max(0,s-Math.min(o,a));t-=o+l-s}if(o<s&&r.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 jA(r){let e=[];if(r.root.activeElement!=r.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:i,focusOffset:s}=r.observer.selectionRange;return t&&(e.push(new Yg(t,n)),(i!=t||s!=n)&&e.push(new Yg(i,s))),e}function VA(r,e){if(r.length==0)return null;let t=r[0].pos,n=r.length==2?r[1].pos:t;return t>-1&&n>-1?ie.single(t+e,n+e):null}const WA={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},du=ye.ie&&ye.ie_version<=11;class $A{constructor(e){this.view=e,this.active=!1,this.selectionRange=new Tk,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.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(ye.ie&&ye.ie_version<=11||ye.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),du&&(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),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.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){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,n)=>t!=e[n]))){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:n}=this,i=this.selectionRange;if(n.state.facet(Da)?n.root.activeElement!=this.dom:!Oa(n.dom,i))return;let s=i.anchorNode&&n.docView.nearest(i.anchorNode);if(s&&s.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ye.ie&&ye.ie_version<=11||ye.android&&ye.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Ea(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ye.safari&&e.root.nodeType==11&&Ak(this.dom.ownerDocument)==this.dom&&HA(this.view)||Ca(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=Oa(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&Mk(this.dom,t)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(t),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 n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.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,WA),du&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),du&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let i=()=>{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&qi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(i)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.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,n=-1,i=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(i=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Oa(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new LA(this.view,e,t,n);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 n=this.view.state,i=Jg(this.view,t);return this.view.state==n&&this.view.update([]),i}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 n=Qg(t,e.previousSibling||e.target.previousSibling,-1),i=Qg(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):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),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),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let i of this.scrollTargets)i.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 Qg(r,e,t){for(;e;){let n=nt.get(e);if(n&&n.parent==r)return n;let i=e.parentNode;e=i!=r.dom?i:t>0?e.nextSibling:e.previousSibling}return null}function HA(r){let e=null;function t(l){l.preventDefault(),l.stopImmediatePropagation(),e=l.getTargetRanges()[0]}if(r.contentDOM.addEventListener("beforeinput",t,!0),r.dom.ownerDocument.execCommand("indent"),r.contentDOM.removeEventListener("beforeinput",t,!0),!e)return null;let n=e.startContainer,i=e.startOffset,s=e.endContainer,o=e.endOffset,a=r.docView.domAtPos(r.state.selection.main.anchor);return Ea(a.node,a.offset,s,o)&&([n,i,s,o]=[s,o,n,i]),{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:o}}class he{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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(n=>n.forEach(i=>t(i,this)))||(n=>this.update(n)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Pk(e.parent)||document,this.viewState=new $g(e.state||We.create(e)),this.plugins=this.state.facet(eo).map(n=>new _c(n));for(let n of this.plugins)n.update(this);this.observer=new $A(this),this.inputState=new sA(this),this.inputState.ensureHandlers(this.plugins),this.docView=new lg(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let t=e.length==1&&e[0]instanceof Tt?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,n=!1,i,s=this.state;for(let d of e){if(d.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=d.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,a=0,l=null;e.some(d=>d.annotation(Dg))?(this.inputState.notifiedFocused=o,a=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,l=Ng(s,o),l||(a=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(We.phrases)!=this.state.facet(We.phrases))return this.setState(s);i=Ra.create(this,s,e),i.flags|=a;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(h&&(h=h.map(d.changes)),d.scrollIntoView){let{main:p}=d.state.selection;h=new Ia(p.empty?p:ie.cursor(p.head,p.head>p.anchor?-1:1))}for(let p of d.effects)p.is(Qp)&&(h=p.value)}this.viewState.update(i,h),this.bidiCache=za.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),t=this.docView.update(i),this.state.facet(ro)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(Ha)!=i.state.facet(Ha)&&(this.viewState.mustMeasureContent=!0),(t||n||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!i.empty)for(let d of this.state.facet(Zc))d(i);(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!Jg(this,u)&&c.force&&qi(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 n of this.plugins)n.destroy(this);this.viewState=new $g(e),this.plugins=e.facet(eo).map(n=>new _c(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView=new lg(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(eo),n=e.state.facet(eo);if(t!=n){let i=[];for(let s of n){let o=t.indexOf(s);if(o<0)i.push(new _c(s));else{let a=this.plugins[o];a.mustUpdate=e,i.push(a)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=e;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}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,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let a=0;;a++){if(o<0)if(Cp(n))s=-1,o=this.viewState.heightMap.height;else{let p=this.viewState.scrollAnchorAt(i);s=p.from,o=p.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 u=c.map(p=>{try{return p.read(this)}catch(m){return Nr(this.state,m),Xg}}),h=Ra.create(this,this.state,[]),d=!1;h.flags|=l,t?t.flags|=l:t=h,this.updateState=2,h.empty||(this.updatePlugins(h),this.inputState.update(h),this.updateAttrs(),d=this.docView.update(h));for(let p=0;p<c.length;p++)if(u[p]!=Xg)try{let m=c[p];m.write&&m.write(u[p],this)}catch(m){Nr(this.state,m)}if(d&&this.docView.updateSelection(!0),!h.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let m=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-o;if(m>1||m<-1){i=i+m,n.scrollTop=i/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let a of this.state.facet(Zc))a(t)}get themeClasses(){return fu+" "+(this.state.facet(uu)?Ug:zg)+" "+this.state.facet(Ha)}updateAttrs(){let e=Zg(this,Xp,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Da)?"true":"false",class:"cm-content",style:`${ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Zg(this,Na,t);let n=this.observer.ignore(()=>{let i=Qc(this.contentDOM,this.contentAttrs,t),s=Qc(this.dom,this.editorAttrs,e);return i||s});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let i of n.effects)if(i.is(he.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(ro);let e=this.state.facet(he.cspNonce);Gn.mount(this.root,this.styleModules.concat(DA).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(n=>n.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,n){return ou(this,e,vg(this,e,t,n))}moveByGroup(e,t){return ou(this,e,vg(this,e,t,n=>nA(this,e.head,n)))}moveToLineBoundary(e,t,n=!0){return rA(this,e,t,n)}moveVertically(e,t,n){return ou(this,e,iA(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),gg(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),s=this.bidiSpans(i),o=s[Xn.find(s,e-i.from,-1,t)];return Ta(n,o.dir==ft.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(Yp)||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>zA)return sg(e.length);let t=this.textDirectionAt(e.from),n;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||ng(s.isolates,n=_p(this,e.from,e.to))))return s.order;n||(n=_p(this,e.from,e.to));let i=ig(e.text,t,n);return this.bidiCache.push(new za(e.from,e.to,t,n,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Sp(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(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Qp.of(new Ia(typeof e=="number"?ie.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return ut.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return ut.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Gn.newName(),i=[Ha.of(n),ro.of(hu(`.${n}`,e))];return t&&t.dark&&i.push(uu.of(!0)),i}static baseTheme(e){return xi.lowest(ro.of(hu("."+fu,e,Gg)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&nt.get(n)||nt.get(e);return((t=i?.rootView)===null||t===void 0?void 0:t.view)||null}}he.styleModule=ro,he.inputHandler=Gp,he.focusChangeEffect=Kp,he.perLineTextDirection=Yp,he.exceptionSink=Up,he.updateListener=Zc,he.editable=Da,he.mouseSelectionStyle=zp,he.dragMovesSelection=Hp,he.clickAddsSelectionRange=$p,he.decorations=to,he.atomicRanges=qc,he.bidiIsolatedRanges=Zp,he.scrollMargins=qp,he.darkTheme=uu,he.cspNonce=de.define({combine:r=>r.length?r[0]:""}),he.contentAttributes=Na,he.editorAttributes=Xp,he.lineWrapping=he.contentAttributes.of({class:"cm-lineWrapping"}),he.announce=Ae.define();const zA=4096,Xg={};class za{constructor(e,t,n,i,s,o){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:ft.LTR;for(let s=Math.max(0,e.length-10);s<e.length;s++){let o=e[s];o.dir==i&&!t.touchesRange(o.from,o.to)&&n.push(new za(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function Zg(r,e,t){for(let n=r.state.facet(e),i=n.length-1;i>=0;i--){let s=n[i],o=typeof s=="function"?s(r):s;o&&Yc(o,t)}return t}const UA=ye.mac?"mac":ye.windows?"win":ye.linux?"linux":"key";function GA(r,e){const t=r.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let i,s,o,a;for(let l=0;l<t.length-1;++l){const c=t[l];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))i=!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 i&&(n="Alt-"+n),s&&(n="Ctrl-"+n),a&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function Ua(r,e,t){return e.altKey&&(r="Alt-"+r),e.ctrlKey&&(r="Ctrl-"+r),e.metaKey&&(r="Meta-"+r),t!==!1&&e.shiftKey&&(r="Shift-"+r),r}const KA=xi.default(he.domEventHandlers({keydown(r,e){return em(qg(e.state),r,e,"editor")}})),oo=de.define({enables:KA}),_g=new WeakMap;function qg(r){let e=r.facet(oo),t=_g.get(e);return t||_g.set(e,t=QA(e.reduce((n,i)=>n.concat(i),[]))),t}function YA(r,e,t){return em(qg(r.state),e,r,t)}let Zn=null;const JA=4e3;function QA(r,e=UA){let t=Object.create(null),n=Object.create(null),i=(o,a)=>{let l=n[o];if(l==null)n[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,u)=>{var h,d;let p=t[o]||(t[o]=Object.create(null)),m=a.split(/ (?!$)/).map(A=>GA(A,e));for(let A=1;A<m.length;A++){let T=m.slice(0,A).join(" ");i(T,!0),p[T]||(p[T]={preventDefault:!0,stopPropagation:!1,run:[P=>{let L=Zn={view:P,prefix:T,scope:o};return setTimeout(()=>{Zn==L&&(Zn=null)},JA),!0}]})}let y=m.join(" ");i(y,!1);let w=p[y]||(p[y]={preventDefault:!1,stopPropagation:!1,run:((d=(h=p._any)===null||h===void 0?void 0:h.run)===null||d===void 0?void 0:d.slice())||[]});l&&w.run.push(l),c&&(w.preventDefault=!0),u&&(w.stopPropagation=!0)};for(let o of r){let a=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let c of a){let u=t[c]||(t[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let h in u)u[h].run.push(o.any)}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}function em(r,e,t,n){let i=kk(e),s=Lt(i,0),o=Dr(s)==i.length&&i!=" ",a="",l=!1,c=!1,u=!1;Zn&&Zn.view==t&&Zn.scope==n&&(a=Zn.prefix+" ",xg.indexOf(e.keyCode)<0&&(c=!0,Zn=null));let h=new Set,d=w=>{if(w){for(let A of w.run)if(!h.has(A)&&(h.add(A),A(t,e)))return w.stopPropagation&&(u=!0),!0;w.preventDefault&&(w.stopPropagation&&(u=!0),c=!0)}return!1},p=r[n],m,y;return p&&(d(p[a+Ua(i,e,!o)])?l=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ye.windows&&e.ctrlKey&&e.altKey)&&(m=Kn[e.keyCode])&&m!=i?(d(p[a+Ua(m,e,!0)])||e.shiftKey&&(y=Qs[e.keyCode])!=i&&y!=m&&d(p[a+Ua(y,e,!1)]))&&(l=!0):o&&e.shiftKey&&d(p[a+Ua(i,e,!0)])&&(l=!0),!l&&d(p._any)&&(l=!0)),c&&(l=!0),l&&u&&e.stopPropagation(),l}class ao{constructor(e,t,n,i,s){this.className=e,this.left=t,this.top=n,this.width=i,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,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let s=tm(e);return[new ao(t,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return XA(e,t,n)}}function tm(r){let e=r.scrollDOM.getBoundingClientRect();return{left:(r.textDirection==ft.LTR?e.left:e.right-r.scrollDOM.clientWidth*r.scaleX)-r.scrollDOM.scrollLeft*r.scaleX,top:e.top-r.scrollDOM.scrollTop*r.scaleY}}function rm(r,e,t){let n=ie.cursor(e);return{from:Math.max(t.from,r.moveToLineBoundary(n,!1,!0).from),to:Math.min(t.to,r.moveToLineBoundary(n,!0,!0).from),type:nr.Text}}function XA(r,e,t){if(t.to<=r.viewport.from||t.from>=r.viewport.to)return[];let n=Math.max(t.from,r.viewport.from),i=Math.min(t.to,r.viewport.to),s=r.textDirection==ft.LTR,o=r.contentDOM,a=o.getBoundingClientRect(),l=tm(r),c=o.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),h=a.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),d=a.right-(u?parseInt(u.paddingRight):0),p=su(r,n),m=su(r,i),y=p.type==nr.Text?p:null,w=m.type==nr.Text?m:null;if(y&&(r.lineWrapping||p.widgetLineBreaks)&&(y=rm(r,n,y)),w&&(r.lineWrapping||m.widgetLineBreaks)&&(w=rm(r,i,w)),y&&w&&y.from==w.from)return T(P(t.from,t.to,y));{let D=y?P(t.from,null,y):L(p,!1),j=w?P(null,t.to,w):L(m,!0),W=[];return(y||p).to<(w||m).from-(y&&w?1:0)||p.widgetLineBreaks>1&&D.bottom+r.defaultLineHeight/2<j.top?W.push(A(h,D.bottom,d,j.top)):D.bottom<j.top&&r.elementAtHeight((D.bottom+j.top)/2).type==nr.Text&&(D.bottom=j.top=(D.bottom+j.top)/2),T(D).concat(W).concat(T(j))}function A(D,j,W,q){return new ao(e,D-l.left,j-l.top-.01,W-D,q-j+.01)}function T({top:D,bottom:j,horizontal:W}){let q=[];for(let F=0;F<W.length;F+=2)q.push(A(W[F],D,W[F+1],j));return q}function P(D,j,W){let q=1e9,F=-1e9,H=[];function Q(be,ke,Re,Se,Oe){let Te=r.coordsAtPos(be,be==W.to?-2:2),De=r.coordsAtPos(Re,Re==W.from?2:-2);!Te||!De||(q=Math.min(Te.top,De.top,q),F=Math.max(Te.bottom,De.bottom,F),Oe==ft.LTR?H.push(s&&ke?h:Te.left,s&&Se?d:De.right):H.push(!s&&Se?h:De.left,!s&&ke?d:Te.right))}let oe=D??W.from,fe=j??W.to;for(let be of r.visibleRanges)if(be.to>oe&&be.from<fe)for(let ke=Math.max(be.from,oe),Re=Math.min(be.to,fe);;){let Se=r.state.doc.lineAt(ke);for(let Oe of r.bidiSpans(Se)){let Te=Oe.from+Se.from,De=Oe.to+Se.from;if(Te>=Re)break;De>ke&&Q(Math.max(Te,ke),D==null&&Te<=oe,Math.min(De,Re),j==null&&De>=fe,Oe.dir)}if(ke=Se.to+1,ke>=Re)break}return H.length==0&&Q(oe,D==null,fe,j==null,r.textDirection),{top:q,bottom:F,horizontal:H}}function L(D,j){let W=a.top+(j?D.top:D.bottom);return{top:W,bottom:W,horizontal:[]}}}function ZA(r,e){return r.constructor==e.constructor&&r.eq(e)}class _A{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(Ga)!=e.state.facet(Ga)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,n=e.facet(Ga);for(;t<n.length&&n[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,n)=>!ZA(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let i=t.nextSibling;t.remove(),t=i}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Ga=de.define();function nm(r){return[ut.define(e=>new _A(e,r)),Ga.of(r)]}const im=!ye.ios,ts=de.define({combine(r){return zr(r,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function qA(r={}){return[ts.of(r),eC,tC,rC,Jp.of(!0)]}function eD(r){return r.facet(ts)}function sm(r){return r.startState.facet(ts)!=r.state.facet(ts)}const eC=nm({above:!0,markers(r){let{state:e}=r,t=e.facet(ts),n=[];for(let i of e.selection.ranges){let s=i==e.selection.main;if(i.empty?!s||im:t.drawRangeCursor){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",a=i.empty?i:ie.cursor(i.head,i.head>i.anchor?-1:1);for(let l of ao.forRange(r,o,a))n.push(l)}}return n},update(r,e){r.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=sm(r);return t&&om(r.state,e),r.docChanged||r.selectionSet||t},mount(r,e){om(e.state,r)},class:"cm-cursorLayer"});function om(r,e){e.style.animationDuration=r.facet(ts).cursorBlinkRate+"ms"}const tC=nm({above:!1,markers(r){return r.state.selection.ranges.map(e=>e.empty?[]:ao.forRange(r,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(r,e){return r.docChanged||r.selectionSet||r.viewportChanged||sm(r)},class:"cm-selectionLayer"}),am={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};im&&(am[".cm-line"].caretColor="transparent !important");const rC=xi.highest(he.theme(am)),lm=Ae.define({map(r,e){return r==null?null:e.mapPos(r)}}),lo=kt.define({create(){return null},update(r,e){return r!=null&&(r=e.changes.mapPos(r)),e.effects.reduce((t,n)=>n.is(lm)?n.value:t,r)}}),nC=ut.fromClass(class{constructor(r){this.view=r,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(r){var e;let t=r.state.field(lo);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"),(r.startState.field(lo)!=t||r.docChanged||r.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:r}=this,e=r.state.field(lo),t=e!=null&&r.coordsAtPos(e);if(!t)return null;let n=r.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+r.scrollDOM.scrollLeft*r.scaleX,top:t.top-n.top+r.scrollDOM.scrollTop*r.scaleY,height:t.bottom-t.top}}drawCursor(r){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;r?(this.cursor.style.left=r.left/e+"px",this.cursor.style.top=r.top/t+"px",this.cursor.style.height=r.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(r){this.view.state.field(lo)!=r&&this.view.dispatch({effects:lm.of(r)})}},{eventObservers:{dragover(r){this.setDropPos(this.view.posAtCoords({x:r.clientX,y:r.clientY}))},dragleave(r){(r.target==this.view.contentDOM||!this.view.contentDOM.contains(r.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function iC(){return[lo,nC]}function cm(r,e,t,n,i){e.lastIndex=0;for(let s=r.iterRange(t,n),o=t,a;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;a=e.exec(s.value);)i(o+a.index,a)}function sC(r,e){let t=r.visibleRanges;if(t.length==1&&t[0].from==r.viewport.from&&t[0].to==r.viewport.to)return t;let n=[];for(let{from:i,to:s}of t)i=Math.max(r.state.doc.lineAt(i).from,i-e),s=Math.min(r.state.doc.lineAt(s).to,s+e),n.length&&n[n.length-1].to>=i?n[n.length-1].to=s:n.push({from:i,to:s});return n}class pu{constructor(e){const{regexp:t,decoration:n,decorate:i,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,i)this.addMatch=(a,l,c,u)=>i(u,c,c+a[0].length,a,l);else if(typeof n=="function")this.addMatch=(a,l,c,u)=>{let h=n(a,l,c);h&&u(c,c+a[0].length,h)};else if(n)this.addMatch=(a,l,c,u)=>u(c,c+a[0].length,n);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new Un,n=t.add.bind(t);for(let{from:i,to:s}of sC(e,this.maxLength))cm(e.state.doc,this.regexp,i,s,(o,a)=>this.addMatch(a,e,o,n));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges((s,o,a,l)=>{l>e.view.viewport.from&&a<e.view.viewport.to&&(n=Math.min(a,n),i=Math.max(l,i))}),e.viewportChanged||i-n>1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let s of e.visibleRanges){let o=Math.max(s.from,n),a=Math.min(s.to,i);if(a>o){let l=e.state.doc.lineAt(o),c=l.to<a?e.state.doc.lineAt(a):l,u=Math.max(s.from,l.from),h=Math.min(s.to,c.to);if(this.boundary){for(;o>l.from;o--)if(this.boundary.test(l.text[o-1-l.from])){u=o;break}for(;a<c.to;a++)if(this.boundary.test(c.text[a-c.from])){h=a;break}}let d=[],p,m=(y,w,A)=>d.push(A.range(y,w));if(l==c)for(this.regexp.lastIndex=u-l.from;(p=this.regexp.exec(l.text))&&p.index<h-l.from;)this.addMatch(p,e,p.index+l.from,m);else cm(e.state.doc,this.regexp,u,h,(y,w)=>this.addMatch(w,e,y,m));t=t.update({filterFrom:u,filterTo:h,filter:(y,w)=>y<u||w>h,add:d})}}return t}}const gu=/x/.unicode!=null?"gu":"g",oC=new RegExp(`[\0-\b
|
|
149
|
+
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,gu),aC={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"};let mu=null;function lC(){var r;if(mu==null&&typeof document<"u"&&document.body){let e=document.body.style;mu=((r=e.tabSize)!==null&&r!==void 0?r:e.MozTabSize)!=null}return mu||!1}const Ka=de.define({combine(r){let e=zr(r,{render:null,specialChars:oC,addSpecialChars:null});return(e.replaceTabs=!lC())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,gu)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,gu)),e}});function cC(r={}){return[Ka.of(r),uC()]}let um=null;function uC(){return um||(um=ut.fromClass(class{constructor(r){this.view=r,this.decorations=we.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(r.state.facet(Ka)),this.decorations=this.decorator.createDeco(r)}makeDecorator(r){return new pu({regexp:r.specialChars,decoration:(e,t,n)=>{let{doc:i}=t.state,s=Lt(e[0],0);if(s==9){let o=i.lineAt(n),a=t.state.tabSize,l=Xi(o.text,a,n-o.from);return we.replace({widget:new pC((a-l%a)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=we.replace({widget:new dC(r,s)}))},boundary:r.replaceTabs?void 0:/[^]/})}update(r){let e=r.state.facet(Ka);r.startState.facet(Ka)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(r.view)):this.decorations=this.decorator.updateDeco(r,this.decorations)}},{decorations:r=>r.decorations}))}const fC="\u2022";function hC(r){return r>=32?fC:r==10?"\u2424":String.fromCharCode(9216+r)}class dC extends on{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=hC(this.code),n=e.state.phrase("Control character")+" "+(aC[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let s=document.createElement("span");return s.textContent=t,s.title=n,s.setAttribute("aria-label",n),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class pC extends on{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}}const fm=null;function tD(){return[fm,Na.of(r=>{var e;return((e=r.plugin(fm))===null||e===void 0?void 0:e.attrs)||null})]}function gC(){return vC}const mC=we.line({class:"cm-activeLine"}),vC=ut.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.docChanged||r.selectionSet)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=-1,t=[];for(let n of r.state.selection.ranges){let i=r.lineBlockAt(n.head);i.from>e&&(t.push(mC.range(i.from)),e=i.from)}return we.set(t)}},{decorations:r=>r.decorations});class yC extends on{constructor(e){super(),this.content=e}toDOM(){let e=document.createElement("span");return e.className="cm-placeholder",e.style.pointerEvents="none",e.appendChild(typeof this.content=="string"?document.createTextNode(this.content):this.content),typeof this.content=="string"?e.setAttribute("aria-label","placeholder "+this.content):e.setAttribute("aria-hidden","true"),e}coordsAt(e){let t=e.firstChild?Zi(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Ta(t[0],n.direction!="rtl"),s=parseInt(n.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function bC(r){return ut.fromClass(class{constructor(e){this.view=e,this.placeholder=r?we.set([we.widget({widget:new yC(r),side:1}).range(0)]):we.none}get decorations(){return this.view.state.doc.length?we.none:this.placeholder}},{decorations:e=>e.decorations})}const vu=2e3;function xC(r,e,t){let n=Math.min(e.line,t.line),i=Math.max(e.line,t.line),s=[];if(e.off>vu||t.off>vu||e.col<0||t.col<0){let o=Math.min(e.off,t.off),a=Math.max(e.off,t.off);for(let l=n;l<=i;l++){let c=r.doc.line(l);c.length<=a&&s.push(ie.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=n;l<=i;l++){let c=r.doc.line(l),u=Fc(c.text,o,r.tabSize,!0);if(u<0)s.push(ie.cursor(c.to));else{let h=Fc(c.text,a,r.tabSize);s.push(ie.range(c.from+u,c.from+h))}}}return s}function wC(r,e){let t=r.coordsAtPos(r.viewport.from);return t?Math.round(Math.abs((t.left-e)/r.defaultCharacterWidth)):-1}function hm(r,e){let t=r.posAtCoords({x:e.clientX,y:e.clientY},!1),n=r.state.doc.lineAt(t),i=t-n.from,s=i>vu?-1:i==n.length?wC(r,e.clientX):Xi(n.text,r.state.tabSize,t-n.from);return{line:n.number,col:s,off:i}}function SC(r,e){let t=hm(r,e),n=r.state.selection;return t?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(t.line).from),o=i.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},n=n.map(i.changes)}},get(i,s,o){let a=hm(r,i);if(!a)return n;let l=xC(r.state,t,a);return l.length?o?ie.create(l.concat(n.ranges)):ie.create(l):n}}:null}function kC(r){let e=r?.eventFilter||(t=>t.altKey&&t.button==0);return he.mouseSelectionStyle.of((t,n)=>e(n)?SC(t,n):null)}const AC={Alt:[18,r=>!!r.altKey],Control:[17,r=>!!r.ctrlKey],Shift:[16,r=>!!r.shiftKey],Meta:[91,r=>!!r.metaKey]},CC={style:"cursor: crosshair"};function OC(r={}){let[e,t]=AC[r.key||"Alt"],n=ut.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==e||t(i))},keyup(i){(i.keyCode==e||!t(i))&&this.set(!1)},mousemove(i){this.set(t(i))}}});return[n,he.contentAttributes.of(i=>{var s;return!((s=i.plugin(n))===null||s===void 0)&&s.isDown?CC:null})]}const co="-10000px";class dm{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter(i=>i),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let i=e.state.facet(this.facet),s=i.filter(l=>l);if(i===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],u=-1;if(c){for(let h=0;h<this.tooltips.length;h++){let d=this.tooltips[h];d&&d.create==c.create&&(u=h)}if(u<0)o[l]=this.createTooltipView(c),a&&(a[l]=!!c.above);else{let h=o[l]=this.tooltipViews[u];a&&(a[l]=t[u]),h.update&&h.update(e)}}}for(let l of this.tooltipViews)o.indexOf(l)<0&&(l.dom.remove(),(n=l.destroy)===null||n===void 0||n.call(l));return t&&(a.forEach((l,c)=>t[c]=l),t.length=a.length),this.input=i,this.tooltips=s,this.tooltipViews=o,!0}}function rD(r={}){return Ya.of(r)}function EC(r){let{win:e}=r;return{top:0,left:0,bottom:e.innerHeight,right:e.innerWidth}}const Ya=de.define({combine:r=>{var e,t,n;return{position:ye.ios?"absolute":((e=r.find(i=>i.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=r.find(i=>i.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=r.find(i=>i.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||EC}}}),pm=new WeakMap,yu=ut.fromClass(class{constructor(r){this.view=r,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=r.state.facet(Ya);this.position=e.position,this.parent=e.parent,this.classes=r.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new dm(r,Ja,t=>this.createTooltip(t)),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(),r.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 r of this.manager.tooltipViews)this.intersectionObserver.observe(r.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(r){r.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(r,this.above);e&&this.observeIntersection();let t=e||r.geometryChanged,n=r.state.facet(Ya);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(r){let e=r.create(this.view);if(e.dom.classList.add("cm-tooltip"),r.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let t=document.createElement("div");t.className="cm-tooltip-arrow",e.dom.appendChild(t)}return e.dom.style.position=this.position,e.dom.style.top=co,e.dom.style.left="0px",this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}destroy(){var r,e;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(r=t.destroy)===null||r===void 0||r.call(t);this.parent&&this.container.remove(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let r=this.view.dom.getBoundingClientRect(),e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(ye.gecko)n=i.offsetParent!=this.container.ownerDocument.body;else if(this.view.scaleX!=1||this.view.scaleY!=1)n=!0;else if(i.style.top==co&&i.style.left=="0px"){let s=i.getBoundingClientRect();n=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(e=i.width/this.parent.offsetWidth,t=i.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);return{editor:r,parent:this.parent?this.container.getBoundingClientRect():r,pos:this.manager.tooltips.map((i,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(Ya).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(r){var e;if(r.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let a of this.manager.tooltipViews)a.dom.style.position="absolute"}let{editor:t,space:n,scaleX:i,scaleY:s}=r,o=[];for(let a=0;a<this.manager.tooltips.length;a++){let l=this.manager.tooltips[a],c=this.manager.tooltipViews[a],{dom:u}=c,h=r.pos[a],d=r.size[a];if(!h||h.bottom<=Math.max(t.top,n.top)||h.top>=Math.min(t.bottom,n.bottom)||h.right<Math.max(t.left,n.left)-.1||h.left>Math.min(t.right,n.right)+.1){u.style.top=co;continue}let p=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,m=p?7:0,y=d.right-d.left,w=(e=pm.get(c))!==null&&e!==void 0?e:d.bottom-d.top,A=c.offset||PC,T=this.view.textDirection==ft.LTR,P=d.width>n.right-n.left?T?n.left:n.right-d.width:T?Math.min(h.left-(p?14:0)+A.x,n.right-y):Math.max(n.left,h.left-y+(p?14:0)-A.x),L=this.above[a];!l.strictSide&&(L?h.top-(d.bottom-d.top)-A.y<n.top:h.bottom+(d.bottom-d.top)+A.y>n.bottom)&&L==n.bottom-h.bottom>h.top-n.top&&(L=this.above[a]=!L);let D=(L?h.top-n.top:n.bottom-h.bottom)-m;if(D<w&&c.resize!==!1){if(D<this.view.defaultLineHeight){u.style.top=co;continue}pm.set(c,w),u.style.height=(w=D)/s+"px"}else u.style.height&&(u.style.height="");let j=L?h.top-w-m-A.y:h.bottom+m+A.y,W=P+y;if(c.overlap!==!0)for(let q of o)q.left<W&&q.right>P&&q.top<j+w&&q.bottom>j&&(j=L?q.top-w-2-m:q.bottom+m+2);if(this.position=="absolute"?(u.style.top=(j-r.parent.top)/s+"px",u.style.left=(P-r.parent.left)/i+"px"):(u.style.top=j/s+"px",u.style.left=P/i+"px"),p){let q=h.left+(T?A.x:-A.x)-(P+14-7);p.style.left=q/i+"px"}c.overlap!==!0&&o.push({left:P,top:j,right:W,bottom:j+w}),u.classList.toggle("cm-tooltip-above",L),u.classList.toggle("cm-tooltip-below",!L),c.positioned&&c.positioned(r.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 r of this.manager.tooltipViews)r.dom.style.top=co}},{eventObservers:{scroll(){this.maybeMeasure()}}}),TC=he.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"}}}),PC={x:0,y:0},Ja=de.define({enables:[yu,TC]}),uo=de.define();class bu{static create(e){return new bu(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new dm(e,uo,t=>this.createHostedView(t))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}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 n of this.manager.tooltipViews){let i=n[e];if(i!==void 0){if(t===void 0)t=i;else if(t!==i)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")}}const MC=Ja.compute([uo],r=>{let e=r.facet(uo).filter(t=>t);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.filter(t=>t.end!=null).map(t=>t.end)),create:bu.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class IC{constructor(e,t,n,i,s){this.view=e,this.source=t,this.field=n,this.setHover=i,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)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,n=e.docView.nearest(t.target);if(!n)return;let i,s=1;if(n instanceof Yn)i=n.posAtStart;else{if(i=e.posAtCoords(t),i==null)return;let a=e.coordsAtPos(i);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(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==ft.RTL?-1:1;s=t.x<a.left?-c:c}let o=this.source(e,i,s);if(o?.then){let a=this.pending={pos:i};o.then(l=>{this.pending==a&&(this.pending=null,l&&e.dispatch({effects:this.setHover.of(l)}))},l=>Nr(e.state,l,"hover tooltip"))}else o&&e.dispatch({effects:this.setHover.of(o)})}mousemove(e){var t;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 n=this.active;if(n&&!gm(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,s=(t=n?.end)!==null&&t!==void 0?t:i;(i==s?this.view.posAtCoords(this.lastMove)!=i:!DC(this.view,i,s,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!gm(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function gm(r){for(let e=r;e;e=e.parentNode)if(e.nodeType==1&&e.classList.contains("cm-tooltip"))return!0;return!1}function DC(r,e,t,n,i,s){let o=r.scrollDOM.getBoundingClientRect(),a=r.documentTop+r.documentPadding.top+r.contentHeight;if(o.left>n||o.right<n||o.top>i||Math.min(o.bottom,a)<i)return!1;let l=r.posAtCoords({x:n,y:i},!1);return l>=e&&l<=t}function NC(r,e={}){let t=Ae.define(),n=kt.define({create(){return null},update(i,s){if(i&&(e.hideOnChange&&(s.docChanged||s.selection)||e.hideOn&&e.hideOn(s,i)))return null;if(i&&s.docChanged){let o=s.changes.mapPos(i.pos,-1,rr.TrackDel);if(o==null)return null;let a=Object.assign(Object.create(null),i);a.pos=o,i.end!=null&&(a.end=s.changes.mapPos(i.end)),i=a}for(let o of s.effects)o.is(t)&&(i=o.value),o.is(RC)&&(i=null);return i},provide:i=>uo.from(i)});return[n,ut.define(i=>new IC(i,r,n,t,e.hoverTime||300)),MC]}function mm(r,e){let t=r.plugin(yu);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}function nD(r){return r.facet(uo).some(e=>e)}const RC=Ae.define(),iD=null;function sD(r){let e=r.plugin(yu);e&&e.maybeMeasure()}const xu=de.define({combine(r){let e,t;for(let n of r)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}});function oD(r){return r?[xu.of(r)]:[]}function fo(r,e){let t=r.plugin(vm),n=t?t.specs.indexOf(e):-1;return n>-1?t.panels[n]:null}const vm=ut.fromClass(class{constructor(r){this.input=r.state.facet(ho),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(r));let e=r.state.facet(xu);this.top=new Qa(r,!0,e.topContainer),this.bottom=new Qa(r,!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(r){let e=r.state.facet(xu);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Qa(r.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Qa(r.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=r.state.facet(ho);if(t!=this.input){let n=t.filter(l=>l),i=[],s=[],o=[],a=[];for(let l of n){let c=this.specs.indexOf(l),u;c<0?(u=l(r.view),a.push(u)):(u=this.panels[c],u.update&&u.update(r)),i.push(u),(u.top?s:o).push(u)}this.specs=n,this.panels=i,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 n of this.panels)n.update&&n.update(r)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:r=>he.scrollMargins.of(e=>{let t=e.plugin(r);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Qa{constructor(e,t,n){this.view=e,this.top=t,this.container=n,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=ym(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=ym(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 ym(r){let e=r.nextSibling;return r.remove(),e}const ho=de.define({enables:vm});class un extends wi{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}un.prototype.elementClass="",un.prototype.toDOM=void 0,un.prototype.mapMode=rr.TrackBefore,un.prototype.startSide=un.prototype.endSide=-1,un.prototype.point=!0;const Xa=de.define(),LC={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ge.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},po=de.define();function bm(r){return[xm(),po.of(Object.assign(Object.assign({},LC),r))]}const wu=de.define({combine:r=>r.some(e=>e)});function xm(r){let e=[BC];return r&&r.fixed===!1&&e.push(wu.of(!0)),e}const BC=ut.fromClass(class{constructor(r){this.view=r,this.prevViewport=r.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=r.state.facet(po).map(e=>new Sm(r,e));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!r.state.facet(wu),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),r.scrollDOM.insertBefore(this.dom,r.contentDOM)}update(r){if(this.updateGutters(r)){let e=this.prevViewport,t=r.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}r.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(wu)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=r.view.viewport}syncGutters(r){let e=this.dom.nextSibling;r&&this.dom.remove();let t=Ge.iter(this.view.state.facet(Xa),this.view.viewport.from),n=[],i=this.gutters.map(s=>new FC(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(s.type)){let o=!0;for(let a of s.type)if(a.type==nr.Text&&o){Su(t,n,a.from);for(let l of i)l.line(this.view,a,n);o=!1}else if(a.widget)for(let l of i)l.widget(this.view,a)}else if(s.type==nr.Text){Su(t,n,s.from);for(let o of i)o.line(this.view,s,n)}else if(s.widget)for(let o of i)o.widget(this.view,s);for(let s of i)s.finish();r&&this.view.scrollDOM.insertBefore(this.dom,e)}updateGutters(r){let e=r.startState.facet(po),t=r.state.facet(po),n=r.docChanged||r.heightChanged||r.viewportChanged||!Ge.eq(r.startState.facet(Xa),r.state.facet(Xa),r.view.viewport.from,r.view.viewport.to);if(e==t)for(let i of this.gutters)i.update(r)&&(n=!0);else{n=!0;let i=[];for(let s of t){let o=e.indexOf(s);o<0?i.push(new Sm(this.view,s)):(this.gutters[o].update(r),i.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return n}destroy(){for(let r of this.gutters)r.destroy();this.dom.remove()}},{provide:r=>he.scrollMargins.of(e=>{let t=e.plugin(r);return!t||t.gutters.length==0||!t.fixed?null:e.textDirection==ft.LTR?{left:t.dom.offsetWidth*e.scaleX}:{right:t.dom.offsetWidth*e.scaleX}})});function wm(r){return Array.isArray(r)?r:[r]}function Su(r,e,t){for(;r.value&&r.from<=t;)r.from==t&&e.push(r.value),r.next()}class FC{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ge.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==i.elements.length){let a=new km(e,o,s,n);i.elements.push(a),i.dom.appendChild(a.dom)}else i.elements[this.i].update(e,o,s,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Su(this.cursor,i,t.from),n.length&&(i=i.concat(n));let s=this.gutter.config.lineMarker(e,t,i);s&&i.unshift(s);let o=this.gutter;i.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Sm{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 n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let s=i.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=i.clientY;let a=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,a,i)&&i.preventDefault()});this.markers=wm(t.markers(e)),t.initialSpacer&&(this.spacer=new km(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=wm(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],e);i!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[i])}let n=e.view.viewport;return!Ge.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class km{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),jC(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let s=0,o=0;;){let a=o,l=s<t.length?t[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(n+=" "+u);for(let h=o;h<this.markers.length;h++)if(this.markers[h].compare(l)){a=h,c=!0;break}}else a=this.markers.length;for(;o<a;){let u=this.markers[o++];if(u.toDOM){u.destroy(i);let h=i.nextSibling;i.remove(),i=h}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),c&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function jC(r,e){if(r.length!=e.length)return!1;for(let t=0;t<r.length;t++)if(!r[t].compare(e[t]))return!1;return!0}const VC=de.define(),rs=de.define({combine(r){return zr(r,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let i in t){let s=n[i],o=t[i];n[i]=s?(a,l,c)=>s(a,l,c)||o(a,l,c):o}return n}})}});class ku extends un{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Au(r,e){return r.state.facet(rs).formatNumber(e,r.state)}const WC=po.compute([rs],r=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(VC)},lineMarker(e,t,n){return n.some(i=>i.toDOM)?null:new ku(Au(e,e.state.doc.lineAt(t.from).number))},widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(rs)!=e.state.facet(rs),initialSpacer(e){return new ku(Au(e,Am(e.state.doc.lines)))},updateSpacer(e,t){let n=Au(t.view,Am(t.view.state.doc.lines));return n==e.number?e:new ku(n)},domEventHandlers:r.facet(rs).domEventHandlers}));function $C(r={}){return[rs.of(r),xm(),WC]}function Am(r){let e=9;for(;e<r;)e=e*10+9;return e}const HC=new class extends un{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},zC=Xa.compute(["selection"],r=>{let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.head).from;i>t&&(t=i,e.push(HC.range(i)))}return Ge.of(e)});function UC(){return zC}const Cm=new Map;function GC(r){let e=Cm.get(r);return e||Cm.set(r,e=we.mark({attributes:r===" "?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":r.replace(/ /g,"\xB7")}})),e}function Om(r){return ut.define(e=>({decorations:r.createDeco(e),update(t){this.decorations=r.updateDeco(t,this.decorations)}}),{decorations:e=>e.decorations})}const KC=Om(new pu({regexp:/\t| +/g,decoration:r=>GC(r[0]),boundary:/\S/}));function aD(){return KC}const YC=Om(new pu({regexp:/\s+$/g,decoration:we.mark({class:"cm-trailingSpace"}),boundary:/\S/}));function lD(){return YC}const cD={HeightMap:Yt,HeightOracle:Fg,MeasuredHeights:jg,QueryType:tt,ChangedRange:yr,computeOrder:ig,moveVisually:ag};var Cu;const ki=new Be;function Em(r){return de.define({combine:r?e=>e.concat(r):void 0})}const JC=new Be;class xr{constructor(e,t,n=[],i=""){this.data=e,this.name=i,We.prototype.hasOwnProperty("tree")||Object.defineProperty(We.prototype,"tree",{get(){return Nt(this)}}),this.parser=t,this.extension=[_n.of(this),We.languageData.of((s,o,a)=>{let l=Tm(s,o,a),c=l.type.prop(ki);if(!c)return[];let u=s.facet(c),h=l.type.prop(JC);if(h){let d=l.resolve(o-l.from,a);for(let p of h)if(p.test(d,s)){let m=s.facet(p.facet);return p.type=="replace"?m:m.concat(u)}}return u})].concat(n)}isActiveAt(e,t,n=-1){return Tm(e,t,n).type.prop(ki)==this.data}findRegions(e){let t=e.facet(_n);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(s,o)=>{if(s.prop(ki)==this.data){n.push({from:o,to:o+s.length});return}let a=s.prop(Be.mounted);if(a){if(a.tree.prop(ki)==this.data){if(a.overlay)for(let l of a.overlay)n.push({from:l.from+o,to:l.to+o});else n.push({from:o,to:o+s.length});return}else if(a.overlay){let l=n.length;if(i(a.tree,a.overlay[0].from+o),n.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ct&&i(c,s.positions[l]+o)}};return i(Nt(e),0),n}get allowsNesting(){return!0}}xr.setState=Ae.define();function Tm(r,e,t){let n=r.facet(_n),i=Nt(r).topNode;if(!n||n.allowsNesting)for(let s=i;s;s=s.enter(e,t,st.ExcludeBuffers))s.type.isTop&&(i=s);return i}class Za extends xr{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Em(e.languageData);return new Za(t,e.parser.configure({props:[ki.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Za(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Nt(r){let e=r.field(xr.state,!1);return e?e.tree:ct.empty}function QC(r,e,t=50){var n;let i=(n=r.field(xr.state,!1))===null||n===void 0?void 0:n.context;if(!i)return null;let s=i.viewport;i.updateViewport({from:0,to:e});let o=i.isDone(e)||i.work(t,e)?i.tree:null;return i.updateViewport(s),o}function uD(r,e=r.doc.length){var t;return((t=r.field(xr.state,!1))===null||t===void 0?void 0:t.context.isDone(e))||!1}function fD(r,e=r.viewport.to,t=100){let n=QC(r.state,e,t);return n!=Nt(r.state)&&r.dispatch({}),!!n}function hD(r){var e;return((e=r.plugin(Im))===null||e===void 0?void 0:e.isWorking())||!1}class XC{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 n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let go=null;class ns{constructor(e,t,n=[],i,s,o,a,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=s,this.viewport=o,this.skipped=a,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ns(e,t,[],ct.empty,0,n,[],null)}startParse(){return this.parser.startParse(new XC(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ct.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let i=Date.now()+e;e=()=>Date.now()>i}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 i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(kn.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=i,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(kn.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=go;go=this;try{return e()}finally{go=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Pm(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:s,viewport:o,skipped:a}=this;if(this.takeTree(),!e.empty){let l=[];if(e.iterChangedRanges((c,u,h,d)=>l.push({fromA:c,toA:u,fromB:h,toB:d})),n=kn.applyChanges(n,l),i=ct.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 u=e.mapPos(c.from,1),h=e.mapPos(c.to,-1);u<h&&a.push({from:u,to:h})}}}return new ns(this.parser,t,n,i,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 n=0;n<this.skipped.length;n++){let{from:i,to:s}=this.skipped[n];i<e.to&&s>e.from&&(this.fragments=Pm(this.fragments,i,s),this.skipped.splice(n--,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 Td{createParse(t,n,i){let s=i[0].from,o=i[i.length-1].to;return{parsedPos:s,advance(){let l=go;if(l){for(let c of i)l.tempSkipped.push(c);e&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,e]):e)}return this.parsedPos=o,new ct(er.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 go}}function Pm(r,e,t){return kn.applyChanges(r,[{fromA:e,toA:t,fromB:e,toB:t}])}class is{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),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new is(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ns.create(e.facet(_n).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new is(n)}}xr.state=kt.define({create:is.init,update(r,e){for(let t of e.effects)if(t.is(xr.setState))return t.value;return e.startState.facet(_n)!=e.state.facet(_n)?is.init(e.state):r.apply(e)}});let Mm=r=>{let e=setTimeout(()=>r(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Mm=r=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(r,{timeout:500-100})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const Ou=typeof navigator<"u"&&(!((Cu=navigator.scheduling)===null||Cu===void 0)&&Cu.isInputPending)?()=>navigator.scheduling.isInputPending():null,Im=ut.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(xr.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(xr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Mm(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:n,viewport:{to:i}}=this.view,s=n.field(xr.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!Ou?Math.max(25,e.timeRemaining()-5):1e9),a=s.context.treeLen<i&&n.doc.length>i+1e3,l=s.context.work(()=>Ou&&Ou()||Date.now()>o,i+(a?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:xr.setState.of(new is(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=>Nr(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()}}}),_n=de.define({combine(r){return r.length?r[0]:null},enables:r=>[xr.state,Im,he.contentAttributes.compute([r],e=>{let t=e.facet(r);return t&&t.name?{"data-language":t.name}:{}})]});class ZC{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}class Dm{constructor(e,t,n,i,s,o=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=i,this.loadFunc=s,this.support=o,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e}))}static of(e){let{load:t,support:n}=e;if(!t){if(!n)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");t=()=>Promise.resolve(n)}return new Dm(e.name,(e.alias||[]).concat(e.name).map(i=>i.toLowerCase()),e.extensions||[],e.filename,t,n)}static matchFilename(e,t){for(let i of e)if(i.filename&&i.filename.test(t))return i;let n=/\.([^.]+)$/.exec(t);if(n){for(let i of e)if(i.extensions.indexOf(n[1])>-1)return i}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let i of e)if(i.alias.some(s=>s==t))return i;if(n)for(let i of e)for(let s of i.alias){let o=t.indexOf(s);if(o>-1&&(s.length>2||!/\w/.test(t[o-1])&&!/\w/.test(t[o+s.length])))return i}return null}}const Nm=de.define(),_a=de.define({combine:r=>{if(!r.length)return" ";let e=r[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(r[0]));return e}});function Ai(r){let e=r.facet(_a);return e.charCodeAt(0)==9?r.tabSize*e.length:e.length}function ss(r,e){let t="",n=r.tabSize,i=r.facet(_a)[0];if(i==" "){for(;e>=n;)t+=" ",e-=n;i=" "}for(let s=0;s<e;s++)t+=i;return t}function qa(r,e){r instanceof We&&(r=new mo(r));for(let n of r.state.facet(Nm)){let i=n(r,e);if(i!==void 0)return i}let t=Nt(r.state);return t.length>=e?_C(r,t,e):null}function dD(r,e,t){let n=Object.create(null),i=new mo(r,{overrideIndentation:o=>{var a;return(a=n[o])!==null&&a!==void 0?a:-1}}),s=[];for(let o=e;o<=t;){let a=r.doc.lineAt(o);o=a.to+1;let l=qa(i,a.from);if(l==null)continue;/\S/.test(a.text)||(l=0);let c=/^\s*/.exec(a.text)[0],u=ss(r,l);c!=u&&(n[a.from]=l,s.push({from:a.from,to:a.from+c.length,insert:u}))}return r.changes(s)}class mo{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ai(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=n.from&&i<=n.to?s&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.countColumn(n,e-i),o=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return o>-1&&(s+=o-this.countColumn(n,n.search(/\S|$/))),s}countColumn(e,t=e.length){return Xi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(i);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Rm=new Be;function _C(r,e,t){let n=e.resolveStack(t),i=n.node.enterUnfinishedNodesBefore(t);if(i!=n.node){let s=[];for(let o=i;o!=n.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)n={node:s[o],next:n}}return Lm(n,r,t)}function Lm(r,e,t){for(let n=r;n;n=n.next){let i=eO(n.node);if(i)return i(Eu.create(e,t,n))}return 0}function qC(r){return r.pos==r.options.simulateBreak&&r.options.simulateDoubleBreak}function eO(r){let e=r.type.prop(Rm);if(e)return e;let t=r.firstChild,n;if(t&&(n=t.type.prop(Be.closedBy))){let i=r.lastChild,s=i&&n.indexOf(i.name)>-1;return o=>Bm(o,!0,1,void 0,s&&!qC(o)?i.from:void 0)}return r.parent==null?tO:null}function tO(){return 0}class Eu extends mo{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Eu(e,t,n)}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 n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(rO(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Lm(this.context.next,this.base,this.pos)}}function rO(r,e){for(let t=e;t;t=t.parent)if(r==t)return!0;return!1}function nO(r){let e=r.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let i=r.options.simulateBreak,s=r.state.doc.lineAt(t.from),o=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let a=t.to;;){let l=e.childAfter(a);if(!l||l==n)return null;if(!l.type.isSkipped)return l.from<o?t:null;a=l.to}}function pD({closing:r,align:e=!0,units:t=1}){return n=>Bm(n,e,t,r)}function Bm(r,e,t,n,i){let s=r.textAfter,o=s.match(/^\s*/)[0].length,a=n&&s.slice(o,o+n.length)==n||i==r.pos+o,l=e?nO(r):null;return l?a?r.column(l.from):r.column(l.to):r.baseIndent+(a?0:r.unit*t)}const gD=r=>r.baseIndent;function Fm({except:r,units:e=1}={}){return t=>{let n=r&&r.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const iO=200;function sO(){return We.transactionFilter.of(r=>{if(!r.docChanged||!r.isUserEvent("input.type")&&!r.isUserEvent("input.complete"))return r;let e=r.startState.languageDataAt("indentOnInput",r.startState.selection.main.head);if(!e.length)return r;let t=r.newDoc,{head:n}=r.newSelection.main,i=t.lineAt(n);if(n>i.from+iO)return r;let s=t.sliceString(i.from,n);if(!e.some(c=>c.test(s)))return r;let{state:o}=r,a=-1,l=[];for(let{head:c}of o.selection.ranges){let u=o.doc.lineAt(c);if(u.from==a)continue;a=u.from;let h=qa(o,u.from);if(h==null)continue;let d=/^\s*/.exec(u.text)[0],p=ss(o,h);d!=p&&l.push({from:u.from,to:u.from+d.length,insert:p})}return l.length?[r,{changes:l,sequential:!0}]:r})}const oO=de.define(),jm=new Be;function aO(r){let e=r.firstChild,t=r.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?r.to:t.from}:null}function lO(r,e,t){let n=Nt(r);if(n.length<t)return null;let i=n.resolveStack(t,1),s=null;for(let o=i;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(jm);if(l&&(a.to<n.length-50||n.length==r.doc.length||!cO(a))){let c=l(a,r);c&&c.from<=t&&c.from>=e&&c.to>t&&(s=c)}}return s}function cO(r){let e=r.lastChild;return e&&e.to==r.to&&e.type.isError}function vo(r,e,t){for(let n of r.facet(oO)){let i=n(r,e,t);if(i)return i}return lO(r,e,t)}function Vm(r,e){let t=e.mapPos(r.from,1),n=e.mapPos(r.to,-1);return t>=n?void 0:{from:t,to:n}}const yo=Ae.define({map:Vm}),os=Ae.define({map:Vm});function Tu(r){let e=[];for(let{head:t}of r.state.selection.ranges)e.some(n=>n.from<=t&&n.to>=t)||e.push(r.lineBlockAt(t));return e}const qn=kt.define({create(){return we.none},update(r,e){r=r.map(e.changes);for(let t of e.effects)if(t.is(yo)&&!uO(r,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(Mu),i=n?we.replace({widget:new yO(n(e.state,t.value))}):Hm;r=r.update({add:[i.range(t.value.from,t.value.to)]})}else t.is(os)&&(r=r.update({filter:(n,i)=>t.value.from!=n||t.value.to!=i,filterFrom:t.value.from,filterTo:t.value.to}));if(e.selection){let t=!1,{head:n}=e.selection.main;r.between(n,n,(i,s)=>{i<n&&s>n&&(t=!0)}),t&&(r=r.update({filterFrom:n,filterTo:n,filter:(i,s)=>s<=n||i>=n}))}return r},provide:r=>he.decorations.from(r),toJSON(r,e){let t=[];return r.between(0,e.doc.length,(n,i)=>{t.push(n,i)}),t},fromJSON(r){if(!Array.isArray(r)||r.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<r.length;){let n=r[t++],i=r[t++];if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");e.push(Hm.range(n,i))}return we.set(e,!0)}});function mD(r){return r.field(qn,!1)||RangeSet.empty}function bo(r,e,t){var n;let i=null;return(n=r.field(qn,!1))===null||n===void 0||n.between(e,t,(s,o)=>{(!i||i.from>s)&&(i={from:s,to:o})}),i}function uO(r,e,t){let n=!1;return r.between(e,e,(i,s)=>{i==e&&s==t&&(n=!0)}),n}function Pu(r,e){return r.field(qn,!1)?e:e.concat(Ae.appendConfig.of(Wm()))}const fO=r=>{for(let e of Tu(r)){let t=vo(r.state,e.from,e.to);if(t)return r.dispatch({effects:Pu(r.state,[yo.of(t),el(r,t)])}),!0}return!1},hO=r=>{if(!r.state.field(qn,!1))return!1;let e=[];for(let t of Tu(r)){let n=bo(r.state,t.from,t.to);n&&e.push(os.of(n),el(r,n,!1))}return e.length&&r.dispatch({effects:e}),e.length>0};function el(r,e,t=!0){let n=r.state.doc.lineAt(e.from).number,i=r.state.doc.lineAt(e.to).number;return he.announce.of(`${r.state.phrase(t?"Folded lines":"Unfolded lines")} ${n} ${r.state.phrase("to")} ${i}.`)}const dO=r=>{let{state:e}=r,t=[];for(let n=0;n<e.doc.length;){let i=r.lineBlockAt(n),s=vo(e,i.from,i.to);s&&t.push(yo.of(s)),n=(s?r.lineBlockAt(s.to):i).to+1}return t.length&&r.dispatch({effects:Pu(r.state,t)}),!!t.length},pO=r=>{let e=r.state.field(qn,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,r.state.doc.length,(n,i)=>{t.push(os.of({from:n,to:i}))}),r.dispatch({effects:t}),!0};function gO(r,e){for(let t=e;;){let n=vo(r.state,t.from,t.to);if(n&&n.to>e.from)return n;if(!t.from)return null;t=r.lineBlockAt(t.from-1)}}const vD=r=>{let e=[];for(let t of Tu(r)){let n=bo(r.state,t.from,t.to);if(n)e.push(os.of(n),el(r,n,!1));else{let i=gO(r,t);i&&e.push(yo.of(i),el(r,i))}}return e.length>0&&r.dispatch({effects:Pu(r.state,e)}),!!e.length},mO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:fO},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:hO},{key:"Ctrl-Alt-[",run:dO},{key:"Ctrl-Alt-]",run:pO}],vO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"\u2026"},Mu=de.define({combine(r){return zr(r,vO)}});function Wm(r){let e=[qn,wO];return r&&e.push(Mu.of(r)),e}function $m(r,e){let{state:t}=r,n=t.facet(Mu),i=o=>{let a=r.lineBlockAt(r.posAtDOM(o.target)),l=bo(r.state,a.from,a.to);l&&r.dispatch({effects:os.of(l)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(r,i,e);let s=document.createElement("span");return s.textContent=n.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const Hm=we.replace({widget:new class extends on{toDOM(r){return $m(r,null)}}});class yO extends on{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return $m(e,this.value)}}const bO={openText:"\u2304",closedText:"\u203A",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Iu extends un{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 xO(r={}){let e=Object.assign(Object.assign({},bO),r),t=new Iu(e,!0),n=new Iu(e,!1),i=ut.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(_n)!=o.state.facet(_n)||o.startState.field(qn,!1)!=o.state.field(qn,!1)||Nt(o.startState)!=Nt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let a=new Un;for(let l of o.viewportLineBlocks){let c=bo(o.state,l.from,l.to)?n:vo(o.state,l.from,l.to)?t:null;c&&a.add(l.from,l.from,c)}return a.finish()}}),{domEventHandlers:s}=e;return[i,bm({class:"cm-foldGutter",markers(o){var a;return((a=o.plugin(i))===null||a===void 0?void 0:a.markers)||Ge.empty},initialSpacer(){return new Iu(e,!1)},domEventHandlers:Object.assign(Object.assign({},s),{click:(o,a,l)=>{if(s.click&&s.click(o,a,l))return!0;let c=bo(o.state,a.from,a.to);if(c)return o.dispatch({effects:os.of(c)}),!0;let u=vo(o.state,a.from,a.to);return u?(o.dispatch({effects:yo.of(u)}),!0):!1}})}),Wm()]}const wO=he.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"}});class as{constructor(e,t){this.specs=e;let n;function i(a){let l=Gn.newName();return(n||(n=Object.create(null)))["."+l]=a,l}const s=typeof t.all=="string"?t.all:t.all?i(t.all):void 0,o=t.scope;this.scope=o instanceof xr?a=>a.prop(ki)==o.data:o?a=>a==o:void 0,this.style=zd(e.map(a=>({tag:a.tag,class:a.class||i(Object.assign({},a,{tag:null}))})),{all:s}).style,this.module=n?new Gn(n):null,this.themeType=t.themeType}static define(e,t){return new as(e,t||{})}}const Du=de.define(),zm=de.define({combine(r){return r.length?[r[0]]:null}});function tl(r){let e=r.facet(Du);return e.length?e:r.facet(zm)}function Nu(r,e){let t=[kO],n;return r instanceof as&&(r.module&&t.push(he.styleModule.of(r.module)),n=r.themeType),e?.fallback?t.push(zm.of(r)):n?t.push(Du.computeN([he.darkTheme],i=>i.facet(he.darkTheme)==(n=="dark")?[r]:[])):t.push(Du.of(r)),t}function yD(r,e,t){let n=tl(r),i=null;if(n){for(let s of n)if(!s.scope||t&&s.scope(t)){let o=s.style(e);o&&(i=i?i+" "+o:o)}}return i}class SO{constructor(e){this.markCache=Object.create(null),this.tree=Nt(e.state),this.decorations=this.buildDeco(e,tl(e.state))}update(e){let t=Nt(e.state),n=tl(e.state),i=n!=tl(e.startState);t.length<e.view.viewport.to&&!i&&t.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n))}buildDeco(e,t){if(!t||!this.tree.length)return we.none;let n=new Un;for(let{from:i,to:s}of e.visibleRanges)qS(this.tree,t,(o,a,l)=>{n.add(o,a,this.markCache[l]||(this.markCache[l]=we.mark({class:l})))},i,s);return n.finish()}}const kO=xi.high(ut.fromClass(SO,{decorations:r=>r.decorations})),AO=as.define([{tag:M.meta,color:"#404740"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,textDecoration:"underline",fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strong,fontWeight:"bold"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.keyword,color:"#708"},{tag:[M.atom,M.bool,M.url,M.contentSeparator,M.labelName],color:"#219"},{tag:[M.literal,M.inserted],color:"#164"},{tag:[M.string,M.deleted],color:"#a11"},{tag:[M.regexp,M.escape,M.special(M.string)],color:"#e40"},{tag:M.definition(M.variableName),color:"#00f"},{tag:M.local(M.variableName),color:"#30a"},{tag:[M.typeName,M.namespace],color:"#085"},{tag:M.className,color:"#167"},{tag:[M.special(M.variableName),M.macroName],color:"#256"},{tag:M.definition(M.propertyName),color:"#00c"},{tag:M.comment,color:"#940"},{tag:M.invalid,color:"#f00"}]),CO=he.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Um=1e4,Gm="()[]{}",Km=de.define({combine(r){return zr(r,{afterCursor:!0,brackets:Gm,maxScanDistance:Um,renderMatch:TO})}}),OO=we.mark({class:"cm-matchingBracket"}),EO=we.mark({class:"cm-nonmatchingBracket"});function TO(r){let e=[],t=r.matched?OO:EO;return e.push(t.range(r.start.from,r.start.to)),r.end&&e.push(t.range(r.end.from,r.end.to)),e}const PO=[kt.define({create(){return we.none},update(r,e){if(!e.docChanged&&!e.selection)return r;let t=[],n=e.state.facet(Km);for(let i of e.state.selection.ranges){if(!i.empty)continue;let s=fn(e.state,i.head,-1,n)||i.head>0&&fn(e.state,i.head-1,1,n)||n.afterCursor&&(fn(e.state,i.head,1,n)||i.head<e.state.doc.length&&fn(e.state,i.head+1,-1,n));s&&(t=t.concat(n.renderMatch(s,e.state)))}return we.set(t,!0)},provide:r=>he.decorations.from(r)}),CO];function MO(r={}){return[Km.of(r),PO]}const IO=new Be;function Ru(r,e,t){let n=r.prop(e<0?Be.openedBy:Be.closedBy);if(n)return n;if(r.name.length==1){let i=t.indexOf(r.name);if(i>-1&&i%2==(e<0?1:0))return[t[i+e]]}return null}function Lu(r){let e=r.type.prop(IO);return e?e(r.node):r}function fn(r,e,t,n={}){let i=n.maxScanDistance||Um,s=n.brackets||Gm,o=Nt(r),a=o.resolveInner(e,t);for(let l=a;l;l=l.parent){let c=Ru(l.type,t,s);if(c&&l.from<l.to){let u=Lu(l);if(u&&(t>0?e>=u.from&&e<u.to:e>u.from&&e<=u.to))return DO(r,e,t,l,u,c,s)}}return NO(r,e,t,o,a.type,i,s)}function DO(r,e,t,n,i,s,o){let a=n.parent,l={from:i.from,to:i.to},c=0,u=a?.cursor();if(u&&(t<0?u.childBefore(n.from):u.childAfter(n.to)))do if(t<0?u.to<=n.from:u.from>=n.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let h=Lu(u);return{start:l,end:h?{from:h.from,to:h.to}:void 0,matched:!0}}else if(Ru(u.type,t,o))c++;else if(Ru(u.type,-t,o)){if(c==0){let h=Lu(u);return{start:l,end:h&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1}}c--}}while(t<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function NO(r,e,t,n,i,s,o){let a=t<0?r.sliceDoc(e-1,e):r.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},u=r.doc.iterRange(e,t>0?r.doc.length:0),h=0;for(let d=0;!u.next().done&&d<=s;){let p=u.value;t<0&&(d+=p.length);let m=e+d*t;for(let y=t>0?0:p.length-1,w=t>0?p.length:-1;y!=w;y+=t){let A=o.indexOf(p[y]);if(!(A<0||n.resolveInner(m+y,1).type!=i))if(A%2==0==t>0)h++;else{if(h==1)return{start:c,end:{from:m+y,to:m+y+1},matched:A>>1==l>>1};h--}}t>0&&(d+=p.length)}return u.done?{start:c,matched:!1}:null}function Ym(r,e,t,n=0,i=0){e==null&&(e=r.search(/[^\s\u00a0]/),e==-1&&(e=r.length));let s=i;for(let o=n;o<e;o++)r.charCodeAt(o)==9?s+=t-s%t:s++;return s}class Jm{constructor(e,t,n,i){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(typeof e=="string"?n=t==e:n=t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Ym(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var e;return(e=this.overrideIndent)!==null&&e!==void 0?e:Ym(this.string,null,this.tabSize)}match(e,t,n){if(typeof e=="string"){let i=o=>n?o.toLowerCase():o,s=this.string.substr(this.pos,e.length);return i(s)==i(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{let i=this.string.slice(this.pos).match(e);return i&&i.index>0?null:(i&&t!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function RO(r){return{name:r.name||"",token:r.token,blankLine:r.blankLine||(()=>{}),startState:r.startState||(()=>!0),copyState:r.copyState||LO,indent:r.indent||(()=>null),languageData:r.languageData||{},tokenTable:r.tokenTable||Fu}}function LO(r){if(typeof r!="object")return r;let e={};for(let t in r){let n=r[t];e[t]=n instanceof Array?n.slice():n}return e}const Qm=new WeakMap;class Xm extends null{constructor(e){let t=Em(e.languageData),n=RO(e),i,s=new class extends Parser{createParse(o,a,l){return new FO(i,o,a,l)}};super(t,s,[Nm.of((o,a)=>this.getIndent(o,a))],e.name),this.topNode=WO(t),i=this,this.streamParser=n,this.stateAfter=new NodeProp({perNode:!0}),this.tokenTable=e.tokenTable?new t0(n.tokenTable):VO}static define(e){return new Xm(e)}getIndent(e,t){let n=Nt(e.state),i=n.resolve(t);for(;i&&i.type!=this.topNode;)i=i.parent;if(!i)return null;let s,{overrideIndentation:o}=e.options;o&&(s=Qm.get(e.state),s!=null&&s<t-1e4&&(s=void 0));let a=Bu(this,n,0,i.from,s??t),l,c;if(a?(c=a.state,l=a.pos+1):(c=this.streamParser.startState(e.unit),l=0),t-l>1e4)return null;for(;l<t;){let h=e.state.doc.lineAt(l),d=Math.min(t,h.to);if(h.length){let p=o?o(h.from):-1,m=new Jm(h.text,e.state.tabSize,e.unit,p<0?void 0:p);for(;m.pos<d-h.from;)_m(this.streamParser.token,m,c)}else this.streamParser.blankLine(c,e.unit);if(d==t)break;l=h.to+1}let u=e.lineAt(t);return o&&s==null&&Qm.set(e.state,u.from),this.streamParser.indent(c,/^\s*(.*)/.exec(u.text)[1],e)}get allowsNesting(){return!1}}function Bu(r,e,t,n,i){let s=t>=n&&t+e.length<=i&&e.prop(r.stateAfter);if(s)return{state:r.streamParser.copyState(s),pos:t+e.length};for(let o=e.children.length-1;o>=0;o--){let a=e.children[o],l=t+e.positions[o],c=a instanceof Tree&&l<i&&Bu(r,a,l,n,i);if(c)return c}return null}function Zm(r,e,t,n,i){if(i&&t<=0&&n>=e.length)return e;!i&&e.type==r.topNode&&(i=!0);for(let s=e.children.length-1;s>=0;s--){let o=e.positions[s],a=e.children[s],l;if(o<n&&a instanceof Tree){if(!(l=Zm(r,a,t-o,n-o,i)))break;return i?new Tree(e.type,e.children.slice(0,s).concat(l),e.positions.slice(0,s+1),o+l.length):l}}return null}function BO(r,e,t,n){for(let i of e){let s=i.from+(i.openStart?25:0),o=i.to-(i.openEnd?25:0),a=s<=t&&o>t&&Bu(r,i.tree,0-i.offset,t,o),l;if(a&&(l=Zm(r,i.tree,t+i.offset,a.pos+i.offset,!1)))return{state:a.state,tree:l}}return{state:r.streamParser.startState(n?Ai(n):4),tree:Tree.empty}}class FO{constructor(e,t,n,i){this.lang=e,this.input=t,this.fragments=n,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=ns.get(),o=i[0].from,{state:a,tree:l}=BO(e,n,o,s?.state);this.state=a,this.parsedPos=this.chunkStart=o+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Ai(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let e=ns.get(),t=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),n=Math.min(t,this.chunkStart+2048);for(e&&(n=Math.min(n,e.viewport.to));this.parsedPos<n;)this.parseLine(e);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=t?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,t),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let t=this.input.chunk(e);if(this.input.lineChunks)t==`
|
|
150
150
|
`&&(t="");else{let n=t.indexOf(`
|
|
151
|
-
`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,n=o+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,i,s){if(this.ranges.length>1){s=this.skipGapsTo(t,s,1),t+=s;let o=this.chunk.length;s=this.skipGapsTo(n,s,-1),n+=s,i+=this.chunk.length-o}return this.chunk.push(e,t,n,i),s}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Jm(t,e?e.state.tabSize:4,e?Ai(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=_m(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Tree.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:FO,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Tree(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Tree(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function _m(r,e,t){e.start=e.pos;for(let n=0;n<10;n++){let i=r(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const Fu=Object.create(null),xo=[er.none],FO=new sa(xo),qm=[],e0=Object.create(null);for(let[r,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"]])e0[r]=r0(Fu,e);class t0{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),e0)}resolve(e){return e?this.table[e]||(this.table[e]=r0(this.extra,e)):0}}const jO=new t0(Fu);function ju(r,e){qm.indexOf(r)>-1||(qm.push(r),console.warn(e))}function r0(r,e){let t=[];for(let s of e.split(" ")){let o=[];for(let a of s.split(".")){let l=r[a]||M[a];l?typeof l=="function"?o.length?o=o.map(l):ju(a,`Modifier ${a} used at start of tag`):o.length?ju(a,`Tag ${a} used as modifier`):o=Array.isArray(l)?l:[l]:ju(a,`Unknown highlighting tag ${a}`)}for(let a of o)t.push(a)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=er.define({id:xo.length,name:n,props:[$d({[n]:t})]});return xo.push(i),i.id}function VO(r){let e=NodeType.define({id:xo.length,name:"Document",props:[ki.add(()=>r)],top:!0});return xo.push(e),e}const bD=()=>r=>{try{JSON.parse(r.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=WO(e,r.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function WO(r,e){let t;return(t=r.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=r.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const $O=Za.define({name:"json",parser:rk.configure({props:[Rm.add({Object:Fm({except:/^\s*\}/}),Array:Fm({except:/^\s*\]/})}),jm.add({"Object Array":oO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function HO(){return new XC($O)}function Vu(){return Vu=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Vu.apply(this,arguments)}function zO(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}const UO=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=$u(r.state,t.from);return n.line?GO(r):n.block?YO(r):!1};function Wu(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=r(e,t);return i?(n(t.update(i)),!0):!1}}const GO=Wu(XO,0),xD=null,wD=null,KO=Wu(n0,0),SD=null,kD=null,YO=Wu((r,e)=>n0(r,e,QO(e)),0);function $u(r,e){let t=r.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const wo=50;function JO(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-wo,n),o=r.sliceDoc(i,i+wo),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:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-n<=2*wo?u=h=r.sliceDoc(n,i):(u=r.sliceDoc(n,n+wo),h=r.sliceDoc(i-wo,i));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-t.length;return u.slice(d,d+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function QO(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),i=t.to<=n.to?n:r.doc.lineAt(t.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function n0(r,e,t=e.selection.ranges){let n=t.map(s=>$u(e,s.from).block);if(!n.every(s=>s))return null;let i=t.map((s,o)=>JO(e,n[o],s.from,s.to));if(r!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(r!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function XO(r,e,t=e.selection.ranges){let n=[],i=-1;for(let{from:s,to:o}of t){let a=n.length,l=1e9,c=$u(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,p=d==h.length,m=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),n.push({line:h,comment:m,token:c,indent:d,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=l);n.length==a+1&&(n[a].single=!0)}}if(r!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of n)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(r!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Hu=sn.define(),ZO=sn.define(),_O=de.define(),i0=de.define({combine(r){return zr(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}});function qO(r){let e=0;return r.iterChangedRanges((t,n)=>e=n),e}const zu=kt.define({create(){return hn.empty},update(r,e){let t=e.state.facet(i0),n=e.annotation(Hu);if(n){let l=e.docChanged?ie.single(qO(e.changes)):void 0,c=ar.fromTransaction(e,l),u=n.side,h=u==0?r.undone:r.done;return c?h=nl(h,h.length,t.minDepth,c):h=a0(h,e.startState.selection),new hn(u==0?n.rest:h,u==0?h:n.rest)}let i=e.annotation(ZO);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(Tt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=ar.fromTransaction(e),o=e.annotation(Tt.time),a=e.annotation(Tt.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new hn(r.done.map(ar.fromJSON),r.undone.map(ar.fromJSON))}});function e2(r={}){return[zu,i0.of(r),he.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?s0:e.inputType=="historyRedo"?Uu:null;return n?(e.preventDefault(),n(t)):!1}})]}const AD=null;function rl(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(zu,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}const s0=rl(0,!1),Uu=rl(1,!1),t2=rl(0,!0),r2=rl(1,!0);function CD(r){return function(e){let t=e.field(zu,!1);if(!t)return 0;let n=r==0?t.done:t.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const OD=null,ED=null;class ar{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new ar(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;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:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new ar(e.changes&&Et.fromJSON(e.changes),[],e.mapped&&nn.fromJSON(e.mapped),e.startSelection&&ie.fromJSON(e.startSelection),e.selectionsAfter.map(ie.fromJSON))}static fromTransaction(e,t){let n=Rr;for(let i of e.startState.facet(_O)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new ar(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Rr)}static selection(e){return new ar(void 0,Rr,void 0,void 0,e)}}function nl(r,e,t,n){let i=e+1>t+20?e-t-1:0,s=r.slice(i,e);return s.push(n),s}function n2(r,e){let t=[],n=!1;return r.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],u=t[l++];a>=c&&o<=u&&(n=!0)}}),n}function i2(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function o0(r,e){return r.length?e.length?r.concat(e):r:e}const Rr=[],s2=200;function a0(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-s2));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),nl(r,r.length-1,1e9,t.setSelAfter(n)))}else return[ar.selection([e])]}function o2(r){let e=r[r.length-1],t=r.slice();return t[r.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Gu(r,e){if(!r.length)return r;let t=r.length,n=Rr;for(;t;){let i=a2(r[t-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let s=r.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,n=i.selectionsAfter}return n.length?[ar.selection(n)]:Rr}function a2(r,e,t){let n=o0(r.selectionsAfter.length?r.selectionsAfter.map(a=>a.map(e)):Rr,t);if(!r.changes)return ar.selection(n);let i=r.changes.map(e),s=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(s):s;return new ar(i,Ae.mapEffects(r.effects,e),o,r.startSelection.map(s),n)}const l2=/^(input\.type|delete)($|\.)/;class hn{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new hn(this.done,this.undone):this}addChanges(e,t,n,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||l2.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,n2(a.changes,e.changes))||n=="input.type.compose")?o=nl(o,o.length-1,i.minDepth,new ar(e.changes.compose(a.changes),o0(e.effects,a.effects),a.mapped,a.startSelection,Rr)):o=nl(o,o.length,i.minDepth,e),new hn(o,Rr,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Rr;return s.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&i2(s[s.length-1],e)?this:new hn(a0(this.done,e),this.undone,t,n)}addMapping(e){return new hn(Gu(this.done,e),Gu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1];if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Hu.of({side:e,rest:o2(i)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=i.length==1?Rr:i.slice(0,i.length-1);return s.mapped&&(o=Gu(o,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Hu.of({side:e,rest:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}hn.empty=new hn(Rr,Rr);const c2=[{key:"Mod-z",run:s0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Uu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Uu,preventDefault:!0},{key:"Mod-u",run:t2,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:r2,preventDefault:!0}];function ls(r,e){return ie.create(r.ranges.map(e),r.mainIndex)}function dn(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Lr({state:r,dispatch:e},t){let n=ls(r.selection,t);return n.eq(r.selection)?!1:(e(dn(r,n)),!0)}function So(r,e){return ie.cursor(e?r.to:r.from)}function il(r,e){return Lr(r,t=>t.empty?r.moveByChar(t,e):So(t,e))}function Jt(r){return r.textDirectionAt(r.state.selection.main.head)==ft.LTR}const l0=r=>il(r,!Jt(r)),c0=r=>il(r,Jt(r)),TD=r=>il(r,!0),PD=r=>il(r,!1);function sl(r,e){return Lr(r,t=>t.empty?r.moveByGroup(t,e):So(t,e))}const u2=r=>sl(r,!Jt(r)),f2=r=>sl(r,Jt(r)),MD=r=>sl(r,!0),ID=r=>sl(r,!1),u0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function f0(r,e,t){let n=r.state.charCategorizer(e.from),i=CharCategory.Space,s=e.from,o=0,a=!1,l=!1,c=!1,u=d=>{if(a)return!1;s+=t?d.length:-d.length;let p=n(d),m;if(p==CharCategory.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(p=-1),i==CharCategory.Space&&(i=p),i!=p)return!1;if(i==CharCategory.Word)if(d.toLowerCase()==d){if(!t&&l)return!1;c=!0}else if(c){if(t)return!1;a=!0}else{if(l&&t&&n(m=r.state.sliceDoc(s,s+1))==CharCategory.Word&&m.toLowerCase()==m)return!1;l=!0}return o++,!0},h=r.moveByChar(e,t,d=>(u(d),u));if(u0&&i==CharCategory.Word&&h.from==e.from+o*(t?1:-1)){let d=Math.min(e.head,h.head),p=Math.max(e.head,h.head),m=r.state.sliceDoc(d,p);if(m.length>1&&/[\u4E00-\uffff]/.test(m)){let y=Array.from(u0.segment(m));if(y.length>1)return t?EditorSelection.cursor(e.head+y[1].index,-1):EditorSelection.cursor(h.head+y[y.length-1].index,1)}}return h}function h0(r,e){return Lr(r,t=>t.empty?f0(r,t,e):So(t,e))}const DD=r=>h0(r,!0),ND=r=>h0(r,!1);function h2(r,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(r.sliceDoc(e.from,e.to)))||e.firstChild}function ol(r,e,t){let n=Nt(r).resolveInner(e.head),i=t?Be.closedBy:Be.openedBy;for(let l=e.head;;){let c=t?n.childAfter(l):n.childBefore(l);if(!c)break;h2(r,c,i)?n=c:l=t?c.to:c.from}let s=n.type.prop(i),o,a;return s&&(o=t?fn(r,n.from,1):fn(r,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,ie.cursor(a,t?-1:1)}const d2=r=>Lr(r,e=>ol(r.state,e,!Jt(r))),p2=r=>Lr(r,e=>ol(r.state,e,Jt(r)));function d0(r,e){return Lr(r,t=>{if(!t.empty)return So(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const p0=r=>d0(r,!1),g0=r=>d0(r,!0);function m0(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,i;if(e){for(let s of r.state.facet(he.scrollMargins)){let o=s(r);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(n=Math.max(o?.bottom,n))}i=r.scrollDOM.clientHeight-t-n}else i=(r.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(r.defaultLineHeight,i-5)}}function v0(r,e){let t=m0(r),{state:n}=r,i=ls(n.selection,o=>o.empty?r.moveVertically(o,e,t.height):So(o,e));if(i.eq(n.selection))return!1;let s;if(t.selfScroll){let o=r.coordsAtPos(n.selection.main.head),a=r.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=he.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return r.dispatch(dn(n,i),{effects:s}),!0}const y0=r=>v0(r,!1),Ku=r=>v0(r,!0);function ei(r,e,t){let n=r.lineBlockAt(e.head),i=r.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?n.to:n.from)&&(i=r.moveToLineBoundary(e,t,!1)),!t&&i.head==n.from&&n.length){let s=/^\s*/.exec(r.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(i=ie.cursor(n.from+s))}return i}const g2=r=>Lr(r,e=>ei(r,e,!0)),m2=r=>Lr(r,e=>ei(r,e,!1)),v2=r=>Lr(r,e=>ei(r,e,!Jt(r))),y2=r=>Lr(r,e=>ei(r,e,Jt(r))),b2=r=>Lr(r,e=>ie.cursor(r.lineBlockAt(e.head).from,1)),x2=r=>Lr(r,e=>ie.cursor(r.lineBlockAt(e.head).to,-1));function b0(r,e,t){let n=!1,i=ls(r.selection,s=>{let o=fn(r,s.head,-1)||fn(r,s.head,1)||s.head>0&&fn(r,s.head-1,1)||s.head<r.doc.length&&fn(r,s.head+1,-1);if(!o||!o.end)return s;n=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return t?ie.range(s.anchor,a):ie.cursor(a)});return n?(e(dn(r,i)),!0):!1}const w2=({state:r,dispatch:e})=>b0(r,e,!1),RD=({state:r,dispatch:e})=>b0(r,e,!0);function wr(r,e){let t=ls(r.state.selection,n=>{let i=e(n);return ie.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(r.state.selection)?!1:(r.dispatch(dn(r.state,t)),!0)}function al(r,e){return wr(r,t=>r.moveByChar(t,e))}const x0=r=>al(r,!Jt(r)),w0=r=>al(r,Jt(r)),LD=r=>al(r,!0),BD=r=>al(r,!1);function ll(r,e){return wr(r,t=>r.moveByGroup(t,e))}const S2=r=>ll(r,!Jt(r)),k2=r=>ll(r,Jt(r)),FD=r=>ll(r,!0),jD=r=>ll(r,!1);function S0(r,e){return wr(r,t=>f0(r,t,e))}const VD=r=>S0(r,!0),WD=r=>S0(r,!1),A2=r=>wr(r,e=>ol(r.state,e,!Jt(r))),C2=r=>wr(r,e=>ol(r.state,e,Jt(r)));function k0(r,e){return wr(r,t=>r.moveVertically(t,e))}const A0=r=>k0(r,!1),C0=r=>k0(r,!0);function O0(r,e){return wr(r,t=>r.moveVertically(t,e,m0(r).height))}const E0=r=>O0(r,!1),T0=r=>O0(r,!0),O2=r=>wr(r,e=>ei(r,e,!0)),E2=r=>wr(r,e=>ei(r,e,!1)),T2=r=>wr(r,e=>ei(r,e,!Jt(r))),P2=r=>wr(r,e=>ei(r,e,Jt(r))),M2=r=>wr(r,e=>ie.cursor(r.lineBlockAt(e.head).from)),I2=r=>wr(r,e=>ie.cursor(r.lineBlockAt(e.head).to)),P0=({state:r,dispatch:e})=>(e(dn(r,{anchor:0})),!0),M0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.doc.length})),!0),I0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.selection.main.anchor,head:0})),!0),D0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),D2=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),N2=({state:r,dispatch:e})=>{let t=ul(r).map(({from:n,to:i})=>ie.range(n,Math.min(i+1,r.doc.length)));return e(r.update({selection:ie.create(t),userEvent:"select"})),!0},R2=({state:r,dispatch:e})=>{let t=ls(r.selection,n=>{var i;let s=Nt(r).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&(!((i=a.parent)===null||i===void 0)&&i.parent))return ie.range(a.to,a.from)}return n});return e(dn(r,t)),!0},L2=({state:r,dispatch:e})=>{let t=r.selection,n=null;return t.ranges.length>1?n=ie.create([t.main]):t.main.empty||(n=ie.create([ie.cursor(t.main.head)])),n?(e(dn(r,n)),!0):!1};function cs(r,e){if(r.state.readOnly)return!1;let t="delete.selection",{state:n}=r,i=n.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=cl(r,l,!1)):l>o&&(t="delete.forward",l=cl(r,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=cl(r,o,!1),a=cl(r,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:ie.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(r.dispatch(n.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?he.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function cl(r,e,t){if(r instanceof he)for(let n of r.state.facet(he.atomicRanges).map(i=>i(r)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const N0=(r,e)=>cs(r,t=>{let n=t.from,{state:i}=r,s=i.doc.lineAt(n),o,a;if(!e&&n>s.from&&n<s.from+200&&!/[^ \t]/.test(o=s.text.slice(0,n-s.from))){if(o[o.length-1]==" ")return n-1;let l=Xi(o,i.tabSize),c=l%Ai(i)||Ai(i);for(let u=0;u<c&&o[o.length-1-u]==" ";u++)n--;a=n}else a=Ut(s.text,n-s.from,e,e)+s.from,a==n&&s.number!=(e?i.doc.lines:1)&&(a+=e?1:-1);return a}),Yu=r=>N0(r,!1),R0=r=>N0(r,!0),L0=(r,e)=>cs(r,t=>{let n=t.head,{state:i}=r,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let a=null;;){if(n==(e?s.to:s.from)){n==t.head&&s.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let l=Ut(s.text,n-s.from,e)+s.from,c=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||n!=t.head)&&(a=u),n=l}return n}),B0=r=>L0(r,!1),B2=r=>L0(r,!0),F2=r=>cs(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),$D=r=>cs(r,e=>{let t=r.lineBlockAt(e.head).from;return e.head>t?t:Math.max(0,e.head-1)}),j2=r=>cs(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),V2=r=>cs(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),HD=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=[];for(let n=0,i="",s=r.doc.iter();;){if(s.next(),s.lineBreak||s.done){let o=i.search(/\s+$/);if(o>-1&&t.push({from:n-(i.length-o),to:n}),s.done)break;i=""}else i=s.value;n+=s.value.length}return t.length?(e(r.update({changes:t,userEvent:"delete"})),!0):!1},W2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Qe.of(["",""])},range:ie.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},$2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>{if(!n.empty||n.from==0||n.from==r.doc.length)return{range:n};let i=n.from,s=r.doc.lineAt(i),o=i==s.from?i-1:Ut(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Ut(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:r.doc.slice(i,a).append(r.doc.slice(o,i))},range:ie.cursor(a)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ul(r){let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.from),s=r.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=r.doc.lineAt(n.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:i.from,to:s.to,ranges:[n]});t=s.number+1}return e}function F0(r,e,t){if(r.readOnly)return!1;let n=[],i=[];for(let s of ul(r)){if(t?s.to==r.doc.length:s.from==0)continue;let o=r.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+r.lineBreak});for(let l of s.ranges)i.push(ie.range(Math.min(r.doc.length,l.anchor+a),Math.min(r.doc.length,l.head+a)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:r.lineBreak+o.text});for(let l of s.ranges)i.push(ie.range(l.anchor-a,l.head-a))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:ie.create(i,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const H2=({state:r,dispatch:e})=>F0(r,e,!1),z2=({state:r,dispatch:e})=>F0(r,e,!0);function j0(r,e,t){if(r.readOnly)return!1;let n=[];for(let i of ul(r))t?n.push({from:i.from,insert:r.doc.slice(i.from,i.to)+r.lineBreak}):n.push({from:i.to,insert:r.lineBreak+r.doc.slice(i.from,i.to)});return e(r.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const U2=({state:r,dispatch:e})=>j0(r,e,!1),G2=({state:r,dispatch:e})=>j0(r,e,!0),K2=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(ul(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=ls(e.selection,i=>r.moveVertically(i,!0)).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},zD=({state:r,dispatch:e})=>(e(r.update(r.replaceSelection(r.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function Y2(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Nt(r).resolveInner(e),n=t.childBefore(e),i=t.childAfter(e),s;return n&&i&&n.to<=e&&i.from>=e&&(s=n.type.prop(Be.closedBy))&&s.indexOf(i.name)>-1&&r.doc.lineAt(n.to).from==r.doc.lineAt(i.from).from&&!/\S/.test(r.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const J2=V0(!1),Q2=V0(!0);function V0(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!r&&s==o&&Y2(e,s);r&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new mo(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=qa(c,s);for(u==null&&(u=Xi(/^\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 h=["",ss(e,u)];return l&&h.push(ss(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Qe.of(h)},range:ie.cursor(s+1+h[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ju(r,e){let t=-1;return r.changeByRange(n=>{let i=[];for(let o=n.from;o<=n.to;){let a=r.doc.lineAt(o);a.number>t&&(n.empty||n.to>a.from)&&(e(a,i,n),t=a.number),o=a.to+1}let s=r.changes(i);return{changes:i,range:ie.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const X2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new mo(r,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=Ju(r,(s,o,a)=>{let l=qa(n,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=ss(r,l);(c!=u||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(r.update(i,{userEvent:"indent"})),!0},Qu=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Ju(r,(t,n)=>{n.push({from:t.from,insert:r.facet(_a)})}),{userEvent:"input.indent"})),!0),W0=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Ju(r,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Xi(i,r.tabSize),o=0,a=ss(r,Math.max(0,s-Ai(r)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),UD=({state:r,dispatch:e})=>r.selection.ranges.some(t=>!t.empty)?Qu({state:r,dispatch:e}):(e(r.update(r.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),Z2=[{key:"Ctrl-b",run:l0,shift:x0,preventDefault:!0},{key:"Ctrl-f",run:c0,shift:w0},{key:"Ctrl-p",run:p0,shift:A0},{key:"Ctrl-n",run:g0,shift:C0},{key:"Ctrl-a",run:b2,shift:M2},{key:"Ctrl-e",run:x2,shift:I2},{key:"Ctrl-d",run:R0},{key:"Ctrl-h",run:Yu},{key:"Ctrl-k",run:F2},{key:"Ctrl-Alt-h",run:B0},{key:"Ctrl-o",run:W2},{key:"Ctrl-t",run:$2},{key:"Ctrl-v",run:Ku}],_2=[{key:"ArrowLeft",run:l0,shift:x0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:u2,shift:S2,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:v2,shift:T2,preventDefault:!0},{key:"ArrowRight",run:c0,shift:w0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:f2,shift:k2,preventDefault:!0},{mac:"Cmd-ArrowRight",run:y2,shift:P2,preventDefault:!0},{key:"ArrowUp",run:p0,shift:A0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:P0,shift:I0},{mac:"Ctrl-ArrowUp",run:y0,shift:E0},{key:"ArrowDown",run:g0,shift:C0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:M0,shift:D0},{mac:"Ctrl-ArrowDown",run:Ku,shift:T0},{key:"PageUp",run:y0,shift:E0},{key:"PageDown",run:Ku,shift:T0},{key:"Home",run:m2,shift:E2,preventDefault:!0},{key:"Mod-Home",run:P0,shift:I0},{key:"End",run:g2,shift:O2,preventDefault:!0},{key:"Mod-End",run:M0,shift:D0},{key:"Enter",run:J2},{key:"Mod-a",run:D2},{key:"Backspace",run:Yu,shift:Yu},{key:"Delete",run:R0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:B0},{key:"Mod-Delete",mac:"Alt-Delete",run:B2},{mac:"Mod-Backspace",run:j2},{mac:"Mod-Delete",run:V2}].concat(Z2.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),q2=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:d2,shift:A2},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:p2,shift:C2},{key:"Alt-ArrowUp",run:H2},{key:"Shift-Alt-ArrowUp",run:U2},{key:"Alt-ArrowDown",run:z2},{key:"Shift-Alt-ArrowDown",run:G2},{key:"Escape",run:L2},{key:"Mod-Enter",run:Q2},{key:"Alt-l",mac:"Ctrl-l",run:N2},{key:"Mod-i",run:R2,preventDefault:!0},{key:"Mod-[",run:W0},{key:"Mod-]",run:Qu},{key:"Mod-Alt-\\",run:X2},{key:"Shift-Mod-k",run:K2},{key:"Shift-Mod-\\",run:w2},{key:"Mod-/",run:UO},{key:"Alt-A",run:KO}].concat(_2),eE={key:"Tab",run:Qu,shift:W0};function rt(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];typeof i=="string"?r.setAttribute(n,i):i!=null&&(r[n]=i)}e++}for(;e<arguments.length;e++)$0(r,arguments[e]);return r}function $0(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)$0(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}const H0=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class us{constructor(e,t,n=0,i=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(n,i),this.bufferStart=n,this.normalize=s?a=>s(H0(a)):H0,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 Lt(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=kc(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Dr(e);let i=this.normalize(t);for(let s=0,o=n;;s++){let a=i.charCodeAt(s),l=this.match(a,o);if(s==i.length-1){if(l)return this.value=l,this;break}o==n&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t){let n=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],o=!1;this.query.charCodeAt(s)==e&&(s==this.query.length-1?n={from:this.matches[i+1],to:t+1}:(this.matches[i]++,o=!0)),o||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:t,to:t+1}:this.matches.push(1,t)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}typeof Symbol<"u"&&(us.prototype[Symbol.iterator]=function(){return this});const z0={from:-1,to:-1,match:/.*/.exec("")},Xu="gm"+(/x/.unicode==null?"":"u");class U0{constructor(e,t,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=z0,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new G0(e,t,n,i,s);this.re=new RegExp(t,Xu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=fl(e,i),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 n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=fl(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,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}}}const Zu=new WeakMap;class fs{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=Zu.get(e);if(!i||i.from>=n||i.to<=t){let a=new fs(t,e.sliceString(t,n));return Zu.set(e,a),a}if(i.from==t&&i.to==n)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<n&&(s+=e.sliceString(i.to,n)),Zu.set(e,new fs(o,s)),new fs(t,s.slice(t-o,n-o))}}class G0{constructor(e,t,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=z0,this.matchPos=fl(e,i),this.re=new RegExp(t,Xu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=fs.get(e,i,this.chunkEnd(i+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 n=this.flat.from+t.index,i=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this.matchPos=fl(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=fs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(U0.prototype[Symbol.iterator]=G0.prototype[Symbol.iterator]=function(){return this});function tE(r){try{return new RegExp(r,Xu),!0}catch{return!1}}function fl(r,e){if(e>=r.length)return e;let t=r.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function _u(r){let e=String(r.state.doc.lineAt(r.state.selection.main.head).number),t=rt("input",{class:"cm-textfield",name:"line",value:e}),n=rt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),r.dispatch({effects:hl.of(!1)}),r.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},rt("label",r.state.phrase("Go to line"),": ",t)," ",rt("button",{class:"cm-button",type:"submit"},r.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=r,a=o.doc.lineAt(o.selection.main.head),[,l,c,u,h]=s,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&h){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),y=ie.cursor(m.from+Math.max(0,Math.min(d,m.length)));r.dispatch({effects:[hl.of(!1),he.scrollIntoView(y.from,{y:"center"})],selection:y}),r.focus()}return{dom:n}}const hl=Ae.define(),K0=kt.define({create(){return!0},update(r,e){for(let t of e.effects)t.is(hl)&&(r=t.value);return r},provide:r=>ho.from(r,e=>e?_u:null)}),rE=r=>{let e=fo(r,_u);if(!e){let t=[hl.of(!0)];r.state.field(K0,!1)==null&&t.push(Ae.appendConfig.of([K0,nE])),r.dispatch({effects:t}),e=fo(r,_u)}return e&&e.dom.querySelector("input").select(),!0},nE=he.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),iE={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Y0=de.define({combine(r){return zr(r,iE,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function sE(r){let e=[uE,cE];return r&&e.push(Y0.of(r)),e}const oE=we.mark({class:"cm-selectionMatch"}),aE=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function J0(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=ot.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=ot.Word)}function lE(r,e,t,n){return r(e.sliceDoc(t,t+1))==ot.Word&&r(e.sliceDoc(n-1,n))==ot.Word}const cE=ut.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.selectionSet||r.docChanged||r.viewportChanged)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=r.state.facet(Y0),{state:t}=r,n=t.selection;if(n.ranges.length>1)return we.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return we.none;let l=t.wordAt(i.head);if(!l)return we.none;o=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return we.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(J0(o,t,i.from,i.to)&&lE(o,t,i.from,i.to)))return we.none}else if(s=t.sliceDoc(i.from,i.to).trim(),!s)return we.none}let a=[];for(let l of r.visibleRanges){let c=new us(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||J0(o,t,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(aE.range(u,h)):(u>=i.to||h<=i.from)&&a.push(oE.range(u,h)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:r=>r.decorations}),uE=he.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),fE=({state:r,dispatch:e})=>{let{selection:t}=r,n=ie.create(t.ranges.map(i=>r.wordAt(i.head)||ie.cursor(i.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function hE(r,e){let{main:t,ranges:n}=r.selection,i=r.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new us(r.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new us(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(s){let l=r.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const dE=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return fE({state:r,dispatch:e});let n=r.sliceDoc(t[0].from,t[0].to);if(r.selection.ranges.some(s=>r.sliceDoc(s.from,s.to)!=n))return!1;let i=hE(r,n);return i?(e(r.update({selection:r.selection.addRange(ie.range(i.from,i.to),!1),effects:he.scrollIntoView(i.to)})),!0):!1},Ci=de.define({combine(r){return zr(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new CE(e),scrollToMatch:e=>he.scrollIntoView(e)})}});function GD(r){return r?[Ci.of(r),nf]:nf}class Q0{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||tE(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
152
|
-
`:n=="r"?"\r":n=="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 vE(this):new gE(this)}getCursor(e,t=0,n){let i=e.doc?e:We.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?ds(this,i,t,n):hs(this,i,t,n)}}class X0{constructor(e){this.spec=e}}function hs(r,e,t,n){return new us(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:i=>i.toLowerCase(),r.wholeWord?pE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function pE(r,e){return(t,n,i,s)=>((s>t||s+i.length<n)&&(s=Math.max(0,t-2),i=r.sliceString(s,Math.min(r.length,n+2))),(e(dl(i,t-s))!=ot.Word||e(pl(i,t-s))!=ot.Word)&&(e(pl(i,n-s))!=ot.Word||e(dl(i,n-s))!=ot.Word))}class gE extends X0{constructor(e){super(e)}nextMatch(e,t,n){let i=hs(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=hs(this.spec,e,0,t).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=hs(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=hs(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=hs(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ds(r,e,t,n){return new U0(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:r.wholeWord?mE(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function dl(r,e){return r.slice(Ut(r,e,!1),e)}function pl(r,e){return r.slice(e,Ut(r,e))}function mE(r){return(e,t,n)=>!n[0].length||(r(dl(n.input,n.index))!=ot.Word||r(pl(n.input,n.index))!=ot.Word)&&(r(pl(n.input,n.index+n[0].length))!=ot.Word||r(dl(n.input,n.index+n[0].length))!=ot.Word)}class vE extends X0{nextMatch(e,t,n){let i=ds(this.spec,e,n,e.doc.length).next();return i.done&&(i=ds(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),o=ds(this.spec,e,s,n),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,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t))}matchAll(e,t){let n=ds(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=ds(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const ko=Ae.define(),qu=Ae.define(),pn=kt.define({create(r){return new ef(vl(r).create(),null)},update(r,e){for(let t of e.effects)t.is(ko)?r=new ef(t.value.create(),r.panel):t.is(qu)&&(r=new ef(r.query,t.value?tf:null));return r},provide:r=>ho.from(r,e=>e.panel)});function KD(r){let e=r.field(pn,!1);return e?e.query.spec:vl(r)}function YD(r){var e;return((e=r.field(pn,!1))===null||e===void 0?void 0:e.panel)!=null}class ef{constructor(e,t){this.query=e,this.panel=t}}const yE=we.mark({class:"cm-searchMatch"}),bE=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),xE=ut.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(pn))}update(r){let e=r.state.field(pn);(e!=r.startState.field(pn)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return we.none;let{view:t}=this,n=new Un;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;r.highlight(t.state,a,l,(c,u)=>{let h=t.state.selection.ranges.some(d=>d.from==c&&d.to==u);n.add(c,u,h?bE:yE)})}return n.finish()}},{decorations:r=>r.decorations});function Ao(r){return e=>{let t=e.state.field(pn,!1);return t&&t.query.spec.valid?r(e,t):ev(e)}}const gl=Ao((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=ie.single(n.from,n.to),s=r.state.facet(Ci);return r.dispatch({selection:i,effects:[rf(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),q0(r),!0}),ml=Ao((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(!i)return!1;let s=ie.single(i.from,i.to),o=r.state.facet(Ci);return r.dispatch({selection:s,effects:[rf(r,i),o.scrollToMatch(s.main,r)],userEvent:"select.search"}),q0(r),!0}),wE=Ao((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:ie.create(t.map(n=>ie.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),SE=({state:r,dispatch:e})=>{let t=r.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:i}=t.main,s=[],o=0;for(let a=new us(r.doc,r.sliceDoc(n,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==n&&(o=s.length),s.push(ie.range(a.value.from,a.value.to))}return e(r.update({selection:ie.create(s,o),userEvent:"select.search.matches"})),!0},Z0=Ao((r,{query:e})=>{let{state:t}=r,{from:n,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let o=[],a,l,c=[];if(s.from==n&&s.to==i&&(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(he.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=ie.single(s.from-u,s.to-u),c.push(rf(r,s)),c.push(t.facet(Ci).scrollToMatch(a.main,r))}return r.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),kE=Ao((r,{query:e})=>{if(r.state.readOnly)return!1;let t=e.matchAll(r.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let n=r.state.phrase("replaced $ matches",t.length)+".";return r.dispatch({changes:t,effects:he.announce.of(n),userEvent:"input.replace.all"}),!0});function tf(r){return r.state.facet(Ci).createPanel(r)}function vl(r,e){var t,n,i,s,o;let a=r.selection.main,l=a.empty||a.to>a.from+100?"":r.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=r.facet(Ci);return new Q0({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i: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 _0(r){let e=fo(r,tf);return e&&e.dom.querySelector("[main-field]")}function q0(r){let e=_0(r);e&&e==r.root.activeElement&&e.select()}const ev=r=>{let e=r.state.field(pn,!1);if(e&&e.panel){let t=_0(r);if(t&&t!=r.root.activeElement){let n=vl(r.state,e.query.spec);n.valid&&r.dispatch({effects:ko.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[qu.of(!0),e?ko.of(vl(r.state,e.query.spec)):Ae.appendConfig.of(nf)]});return!0},tv=r=>{let e=r.state.field(pn,!1);if(!e||!e.panel)return!1;let t=fo(r,tf);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:qu.of(!1)}),!0},AE=[{key:"Mod-f",run:ev,scope:"editor search-panel"},{key:"F3",run:gl,shift:ml,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:gl,shift:ml,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tv,scope:"editor search-panel"},{key:"Mod-Shift-l",run:SE},{key:"Alt-g",run:rE},{key:"Mod-d",run:dE,preventDefault:!0}];class CE{constructor(e){this.view=e;let t=this.query=e.state.field(pn).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:t.search,placeholder:Sr(e,"Find"),"aria-label":Sr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=rt("input",{value:t.replace,placeholder:Sr(e,"Replace"),"aria-label":Sr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=rt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=rt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=rt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(i,s,o){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>gl(e),[Sr(e,"next")]),n("prev",()=>ml(e),[Sr(e,"previous")]),n("select",()=>wE(e),[Sr(e,"all")]),rt("label",null,[this.caseField,Sr(e,"match case")]),rt("label",null,[this.reField,Sr(e,"regexp")]),rt("label",null,[this.wordField,Sr(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,n("replace",()=>Z0(e),[Sr(e,"replace")]),n("replaceAll",()=>kE(e),[Sr(e,"replace all")])],rt("button",{name:"close",onclick:()=>tv(e),"aria-label":Sr(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Q0({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:ko.of(e)}))}keydown(e){KA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ml:gl)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Z0(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(ko)&&!n.value.eq(this.query)&&this.setQuery(n.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(Ci).top}}function Sr(r,e){return r.state.phrase(e)}const yl=30,bl=/[\s\.,:;?!]/;function rf(r,{from:e,to:t}){let n=r.state.doc.lineAt(e),i=r.state.doc.lineAt(t).to,s=Math.max(n.from,e-yl),o=Math.min(i,t+yl),a=r.state.sliceDoc(s,o);if(s!=n.from){for(let l=0;l<yl;l++)if(!bl.test(a[l+1])&&bl.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-yl;l--)if(!bl.test(a[l-1])&&bl.test(a[l])){a=a.slice(0,l);break}}return he.announce.of(`${r.state.phrase("current match")}. ${a} ${r.state.phrase("on line")} ${n.number}.`)}const OE=he.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"}}),nf=[pn,xi.low(xE),OE];class rv{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Nt(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),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(sv(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function nv(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function EE(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let n=nv(e)+nv(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function TE(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:EE(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function JD(r,e){return t=>{for(let n=syntaxTree(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return e(t);if(n.type.isTop)break}return null}}function QD(r,e){return t=>{for(let n=syntaxTree(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class iv{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function ti(r){return r.selection.main.from}function sv(r,e){var t;let{source:n}=r,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?r:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":"")}const ov=sn.define();function PE(r,e,t,n){let{main:i}=r.selection,s=t-i.from,o=n-i.from;return Object.assign(Object.assign({},r.changeByRange(a=>a!=i&&t!=n&&r.sliceDoc(a.from+s,a.from+o)!=r.sliceDoc(t,n)?{range:a}:{changes:{from:a.from+s,to:n==i.from?a.to:a.from+o,insert:e},range:ie.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const av=new WeakMap;function ME(r){if(!Array.isArray(r))return r;let e=av.get(r);return e||av.set(r,e=TE(r)),e}const sf=Ae.define(),Co=Ae.define();class IE{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 n=Lt(e,t),i=Dr(n);this.chars.push(n);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(Lt(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,!0}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:t,folded:n,any:i,precise:s,byWord:o}=this;if(t.length==1){let T=Lt(e,0),P=Dr(T),L=P==e.length?0:-100;if(T!=t[0])if(T==n[0])L+=-200;else return!1;return this.ret(L,[0,P])}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 T=0,P=Math.min(e.length,200);T<P&&c<l;){let L=Lt(e,T);(L==t[c]||L==n[c])&&(i[c++]=T),T+=Dr(L)}if(c<l)return!1}let u=0,h=0,d=!1,p=0,m=-1,y=-1,w=/[a-z]/.test(e),A=!0;for(let T=0,P=Math.min(e.length,200),L=0;T<P&&h<l;){let D=Lt(e,T);a<0&&(u<l&&D==t[u]&&(s[u++]=T),p<l&&(D==t[p]||D==n[p]?(p==0&&(m=T),y=T+1,p++):p=0));let j,W=D<255?D>=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(j=kc(D))!=j.toLowerCase()?1:j!=j.toUpperCase()?2:0;(!T||W==1&&w||L==0&&W!=0)&&(t[h]==D||n[h]==D&&(d=!0)?o[h++]=T:o.length&&(A=!1)),L=W,T+=Dr(D)}return h==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-200+-700-e.length,[m,y]):h==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,e):t.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],s=0;for(let o of t){let a=o+(this.astral?Dr(Lt(n,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-n.length,i)}}const Qt=de.define({combine(r){return zr(r,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:DE,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)=>n=>lv(e(n),t(n)),optionClass:(e,t)=>n=>lv(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})}});function lv(r,e){return r?e?r+" "+e:r:e}function DE(r,e,t,n,i,s){let o=r.textDirection==ft.RTL,a=o,l=!1,c="top",u,h,d=e.left-i.left,p=i.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&d<Math.min(m,p)?a=!1:!a&&p<Math.min(m,d)&&(a=!0),m<=(a?d:p))u=Math.max(i.top,Math.min(t.top,i.bottom-y))-e.top,h=Math.min(400,a?d:p);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let T=i.bottom-e.bottom;T>=y||T>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let w=(e.bottom-e.top)/s.offsetHeight,A=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${h/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function NE(r){let e=r.addToOptions.slice();return r.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,i){let s=document.createElement("span");s.className="cm-completionLabel";let o=t.displayLabel||t.label,a=0;for(let l=0;l<i.length;){let c=i[l++],u=i[l++];c>a&&s.appendChild(document.createTextNode(o.slice(a,c)));let h=s.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(c,u))),h.className="cm-completionMatchedText",a=u}return a<o.length&&s.appendChild(document.createTextNode(o.slice(a))),s},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function of(r,e,t){if(r<=t)return{from:0,to:r};if(e<0&&(e=0),e<=r>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let n=Math.floor((r-e)/t);return{from:r-(n+1)*t,to:r-n*t}}class RE{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(Qt);this.optionContent=NE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=of(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 u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Qt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Co.of(null)})}),this.showOptions(s,i.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 n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:o,disabled:a}=n.open;(!i.open||i.open.options!=s)&&(this.range=of(s.length,o,e.state.facet(Qt).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((t=i.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 n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);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=of(t.options.length,t.selected,this.view.state.facet(Qt).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(n);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>Nr(this.view.state,o,"completion info")):this.addInfoPane(s,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&BE(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=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 i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Qt).positionInfo(this.view,t,i,n,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,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=s&&(o>n.from||n.from==0))if(s=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let d of this.optionContent){let p=d(a,this.view.state,l);p&&u.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function LE(r,e){return t=>new RE(t,r,e)}function BE(r,e){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect(),i=t.height/r.offsetHeight;n.top<t.top?r.scrollTop-=(t.top-n.top)/i:n.bottom>t.bottom&&(r.scrollTop+=(n.bottom-t.bottom)/i)}function cv(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function FE(r,e){let t=[],n=null,i=l=>{t.push(l);let{section:c}=l.completion;if(c){n||(n=[]);let u=typeof c=="string"?c:c.name;n.some(h=>h.name==u)||n.push(typeof c=="string"?{name:u}:c)}};for(let l of r)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let u of l.result.options)i(new iv(u,l.source,c?c(u):[],1e9-t.length));else{let u=new IE(e.sliceDoc(l.from,l.to));for(let h of l.result.options)if(u.match(h.label)){let d=h.displayLabel?c?c(h,u.matched):[]:u.matched;i(new iv(h,l.source,d,u.score+(h.boost||0)))}}}if(n){let l=Object.create(null),c=0,u=(h,d)=>{var p,m;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(h.name<d.name?-1:1)};for(let h of n.sort(u))c-=1e5,l[h.name]=c;for(let h of t){let{section:d}=h.completion;d&&(h.score+=l[typeof d=="string"?d:d.name])}}let s=[],o=null,a=e.facet(Qt).compareCompletions;for(let l of t.sort((c,u)=>u.score-c.score||a(c.completion,u.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?s.push(l):cv(l.completion)>cv(o)&&(s[s.length-1]=l),o=l.completion}return s}class ps{constructor(e,t,n,i,s,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ps(this.options,uv(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,s){let o=FE(e,t);if(!o.length)return i&&e.some(l=>l.state==1)?new ps(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=t.facet(Qt).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let l=i.options[i.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new ps(o,uv(n,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:HE,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new ps(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class xl{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new xl(WE,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Qt),s=(n.override||t.languageDataAt("autocomplete",ti(t)).map(ME)).map(a=>(this.active.find(c=>c.source==a)||new lr(a,this.active.some(c=>c.state!=0)?1:0)).update(e,n));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))||!jE(s,this.active)?o=ps.build(s,t,this.id,o,n):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 lr(a.source,0):a));for(let a of e.effects)a.is(lf)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new xl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:VE}}function jE(r,e){if(r==e)return!0;for(let t=0,n=0;;){for(;t<r.length&&!r[t].hasResult;)t++;for(;n<e.length&&!e[n].hasResult;)n++;let i=t==r.length,s=n==e.length;if(i||s)return i==s;if(r[t++].result!=e[n++].result)return!1}}const VE={"aria-autocomplete":"list"};function uv(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const WE=[];function af(r){return r.isUserEvent("input.type")?"input":r.isUserEvent("delete.backward")?"delete":null}class lr{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=af(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new lr(i.source,0));for(let s of e.effects)if(s.is(sf))i=new lr(i.source,1,s.value?ti(e.state):-1);else if(s.is(Co))i=new lr(i.source,0);else if(s.is(fv))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,t,n){return t=="delete"||!n.activateOnTyping?this.map(e.changes):new lr(this.source,1)}handleChange(e){return e.changes.touchesRange(ti(e.startState))?new lr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new lr(this.source,this.state,e.mapPos(this.explicitPos))}}class gs extends lr{constructor(e,t,n,i,s){super(e,2,t),this.result=n,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,t,n){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ti(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||t=="delete"&&ti(e.startState)==this.from)return new lr(this.source,t=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return $E(this.result.validFor,e.state,s,o)?new gs(this.source,l,this.result,s,o):this.result.update&&(c=this.result.update(this.result,s,o,new rv(e.state,a,l>=0)))?new gs(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:ti(e.state)):new lr(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new lr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new gs(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function $E(r,e,t,n){if(!r)return!1;let i=e.sliceDoc(t,n);return typeof r=="function"?r(i,t,n,e):sv(r,!0).test(i)}const fv=Ae.define({map(r,e){return r.map(t=>t.map(e))}}),lf=Ae.define(),jt=kt.define({create(){return xl.start()},update(r,e){return r.update(e)},provide:r=>[Ja.from(r,e=>e.tooltip),he.contentAttributes.from(r,e=>e.attrs)]});function hv(r,e){const t=e.completion.apply||e.completion.label;let n=r.state.field(jt).active.find(i=>i.source==e.source);return n instanceof gs?(typeof t=="string"?r.dispatch(Object.assign(Object.assign({},PE(r.state,t,n.from,n.to)),{annotations:ov.of(e.completion)})):t(r,e.completion,n.from,n.to),!0):!1}const HE=LE(jt,hv);function wl(r,e="option"){return t=>{let n=t.state.field(jt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(Qt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=mm(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+i*(r?1:-1):r?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:lf.of(a)}),!0}}const zE=r=>{let e=r.state.field(jt,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<r.state.facet(Qt).interactionDelay?!1:hv(r,e.open.options[e.open.selected])},UE=r=>r.state.field(jt,!1)?(r.dispatch({effects:sf.of(!0)}),!0):!1,GE=r=>{let e=r.state.field(jt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:Co.of(null)}),!0)};class KE{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const YE=50,JE=1e3,QE=ut.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of r.state.field(jt).active)e.state==1&&this.startQuery(e)}update(r){let e=r.state.field(jt);if(!r.selectionSet&&!r.docChanged&&r.startState.field(jt)==e)return;let t=r.transactions.some(n=>(n.selection||n.docChanged)&&!af(n));for(let n=0;n<this.running.length;n++){let i=this.running[n];if(t||i.updates.length+r.transactions.length>YE&&Date.now()-i.time>JE){for(let s of i.context.abortListeners)try{s()}catch(o){Nr(this.view.state,o)}i.context.abortListeners=null,this.running.splice(n--,1)}else i.updates.push(...r.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(i=>i.active.source==n.source))?setTimeout(()=>this.startUpdate(),50):-1,this.composing!=0)for(let n of r.transactions)af(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:r}=this.view,e=r.field(jt);for(let t of e.active)t.state==1&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t)}startQuery(r){let{state:e}=this.view,t=ti(e),n=new rv(e,t,r.explicitPos==t),i=new KE(r,n);this.running.push(i),Promise.resolve(r.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Co.of(null)}),Nr(this.view.state,s)})}scheduleAccept(){this.running.every(r=>r.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Qt).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Qt);for(let n=0;n<this.running.length;n++){let i=this.running[n];if(i.done===void 0)continue;if(this.running.splice(n--,1),i.done){let o=new gs(i.active.source,i.active.explicitPos,i.done,i.done.from,(r=i.done.to)!==null&&r!==void 0?r:ti(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)o=o.update(a,t);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(jt).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new lr(i.active.source,0);for(let a of i.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:fv.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field(jt,!1);if(e&&e.tooltip&&this.view.state.facet(Qt).closeOnBlur){let t=e.open&&mm(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&this.view.dispatch({effects:Co.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:sf.of(!1)}),20),this.composing=0}}}),dv=he.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"}}});class XE{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class cf{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,MapMode.TrackDel),n=e.mapPos(this.to,1,MapMode.TrackDel);return t==null||n==null?null:new cf(this.field,t,n)}}class uf{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(indentUnit);i.push(t+c.length-u),l=c+l.slice(u)}n.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new cf(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],i=[],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;for(let u=0;u<t.length;u++)(a!=null?t[u].seq==a:l&&t[u].name==l)&&(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:l}),c=u;for(let h of i)h.field>=c&&h.field++}i.push(new XE(c,n.length,s.index,s.index+l.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of i)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(o)}return new uf(n,i)}}let ZE=we.widget({widget:new class extends on{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),_E=we.mark({class:"cm-snippetField"});class ms{constructor(e,t){this.ranges=e,this.active=t,this.deco=we.set(e.map(n=>(n.from==n.to?ZE:_E).range(n.from,n.to)))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new ms(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const Oo=Ae.define({map(r,e){return r&&r.map(e)}}),qE=Ae.define(),Oi=kt.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(Oo))return t.value;if(t.is(qE)&&r)return new ms(r.ranges,t.value)}return r&&e.docChanged&&(r=r.map(e.changes)),r&&e.selection&&!r.selectionInsideField(e.selection)&&(r=null),r},provide:r=>he.decorations.from(r,e=>e?e.deco:we.none)});function ff(r,e){return ie.create(r.filter(t=>t.field==e).map(t=>ie.range(t.from,t.to)))}function eT(r){let e=uf.parse(r);return(t,n,i,s)=>{let{text:o,ranges:a}=e.instantiate(t.state,i),l={changes:{from:i,to:s,insert:Text.of(o)},scrollIntoView:!0,annotations:n?ov.of(n):void 0};if(a.length&&(l.selection=ff(a,0)),a.length>1){let c=new ms(a,0),u=l.effects=[Oo.of(c)];t.state.field(Oi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Oi,sT,oT,dv]))}t.dispatch(t.state.update(l))}}function pv(r){return({state:e,dispatch:t})=>{let n=e.field(Oi,!1);if(!n||r<0&&n.active==0)return!1;let i=n.active+r,s=r>0&&!n.ranges.some(o=>o.field==i+r);return t(e.update({selection:ff(n.ranges,i),effects:Oo.of(s?null:new ms(n.ranges,i)),scrollIntoView:!0})),!0}}const tT=({state:r,dispatch:e})=>r.field(Oi,!1)?(e(r.update({effects:Oo.of(null)})),!0):!1,rT=pv(1),nT=pv(-1);function XD(r){let e=r.field(Oi,!1);return!!(e&&e.ranges.some(t=>t.field==e.active+1))}function ZD(r){let e=r.field(Oi,!1);return!!(e&&e.active>0)}const iT=[{key:"Tab",run:rT,shift:nT},{key:"Escape",run:tT}],gv=de.define({combine(r){return r.length?r[0]:iT}}),sT=xi.highest(oo.compute([gv],r=>r.facet(gv)));function _D(r,e){return Object.assign(Object.assign({},e),{apply:eT(r)})}const oT=he.domEventHandlers({mousedown(r,e){let t=e.state.field(Oi,!1),n;if(!t||(n=e.posAtCoords({x:r.clientX,y:r.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==t.active?!1:(e.dispatch({selection:ff(t.ranges,i.field),effects:Oo.of(t.ranges.some(s=>s.field>i.field)?new ms(t.ranges,i.field):null),scrollIntoView:!0}),!0)}});function aT(r){let e=r.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function mv(r,e){return new RegExp(e(r.source),r.unicode?"u":"")}const vv=null;function lT(r){return vv[r]||(vv[r]=new WeakMap)}function yv(r,e,t,n,i){for(let s=r.iterLines(),o=0;!s.next().done;){let{value:a}=s,l;for(e.lastIndex=0;l=e.exec(a);)if(!n[l[0]]&&o+l.index!=i&&(t.push({type:"text",label:l[0]}),n[l[0]]=!0,t.length>=2e3))return;o+=a.length+1}}function bv(r,e,t,n,i){let s=r.length>=1e3,o=s&&e.get(r);if(o)return o;let a=[],l=Object.create(null);if(r.children){let c=0;for(let u of r.children){if(u.length>=1e3)for(let h of bv(u,e,t,n-c,i-c))l[h.label]||(l[h.label]=!0,a.push(h));else yv(u,t,a,l,i-c);c+=u.length+1}}else yv(r,t,a,l,i);return s&&a.length<2e3&&e.set(r,a),a}const qD=r=>{let e=r.state.languageDataAt("wordChars",r.pos).join(""),t=aT(e),n=r.matchBefore(mv(t,o=>o+"$"));if(!n&&!r.explicit)return null;let i=n?n.from:r.pos,s=bv(r.state.doc,lT(e),t,5e4,i);return{from:i,options:s,validFor:mv(t,o=>"^"+o)}},Eo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ei=Ae.define({map(r,e){let t=e.mapPos(r,-1,rr.TrackAfter);return t??void 0}}),hf=new class extends wi{};hf.startSide=1,hf.endSide=-1;const xv=kt.define({create(){return Ge.empty},update(r,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,n=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(n,-1)&&(r=Ge.empty)}r=r.map(e.changes);for(let t of e.effects)t.is(Ei)&&(r=r.update({add:[hf.range(t.value,t.value+1)]}));return r}});function cT(){return[fT,xv]}const df="()[]{}<>";function wv(r){for(let e=0;e<df.length;e+=2)if(df.charCodeAt(e)==r)return df.charAt(e+1);return kc(r<128?r:r+1)}function Sv(r,e){return r.languageDataAt("closeBrackets",e)[0]||Eo}const uT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),fT=he.inputHandler.of((r,e,t,n)=>{if((uT?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&Dr(Lt(n,0))==1||e!=i.from||t!=i.to)return!1;let s=dT(r.state,n);return s?(r.dispatch(s),!0):!1}),hT=[{key:"Backspace",run:({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=Sv(r,r.selection.main.head).brackets||Eo.brackets,i=null,s=r.changeByRange(o=>{if(o.empty){let a=pT(r.doc,o.head);for(let l of n)if(l==a&&Sl(r.doc,o.head)==wv(Lt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:ie.cursor(o.head-l.length)}}return{range:i=o}});return i||e(r.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function dT(r,e){let t=Sv(r,r.selection.main.head),n=t.brackets||Eo.brackets;for(let i of n){let s=wv(Lt(i,0));if(e==i)return s==i?vT(r,i,n.indexOf(i+i+i)>-1,t):gT(r,i,s,t.before||Eo.before);if(e==s&&kv(r,r.selection.main.from))return mT(r,i,s)}return null}function kv(r,e){let t=!1;return r.field(xv).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function Sl(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Dr(Lt(t,0)))}function pT(r,e){let t=r.sliceString(e-2,e);return Dr(Lt(t,0))==t.length?t:t.slice(1)}function gT(r,e,t,n){let i=null,s=r.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ei.of(o.to+e.length),range:ie.range(o.anchor+e.length,o.head+e.length)};let a=Sl(r.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Ei.of(o.head+e.length),range:ie.cursor(o.head+e.length)}:{range:i=o}});return i?null:r.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function mT(r,e,t){let n=null,i=r.changeByRange(s=>s.empty&&Sl(r.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:ie.cursor(s.head+t.length)}:n={range:s});return n?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function vT(r,e,t,n){let i=n.stringPrefixes||Eo.stringPrefixes,s=null,o=r.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ei.of(a.to+e.length),range:ie.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Sl(r.doc,l),u;if(c==e){if(Av(r,l))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)};if(kv(r,l)){let d=t&&r.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:ie.cursor(l+d.length)}}}else{if(t&&r.sliceDoc(l-2*e.length,l)==e+e&&(u=Cv(r,l-2*e.length,i))>-1&&Av(r,u))return{changes:{insert:e+e+e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)};if(r.charCategorizer(l)(c)!=ot.Word&&Cv(r,l,i)>-1&&!yT(r,l,e,i))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)}}return{range:s=a}});return s?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Av(r,e){let t=Nt(r).resolveInner(e+1);return t.parent&&t.from==e}function yT(r,e,t,n){let i=Nt(r).resolveInner(e,-1),s=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=r.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>t.length+l;){if(r.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Cv(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=ot.Word)return e;for(let i of t){let s=e-i.length;if(r.sliceDoc(s,e)==i&&n(r.sliceDoc(s-1,s))!=ot.Word)return s}return-1}function bT(r={}){return[jt,Qt.of(r),QE,xT,dv]}const Ov=[{key:"Ctrl-Space",run:UE},{key:"Escape",run:GE},{key:"ArrowDown",run:wl(!0)},{key:"ArrowUp",run:wl(!1)},{key:"PageDown",run:wl(!0,"page")},{key:"PageUp",run:wl(!1,"page")},{key:"Enter",run:zE}],xT=xi.highest(oo.computeN([Qt],r=>r.facet(Qt).defaultKeymap?[Ov]:[]));function t3(r){let e=r.field(jt,!1);return e&&e.active.some(t=>t.state==1)?"pending":e&&e.active.some(t=>t.state!=0)?"active":null}const Ev=new WeakMap;function r3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;if(!t||t.disabled)return[];let n=Ev.get(t.options);return n||Ev.set(t.options,n=t.options.map(i=>i.completion)),n}function n3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.options[t.selected].completion:null}function i3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.selected:null}function s3(r){return lf.of(r)}class wT{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Ti{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,s=n.facet(Pi).markerFilter;s&&(i=s(i));let o=we.set(i.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?we.widget({widget:new PT(a),diagnostic:a}).range(a.from):we.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ti(o,t,vs(o))}}function vs(r,e=null,t=0){let n=null;return r.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new wT(i,s,o.diagnostic),!1}),n}function Tv(r,e){let t=r.startState.doc.lineAt(e.pos);return!!(r.effects.some(n=>n.is(kl))||r.changes.touchesRange(t.from,t.to))}function Pv(r,e){return r.field(Xt,!1)?e:e.concat(Ae.appendConfig.of(Wv))}function ST(r,e){return{effects:Pv(r,[kl.of(e)])}}const kl=Ae.define(),pf=Ae.define(),Mv=Ae.define(),Xt=kt.define({create(){return new Ti(we.none,null,null)},update(r,e){if(e.docChanged){let t=r.diagnostics.map(e.changes),n=null;if(r.selected){let i=e.changes.mapPos(r.selected.from,1);n=vs(t,r.selected.diagnostic,i)||vs(t,null,i)}r=new Ti(t,r.panel,n)}for(let t of e.effects)t.is(kl)?r=Ti.init(t.value,r.panel,e.state):t.is(pf)?r=new Ti(r.diagnostics,t.value?Al.open:null,r.selected):t.is(Mv)&&(r=new Ti(r.diagnostics,r.panel,t.value));return r},provide:r=>[ho.from(r,e=>e.panel),he.decorations.from(r,e=>e.diagnostics)]});function o3(r){let e=r.field(Xt,!1);return e?e.diagnostics.size:0}const kT=we.mark({class:"cm-lintRange cm-lintRange-active"});function AT(r,e,t){let{diagnostics:n}=r.state.field(Xt),i=[],s=2e8,o=0;n.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0))&&(i.push(u.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=r.state.facet(Pi).tooltipFilter;return a&&(i=a(i)),i.length?{pos:s,end:o,above:r.state.doc.lineAt(s).to<o,create(){return{dom:Iv(r,i)}}}:null}function Iv(r,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(t=>Lv(r,t,!1)))}const CT=r=>{let e=r.state.field(Xt,!1);(!e||!e.panel)&&r.dispatch({effects:Pv(r.state,[pf.of(!0)])});let t=fo(r,Al.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Dv=r=>{let e=r.state.field(Xt,!1);return!e||!e.panel?!1:(r.dispatch({effects:pf.of(!1)}),!0)},OT=r=>{let e=r.state.field(Xt,!1);if(!e)return!1;let t=r.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(r.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},a3=r=>{let{state:e}=r,t=e.field(Xt,!1);if(!t)return!1;let n=e.selection.main,i,s,o,a;return t.diagnostics.between(0,e.doc.length,(l,c)=>{c<n.to&&(i==null||i<l)&&(i=l,s=c),(o==null||l>o)&&(o=l,a=c)}),o==null||i==null&&o==n.from?!1:(r.dispatch({selection:{anchor:i??o,head:s??a},scrollIntoView:!0}),!0)},ET=[{key:"Mod-Shift-m",run:CT,preventDefault:!0},{key:"F8",run:OT}],Nv=ut.fromClass(class{constructor(r){this.view=r,this.timeout=-1,this.set=!0;let{delay:e}=r.state.facet(Pi);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let r=Date.now();if(r<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-r);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(Pi);Promise.all(t.map(n=>Promise.resolve(n(this.view)))).then(n=>{let i=n.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(ST(this.view.state,i))},n=>{Nr(this.view.state,n)})}}update(r){let e=r.state.facet(Pi);(r.docChanged||e!=r.startState.facet(Pi)||e.needsRefresh&&e.needsRefresh(r))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Pi=de.define({combine(r){return Object.assign({sources:r.map(e=>e.source)},zr(r.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function TT(r,e={}){return[Pi.of({source:r,config:e}),Nv,Wv]}function l3(r){let e=r.plugin(Nv);e&&e.force()}function Rv(r){let e=[];if(r)e:for(let{name:t}of r){for(let n=0;n<t.length;n++){let i=t[n];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Lv(r,e,t){var n;let i=t?Rv(e.actions):[];return rt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},rt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=vs(r.state.field(Xt).diagnostics,e);p&&s.apply(r,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),rt("u",c.slice(u,u+1)),c.slice(u+1)];return rt("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class PT extends on{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return rt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Bv{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Lv(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Al{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Dv(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Rv(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=vs(this.view.state.field(Xt).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},n=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=rt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=rt("div",{class:"cm-panel-lint"},this.list,rt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Dv(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(Xt).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(Xt),n=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,u;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==l.diagnostic){c=h;break}c<0?(u=new Bv(this.view,l.diagnostic),this.items.splice(n,0,u),i=!0):(u=this.items[c],c>n&&(this.items.splice(n,c-n),i=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Bv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!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"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Xt),n=vs(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Mv.of(n)})}static open(e){return new Al(e)}}function Cl(r,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(r)}</svg>')`}function Ol(r){return Cl(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${r}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const MT=he.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:Ol("#d11")},".cm-lintRange-warning":{backgroundImage:Ol("orange")},".cm-lintRange-info":{backgroundImage:Ol("#999")},".cm-lintRange-hint":{backgroundImage:Ol("#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}}});function Fv(r){return r=="error"?4:r=="warning"?3:r=="info"?2:1}class IT extends un{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((t,n)=>Fv(t)<Fv(n.severity)?n.severity:t,"hint")}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,i=e.state.facet(El).tooltipFilter;return i&&(n=i(n)),n.length&&(t.onmouseover=()=>NT(e,t,n)),t}}function DT(r,e){let t=n=>{let i=e.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),r.state.field(Vv)&&r.dispatch({effects:gf.of(null)})}};window.addEventListener("mousemove",t)}function NT(r,e,t){function n(){let o=r.elementAtHeight(e.getBoundingClientRect().top+5-r.documentTop);r.coordsAtPos(o.from)&&r.dispatch({effects:gf.of({pos:o.from,above:!1,create(){return{dom:Iv(r,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,DT(r,e)}let{hoverTime:i}=r.state.facet(El),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function RT(r,e){let t=Object.create(null);for(let i of e){let s=r.lineAt(i.from);(t[s.from]||(t[s.from]=[])).push(i)}let n=[];for(let i in t)n.push(new IT(t[i]).range(+i));return Ge.of(n,!0)}const LT=bm({class:"cm-gutter-lint",markers:r=>r.state.field(jv)}),jv=kt.define({create(){return Ge.empty},update(r,e){r=r.map(e.changes);let t=e.state.facet(El).markerFilter;for(let n of e.effects)if(n.is(kl)){let i=n.value;t&&(i=t(i||[])),r=RT(e.state.doc,i.slice(0))}return r}}),gf=Ae.define(),Vv=kt.define({create(){return null},update(r,e){return r&&e.docChanged&&(r=Tv(e,r)?null:Object.assign(Object.assign({},r),{pos:e.changes.mapPos(r.pos)})),e.effects.reduce((t,n)=>n.is(gf)?n.value:t,r)},provide:r=>Ja.from(r)}),BT=he.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Cl('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Cl('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Cl('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Wv=[Xt,he.decorations.compute([Xt],r=>{let{selected:e,panel:t}=r.field(Xt);return!e||!t||e.from==e.to?we.none:we.set([kT.range(e.from,e.to)])}),DC(AT,{hideOn:Tv}),MT],El=de.define({combine(r){return zr(r,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function c3(r={}){return[El.of(r),jv,LT,BT,Vv]}function u3(r,e){let t=r.field(Xt,!1);if(t&&t.diagnostics.size)for(let n=RangeSet.iter([t.diagnostics]);n.value;n.next())e(n.value.spec.diagnostic,n.from,n.to)}var $v=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(hT)),e.defaultKeymap!==!1&&(n=n.concat(q2)),e.searchKeymap!==!1&&(n=n.concat(AE)),e.historyKeymap!==!1&&(n=n.concat(c2)),e.foldKeymap!==!1&&(n=n.concat(gO)),e.completionKeymap!==!1&&(n=n.concat(Ov)),e.lintKeymap!==!1&&(n=n.concat(ET));var i=[];return e.lineNumbers!==!1&&i.push(WC()),e.highlightActiveLineGutter!==!1&&i.push(zC()),e.highlightSpecialChars!==!1&&i.push(lC()),e.history!==!1&&i.push(e2()),e.foldGutter!==!1&&i.push(bO()),e.drawSelection!==!1&&i.push(_A()),e.dropCursor!==!1&&i.push(nC()),e.allowMultipleSelections!==!1&&i.push(We.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(iO()),e.syntaxHighlighting!==!1&&i.push(Nu(kO,{fallback:!0})),e.bracketMatching!==!1&&i.push(PO()),e.closeBrackets!==!1&&i.push(cT()),e.autocompletion!==!1&&i.push(bT()),e.rectangularSelection!==!1&&i.push(SC()),t!==!1&&i.push(CC()),e.highlightActiveLine!==!1&&i.push(pC()),e.highlightSelectionMatches!==!1&&i.push(sE()),e.tabSize&&typeof e.tabSize=="number"&&i.push(_a.of(" ".repeat(e.tabSize))),i.concat([oo.of(n.flat())]).filter(Boolean)},f3=function(e){e===void 0&&(e={});var t=[];e.defaultKeymap!==!1&&(t=t.concat(defaultKeymap)),e.historyKeymap!==!1&&(t=t.concat(historyKeymap));var n=[];return e.highlightSpecialChars!==!1&&n.push(highlightSpecialChars()),e.history!==!1&&n.push(history()),e.drawSelection!==!1&&n.push(drawSelection()),e.syntaxHighlighting!==!1&&n.push(syntaxHighlighting(defaultHighlightStyle,{fallback:!0})),n.concat([keymap.of(t.flat())]).filter(Boolean)};const Hv="#e5c07b",mf="#e06c75",zv="#56b6c2",Uv="#ffffff",To="#abb2bf",Tl="#7d8799",Gv="#61afef",Kv="#98c379",vf="#d19a66",Yv="#c678dd",Jv="#21252b",yf="#2c313a",bf="#282c34",Pl="#353a42",Qv="#3E4451",xf="#528bff",h3={chalky:Hv,coral:mf,cyan:zv,invalid:Uv,ivory:To,stone:Tl,malibu:Gv,sage:Kv,whiskey:vf,violet:Yv,darkBackground:Jv,highlightBackground:yf,background:bf,tooltipBackground:Pl,selection:Qv,cursor:xf},FT=he.theme({"&":{color:To,backgroundColor:bf},".cm-content":{caretColor:xf},".cm-cursor, .cm-dropCursor":{borderLeftColor:xf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Qv},".cm-panels":{backgroundColor:Jv,color:To},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:bf,color:Tl,border:"none"},".cm-activeLineGutter":{backgroundColor:yf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Pl},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Pl,borderBottomColor:Pl},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:yf,color:To}}},{dark:!0}),jT=as.define([{tag:M.keyword,color:Yv},{tag:[M.name,M.deleted,M.character,M.propertyName,M.macroName],color:mf},{tag:[M.function(M.variableName),M.labelName],color:Gv},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:vf},{tag:[M.definition(M.name),M.separator],color:To},{tag:[M.typeName,M.className,M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:Hv},{tag:[M.operator,M.operatorKeyword,M.url,M.escape,M.regexp,M.link,M.special(M.string)],color:zv},{tag:[M.meta,M.comment],color:Tl},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.link,color:Tl,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:mf},{tag:[M.atom,M.bool,M.special(M.variableName)],color:vf},{tag:[M.processingInstruction,M.string,M.inserted],color:Kv},{tag:M.invalid,color:Uv}]),VT=[FT,Nu(jT)];var WT=he.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),$T=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(t&&l.unshift(oo.of([eE])),a&&(typeof a=="boolean"?l.unshift($v()):l.unshift($v(a))),o&&l.unshift(yC(o)),s){case"light":l.push(WT);break;case"dark":l.push(VT);break;case"none":break;default:l.push(s);break}return n===!1&&l.push(he.editable.of(!1)),i&&l.push(We.readOnly.of(!0)),[...l]},HT=r=>({line:r.state.doc.lineAt(r.state.selection.main.from),lineCount:r.state.doc.lines,lineBreak:r.state.lineBreak,length:r.state.doc.length,readOnly:r.state.readOnly,tabSize:r.state.tabSize,selection:r.state.selection,selectionAsSingle:r.state.selection.asSingle().main,ranges:r.state.selection.ranges,selectionCode:r.state.sliceDoc(r.state.selection.main.from,r.state.selection.main.to),selections:r.state.selection.ranges.map(e=>r.state.sliceDoc(e.from,e.to)),selectedText:r.state.selection.ranges.some(e=>!e.empty)}),Xv=sn.define(),zT=[];function UT(r){var{value:e,selection:t,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=zT,autoFocus:l,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:p=null,minWidth:m=null,maxWidth:y=null,placeholder:w="",editable:A=!0,readOnly:T=!1,indentWithTab:P=!0,basicSetup:L=!0,root:D,initialState:j}=r,[W,q]=(0,S.useState)(),[F,H]=(0,S.useState)(),[Q,oe]=(0,S.useState)(),fe=he.theme({"&":{height:u,minHeight:h,maxHeight:d,width:p,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),be=he.updateListener.of(Se=>{if(Se.docChanged&&typeof n=="function"&&!Se.transactions.some(De=>De.annotation(Xv))){var Oe=Se.state.doc,Te=Oe.toString();n(Te,Se)}i&&i(HT(Se))}),ke=$T({theme:c,editable:A,readOnly:T,placeholder:w,indentWithTab:P,basicSetup:L}),Re=[be,fe,...ke];return o&&typeof o=="function"&&Re.push(he.updateListener.of(o)),Re=Re.concat(a),(0,S.useEffect)(()=>{if(W&&!Q){var Se={doc:e,selection:t,extensions:Re},Oe=j?We.fromJSON(j.json,Se,j.fields):We.create(Se);if(oe(Oe),!F){var Te=new he({state:Oe,parent:W,root:D});H(Te),s&&s(Te,Oe)}}return()=>{F&&(oe(void 0),H(void 0))}},[W,Q]),(0,S.useEffect)(()=>q(r.container),[r.container]),(0,S.useEffect)(()=>()=>{F&&(F.destroy(),H(void 0))},[F]),(0,S.useEffect)(()=>{l&&F&&F.focus()},[l,F]),(0,S.useEffect)(()=>{F&&F.dispatch({effects:Ae.reconfigure.of(Re)})},[c,a,u,h,d,p,m,y,w,A,T,P,L,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var Se=F?F.state.doc.toString():"";F&&e!==Se&&F.dispatch({changes:{from:0,to:Se.length,insert:e||""},annotations:[Xv.of(!0)]})}},[e,F]),{state:Q,setState:oe,view:F,setView:H,container:W,setContainer:q}}var GT=f(61250),KT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Zv=(0,S.forwardRef)((r,e)=>{var{className:t,value:n="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:P,indentWithTab:L,editable:D,readOnly:j,root:W,initialState:q}=r,F=zO(r,KT),H=(0,S.useRef)(null),{state:Q,view:oe,container:fe}=UT({container:H.current,root:W,value:n,autoFocus:u,theme:h,height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:P,indentWithTab:L,editable:D,readOnly:j,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:q});if((0,S.useImperativeHandle)(e,()=>({editor:H.current,state:Q,view:oe}),[H,fe,Q,oe]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var be=typeof h=="string"?"cm-theme-"+h:"cm-theme";return(0,GT.jsx)("div",Vu({ref:H,className:""+be+(t?" "+t:"")},F))});Zv.displayName="CodeMirror";const YT=Zv,JT=(0,Je.ZP)(YT)`
|
|
151
|
+
`);n>-1&&(t=t.slice(0,n))}return e+t.length<=this.to?t:t.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,t=this.lineAfter(e),n=e+t.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=n||(t=t.slice(0,s-(n-t.length)),i++,i==this.ranges.length))break;let o=this.ranges[i].from,a=this.lineAfter(o);t+=a,n=o+a.length}return{line:t,end:n}}skipGapsTo(e,t,n){for(;;){let i=this.ranges[this.rangeIndex].to,s=e+t;if(n>0?i>s:i>=s)break;let o=this.ranges[++this.rangeIndex].from;t+=o-i}return t}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(e,t,n,i,s){if(this.ranges.length>1){s=this.skipGapsTo(t,s,1),t+=s;let o=this.chunk.length;s=this.skipGapsTo(n,s,-1),n+=s,i+=this.chunk.length-o}return this.chunk.push(e,t,n,i),s}parseLine(e){let{line:t,end:n}=this.nextLine(),i=0,{streamParser:s}=this.lang,o=new Jm(t,e?e.state.tabSize:4,e?Ai(e.state):2);if(o.eol())s.blankLine(this.state,o.indentUnit);else for(;!o.eol();){let a=_m(s.token,o,this.state);if(a&&(i=this.emitToken(this.lang.tokenTable.resolve(a),this.parsedPos+o.start,this.parsedPos+o.pos,4,i)),o.start>1e4)break}this.parsedPos=n,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let e=Tree.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:jO,topID:0,maxBufferLength:2048,reused:this.chunkReused});e=new Tree(e.type,e.children,e.positions,e.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(e),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new Tree(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}function _m(r,e,t){e.start=e.pos;for(let n=0;n<10;n++){let i=r(e,t);if(e.pos>e.start)return i}throw new Error("Stream parser failed to advance stream.")}const Fu=Object.create(null),xo=[er.none],jO=new sa(xo),qm=[],e0=Object.create(null);for(let[r,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"]])e0[r]=r0(Fu,e);class t0{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),e0)}resolve(e){return e?this.table[e]||(this.table[e]=r0(this.extra,e)):0}}const VO=new t0(Fu);function ju(r,e){qm.indexOf(r)>-1||(qm.push(r),console.warn(e))}function r0(r,e){let t=[];for(let s of e.split(" ")){let o=[];for(let a of s.split(".")){let l=r[a]||M[a];l?typeof l=="function"?o.length?o=o.map(l):ju(a,`Modifier ${a} used at start of tag`):o.length?ju(a,`Tag ${a} used as modifier`):o=Array.isArray(l)?l:[l]:ju(a,`Unknown highlighting tag ${a}`)}for(let a of o)t.push(a)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),i=er.define({id:xo.length,name:n,props:[$d({[n]:t})]});return xo.push(i),i.id}function WO(r){let e=NodeType.define({id:xo.length,name:"Document",props:[ki.add(()=>r)],top:!0});return xo.push(e),e}const xD=()=>r=>{try{JSON.parse(r.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=$O(e,r.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function $O(r,e){let t;return(t=r.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=r.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const HO=Za.define({name:"json",parser:nk.configure({props:[Rm.add({Object:Fm({except:/^\s*\}/}),Array:Fm({except:/^\s*\]/})}),jm.add({"Object Array":aO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function zO(){return new ZC(HO)}function Vu(){return Vu=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Vu.apply(this,arguments)}function UO(r,e){if(r==null)return{};var t={},n=Object.keys(r),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(t[i]=r[i]);return t}const GO=r=>{let{state:e}=r,t=e.doc.lineAt(e.selection.main.from),n=$u(r.state,t.from);return n.line?KO(r):n.block?JO(r):!1};function Wu(r,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=r(e,t);return i?(n(t.update(i)),!0):!1}}const KO=Wu(ZO,0),wD=null,SD=null,YO=Wu(n0,0),kD=null,AD=null,JO=Wu((r,e)=>n0(r,e,XO(e)),0);function $u(r,e){let t=r.languageDataAt("commentTokens",e);return t.length?t[0]:{}}const wo=50;function QO(r,{open:e,close:t},n,i){let s=r.sliceDoc(n-wo,n),o=r.sliceDoc(i,i+wo),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:n-a,margin:a&&1},close:{pos:i+l,margin:l&&1}};let u,h;i-n<=2*wo?u=h=r.sliceDoc(n,i):(u=r.sliceDoc(n,n+wo),h=r.sliceDoc(i-wo,i));let d=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(h)[0].length,m=h.length-p-t.length;return u.slice(d,d+e.length)==e&&h.slice(m,m+t.length)==t?{open:{pos:n+d+e.length,margin:/\s/.test(u.charAt(d+e.length))?1:0},close:{pos:i-p-t.length,margin:/\s/.test(h.charAt(m-1))?1:0}}:null}function XO(r){let e=[];for(let t of r.selection.ranges){let n=r.doc.lineAt(t.from),i=t.to<=n.to?n:r.doc.lineAt(t.to),s=e.length-1;s>=0&&e[s].to>n.from?e[s].to=i.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:i.to})}return e}function n0(r,e,t=e.selection.ranges){let n=t.map(s=>$u(e,s.from).block);if(!n.every(s=>s))return null;let i=t.map((s,o)=>QO(e,n[o],s.from,s.to));if(r!=2&&!i.every(s=>s))return{changes:e.changes(t.map((s,o)=>i[o]?[]:[{from:s.from,insert:n[o].open+" "},{from:s.to,insert:" "+n[o].close}]))};if(r!=1&&i.some(s=>s)){let s=[];for(let o=0,a;o<i.length;o++)if(a=i[o]){let l=n[o],{open:c,close:u}=a;s.push({from:c.pos-l.open.length,to:c.pos+c.margin},{from:u.pos-u.margin,to:u.pos+l.close.length})}return{changes:s}}return null}function ZO(r,e,t=e.selection.ranges){let n=[],i=-1;for(let{from:s,to:o}of t){let a=n.length,l=1e9,c=$u(e,s).line;if(c){for(let u=s;u<=o;){let h=e.doc.lineAt(u);if(h.from>i&&(s==o||o>h.from)){i=h.from;let d=/^\s*/.exec(h.text)[0].length,p=d==h.length,m=h.text.slice(d,d+c.length)==c?d:-1;d<h.text.length&&d<l&&(l=d),n.push({line:h,comment:m,token:c,indent:d,empty:p,single:!1})}u=h.to+1}if(l<1e9)for(let u=a;u<n.length;u++)n[u].indent<n[u].line.text.length&&(n[u].indent=l);n.length==a+1&&(n[a].single=!0)}}if(r!=2&&n.some(s=>s.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:a,token:l,indent:c,empty:u,single:h}of n)(h||!u)&&s.push({from:a.from+c,insert:l+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(r!=1&&n.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:a,token:l}of n)if(a>=0){let c=o.from+a,u=c+l.length;o.text[u-o.from]==" "&&u++,s.push({from:c,to:u})}return{changes:s}}return null}const Hu=sn.define(),_O=sn.define(),qO=de.define(),i0=de.define({combine(r){return zr(r,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,i)=>e(n,i)||t(n,i)})}});function e2(r){let e=0;return r.iterChangedRanges((t,n)=>e=n),e}const zu=kt.define({create(){return hn.empty},update(r,e){let t=e.state.facet(i0),n=e.annotation(Hu);if(n){let l=e.docChanged?ie.single(e2(e.changes)):void 0,c=ar.fromTransaction(e,l),u=n.side,h=u==0?r.undone:r.done;return c?h=nl(h,h.length,t.minDepth,c):h=a0(h,e.startState.selection),new hn(u==0?n.rest:h,u==0?h:n.rest)}let i=e.annotation(_O);if((i=="full"||i=="before")&&(r=r.isolate()),e.annotation(Tt.addToHistory)===!1)return e.changes.empty?r:r.addMapping(e.changes.desc);let s=ar.fromTransaction(e),o=e.annotation(Tt.time),a=e.annotation(Tt.userEvent);return s?r=r.addChanges(s,o,a,t,e):e.selection&&(r=r.addSelection(e.startState.selection,o,a,t.newGroupDelay)),(i=="full"||i=="after")&&(r=r.isolate()),r},toJSON(r){return{done:r.done.map(e=>e.toJSON()),undone:r.undone.map(e=>e.toJSON())}},fromJSON(r){return new hn(r.done.map(ar.fromJSON),r.undone.map(ar.fromJSON))}});function t2(r={}){return[zu,i0.of(r),he.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?s0:e.inputType=="historyRedo"?Uu:null;return n?(e.preventDefault(),n(t)):!1}})]}const CD=null;function rl(r,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let i=t.field(zu,!1);if(!i)return!1;let s=i.pop(r,t,e);return s?(n(s),!0):!1}}const s0=rl(0,!1),Uu=rl(1,!1),r2=rl(0,!0),n2=rl(1,!0);function OD(r){return function(e){let t=e.field(zu,!1);if(!t)return 0;let n=r==0?t.done:t.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const ED=null,TD=null;class ar{constructor(e,t,n,i,s){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=s}setSelAfter(e){return new ar(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;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:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(i=>i.toJSON())}}static fromJSON(e){return new ar(e.changes&&Et.fromJSON(e.changes),[],e.mapped&&nn.fromJSON(e.mapped),e.startSelection&&ie.fromJSON(e.startSelection),e.selectionsAfter.map(ie.fromJSON))}static fromTransaction(e,t){let n=Rr;for(let i of e.startState.facet(qO)){let s=i(e);s.length&&(n=n.concat(s))}return!n.length&&e.changes.empty?null:new ar(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Rr)}static selection(e){return new ar(void 0,Rr,void 0,void 0,e)}}function nl(r,e,t,n){let i=e+1>t+20?e-t-1:0,s=r.slice(i,e);return s.push(n),s}function i2(r,e){let t=[],n=!1;return r.iterChangedRanges((i,s)=>t.push(i,s)),e.iterChangedRanges((i,s,o,a)=>{for(let l=0;l<t.length;){let c=t[l++],u=t[l++];a>=c&&o<=u&&(n=!0)}}),n}function s2(r,e){return r.ranges.length==e.ranges.length&&r.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function o0(r,e){return r.length?e.length?r.concat(e):r:e}const Rr=[],o2=200;function a0(r,e){if(r.length){let t=r[r.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-o2));return n.length&&n[n.length-1].eq(e)?r:(n.push(e),nl(r,r.length-1,1e9,t.setSelAfter(n)))}else return[ar.selection([e])]}function a2(r){let e=r[r.length-1],t=r.slice();return t[r.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Gu(r,e){if(!r.length)return r;let t=r.length,n=Rr;for(;t;){let i=l2(r[t-1],e,n);if(i.changes&&!i.changes.empty||i.effects.length){let s=r.slice(0,t);return s[t-1]=i,s}else e=i.mapped,t--,n=i.selectionsAfter}return n.length?[ar.selection(n)]:Rr}function l2(r,e,t){let n=o0(r.selectionsAfter.length?r.selectionsAfter.map(a=>a.map(e)):Rr,t);if(!r.changes)return ar.selection(n);let i=r.changes.map(e),s=e.mapDesc(r.changes,!0),o=r.mapped?r.mapped.composeDesc(s):s;return new ar(i,Ae.mapEffects(r.effects,e),o,r.startSelection.map(s),n)}const c2=/^(input\.type|delete)($|\.)/;class hn{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new hn(this.done,this.undone):this}addChanges(e,t,n,i,s){let o=this.done,a=o[o.length-1];return a&&a.changes&&!a.changes.empty&&e.changes&&(!n||c2.test(n))&&(!a.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(s,i2(a.changes,e.changes))||n=="input.type.compose")?o=nl(o,o.length-1,i.minDepth,new ar(e.changes.compose(a.changes),o0(e.effects,a.effects),a.mapped,a.startSelection,Rr)):o=nl(o,o.length,i.minDepth,e),new hn(o,Rr,t,n)}addSelection(e,t,n,i){let s=this.done.length?this.done[this.done.length-1].selectionsAfter:Rr;return s.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&s2(s[s.length-1],e)?this:new hn(a0(this.done,e),this.undone,t,n)}addMapping(e){return new hn(Gu(this.done,e),Gu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=e==0?this.done:this.undone;if(i.length==0)return null;let s=i[i.length-1];if(n&&s.selectionsAfter.length)return t.update({selection:s.selectionsAfter[s.selectionsAfter.length-1],annotations:Hu.of({side:e,rest:a2(i)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(s.changes){let o=i.length==1?Rr:i.slice(0,i.length-1);return s.mapped&&(o=Gu(o,s.mapped)),t.update({changes:s.changes,selection:s.startSelection,effects:s.effects,annotations:Hu.of({side:e,rest:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}hn.empty=new hn(Rr,Rr);const u2=[{key:"Mod-z",run:s0,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Uu,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Uu,preventDefault:!0},{key:"Mod-u",run:r2,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:n2,preventDefault:!0}];function ls(r,e){return ie.create(r.ranges.map(e),r.mainIndex)}function dn(r,e){return r.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Lr({state:r,dispatch:e},t){let n=ls(r.selection,t);return n.eq(r.selection)?!1:(e(dn(r,n)),!0)}function So(r,e){return ie.cursor(e?r.to:r.from)}function il(r,e){return Lr(r,t=>t.empty?r.moveByChar(t,e):So(t,e))}function Jt(r){return r.textDirectionAt(r.state.selection.main.head)==ft.LTR}const l0=r=>il(r,!Jt(r)),c0=r=>il(r,Jt(r)),PD=r=>il(r,!0),MD=r=>il(r,!1);function sl(r,e){return Lr(r,t=>t.empty?r.moveByGroup(t,e):So(t,e))}const f2=r=>sl(r,!Jt(r)),h2=r=>sl(r,Jt(r)),ID=r=>sl(r,!0),DD=r=>sl(r,!1),u0=typeof Intl<"u"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function f0(r,e,t){let n=r.state.charCategorizer(e.from),i=CharCategory.Space,s=e.from,o=0,a=!1,l=!1,c=!1,u=d=>{if(a)return!1;s+=t?d.length:-d.length;let p=n(d),m;if(p==CharCategory.Word&&d.charCodeAt(0)<128&&/[\W_]/.test(d)&&(p=-1),i==CharCategory.Space&&(i=p),i!=p)return!1;if(i==CharCategory.Word)if(d.toLowerCase()==d){if(!t&&l)return!1;c=!0}else if(c){if(t)return!1;a=!0}else{if(l&&t&&n(m=r.state.sliceDoc(s,s+1))==CharCategory.Word&&m.toLowerCase()==m)return!1;l=!0}return o++,!0},h=r.moveByChar(e,t,d=>(u(d),u));if(u0&&i==CharCategory.Word&&h.from==e.from+o*(t?1:-1)){let d=Math.min(e.head,h.head),p=Math.max(e.head,h.head),m=r.state.sliceDoc(d,p);if(m.length>1&&/[\u4E00-\uffff]/.test(m)){let y=Array.from(u0.segment(m));if(y.length>1)return t?EditorSelection.cursor(e.head+y[1].index,-1):EditorSelection.cursor(h.head+y[y.length-1].index,1)}}return h}function h0(r,e){return Lr(r,t=>t.empty?f0(r,t,e):So(t,e))}const ND=r=>h0(r,!0),RD=r=>h0(r,!1);function d2(r,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(r.sliceDoc(e.from,e.to)))||e.firstChild}function ol(r,e,t){let n=Nt(r).resolveInner(e.head),i=t?Be.closedBy:Be.openedBy;for(let l=e.head;;){let c=t?n.childAfter(l):n.childBefore(l);if(!c)break;d2(r,c,i)?n=c:l=t?c.to:c.from}let s=n.type.prop(i),o,a;return s&&(o=t?fn(r,n.from,1):fn(r,n.to,-1))&&o.matched?a=t?o.end.to:o.end.from:a=t?n.to:n.from,ie.cursor(a,t?-1:1)}const p2=r=>Lr(r,e=>ol(r.state,e,!Jt(r))),g2=r=>Lr(r,e=>ol(r.state,e,Jt(r)));function d0(r,e){return Lr(r,t=>{if(!t.empty)return So(t,e);let n=r.moveVertically(t,e);return n.head!=t.head?n:r.moveToLineBoundary(t,e)})}const p0=r=>d0(r,!1),g0=r=>d0(r,!0);function m0(r){let e=r.scrollDOM.clientHeight<r.scrollDOM.scrollHeight-2,t=0,n=0,i;if(e){for(let s of r.state.facet(he.scrollMargins)){let o=s(r);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(n=Math.max(o?.bottom,n))}i=r.scrollDOM.clientHeight-t-n}else i=(r.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(r.defaultLineHeight,i-5)}}function v0(r,e){let t=m0(r),{state:n}=r,i=ls(n.selection,o=>o.empty?r.moveVertically(o,e,t.height):So(o,e));if(i.eq(n.selection))return!1;let s;if(t.selfScroll){let o=r.coordsAtPos(n.selection.main.head),a=r.scrollDOM.getBoundingClientRect(),l=a.top+t.marginTop,c=a.bottom-t.marginBottom;o&&o.top>l&&o.bottom<c&&(s=he.scrollIntoView(i.main.head,{y:"start",yMargin:o.top-l}))}return r.dispatch(dn(n,i),{effects:s}),!0}const y0=r=>v0(r,!1),Ku=r=>v0(r,!0);function ei(r,e,t){let n=r.lineBlockAt(e.head),i=r.moveToLineBoundary(e,t);if(i.head==e.head&&i.head!=(t?n.to:n.from)&&(i=r.moveToLineBoundary(e,t,!1)),!t&&i.head==n.from&&n.length){let s=/^\s*/.exec(r.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;s&&e.head!=n.from+s&&(i=ie.cursor(n.from+s))}return i}const m2=r=>Lr(r,e=>ei(r,e,!0)),v2=r=>Lr(r,e=>ei(r,e,!1)),y2=r=>Lr(r,e=>ei(r,e,!Jt(r))),b2=r=>Lr(r,e=>ei(r,e,Jt(r))),x2=r=>Lr(r,e=>ie.cursor(r.lineBlockAt(e.head).from,1)),w2=r=>Lr(r,e=>ie.cursor(r.lineBlockAt(e.head).to,-1));function b0(r,e,t){let n=!1,i=ls(r.selection,s=>{let o=fn(r,s.head,-1)||fn(r,s.head,1)||s.head>0&&fn(r,s.head-1,1)||s.head<r.doc.length&&fn(r,s.head+1,-1);if(!o||!o.end)return s;n=!0;let a=o.start.from==s.head?o.end.to:o.end.from;return t?ie.range(s.anchor,a):ie.cursor(a)});return n?(e(dn(r,i)),!0):!1}const S2=({state:r,dispatch:e})=>b0(r,e,!1),LD=({state:r,dispatch:e})=>b0(r,e,!0);function wr(r,e){let t=ls(r.state.selection,n=>{let i=e(n);return ie.range(n.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)});return t.eq(r.state.selection)?!1:(r.dispatch(dn(r.state,t)),!0)}function al(r,e){return wr(r,t=>r.moveByChar(t,e))}const x0=r=>al(r,!Jt(r)),w0=r=>al(r,Jt(r)),BD=r=>al(r,!0),FD=r=>al(r,!1);function ll(r,e){return wr(r,t=>r.moveByGroup(t,e))}const k2=r=>ll(r,!Jt(r)),A2=r=>ll(r,Jt(r)),jD=r=>ll(r,!0),VD=r=>ll(r,!1);function S0(r,e){return wr(r,t=>f0(r,t,e))}const WD=r=>S0(r,!0),$D=r=>S0(r,!1),C2=r=>wr(r,e=>ol(r.state,e,!Jt(r))),O2=r=>wr(r,e=>ol(r.state,e,Jt(r)));function k0(r,e){return wr(r,t=>r.moveVertically(t,e))}const A0=r=>k0(r,!1),C0=r=>k0(r,!0);function O0(r,e){return wr(r,t=>r.moveVertically(t,e,m0(r).height))}const E0=r=>O0(r,!1),T0=r=>O0(r,!0),E2=r=>wr(r,e=>ei(r,e,!0)),T2=r=>wr(r,e=>ei(r,e,!1)),P2=r=>wr(r,e=>ei(r,e,!Jt(r))),M2=r=>wr(r,e=>ei(r,e,Jt(r))),I2=r=>wr(r,e=>ie.cursor(r.lineBlockAt(e.head).from)),D2=r=>wr(r,e=>ie.cursor(r.lineBlockAt(e.head).to)),P0=({state:r,dispatch:e})=>(e(dn(r,{anchor:0})),!0),M0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.doc.length})),!0),I0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.selection.main.anchor,head:0})),!0),D0=({state:r,dispatch:e})=>(e(dn(r,{anchor:r.selection.main.anchor,head:r.doc.length})),!0),N2=({state:r,dispatch:e})=>(e(r.update({selection:{anchor:0,head:r.doc.length},userEvent:"select"})),!0),R2=({state:r,dispatch:e})=>{let t=ul(r).map(({from:n,to:i})=>ie.range(n,Math.min(i+1,r.doc.length)));return e(r.update({selection:ie.create(t),userEvent:"select"})),!0},L2=({state:r,dispatch:e})=>{let t=ls(r.selection,n=>{var i;let s=Nt(r).resolveStack(n.from,1);for(let o=s;o;o=o.next){let{node:a}=o;if((a.from<n.from&&a.to>=n.to||a.to>n.to&&a.from<=n.from)&&(!((i=a.parent)===null||i===void 0)&&i.parent))return ie.range(a.to,a.from)}return n});return e(dn(r,t)),!0},B2=({state:r,dispatch:e})=>{let t=r.selection,n=null;return t.ranges.length>1?n=ie.create([t.main]):t.main.empty||(n=ie.create([ie.cursor(t.main.head)])),n?(e(dn(r,n)),!0):!1};function cs(r,e){if(r.state.readOnly)return!1;let t="delete.selection",{state:n}=r,i=n.changeByRange(s=>{let{from:o,to:a}=s;if(o==a){let l=e(s);l<o?(t="delete.backward",l=cl(r,l,!1)):l>o&&(t="delete.forward",l=cl(r,l,!0)),o=Math.min(o,l),a=Math.max(a,l)}else o=cl(r,o,!1),a=cl(r,a,!0);return o==a?{range:s}:{changes:{from:o,to:a},range:ie.cursor(o,o<s.head?-1:1)}});return i.changes.empty?!1:(r.dispatch(n.update(i,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?he.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function cl(r,e,t){if(r instanceof he)for(let n of r.state.facet(he.atomicRanges).map(i=>i(r)))n.between(e,e,(i,s)=>{i<e&&s>e&&(e=t?s:i)});return e}const N0=(r,e)=>cs(r,t=>{let n=t.from,{state:i}=r,s=i.doc.lineAt(n),o,a;if(!e&&n>s.from&&n<s.from+200&&!/[^ \t]/.test(o=s.text.slice(0,n-s.from))){if(o[o.length-1]==" ")return n-1;let l=Xi(o,i.tabSize),c=l%Ai(i)||Ai(i);for(let u=0;u<c&&o[o.length-1-u]==" ";u++)n--;a=n}else a=Ut(s.text,n-s.from,e,e)+s.from,a==n&&s.number!=(e?i.doc.lines:1)&&(a+=e?1:-1);return a}),Yu=r=>N0(r,!1),R0=r=>N0(r,!0),L0=(r,e)=>cs(r,t=>{let n=t.head,{state:i}=r,s=i.doc.lineAt(n),o=i.charCategorizer(n);for(let a=null;;){if(n==(e?s.to:s.from)){n==t.head&&s.number!=(e?i.doc.lines:1)&&(n+=e?1:-1);break}let l=Ut(s.text,n-s.from,e)+s.from,c=s.text.slice(Math.min(n,l)-s.from,Math.max(n,l)-s.from),u=o(c);if(a!=null&&u!=a)break;(c!=" "||n!=t.head)&&(a=u),n=l}return n}),B0=r=>L0(r,!1),F2=r=>L0(r,!0),j2=r=>cs(r,e=>{let t=r.lineBlockAt(e.head).to;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),HD=r=>cs(r,e=>{let t=r.lineBlockAt(e.head).from;return e.head>t?t:Math.max(0,e.head-1)}),V2=r=>cs(r,e=>{let t=r.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),W2=r=>cs(r,e=>{let t=r.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(r.state.doc.length,e.head+1)}),zD=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=[];for(let n=0,i="",s=r.doc.iter();;){if(s.next(),s.lineBreak||s.done){let o=i.search(/\s+$/);if(o>-1&&t.push({from:n-(i.length-o),to:n}),s.done)break;i=""}else i=s.value;n+=s.value.length}return t.length?(e(r.update({changes:t,userEvent:"delete"})),!0):!1},$2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Qe.of(["",""])},range:ie.cursor(n.from)}));return e(r.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},H2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=r.changeByRange(n=>{if(!n.empty||n.from==0||n.from==r.doc.length)return{range:n};let i=n.from,s=r.doc.lineAt(i),o=i==s.from?i-1:Ut(s.text,i-s.from,!1)+s.from,a=i==s.to?i+1:Ut(s.text,i-s.from,!0)+s.from;return{changes:{from:o,to:a,insert:r.doc.slice(i,a).append(r.doc.slice(o,i))},range:ie.cursor(a)}});return t.changes.empty?!1:(e(r.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ul(r){let e=[],t=-1;for(let n of r.selection.ranges){let i=r.doc.lineAt(n.from),s=r.doc.lineAt(n.to);if(!n.empty&&n.to==s.from&&(s=r.doc.lineAt(n.to-1)),t>=i.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(n)}else e.push({from:i.from,to:s.to,ranges:[n]});t=s.number+1}return e}function F0(r,e,t){if(r.readOnly)return!1;let n=[],i=[];for(let s of ul(r)){if(t?s.to==r.doc.length:s.from==0)continue;let o=r.doc.lineAt(t?s.to+1:s.from-1),a=o.length+1;if(t){n.push({from:s.to,to:o.to},{from:s.from,insert:o.text+r.lineBreak});for(let l of s.ranges)i.push(ie.range(Math.min(r.doc.length,l.anchor+a),Math.min(r.doc.length,l.head+a)))}else{n.push({from:o.from,to:s.from},{from:s.to,insert:r.lineBreak+o.text});for(let l of s.ranges)i.push(ie.range(l.anchor-a,l.head-a))}}return n.length?(e(r.update({changes:n,scrollIntoView:!0,selection:ie.create(i,r.selection.mainIndex),userEvent:"move.line"})),!0):!1}const z2=({state:r,dispatch:e})=>F0(r,e,!1),U2=({state:r,dispatch:e})=>F0(r,e,!0);function j0(r,e,t){if(r.readOnly)return!1;let n=[];for(let i of ul(r))t?n.push({from:i.from,insert:r.doc.slice(i.from,i.to)+r.lineBreak}):n.push({from:i.to,insert:r.lineBreak+r.doc.slice(i.from,i.to)});return e(r.update({changes:n,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const G2=({state:r,dispatch:e})=>j0(r,e,!1),K2=({state:r,dispatch:e})=>j0(r,e,!0),Y2=r=>{if(r.state.readOnly)return!1;let{state:e}=r,t=e.changes(ul(e).map(({from:i,to:s})=>(i>0?i--:s<e.doc.length&&s++,{from:i,to:s}))),n=ls(e.selection,i=>r.moveVertically(i,!0)).map(t);return r.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},UD=({state:r,dispatch:e})=>(e(r.update(r.replaceSelection(r.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0);function J2(r,e){if(/\(\)|\[\]|\{\}/.test(r.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Nt(r).resolveInner(e),n=t.childBefore(e),i=t.childAfter(e),s;return n&&i&&n.to<=e&&i.from>=e&&(s=n.type.prop(Be.closedBy))&&s.indexOf(i.name)>-1&&r.doc.lineAt(n.to).from==r.doc.lineAt(i.from).from&&!/\S/.test(r.sliceDoc(n.to,i.from))?{from:n.to,to:i.from}:null}const Q2=V0(!1),X2=V0(!0);function V0(r){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(i=>{let{from:s,to:o}=i,a=e.doc.lineAt(s),l=!r&&s==o&&J2(e,s);r&&(s=o=(o<=a.to?a:e.doc.lineAt(o)).to);let c=new mo(e,{simulateBreak:s,simulateDoubleBreak:!!l}),u=qa(c,s);for(u==null&&(u=Xi(/^\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 h=["",ss(e,u)];return l&&h.push(ss(e,c.lineIndent(a.from,-1))),{changes:{from:s,to:o,insert:Qe.of(h)},range:ie.cursor(s+1+h[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ju(r,e){let t=-1;return r.changeByRange(n=>{let i=[];for(let o=n.from;o<=n.to;){let a=r.doc.lineAt(o);a.number>t&&(n.empty||n.to>a.from)&&(e(a,i,n),t=a.number),o=a.to+1}let s=r.changes(i);return{changes:i,range:ie.range(s.mapPos(n.anchor,1),s.mapPos(n.head,1))}})}const Z2=({state:r,dispatch:e})=>{if(r.readOnly)return!1;let t=Object.create(null),n=new mo(r,{overrideIndentation:s=>{let o=t[s];return o??-1}}),i=Ju(r,(s,o,a)=>{let l=qa(n,s.from);if(l==null)return;/\S/.test(s.text)||(l=0);let c=/^\s*/.exec(s.text)[0],u=ss(r,l);(c!=u||a.from<s.from+c.length)&&(t[s.from]=l,o.push({from:s.from,to:s.from+c.length,insert:u}))});return i.changes.empty||e(r.update(i,{userEvent:"indent"})),!0},Qu=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Ju(r,(t,n)=>{n.push({from:t.from,insert:r.facet(_a)})}),{userEvent:"input.indent"})),!0),W0=({state:r,dispatch:e})=>r.readOnly?!1:(e(r.update(Ju(r,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let s=Xi(i,r.tabSize),o=0,a=ss(r,Math.max(0,s-Ai(r)));for(;o<i.length&&o<a.length&&i.charCodeAt(o)==a.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+i.length,insert:a.slice(o)})}),{userEvent:"delete.dedent"})),!0),GD=({state:r,dispatch:e})=>r.selection.ranges.some(t=>!t.empty)?Qu({state:r,dispatch:e}):(e(r.update(r.replaceSelection(" "),{scrollIntoView:!0,userEvent:"input"})),!0),_2=[{key:"Ctrl-b",run:l0,shift:x0,preventDefault:!0},{key:"Ctrl-f",run:c0,shift:w0},{key:"Ctrl-p",run:p0,shift:A0},{key:"Ctrl-n",run:g0,shift:C0},{key:"Ctrl-a",run:x2,shift:I2},{key:"Ctrl-e",run:w2,shift:D2},{key:"Ctrl-d",run:R0},{key:"Ctrl-h",run:Yu},{key:"Ctrl-k",run:j2},{key:"Ctrl-Alt-h",run:B0},{key:"Ctrl-o",run:$2},{key:"Ctrl-t",run:H2},{key:"Ctrl-v",run:Ku}],q2=[{key:"ArrowLeft",run:l0,shift:x0,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:f2,shift:k2,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:y2,shift:P2,preventDefault:!0},{key:"ArrowRight",run:c0,shift:w0,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:h2,shift:A2,preventDefault:!0},{mac:"Cmd-ArrowRight",run:b2,shift:M2,preventDefault:!0},{key:"ArrowUp",run:p0,shift:A0,preventDefault:!0},{mac:"Cmd-ArrowUp",run:P0,shift:I0},{mac:"Ctrl-ArrowUp",run:y0,shift:E0},{key:"ArrowDown",run:g0,shift:C0,preventDefault:!0},{mac:"Cmd-ArrowDown",run:M0,shift:D0},{mac:"Ctrl-ArrowDown",run:Ku,shift:T0},{key:"PageUp",run:y0,shift:E0},{key:"PageDown",run:Ku,shift:T0},{key:"Home",run:v2,shift:T2,preventDefault:!0},{key:"Mod-Home",run:P0,shift:I0},{key:"End",run:m2,shift:E2,preventDefault:!0},{key:"Mod-End",run:M0,shift:D0},{key:"Enter",run:Q2},{key:"Mod-a",run:N2},{key:"Backspace",run:Yu,shift:Yu},{key:"Delete",run:R0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:B0},{key:"Mod-Delete",mac:"Alt-Delete",run:F2},{mac:"Mod-Backspace",run:V2},{mac:"Mod-Delete",run:W2}].concat(_2.map(r=>({mac:r.key,run:r.run,shift:r.shift}))),eE=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:p2,shift:C2},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:g2,shift:O2},{key:"Alt-ArrowUp",run:z2},{key:"Shift-Alt-ArrowUp",run:G2},{key:"Alt-ArrowDown",run:U2},{key:"Shift-Alt-ArrowDown",run:K2},{key:"Escape",run:B2},{key:"Mod-Enter",run:X2},{key:"Alt-l",mac:"Ctrl-l",run:R2},{key:"Mod-i",run:L2,preventDefault:!0},{key:"Mod-[",run:W0},{key:"Mod-]",run:Qu},{key:"Mod-Alt-\\",run:Z2},{key:"Shift-Mod-k",run:Y2},{key:"Shift-Mod-\\",run:S2},{key:"Mod-/",run:GO},{key:"Alt-A",run:YO}].concat(q2),tE={key:"Tab",run:Qu,shift:W0};function rt(){var r=arguments[0];typeof r=="string"&&(r=document.createElement(r));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];typeof i=="string"?r.setAttribute(n,i):i!=null&&(r[n]=i)}e++}for(;e<arguments.length;e++)$0(r,arguments[e]);return r}function $0(r,e){if(typeof e=="string")r.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)r.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)$0(r,e[t]);else throw new RangeError("Unsupported child node: "+e)}const H0=typeof String.prototype.normalize=="function"?r=>r.normalize("NFKD"):r=>r;class us{constructor(e,t,n=0,i=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(n,i),this.bufferStart=n,this.normalize=s?a=>s(H0(a)):H0,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 Lt(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=kc(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=Dr(e);let i=this.normalize(t);for(let s=0,o=n;;s++){let a=i.charCodeAt(s),l=this.match(a,o);if(s==i.length-1){if(l)return this.value=l,this;break}o==n&&s<t.length&&t.charCodeAt(s)==a&&o++}}}match(e,t){let n=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],o=!1;this.query.charCodeAt(s)==e&&(s==this.query.length-1?n={from:this.matches[i+1],to:t+1}:(this.matches[i]++,o=!0)),o||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?n={from:t,to:t+1}:this.matches.push(1,t)),n&&this.test&&!this.test(n.from,n.to,this.buffer,this.bufferStart)&&(n=null),n}}typeof Symbol<"u"&&(us.prototype[Symbol.iterator]=function(){return this});const z0={from:-1,to:-1,match:/.*/.exec("")},Xu="gm"+(/x/.unicode==null?"":"u");class U0{constructor(e,t,n,i=0,s=e.length){if(this.text=e,this.to=s,this.curLine="",this.done=!1,this.value=z0,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new G0(e,t,n,i,s);this.re=new RegExp(t,Xu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.iter=e.iter();let o=e.lineAt(i);this.curLineStart=o.from,this.matchPos=fl(e,i),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 n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=fl(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<i||n>this.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,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}}}const Zu=new WeakMap;class fs{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let i=Zu.get(e);if(!i||i.from>=n||i.to<=t){let a=new fs(t,e.sliceString(t,n));return Zu.set(e,a),a}if(i.from==t&&i.to==n)return i;let{text:s,from:o}=i;return o>t&&(s=e.sliceString(t,o)+s,o=t),i.to<n&&(s+=e.sliceString(i.to,n)),Zu.set(e,new fs(o,s)),new fs(t,s.slice(t-o,n-o))}}class G0{constructor(e,t,n,i,s){this.text=e,this.to=s,this.done=!1,this.value=z0,this.matchPos=fl(e,i),this.re=new RegExp(t,Xu+(n?.ignoreCase?"i":"")),this.test=n?.test,this.flat=fs.get(e,i,this.chunkEnd(i+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 n=this.flat.from+t.index,i=n+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this.matchPos=fl(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=fs.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(U0.prototype[Symbol.iterator]=G0.prototype[Symbol.iterator]=function(){return this});function rE(r){try{return new RegExp(r,Xu),!0}catch{return!1}}function fl(r,e){if(e>=r.length)return e;let t=r.lineAt(e),n;for(;e<t.to&&(n=t.text.charCodeAt(e-t.from))>=56320&&n<57344;)e++;return e}function _u(r){let e=String(r.state.doc.lineAt(r.state.selection.main.head).number),t=rt("input",{class:"cm-textfield",name:"line",value:e}),n=rt("form",{class:"cm-gotoLine",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),r.dispatch({effects:hl.of(!1)}),r.focus()):s.keyCode==13&&(s.preventDefault(),i())},onsubmit:s=>{s.preventDefault(),i()}},rt("label",r.state.phrase("Go to line"),": ",t)," ",rt("button",{class:"cm-button",type:"submit"},r.state.phrase("go")));function i(){let s=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!s)return;let{state:o}=r,a=o.doc.lineAt(o.selection.main.head),[,l,c,u,h]=s,d=u?+u.slice(1):0,p=c?+c:a.number;if(c&&h){let w=p/100;l&&(w=w*(l=="-"?-1:1)+a.number/o.doc.lines),p=Math.round(o.doc.lines*w)}else c&&l&&(p=p*(l=="-"?-1:1)+a.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,p))),y=ie.cursor(m.from+Math.max(0,Math.min(d,m.length)));r.dispatch({effects:[hl.of(!1),he.scrollIntoView(y.from,{y:"center"})],selection:y}),r.focus()}return{dom:n}}const hl=Ae.define(),K0=kt.define({create(){return!0},update(r,e){for(let t of e.effects)t.is(hl)&&(r=t.value);return r},provide:r=>ho.from(r,e=>e?_u:null)}),nE=r=>{let e=fo(r,_u);if(!e){let t=[hl.of(!0)];r.state.field(K0,!1)==null&&t.push(Ae.appendConfig.of([K0,iE])),r.dispatch({effects:t}),e=fo(r,_u)}return e&&e.dom.querySelector("input").select(),!0},iE=he.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),sE={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Y0=de.define({combine(r){return zr(r,sE,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function oE(r){let e=[fE,uE];return r&&e.push(Y0.of(r)),e}const aE=we.mark({class:"cm-selectionMatch"}),lE=we.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function J0(r,e,t,n){return(t==0||r(e.sliceDoc(t-1,t))!=ot.Word)&&(n==e.doc.length||r(e.sliceDoc(n,n+1))!=ot.Word)}function cE(r,e,t,n){return r(e.sliceDoc(t,t+1))==ot.Word&&r(e.sliceDoc(n-1,n))==ot.Word}const uE=ut.fromClass(class{constructor(r){this.decorations=this.getDeco(r)}update(r){(r.selectionSet||r.docChanged||r.viewportChanged)&&(this.decorations=this.getDeco(r.view))}getDeco(r){let e=r.state.facet(Y0),{state:t}=r,n=t.selection;if(n.ranges.length>1)return we.none;let i=n.main,s,o=null;if(i.empty){if(!e.highlightWordAroundCursor)return we.none;let l=t.wordAt(i.head);if(!l)return we.none;o=t.charCategorizer(i.head),s=t.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l<e.minSelectionLength||l>200)return we.none;if(e.wholeWords){if(s=t.sliceDoc(i.from,i.to),o=t.charCategorizer(i.head),!(J0(o,t,i.from,i.to)&&cE(o,t,i.from,i.to)))return we.none}else if(s=t.sliceDoc(i.from,i.to).trim(),!s)return we.none}let a=[];for(let l of r.visibleRanges){let c=new us(t.doc,s,l.from,l.to);for(;!c.next().done;){let{from:u,to:h}=c.value;if((!o||J0(o,t,u,h))&&(i.empty&&u<=i.from&&h>=i.to?a.push(lE.range(u,h)):(u>=i.to||h<=i.from)&&a.push(aE.range(u,h)),a.length>e.maxMatches))return we.none}}return we.set(a)}},{decorations:r=>r.decorations}),fE=he.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),hE=({state:r,dispatch:e})=>{let{selection:t}=r,n=ie.create(t.ranges.map(i=>r.wordAt(i.head)||ie.cursor(i.head)),t.mainIndex);return n.eq(t)?!1:(e(r.update({selection:n})),!0)};function dE(r,e){let{main:t,ranges:n}=r.selection,i=r.wordAt(t.head),s=i&&i.from==t.from&&i.to==t.to;for(let o=!1,a=new us(r.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new us(r.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(s){let l=r.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}const pE=({state:r,dispatch:e})=>{let{ranges:t}=r.selection;if(t.some(s=>s.from===s.to))return hE({state:r,dispatch:e});let n=r.sliceDoc(t[0].from,t[0].to);if(r.selection.ranges.some(s=>r.sliceDoc(s.from,s.to)!=n))return!1;let i=dE(r,n);return i?(e(r.update({selection:r.selection.addRange(ie.range(i.from,i.to),!1),effects:he.scrollIntoView(i.to)})),!0):!1},Ci=de.define({combine(r){return zr(r,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new OE(e),scrollToMatch:e=>he.scrollIntoView(e)})}});function KD(r){return r?[Ci.of(r),nf]:nf}class Q0{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||rE(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,n)=>n=="n"?`
|
|
152
|
+
`:n=="r"?"\r":n=="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 yE(this):new mE(this)}getCursor(e,t=0,n){let i=e.doc?e:We.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?ds(this,i,t,n):hs(this,i,t,n)}}class X0{constructor(e){this.spec=e}}function hs(r,e,t,n){return new us(e.doc,r.unquoted,t,n,r.caseSensitive?void 0:i=>i.toLowerCase(),r.wholeWord?gE(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function gE(r,e){return(t,n,i,s)=>((s>t||s+i.length<n)&&(s=Math.max(0,t-2),i=r.sliceString(s,Math.min(r.length,n+2))),(e(dl(i,t-s))!=ot.Word||e(pl(i,t-s))!=ot.Word)&&(e(pl(i,n-s))!=ot.Word||e(dl(i,n-s))!=ot.Word))}class mE extends X0{constructor(e){super(e)}nextMatch(e,t,n){let i=hs(this.spec,e,n,e.doc.length).nextOverlapping();return i.done&&(i=hs(this.spec,e,0,t).nextOverlapping()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=n;;){let s=Math.max(t,i-1e4-this.spec.unquoted.length),o=hs(this.spec,e,s,i),a=null;for(;!o.nextOverlapping().done;)a=o.value;if(a)return a;if(s==t)return null;i-=1e4}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=hs(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=hs(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}function ds(r,e,t,n){return new U0(e.doc,r.search,{ignoreCase:!r.caseSensitive,test:r.wholeWord?vE(e.charCategorizer(e.selection.main.head)):void 0},t,n)}function dl(r,e){return r.slice(Ut(r,e,!1),e)}function pl(r,e){return r.slice(e,Ut(r,e))}function vE(r){return(e,t,n)=>!n[0].length||(r(dl(n.input,n.index))!=ot.Word||r(pl(n.input,n.index))!=ot.Word)&&(r(pl(n.input,n.index+n[0].length))!=ot.Word||r(dl(n.input,n.index+n[0].length))!=ot.Word)}class yE extends X0{nextMatch(e,t,n){let i=ds(this.spec,e,n,e.doc.length).next();return i.done&&(i=ds(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let s=Math.max(t,n-i*1e4),o=ds(this.spec,e,s,n),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,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(t,n)=>n=="$"?"$":n=="&"?e.match[0]:n!="0"&&+n<e.match.length?e.match[n]:t))}matchAll(e,t){let n=ds(this.spec,e,0,e.doc.length),i=[];for(;!n.next().done;){if(i.length>=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let s=ds(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}}const ko=Ae.define(),qu=Ae.define(),pn=kt.define({create(r){return new ef(vl(r).create(),null)},update(r,e){for(let t of e.effects)t.is(ko)?r=new ef(t.value.create(),r.panel):t.is(qu)&&(r=new ef(r.query,t.value?tf:null));return r},provide:r=>ho.from(r,e=>e.panel)});function YD(r){let e=r.field(pn,!1);return e?e.query.spec:vl(r)}function JD(r){var e;return((e=r.field(pn,!1))===null||e===void 0?void 0:e.panel)!=null}class ef{constructor(e,t){this.query=e,this.panel=t}}const bE=we.mark({class:"cm-searchMatch"}),xE=we.mark({class:"cm-searchMatch cm-searchMatch-selected"}),wE=ut.fromClass(class{constructor(r){this.view=r,this.decorations=this.highlight(r.state.field(pn))}update(r){let e=r.state.field(pn);(e!=r.startState.field(pn)||r.docChanged||r.selectionSet||r.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:r,panel:e}){if(!e||!r.spec.valid)return we.none;let{view:t}=this,n=new Un;for(let i=0,s=t.visibleRanges,o=s.length;i<o;i++){let{from:a,to:l}=s[i];for(;i<o-1&&l>s[i+1].from-2*250;)l=s[++i].to;r.highlight(t.state,a,l,(c,u)=>{let h=t.state.selection.ranges.some(d=>d.from==c&&d.to==u);n.add(c,u,h?xE:bE)})}return n.finish()}},{decorations:r=>r.decorations});function Ao(r){return e=>{let t=e.state.field(pn,!1);return t&&t.query.spec.valid?r(e,t):ev(e)}}const gl=Ao((r,{query:e})=>{let{to:t}=r.state.selection.main,n=e.nextMatch(r.state,t,t);if(!n)return!1;let i=ie.single(n.from,n.to),s=r.state.facet(Ci);return r.dispatch({selection:i,effects:[rf(r,n),s.scrollToMatch(i.main,r)],userEvent:"select.search"}),q0(r),!0}),ml=Ao((r,{query:e})=>{let{state:t}=r,{from:n}=t.selection.main,i=e.prevMatch(t,n,n);if(!i)return!1;let s=ie.single(i.from,i.to),o=r.state.facet(Ci);return r.dispatch({selection:s,effects:[rf(r,i),o.scrollToMatch(s.main,r)],userEvent:"select.search"}),q0(r),!0}),SE=Ao((r,{query:e})=>{let t=e.matchAll(r.state,1e3);return!t||!t.length?!1:(r.dispatch({selection:ie.create(t.map(n=>ie.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),kE=({state:r,dispatch:e})=>{let t=r.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:n,to:i}=t.main,s=[],o=0;for(let a=new us(r.doc,r.sliceDoc(n,i));!a.next().done;){if(s.length>1e3)return!1;a.value.from==n&&(o=s.length),s.push(ie.range(a.value.from,a.value.to))}return e(r.update({selection:ie.create(s,o),userEvent:"select.search.matches"})),!0},Z0=Ao((r,{query:e})=>{let{state:t}=r,{from:n,to:i}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,n,n);if(!s)return!1;let o=[],a,l,c=[];if(s.from==n&&s.to==i&&(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(he.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(n).number)+"."))),s){let u=o.length==0||o[0].from>=s.to?0:s.to-s.from-l.length;a=ie.single(s.from-u,s.to-u),c.push(rf(r,s)),c.push(t.facet(Ci).scrollToMatch(a.main,r))}return r.dispatch({changes:o,selection:a,effects:c,userEvent:"input.replace"}),!0}),AE=Ao((r,{query:e})=>{if(r.state.readOnly)return!1;let t=e.matchAll(r.state,1e9).map(i=>{let{from:s,to:o}=i;return{from:s,to:o,insert:e.getReplacement(i)}});if(!t.length)return!1;let n=r.state.phrase("replaced $ matches",t.length)+".";return r.dispatch({changes:t,effects:he.announce.of(n),userEvent:"input.replace.all"}),!0});function tf(r){return r.state.facet(Ci).createPanel(r)}function vl(r,e){var t,n,i,s,o;let a=r.selection.main,l=a.empty||a.to>a.from+100?"":r.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=r.facet(Ci);return new Q0({search:((t=e?.literal)!==null&&t!==void 0?t:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i: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 _0(r){let e=fo(r,tf);return e&&e.dom.querySelector("[main-field]")}function q0(r){let e=_0(r);e&&e==r.root.activeElement&&e.select()}const ev=r=>{let e=r.state.field(pn,!1);if(e&&e.panel){let t=_0(r);if(t&&t!=r.root.activeElement){let n=vl(r.state,e.query.spec);n.valid&&r.dispatch({effects:ko.of(n)}),t.focus(),t.select()}}else r.dispatch({effects:[qu.of(!0),e?ko.of(vl(r.state,e.query.spec)):Ae.appendConfig.of(nf)]});return!0},tv=r=>{let e=r.state.field(pn,!1);if(!e||!e.panel)return!1;let t=fo(r,tf);return t&&t.dom.contains(r.root.activeElement)&&r.focus(),r.dispatch({effects:qu.of(!1)}),!0},CE=[{key:"Mod-f",run:ev,scope:"editor search-panel"},{key:"F3",run:gl,shift:ml,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:gl,shift:ml,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:tv,scope:"editor search-panel"},{key:"Mod-Shift-l",run:kE},{key:"Alt-g",run:nE},{key:"Mod-d",run:pE,preventDefault:!0}];class OE{constructor(e){this.view=e;let t=this.query=e.state.field(pn).query.spec;this.commit=this.commit.bind(this),this.searchField=rt("input",{value:t.search,placeholder:Sr(e,"Find"),"aria-label":Sr(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=rt("input",{value:t.replace,placeholder:Sr(e,"Replace"),"aria-label":Sr(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=rt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=rt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=rt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function n(i,s,o){return rt("button",{class:"cm-button",name:i,onclick:s,type:"button"},o)}this.dom=rt("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>gl(e),[Sr(e,"next")]),n("prev",()=>ml(e),[Sr(e,"previous")]),n("select",()=>SE(e),[Sr(e,"all")]),rt("label",null,[this.caseField,Sr(e,"match case")]),rt("label",null,[this.reField,Sr(e,"regexp")]),rt("label",null,[this.wordField,Sr(e,"by word")]),...e.state.readOnly?[]:[rt("br"),this.replaceField,n("replace",()=>Z0(e),[Sr(e,"replace")]),n("replaceAll",()=>AE(e),[Sr(e,"replace all")])],rt("button",{name:"close",onclick:()=>tv(e),"aria-label":Sr(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Q0({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:ko.of(e)}))}keydown(e){YA(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?ml:gl)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Z0(this.view))}update(e){for(let t of e.transactions)for(let n of t.effects)n.is(ko)&&!n.value.eq(this.query)&&this.setQuery(n.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(Ci).top}}function Sr(r,e){return r.state.phrase(e)}const yl=30,bl=/[\s\.,:;?!]/;function rf(r,{from:e,to:t}){let n=r.state.doc.lineAt(e),i=r.state.doc.lineAt(t).to,s=Math.max(n.from,e-yl),o=Math.min(i,t+yl),a=r.state.sliceDoc(s,o);if(s!=n.from){for(let l=0;l<yl;l++)if(!bl.test(a[l+1])&&bl.test(a[l])){a=a.slice(l);break}}if(o!=i){for(let l=a.length-1;l>a.length-yl;l--)if(!bl.test(a[l-1])&&bl.test(a[l])){a=a.slice(0,l);break}}return he.announce.of(`${r.state.phrase("current match")}. ${a} ${r.state.phrase("on line")} ${n.number}.`)}const EE=he.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"}}),nf=[pn,xi.low(wE),EE];class rv{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Nt(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),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),s=i.search(sv(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function nv(r){let e=Object.keys(r).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function TE(r){let e=Object.create(null),t=Object.create(null);for(let{label:i}of r){e[i[0]]=!0;for(let s=1;s<i.length;s++)t[i[s]]=!0}let n=nv(e)+nv(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function PE(r){let e=r.map(i=>typeof i=="string"?{label:i}:i),[t,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:TE(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:t}:null}}function QD(r,e){return t=>{for(let n=syntaxTree(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return e(t);if(n.type.isTop)break}return null}}function XD(r,e){return t=>{for(let n=syntaxTree(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(r.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class iv{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function ti(r){return r.selection.main.from}function sv(r,e){var t;let{source:n}=r,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?r:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(t=r.flags)!==null&&t!==void 0?t:r.ignoreCase?"i":"")}const ov=sn.define();function ME(r,e,t,n){let{main:i}=r.selection,s=t-i.from,o=n-i.from;return Object.assign(Object.assign({},r.changeByRange(a=>a!=i&&t!=n&&r.sliceDoc(a.from+s,a.from+o)!=r.sliceDoc(t,n)?{range:a}:{changes:{from:a.from+s,to:n==i.from?a.to:a.from+o,insert:e},range:ie.cursor(a.from+s+e.length)})),{scrollIntoView:!0,userEvent:"input.complete"})}const av=new WeakMap;function IE(r){if(!Array.isArray(r))return r;let e=av.get(r);return e||av.set(r,e=PE(r)),e}const sf=Ae.define(),Co=Ae.define();class DE{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 n=Lt(e,t),i=Dr(n);this.chars.push(n);let s=e.slice(t,t+i),o=s.toUpperCase();this.folded.push(Lt(o==s?s.toLowerCase():o,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,!0}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return!1;let{chars:t,folded:n,any:i,precise:s,byWord:o}=this;if(t.length==1){let T=Lt(e,0),P=Dr(T),L=P==e.length?0:-100;if(T!=t[0])if(T==n[0])L+=-200;else return!1;return this.ret(L,[0,P])}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 T=0,P=Math.min(e.length,200);T<P&&c<l;){let L=Lt(e,T);(L==t[c]||L==n[c])&&(i[c++]=T),T+=Dr(L)}if(c<l)return!1}let u=0,h=0,d=!1,p=0,m=-1,y=-1,w=/[a-z]/.test(e),A=!0;for(let T=0,P=Math.min(e.length,200),L=0;T<P&&h<l;){let D=Lt(e,T);a<0&&(u<l&&D==t[u]&&(s[u++]=T),p<l&&(D==t[p]||D==n[p]?(p==0&&(m=T),y=T+1,p++):p=0));let j,W=D<255?D>=48&&D<=57||D>=97&&D<=122?2:D>=65&&D<=90?1:0:(j=kc(D))!=j.toLowerCase()?1:j!=j.toUpperCase()?2:0;(!T||W==1&&w||L==0&&W!=0)&&(t[h]==D||n[h]==D&&(d=!0)?o[h++]=T:o.length&&(A=!1)),L=W,T+=Dr(D)}return h==l&&o[0]==0&&A?this.result(-100+(d?-200:0),o,e):p==l&&m==0?this.ret(-200-e.length+(y==e.length?0:-100),[0,y]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):p==l?this.ret(-200+-700-e.length,[m,y]):h==l?this.result(-100+(d?-200:0)+-700+(A?0:-1100),o,e):t.length==2?!1:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,t,n){let i=[],s=0;for(let o of t){let a=o+(this.astral?Dr(Lt(n,o)):1);s&&i[s-1]==o?i[s-1]=a:(i[s++]=o,i[s++]=a)}return this.ret(e-n.length,i)}}const Qt=de.define({combine(r){return zr(r,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:NE,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)=>n=>lv(e(n),t(n)),optionClass:(e,t)=>n=>lv(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})}});function lv(r,e){return r?e?r+" "+e:r:e}function NE(r,e,t,n,i,s){let o=r.textDirection==ft.RTL,a=o,l=!1,c="top",u,h,d=e.left-i.left,p=i.right-e.right,m=n.right-n.left,y=n.bottom-n.top;if(a&&d<Math.min(m,p)?a=!1:!a&&p<Math.min(m,d)&&(a=!0),m<=(a?d:p))u=Math.max(i.top,Math.min(t.top,i.bottom-y))-e.top,h=Math.min(400,a?d:p);else{l=!0,h=Math.min(400,(o?e.right:i.right-e.left)-30);let T=i.bottom-e.bottom;T>=y||T>e.top?u=t.bottom-e.top:(c="bottom",u=e.bottom-t.top)}let w=(e.bottom-e.top)/s.offsetHeight,A=(e.right-e.left)/s.offsetWidth;return{style:`${c}: ${u/w}px; max-width: ${h/A}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}function RE(r){let e=r.addToOptions.slice();return r.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,i){let s=document.createElement("span");s.className="cm-completionLabel";let o=t.displayLabel||t.label,a=0;for(let l=0;l<i.length;){let c=i[l++],u=i[l++];c>a&&s.appendChild(document.createTextNode(o.slice(a,c)));let h=s.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(c,u))),h.className="cm-completionMatchedText",a=u}return a<o.length&&s.appendChild(document.createTextNode(o.slice(a))),s},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function of(r,e,t){if(r<=t)return{from:0,to:r};if(e<0&&(e=0),e<=r>>1){let i=Math.floor(e/t);return{from:i*t,to:(i+1)*t}}let n=Math.floor((r-e)/t);return{from:r-(n+1)*t,to:r-n*t}}class LE{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:s,selected:o}=i.open,a=e.state.facet(Qt);this.optionContent=RE(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=of(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 u=l.target,h;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(h=/-(\d+)$/.exec(u.id))&&+h[1]<c.length){this.applyCompletion(e,c[+h[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(Qt).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:Co.of(null)})}),this.showOptions(s,i.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 n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:o,disabled:a}=n.open;(!i.open||i.open.options!=s)&&(this.range=of(s.length,o,e.state.facet(Qt).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),a!=((t=i.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 n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);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=of(t.options.length,t.selected,this.view.state.facet(Qt).maxRenderedOptions),this.showOptions(t.options,e.id)),this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(n);if(!s)return;"then"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,n)}).catch(o=>Nr(this.view.state,o,"completion info")):this.addInfoPane(s,n)}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&FE(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=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 i.top>Math.min(s.bottom,t.bottom)-10||i.bottom<Math.max(s.top,t.top)+10?null:this.view.state.facet(Qt).positionInfo(this.view,t,i,n,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,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));let s=null;for(let o=n.from;o<n.to;o++){let{completion:a,match:l}=e[o],{section:c}=a;if(c){let d=typeof c=="string"?c:c.name;if(d!=s&&(o>n.from||n.from==0))if(s=d,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let p=i.appendChild(document.createElement("completion-section"));p.textContent=d}}const u=i.appendChild(document.createElement("li"));u.id=t+"-"+o,u.setAttribute("role","option");let h=this.optionClass(a);h&&(u.className=h);for(let d of this.optionContent){let p=d(a,this.view.state,l);p&&u.appendChild(p)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function BE(r,e){return t=>new LE(t,r,e)}function FE(r,e){let t=r.getBoundingClientRect(),n=e.getBoundingClientRect(),i=t.height/r.offsetHeight;n.top<t.top?r.scrollTop-=(t.top-n.top)/i:n.bottom>t.bottom&&(r.scrollTop+=(n.bottom-t.bottom)/i)}function cv(r){return(r.boost||0)*100+(r.apply?10:0)+(r.info?5:0)+(r.type?1:0)}function jE(r,e){let t=[],n=null,i=l=>{t.push(l);let{section:c}=l.completion;if(c){n||(n=[]);let u=typeof c=="string"?c:c.name;n.some(h=>h.name==u)||n.push(typeof c=="string"?{name:u}:c)}};for(let l of r)if(l.hasResult()){let c=l.result.getMatch;if(l.result.filter===!1)for(let u of l.result.options)i(new iv(u,l.source,c?c(u):[],1e9-t.length));else{let u=new DE(e.sliceDoc(l.from,l.to));for(let h of l.result.options)if(u.match(h.label)){let d=h.displayLabel?c?c(h,u.matched):[]:u.matched;i(new iv(h,l.source,d,u.score+(h.boost||0)))}}}if(n){let l=Object.create(null),c=0,u=(h,d)=>{var p,m;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((m=d.rank)!==null&&m!==void 0?m:1e9)||(h.name<d.name?-1:1)};for(let h of n.sort(u))c-=1e5,l[h.name]=c;for(let h of t){let{section:d}=h.completion;d&&(h.score+=l[typeof d=="string"?d:d.name])}}let s=[],o=null,a=e.facet(Qt).compareCompletions;for(let l of t.sort((c,u)=>u.score-c.score||a(c.completion,u.completion))){let c=l.completion;!o||o.label!=c.label||o.detail!=c.detail||o.type!=null&&c.type!=null&&o.type!=c.type||o.apply!=c.apply||o.boost!=c.boost?s.push(l):cv(l.completion)>cv(o)&&(s[s.length-1]=l),o=l.completion}return s}class ps{constructor(e,t,n,i,s,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ps(this.options,uv(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,s){let o=jE(e,t);if(!o.length)return i&&e.some(l=>l.state==1)?new ps(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let a=t.facet(Qt).selectOnOpen?0:-1;if(i&&i.selected!=a&&i.selected!=-1){let l=i.options[i.selected].completion;for(let c=0;c<o.length;c++)if(o[c].completion==l){a=c;break}}return new ps(o,uv(n,a),{pos:e.reduce((l,c)=>c.hasResult()?Math.min(l,c.from):l,1e8),create:zE,above:s.aboveCursor},i?i.timestamp:Date.now(),a,!1)}map(e){return new ps(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class xl{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new xl($E,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Qt),s=(n.override||t.languageDataAt("autocomplete",ti(t)).map(IE)).map(a=>(this.active.find(c=>c.source==a)||new lr(a,this.active.some(c=>c.state!=0)?1:0)).update(e,n));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))||!VE(s,this.active)?o=ps.build(s,t,this.id,o,n):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 lr(a.source,0):a));for(let a of e.effects)a.is(lf)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new xl(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:WE}}function VE(r,e){if(r==e)return!0;for(let t=0,n=0;;){for(;t<r.length&&!r[t].hasResult;)t++;for(;n<e.length&&!e[n].hasResult;)n++;let i=t==r.length,s=n==e.length;if(i||s)return i==s;if(r[t++].result!=e[n++].result)return!1}}const WE={"aria-autocomplete":"list"};function uv(r,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":r};return e>-1&&(t["aria-activedescendant"]=r+"-"+e),t}const $E=[];function af(r){return r.isUserEvent("input.type")?"input":r.isUserEvent("delete.backward")?"delete":null}class lr{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=af(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&i.state!=0&&(i=new lr(i.source,0));for(let s of e.effects)if(s.is(sf))i=new lr(i.source,1,s.value?ti(e.state):-1);else if(s.is(Co))i=new lr(i.source,0);else if(s.is(fv))for(let o of s.value)o.source==i.source&&(i=o);return i}handleUserEvent(e,t,n){return t=="delete"||!n.activateOnTyping?this.map(e.changes):new lr(this.source,1)}handleChange(e){return e.changes.touchesRange(ti(e.startState))?new lr(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new lr(this.source,this.state,e.mapPos(this.explicitPos))}}class gs extends lr{constructor(e,t,n,i,s){super(e,2,t),this.result=n,this.from=i,this.to=s}hasResult(){return!0}handleUserEvent(e,t,n){var i;let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=ti(e.state);if((this.explicitPos<0?a<=s:a<this.from)||a>o||t=="delete"&&ti(e.startState)==this.from)return new lr(this.source,t=="input"&&n.activateOnTyping?1:0);let l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos),c;return HE(this.result.validFor,e.state,s,o)?new gs(this.source,l,this.result,s,o):this.result.update&&(c=this.result.update(this.result,s,o,new rv(e.state,a,l>=0)))?new gs(this.source,l,c,c.from,(i=c.to)!==null&&i!==void 0?i:ti(e.state)):new lr(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new lr(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new gs(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function HE(r,e,t,n){if(!r)return!1;let i=e.sliceDoc(t,n);return typeof r=="function"?r(i,t,n,e):sv(r,!0).test(i)}const fv=Ae.define({map(r,e){return r.map(t=>t.map(e))}}),lf=Ae.define(),jt=kt.define({create(){return xl.start()},update(r,e){return r.update(e)},provide:r=>[Ja.from(r,e=>e.tooltip),he.contentAttributes.from(r,e=>e.attrs)]});function hv(r,e){const t=e.completion.apply||e.completion.label;let n=r.state.field(jt).active.find(i=>i.source==e.source);return n instanceof gs?(typeof t=="string"?r.dispatch(Object.assign(Object.assign({},ME(r.state,t,n.from,n.to)),{annotations:ov.of(e.completion)})):t(r,e.completion,n.from,n.to),!0):!1}const zE=BE(jt,hv);function wl(r,e="option"){return t=>{let n=t.state.field(jt,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(Qt).interactionDelay)return!1;let i=1,s;e=="page"&&(s=mm(t,n.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,a=n.open.selected>-1?n.open.selected+i*(r?1:-1):r?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),t.dispatch({effects:lf.of(a)}),!0}}const UE=r=>{let e=r.state.field(jt,!1);return r.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<r.state.facet(Qt).interactionDelay?!1:hv(r,e.open.options[e.open.selected])},GE=r=>r.state.field(jt,!1)?(r.dispatch({effects:sf.of(!0)}),!0):!1,KE=r=>{let e=r.state.field(jt,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(r.dispatch({effects:Co.of(null)}),!0)};class YE{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const JE=50,QE=1e3,XE=ut.fromClass(class{constructor(r){this.view=r,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let e of r.state.field(jt).active)e.state==1&&this.startQuery(e)}update(r){let e=r.state.field(jt);if(!r.selectionSet&&!r.docChanged&&r.startState.field(jt)==e)return;let t=r.transactions.some(n=>(n.selection||n.docChanged)&&!af(n));for(let n=0;n<this.running.length;n++){let i=this.running[n];if(t||i.updates.length+r.transactions.length>JE&&Date.now()-i.time>QE){for(let s of i.context.abortListeners)try{s()}catch(o){Nr(this.view.state,o)}i.context.abortListeners=null,this.running.splice(n--,1)}else i.updates.push(...r.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=e.active.some(n=>n.state==1&&!this.running.some(i=>i.active.source==n.source))?setTimeout(()=>this.startUpdate(),50):-1,this.composing!=0)for(let n of r.transactions)af(n)=="input"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:r}=this.view,e=r.field(jt);for(let t of e.active)t.state==1&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t)}startQuery(r){let{state:e}=this.view,t=ti(e),n=new rv(e,t,r.explicitPos==t),i=new YE(r,n);this.running.push(i),Promise.resolve(r.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Co.of(null)}),Nr(this.view.state,s)})}scheduleAccept(){this.running.every(r=>r.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Qt).updateSyncTime))}accept(){var r;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Qt);for(let n=0;n<this.running.length;n++){let i=this.running[n];if(i.done===void 0)continue;if(this.running.splice(n--,1),i.done){let o=new gs(i.active.source,i.active.explicitPos,i.done,i.done.from,(r=i.done.to)!==null&&r!==void 0?r:ti(i.updates.length?i.updates[0].startState:this.view.state));for(let a of i.updates)o=o.update(a,t);if(o.hasResult()){e.push(o);continue}}let s=this.view.state.field(jt).active.find(o=>o.source==i.active.source);if(s&&s.state==1)if(i.done==null){let o=new lr(i.active.source,0);for(let a of i.updates)o=o.update(a,t);o.state!=1&&e.push(o)}else this.startQuery(s)}e.length&&this.view.dispatch({effects:fv.of(e)})}},{eventHandlers:{blur(r){let e=this.view.state.field(jt,!1);if(e&&e.tooltip&&this.view.state.facet(Qt).closeOnBlur){let t=e.open&&mm(this.view,e.open.tooltip);(!t||!t.dom.contains(r.relatedTarget))&&this.view.dispatch({effects:Co.of(null)})}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:sf.of(!1)}),20),this.composing=0}}}),dv=he.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"}}});class ZE{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class cf{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,MapMode.TrackDel),n=e.mapPos(this.to,1,MapMode.TrackDel);return t==null||n==null?null:new cf(this.field,t,n)}}class uf{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let c=o,u=/^\t*/.exec(l)[0].length;for(let h=0;h<u;h++)c+=e.facet(indentUnit);i.push(t+c.length-u),l=c+l.slice(u)}n.push(l),t+=l.length+1}let a=this.fieldPositions.map(l=>new cf(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let t=[],n=[],i=[],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;for(let u=0;u<t.length;u++)(a!=null?t[u].seq==a:l&&t[u].name==l)&&(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:l}),c=u;for(let h of i)h.field>=c&&h.field++}i.push(new ZE(c,n.length,s.index,s.index+l.length)),o=o.slice(0,s.index)+l+o.slice(s.index+s[0].length)}for(let a;a=/\\([{}])/.exec(o);){o=o.slice(0,a.index)+a[1]+o.slice(a.index+a[0].length);for(let l of i)l.line==n.length&&l.from>a.index&&(l.from--,l.to--)}n.push(o)}return new uf(n,i)}}let _E=we.widget({widget:new class extends on{toDOM(){let r=document.createElement("span");return r.className="cm-snippetFieldPosition",r}ignoreEvent(){return!1}}}),qE=we.mark({class:"cm-snippetField"});class ms{constructor(e,t){this.ranges=e,this.active=t,this.deco=we.set(e.map(n=>(n.from==n.to?_E:qE).range(n.from,n.to)))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new ms(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(n=>n.field==this.active&&n.from<=t.from&&n.to>=t.to))}}const Oo=Ae.define({map(r,e){return r&&r.map(e)}}),eT=Ae.define(),Oi=kt.define({create(){return null},update(r,e){for(let t of e.effects){if(t.is(Oo))return t.value;if(t.is(eT)&&r)return new ms(r.ranges,t.value)}return r&&e.docChanged&&(r=r.map(e.changes)),r&&e.selection&&!r.selectionInsideField(e.selection)&&(r=null),r},provide:r=>he.decorations.from(r,e=>e?e.deco:we.none)});function ff(r,e){return ie.create(r.filter(t=>t.field==e).map(t=>ie.range(t.from,t.to)))}function tT(r){let e=uf.parse(r);return(t,n,i,s)=>{let{text:o,ranges:a}=e.instantiate(t.state,i),l={changes:{from:i,to:s,insert:Text.of(o)},scrollIntoView:!0,annotations:n?ov.of(n):void 0};if(a.length&&(l.selection=ff(a,0)),a.length>1){let c=new ms(a,0),u=l.effects=[Oo.of(c)];t.state.field(Oi,!1)===void 0&&u.push(StateEffect.appendConfig.of([Oi,oT,aT,dv]))}t.dispatch(t.state.update(l))}}function pv(r){return({state:e,dispatch:t})=>{let n=e.field(Oi,!1);if(!n||r<0&&n.active==0)return!1;let i=n.active+r,s=r>0&&!n.ranges.some(o=>o.field==i+r);return t(e.update({selection:ff(n.ranges,i),effects:Oo.of(s?null:new ms(n.ranges,i)),scrollIntoView:!0})),!0}}const rT=({state:r,dispatch:e})=>r.field(Oi,!1)?(e(r.update({effects:Oo.of(null)})),!0):!1,nT=pv(1),iT=pv(-1);function ZD(r){let e=r.field(Oi,!1);return!!(e&&e.ranges.some(t=>t.field==e.active+1))}function _D(r){let e=r.field(Oi,!1);return!!(e&&e.active>0)}const sT=[{key:"Tab",run:nT,shift:iT},{key:"Escape",run:rT}],gv=de.define({combine(r){return r.length?r[0]:sT}}),oT=xi.highest(oo.compute([gv],r=>r.facet(gv)));function qD(r,e){return Object.assign(Object.assign({},e),{apply:tT(r)})}const aT=he.domEventHandlers({mousedown(r,e){let t=e.state.field(Oi,!1),n;if(!t||(n=e.posAtCoords({x:r.clientX,y:r.clientY}))==null)return!1;let i=t.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==t.active?!1:(e.dispatch({selection:ff(t.ranges,i.field),effects:Oo.of(t.ranges.some(s=>s.field>i.field)?new ms(t.ranges,i.field):null),scrollIntoView:!0}),!0)}});function lT(r){let e=r.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${e}]+`,"ug")}catch{return new RegExp(`[w${e}]`,"g")}}function mv(r,e){return new RegExp(e(r.source),r.unicode?"u":"")}const vv=null;function cT(r){return vv[r]||(vv[r]=new WeakMap)}function yv(r,e,t,n,i){for(let s=r.iterLines(),o=0;!s.next().done;){let{value:a}=s,l;for(e.lastIndex=0;l=e.exec(a);)if(!n[l[0]]&&o+l.index!=i&&(t.push({type:"text",label:l[0]}),n[l[0]]=!0,t.length>=2e3))return;o+=a.length+1}}function bv(r,e,t,n,i){let s=r.length>=1e3,o=s&&e.get(r);if(o)return o;let a=[],l=Object.create(null);if(r.children){let c=0;for(let u of r.children){if(u.length>=1e3)for(let h of bv(u,e,t,n-c,i-c))l[h.label]||(l[h.label]=!0,a.push(h));else yv(u,t,a,l,i-c);c+=u.length+1}}else yv(r,t,a,l,i);return s&&a.length<2e3&&e.set(r,a),a}const e3=r=>{let e=r.state.languageDataAt("wordChars",r.pos).join(""),t=lT(e),n=r.matchBefore(mv(t,o=>o+"$"));if(!n&&!r.explicit)return null;let i=n?n.from:r.pos,s=bv(r.state.doc,cT(e),t,5e4,i);return{from:i,options:s,validFor:mv(t,o=>"^"+o)}},Eo={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ei=Ae.define({map(r,e){let t=e.mapPos(r,-1,rr.TrackAfter);return t??void 0}}),hf=new class extends wi{};hf.startSide=1,hf.endSide=-1;const xv=kt.define({create(){return Ge.empty},update(r,e){if(e.selection){let t=e.state.doc.lineAt(e.selection.main.head).from,n=e.startState.doc.lineAt(e.startState.selection.main.head).from;t!=e.changes.mapPos(n,-1)&&(r=Ge.empty)}r=r.map(e.changes);for(let t of e.effects)t.is(Ei)&&(r=r.update({add:[hf.range(t.value,t.value+1)]}));return r}});function uT(){return[hT,xv]}const df="()[]{}<>";function wv(r){for(let e=0;e<df.length;e+=2)if(df.charCodeAt(e)==r)return df.charAt(e+1);return kc(r<128?r:r+1)}function Sv(r,e){return r.languageDataAt("closeBrackets",e)[0]||Eo}const fT=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),hT=he.inputHandler.of((r,e,t,n)=>{if((fT?r.composing:r.compositionStarted)||r.state.readOnly)return!1;let i=r.state.selection.main;if(n.length>2||n.length==2&&Dr(Lt(n,0))==1||e!=i.from||t!=i.to)return!1;let s=pT(r.state,n);return s?(r.dispatch(s),!0):!1}),dT=[{key:"Backspace",run:({state:r,dispatch:e})=>{if(r.readOnly)return!1;let n=Sv(r,r.selection.main.head).brackets||Eo.brackets,i=null,s=r.changeByRange(o=>{if(o.empty){let a=gT(r.doc,o.head);for(let l of n)if(l==a&&Sl(r.doc,o.head)==wv(Lt(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:ie.cursor(o.head-l.length)}}return{range:i=o}});return i||e(r.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function pT(r,e){let t=Sv(r,r.selection.main.head),n=t.brackets||Eo.brackets;for(let i of n){let s=wv(Lt(i,0));if(e==i)return s==i?yT(r,i,n.indexOf(i+i+i)>-1,t):mT(r,i,s,t.before||Eo.before);if(e==s&&kv(r,r.selection.main.from))return vT(r,i,s)}return null}function kv(r,e){let t=!1;return r.field(xv).between(0,r.doc.length,n=>{n==e&&(t=!0)}),t}function Sl(r,e){let t=r.sliceString(e,e+2);return t.slice(0,Dr(Lt(t,0)))}function gT(r,e){let t=r.sliceString(e-2,e);return Dr(Lt(t,0))==t.length?t:t.slice(1)}function mT(r,e,t,n){let i=null,s=r.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:Ei.of(o.to+e.length),range:ie.range(o.anchor+e.length,o.head+e.length)};let a=Sl(r.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+t,from:o.head},effects:Ei.of(o.head+e.length),range:ie.cursor(o.head+e.length)}:{range:i=o}});return i?null:r.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function vT(r,e,t){let n=null,i=r.changeByRange(s=>s.empty&&Sl(r.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:ie.cursor(s.head+t.length)}:n={range:s});return n?null:r.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function yT(r,e,t,n){let i=n.stringPrefixes||Eo.stringPrefixes,s=null,o=r.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:Ei.of(a.to+e.length),range:ie.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=Sl(r.doc,l),u;if(c==e){if(Av(r,l))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)};if(kv(r,l)){let d=t&&r.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+d.length,insert:d},range:ie.cursor(l+d.length)}}}else{if(t&&r.sliceDoc(l-2*e.length,l)==e+e&&(u=Cv(r,l-2*e.length,i))>-1&&Av(r,u))return{changes:{insert:e+e+e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)};if(r.charCategorizer(l)(c)!=ot.Word&&Cv(r,l,i)>-1&&!bT(r,l,e,i))return{changes:{insert:e+e,from:l},effects:Ei.of(l+e.length),range:ie.cursor(l+e.length)}}return{range:s=a}});return s?null:r.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Av(r,e){let t=Nt(r).resolveInner(e+1);return t.parent&&t.from==e}function bT(r,e,t,n){let i=Nt(r).resolveInner(e,-1),s=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=r.sliceDoc(i.from,Math.min(i.to,i.from+t.length+s)),l=a.indexOf(t);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>t.length+l;){if(r.sliceDoc(u.to-t.length,u.to)==t)return!1;u=u.firstChild}return!0}let c=i.to==e&&i.parent;if(!c)break;i=c}return!1}function Cv(r,e,t){let n=r.charCategorizer(e);if(n(r.sliceDoc(e-1,e))!=ot.Word)return e;for(let i of t){let s=e-i.length;if(r.sliceDoc(s,e)==i&&n(r.sliceDoc(s-1,s))!=ot.Word)return s}return-1}function xT(r={}){return[jt,Qt.of(r),XE,wT,dv]}const Ov=[{key:"Ctrl-Space",run:GE},{key:"Escape",run:KE},{key:"ArrowDown",run:wl(!0)},{key:"ArrowUp",run:wl(!1)},{key:"PageDown",run:wl(!0,"page")},{key:"PageUp",run:wl(!1,"page")},{key:"Enter",run:UE}],wT=xi.highest(oo.computeN([Qt],r=>r.facet(Qt).defaultKeymap?[Ov]:[]));function r3(r){let e=r.field(jt,!1);return e&&e.active.some(t=>t.state==1)?"pending":e&&e.active.some(t=>t.state!=0)?"active":null}const Ev=new WeakMap;function n3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;if(!t||t.disabled)return[];let n=Ev.get(t.options);return n||Ev.set(t.options,n=t.options.map(i=>i.completion)),n}function i3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.options[t.selected].completion:null}function s3(r){var e;let t=(e=r.field(jt,!1))===null||e===void 0?void 0:e.open;return t&&!t.disabled&&t.selected>=0?t.selected:null}function o3(r){return lf.of(r)}class ST{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Ti{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,s=n.facet(Pi).markerFilter;s&&(i=s(i));let o=we.set(i.map(a=>a.from==a.to||a.from==a.to-1&&n.doc.lineAt(a.from).to==a.from?we.widget({widget:new MT(a),diagnostic:a}).range(a.from):we.mark({attributes:{class:"cm-lintRange cm-lintRange-"+a.severity+(a.markClass?" "+a.markClass:"")},diagnostic:a}).range(a.from,a.to)),!0);return new Ti(o,t,vs(o))}}function vs(r,e=null,t=0){let n=null;return r.between(t,1e9,(i,s,{spec:o})=>{if(!(e&&o.diagnostic!=e))return n=new ST(i,s,o.diagnostic),!1}),n}function Tv(r,e){let t=r.startState.doc.lineAt(e.pos);return!!(r.effects.some(n=>n.is(kl))||r.changes.touchesRange(t.from,t.to))}function Pv(r,e){return r.field(Xt,!1)?e:e.concat(Ae.appendConfig.of(Wv))}function kT(r,e){return{effects:Pv(r,[kl.of(e)])}}const kl=Ae.define(),pf=Ae.define(),Mv=Ae.define(),Xt=kt.define({create(){return new Ti(we.none,null,null)},update(r,e){if(e.docChanged){let t=r.diagnostics.map(e.changes),n=null;if(r.selected){let i=e.changes.mapPos(r.selected.from,1);n=vs(t,r.selected.diagnostic,i)||vs(t,null,i)}r=new Ti(t,r.panel,n)}for(let t of e.effects)t.is(kl)?r=Ti.init(t.value,r.panel,e.state):t.is(pf)?r=new Ti(r.diagnostics,t.value?Al.open:null,r.selected):t.is(Mv)&&(r=new Ti(r.diagnostics,r.panel,t.value));return r},provide:r=>[ho.from(r,e=>e.panel),he.decorations.from(r,e=>e.diagnostics)]});function a3(r){let e=r.field(Xt,!1);return e?e.diagnostics.size:0}const AT=we.mark({class:"cm-lintRange cm-lintRange-active"});function CT(r,e,t){let{diagnostics:n}=r.state.field(Xt),i=[],s=2e8,o=0;n.between(e-(t<0?1:0),e+(t>0?1:0),(l,c,{spec:u})=>{e>=l&&e<=c&&(l==c||(e>l||t>0)&&(e<c||t<0))&&(i.push(u.diagnostic),s=Math.min(l,s),o=Math.max(c,o))});let a=r.state.facet(Pi).tooltipFilter;return a&&(i=a(i)),i.length?{pos:s,end:o,above:r.state.doc.lineAt(s).to<o,create(){return{dom:Iv(r,i)}}}:null}function Iv(r,e){return rt("ul",{class:"cm-tooltip-lint"},e.map(t=>Lv(r,t,!1)))}const OT=r=>{let e=r.state.field(Xt,!1);(!e||!e.panel)&&r.dispatch({effects:Pv(r.state,[pf.of(!0)])});let t=fo(r,Al.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},Dv=r=>{let e=r.state.field(Xt,!1);return!e||!e.panel?!1:(r.dispatch({effects:pf.of(!1)}),!0)},ET=r=>{let e=r.state.field(Xt,!1);if(!e)return!1;let t=r.state.selection.main,n=e.diagnostics.iter(t.to+1);return!n.value&&(n=e.diagnostics.iter(0),!n.value||n.from==t.from&&n.to==t.to)?!1:(r.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0}),!0)},l3=r=>{let{state:e}=r,t=e.field(Xt,!1);if(!t)return!1;let n=e.selection.main,i,s,o,a;return t.diagnostics.between(0,e.doc.length,(l,c)=>{c<n.to&&(i==null||i<l)&&(i=l,s=c),(o==null||l>o)&&(o=l,a=c)}),o==null||i==null&&o==n.from?!1:(r.dispatch({selection:{anchor:i??o,head:s??a},scrollIntoView:!0}),!0)},TT=[{key:"Mod-Shift-m",run:OT,preventDefault:!0},{key:"F8",run:ET}],Nv=ut.fromClass(class{constructor(r){this.view=r,this.timeout=-1,this.set=!0;let{delay:e}=r.state.facet(Pi);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){let r=Date.now();if(r<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-r);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(Pi);Promise.all(t.map(n=>Promise.resolve(n(this.view)))).then(n=>{let i=n.reduce((s,o)=>s.concat(o));this.view.state.doc==e.doc&&this.view.dispatch(kT(this.view.state,i))},n=>{Nr(this.view.state,n)})}}update(r){let e=r.state.facet(Pi);(r.docChanged||e!=r.startState.facet(Pi)||e.needsRefresh&&e.needsRefresh(r))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),Pi=de.define({combine(r){return Object.assign({sources:r.map(e=>e.source)},zr(r.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t}))}});function PT(r,e={}){return[Pi.of({source:r,config:e}),Nv,Wv]}function c3(r){let e=r.plugin(Nv);e&&e.force()}function Rv(r){let e=[];if(r)e:for(let{name:t}of r){for(let n=0;n<t.length;n++){let i=t[n];if(/[a-zA-Z]/.test(i)&&!e.some(s=>s.toLowerCase()==i.toLowerCase())){e.push(i);continue e}}e.push("")}return e}function Lv(r,e,t){var n;let i=t?Rv(e.actions):[];return rt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},rt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage():e.message),(n=e.actions)===null||n===void 0?void 0:n.map((s,o)=>{let a=!1,l=d=>{if(d.preventDefault(),a)return;a=!0;let p=vs(r.state.field(Xt).diagnostics,e);p&&s.apply(r,p.from,p.to)},{name:c}=s,u=i[o]?c.indexOf(i[o]):-1,h=u<0?c:[c.slice(0,u),rt("u",c.slice(u,u+1)),c.slice(u+1)];return rt("button",{type:"button",class:"cm-diagnosticAction",onclick:l,onmousedown:l,"aria-label":` Action: ${c}${u<0?"":` (access key "${i[o]})"`}.`},h)}),e.source&&rt("div",{class:"cm-diagnosticSource"},e.source))}class MT extends on{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return rt("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class Bv{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Lv(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Al{constructor(e){this.view=e,this.items=[];let t=i=>{if(i.keyCode==27)Dv(this.view),this.view.focus();else if(i.keyCode==38||i.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(i.keyCode==40||i.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(i.keyCode==36)this.moveSelection(0);else if(i.keyCode==35)this.moveSelection(this.items.length-1);else if(i.keyCode==13)this.view.focus();else if(i.keyCode>=65&&i.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Rv(s.actions);for(let a=0;a<o.length;a++)if(o[a].toUpperCase().charCodeAt(0)==i.keyCode){let l=vs(this.view.state.field(Xt).diagnostics,s);l&&s.actions[a].apply(e,l.from,l.to)}}else return;i.preventDefault()},n=i=>{for(let s=0;s<this.items.length;s++)this.items[s].dom.contains(i.target)&&this.moveSelection(s)};this.list=rt("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=rt("div",{class:"cm-panel-lint"},this.list,rt("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Dv(this.view)},"\xD7")),this.update()}get selectedIndex(){let e=this.view.state.field(Xt).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(Xt),n=0,i=!1,s=null;for(e.between(0,this.view.state.doc.length,(o,a,{spec:l})=>{let c=-1,u;for(let h=n;h<this.items.length;h++)if(this.items[h].diagnostic==l.diagnostic){c=h;break}c<0?(u=new Bv(this.view,l.diagnostic),this.items.splice(n,0,u),i=!0):(u=this.items[c],c>n&&(this.items.splice(n,c-n),i=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),n++});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();this.items.length==0&&(this.items.push(new Bv(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!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"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Xt),n=vs(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:Mv.of(n)})}static open(e){return new Al(e)}}function Cl(r,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(r)}</svg>')`}function Ol(r){return Cl(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${r}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const IT=he.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:Ol("#d11")},".cm-lintRange-warning":{backgroundImage:Ol("orange")},".cm-lintRange-info":{backgroundImage:Ol("#999")},".cm-lintRange-hint":{backgroundImage:Ol("#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}}});function Fv(r){return r=="error"?4:r=="warning"?3:r=="info"?2:1}class DT extends un{constructor(e){super(),this.diagnostics=e,this.severity=e.reduce((t,n)=>Fv(t)<Fv(n.severity)?n.severity:t,"hint")}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,i=e.state.facet(El).tooltipFilter;return i&&(n=i(n)),n.length&&(t.onmouseover=()=>RT(e,t,n)),t}}function NT(r,e){let t=n=>{let i=e.getBoundingClientRect();if(!(n.clientX>i.left-10&&n.clientX<i.right+10&&n.clientY>i.top-10&&n.clientY<i.bottom+10)){for(let s=n.target;s;s=s.parentNode)if(s.nodeType==1&&s.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),r.state.field(Vv)&&r.dispatch({effects:gf.of(null)})}};window.addEventListener("mousemove",t)}function RT(r,e,t){function n(){let o=r.elementAtHeight(e.getBoundingClientRect().top+5-r.documentTop);r.coordsAtPos(o.from)&&r.dispatch({effects:gf.of({pos:o.from,above:!1,create(){return{dom:Iv(r,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,NT(r,e)}let{hoverTime:i}=r.state.facet(El),s=setTimeout(n,i);e.onmouseout=()=>{clearTimeout(s),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(s),s=setTimeout(n,i)}}function LT(r,e){let t=Object.create(null);for(let i of e){let s=r.lineAt(i.from);(t[s.from]||(t[s.from]=[])).push(i)}let n=[];for(let i in t)n.push(new DT(t[i]).range(+i));return Ge.of(n,!0)}const BT=bm({class:"cm-gutter-lint",markers:r=>r.state.field(jv)}),jv=kt.define({create(){return Ge.empty},update(r,e){r=r.map(e.changes);let t=e.state.facet(El).markerFilter;for(let n of e.effects)if(n.is(kl)){let i=n.value;t&&(i=t(i||[])),r=LT(e.state.doc,i.slice(0))}return r}}),gf=Ae.define(),Vv=kt.define({create(){return null},update(r,e){return r&&e.docChanged&&(r=Tv(e,r)?null:Object.assign(Object.assign({},r),{pos:e.changes.mapPos(r.pos)})),e.effects.reduce((t,n)=>n.is(gf)?n.value:t,r)},provide:r=>Ja.from(r)}),FT=he.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Cl('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Cl('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Cl('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Wv=[Xt,he.decorations.compute([Xt],r=>{let{selected:e,panel:t}=r.field(Xt);return!e||!t||e.from==e.to?we.none:we.set([AT.range(e.from,e.to)])}),NC(CT,{hideOn:Tv}),IT],El=de.define({combine(r){return zr(r,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function u3(r={}){return[El.of(r),jv,BT,FT,Vv]}function f3(r,e){let t=r.field(Xt,!1);if(t&&t.diagnostics.size)for(let n=RangeSet.iter([t.diagnostics]);n.value;n.next())e(n.value.spec.diagnostic,n.from,n.to)}var $v=function(e){e===void 0&&(e={});var{crosshairCursor:t=!1}=e,n=[];e.closeBracketsKeymap!==!1&&(n=n.concat(dT)),e.defaultKeymap!==!1&&(n=n.concat(eE)),e.searchKeymap!==!1&&(n=n.concat(CE)),e.historyKeymap!==!1&&(n=n.concat(u2)),e.foldKeymap!==!1&&(n=n.concat(mO)),e.completionKeymap!==!1&&(n=n.concat(Ov)),e.lintKeymap!==!1&&(n=n.concat(TT));var i=[];return e.lineNumbers!==!1&&i.push($C()),e.highlightActiveLineGutter!==!1&&i.push(UC()),e.highlightSpecialChars!==!1&&i.push(cC()),e.history!==!1&&i.push(t2()),e.foldGutter!==!1&&i.push(xO()),e.drawSelection!==!1&&i.push(qA()),e.dropCursor!==!1&&i.push(iC()),e.allowMultipleSelections!==!1&&i.push(We.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&i.push(sO()),e.syntaxHighlighting!==!1&&i.push(Nu(AO,{fallback:!0})),e.bracketMatching!==!1&&i.push(MO()),e.closeBrackets!==!1&&i.push(uT()),e.autocompletion!==!1&&i.push(xT()),e.rectangularSelection!==!1&&i.push(kC()),t!==!1&&i.push(OC()),e.highlightActiveLine!==!1&&i.push(gC()),e.highlightSelectionMatches!==!1&&i.push(oE()),e.tabSize&&typeof e.tabSize=="number"&&i.push(_a.of(" ".repeat(e.tabSize))),i.concat([oo.of(n.flat())]).filter(Boolean)},h3=function(e){e===void 0&&(e={});var t=[];e.defaultKeymap!==!1&&(t=t.concat(defaultKeymap)),e.historyKeymap!==!1&&(t=t.concat(historyKeymap));var n=[];return e.highlightSpecialChars!==!1&&n.push(highlightSpecialChars()),e.history!==!1&&n.push(history()),e.drawSelection!==!1&&n.push(drawSelection()),e.syntaxHighlighting!==!1&&n.push(syntaxHighlighting(defaultHighlightStyle,{fallback:!0})),n.concat([keymap.of(t.flat())]).filter(Boolean)};const Hv="#e5c07b",mf="#e06c75",zv="#56b6c2",Uv="#ffffff",To="#abb2bf",Tl="#7d8799",Gv="#61afef",Kv="#98c379",vf="#d19a66",Yv="#c678dd",Jv="#21252b",yf="#2c313a",bf="#282c34",Pl="#353a42",Qv="#3E4451",xf="#528bff",d3={chalky:Hv,coral:mf,cyan:zv,invalid:Uv,ivory:To,stone:Tl,malibu:Gv,sage:Kv,whiskey:vf,violet:Yv,darkBackground:Jv,highlightBackground:yf,background:bf,tooltipBackground:Pl,selection:Qv,cursor:xf},jT=he.theme({"&":{color:To,backgroundColor:bf},".cm-content":{caretColor:xf},".cm-cursor, .cm-dropCursor":{borderLeftColor:xf},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Qv},".cm-panels":{backgroundColor:Jv,color:To},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:bf,color:Tl,border:"none"},".cm-activeLineGutter":{backgroundColor:yf},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Pl},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Pl,borderBottomColor:Pl},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:yf,color:To}}},{dark:!0}),VT=as.define([{tag:M.keyword,color:Yv},{tag:[M.name,M.deleted,M.character,M.propertyName,M.macroName],color:mf},{tag:[M.function(M.variableName),M.labelName],color:Gv},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:vf},{tag:[M.definition(M.name),M.separator],color:To},{tag:[M.typeName,M.className,M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:Hv},{tag:[M.operator,M.operatorKeyword,M.url,M.escape,M.regexp,M.link,M.special(M.string)],color:zv},{tag:[M.meta,M.comment],color:Tl},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.link,color:Tl,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:mf},{tag:[M.atom,M.bool,M.special(M.variableName)],color:vf},{tag:[M.processingInstruction,M.string,M.inserted],color:Kv},{tag:M.invalid,color:Uv}]),WT=[jT,Nu(VT)];var $T=he.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),HT=function(e){e===void 0&&(e={});var{indentWithTab:t=!0,editable:n=!0,readOnly:i=!1,theme:s="light",placeholder:o="",basicSetup:a=!0}=e,l=[];switch(t&&l.unshift(oo.of([tE])),a&&(typeof a=="boolean"?l.unshift($v()):l.unshift($v(a))),o&&l.unshift(bC(o)),s){case"light":l.push($T);break;case"dark":l.push(WT);break;case"none":break;default:l.push(s);break}return n===!1&&l.push(he.editable.of(!1)),i&&l.push(We.readOnly.of(!0)),[...l]},zT=r=>({line:r.state.doc.lineAt(r.state.selection.main.from),lineCount:r.state.doc.lines,lineBreak:r.state.lineBreak,length:r.state.doc.length,readOnly:r.state.readOnly,tabSize:r.state.tabSize,selection:r.state.selection,selectionAsSingle:r.state.selection.asSingle().main,ranges:r.state.selection.ranges,selectionCode:r.state.sliceDoc(r.state.selection.main.from,r.state.selection.main.to),selections:r.state.selection.ranges.map(e=>r.state.sliceDoc(e.from,e.to)),selectedText:r.state.selection.ranges.some(e=>!e.empty)}),Xv=sn.define(),UT=[];function GT(r){var{value:e,selection:t,onChange:n,onStatistics:i,onCreateEditor:s,onUpdate:o,extensions:a=UT,autoFocus:l,theme:c="light",height:u=null,minHeight:h=null,maxHeight:d=null,width:p=null,minWidth:m=null,maxWidth:y=null,placeholder:w="",editable:A=!0,readOnly:T=!1,indentWithTab:P=!0,basicSetup:L=!0,root:D,initialState:j}=r,[W,q]=(0,S.useState)(),[F,H]=(0,S.useState)(),[Q,oe]=(0,S.useState)(),fe=he.theme({"&":{height:u,minHeight:h,maxHeight:d,width:p,minWidth:m,maxWidth:y},"& .cm-scroller":{height:"100% !important"}}),be=he.updateListener.of(Se=>{if(Se.docChanged&&typeof n=="function"&&!Se.transactions.some(De=>De.annotation(Xv))){var Oe=Se.state.doc,Te=Oe.toString();n(Te,Se)}i&&i(zT(Se))}),ke=HT({theme:c,editable:A,readOnly:T,placeholder:w,indentWithTab:P,basicSetup:L}),Re=[be,fe,...ke];return o&&typeof o=="function"&&Re.push(he.updateListener.of(o)),Re=Re.concat(a),(0,S.useEffect)(()=>{if(W&&!Q){var Se={doc:e,selection:t,extensions:Re},Oe=j?We.fromJSON(j.json,Se,j.fields):We.create(Se);if(oe(Oe),!F){var Te=new he({state:Oe,parent:W,root:D});H(Te),s&&s(Te,Oe)}}return()=>{F&&(oe(void 0),H(void 0))}},[W,Q]),(0,S.useEffect)(()=>q(r.container),[r.container]),(0,S.useEffect)(()=>()=>{F&&(F.destroy(),H(void 0))},[F]),(0,S.useEffect)(()=>{l&&F&&F.focus()},[l,F]),(0,S.useEffect)(()=>{F&&F.dispatch({effects:Ae.reconfigure.of(Re)})},[c,a,u,h,d,p,m,y,w,A,T,P,L,n,o]),(0,S.useEffect)(()=>{if(e!==void 0){var Se=F?F.state.doc.toString():"";F&&e!==Se&&F.dispatch({changes:{from:0,to:Se.length,insert:e||""},annotations:[Xv.of(!0)]})}},[e,F]),{state:Q,setState:oe,view:F,setView:H,container:W,setContainer:q}}var KT=f(61250),YT=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Zv=(0,S.forwardRef)((r,e)=>{var{className:t,value:n="",selection:i,extensions:s=[],onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,autoFocus:u,theme:h="light",height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:P,indentWithTab:L,editable:D,readOnly:j,root:W,initialState:q}=r,F=UO(r,YT),H=(0,S.useRef)(null),{state:Q,view:oe,container:fe}=GT({container:H.current,root:W,value:n,autoFocus:u,theme:h,height:d,minHeight:p,maxHeight:m,width:y,minWidth:w,maxWidth:A,basicSetup:T,placeholder:P,indentWithTab:L,editable:D,readOnly:j,selection:i,onChange:o,onStatistics:a,onCreateEditor:l,onUpdate:c,extensions:s,initialState:q});if((0,S.useImperativeHandle)(e,()=>({editor:H.current,state:Q,view:oe}),[H,fe,Q,oe]),typeof n!="string")throw new Error("value must be typeof string but got "+typeof n);var be=typeof h=="string"?"cm-theme-"+h:"cm-theme";return(0,KT.jsx)("div",Vu({ref:H,className:""+be+(t?" "+t:"")},F))});Zv.displayName="CodeMirror";const JT=Zv,QT=(0,Je.ZP)(JT)`
|
|
153
153
|
display: flex;
|
|
154
154
|
flex-direction: column;
|
|
155
155
|
justify-content: flex-start;
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
.cm-activeLine {
|
|
180
180
|
background: none;
|
|
181
181
|
}
|
|
182
|
-
|
|
182
|
+
.cm-lintRange,
|
|
183
183
|
.cm-lintPoint:after {
|
|
184
184
|
border: none;
|
|
185
185
|
width: 10px;
|
|
@@ -200,35 +200,34 @@
|
|
|
200
200
|
background: none;
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
`;function Ml(){return Ml=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Ml.apply(this,arguments)}var _v=r=>{var{theme:e,settings:t={},styles:n=[]}=r,i={".cm-gutters":{}},s={};t.background&&(s.backgroundColor=t.background),t.backgroundImage&&(s.backgroundImage=t.backgroundImage),t.foreground&&(s.color=t.foreground),(t.background||t.foreground)&&(i["&"]=s),t.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:t.fontFamily}),t.gutterBackground&&(i[".cm-gutters"].backgroundColor=t.gutterBackground),t.gutterForeground&&(i[".cm-gutters"].color=t.gutterForeground),t.gutterBorder&&(i[".cm-gutters"].borderRightColor=t.gutterBorder),t.caret&&(i[".cm-content"]={caretColor:t.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:t.caret});var o={};t.gutterActiveForeground&&(o.color=t.gutterActiveForeground),t.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:t.lineHighlight},o.backgroundColor=t.lineHighlight),i[".cm-activeLineGutter"]=o,t.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:t.selection+" !important"}),t.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:t.selectionMatch});var a=he.theme(i,{dark:e==="dark"}),l=as.define(n),c=[a,Nu(l)];return c};const
|
|
203
|
+
`;function Ml(){return Ml=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},Ml.apply(this,arguments)}var _v=r=>{var{theme:e,settings:t={},styles:n=[]}=r,i={".cm-gutters":{}},s={};t.background&&(s.backgroundColor=t.background),t.backgroundImage&&(s.backgroundImage=t.backgroundImage),t.foreground&&(s.color=t.foreground),(t.background||t.foreground)&&(i["&"]=s),t.fontFamily&&(i["&.cm-editor .cm-scroller"]={fontFamily:t.fontFamily}),t.gutterBackground&&(i[".cm-gutters"].backgroundColor=t.gutterBackground),t.gutterForeground&&(i[".cm-gutters"].color=t.gutterForeground),t.gutterBorder&&(i[".cm-gutters"].borderRightColor=t.gutterBorder),t.caret&&(i[".cm-content"]={caretColor:t.caret},i[".cm-cursor, .cm-dropCursor"]={borderLeftColor:t.caret});var o={};t.gutterActiveForeground&&(o.color=t.gutterActiveForeground),t.lineHighlight&&(i[".cm-activeLine"]={backgroundColor:t.lineHighlight},o.backgroundColor=t.lineHighlight),i[".cm-activeLineGutter"]=o,t.selection&&(i["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:t.selection+" !important"}),t.selectionMatch&&(i["& .cm-selectionMatch"]={backgroundColor:t.selectionMatch});var a=he.theme(i,{dark:e==="dark"}),l=as.define(n),c=[a,Nu(l)];return c};const p3=null;var XT={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f0",selectionMatch:"#d7d4f0",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b61"},g3=null,wf=r=>{var{theme:e="dark",settings:t={},styles:n=[]}=r||{};return _v({theme:e,settings:Ml({},XT,t),styles:[{tag:M.keyword,color:"#cf6edf"},{tag:[M.name,M.deleted,M.character,M.macroName],color:"#56c8d8"},{tag:[M.propertyName],color:"#facf4e"},{tag:[M.variableName],color:"#bdbdbd"},{tag:[M.function(M.variableName)],color:"#56c8d8"},{tag:[M.labelName],color:"#cf6edf"},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:"#facf4e"},{tag:[M.definition(M.name),M.separator],color:"#fa5788"},{tag:[M.brace],color:"#cf6edf"},{tag:[M.annotation],color:"#ff5f52"},{tag:[M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:"#ffad42"},{tag:[M.typeName,M.className],color:"#ffad42"},{tag:[M.operator,M.operatorKeyword],color:"#7186f0"},{tag:[M.tagName],color:"#99d066"},{tag:[M.squareBracket],color:"#ff5f52"},{tag:[M.angleBracket],color:"#606f7a"},{tag:[M.attributeName],color:"#bdbdbd"},{tag:[M.regexp],color:"#ff5f52"},{tag:[M.quote],color:"#6abf69"},{tag:[M.string],color:"#99d066"},{tag:M.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[M.url,M.escape,M.special(M.string)],color:"#facf4e"},{tag:[M.meta],color:"#707d8b"},{tag:[M.comment],color:"#707d8b",fontStyle:"italic"},{tag:M.monospace,color:"#bdbdbd"},{tag:M.strong,fontWeight:"bold",color:"#ff5f52"},{tag:M.emphasis,fontStyle:"italic",color:"#99d066"},{tag:M.strikethrough,textDecoration:"line-through"},{tag:M.heading,fontWeight:"bold",color:"#facf4e"},{tag:M.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[M.heading2,M.heading3,M.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[M.heading5,M.heading6],color:"#facf4e"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"#56c8d8"},{tag:[M.processingInstruction,M.inserted],color:"#ff5f52"},{tag:[M.contentSeparator],color:"#56c8d8"},{tag:M.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"},...n]})},ZT=wf,m3=wf(),v3=wf(),_T={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#FAFAFA",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},Sf=r=>{var{theme:e="light",settings:t={},styles:n=[]}=r||{};return _v({theme:e,settings:Ml({},_T,t),styles:[{tag:M.keyword,color:"#39ADB5"},{tag:[M.name,M.deleted,M.character,M.macroName],color:"#90A4AE"},{tag:[M.propertyName],color:"#6182B8"},{tag:[M.processingInstruction,M.string,M.inserted,M.special(M.string)],color:"#91B859"},{tag:[M.function(M.variableName),M.labelName],color:"#6182B8"},{tag:[M.color,M.constant(M.name),M.standard(M.name)],color:"#39ADB5"},{tag:[M.definition(M.name),M.separator],color:"#90A4AE"},{tag:[M.className],color:"#E2931D"},{tag:[M.number,M.changed,M.annotation,M.modifier,M.self,M.namespace],color:"#F76D47"},{tag:[M.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[M.operator,M.operatorKeyword],color:"#39ADB5"},{tag:[M.url,M.escape,M.regexp,M.link],color:"#91B859"},{tag:[M.meta,M.comment],color:"#90A4AE"},{tag:M.strong,fontWeight:"bold"},{tag:M.emphasis,fontStyle:"italic"},{tag:M.link,textDecoration:"underline"},{tag:M.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"#90A4AE"},{tag:M.invalid,color:"#E5393570"},{tag:M.strikethrough,textDecoration:"line-through"},...n]})},y3=Sf();function Il(r,e){e===void 0&&(e=!1);var t=r.length,n=0,i="",s=0,o=16,a=0,l=0,c=0,u=0,h=0;function d(P,L){for(var D=0,j=0;D<P||!L;){var W=r.charCodeAt(n);if(W>=48&&W<=57)j=j*16+W-48;else if(W>=65&&W<=70)j=j*16+W-65+10;else if(W>=97&&W<=102)j=j*16+W-97+10;else break;n++,D++}return D<P&&(j=-1),j}function p(P){n=P,i="",s=0,o=16,h=0}function m(){var P=n;if(r.charCodeAt(n)===48)n++;else for(n++;n<r.length&&ys(r.charCodeAt(n));)n++;if(n<r.length&&r.charCodeAt(n)===46)if(n++,n<r.length&&ys(r.charCodeAt(n)))for(n++;n<r.length&&ys(r.charCodeAt(n));)n++;else return h=3,r.substring(P,n);var L=n;if(n<r.length&&(r.charCodeAt(n)===69||r.charCodeAt(n)===101))if(n++,(n<r.length&&r.charCodeAt(n)===43||r.charCodeAt(n)===45)&&n++,n<r.length&&ys(r.charCodeAt(n))){for(n++;n<r.length&&ys(r.charCodeAt(n));)n++;L=n}else h=3;return r.substring(P,L)}function y(){for(var P="",L=n;;){if(n>=t){P+=r.substring(L,n),h=2;break}var D=r.charCodeAt(n);if(D===34){P+=r.substring(L,n),n++;break}if(D===92){if(P+=r.substring(L,n),n++,n>=t){h=2;break}var j=r.charCodeAt(n++);switch(j){case 34:P+='"';break;case 92:P+="\\";break;case 47:P+="/";break;case 98:P+="\b";break;case 102:P+="\f";break;case 110:P+=`
|
|
204
204
|
`;break;case 114:P+="\r";break;case 116:P+=" ";break;case 117:var W=d(4,!0);W>=0?P+=String.fromCharCode(W):h=4;break;default:h=5}L=n;continue}if(D>=0&&D<=31)if(Po(D)){P+=r.substring(L,n),h=2;break}else h=6;n++}return P}function w(){if(i="",h=0,s=n,l=a,u=c,n>=t)return s=t,o=17;var P=r.charCodeAt(n);if(kf(P)){do n++,i+=String.fromCharCode(P),P=r.charCodeAt(n);while(kf(P));return o=15}if(Po(P))return n++,i+=String.fromCharCode(P),P===13&&r.charCodeAt(n)===10&&(n++,i+=`
|
|
205
|
-
`),a++,c=n,o=14;switch(P){case 123:return n++,o=1;case 125:return n++,o=2;case 91:return n++,o=3;case 93:return n++,o=4;case 58:return n++,o=6;case 44:return n++,o=5;case 34:return n++,i=y(),o=10;case 47:var L=n-1;if(r.charCodeAt(n+1)===47){for(n+=2;n<t&&!Po(r.charCodeAt(n));)n++;return i=r.substring(L,n),o=12}if(r.charCodeAt(n+1)===42){n+=2;for(var D=t-1,j=!1;n<D;){var W=r.charCodeAt(n);if(W===42&&r.charCodeAt(n+1)===47){n+=2,j=!0;break}n++,Po(W)&&(W===13&&r.charCodeAt(n)===10&&n++,a++,c=n)}return j||(n++,h=1),i=r.substring(L,n),o=13}return i+=String.fromCharCode(P),n++,o=16;case 45:if(i+=String.fromCharCode(P),n++,n===t||!ys(r.charCodeAt(n)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;n<t&&A(P);)n++,P=r.charCodeAt(n);if(s!==n){switch(i=r.substring(s,n),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(P),n++,o=16}}function A(P){if(kf(P)||Po(P))return!1;switch(P){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function T(){var P;do P=w();while(P>=12&&P<=15);return P}return{setPosition:p,getPosition:function(){return n},scan:e?T:w,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return s},getTokenLength:function(){return n-s},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return s-u},getTokenError:function(){return h}}}function kf(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function Po(r){return r===10||r===13||r===8232||r===8233}function ys(r){return r>=48&&r<=57}function
|
|
205
|
+
`),a++,c=n,o=14;switch(P){case 123:return n++,o=1;case 125:return n++,o=2;case 91:return n++,o=3;case 93:return n++,o=4;case 58:return n++,o=6;case 44:return n++,o=5;case 34:return n++,i=y(),o=10;case 47:var L=n-1;if(r.charCodeAt(n+1)===47){for(n+=2;n<t&&!Po(r.charCodeAt(n));)n++;return i=r.substring(L,n),o=12}if(r.charCodeAt(n+1)===42){n+=2;for(var D=t-1,j=!1;n<D;){var W=r.charCodeAt(n);if(W===42&&r.charCodeAt(n+1)===47){n+=2,j=!0;break}n++,Po(W)&&(W===13&&r.charCodeAt(n)===10&&n++,a++,c=n)}return j||(n++,h=1),i=r.substring(L,n),o=13}return i+=String.fromCharCode(P),n++,o=16;case 45:if(i+=String.fromCharCode(P),n++,n===t||!ys(r.charCodeAt(n)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;n<t&&A(P);)n++,P=r.charCodeAt(n);if(s!==n){switch(i=r.substring(s,n),i){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return i+=String.fromCharCode(P),n++,o=16}}function A(P){if(kf(P)||Po(P))return!1;switch(P){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function T(){var P;do P=w();while(P>=12&&P<=15);return P}return{setPosition:p,getPosition:function(){return n},scan:e?T:w,getToken:function(){return o},getTokenValue:function(){return i},getTokenOffset:function(){return s},getTokenLength:function(){return n-s},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return s-u},getTokenError:function(){return h}}}function kf(r){return r===32||r===9||r===11||r===12||r===160||r===5760||r>=8192&&r<=8203||r===8239||r===8287||r===12288||r===65279}function Po(r){return r===10||r===13||r===8232||r===8233}function ys(r){return r>=48&&r<=57}function qT(r,e,t){var n,i,s,o,a;if(e){for(o=e.offset,a=o+e.length,s=o;s>0&&!qv(r,s-1);)s--;for(var l=a;l<r.length&&!qv(r,l);)l++;i=r.substring(s,l),n=eP(i,t)}else i=r,n=0,s=0,o=0,a=r.length;var c=tP(t,r),u=!1,h=0,d;t.insertSpaces?d=Af(" ",t.tabSize||4):d=" ";var p=Il(i,!1),m=!1;function y(){return c+Af(d,n+h)}function w(){var Q=p.scan();for(u=!1;Q===15||Q===14;)u=u||Q===14,Q=p.scan();return m=Q===16||p.getTokenError()!==0,Q}var A=[];function T(Q,oe,fe){!m&&oe<a&&fe>o&&r.substring(oe,fe)!==Q&&A.push({offset:oe,length:fe-oe,content:Q})}var P=w();if(P!==17){var L=p.getTokenOffset()+s,D=Af(d,n);T(D,s,L)}for(;P!==17;){for(var j=p.getTokenOffset()+p.getTokenLength()+s,W=w(),q="";!u&&(W===12||W===13);){var F=p.getTokenOffset()+s;T(" ",j,F),j=p.getTokenOffset()+p.getTokenLength()+s,q=W===12?y():"",W=w()}if(W===2)P!==1&&(h--,q=y());else if(W===4)P!==3&&(h--,q=y());else{switch(P){case 3:case 1:h++,q=y();break;case 5:case 12:q=y();break;case 13:u?q=y():q=" ";break;case 6:q=" ";break;case 10:if(W===6){q="";break}case 7:case 8:case 9:case 11:case 2:case 4:W===12||W===13?q=" ":W!==5&&W!==17&&(m=!0);break;case 16:m=!0;break}u&&(W===12||W===13)&&(q=y())}var H=p.getTokenOffset()+s;T(q,j,H),P=W}return A}function Af(r,e){for(var t="",n=0;n<e;n++)t+=r;return t}function eP(r,e){for(var t=0,n=0,i=e.tabSize||4;t<r.length;){var s=r.charAt(t);if(s===" ")n++;else if(s===" ")n+=i;else break;t++}return Math.floor(n/i)}function tP(r,e){for(var t=0;t<e.length;t++){var n=e.charAt(t);if(n==="\r")return t+1<e.length&&e.charAt(t+1)===`
|
|
206
206
|
`?`\r
|
|
207
207
|
`:"\r";if(n===`
|
|
208
208
|
`)return`
|
|
209
209
|
`}return r&&r.eol||`
|
|
210
210
|
`}function qv(r,e){return`\r
|
|
211
|
-
`.indexOf(r.charAt(e))!==-1}var Mo;(function(r){r.DEFAULT={allowTrailingComma:!1}})(Mo||(Mo={}));function
|
|
212
|
-
`.indexOf(r.charAt(e))!==-1}var bs=Il,x3=tP,lP=rP,w3=nP,S3=iP,cP=ty,uP=ey,fP=Cf,k3=Dl,A3=oP;function C3(r){switch(r){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function hP(r,e,t){return _T(r,e,t)}function O3(r,e,t,n){return edit.setProperty(r,e,t,n)}function E3(r,e){for(var t=e.length-1;t>=0;t--)r=edit.applyEdit(r,e[t]);return r}function Io(r,e){if(r===e)return!0;if(r==null||e===null||e===void 0||typeof r!=typeof e||typeof r!="object"||Array.isArray(r)!==Array.isArray(e))return!1;var t,n;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(t=0;t<r.length;t++)if(!Io(r[t],e[t]))return!1}else{var i=[];for(n in r)i.push(n);i.sort();var s=[];for(n in e)s.push(n);if(s.sort(),!Io(i,s))return!1;for(t=0;t<i.length;t++)if(!Io(r[i[t]],e[i[t]]))return!1}return!0}function kr(r){return typeof r=="number"}function Tn(r){return typeof r<"u"}function gn(r){return typeof r=="boolean"}function dP(r){return typeof r=="string"}var iy;(function(r){function e(t){return typeof t=="string"}r.is=e})(iy||(iy={}));var Of;(function(r){function e(t){return typeof t=="string"}r.is=e})(Of||(Of={}));var sy;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(sy||(sy={}));var Nl;(function(r){r.MIN_VALUE=0,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(Nl||(Nl={}));var Br;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=Nl.MAX_VALUE),i===Number.MAX_VALUE&&(i=Nl.MAX_VALUE),{line:n,character:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.uinteger(i.line)&&J.uinteger(i.character)}r.is=t})(Br||(Br={}));var Ue;(function(r){function e(n,i,s,o){if(J.uinteger(n)&&J.uinteger(i)&&J.uinteger(s)&&J.uinteger(o))return{start:Br.create(n,i),end:Br.create(s,o)};if(Br.is(n)&&Br.is(i))return{start:n,end:i};throw new Error("Range#create called with invalid arguments[".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,"]"))}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Br.is(i.start)&&Br.is(i.end)}r.is=t})(Ue||(Ue={}));var xs;(function(r){function e(n,i){return{uri:n,range:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&(J.string(i.uri)||J.undefined(i.uri))}r.is=t})(xs||(xs={}));var oy;(function(r){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.targetRange)&&J.string(i.targetUri)&&Ue.is(i.targetSelectionRange)&&(Ue.is(i.originSelectionRange)||J.undefined(i.originSelectionRange))}r.is=t})(oy||(oy={}));var Ef;(function(r){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.numberRange(i.red,0,1)&&J.numberRange(i.green,0,1)&&J.numberRange(i.blue,0,1)&&J.numberRange(i.alpha,0,1)}r.is=t})(Ef||(Ef={}));var ay;(function(r){function e(n,i){return{range:n,color:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&Ef.is(i.color)}r.is=t})(ay||(ay={}));var ly;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.string(i.label)&&(J.undefined(i.textEdit)||Fr.is(i))&&(J.undefined(i.additionalTextEdits)||J.typedArray(i.additionalTextEdits,Fr.is))}r.is=t})(ly||(ly={}));var Do;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(Do||(Do={}));var cy;(function(r){function e(n,i,s,o,a,l){var c={startLine:n,endLine:i};return J.defined(s)&&(c.startCharacter=s),J.defined(o)&&(c.endCharacter=o),J.defined(a)&&(c.kind=a),J.defined(l)&&(c.collapsedText=l),c}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.uinteger(i.startLine)&&J.uinteger(i.startLine)&&(J.undefined(i.startCharacter)||J.uinteger(i.startCharacter))&&(J.undefined(i.endCharacter)||J.uinteger(i.endCharacter))&&(J.undefined(i.kind)||J.string(i.kind))}r.is=t})(cy||(cy={}));var Tf;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&xs.is(i.location)&&J.string(i.message)}r.is=t})(Tf||(Tf={}));var Ie;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(Ie||(Ie={}));var uy;(function(r){r.Unnecessary=1,r.Deprecated=2})(uy||(uy={}));var fy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&J.string(n.href)}r.is=e})(fy||(fy={}));var Pn;(function(r){function e(n,i,s,o,a,l){var c={range:n,message:i};return J.defined(s)&&(c.severity=s),J.defined(o)&&(c.code=o),J.defined(a)&&(c.source=a),J.defined(l)&&(c.relatedInformation=l),c}r.create=e;function t(n){var i,s=n;return J.defined(s)&&Ue.is(s.range)&&J.string(s.message)&&(J.number(s.severity)||J.undefined(s.severity))&&(J.integer(s.code)||J.string(s.code)||J.undefined(s.code))&&(J.undefined(s.codeDescription)||J.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(J.string(s.source)||J.undefined(s.source))&&(J.undefined(s.relatedInformation)||J.typedArray(s.relatedInformation,Tf.is))}r.is=t})(Pn||(Pn={}));var ws;(function(r){function e(n,i){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var a={title:n,command:i};return J.defined(s)&&s.length>0&&(a.arguments=s),a}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.title)&&J.string(i.command)}r.is=t})(ws||(ws={}));var Fr;(function(r){function e(s,o){return{range:s,newText:o}}r.replace=e;function t(s,o){return{range:{start:s,end:s},newText:o}}r.insert=t;function n(s){return{range:s,newText:""}}r.del=n;function i(s){var o=s;return J.objectLiteral(o)&&J.string(o.newText)&&Ue.is(o.range)}r.is=i})(Fr||(Fr={}));var Ss;(function(r){function e(n,i,s){var o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.string(i.label)&&(J.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(J.string(i.description)||i.description===void 0)}r.is=t})(Ss||(Ss={}));var Zt;(function(r){function e(t){var n=t;return J.string(n)}r.is=e})(Zt||(Zt={}));var ri;(function(r){function e(s,o,a){return{range:s,newText:o,annotationId:a}}r.replace=e;function t(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}r.insert=t;function n(s,o){return{range:s,newText:"",annotationId:o}}r.del=n;function i(s){var o=s;return Fr.is(o)&&(Ss.is(o.annotationId)||Zt.is(o.annotationId))}r.is=i})(ri||(ri={}));var Rl;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&Bl.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(Rl||(Rl={}));var No;(function(r){function e(n,i,s){var o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}r.create=e;function t(n){var i=n;return i&&i.kind==="create"&&J.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||J.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||J.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(No||(No={}));var Ro;(function(r){function e(n,i,s,o){var a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}r.create=e;function t(n){var i=n;return i&&i.kind==="rename"&&J.string(i.oldUri)&&J.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||J.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||J.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(Ro||(Ro={}));var Lo;(function(r){function e(n,i,s){var o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}r.create=e;function t(n){var i=n;return i&&i.kind==="delete"&&J.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||J.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||J.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(Lo||(Lo={}));var Pf;(function(r){function e(t){var n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(i){return J.string(i.kind)?No.is(i)||Ro.is(i)||Lo.is(i):Rl.is(i)}))}r.is=e})(Pf||(Pf={}));var Ll=function(){function r(e,t){this.edits=e,this.changeAnnotations=t}return r.prototype.insert=function(e,t,n){var i,s;if(n===void 0?i=Fr.insert(e,t):Zt.is(n)?(s=n,i=ri.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ri.insert(e,t,s)),this.edits.push(i),s!==void 0)return s},r.prototype.replace=function(e,t,n){var i,s;if(n===void 0?i=Fr.replace(e,t):Zt.is(n)?(s=n,i=ri.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ri.replace(e,t,s)),this.edits.push(i),s!==void 0)return s},r.prototype.delete=function(e,t){var n,i;if(t===void 0?n=Fr.del(e):Zt.is(t)?(i=t,n=ri.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),n=ri.del(e,i)),this.edits.push(n),i!==void 0)return i},r.prototype.add=function(e){this.edits.push(e)},r.prototype.all=function(){return this.edits},r.prototype.clear=function(){this.edits.splice(0,this.edits.length)},r.prototype.assertChangeAnnotations=function(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},r}(),hy=function(){function r(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}return r.prototype.all=function(){return this._annotations},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),r.prototype.manage=function(e,t){var n;if(Zt.is(e)?n=e:(n=this.nextId(),t=e),this._annotations[n]!==void 0)throw new Error("Id ".concat(n," is already in use."));if(t===void 0)throw new Error("No annotation provided for id ".concat(n));return this._annotations[n]=t,this._size++,n},r.prototype.nextId=function(){return this._counter++,this._counter.toString()},r}(),T3=function(){function r(e){var t=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new hy(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(Rl.is(n)){var i=new Ll(n.edits,t._changeAnnotations);t._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new Ll(e.changes[n]);t._textEditChanges[n]=i})):this._workspaceEdit={}}return Object.defineProperty(r.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),r.prototype.getTextEditChange=function(e){if(Bl.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var t={uri:e.uri,version:e.version},n=this._textEditChanges[t.uri];if(!n){var i=[],s={textDocument:t,edits:i};this._workspaceEdit.documentChanges.push(s),n=new Ll(i,this._changeAnnotations),this._textEditChanges[t.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[e];if(!n){var i=[];this._workspaceEdit.changes[e]=i,n=new Ll(i),this._textEditChanges[e]=n}return n}},r.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new hy,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},r.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},r.prototype.createFile=function(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;Ss.is(t)||Zt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=No.create(e,n):(o=Zt.is(i)?i:this._changeAnnotations.manage(i),s=No.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r.prototype.renameFile=function(e,t,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var s;Ss.is(n)||Zt.is(n)?s=n:i=n;var o,a;if(s===void 0?o=Ro.create(e,t,i):(a=Zt.is(s)?s:this._changeAnnotations.manage(s),o=Ro.create(e,t,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a},r.prototype.deleteFile=function(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;Ss.is(t)||Zt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=Lo.create(e,n):(o=Zt.is(i)?i:this._changeAnnotations.manage(i),s=Lo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r}(),dy;(function(r){function e(n){return{uri:n}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)}r.is=t})(dy||(dy={}));var py;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&J.integer(i.version)}r.is=t})(py||(py={}));var Bl;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&(i.version===null||J.integer(i.version))}r.is=t})(Bl||(Bl={}));var gy;(function(r){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&J.string(i.languageId)&&J.integer(i.version)&&J.string(i.text)}r.is=t})(gy||(gy={}));var Ii;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){var n=t;return n===r.PlainText||n===r.Markdown}r.is=e})(Ii||(Ii={}));var Bo;(function(r){function e(t){var n=t;return J.objectLiteral(t)&&Ii.is(n.kind)&&J.string(n.value)}r.is=e})(Bo||(Bo={}));var Ar;(function(r){r.Text=1,r.Method=2,r.Function=3,r.Constructor=4,r.Field=5,r.Variable=6,r.Class=7,r.Interface=8,r.Module=9,r.Property=10,r.Unit=11,r.Value=12,r.Enum=13,r.Keyword=14,r.Snippet=15,r.Color=16,r.File=17,r.Reference=18,r.Folder=19,r.EnumMember=20,r.Constant=21,r.Struct=22,r.Event=23,r.Operator=24,r.TypeParameter=25})(Ar||(Ar={}));var Mt;(function(r){r.PlainText=1,r.Snippet=2})(Mt||(Mt={}));var my;(function(r){r.Deprecated=1})(my||(my={}));var vy;(function(r){function e(n,i,s){return{newText:n,insert:i,replace:s}}r.create=e;function t(n){var i=n;return i&&J.string(i.newText)&&Ue.is(i.insert)&&Ue.is(i.replace)}r.is=t})(vy||(vy={}));var yy;(function(r){r.asIs=1,r.adjustIndentation=2})(yy||(yy={}));var by;(function(r){function e(t){var n=t;return n&&(J.string(n.detail)||n.detail===void 0)&&(J.string(n.description)||n.description===void 0)}r.is=e})(by||(by={}));var Mf;(function(r){function e(t){return{label:t}}r.create=e})(Mf||(Mf={}));var xy;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(xy||(xy={}));var Fl;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}r.fromPlainText=e;function t(n){var i=n;return J.string(i)||J.objectLiteral(i)&&J.string(i.language)&&J.string(i.value)}r.is=t})(Fl||(Fl={}));var wy;(function(r){function e(t){var n=t;return!!n&&J.objectLiteral(n)&&(Bo.is(n.contents)||Fl.is(n.contents)||J.typedArray(n.contents,Fl.is))&&(t.range===void 0||Ue.is(t.range))}r.is=e})(wy||(wy={}));var Sy;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(Sy||(Sy={}));var ky;(function(r){function e(t,n){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var o={label:t};return J.defined(n)&&(o.documentation=n),J.defined(i)?o.parameters=i:o.parameters=[],o}r.create=e})(ky||(ky={}));var Ay;(function(r){r.Text=1,r.Read=2,r.Write=3})(Ay||(Ay={}));var Cy;(function(r){function e(t,n){var i={range:t};return J.number(n)&&(i.kind=n),i}r.create=e})(Cy||(Cy={}));var mn;(function(r){r.File=1,r.Module=2,r.Namespace=3,r.Package=4,r.Class=5,r.Method=6,r.Property=7,r.Field=8,r.Constructor=9,r.Enum=10,r.Interface=11,r.Function=12,r.Variable=13,r.Constant=14,r.String=15,r.Number=16,r.Boolean=17,r.Array=18,r.Object=19,r.Key=20,r.Null=21,r.EnumMember=22,r.Struct=23,r.Event=24,r.Operator=25,r.TypeParameter=26})(mn||(mn={}));var Oy;(function(r){r.Deprecated=1})(Oy||(Oy={}));var Ey;(function(r){function e(t,n,i,s,o){var a={name:t,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}r.create=e})(Ey||(Ey={}));var Ty;(function(r){function e(t,n,i,s){return s!==void 0?{name:t,kind:n,location:{uri:i,range:s}}:{name:t,kind:n,location:{uri:i}}}r.create=e})(Ty||(Ty={}));var Py;(function(r){function e(n,i,s,o,a,l){var c={name:n,detail:i,kind:s,range:o,selectionRange:a};return l!==void 0&&(c.children=l),c}r.create=e;function t(n){var i=n;return i&&J.string(i.name)&&J.number(i.kind)&&Ue.is(i.range)&&Ue.is(i.selectionRange)&&(i.detail===void 0||J.string(i.detail))&&(i.deprecated===void 0||J.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}r.is=t})(Py||(Py={}));var My;(function(r){r.Empty="",r.QuickFix="quickfix",r.Refactor="refactor",r.RefactorExtract="refactor.extract",r.RefactorInline="refactor.inline",r.RefactorRewrite="refactor.rewrite",r.Source="source",r.SourceOrganizeImports="source.organizeImports",r.SourceFixAll="source.fixAll"})(My||(My={}));var jl;(function(r){r.Invoked=1,r.Automatic=2})(jl||(jl={}));var Iy;(function(r){function e(n,i,s){var o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}r.create=e;function t(n){var i=n;return J.defined(i)&&J.typedArray(i.diagnostics,Pn.is)&&(i.only===void 0||J.typedArray(i.only,J.string))&&(i.triggerKind===void 0||i.triggerKind===jl.Invoked||i.triggerKind===jl.Automatic)}r.is=t})(Iy||(Iy={}));var Dy;(function(r){function e(n,i,s){var o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):ws.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return i&&J.string(i.title)&&(i.diagnostics===void 0||J.typedArray(i.diagnostics,Pn.is))&&(i.kind===void 0||J.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ws.is(i.command))&&(i.isPreferred===void 0||J.boolean(i.isPreferred))&&(i.edit===void 0||Pf.is(i.edit))}r.is=t})(Dy||(Dy={}));var Ny;(function(r){function e(n,i){var s={range:n};return J.defined(i)&&(s.data=i),s}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(i.range)&&(J.undefined(i.command)||ws.is(i.command))}r.is=t})(Ny||(Ny={}));var Ry;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.uinteger(i.tabSize)&&J.boolean(i.insertSpaces)}r.is=t})(Ry||(Ry={}));var Ly;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(i.range)&&(J.undefined(i.target)||J.string(i.target))}r.is=t})(Ly||(Ly={}));var Vl;(function(r){function e(n,i){return{range:n,parent:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&(i.parent===void 0||r.is(i.parent))}r.is=t})(Vl||(Vl={}));var By;(function(r){r.namespace="namespace",r.type="type",r.class="class",r.enum="enum",r.interface="interface",r.struct="struct",r.typeParameter="typeParameter",r.parameter="parameter",r.variable="variable",r.property="property",r.enumMember="enumMember",r.event="event",r.function="function",r.method="method",r.macro="macro",r.keyword="keyword",r.modifier="modifier",r.comment="comment",r.string="string",r.number="number",r.regexp="regexp",r.operator="operator",r.decorator="decorator"})(By||(By={}));var Fy;(function(r){r.declaration="declaration",r.definition="definition",r.readonly="readonly",r.static="static",r.deprecated="deprecated",r.abstract="abstract",r.async="async",r.modification="modification",r.documentation="documentation",r.defaultLibrary="defaultLibrary"})(Fy||(Fy={}));var jy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}r.is=e})(jy||(jy={}));var Vy;(function(r){function e(n,i){return{range:n,text:i}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&J.string(i.text)}r.is=t})(Vy||(Vy={}));var Wy;(function(r){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&J.boolean(i.caseSensitiveLookup)&&(J.string(i.variableName)||i.variableName===void 0)}r.is=t})(Wy||(Wy={}));var $y;(function(r){function e(n,i){return{range:n,expression:i}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&(J.string(i.expression)||i.expression===void 0)}r.is=t})($y||($y={}));var Hy;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(n.stoppedLocation)}r.is=t})(Hy||(Hy={}));var If;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})(If||(If={}));var Df;(function(r){function e(n){return{value:n}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&(i.tooltip===void 0||J.string(i.tooltip)||Bo.is(i.tooltip))&&(i.location===void 0||xs.is(i.location))&&(i.command===void 0||ws.is(i.command))}r.is=t})(Df||(Df={}));var zy;(function(r){function e(n,i,s){var o={position:n,label:i};return s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Br.is(i.position)&&(J.string(i.label)||J.typedArray(i.label,Df.is))&&(i.kind===void 0||If.is(i.kind))&&i.textEdits===void 0||J.typedArray(i.textEdits,Fr.is)&&(i.tooltip===void 0||J.string(i.tooltip)||Bo.is(i.tooltip))&&(i.paddingLeft===void 0||J.boolean(i.paddingLeft))&&(i.paddingRight===void 0||J.boolean(i.paddingRight))}r.is=t})(zy||(zy={}));var Uy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&Of.is(n.uri)&&J.string(n.name)}r.is=e})(Uy||(Uy={}));var P3=null,Gy;(function(r){function e(s,o,a,l){return new pP(s,o,a,l)}r.create=e;function t(s){var o=s;return!!(J.defined(o)&&J.string(o.uri)&&(J.undefined(o.languageId)||J.string(o.languageId))&&J.uinteger(o.lineCount)&&J.func(o.getText)&&J.func(o.positionAt)&&J.func(o.offsetAt))}r.is=t;function n(s,o){for(var a=s.getText(),l=i(o,function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),c=a.length,u=l.length-1;u>=0;u--){var h=l[u],d=s.offsetAt(h.range.start),p=s.offsetAt(h.range.end);if(p<=c)a=a.substring(0,d)+h.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}r.applyEdits=n;function i(s,o){if(s.length<=1)return s;var a=s.length/2|0,l=s.slice(0,a),c=s.slice(a);i(l,o),i(c,o);for(var u=0,h=0,d=0;u<l.length&&h<c.length;){var p=o(l[u],c[h]);p<=0?s[d++]=l[u++]:s[d++]=c[h++]}for(;u<l.length;)s[d++]=l[u++];for(;h<c.length;)s[d++]=c[h++];return s}})(Gy||(Gy={}));var pP=function(){function r(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},r.prototype.update=function(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0},r.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],t=this._content,n=!0,i=0;i<t.length;i++){n&&(e.push(i),n=!1);var s=t.charAt(i);n=s==="\r"||s===`
|
|
211
|
+
`.indexOf(r.charAt(e))!==-1}var Mo;(function(r){r.DEFAULT={allowTrailingComma:!1}})(Mo||(Mo={}));function rP(r,e){var t=[],n=new Object,i=void 0,s={value:{},offset:0,length:0,type:"object",parent:void 0},o=!1;function a(l,c,u,h){s.value=l,s.offset=c,s.length=u,s.type=h,s.colonOffset=void 0,i=s}try{Dl(r,{onObjectBegin:function(l,c){if(e<=l)throw n;i=void 0,o=e>l,t.push("")},onObjectProperty:function(l,c,u){if(e<c||(a(l,c,u,"property"),t[t.length-1]=l,e<=c+u))throw n},onObjectEnd:function(l,c){if(e<=l)throw n;i=void 0,t.pop()},onArrayBegin:function(l,c){if(e<=l)throw n;i=void 0,t.push(0)},onArrayEnd:function(l,c){if(e<=l)throw n;i=void 0,t.pop()},onLiteralValue:function(l,c,u){if(e<c||(a(l,c,u,ry(l)),e<=c+u))throw n},onSeparator:function(l,c,u){if(e<=c)throw n;if(l===":"&&i&&i.type==="property")i.colonOffset=c,o=!1,i=void 0;else if(l===","){var h=t[t.length-1];typeof h=="number"?t[t.length-1]=h+1:(o=!0,t[t.length-1]=""),i=void 0}}})}catch(l){if(l!==n)throw l}return{path:t,previousNode:i,isAtPropertyKey:o,matches:function(l){for(var c=0,u=0;c<l.length&&u<t.length;u++)if(l[c]===t[u]||l[c]==="*")c++;else if(l[c]!=="**")return!1;return c===l.length}}}function nP(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=Mo.DEFAULT);var n=null,i=[],s=[];function o(l){Array.isArray(i)?i.push(l):n!==null&&(i[n]=l)}var a={onObjectBegin:function(){var l={};o(l),s.push(i),i=l,n=null},onObjectProperty:function(l){n=l},onObjectEnd:function(){i=s.pop()},onArrayBegin:function(){var l=[];o(l),s.push(i),i=l,n=null},onArrayEnd:function(){i=s.pop()},onLiteralValue:o,onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};return Dl(r,a,t),i[0]}function iP(r,e,t){e===void 0&&(e=[]),t===void 0&&(t=Mo.DEFAULT);var n={type:"array",offset:-1,length:-1,children:[],parent:void 0};function i(l){n.type==="property"&&(n.length=l-n.offset,n=n.parent)}function s(l){return n.children.push(l),l}var o={onObjectBegin:function(l){n=s({type:"object",offset:l,length:-1,parent:n,children:[]})},onObjectProperty:function(l,c,u){n=s({type:"property",offset:c,length:-1,parent:n,children:[]}),n.children.push({type:"string",value:l,offset:c,length:u,parent:n})},onObjectEnd:function(l,c){i(l+c),n.length=l+c-n.offset,n=n.parent,i(l+c)},onArrayBegin:function(l,c){n=s({type:"array",offset:l,length:-1,parent:n,children:[]})},onArrayEnd:function(l,c){n.length=l+c-n.offset,n=n.parent,i(l+c)},onLiteralValue:function(l,c,u){s({type:ry(l),offset:c,length:u,parent:n,value:l}),i(c+u)},onSeparator:function(l,c,u){n.type==="property"&&(l===":"?n.colonOffset=c:l===","&&i(c))},onError:function(l,c,u){e.push({error:l,offset:c,length:u})}};Dl(r,o,t);var a=n.children[0];return a&&delete a.parent,a}function sP(r,e){if(r){for(var t=r,n=0,i=e;n<i.length;n++){var s=i[n];if(typeof s=="string"){if(t.type!=="object"||!Array.isArray(t.children))return;for(var o=!1,a=0,l=t.children;a<l.length;a++){var c=l[a];if(Array.isArray(c.children)&&c.children[0].value===s){t=c.children[1],o=!0;break}}if(!o)return}else{var u=s;if(t.type!=="array"||u<0||!Array.isArray(t.children)||u>=t.children.length)return;t=t.children[u]}}return t}}function ey(r){if(!r.parent||!r.parent.children)return[];var e=ey(r.parent);if(r.parent.type==="property"){var t=r.parent.children[0].value;e.push(t)}else if(r.parent.type==="array"){var n=r.parent.children.indexOf(r);n!==-1&&e.push(n)}return e}function Cf(r){switch(r.type){case"array":return r.children.map(Cf);case"object":for(var e=Object.create(null),t=0,n=r.children;t<n.length;t++){var i=n[t],s=i.children[1];s&&(e[i.children[0].value]=Cf(s))}return e;case"null":case"string":case"number":case"boolean":return r.value;default:return}}function oP(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}function ty(r,e,t){if(t===void 0&&(t=!1),oP(r,e,t)){var n=r.children;if(Array.isArray(n))for(var i=0;i<n.length&&n[i].offset<=e;i++){var s=ty(n[i],e,t);if(s)return s}return r}}function Dl(r,e,t){t===void 0&&(t=Mo.DEFAULT);var n=Il(r,!1);function i(F){return F?function(){return F(n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}function s(F){return F?function(H){return F(H,n.getTokenOffset(),n.getTokenLength(),n.getTokenStartLine(),n.getTokenStartCharacter())}:function(){return!0}}var o=i(e.onObjectBegin),a=s(e.onObjectProperty),l=i(e.onObjectEnd),c=i(e.onArrayBegin),u=i(e.onArrayEnd),h=s(e.onLiteralValue),d=s(e.onSeparator),p=i(e.onComment),m=s(e.onError),y=t&&t.disallowComments,w=t&&t.allowTrailingComma;function A(){for(;;){var F=n.scan();switch(n.getTokenError()){case 4:T(14);break;case 5:T(15);break;case 3:T(13);break;case 1:y||T(11);break;case 2:T(12);break;case 6:T(16);break}switch(F){case 12:case 13:y?T(10):p();break;case 16:T(1);break;case 15:case 14:break;default:return F}}}function T(F,H,Q){if(H===void 0&&(H=[]),Q===void 0&&(Q=[]),m(F),H.length+Q.length>0)for(var oe=n.getToken();oe!==17;){if(H.indexOf(oe)!==-1){A();break}else if(Q.indexOf(oe)!==-1)break;oe=A()}}function P(F){var H=n.getTokenValue();return F?h(H):a(H),A(),!0}function L(){switch(n.getToken()){case 11:var F=n.getTokenValue(),H=Number(F);isNaN(H)&&(T(2),H=0),h(H);break;case 7:h(null);break;case 8:h(!0);break;case 9:h(!1);break;default:return!1}return A(),!0}function D(){return n.getToken()!==10?(T(3,[],[2,5]),!1):(P(!1),n.getToken()===6?(d(":"),A(),q()||T(4,[],[2,5])):T(5,[],[2,5]),!0)}function j(){o(),A();for(var F=!1;n.getToken()!==2&&n.getToken()!==17;){if(n.getToken()===5){if(F||T(4,[],[]),d(","),A(),n.getToken()===2&&w)break}else F&&T(6,[],[]);D()||T(4,[],[2,5]),F=!0}return l(),n.getToken()!==2?T(7,[2],[]):A(),!0}function W(){c(),A();for(var F=!1;n.getToken()!==4&&n.getToken()!==17;){if(n.getToken()===5){if(F||T(4,[],[]),d(","),A(),n.getToken()===4&&w)break}else F&&T(6,[],[]);q()||T(4,[],[4,5]),F=!0}return u(),n.getToken()!==4?T(8,[4],[]):A(),!0}function q(){switch(n.getToken()){case 3:return W();case 1:return j();case 10:return P(!0);default:return L()}}return A(),n.getToken()===17?t.allowEmptyContent?!0:(T(4,[],[]),!1):q()?(n.getToken()!==17&&T(9,[],[]),!0):(T(4,[],[]),!1)}function aP(r,e){var t=Il(r),n=[],i,s=0,o;do switch(o=t.getPosition(),i=t.scan(),i){case 12:case 13:case 17:s!==o&&n.push(r.substring(s,o)),e!==void 0&&n.push(t.getTokenValue().replace(/[^\r\n]/g,e)),s=t.getPosition();break}while(i!==17);return n.join("")}function ry(r){switch(typeof r){case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"object":{if(r){if(Array.isArray(r))return"array"}else return"null";return"object"}default:return"null"}}function b3(r,e,t){return lP(r,e,void 0,t)}function lP(r,e,t,n){for(var i,s=e.slice(),o=[],a=parseTree(r,o),l=void 0,c=void 0;s.length>0&&(c=s.pop(),l=findNodeAtLocation(a,s),l===void 0&&t!==void 0);)typeof c=="string"?t=(i={},i[c]=t,i):t=[t];if(l)if(l.type==="object"&&typeof c=="string"&&Array.isArray(l.children)){var u=findNodeAtLocation(l,[c]);if(u!==void 0)if(t===void 0){if(!u.parent)throw new Error("Malformed AST");var h=l.children.indexOf(u.parent),d=void 0,p=u.parent.offset+u.parent.length;if(h>0){var m=l.children[h-1];d=m.offset+m.length}else if(d=l.offset+1,l.children.length>1){var y=l.children[1];p=y.offset}return Mi(r,{offset:d,length:p-d,content:""},n)}else return Mi(r,{offset:u.offset,length:u.length,content:JSON.stringify(t)},n);else{if(t===void 0)return[];var w=JSON.stringify(c)+": "+JSON.stringify(t),A=n.getInsertionIndex?n.getInsertionIndex(l.children.map(function(F){return F.children[0].value})):l.children.length,T=void 0;if(A>0){var m=l.children[A-1];T={offset:m.offset+m.length,length:0,content:","+w}}else l.children.length===0?T={offset:l.offset+1,length:0,content:w}:T={offset:l.offset+1,length:0,content:w+","};return Mi(r,T,n)}}else if(l.type==="array"&&typeof c=="number"&&Array.isArray(l.children)){var P=c;if(P===-1){var w=""+JSON.stringify(t),T=void 0;if(l.children.length===0)T={offset:l.offset+1,length:0,content:w};else{var m=l.children[l.children.length-1];T={offset:m.offset+m.length,length:0,content:","+w}}return Mi(r,T,n)}else if(t===void 0&&l.children.length>=0){var L=c,D=l.children[L],T=void 0;if(l.children.length===1)T={offset:l.offset+1,length:l.length-2,content:""};else if(l.children.length-1===L){var m=l.children[L-1],j=m.offset+m.length,W=l.offset+l.length;T={offset:j,length:W-2-j,content:""}}else T={offset:D.offset,length:l.children[L+1].offset-D.offset,content:""};return Mi(r,T,n)}else if(t!==void 0){var T=void 0,w=""+JSON.stringify(t);if(!n.isArrayInsertion&&l.children.length>c){var q=l.children[c];T={offset:q.offset,length:q.length,content:w}}else if(l.children.length===0||c===0)T={offset:l.offset+1,length:0,content:l.children.length===0?w:w+","};else{var A=c>l.children.length?l.children.length:c,m=l.children[A-1];T={offset:m.offset+m.length,length:0,content:","+w}}return Mi(r,T,n)}else throw new Error("Can not "+(t===void 0?"remove":n.isArrayInsertion?"insert":"modify")+" Array index "+P+" as length is not sufficient")}else throw new Error("Can not add "+(typeof c!="number"?"index":"property")+" to parent of type "+l.type);else{if(t===void 0)throw new Error("Can not delete in empty document");return Mi(r,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(t)},n)}}function Mi(r,e,t){if(!t.formattingOptions)return[e];var n=ny(r,e),i=e.offset,s=e.offset+e.content.length;if(e.length===0||e.content.length===0){for(;i>0&&!isEOL(n,i-1);)i--;for(;s<n.length&&!isEOL(n,s);)s++}for(var o=format(n,{offset:i,length:s-i},t.formattingOptions),a=o.length-1;a>=0;a--){var l=o[a];n=ny(n,l),i=Math.min(i,l.offset),s=Math.max(s,l.offset+l.length),s+=l.content.length-l.length}var c=r.length-(n.length-s)-i;return[{offset:i,length:c,content:n.substring(i,s)}]}function ny(r,e){return r.substring(0,e.offset)+e.content+r.substring(e.offset+e.length)}function x3(r,e){return`\r
|
|
212
|
+
`.indexOf(r.charAt(e))!==-1}var bs=Il,w3=rP,cP=nP,S3=iP,k3=sP,uP=ty,fP=ey,hP=Cf,A3=Dl,C3=aP;function O3(r){switch(r){case 1:return"InvalidSymbol";case 2:return"InvalidNumberFormat";case 3:return"PropertyNameExpected";case 4:return"ValueExpected";case 5:return"ColonExpected";case 6:return"CommaExpected";case 7:return"CloseBraceExpected";case 8:return"CloseBracketExpected";case 9:return"EndOfFileExpected";case 10:return"InvalidCommentToken";case 11:return"UnexpectedEndOfComment";case 12:return"UnexpectedEndOfString";case 13:return"UnexpectedEndOfNumber";case 14:return"InvalidUnicode";case 15:return"InvalidEscapeCharacter";case 16:return"InvalidCharacter"}return"<unknown ParseErrorCode>"}function dP(r,e,t){return qT(r,e,t)}function E3(r,e,t,n){return edit.setProperty(r,e,t,n)}function T3(r,e){for(var t=e.length-1;t>=0;t--)r=edit.applyEdit(r,e[t]);return r}function Io(r,e){if(r===e)return!0;if(r==null||e===null||e===void 0||typeof r!=typeof e||typeof r!="object"||Array.isArray(r)!==Array.isArray(e))return!1;var t,n;if(Array.isArray(r)){if(r.length!==e.length)return!1;for(t=0;t<r.length;t++)if(!Io(r[t],e[t]))return!1}else{var i=[];for(n in r)i.push(n);i.sort();var s=[];for(n in e)s.push(n);if(s.sort(),!Io(i,s))return!1;for(t=0;t<i.length;t++)if(!Io(r[i[t]],e[i[t]]))return!1}return!0}function kr(r){return typeof r=="number"}function Tn(r){return typeof r<"u"}function gn(r){return typeof r=="boolean"}function pP(r){return typeof r=="string"}var iy;(function(r){function e(t){return typeof t=="string"}r.is=e})(iy||(iy={}));var Of;(function(r){function e(t){return typeof t=="string"}r.is=e})(Of||(Of={}));var sy;(function(r){r.MIN_VALUE=-2147483648,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(sy||(sy={}));var Nl;(function(r){r.MIN_VALUE=0,r.MAX_VALUE=2147483647;function e(t){return typeof t=="number"&&r.MIN_VALUE<=t&&t<=r.MAX_VALUE}r.is=e})(Nl||(Nl={}));var Br;(function(r){function e(n,i){return n===Number.MAX_VALUE&&(n=Nl.MAX_VALUE),i===Number.MAX_VALUE&&(i=Nl.MAX_VALUE),{line:n,character:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.uinteger(i.line)&&J.uinteger(i.character)}r.is=t})(Br||(Br={}));var Ue;(function(r){function e(n,i,s,o){if(J.uinteger(n)&&J.uinteger(i)&&J.uinteger(s)&&J.uinteger(o))return{start:Br.create(n,i),end:Br.create(s,o)};if(Br.is(n)&&Br.is(i))return{start:n,end:i};throw new Error("Range#create called with invalid arguments[".concat(n,", ").concat(i,", ").concat(s,", ").concat(o,"]"))}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Br.is(i.start)&&Br.is(i.end)}r.is=t})(Ue||(Ue={}));var xs;(function(r){function e(n,i){return{uri:n,range:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&(J.string(i.uri)||J.undefined(i.uri))}r.is=t})(xs||(xs={}));var oy;(function(r){function e(n,i,s,o){return{targetUri:n,targetRange:i,targetSelectionRange:s,originSelectionRange:o}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.targetRange)&&J.string(i.targetUri)&&Ue.is(i.targetSelectionRange)&&(Ue.is(i.originSelectionRange)||J.undefined(i.originSelectionRange))}r.is=t})(oy||(oy={}));var Ef;(function(r){function e(n,i,s,o){return{red:n,green:i,blue:s,alpha:o}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.numberRange(i.red,0,1)&&J.numberRange(i.green,0,1)&&J.numberRange(i.blue,0,1)&&J.numberRange(i.alpha,0,1)}r.is=t})(Ef||(Ef={}));var ay;(function(r){function e(n,i){return{range:n,color:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&Ef.is(i.color)}r.is=t})(ay||(ay={}));var ly;(function(r){function e(n,i,s){return{label:n,textEdit:i,additionalTextEdits:s}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.string(i.label)&&(J.undefined(i.textEdit)||Fr.is(i))&&(J.undefined(i.additionalTextEdits)||J.typedArray(i.additionalTextEdits,Fr.is))}r.is=t})(ly||(ly={}));var Do;(function(r){r.Comment="comment",r.Imports="imports",r.Region="region"})(Do||(Do={}));var cy;(function(r){function e(n,i,s,o,a,l){var c={startLine:n,endLine:i};return J.defined(s)&&(c.startCharacter=s),J.defined(o)&&(c.endCharacter=o),J.defined(a)&&(c.kind=a),J.defined(l)&&(c.collapsedText=l),c}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.uinteger(i.startLine)&&J.uinteger(i.startLine)&&(J.undefined(i.startCharacter)||J.uinteger(i.startCharacter))&&(J.undefined(i.endCharacter)||J.uinteger(i.endCharacter))&&(J.undefined(i.kind)||J.string(i.kind))}r.is=t})(cy||(cy={}));var Tf;(function(r){function e(n,i){return{location:n,message:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&xs.is(i.location)&&J.string(i.message)}r.is=t})(Tf||(Tf={}));var Ie;(function(r){r.Error=1,r.Warning=2,r.Information=3,r.Hint=4})(Ie||(Ie={}));var uy;(function(r){r.Unnecessary=1,r.Deprecated=2})(uy||(uy={}));var fy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&J.string(n.href)}r.is=e})(fy||(fy={}));var Pn;(function(r){function e(n,i,s,o,a,l){var c={range:n,message:i};return J.defined(s)&&(c.severity=s),J.defined(o)&&(c.code=o),J.defined(a)&&(c.source=a),J.defined(l)&&(c.relatedInformation=l),c}r.create=e;function t(n){var i,s=n;return J.defined(s)&&Ue.is(s.range)&&J.string(s.message)&&(J.number(s.severity)||J.undefined(s.severity))&&(J.integer(s.code)||J.string(s.code)||J.undefined(s.code))&&(J.undefined(s.codeDescription)||J.string((i=s.codeDescription)===null||i===void 0?void 0:i.href))&&(J.string(s.source)||J.undefined(s.source))&&(J.undefined(s.relatedInformation)||J.typedArray(s.relatedInformation,Tf.is))}r.is=t})(Pn||(Pn={}));var ws;(function(r){function e(n,i){for(var s=[],o=2;o<arguments.length;o++)s[o-2]=arguments[o];var a={title:n,command:i};return J.defined(s)&&s.length>0&&(a.arguments=s),a}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.title)&&J.string(i.command)}r.is=t})(ws||(ws={}));var Fr;(function(r){function e(s,o){return{range:s,newText:o}}r.replace=e;function t(s,o){return{range:{start:s,end:s},newText:o}}r.insert=t;function n(s){return{range:s,newText:""}}r.del=n;function i(s){var o=s;return J.objectLiteral(o)&&J.string(o.newText)&&Ue.is(o.range)}r.is=i})(Fr||(Fr={}));var Ss;(function(r){function e(n,i,s){var o={label:n};return i!==void 0&&(o.needsConfirmation=i),s!==void 0&&(o.description=s),o}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&J.string(i.label)&&(J.boolean(i.needsConfirmation)||i.needsConfirmation===void 0)&&(J.string(i.description)||i.description===void 0)}r.is=t})(Ss||(Ss={}));var Zt;(function(r){function e(t){var n=t;return J.string(n)}r.is=e})(Zt||(Zt={}));var ri;(function(r){function e(s,o,a){return{range:s,newText:o,annotationId:a}}r.replace=e;function t(s,o,a){return{range:{start:s,end:s},newText:o,annotationId:a}}r.insert=t;function n(s,o){return{range:s,newText:"",annotationId:o}}r.del=n;function i(s){var o=s;return Fr.is(o)&&(Ss.is(o.annotationId)||Zt.is(o.annotationId))}r.is=i})(ri||(ri={}));var Rl;(function(r){function e(n,i){return{textDocument:n,edits:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&Bl.is(i.textDocument)&&Array.isArray(i.edits)}r.is=t})(Rl||(Rl={}));var No;(function(r){function e(n,i,s){var o={kind:"create",uri:n};return i!==void 0&&(i.overwrite!==void 0||i.ignoreIfExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}r.create=e;function t(n){var i=n;return i&&i.kind==="create"&&J.string(i.uri)&&(i.options===void 0||(i.options.overwrite===void 0||J.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||J.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(No||(No={}));var Ro;(function(r){function e(n,i,s,o){var a={kind:"rename",oldUri:n,newUri:i};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(a.options=s),o!==void 0&&(a.annotationId=o),a}r.create=e;function t(n){var i=n;return i&&i.kind==="rename"&&J.string(i.oldUri)&&J.string(i.newUri)&&(i.options===void 0||(i.options.overwrite===void 0||J.boolean(i.options.overwrite))&&(i.options.ignoreIfExists===void 0||J.boolean(i.options.ignoreIfExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(Ro||(Ro={}));var Lo;(function(r){function e(n,i,s){var o={kind:"delete",uri:n};return i!==void 0&&(i.recursive!==void 0||i.ignoreIfNotExists!==void 0)&&(o.options=i),s!==void 0&&(o.annotationId=s),o}r.create=e;function t(n){var i=n;return i&&i.kind==="delete"&&J.string(i.uri)&&(i.options===void 0||(i.options.recursive===void 0||J.boolean(i.options.recursive))&&(i.options.ignoreIfNotExists===void 0||J.boolean(i.options.ignoreIfNotExists)))&&(i.annotationId===void 0||Zt.is(i.annotationId))}r.is=t})(Lo||(Lo={}));var Pf;(function(r){function e(t){var n=t;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(function(i){return J.string(i.kind)?No.is(i)||Ro.is(i)||Lo.is(i):Rl.is(i)}))}r.is=e})(Pf||(Pf={}));var Ll=function(){function r(e,t){this.edits=e,this.changeAnnotations=t}return r.prototype.insert=function(e,t,n){var i,s;if(n===void 0?i=Fr.insert(e,t):Zt.is(n)?(s=n,i=ri.insert(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ri.insert(e,t,s)),this.edits.push(i),s!==void 0)return s},r.prototype.replace=function(e,t,n){var i,s;if(n===void 0?i=Fr.replace(e,t):Zt.is(n)?(s=n,i=ri.replace(e,t,n)):(this.assertChangeAnnotations(this.changeAnnotations),s=this.changeAnnotations.manage(n),i=ri.replace(e,t,s)),this.edits.push(i),s!==void 0)return s},r.prototype.delete=function(e,t){var n,i;if(t===void 0?n=Fr.del(e):Zt.is(t)?(i=t,n=ri.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(t),n=ri.del(e,i)),this.edits.push(n),i!==void 0)return i},r.prototype.add=function(e){this.edits.push(e)},r.prototype.all=function(){return this.edits},r.prototype.clear=function(){this.edits.splice(0,this.edits.length)},r.prototype.assertChangeAnnotations=function(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},r}(),hy=function(){function r(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}return r.prototype.all=function(){return this._annotations},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),r.prototype.manage=function(e,t){var n;if(Zt.is(e)?n=e:(n=this.nextId(),t=e),this._annotations[n]!==void 0)throw new Error("Id ".concat(n," is already in use."));if(t===void 0)throw new Error("No annotation provided for id ".concat(n));return this._annotations[n]=t,this._size++,n},r.prototype.nextId=function(){return this._counter++,this._counter.toString()},r}(),P3=function(){function r(e){var t=this;this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new hy(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(function(n){if(Rl.is(n)){var i=new Ll(n.edits,t._changeAnnotations);t._textEditChanges[n.textDocument.uri]=i}})):e.changes&&Object.keys(e.changes).forEach(function(n){var i=new Ll(e.changes[n]);t._textEditChanges[n]=i})):this._workspaceEdit={}}return Object.defineProperty(r.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),r.prototype.getTextEditChange=function(e){if(Bl.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var t={uri:e.uri,version:e.version},n=this._textEditChanges[t.uri];if(!n){var i=[],s={textDocument:t,edits:i};this._workspaceEdit.documentChanges.push(s),n=new Ll(i,this._changeAnnotations),this._textEditChanges[t.uri]=n}return n}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var n=this._textEditChanges[e];if(!n){var i=[];this._workspaceEdit.changes[e]=i,n=new Ll(i),this._textEditChanges[e]=n}return n}},r.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new hy,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},r.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},r.prototype.createFile=function(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;Ss.is(t)||Zt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=No.create(e,n):(o=Zt.is(i)?i:this._changeAnnotations.manage(i),s=No.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r.prototype.renameFile=function(e,t,n,i){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var s;Ss.is(n)||Zt.is(n)?s=n:i=n;var o,a;if(s===void 0?o=Ro.create(e,t,i):(a=Zt.is(s)?s:this._changeAnnotations.manage(s),o=Ro.create(e,t,i,a)),this._workspaceEdit.documentChanges.push(o),a!==void 0)return a},r.prototype.deleteFile=function(e,t,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var i;Ss.is(t)||Zt.is(t)?i=t:n=t;var s,o;if(i===void 0?s=Lo.create(e,n):(o=Zt.is(i)?i:this._changeAnnotations.manage(i),s=Lo.create(e,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o},r}(),dy;(function(r){function e(n){return{uri:n}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)}r.is=t})(dy||(dy={}));var py;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&J.integer(i.version)}r.is=t})(py||(py={}));var Bl;(function(r){function e(n,i){return{uri:n,version:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&(i.version===null||J.integer(i.version))}r.is=t})(Bl||(Bl={}));var gy;(function(r){function e(n,i,s,o){return{uri:n,languageId:i,version:s,text:o}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.string(i.uri)&&J.string(i.languageId)&&J.integer(i.version)&&J.string(i.text)}r.is=t})(gy||(gy={}));var Ii;(function(r){r.PlainText="plaintext",r.Markdown="markdown";function e(t){var n=t;return n===r.PlainText||n===r.Markdown}r.is=e})(Ii||(Ii={}));var Bo;(function(r){function e(t){var n=t;return J.objectLiteral(t)&&Ii.is(n.kind)&&J.string(n.value)}r.is=e})(Bo||(Bo={}));var Ar;(function(r){r.Text=1,r.Method=2,r.Function=3,r.Constructor=4,r.Field=5,r.Variable=6,r.Class=7,r.Interface=8,r.Module=9,r.Property=10,r.Unit=11,r.Value=12,r.Enum=13,r.Keyword=14,r.Snippet=15,r.Color=16,r.File=17,r.Reference=18,r.Folder=19,r.EnumMember=20,r.Constant=21,r.Struct=22,r.Event=23,r.Operator=24,r.TypeParameter=25})(Ar||(Ar={}));var Mt;(function(r){r.PlainText=1,r.Snippet=2})(Mt||(Mt={}));var my;(function(r){r.Deprecated=1})(my||(my={}));var vy;(function(r){function e(n,i,s){return{newText:n,insert:i,replace:s}}r.create=e;function t(n){var i=n;return i&&J.string(i.newText)&&Ue.is(i.insert)&&Ue.is(i.replace)}r.is=t})(vy||(vy={}));var yy;(function(r){r.asIs=1,r.adjustIndentation=2})(yy||(yy={}));var by;(function(r){function e(t){var n=t;return n&&(J.string(n.detail)||n.detail===void 0)&&(J.string(n.description)||n.description===void 0)}r.is=e})(by||(by={}));var Mf;(function(r){function e(t){return{label:t}}r.create=e})(Mf||(Mf={}));var xy;(function(r){function e(t,n){return{items:t||[],isIncomplete:!!n}}r.create=e})(xy||(xy={}));var Fl;(function(r){function e(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}r.fromPlainText=e;function t(n){var i=n;return J.string(i)||J.objectLiteral(i)&&J.string(i.language)&&J.string(i.value)}r.is=t})(Fl||(Fl={}));var wy;(function(r){function e(t){var n=t;return!!n&&J.objectLiteral(n)&&(Bo.is(n.contents)||Fl.is(n.contents)||J.typedArray(n.contents,Fl.is))&&(t.range===void 0||Ue.is(t.range))}r.is=e})(wy||(wy={}));var Sy;(function(r){function e(t,n){return n?{label:t,documentation:n}:{label:t}}r.create=e})(Sy||(Sy={}));var ky;(function(r){function e(t,n){for(var i=[],s=2;s<arguments.length;s++)i[s-2]=arguments[s];var o={label:t};return J.defined(n)&&(o.documentation=n),J.defined(i)?o.parameters=i:o.parameters=[],o}r.create=e})(ky||(ky={}));var Ay;(function(r){r.Text=1,r.Read=2,r.Write=3})(Ay||(Ay={}));var Cy;(function(r){function e(t,n){var i={range:t};return J.number(n)&&(i.kind=n),i}r.create=e})(Cy||(Cy={}));var mn;(function(r){r.File=1,r.Module=2,r.Namespace=3,r.Package=4,r.Class=5,r.Method=6,r.Property=7,r.Field=8,r.Constructor=9,r.Enum=10,r.Interface=11,r.Function=12,r.Variable=13,r.Constant=14,r.String=15,r.Number=16,r.Boolean=17,r.Array=18,r.Object=19,r.Key=20,r.Null=21,r.EnumMember=22,r.Struct=23,r.Event=24,r.Operator=25,r.TypeParameter=26})(mn||(mn={}));var Oy;(function(r){r.Deprecated=1})(Oy||(Oy={}));var Ey;(function(r){function e(t,n,i,s,o){var a={name:t,kind:n,location:{uri:s,range:i}};return o&&(a.containerName=o),a}r.create=e})(Ey||(Ey={}));var Ty;(function(r){function e(t,n,i,s){return s!==void 0?{name:t,kind:n,location:{uri:i,range:s}}:{name:t,kind:n,location:{uri:i}}}r.create=e})(Ty||(Ty={}));var Py;(function(r){function e(n,i,s,o,a,l){var c={name:n,detail:i,kind:s,range:o,selectionRange:a};return l!==void 0&&(c.children=l),c}r.create=e;function t(n){var i=n;return i&&J.string(i.name)&&J.number(i.kind)&&Ue.is(i.range)&&Ue.is(i.selectionRange)&&(i.detail===void 0||J.string(i.detail))&&(i.deprecated===void 0||J.boolean(i.deprecated))&&(i.children===void 0||Array.isArray(i.children))&&(i.tags===void 0||Array.isArray(i.tags))}r.is=t})(Py||(Py={}));var My;(function(r){r.Empty="",r.QuickFix="quickfix",r.Refactor="refactor",r.RefactorExtract="refactor.extract",r.RefactorInline="refactor.inline",r.RefactorRewrite="refactor.rewrite",r.Source="source",r.SourceOrganizeImports="source.organizeImports",r.SourceFixAll="source.fixAll"})(My||(My={}));var jl;(function(r){r.Invoked=1,r.Automatic=2})(jl||(jl={}));var Iy;(function(r){function e(n,i,s){var o={diagnostics:n};return i!=null&&(o.only=i),s!=null&&(o.triggerKind=s),o}r.create=e;function t(n){var i=n;return J.defined(i)&&J.typedArray(i.diagnostics,Pn.is)&&(i.only===void 0||J.typedArray(i.only,J.string))&&(i.triggerKind===void 0||i.triggerKind===jl.Invoked||i.triggerKind===jl.Automatic)}r.is=t})(Iy||(Iy={}));var Dy;(function(r){function e(n,i,s){var o={title:n},a=!0;return typeof i=="string"?(a=!1,o.kind=i):ws.is(i)?o.command=i:o.edit=i,a&&s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return i&&J.string(i.title)&&(i.diagnostics===void 0||J.typedArray(i.diagnostics,Pn.is))&&(i.kind===void 0||J.string(i.kind))&&(i.edit!==void 0||i.command!==void 0)&&(i.command===void 0||ws.is(i.command))&&(i.isPreferred===void 0||J.boolean(i.isPreferred))&&(i.edit===void 0||Pf.is(i.edit))}r.is=t})(Dy||(Dy={}));var Ny;(function(r){function e(n,i){var s={range:n};return J.defined(i)&&(s.data=i),s}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(i.range)&&(J.undefined(i.command)||ws.is(i.command))}r.is=t})(Ny||(Ny={}));var Ry;(function(r){function e(n,i){return{tabSize:n,insertSpaces:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&J.uinteger(i.tabSize)&&J.boolean(i.insertSpaces)}r.is=t})(Ry||(Ry={}));var Ly;(function(r){function e(n,i,s){return{range:n,target:i,data:s}}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(i.range)&&(J.undefined(i.target)||J.string(i.target))}r.is=t})(Ly||(Ly={}));var Vl;(function(r){function e(n,i){return{range:n,parent:i}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Ue.is(i.range)&&(i.parent===void 0||r.is(i.parent))}r.is=t})(Vl||(Vl={}));var By;(function(r){r.namespace="namespace",r.type="type",r.class="class",r.enum="enum",r.interface="interface",r.struct="struct",r.typeParameter="typeParameter",r.parameter="parameter",r.variable="variable",r.property="property",r.enumMember="enumMember",r.event="event",r.function="function",r.method="method",r.macro="macro",r.keyword="keyword",r.modifier="modifier",r.comment="comment",r.string="string",r.number="number",r.regexp="regexp",r.operator="operator",r.decorator="decorator"})(By||(By={}));var Fy;(function(r){r.declaration="declaration",r.definition="definition",r.readonly="readonly",r.static="static",r.deprecated="deprecated",r.abstract="abstract",r.async="async",r.modification="modification",r.documentation="documentation",r.defaultLibrary="defaultLibrary"})(Fy||(Fy={}));var jy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}r.is=e})(jy||(jy={}));var Vy;(function(r){function e(n,i){return{range:n,text:i}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&J.string(i.text)}r.is=t})(Vy||(Vy={}));var Wy;(function(r){function e(n,i,s){return{range:n,variableName:i,caseSensitiveLookup:s}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&J.boolean(i.caseSensitiveLookup)&&(J.string(i.variableName)||i.variableName===void 0)}r.is=t})(Wy||(Wy={}));var $y;(function(r){function e(n,i){return{range:n,expression:i}}r.create=e;function t(n){var i=n;return i!=null&&Ue.is(i.range)&&(J.string(i.expression)||i.expression===void 0)}r.is=t})($y||($y={}));var Hy;(function(r){function e(n,i){return{frameId:n,stoppedLocation:i}}r.create=e;function t(n){var i=n;return J.defined(i)&&Ue.is(n.stoppedLocation)}r.is=t})(Hy||(Hy={}));var If;(function(r){r.Type=1,r.Parameter=2;function e(t){return t===1||t===2}r.is=e})(If||(If={}));var Df;(function(r){function e(n){return{value:n}}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&(i.tooltip===void 0||J.string(i.tooltip)||Bo.is(i.tooltip))&&(i.location===void 0||xs.is(i.location))&&(i.command===void 0||ws.is(i.command))}r.is=t})(Df||(Df={}));var zy;(function(r){function e(n,i,s){var o={position:n,label:i};return s!==void 0&&(o.kind=s),o}r.create=e;function t(n){var i=n;return J.objectLiteral(i)&&Br.is(i.position)&&(J.string(i.label)||J.typedArray(i.label,Df.is))&&(i.kind===void 0||If.is(i.kind))&&i.textEdits===void 0||J.typedArray(i.textEdits,Fr.is)&&(i.tooltip===void 0||J.string(i.tooltip)||Bo.is(i.tooltip))&&(i.paddingLeft===void 0||J.boolean(i.paddingLeft))&&(i.paddingRight===void 0||J.boolean(i.paddingRight))}r.is=t})(zy||(zy={}));var Uy;(function(r){function e(t){var n=t;return J.objectLiteral(n)&&Of.is(n.uri)&&J.string(n.name)}r.is=e})(Uy||(Uy={}));var M3=null,Gy;(function(r){function e(s,o,a,l){return new gP(s,o,a,l)}r.create=e;function t(s){var o=s;return!!(J.defined(o)&&J.string(o.uri)&&(J.undefined(o.languageId)||J.string(o.languageId))&&J.uinteger(o.lineCount)&&J.func(o.getText)&&J.func(o.positionAt)&&J.func(o.offsetAt))}r.is=t;function n(s,o){for(var a=s.getText(),l=i(o,function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),c=a.length,u=l.length-1;u>=0;u--){var h=l[u],d=s.offsetAt(h.range.start),p=s.offsetAt(h.range.end);if(p<=c)a=a.substring(0,d)+h.newText+a.substring(p,a.length);else throw new Error("Overlapping edit");c=d}return a}r.applyEdits=n;function i(s,o){if(s.length<=1)return s;var a=s.length/2|0,l=s.slice(0,a),c=s.slice(a);i(l,o),i(c,o);for(var u=0,h=0,d=0;u<l.length&&h<c.length;){var p=o(l[u],c[h]);p<=0?s[d++]=l[u++]:s[d++]=c[h++]}for(;u<l.length;)s[d++]=l[u++];for(;h<c.length;)s[d++]=c[h++];return s}})(Gy||(Gy={}));var gP=function(){function r(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},r.prototype.update=function(e,t){this._content=e.text,this._version=t,this._lineOffsets=void 0},r.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var e=[],t=this._content,n=!0,i=0;i<t.length;i++){n&&(e.push(i),n=!1);var s=t.charAt(i);n=s==="\r"||s===`
|
|
213
213
|
`,s==="\r"&&i+1<t.length&&t.charAt(i+1)===`
|
|
214
|
-
`&&i++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return Br.create(0,e);for(;n<i;){var s=Math.floor((n+i)/2);t[s]>e?i=s:n=s+1}var o=n-1;return Br.create(o,e-t[o])},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),r}(),J;(function(r){var e=Object.prototype.toString;function t(p){return typeof p<"u"}r.defined=t;function n(p){return typeof p>"u"}r.undefined=n;function i(p){return p===!0||p===!1}r.boolean=i;function s(p){return e.call(p)==="[object String]"}r.string=s;function o(p){return e.call(p)==="[object Number]"}r.number=o;function a(p,m,y){return e.call(p)==="[object Number]"&&m<=p&&p<=y}r.numberRange=a;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}r.integer=l;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}r.uinteger=c;function u(p){return e.call(p)==="[object Function]"}r.func=u;function h(p){return p!==null&&typeof p=="object"}r.objectLiteral=h;function d(p,m){return Array.isArray(p)&&p.every(m)}r.typedArray=d})(J||(J={}));var gP=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return r.concat(s||Array.prototype.slice.call(e))},Ky=function(){function r(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},r.prototype.update=function(e,t){for(var n=0,i=e;n<i.length;n++){var s=i[n];if(r.isIncremental(s)){var o=Jy(s.range),a=this.offsetAt(o.start),l=this.offsetAt(o.end);this._content=this._content.substring(0,a)+s.text+this._content.substring(l,this._content.length);var c=Math.max(o.start.line,0),u=Math.max(o.end.line,0),h=this._lineOffsets,d=Yy(s.text,!1,a);if(u-c===d.length)for(var p=0,m=d.length;p<m;p++)h[p+c+1]=d[p];else d.length<1e4?h.splice.apply(h,gP([c+1,u-c],d,!1)):this._lineOffsets=h=h.slice(0,c+1).concat(d,h.slice(u+1));var y=s.text.length-(l-a);if(y!==0)for(var p=c+1+d.length,m=h.length;p<m;p++)h[p]=h[p]+y}else if(r.isFull(s))this._content=s.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received")}this._version=t},r.prototype.getLineOffsets=function(){return this._lineOffsets===void 0&&(this._lineOffsets=Yy(this._content,!0)),this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return{line:0,character:e};for(;n<i;){var s=Math.floor((n+i)/2);t[s]>e?i=s:n=s+1}var o=n-1;return{line:o,character:e-t[o]}},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),r.isIncremental=function(e){var t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")},r.isFull=function(e){var t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0},r}(),Nf;(function(r){function e(i,s,o,a){return new Ky(i,s,o,a)}r.create=e;function t(i,s,o){if(i instanceof Ky)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}r.update=t;function n(i,s){for(var o=i.getText(),a=Rf(s.map(mP),function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),l=0,c=[],u=0,h=a;u<h.length;u++){var d=h[u],p=i.offsetAt(d.range.start);if(p<l)throw new Error("Overlapping edit");p>l&&c.push(o.substring(l,p)),d.newText.length&&c.push(d.newText),l=i.offsetAt(d.range.end)}return c.push(o.substr(l)),c.join("")}r.applyEdits=n})(Nf||(Nf={}));function Rf(r,e){if(r.length<=1)return r;var t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Rf(n,e),Rf(i,e);for(var s=0,o=0,a=0;s<n.length&&o<i.length;){var l=e(n[s],i[o]);l<=0?r[a++]=n[s++]:r[a++]=i[o++]}for(;s<n.length;)r[a++]=n[s++];for(;o<i.length;)r[a++]=i[o++];return r}function Yy(r,e,t){t===void 0&&(t=0);for(var n=e?[t]:[],i=0;i<r.length;i++){var s=r.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function Jy(r){var e=r.start,t=r.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}function mP(r){var e=Jy(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var He;(function(r){r[r.Undefined=0]="Undefined",r[r.EnumValueMismatch=1]="EnumValueMismatch",r[r.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",r[r.UnexpectedEndOfString=258]="UnexpectedEndOfString",r[r.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",r[r.InvalidUnicode=260]="InvalidUnicode",r[r.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",r[r.InvalidCharacter=262]="InvalidCharacter",r[r.PropertyExpected=513]="PropertyExpected",r[r.CommaExpected=514]="CommaExpected",r[r.ColonExpected=515]="ColonExpected",r[r.ValueExpected=516]="ValueExpected",r[r.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",r[r.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",r[r.TrailingComma=519]="TrailingComma",r[r.DuplicateKey=520]="DuplicateKey",r[r.CommentNotPermitted=521]="CommentNotPermitted",r[r.SchemaResolveError=768]="SchemaResolveError"})(He||(He={}));var Qy;(function(r){r.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[Ii.Markdown,Ii.PlainText],commitCharactersSupport:!0}}}}})(Qy||(Qy={}));var Di=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vP={"color-hex":{errorMessage:"Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.",pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:"String is not a RFC3339 date-time.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:"String is not a RFC3339 date.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:"String is not a RFC3339 time.",pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:"String is not an e-mail address.",pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}},Ni=function(){function r(e,t,n){this.offset=t,this.length=n,this.parent=e}return Object.defineProperty(r.prototype,"children",{get:function(){return[]},enumerable:!0,configurable:!0}),r.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},r}(),yP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="null",i.value=null,i}return e}(Ni),Xy=function(r){Di(e,r);function e(t,n,i){var s=r.call(this,t,i)||this;return s.type="boolean",s.value=n,s}return e}(Ni),bP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="array",i.items=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.items},enumerable:!0,configurable:!0}),e}(Ni),xP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="number",i.isInteger=!0,i.value=Number.NaN,i}return e}(Ni),Zy=function(r){Di(e,r);function e(t,n,i){var s=r.call(this,t,n,i)||this;return s.type="string",s.value="",s}return e}(Ni),wP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="property",i.colonOffset=-1,i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!0,configurable:!0}),e}(Ni),SP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="object",i.properties=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.properties},enumerable:!0,configurable:!0}),e}(Ni);function cr(r){return gn(r)?r?{}:{not:{}}:r}var _y;(function(r){r[r.Key=0]="Key",r[r.Enum=1]="Enum"})(_y||(_y={}));var kP=function(){function r(e,t){e===void 0&&(e=-1),t===void 0&&(t=null),this.focusOffset=e,this.exclude=t,this.schemas=[]}return r.prototype.add=function(e){this.schemas.push(e)},r.prototype.merge=function(e){var t;(t=this.schemas).push.apply(t,e.schemas)},r.prototype.include=function(e){return(this.focusOffset===-1||qy(e,this.focusOffset))&&e!==this.exclude},r.prototype.newSub=function(){return new r(-1,this.exclude)},r}(),Lf=function(){function r(){}return Object.defineProperty(r.prototype,"schemas",{get:function(){return[]},enumerable:!0,configurable:!0}),r.prototype.add=function(e){},r.prototype.merge=function(e){},r.prototype.include=function(e){return!0},r.prototype.newSub=function(){return this},r.instance=new r,r}(),ur=function(){function r(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=null}return r.prototype.hasProblems=function(){return!!this.problems.length},r.prototype.mergeAll=function(e){for(var t=0,n=e;t<n.length;t++){var i=n[t];this.merge(i)}},r.prototype.merge=function(e){this.problems=this.problems.concat(e.problems)},r.prototype.mergeEnumValues=function(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(var t=0,n=this.problems;t<n.length;t++){var i=n[t];i.code===He.EnumValueMismatch&&(i.message="Value is not accepted. Valid values: "+this.enumValues.map(function(s){return JSON.stringify(s)}).join(", ")+".")}}},r.prototype.mergePropertyMatch=function(e){this.merge(e),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++},r.prototype.compare=function(e){var t=this.hasProblems();return t!==e.hasProblems()?t?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches},r}();function AP(r,e){return e===void 0&&(e=[]),new eb(r,e,[])}function ni(r){return fP(r)}function Bf(r){return uP(r)}function qy(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}var eb=function(){function r(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=[]),this.root=e,this.syntaxErrors=t,this.comments=n}return r.prototype.getNodeFromOffset=function(e,t){if(t===void 0&&(t=!1),this.root)return cP(this.root,e,t)},r.prototype.visit=function(e){if(this.root){var t=function(n){var i=e(n),s=n.children;if(Array.isArray(s))for(var o=0;o<s.length&&i;o++)i=t(s[o]);return i};t(this.root)}},r.prototype.validate=function(e,t){if(this.root&&t){var n=new ur;return Vt(this.root,t,n,Lf.instance),n.problems.map(function(i){var s=Ue.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return Pn.create(s,i.message,i.severity,i.code)})}return null},r.prototype.getMatchingSchemas=function(e,t,n){t===void 0&&(t=-1),n===void 0&&(n=null);var i=new kP(t,n);return this.root&&e&&Vt(this.root,e,new ur,i),i.schemas},r}();function Vt(r,e,t,n){if(!r||!n.include(r))return;switch(r.type){case"object":l(r,e,t,n);break;case"array":a(r,e,t,n);break;case"string":o(r,e,t,n);break;case"number":s(r,e,t,n);break;case"property":return Vt(r.valueNode,e,t,n)}i(),n.add({node:r,schema:e});function i(){function c(oe){return r.type===oe||oe==="integer"&&r.type==="number"&&r.isInteger||e.nullable&&r.value===null}if(Array.isArray(e.type)?e.type.some(c)||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,message:e.errorMessage||"Incorrect type. Expected one of "+e.type.join(", ")+"."}):e.type&&(c(e.type)||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,message:e.errorMessage||'Incorrect type. Expected "'+e.type+'".'})),Array.isArray(e.allOf))for(var u=0,h=e.allOf;u<h.length;u++){var d=h[u];Vt(r,cr(d),t,n)}var p=cr(e.not);if(p){var m=new ur,y=n.newSub();Vt(r,p,m,y),m.hasProblems()||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,message:"Matches a schema that is not allowed."});for(var w=0,A=y.schemas;w<A.length;w++){var T=A[w];T.inverted=!T.inverted,n.add(T)}}var P=function(oe,fe){for(var be=[],ke=null,Re=0,Se=oe;Re<Se.length;Re++){var Oe=Se[Re],Te=cr(Oe),De=new ur,bt=n.newSub();if(Vt(r,Te,De,bt),De.hasProblems()||be.push(Te),!ke)ke={schema:Te,validationResult:De,matchingSchemas:bt};else if(!fe&&!De.hasProblems()&&!ke.validationResult.hasProblems())ke.matchingSchemas.merge(bt),ke.validationResult.propertiesMatches+=De.propertiesMatches,ke.validationResult.propertiesValueMatches+=De.propertiesValueMatches;else{var Rt=De.compare(ke.validationResult);Rt>0?ke={schema:Te,validationResult:De,matchingSchemas:bt}:Rt===0&&(ke.matchingSchemas.merge(bt),ke.validationResult.mergeEnumValues(De))}}return be.length>1&&fe&&t.problems.push({location:{offset:r.offset,length:1},severity:Ie.Warning,message:"Matches multiple schemas when only one must validate."}),ke!==null&&(t.merge(ke.validationResult),t.propertiesMatches+=ke.validationResult.propertiesMatches,t.propertiesValueMatches+=ke.validationResult.propertiesValueMatches,n.merge(ke.matchingSchemas)),be.length};Array.isArray(e.anyOf)&&P(e.anyOf,!1),Array.isArray(e.oneOf)&&P(e.oneOf,!0);var L=function(oe){var fe=new ur,be=n.newSub();Vt(r,cr(oe),fe,be),t.merge(fe),t.propertiesMatches+=fe.propertiesMatches,t.propertiesValueMatches+=fe.propertiesValueMatches,n.merge(be)},D=function(oe,fe,be){var ke=cr(oe),Re=new ur,Se=n.newSub();Vt(r,ke,Re,Se),n.merge(Se),Re.hasProblems()?be&&L(be):fe&&L(fe)},j=cr(e.if);if(j&&D(j,cr(e.then),cr(e.else)),Array.isArray(e.enum)){for(var W=ni(r),q=!1,F=0,H=e.enum;F<H.length;F++){var Q=H[F];if(Io(W,Q)){q=!0;break}}t.enumValues=e.enum,t.enumValueMatch=q,q||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,code:He.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(oe){return JSON.stringify(oe)}).join(", ")+"."})}if(Tn(e.const)){var W=ni(r);Io(W,e.const)?t.enumValueMatch=!0:(t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,code:He.EnumValueMismatch,message:e.errorMessage||"Value must be "+JSON.stringify(e.const)+"."}),t.enumValueMatch=!1),t.enumValues=[e.const]}e.deprecationMessage&&r.parent&&t.problems.push({location:{offset:r.parent.offset,length:r.parent.length},severity:Ie.Warning,message:e.deprecationMessage})}function s(c,u,h,d){var p=c.value;kr(u.multipleOf)&&p%u.multipleOf!==0&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function m(L,D){if(kr(D))return D;if(gn(D)&&D)return L}function y(L,D){if(!gn(D)||!D)return L}var w=m(u.minimum,u.exclusiveMinimum);kr(w)&&p<=w&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is below the exclusive minimum of "+w+"."});var A=m(u.maximum,u.exclusiveMaximum);kr(A)&&p>=A&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is above the exclusive maximum of "+A+"."});var T=y(u.minimum,u.exclusiveMinimum);kr(T)&&p<T&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is below the minimum of "+T+"."});var P=y(u.maximum,u.exclusiveMaximum);kr(P)&&p>P&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is above the maximum of "+P+"."})}function o(c,u,h,d){if(kr(u.minLength)&&c.value.length<u.minLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),kr(u.maxLength)&&c.value.length>u.maxLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),dP(u.pattern)){var p=new RegExp(u.pattern);p.test(c.value)||h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.patternErrorMessage||u.errorMessage||'String does not match the pattern of "'+u.pattern+'".'})}if(u.format)switch(u.format){case"uri":case"uri-reference":{var m=void 0;if(!c.value)m="URI expected.";else{var y=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(c.value);y?!y[2]&&u.format==="uri"&&(m="URI with a scheme is expected."):m="URI is expected."}m&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.patternErrorMessage||u.errorMessage||"String is not a URI: "+m})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var w=vP[u.format];(!c.value||!w.pattern.exec(c.value))&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.patternErrorMessage||u.errorMessage||w.errorMessage});break;default:}}function a(c,u,h,d){if(Array.isArray(u.items)){for(var p=u.items,m=0;m<p.length;m++){var y=p[m],w=cr(y),A=new ur,T=c.items[m];T?(Vt(T,w,A,d),h.mergePropertyMatch(A)):c.items.length>=p.length&&h.propertiesValueMatches++}if(c.items.length>p.length)if(typeof u.additionalItems=="object")for(var P=p.length;P<c.items.length;P++){var A=new ur;Vt(c.items[P],u.additionalItems,A,d),h.mergePropertyMatch(A)}else u.additionalItems===!1&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var L=cr(u.items);if(L)for(var D=0,j=c.items;D<j.length;D++){var T=j[D],A=new ur;Vt(T,L,A,d),h.mergePropertyMatch(A)}}var W=cr(u.contains);if(W){var q=c.items.some(function(Q){var oe=new ur;return Vt(Q,W,oe,Lf.instance),!oe.hasProblems()});q||h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.errorMessage||"Array does not contain required item."})}if(kr(u.minItems)&&c.items.length<u.minItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),kr(u.maxItems)&&c.items.length>u.maxItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var F=ni(c),H=F.some(function(Q,oe){return oe!==F.lastIndexOf(Q)});H&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has duplicate items."})}}function l(c,u,h,d){for(var p=Object.create(null),m=[],y=0,w=c.properties;y<w.length;y++){var A=w[y],T=A.keyNode.value;p[T]=A.valueNode,m.push(T)}if(Array.isArray(u.required))for(var P=0,L=u.required;P<L.length;P++){var D=L[P];if(!p[D]){var j=c.parent&&c.parent.type==="property"&&c.parent.keyNode,W=j?{offset:j.offset,length:j.length}:{offset:c.offset,length:1};h.problems.push({location:W,severity:Ie.Warning,message:'Missing property "'+D+'".'})}}var q=function(sr){for(var Es=m.indexOf(sr);Es>=0;)m.splice(Es,1),Es=m.indexOf(sr)};if(u.properties)for(var F=0,H=Object.keys(u.properties);F<H.length;F++){var D=H[F];q(D);var Q=u.properties[D],oe=p[D];if(oe)if(gn(Q))if(Q)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}else{var fe=new ur;Vt(oe,Q,fe,d),h.mergePropertyMatch(fe)}}if(u.patternProperties)for(var be=0,ke=Object.keys(u.patternProperties);be<ke.length;be++)for(var Re=ke[be],Se=new RegExp(Re),Oe=0,Te=m.slice(0);Oe<Te.length;Oe++){var D=Te[Oe];if(Se.test(D)){q(D);var oe=p[D];if(oe){var Q=u.patternProperties[Re];if(gn(Q))if(Q)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}else{var fe=new ur;Vt(oe,Q,fe,d),h.mergePropertyMatch(fe)}}}}if(typeof u.additionalProperties=="object")for(var De=0,bt=m;De<bt.length;De++){var D=bt[De],oe=p[D];if(oe){var fe=new ur;Vt(oe,u.additionalProperties,fe,d),h.mergePropertyMatch(fe)}}else if(u.additionalProperties===!1&&m.length>0)for(var Rt=0,ir=m;Rt<ir.length;Rt++){var D=ir[Rt],oe=p[D];if(oe){var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}}if(kr(u.maxProperties)&&c.properties.length>u.maxProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),kr(u.minProperties)&&c.properties.length<u.minProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var jr=0,si=Object.keys(u.dependencies);jr<si.length;jr++){var T=si[jr],Wt=p[T];if(Wt){var _t=u.dependencies[T];if(Array.isArray(_t))for(var Or=0,oi=_t;Or<oi.length;Or++){var ai=oi[Or];p[ai]?h.propertiesValueMatches++:h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object is missing property "+ai+" required by property {$key}."})}else{var Q=cr(_t);if(Q){var fe=new ur;Vt(c,Q,fe,d),h.mergePropertyMatch(fe)}}}}var Er=cr(u.propertyNames);if(Er)for(var vn=0,Gl=c.properties;vn<Gl.length;vn++){var li=Gl[vn],T=li.keyNode;T&&Vt(T,Er,h,Lf.instance)}}}function CP(r,e){var t=[],n=-1,i=r.getText(),s=bs(i,!1),o=e&&e.collectComments?[]:void 0;function a(){for(;;){var j=s.scan();switch(h(),j){case 12:case 13:Array.isArray(o)&&o.push(Ue.create(r.positionAt(s.getTokenOffset()),r.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return j}}}function l(j){return s.getToken()===j?(a(),!0):!1}function c(j,W,q,F,H){if(H===void 0&&(H=Ie.Error),t.length===0||q!==n){var Q=Ue.create(r.positionAt(q),r.positionAt(F));t.push(Pn.create(Q,j,H,W,r.languageId)),n=q}}function u(j,W,q,F,H){q===void 0&&(q=null),F===void 0&&(F=[]),H===void 0&&(H=[]);var Q=s.getTokenOffset(),oe=s.getTokenOffset()+s.getTokenLength();if(Q===oe&&Q>0){for(Q--;Q>0&&/\s/.test(i.charAt(Q));)Q--;oe=Q+1}if(c(j,W,Q,oe),q&&d(q,!1),F.length+H.length>0)for(var fe=s.getToken();fe!==17;){if(F.indexOf(fe)!==-1){a();break}else if(H.indexOf(fe)!==-1)break;fe=a()}return q}function h(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",He.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",He.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",He.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",He.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",He.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",He.InvalidCharacter),!0}return!1}function d(j,W){return j.length=s.getTokenOffset()+s.getTokenLength()-j.offset,W&&a(),j}function p(j){if(s.getToken()!==3)return null;var W=new bP(j,s.getTokenOffset());a();for(var q=0,F=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){F||u("Value expected",He.ValueExpected);var H=s.getTokenOffset();if(a(),s.getToken()===4){F&&c("Trailing comma",He.TrailingComma,H,H+1);continue}}else F&&u("Expected comma",He.CommaExpected);var Q=P(W,q++);Q?W.items.push(Q):u("Value expected",He.ValueExpected,null,[],[4,5]),F=!0}return s.getToken()!==4?u("Expected comma or closing bracket",He.CommaOrCloseBacketExpected,W):d(W,!0)}function m(j,W){var q=new wP(j,s.getTokenOffset()),F=w(q);if(!F)if(s.getToken()===16){u("Property keys must be doublequoted",He.Undefined);var H=new Zy(q,s.getTokenOffset(),s.getTokenLength());H.value=s.getTokenValue(),F=H,a()}else return null;q.keyNode=F;var Q=W[F.value];if(Q?(c("Duplicate object key",He.DuplicateKey,q.keyNode.offset,q.keyNode.offset+q.keyNode.length,Ie.Warning),typeof Q=="object"&&c("DuplicateKeyWarning",He.DuplicateKey,Q.keyNode.offset,Q.keyNode.offset+Q.keyNode.length,Ie.Warning),W[F.value]=!0):W[F.value]=q,s.getToken()===6)q.colonOffset=s.getTokenOffset(),a();else if(u("Colon expected",He.ColonExpected),s.getToken()===10&&r.positionAt(F.offset+F.length).line<r.positionAt(s.getTokenOffset()).line)return q.length=F.length,q;var oe=P(q,F.value);return oe?(q.valueNode=oe,q.length=oe.offset+oe.length-q.offset,q):u("Value expected",He.ValueExpected,q,[],[2,5])}function y(j){if(s.getToken()!==1)return null;var W=new SP(j,s.getTokenOffset()),q=Object.create(null);a();for(var F=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){F||u("Property expected",He.PropertyExpected);var H=s.getTokenOffset();if(a(),s.getToken()===2){F&&c("Trailing comma",He.TrailingComma,H,H+1);continue}}else F&&u("Expected comma",He.CommaExpected);var Q=m(W,q);Q?W.properties.push(Q):u("Property expected",He.PropertyExpected,null,[],[2,5]),F=!0}return s.getToken()!==2?u("Expected comma or closing brace",He.CommaOrCloseBraceExpected,W):d(W,!0)}function w(j){if(s.getToken()!==10)return null;var W=new Zy(j,s.getTokenOffset());return W.value=s.getTokenValue(),d(W,!0)}function A(j){if(s.getToken()!==11)return null;var W=new xP(j,s.getTokenOffset());if(s.getTokenError()===0){var q=s.getTokenValue();try{var F=JSON.parse(q);if(!kr(F))return u("Invalid number format.",He.Undefined,W);W.value=F}catch{return u("Invalid number format.",He.Undefined,W)}W.isInteger=q.indexOf(".")===-1}return d(W,!0)}function T(j){var W;switch(s.getToken()){case 7:return d(new yP(j,s.getTokenOffset()),!0);case 8:return d(new Xy(j,!0,s.getTokenOffset()),!0);case 9:return d(new Xy(j,!1,s.getTokenOffset()),!0);default:return null}}function P(j,W){return p(j)||y(j)||w(j)||A(j)||T(j)}var L=null,D=a();return D!==17&&(L=P(null,null),L?s.getToken()!==17&&u("End of file expected.",He.Undefined):u("Expected a JSON object, array or literal.",He.Undefined)),new eb(L,t,o)}function Ff(r,e,t){if(r!==null&&typeof r=="object"){var n=e+" ";if(Array.isArray(r)){if(r.length===0)return"[]";for(var i=`[
|
|
214
|
+
`&&i++}n&&t.length>0&&e.push(t.length),this._lineOffsets=e}return this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return Br.create(0,e);for(;n<i;){var s=Math.floor((n+i)/2);t[s]>e?i=s:n=s+1}var o=n-1;return Br.create(o,e-t[o])},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),r}(),J;(function(r){var e=Object.prototype.toString;function t(p){return typeof p<"u"}r.defined=t;function n(p){return typeof p>"u"}r.undefined=n;function i(p){return p===!0||p===!1}r.boolean=i;function s(p){return e.call(p)==="[object String]"}r.string=s;function o(p){return e.call(p)==="[object Number]"}r.number=o;function a(p,m,y){return e.call(p)==="[object Number]"&&m<=p&&p<=y}r.numberRange=a;function l(p){return e.call(p)==="[object Number]"&&-2147483648<=p&&p<=2147483647}r.integer=l;function c(p){return e.call(p)==="[object Number]"&&0<=p&&p<=2147483647}r.uinteger=c;function u(p){return e.call(p)==="[object Function]"}r.func=u;function h(p){return p!==null&&typeof p=="object"}r.objectLiteral=h;function d(p,m){return Array.isArray(p)&&p.every(m)}r.typedArray=d})(J||(J={}));var mP=function(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,s;n<i;n++)(s||!(n in e))&&(s||(s=Array.prototype.slice.call(e,0,n)),s[n]=e[n]);return r.concat(s||Array.prototype.slice.call(e))},Ky=function(){function r(e,t,n,i){this._uri=e,this._languageId=t,this._version=n,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(r.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),r.prototype.getText=function(e){if(e){var t=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(t,n)}return this._content},r.prototype.update=function(e,t){for(var n=0,i=e;n<i.length;n++){var s=i[n];if(r.isIncremental(s)){var o=Jy(s.range),a=this.offsetAt(o.start),l=this.offsetAt(o.end);this._content=this._content.substring(0,a)+s.text+this._content.substring(l,this._content.length);var c=Math.max(o.start.line,0),u=Math.max(o.end.line,0),h=this._lineOffsets,d=Yy(s.text,!1,a);if(u-c===d.length)for(var p=0,m=d.length;p<m;p++)h[p+c+1]=d[p];else d.length<1e4?h.splice.apply(h,mP([c+1,u-c],d,!1)):this._lineOffsets=h=h.slice(0,c+1).concat(d,h.slice(u+1));var y=s.text.length-(l-a);if(y!==0)for(var p=c+1+d.length,m=h.length;p<m;p++)h[p]=h[p]+y}else if(r.isFull(s))this._content=s.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received")}this._version=t},r.prototype.getLineOffsets=function(){return this._lineOffsets===void 0&&(this._lineOffsets=Yy(this._content,!0)),this._lineOffsets},r.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var t=this.getLineOffsets(),n=0,i=t.length;if(i===0)return{line:0,character:e};for(;n<i;){var s=Math.floor((n+i)/2);t[s]>e?i=s:n=s+1}var o=n-1;return{line:o,character:e-t[o]}},r.prototype.offsetAt=function(e){var t=this.getLineOffsets();if(e.line>=t.length)return this._content.length;if(e.line<0)return 0;var n=t[e.line],i=e.line+1<t.length?t[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)},Object.defineProperty(r.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),r.isIncremental=function(e){var t=e;return t!=null&&typeof t.text=="string"&&t.range!==void 0&&(t.rangeLength===void 0||typeof t.rangeLength=="number")},r.isFull=function(e){var t=e;return t!=null&&typeof t.text=="string"&&t.range===void 0&&t.rangeLength===void 0},r}(),Nf;(function(r){function e(i,s,o,a){return new Ky(i,s,o,a)}r.create=e;function t(i,s,o){if(i instanceof Ky)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}r.update=t;function n(i,s){for(var o=i.getText(),a=Rf(s.map(vP),function(m,y){var w=m.range.start.line-y.range.start.line;return w===0?m.range.start.character-y.range.start.character:w}),l=0,c=[],u=0,h=a;u<h.length;u++){var d=h[u],p=i.offsetAt(d.range.start);if(p<l)throw new Error("Overlapping edit");p>l&&c.push(o.substring(l,p)),d.newText.length&&c.push(d.newText),l=i.offsetAt(d.range.end)}return c.push(o.substr(l)),c.join("")}r.applyEdits=n})(Nf||(Nf={}));function Rf(r,e){if(r.length<=1)return r;var t=r.length/2|0,n=r.slice(0,t),i=r.slice(t);Rf(n,e),Rf(i,e);for(var s=0,o=0,a=0;s<n.length&&o<i.length;){var l=e(n[s],i[o]);l<=0?r[a++]=n[s++]:r[a++]=i[o++]}for(;s<n.length;)r[a++]=n[s++];for(;o<i.length;)r[a++]=i[o++];return r}function Yy(r,e,t){t===void 0&&(t=0);for(var n=e?[t]:[],i=0;i<r.length;i++){var s=r.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<r.length&&r.charCodeAt(i+1)===10&&i++,n.push(t+i+1))}return n}function Jy(r){var e=r.start,t=r.end;return e.line>t.line||e.line===t.line&&e.character>t.character?{start:t,end:e}:r}function vP(r){var e=Jy(r.range);return e!==r.range?{newText:r.newText,range:e}:r}var He;(function(r){r[r.Undefined=0]="Undefined",r[r.EnumValueMismatch=1]="EnumValueMismatch",r[r.UnexpectedEndOfComment=257]="UnexpectedEndOfComment",r[r.UnexpectedEndOfString=258]="UnexpectedEndOfString",r[r.UnexpectedEndOfNumber=259]="UnexpectedEndOfNumber",r[r.InvalidUnicode=260]="InvalidUnicode",r[r.InvalidEscapeCharacter=261]="InvalidEscapeCharacter",r[r.InvalidCharacter=262]="InvalidCharacter",r[r.PropertyExpected=513]="PropertyExpected",r[r.CommaExpected=514]="CommaExpected",r[r.ColonExpected=515]="ColonExpected",r[r.ValueExpected=516]="ValueExpected",r[r.CommaOrCloseBacketExpected=517]="CommaOrCloseBacketExpected",r[r.CommaOrCloseBraceExpected=518]="CommaOrCloseBraceExpected",r[r.TrailingComma=519]="TrailingComma",r[r.DuplicateKey=520]="DuplicateKey",r[r.CommentNotPermitted=521]="CommentNotPermitted",r[r.SchemaResolveError=768]="SchemaResolveError"})(He||(He={}));var Qy;(function(r){r.LATEST={textDocument:{completion:{completionItem:{documentationFormat:[Ii.Markdown,Ii.PlainText],commitCharactersSupport:!0}}}}})(Qy||(Qy={}));var Di=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),yP={"color-hex":{errorMessage:"Invalid color format. Use #RGB, #RGBA, #RRGGBB or #RRGGBBAA.",pattern:/^#([0-9A-Fa-f]{3,4}|([0-9A-Fa-f]{2}){3,4})$/},"date-time":{errorMessage:"String is not a RFC3339 date-time.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},date:{errorMessage:"String is not a RFC3339 date.",pattern:/^(\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/i},time:{errorMessage:"String is not a RFC3339 time.",pattern:/^([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)([01][0-9]|2[0-3]):([0-5][0-9]))$/i},email:{errorMessage:"String is not an e-mail address.",pattern:/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/}},Ni=function(){function r(e,t,n){this.offset=t,this.length=n,this.parent=e}return Object.defineProperty(r.prototype,"children",{get:function(){return[]},enumerable:!0,configurable:!0}),r.prototype.toString=function(){return"type: "+this.type+" ("+this.offset+"/"+this.length+")"+(this.parent?" parent: {"+this.parent.toString()+"}":"")},r}(),bP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="null",i.value=null,i}return e}(Ni),Xy=function(r){Di(e,r);function e(t,n,i){var s=r.call(this,t,i)||this;return s.type="boolean",s.value=n,s}return e}(Ni),xP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="array",i.items=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.items},enumerable:!0,configurable:!0}),e}(Ni),wP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="number",i.isInteger=!0,i.value=Number.NaN,i}return e}(Ni),Zy=function(r){Di(e,r);function e(t,n,i){var s=r.call(this,t,n,i)||this;return s.type="string",s.value="",s}return e}(Ni),SP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="property",i.colonOffset=-1,i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.valueNode?[this.keyNode,this.valueNode]:[this.keyNode]},enumerable:!0,configurable:!0}),e}(Ni),kP=function(r){Di(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.type="object",i.properties=[],i}return Object.defineProperty(e.prototype,"children",{get:function(){return this.properties},enumerable:!0,configurable:!0}),e}(Ni);function cr(r){return gn(r)?r?{}:{not:{}}:r}var _y;(function(r){r[r.Key=0]="Key",r[r.Enum=1]="Enum"})(_y||(_y={}));var AP=function(){function r(e,t){e===void 0&&(e=-1),t===void 0&&(t=null),this.focusOffset=e,this.exclude=t,this.schemas=[]}return r.prototype.add=function(e){this.schemas.push(e)},r.prototype.merge=function(e){var t;(t=this.schemas).push.apply(t,e.schemas)},r.prototype.include=function(e){return(this.focusOffset===-1||qy(e,this.focusOffset))&&e!==this.exclude},r.prototype.newSub=function(){return new r(-1,this.exclude)},r}(),Lf=function(){function r(){}return Object.defineProperty(r.prototype,"schemas",{get:function(){return[]},enumerable:!0,configurable:!0}),r.prototype.add=function(e){},r.prototype.merge=function(e){},r.prototype.include=function(e){return!0},r.prototype.newSub=function(){return this},r.instance=new r,r}(),ur=function(){function r(){this.problems=[],this.propertiesMatches=0,this.propertiesValueMatches=0,this.primaryValueMatches=0,this.enumValueMatch=!1,this.enumValues=null}return r.prototype.hasProblems=function(){return!!this.problems.length},r.prototype.mergeAll=function(e){for(var t=0,n=e;t<n.length;t++){var i=n[t];this.merge(i)}},r.prototype.merge=function(e){this.problems=this.problems.concat(e.problems)},r.prototype.mergeEnumValues=function(e){if(!this.enumValueMatch&&!e.enumValueMatch&&this.enumValues&&e.enumValues){this.enumValues=this.enumValues.concat(e.enumValues);for(var t=0,n=this.problems;t<n.length;t++){var i=n[t];i.code===He.EnumValueMismatch&&(i.message="Value is not accepted. Valid values: "+this.enumValues.map(function(s){return JSON.stringify(s)}).join(", ")+".")}}},r.prototype.mergePropertyMatch=function(e){this.merge(e),this.propertiesMatches++,(e.enumValueMatch||!e.hasProblems()&&e.propertiesMatches)&&this.propertiesValueMatches++,e.enumValueMatch&&e.enumValues&&e.enumValues.length===1&&this.primaryValueMatches++},r.prototype.compare=function(e){var t=this.hasProblems();return t!==e.hasProblems()?t?-1:1:this.enumValueMatch!==e.enumValueMatch?e.enumValueMatch?-1:1:this.primaryValueMatches!==e.primaryValueMatches?this.primaryValueMatches-e.primaryValueMatches:this.propertiesValueMatches!==e.propertiesValueMatches?this.propertiesValueMatches-e.propertiesValueMatches:this.propertiesMatches-e.propertiesMatches},r}();function CP(r,e){return e===void 0&&(e=[]),new eb(r,e,[])}function ni(r){return hP(r)}function Bf(r){return fP(r)}function qy(r,e,t){return t===void 0&&(t=!1),e>=r.offset&&e<r.offset+r.length||t&&e===r.offset+r.length}var eb=function(){function r(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=[]),this.root=e,this.syntaxErrors=t,this.comments=n}return r.prototype.getNodeFromOffset=function(e,t){if(t===void 0&&(t=!1),this.root)return uP(this.root,e,t)},r.prototype.visit=function(e){if(this.root){var t=function(n){var i=e(n),s=n.children;if(Array.isArray(s))for(var o=0;o<s.length&&i;o++)i=t(s[o]);return i};t(this.root)}},r.prototype.validate=function(e,t){if(this.root&&t){var n=new ur;return Vt(this.root,t,n,Lf.instance),n.problems.map(function(i){var s=Ue.create(e.positionAt(i.location.offset),e.positionAt(i.location.offset+i.location.length));return Pn.create(s,i.message,i.severity,i.code)})}return null},r.prototype.getMatchingSchemas=function(e,t,n){t===void 0&&(t=-1),n===void 0&&(n=null);var i=new AP(t,n);return this.root&&e&&Vt(this.root,e,new ur,i),i.schemas},r}();function Vt(r,e,t,n){if(!r||!n.include(r))return;switch(r.type){case"object":l(r,e,t,n);break;case"array":a(r,e,t,n);break;case"string":o(r,e,t,n);break;case"number":s(r,e,t,n);break;case"property":return Vt(r.valueNode,e,t,n)}i(),n.add({node:r,schema:e});function i(){function c(oe){return r.type===oe||oe==="integer"&&r.type==="number"&&r.isInteger||e.nullable&&r.value===null}if(Array.isArray(e.type)?e.type.some(c)||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,message:e.errorMessage||"Incorrect type. Expected one of "+e.type.join(", ")+"."}):e.type&&(c(e.type)||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,message:e.errorMessage||'Incorrect type. Expected "'+e.type+'".'})),Array.isArray(e.allOf))for(var u=0,h=e.allOf;u<h.length;u++){var d=h[u];Vt(r,cr(d),t,n)}var p=cr(e.not);if(p){var m=new ur,y=n.newSub();Vt(r,p,m,y),m.hasProblems()||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,message:"Matches a schema that is not allowed."});for(var w=0,A=y.schemas;w<A.length;w++){var T=A[w];T.inverted=!T.inverted,n.add(T)}}var P=function(oe,fe){for(var be=[],ke=null,Re=0,Se=oe;Re<Se.length;Re++){var Oe=Se[Re],Te=cr(Oe),De=new ur,bt=n.newSub();if(Vt(r,Te,De,bt),De.hasProblems()||be.push(Te),!ke)ke={schema:Te,validationResult:De,matchingSchemas:bt};else if(!fe&&!De.hasProblems()&&!ke.validationResult.hasProblems())ke.matchingSchemas.merge(bt),ke.validationResult.propertiesMatches+=De.propertiesMatches,ke.validationResult.propertiesValueMatches+=De.propertiesValueMatches;else{var Rt=De.compare(ke.validationResult);Rt>0?ke={schema:Te,validationResult:De,matchingSchemas:bt}:Rt===0&&(ke.matchingSchemas.merge(bt),ke.validationResult.mergeEnumValues(De))}}return be.length>1&&fe&&t.problems.push({location:{offset:r.offset,length:1},severity:Ie.Warning,message:"Matches multiple schemas when only one must validate."}),ke!==null&&(t.merge(ke.validationResult),t.propertiesMatches+=ke.validationResult.propertiesMatches,t.propertiesValueMatches+=ke.validationResult.propertiesValueMatches,n.merge(ke.matchingSchemas)),be.length};Array.isArray(e.anyOf)&&P(e.anyOf,!1),Array.isArray(e.oneOf)&&P(e.oneOf,!0);var L=function(oe){var fe=new ur,be=n.newSub();Vt(r,cr(oe),fe,be),t.merge(fe),t.propertiesMatches+=fe.propertiesMatches,t.propertiesValueMatches+=fe.propertiesValueMatches,n.merge(be)},D=function(oe,fe,be){var ke=cr(oe),Re=new ur,Se=n.newSub();Vt(r,ke,Re,Se),n.merge(Se),Re.hasProblems()?be&&L(be):fe&&L(fe)},j=cr(e.if);if(j&&D(j,cr(e.then),cr(e.else)),Array.isArray(e.enum)){for(var W=ni(r),q=!1,F=0,H=e.enum;F<H.length;F++){var Q=H[F];if(Io(W,Q)){q=!0;break}}t.enumValues=e.enum,t.enumValueMatch=q,q||t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,code:He.EnumValueMismatch,message:e.errorMessage||"Value is not accepted. Valid values: "+e.enum.map(function(oe){return JSON.stringify(oe)}).join(", ")+"."})}if(Tn(e.const)){var W=ni(r);Io(W,e.const)?t.enumValueMatch=!0:(t.problems.push({location:{offset:r.offset,length:r.length},severity:Ie.Warning,code:He.EnumValueMismatch,message:e.errorMessage||"Value must be "+JSON.stringify(e.const)+"."}),t.enumValueMatch=!1),t.enumValues=[e.const]}e.deprecationMessage&&r.parent&&t.problems.push({location:{offset:r.parent.offset,length:r.parent.length},severity:Ie.Warning,message:e.deprecationMessage})}function s(c,u,h,d){var p=c.value;kr(u.multipleOf)&&p%u.multipleOf!==0&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is not divisible by "+u.multipleOf+"."});function m(L,D){if(kr(D))return D;if(gn(D)&&D)return L}function y(L,D){if(!gn(D)||!D)return L}var w=m(u.minimum,u.exclusiveMinimum);kr(w)&&p<=w&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is below the exclusive minimum of "+w+"."});var A=m(u.maximum,u.exclusiveMaximum);kr(A)&&p>=A&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is above the exclusive maximum of "+A+"."});var T=y(u.minimum,u.exclusiveMinimum);kr(T)&&p<T&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is below the minimum of "+T+"."});var P=y(u.maximum,u.exclusiveMaximum);kr(P)&&p>P&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Value is above the maximum of "+P+"."})}function o(c,u,h,d){if(kr(u.minLength)&&c.value.length<u.minLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"String is shorter than the minimum length of "+u.minLength+"."}),kr(u.maxLength)&&c.value.length>u.maxLength&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"String is longer than the maximum length of "+u.maxLength+"."}),pP(u.pattern)){var p=new RegExp(u.pattern);p.test(c.value)||h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.patternErrorMessage||u.errorMessage||'String does not match the pattern of "'+u.pattern+'".'})}if(u.format)switch(u.format){case"uri":case"uri-reference":{var m=void 0;if(!c.value)m="URI expected.";else{var y=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/.exec(c.value);y?!y[2]&&u.format==="uri"&&(m="URI with a scheme is expected."):m="URI is expected."}m&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.patternErrorMessage||u.errorMessage||"String is not a URI: "+m})}break;case"color-hex":case"date-time":case"date":case"time":case"email":var w=yP[u.format];(!c.value||!w.pattern.exec(c.value))&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.patternErrorMessage||u.errorMessage||w.errorMessage});break;default:}}function a(c,u,h,d){if(Array.isArray(u.items)){for(var p=u.items,m=0;m<p.length;m++){var y=p[m],w=cr(y),A=new ur,T=c.items[m];T?(Vt(T,w,A,d),h.mergePropertyMatch(A)):c.items.length>=p.length&&h.propertiesValueMatches++}if(c.items.length>p.length)if(typeof u.additionalItems=="object")for(var P=p.length;P<c.items.length;P++){var A=new ur;Vt(c.items[P],u.additionalItems,A,d),h.mergePropertyMatch(A)}else u.additionalItems===!1&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too many items according to schema. Expected "+p.length+" or fewer."})}else{var L=cr(u.items);if(L)for(var D=0,j=c.items;D<j.length;D++){var T=j[D],A=new ur;Vt(T,L,A,d),h.mergePropertyMatch(A)}}var W=cr(u.contains);if(W){var q=c.items.some(function(Q){var oe=new ur;return Vt(Q,W,oe,Lf.instance),!oe.hasProblems()});q||h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:u.errorMessage||"Array does not contain required item."})}if(kr(u.minItems)&&c.items.length<u.minItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too few items. Expected "+u.minItems+" or more."}),kr(u.maxItems)&&c.items.length>u.maxItems&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has too many items. Expected "+u.maxItems+" or fewer."}),u.uniqueItems===!0){var F=ni(c),H=F.some(function(Q,oe){return oe!==F.lastIndexOf(Q)});H&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Array has duplicate items."})}}function l(c,u,h,d){for(var p=Object.create(null),m=[],y=0,w=c.properties;y<w.length;y++){var A=w[y],T=A.keyNode.value;p[T]=A.valueNode,m.push(T)}if(Array.isArray(u.required))for(var P=0,L=u.required;P<L.length;P++){var D=L[P];if(!p[D]){var j=c.parent&&c.parent.type==="property"&&c.parent.keyNode,W=j?{offset:j.offset,length:j.length}:{offset:c.offset,length:1};h.problems.push({location:W,severity:Ie.Warning,message:'Missing property "'+D+'".'})}}var q=function(sr){for(var Es=m.indexOf(sr);Es>=0;)m.splice(Es,1),Es=m.indexOf(sr)};if(u.properties)for(var F=0,H=Object.keys(u.properties);F<H.length;F++){var D=H[F];q(D);var Q=u.properties[D],oe=p[D];if(oe)if(gn(Q))if(Q)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}else{var fe=new ur;Vt(oe,Q,fe,d),h.mergePropertyMatch(fe)}}if(u.patternProperties)for(var be=0,ke=Object.keys(u.patternProperties);be<ke.length;be++)for(var Re=ke[be],Se=new RegExp(Re),Oe=0,Te=m.slice(0);Oe<Te.length;Oe++){var D=Te[Oe];if(Se.test(D)){q(D);var oe=p[D];if(oe){var Q=u.patternProperties[Re];if(gn(Q))if(Q)h.propertiesMatches++,h.propertiesValueMatches++;else{var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}else{var fe=new ur;Vt(oe,Q,fe,d),h.mergePropertyMatch(fe)}}}}if(typeof u.additionalProperties=="object")for(var De=0,bt=m;De<bt.length;De++){var D=bt[De],oe=p[D];if(oe){var fe=new ur;Vt(oe,u.additionalProperties,fe,d),h.mergePropertyMatch(fe)}}else if(u.additionalProperties===!1&&m.length>0)for(var Rt=0,ir=m;Rt<ir.length;Rt++){var D=ir[Rt],oe=p[D];if(oe){var A=oe.parent;h.problems.push({location:{offset:A.keyNode.offset,length:A.keyNode.length},severity:Ie.Warning,message:u.errorMessage||"Property "+D+" is not allowed."})}}if(kr(u.maxProperties)&&c.properties.length>u.maxProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object has more properties than limit of "+u.maxProperties+"."}),kr(u.minProperties)&&c.properties.length<u.minProperties&&h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object has fewer properties than the required number of "+u.minProperties}),u.dependencies)for(var jr=0,si=Object.keys(u.dependencies);jr<si.length;jr++){var T=si[jr],Wt=p[T];if(Wt){var _t=u.dependencies[T];if(Array.isArray(_t))for(var Or=0,oi=_t;Or<oi.length;Or++){var ai=oi[Or];p[ai]?h.propertiesValueMatches++:h.problems.push({location:{offset:c.offset,length:c.length},severity:Ie.Warning,message:"Object is missing property "+ai+" required by property {$key}."})}else{var Q=cr(_t);if(Q){var fe=new ur;Vt(c,Q,fe,d),h.mergePropertyMatch(fe)}}}}var Er=cr(u.propertyNames);if(Er)for(var vn=0,Gl=c.properties;vn<Gl.length;vn++){var li=Gl[vn],T=li.keyNode;T&&Vt(T,Er,h,Lf.instance)}}}function OP(r,e){var t=[],n=-1,i=r.getText(),s=bs(i,!1),o=e&&e.collectComments?[]:void 0;function a(){for(;;){var j=s.scan();switch(h(),j){case 12:case 13:Array.isArray(o)&&o.push(Ue.create(r.positionAt(s.getTokenOffset()),r.positionAt(s.getTokenOffset()+s.getTokenLength())));break;case 15:case 14:break;default:return j}}}function l(j){return s.getToken()===j?(a(),!0):!1}function c(j,W,q,F,H){if(H===void 0&&(H=Ie.Error),t.length===0||q!==n){var Q=Ue.create(r.positionAt(q),r.positionAt(F));t.push(Pn.create(Q,j,H,W,r.languageId)),n=q}}function u(j,W,q,F,H){q===void 0&&(q=null),F===void 0&&(F=[]),H===void 0&&(H=[]);var Q=s.getTokenOffset(),oe=s.getTokenOffset()+s.getTokenLength();if(Q===oe&&Q>0){for(Q--;Q>0&&/\s/.test(i.charAt(Q));)Q--;oe=Q+1}if(c(j,W,Q,oe),q&&d(q,!1),F.length+H.length>0)for(var fe=s.getToken();fe!==17;){if(F.indexOf(fe)!==-1){a();break}else if(H.indexOf(fe)!==-1)break;fe=a()}return q}function h(){switch(s.getTokenError()){case 4:return u("Invalid unicode sequence in string.",He.InvalidUnicode),!0;case 5:return u("Invalid escape character in string.",He.InvalidEscapeCharacter),!0;case 3:return u("Unexpected end of number.",He.UnexpectedEndOfNumber),!0;case 1:return u("Unexpected end of comment.",He.UnexpectedEndOfComment),!0;case 2:return u("Unexpected end of string.",He.UnexpectedEndOfString),!0;case 6:return u("Invalid characters in string. Control characters must be escaped.",He.InvalidCharacter),!0}return!1}function d(j,W){return j.length=s.getTokenOffset()+s.getTokenLength()-j.offset,W&&a(),j}function p(j){if(s.getToken()!==3)return null;var W=new xP(j,s.getTokenOffset());a();for(var q=0,F=!1;s.getToken()!==4&&s.getToken()!==17;){if(s.getToken()===5){F||u("Value expected",He.ValueExpected);var H=s.getTokenOffset();if(a(),s.getToken()===4){F&&c("Trailing comma",He.TrailingComma,H,H+1);continue}}else F&&u("Expected comma",He.CommaExpected);var Q=P(W,q++);Q?W.items.push(Q):u("Value expected",He.ValueExpected,null,[],[4,5]),F=!0}return s.getToken()!==4?u("Expected comma or closing bracket",He.CommaOrCloseBacketExpected,W):d(W,!0)}function m(j,W){var q=new SP(j,s.getTokenOffset()),F=w(q);if(!F)if(s.getToken()===16){u("Property keys must be doublequoted",He.Undefined);var H=new Zy(q,s.getTokenOffset(),s.getTokenLength());H.value=s.getTokenValue(),F=H,a()}else return null;q.keyNode=F;var Q=W[F.value];if(Q?(c("Duplicate object key",He.DuplicateKey,q.keyNode.offset,q.keyNode.offset+q.keyNode.length,Ie.Warning),typeof Q=="object"&&c("DuplicateKeyWarning",He.DuplicateKey,Q.keyNode.offset,Q.keyNode.offset+Q.keyNode.length,Ie.Warning),W[F.value]=!0):W[F.value]=q,s.getToken()===6)q.colonOffset=s.getTokenOffset(),a();else if(u("Colon expected",He.ColonExpected),s.getToken()===10&&r.positionAt(F.offset+F.length).line<r.positionAt(s.getTokenOffset()).line)return q.length=F.length,q;var oe=P(q,F.value);return oe?(q.valueNode=oe,q.length=oe.offset+oe.length-q.offset,q):u("Value expected",He.ValueExpected,q,[],[2,5])}function y(j){if(s.getToken()!==1)return null;var W=new kP(j,s.getTokenOffset()),q=Object.create(null);a();for(var F=!1;s.getToken()!==2&&s.getToken()!==17;){if(s.getToken()===5){F||u("Property expected",He.PropertyExpected);var H=s.getTokenOffset();if(a(),s.getToken()===2){F&&c("Trailing comma",He.TrailingComma,H,H+1);continue}}else F&&u("Expected comma",He.CommaExpected);var Q=m(W,q);Q?W.properties.push(Q):u("Property expected",He.PropertyExpected,null,[],[2,5]),F=!0}return s.getToken()!==2?u("Expected comma or closing brace",He.CommaOrCloseBraceExpected,W):d(W,!0)}function w(j){if(s.getToken()!==10)return null;var W=new Zy(j,s.getTokenOffset());return W.value=s.getTokenValue(),d(W,!0)}function A(j){if(s.getToken()!==11)return null;var W=new wP(j,s.getTokenOffset());if(s.getTokenError()===0){var q=s.getTokenValue();try{var F=JSON.parse(q);if(!kr(F))return u("Invalid number format.",He.Undefined,W);W.value=F}catch{return u("Invalid number format.",He.Undefined,W)}W.isInteger=q.indexOf(".")===-1}return d(W,!0)}function T(j){var W;switch(s.getToken()){case 7:return d(new bP(j,s.getTokenOffset()),!0);case 8:return d(new Xy(j,!0,s.getTokenOffset()),!0);case 9:return d(new Xy(j,!1,s.getTokenOffset()),!0);default:return null}}function P(j,W){return p(j)||y(j)||w(j)||A(j)||T(j)}var L=null,D=a();return D!==17&&(L=P(null,null),L?s.getToken()!==17&&u("End of file expected.",He.Undefined):u("Expected a JSON object, array or literal.",He.Undefined)),new eb(L,t,o)}function Ff(r,e,t){if(r!==null&&typeof r=="object"){var n=e+" ";if(Array.isArray(r)){if(r.length===0)return"[]";for(var i=`[
|
|
215
215
|
`,s=0;s<r.length;s++)i+=n+Ff(r[s],n,t),s<r.length-1&&(i+=","),i+=`
|
|
216
216
|
`;return i+=e+"]",i}else{var o=Object.keys(r);if(o.length===0)return"{}";for(var i=`{
|
|
217
217
|
`,s=0;s<o.length;s++){var a=o[s];i+=n+JSON.stringify(a)+": "+Ff(r[a],n,t),s<o.length-1&&(i+=","),i+=`
|
|
218
|
-
`}return i+=e+"}",i}}return t(r)}function
|
|
218
|
+
`}return i+=e+"}",i}}return t(r)}function EP(r,e){if(r.length<e.length)return!1;for(var t=0;t<e.length;t++)if(r[t]!==e[t])return!1;return!0}function jf(r,e){var t=r.length-e.length;return t>0?r.lastIndexOf(e)===t:t===0?r===e:!1}function TP(r){return r.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function I3(r,e){for(var t="";e>0;)(e&1)===1&&(t+=r),r+=r,e=e>>>1;return t}var PP=[",","}","]"],MP=[":"],IP=function(){function r(e,t,n,i){t===void 0&&(t=[]),n===void 0&&(n=Promise),i===void 0&&(i={}),this.schemaService=e,this.contributions=t,this.promiseConstructor=n,this.clientCapabilities=i,this.templateVarIdCounter=0}return r.prototype.doResolve=function(e){for(var t=this.contributions.length-1;t>=0;t--)if(this.contributions[t].resolveCompletion){var n=this.contributions[t].resolveCompletion(e);if(n)return n}return this.promiseConstructor.resolve(e)},r.prototype.doComplete=function(e,t,n){var i=this,s={items:[],isIncomplete:!1},o=e.getText(),a=e.offsetAt(t),l=n.getNodeFromOffset(a,!0);if(this.isInComment(e,l?l.offset:0,a))return Promise.resolve(s);if(l&&a===l.offset+l.length&&a>0){var c=o[a-1];(l.type==="object"&&c==="}"||l.type==="array"&&c==="]")&&(l=l.parent)}var u=this.getCurrentWord(e,a),h=null;if(l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null"))h=Ue.create(e.positionAt(l.offset),e.positionAt(l.offset+l.length));else{var d=a-u.length;d>0&&o[d-1]==='"'&&d--,h=Ue.create(e.positionAt(d),t)}var p=this.doesSupportsCommitCharacters(),m={},y={add:function(w){var A=m[w.label];A?A.documentation||(A.documentation=w.documentation):(m[w.label]=w,h&&(w.textEdit=Fr.replace(h,w.insertText)),p&&(w.commitCharacters=w.kind===Ar.Property?MP:PP),s.items.push(w))},setAsIncomplete:function(){s.isIncomplete=!0},error:function(w){console.error(w)},log:function(w){console.log(w)},getNumberOfProposals:function(){return s.items.length}};return this.schemaService.getSchemaForResource(e.uri,n).then(function(w){var A=[],T=!0,P="",L=null;if(l&&l.type==="string"){var D=l.parent;D&&D.type==="property"&&D.keyNode===l&&(T=!D.valueNode,L=D,P=o.substr(l.offset+1,l.length-2),D&&(l=D.parent))}if(l&&l.type==="object"){if(l.offset===a)return s;var j=l.properties;j.forEach(function(H){(!L||L!==H)&&(m[H.keyNode.value]=Mf.create("__"))});var W="";T&&(W=i.evaluateSeparatorAfter(e,e.offsetAt(h.end))),w?i.getPropertyCompletions(w,n,l,T,W,y):i.getSchemaLessPropertyCompletions(n,l,P,y);var q=Bf(l);i.contributions.forEach(function(H){var Q=H.collectPropertyCompletions(e.uri,q,u,T,W==="",y);Q&&A.push(Q)}),!w&&u.length>0&&o.charAt(a-u.length-1)!=='"'&&(y.add({kind:Ar.Property,label:i.getLabelForValue(u),insertText:i.getInsertTextForProperty(u,null,!1,W),insertTextFormat:Mt.Snippet,documentation:""}),y.setAsIncomplete())}var F={};return w?i.getValueCompletions(w,n,l,a,e,y,F):i.getSchemaLessValueCompletions(n,l,a,e,y),i.contributions.length>0&&i.getContributedValueCompletions(n,l,a,e,y,A),i.promiseConstructor.all(A).then(function(){if(y.getNumberOfProposals()===0){var H=a;l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null")&&(H=l.offset+l.length);var Q=i.evaluateSeparatorAfter(e,H);i.addFillerValueCompletions(F,Q,y)}return s})})},r.prototype.getPropertyCompletions=function(e,t,n,i,s,o){var a=this,l=t.getMatchingSchemas(e.schema,n.offset);l.forEach(function(c){if(c.node===n&&!c.inverted){var u=c.schema.properties;u&&Object.keys(u).forEach(function(h){var d=u[h],p=!1;if(typeof d=="object"&&d.allOf)for(var m=0,y=d.allOf;m<y.length;m++){var w=y[m];if(w.readOnly){p=!0;break}}if(typeof d=="object"&&!d.deprecationMessage&&!d.doNotSuggest&&!p){var A={kind:Ar.Property,label:a.sanitizeLabel(h),insertText:a.getInsertTextForProperty(h,d,i,s),insertTextFormat:Mt.Snippet,filterText:a.getFilterTextForValue(h),documentation:a.fromMarkup(d.markdownDescription)||d.description||""};jf(A.insertText,"$1"+s)&&(A.command={title:"Suggest",command:"editor.action.triggerSuggest"}),o.add(A)}})}})},r.prototype.getSchemaLessPropertyCompletions=function(e,t,n,i){var s=this,o=function(l){l.properties.forEach(function(c){var u=c.keyNode.value;i.add({kind:Ar.Property,label:s.sanitizeLabel(u),insertText:s.getInsertTextForValue(u,""),insertTextFormat:Mt.Snippet,filterText:s.getFilterTextForValue(u),documentation:""})})};if(t.parent)if(t.parent.type==="property"){var a=t.parent.keyNode.value;e.visit(function(l){return l.type==="property"&&l!==t.parent&&l.keyNode.value===a&&l.valueNode&&l.valueNode.type==="object"&&o(l.valueNode),!0})}else t.parent.type==="array"&&t.parent.items.forEach(function(l){l.type==="object"&&l!==t&&o(l)});else t.type==="object"&&i.add({kind:Ar.Property,label:"$schema",insertText:this.getInsertTextForProperty("$schema",null,!0,""),insertTextFormat:Mt.Snippet,documentation:"",filterText:this.getFilterTextForValue("$schema")})},r.prototype.getSchemaLessValueCompletions=function(e,t,n,i,s){var o=this,a=n;if(t&&(t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(a=t.offset+t.length,t=t.parent),!t){s.add({kind:this.getSuggestionKind("object"),label:"Empty object",insertText:this.getInsertTextForValue({},""),insertTextFormat:Mt.Snippet,documentation:""}),s.add({kind:this.getSuggestionKind("array"),label:"Empty array",insertText:this.getInsertTextForValue([],""),insertTextFormat:Mt.Snippet,documentation:""});return}var l=this.evaluateSeparatorAfter(i,a),c=function(p){qy(p.parent,n,!0)||s.add({kind:o.getSuggestionKind(p.type),label:o.getLabelTextForMatchingNode(p,i),insertText:o.getInsertTextForMatchingNode(p,i,l),insertTextFormat:Mt.Snippet,documentation:""}),p.type==="boolean"&&o.addBooleanValueCompletion(!p.value,l,s)};if(t.type==="property"&&n>t.colonOffset){var u=t.valueNode;if(u&&(n>u.offset+u.length||u.type==="object"||u.type==="array"))return;var h=t.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===h&&p.valueNode&&c(p.valueNode),!0}),h==="$schema"&&t.parent&&!t.parent.parent&&this.addDollarSchemaCompletions(l,s)}if(t.type==="array")if(t.parent&&t.parent.type==="property"){var d=t.parent.keyNode.value;e.visit(function(p){return p.type==="property"&&p.keyNode.value===d&&p.valueNode&&p.valueNode.type==="array"&&p.valueNode.items.forEach(c),!0})}else t.items.forEach(c)},r.prototype.getValueCompletions=function(e,t,n,i,s,o,a){var l=this,c=i,u=null,h=null;if(n&&(n.type==="string"||n.type==="number"||n.type==="boolean"||n.type==="null")&&(c=n.offset+n.length,h=n,n=n.parent),!n){this.addSchemaValueCompletions(e.schema,"",o,a);return}if(n.type==="property"&&i>n.colonOffset){var d=n.valueNode;if(d&&i>d.offset+d.length)return;u=n.keyNode.value,n=n.parent}if(n&&(u!==null||n.type==="array")){var p=this.evaluateSeparatorAfter(s,c),m=t.getMatchingSchemas(e.schema,n.offset,h);m.forEach(function(y){if(y.node===n&&!y.inverted&&y.schema){if(n.type==="array"&&y.schema.items)if(Array.isArray(y.schema.items)){var w=l.findItemAtOffset(n,s,i);w<y.schema.items.length&&l.addSchemaValueCompletions(y.schema.items[w],p,o,a)}else l.addSchemaValueCompletions(y.schema.items,p,o,a);if(y.schema.properties){var A=y.schema.properties[u];A&&l.addSchemaValueCompletions(A,p,o,a)}}}),u==="$schema"&&!n.parent&&this.addDollarSchemaCompletions(p,o),a.boolean&&(this.addBooleanValueCompletion(!0,p,o),this.addBooleanValueCompletion(!1,p,o)),a.null&&this.addNullValueCompletion(p,o)}},r.prototype.getContributedValueCompletions=function(e,t,n,i,s,o){if(!t)this.contributions.forEach(function(u){var h=u.collectDefaultCompletions(i.uri,s);h&&o.push(h)});else if((t.type==="string"||t.type==="number"||t.type==="boolean"||t.type==="null")&&(t=t.parent),t.type==="property"&&n>t.colonOffset){var a=t.keyNode.value,l=t.valueNode;if(!l||n<=l.offset+l.length){var c=Bf(t.parent);this.contributions.forEach(function(u){var h=u.collectValueCompletions(i.uri,c,a,s);h&&o.push(h)})}}},r.prototype.addSchemaValueCompletions=function(e,t,n,i){var s=this;typeof e=="object"&&(this.addEnumValueCompletions(e,t,n),this.addDefaultValueCompletions(e,t,n),this.collectTypes(e,i),Array.isArray(e.allOf)&&e.allOf.forEach(function(o){return s.addSchemaValueCompletions(o,t,n,i)}),Array.isArray(e.anyOf)&&e.anyOf.forEach(function(o){return s.addSchemaValueCompletions(o,t,n,i)}),Array.isArray(e.oneOf)&&e.oneOf.forEach(function(o){return s.addSchemaValueCompletions(o,t,n,i)}))},r.prototype.addDefaultValueCompletions=function(e,t,n,i){var s=this;i===void 0&&(i=0);var o=!1;if(Tn(e.default)){for(var a=e.type,l=e.default,c=i;c>0;c--)l=[l],a="array";n.add({kind:this.getSuggestionKind(a),label:this.getLabelForValue(l),insertText:this.getInsertTextForValue(l,t),insertTextFormat:Mt.Snippet}),o=!0}Array.isArray(e.examples)&&e.examples.forEach(function(u){for(var h=e.type,d=u,p=i;p>0;p--)d=[d],h="array";n.add({kind:s.getSuggestionKind(h),label:s.getLabelForValue(d),insertText:s.getInsertTextForValue(d,t),insertTextFormat:Mt.Snippet}),o=!0}),Array.isArray(e.defaultSnippets)&&e.defaultSnippets.forEach(function(u){var h=e.type,d=u.body,p=u.label,m,y;if(Tn(d)){for(var w=e.type,A=i;A>0;A--)d=[d],w="array";m=s.getInsertTextForSnippetValue(d,t),y=s.getFilterTextForSnippetValue(d),p=p||s.getLabelForSnippetValue(d)}else if(typeof u.bodyText=="string"){for(var T="",P="",L="",A=i;A>0;A--)T=T+L+`[
|
|
219
219
|
`,P=P+`
|
|
220
220
|
`+L+"]",L+=" ",h="array";m=T+L+u.bodyText.split(`
|
|
221
221
|
`).join(`
|
|
222
222
|
`+L)+P+t,p=p||s.sanitizeLabel(m),y=m.replace(/[\n]/g,"")}n.add({kind:s.getSuggestionKind(h),label:p,documentation:s.fromMarkup(u.markdownDescription)||u.description,insertText:m,insertTextFormat:Mt.Snippet,filterText:y}),o=!0}),!o&&typeof e.items=="object"&&!Array.isArray(e.items)&&this.addDefaultValueCompletions(e.items,t,n,i+1)},r.prototype.addEnumValueCompletions=function(e,t,n){if(Tn(e.const)&&n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(e.const),insertText:this.getInsertTextForValue(e.const,t),insertTextFormat:Mt.Snippet,documentation:this.fromMarkup(e.markdownDescription)||e.description}),Array.isArray(e.enum))for(var i=0,s=e.enum.length;i<s;i++){var o=e.enum[i],a=this.fromMarkup(e.markdownDescription)||e.description;e.markdownEnumDescriptions&&i<e.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?a=this.fromMarkup(e.markdownEnumDescriptions[i]):e.enumDescriptions&&i<e.enumDescriptions.length&&(a=e.enumDescriptions[i]),n.add({kind:this.getSuggestionKind(e.type),label:this.getLabelForValue(o),insertText:this.getInsertTextForValue(o,t),insertTextFormat:Mt.Snippet,documentation:a})}},r.prototype.collectTypes=function(e,t){if(!(Array.isArray(e.enum)||Tn(e.const))){var n=e.type;Array.isArray(n)?n.forEach(function(i){return t[i]=!0}):t[n]=!0}},r.prototype.addFillerValueCompletions=function(e,t,n){e.object&&n.add({kind:this.getSuggestionKind("object"),label:"{}",insertText:this.getInsertTextForGuessedValue({},t),insertTextFormat:Mt.Snippet,detail:"New object",documentation:""}),e.array&&n.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],t),insertTextFormat:Mt.Snippet,detail:"New array",documentation:""})},r.prototype.addBooleanValueCompletion=function(e,t,n){n.add({kind:this.getSuggestionKind("boolean"),label:e?"true":"false",insertText:this.getInsertTextForValue(e,t),insertTextFormat:Mt.Snippet,documentation:""})},r.prototype.addNullValueCompletion=function(e,t){t.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+e,insertTextFormat:Mt.Snippet,documentation:""})},r.prototype.addDollarSchemaCompletions=function(e,t){var n=this,i=this.schemaService.getRegisteredSchemaIds(function(s){return s==="http"||s==="https"});i.forEach(function(s){return t.add({kind:Ar.Module,label:n.getLabelForValue(s),filterText:n.getFilterTextForValue(s),insertText:n.getInsertTextForValue(s,e),insertTextFormat:Mt.Snippet,documentation:""})})},r.prototype.sanitizeLabel=function(e){return e=e.replace(/[\n]/g,"\u21B5"),e.length>57&&(e=e.substr(0,57).trim()+"..."),e},r.prototype.getLabelForValue=function(e){return this.sanitizeLabel(JSON.stringify(e))},r.prototype.getFilterTextForValue=function(e){return JSON.stringify(e)},r.prototype.getFilterTextForSnippetValue=function(e){return JSON.stringify(e).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")},r.prototype.getLabelForSnippetValue=function(e){var t=JSON.stringify(e);return t=t.replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1"),this.sanitizeLabel(t)},r.prototype.getInsertTextForPlainText=function(e){return e.replace(/[\\\$\}]/g,"\\$&")},r.prototype.getInsertTextForValue=function(e,t){var n=JSON.stringify(e,null," ");return n==="{}"?"{$1}"+t:n==="[]"?"[$1]"+t:this.getInsertTextForPlainText(n+t)},r.prototype.getInsertTextForSnippetValue=function(e,t){var n=function(i){return typeof i=="string"&&i[0]==="^"?i.substr(1):JSON.stringify(i)};return Ff(e,"",n)+t},r.prototype.getInsertTextForGuessedValue=function(e,t){switch(typeof e){case"object":return e===null?"${1:null}"+t:this.getInsertTextForValue(e,t);case"string":var n=JSON.stringify(e);return n=n.substr(1,n.length-2),n=this.getInsertTextForPlainText(n),'"${1:'+n+'}"'+t;case"number":case"boolean":return"${1:"+JSON.stringify(e)+"}"+t}return this.getInsertTextForValue(e,t)},r.prototype.getSuggestionKind=function(e){if(Array.isArray(e)){var t=e;e=t.length>0?t[0]:null}if(!e)return Ar.Value;switch(e){case"string":return Ar.Value;case"object":return Ar.Module;case"property":return Ar.Property;default:return Ar.Value}},r.prototype.getLabelTextForMatchingNode=function(e,t){switch(e.type){case"array":return"[]";case"object":return"{}";default:var n=t.getText().substr(e.offset,e.length);return n}},r.prototype.getInsertTextForMatchingNode=function(e,t,n){switch(e.type){case"array":return this.getInsertTextForValue([],n);case"object":return this.getInsertTextForValue({},n);default:var i=t.getText().substr(e.offset,e.length)+n;return this.getInsertTextForPlainText(i)}},r.prototype.getInsertTextForProperty=function(e,t,n,i){var s=this.getInsertTextForValue(e,"");if(!n)return s;var o=s+": ",a,l=0;if(t){if(Array.isArray(t.defaultSnippets)){if(t.defaultSnippets.length===1){var c=t.defaultSnippets[0].body;Tn(c)&&(a=this.getInsertTextForSnippetValue(c,""))}l+=t.defaultSnippets.length}if(t.enum&&(!a&&t.enum.length===1&&(a=this.getInsertTextForGuessedValue(t.enum[0],"")),l+=t.enum.length),Tn(t.default)&&(a||(a=this.getInsertTextForGuessedValue(t.default,"")),l++),l===0){var u=Array.isArray(t.type)?t.type[0]:t.type;switch(u||(t.properties?u="object":t.items&&(u="array")),u){case"boolean":a="$1";break;case"string":a='"$1"';break;case"object":a="{$1}";break;case"array":a="[$1]";break;case"number":case"integer":a="${1:0}";break;case"null":a="${1:null}";break;default:return s}}}return(!a||l>1)&&(a="$1"),o+a+i},r.prototype.getCurrentWord=function(e,t){for(var n=t-1,i=e.getText();n>=0&&`
|
|
223
|
-
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,t)},r.prototype.evaluateSeparatorAfter=function(e,t){var n=bs(e.getText(),!0);n.setPosition(t);var i=n.scan();switch(i){case 5:case 2:case 4:case 17:return"";default:return","}},r.prototype.findItemAtOffset=function(e,t,n){for(var i=bs(t.getText(),!0),s=e.items,o=s.length-1;o>=0;o--){var a=s[o];if(n>a.offset+a.length){i.setPosition(a.offset+a.length);var l=i.scan();return l===5&&n>=i.getTokenOffset()+i.getTokenLength()?o+1:o}else if(n>=a.offset)return o}return 0},r.prototype.isInComment=function(e,t,n){var i=bs(e.getText(),!1);i.setPosition(t);for(var s=i.scan();s!==17&&i.getTokenOffset()+i.getTokenLength()<n;)s=i.scan();return(s===12||s===13)&&i.getTokenOffset()<=n},r.prototype.fromMarkup=function(e){if(e&&this.doesSupportMarkdown())return{kind:Ii.Markdown,value:e}},r.prototype.doesSupportMarkdown=function(){if(!Tn(this.supportsMarkdown)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsMarkdown=e&&e.completionItem&&Array.isArray(e.completionItem.documentationFormat)&&e.completionItem.documentationFormat.indexOf(Ii.Markdown)!==-1}return this.supportsMarkdown},r.prototype.doesSupportsCommitCharacters=function(){if(!Tn(this.supportsCommitCharacters)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsCommitCharacters=e&&e.completionItem&&!!e.completionItem.commitCharactersSupport}return this.supportsCommitCharacters},r}(),
|
|
223
|
+
\r\v":{[,]}`.indexOf(i.charAt(n))===-1;)n--;return i.substring(n+1,t)},r.prototype.evaluateSeparatorAfter=function(e,t){var n=bs(e.getText(),!0);n.setPosition(t);var i=n.scan();switch(i){case 5:case 2:case 4:case 17:return"";default:return","}},r.prototype.findItemAtOffset=function(e,t,n){for(var i=bs(t.getText(),!0),s=e.items,o=s.length-1;o>=0;o--){var a=s[o];if(n>a.offset+a.length){i.setPosition(a.offset+a.length);var l=i.scan();return l===5&&n>=i.getTokenOffset()+i.getTokenLength()?o+1:o}else if(n>=a.offset)return o}return 0},r.prototype.isInComment=function(e,t,n){var i=bs(e.getText(),!1);i.setPosition(t);for(var s=i.scan();s!==17&&i.getTokenOffset()+i.getTokenLength()<n;)s=i.scan();return(s===12||s===13)&&i.getTokenOffset()<=n},r.prototype.fromMarkup=function(e){if(e&&this.doesSupportMarkdown())return{kind:Ii.Markdown,value:e}},r.prototype.doesSupportMarkdown=function(){if(!Tn(this.supportsMarkdown)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsMarkdown=e&&e.completionItem&&Array.isArray(e.completionItem.documentationFormat)&&e.completionItem.documentationFormat.indexOf(Ii.Markdown)!==-1}return this.supportsMarkdown},r.prototype.doesSupportsCommitCharacters=function(){if(!Tn(this.supportsCommitCharacters)){var e=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsCommitCharacters=e&&e.completionItem&&!!e.completionItem.commitCharactersSupport}return this.supportsCommitCharacters},r}(),DP=function(){function r(e,t,n){t===void 0&&(t=[]),this.schemaService=e,this.contributions=t,this.promise=n||Promise}return r.prototype.doHover=function(e,t,n){var i=e.offsetAt(t),s=n.getNodeFromOffset(i);if(!s||(s.type==="object"||s.type==="array")&&i>s.offset+1&&i<s.offset+s.length-1)return this.promise.resolve(null);var o=s;if(s.type==="string"){var a=s.parent;if(a&&a.type==="property"&&a.keyNode===s&&(s=a.valueNode,!s))return this.promise.resolve(null)}for(var l=Ue.create(e.positionAt(o.offset),e.positionAt(o.offset+o.length)),c=function(m){var y={contents:m,range:l};return y},u=Bf(s),h=this.contributions.length-1;h>=0;h--){var d=this.contributions[h],p=d.getInfoContribution(e.uri,u);if(p)return p.then(function(m){return c(m)})}return this.schemaService.getSchemaForResource(e.uri,n).then(function(m){if(m){var y=n.getMatchingSchemas(m.schema,s.offset),w=null,A=null,T=null,P=null;y.every(function(D){if(D.node===s&&!D.inverted&&D.schema&&(w=w||D.schema.title,A=A||D.schema.markdownDescription||Vf(D.schema.description),D.schema.enum)){var j=D.schema.enum.indexOf(ni(s));D.schema.markdownEnumDescriptions?T=D.schema.markdownEnumDescriptions[j]:D.schema.enumDescriptions&&(T=Vf(D.schema.enumDescriptions[j])),T&&(P=D.schema.enum[j],typeof P!="string"&&(P=JSON.stringify(P)))}return!0});var L="";return w&&(L=Vf(w)),A&&(L.length>0&&(L+=`
|
|
224
224
|
|
|
225
225
|
`),L+=A),T&&(L.length>0&&(L+=`
|
|
226
226
|
|
|
227
|
-
`),L+="`"+
|
|
227
|
+
`),L+="`"+NP(P)+"`: "+T),c([L])}return null})},r}();function Vf(r){if(r){var e=r.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
|
|
228
228
|
|
|
229
|
-
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function DP(r){return r.indexOf("`")!==-1?"`` "+r+" ``":r}var NP=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vt,Fo;if(typeof process=="object")Fo=!1;else if(typeof navigator=="object"){var RP=navigator.userAgent;Fo=RP.indexOf("Windows")>=0}function I3(r){return 55296<=r&&r<=56319}function D3(r){return 56320<=r&&r<=57343}function N3(r){return r>=97&&r<=102}function LP(r){return r>=97&&r<=122}function BP(r){return r>=65&&r<=90}function R3(r){return LP(r)||BP(r)}var FP=/^\w[\w\d+.-]*$/,jP=/^\//,VP=/^\/\//;function WP(r,e){if(!r.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+r.authority+'", path: "'+r.path+'", query: "'+r.query+'", fragment: "'+r.fragment+'"}');if(r.scheme&&!FP.test(r.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(r.path){if(r.authority){if(!jP.test(r.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(VP.test(r.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function $P(r,e){return!r&&!e?"file":r}function HP(r,e){switch(r){case"https":case"http":case"file":e?e[0]!==Gr&&(e=Gr+e):e=Gr;break}return e}var et="",Gr="/",zP=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,Wf=function(){function r(e,t,n,i,s,o){o===void 0&&(o=!1),typeof e=="object"?(this.scheme=e.scheme||et,this.authority=e.authority||et,this.path=e.path||et,this.query=e.query||et,this.fragment=e.fragment||et):(this.scheme=$P(e,o),this.authority=t||et,this.path=HP(this.scheme,n||et),this.query=i||et,this.fragment=s||et,WP(this,o))}return r.isUri=function(e){return e instanceof r?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="function"&&typeof e.with=="function"&&typeof e.toString=="function":!1},Object.defineProperty(r.prototype,"fsPath",{get:function(){return ib(this,!1)},enumerable:!0,configurable:!0}),r.prototype.with=function(e){if(!e)return this;var t=e.scheme,n=e.authority,i=e.path,s=e.query,o=e.fragment;return t===void 0?t=this.scheme:t===null&&(t=et),n===void 0?n=this.authority:n===null&&(n=et),i===void 0?i=this.path:i===null&&(i=et),s===void 0?s=this.query:s===null&&(s=et),o===void 0?o=this.fragment:o===null&&(o=et),t===this.scheme&&n===this.authority&&i===this.path&&s===this.query&&o===this.fragment?this:new ks(t,n,i,s,o)},r.parse=function(e,t){t===void 0&&(t=!1);var n=zP.exec(e);return n?new ks(n[2]||et,Wl(n[4]||et),Wl(n[5]||et),Wl(n[7]||et),Wl(n[9]||et),t):new ks(et,et,et,et,et)},r.file=function(e){var t=et;if(Fo&&(e=e.replace(/\\/g,Gr)),e[0]===Gr&&e[1]===Gr){var n=e.indexOf(Gr,2);n===-1?(t=e.substring(2),e=Gr):(t=e.substring(2,n),e=e.substring(n)||Gr)}return new ks("file",t,e,et,et)},r.from=function(e){return new ks(e.scheme,e.authority,e.path,e.query,e.fragment)},r.prototype.toString=function(e){return e===void 0&&(e=!1),$f(this,e)},r.prototype.toJSON=function(){return this},r.revive=function(e){if(e){if(e instanceof r)return e;var t=new ks(e);return t._formatted=e.external,t._fsPath=e._sep===tb?e.fsPath:null,t}else return e},r}(),tb=Fo?1:void 0,ks=function(r){NP(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._formatted=null,t._fsPath=null,t}return Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=ib(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){return t===void 0&&(t=!1),t?$f(this,!0):(this._formatted||(this._formatted=$f(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=tb),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(Wf),rb=(vt={},vt[58]="%3A",vt[47]="%2F",vt[63]="%3F",vt[35]="%23",vt[91]="%5B",vt[93]="%5D",vt[64]="%40",vt[33]="%21",vt[36]="%24",vt[38]="%26",vt[39]="%27",vt[40]="%28",vt[41]="%29",vt[42]="%2A",vt[43]="%2B",vt[44]="%2C",vt[59]="%3B",vt[61]="%3D",vt[32]="%20",vt);function nb(r,e){for(var t=void 0,n=-1,i=0;i<r.length;i++){var s=r.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||e&&s===47)n!==-1&&(t+=encodeURIComponent(r.substring(n,i)),n=-1),t!==void 0&&(t+=r.charAt(i));else{t===void 0&&(t=r.substr(0,i));var o=rb[s];o!==void 0?(n!==-1&&(t+=encodeURIComponent(r.substring(n,i)),n=-1),t+=o):n===-1&&(n=i)}}return n!==-1&&(t+=encodeURIComponent(r.substring(n))),t!==void 0?t:r}function UP(r){for(var e=void 0,t=0;t<r.length;t++){var n=r.charCodeAt(t);n===35||n===63?(e===void 0&&(e=r.substr(0,t)),e+=rb[n]):e!==void 0&&(e+=r[t])}return e!==void 0?e:r}function ib(r,e){var t;return r.authority&&r.path.length>1&&r.scheme==="file"?t="//"+r.authority+r.path:r.path.charCodeAt(0)===47&&(r.path.charCodeAt(1)>=65&&r.path.charCodeAt(1)<=90||r.path.charCodeAt(1)>=97&&r.path.charCodeAt(1)<=122)&&r.path.charCodeAt(2)===58?e?t=r.path.substr(1):t=r.path[1].toLowerCase()+r.path.substr(2):t=r.path,Fo&&(t=t.replace(/\//g,"\\")),t}function $f(r,e){var t=e?UP:nb,n="",i=r.scheme,s=r.authority,o=r.path,a=r.query,l=r.fragment;if(i&&(n+=i,n+=":"),(s||i==="file")&&(n+=Gr,n+=Gr),s){var c=s.indexOf("@");if(c!==-1){var u=s.substr(0,c);s=s.substr(c+1),c=u.indexOf(":"),c===-1?n+=t(u,!1):(n+=t(u.substr(0,c),!1),n+=":",n+=t(u.substr(c+1),!1)),n+="@"}s=s.toLowerCase(),c=s.indexOf(":"),c===-1?n+=t(s,!1):(n+=t(s.substr(0,c),!1),n+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){var h=o.charCodeAt(1);h>=65&&h<=90&&(o="/"+String.fromCharCode(h+32)+":"+o.substr(3))}else if(o.length>=2&&o.charCodeAt(1)===58){var h=o.charCodeAt(0);h>=65&&h<=90&&(o=String.fromCharCode(h+32)+":"+o.substr(2))}n+=t(o,!0)}return a&&(n+="?",n+=t(a,!1)),l&&(n+="#",n+=e?l:nb(l,!1)),n}function sb(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+sb(r.substr(3)):r}}var ob=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Wl(r){return r.match(ob)?r.replace(ob,function(e){return sb(e)}):r}var GP=function(){function r(e){try{this.patternRegExp=new RegExp(EP(e)+"$")}catch{this.patternRegExp=null}this.schemas=[]}return r.prototype.addSchema=function(e){this.schemas.push(e)},r.prototype.matchesPattern=function(e){return this.patternRegExp&&this.patternRegExp.test(e)},r.prototype.getSchemas=function(){return this.schemas},r}(),KP=function(){function r(e,t,n){this.service=e,this.url=t,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new As(n)))}return r.prototype.getUnresolvedSchema=function(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.url)),this.unresolvedSchema},r.prototype.getResolvedSchema=function(){var e=this;return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(function(t){return e.service.resolveSchemaContent(t,e.url,e.dependencies)})),this.resolvedSchema},r.prototype.clearSchema=function(){this.resolvedSchema=null,this.unresolvedSchema=null,this.dependencies={}},r}(),As=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r}(),ab=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r.prototype.getSection=function(e){return cr(this.getSectionRecursive(e,this.schema))},r.prototype.getSectionRecursive=function(e,t){if(!t||typeof t=="boolean"||e.length===0)return t;var n=e.shift();if(t.properties&&typeof t.properties[n])return this.getSectionRecursive(e,t.properties[n]);if(t.patternProperties)for(var i=0,s=Object.keys(t.patternProperties);i<s.length;i++){var o=s[i],a=new RegExp(o);if(a.test(n))return this.getSectionRecursive(e,t.patternProperties[o])}else{if(typeof t.additionalProperties=="object")return this.getSectionRecursive(e,t.additionalProperties);if(n.match("[0-9]+")){if(Array.isArray(t.items)){var l=parseInt(n,10);if(!isNaN(l)&&t.items[l])return this.getSectionRecursive(e,t.items[l])}else if(t.items)return this.getSectionRecursive(e,t.items)}}return null},r}(),YP=function(){function r(e,t,n){this.contextService=t,this.requestService=e,this.promiseConstructor=n||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations={},this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={}}return r.prototype.getRegisteredSchemaIds=function(e){return Object.keys(this.registeredSchemasIds).filter(function(t){var n=Wf.parse(t).scheme;return n!=="schemaservice"&&(!e||e(n))})},Object.defineProperty(r.prototype,"promise",{get:function(){return this.promiseConstructor},enumerable:!0,configurable:!0}),r.prototype.dispose=function(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()},r.prototype.onResourceChange=function(e){var t=this,n=!1;e=this.normalizeId(e);for(var i=[e],s=Object.keys(this.schemasById).map(function(c){return t.schemasById[c]});i.length;)for(var o=i.pop(),a=0;a<s.length;a++){var l=s[a];l&&(l.url===o||l.dependencies[o])&&(l.url!==o&&i.push(l.url),l.clearSchema(),s[a]=void 0,n=!0)}return n},r.prototype.normalizeId=function(e){try{return Wf.parse(e).toString()}catch{return e}},r.prototype.setSchemaContributions=function(e){if(e.schemas){var t=e.schemas;for(var n in t){var i=this.normalizeId(n);this.contributionSchemas[i]=this.addSchemaHandle(i,t[n])}}if(e.schemaAssociations){var s=e.schemaAssociations;for(var o in s){var a=s[o];this.contributionAssociations[o]=a;for(var l=this.getOrAddFilePatternAssociation(o),c=0,u=a;c<u.length;c++){var h=u[c],n=this.normalizeId(h);l.addSchema(n)}}}},r.prototype.addSchemaHandle=function(e,t){var n=new KP(this,e,t);return this.schemasById[e]=n,n},r.prototype.getOrAddSchemaHandle=function(e,t){return this.schemasById[e]||this.addSchemaHandle(e,t)},r.prototype.getOrAddFilePatternAssociation=function(e){var t=this.filePatternAssociationById[e];return t||(t=new GP(e),this.filePatternAssociationById[e]=t,this.filePatternAssociations.push(t)),t},r.prototype.registerExternalSchema=function(e,t,n){t===void 0&&(t=null);var i=this.normalizeId(e);if(this.registeredSchemasIds[i]=!0,t)for(var s=0,o=t;s<o.length;s++){var a=o[s];this.getOrAddFilePatternAssociation(a).addSchema(i)}return n?this.addSchemaHandle(i,n):this.getOrAddSchemaHandle(i)},r.prototype.clearExternalSchemas=function(){this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={};for(var e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(var t in this.contributionAssociations)for(var n=this.getOrAddFilePatternAssociation(t),i=0,s=this.contributionAssociations[t];i<s.length;i++){var o=s[i],e=this.normalizeId(o);n.addSchema(e)}},r.prototype.getResolvedSchema=function(e){var t=this.normalizeId(e),n=this.schemasById[t];return n?n.getResolvedSchema():this.promise.resolve(null)},r.prototype.loadSchema=function(e){if(!this.requestService){var t="Unable to load schema from '"+$l(e)+"'. No schema request service available";return this.promise.resolve(new As({},[t]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+$l(e)+"': No content.";return new As({},[i])}var s={},o=[];s=lP(n,o);var a=o.length?["Unable to parse content from '"+$l(e)+"': Parse error at offset "+o[0].offset]:[];return new As(s,a)},function(n){var i="Unable to load schema from '"+$l(e)+"': "+n.toString();return new As({},[i])})},r.prototype.resolveSchemaContent=function(e,t,n){var i=this,s=e.errors.slice(0),o=e.schema;if(o.$schema){var a=this.normalizeId(o.$schema);if(a==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new ab({},["Draft-03 schemas are not supported."]));a==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var l=this.contextService,c=function(p,m){if(!m)return p;var y=p;return m[0]==="/"&&(m=m.substr(1)),m.split("/").some(function(w){return y=y[w],!y}),y},u=function(p,m,y,w){var A=c(m,w);if(A)for(var T in A)A.hasOwnProperty(T)&&!p.hasOwnProperty(T)&&(p[T]=A[T]);else s.push("$ref '"+w+"' in '"+y+"' can not be resolved.")},h=function(p,m,y,w,A){l&&!/^\w+:\/\/.*/.test(m)&&(m=l.resolveRelativePath(m,w)),m=i.normalizeId(m);var T=i.getOrAddSchemaHandle(m);return T.getUnresolvedSchema().then(function(P){if(A[m]=!0,P.errors.length){var L=y?m+"#"+y:m;s.push("Problems loading reference '"+L+"': "+P.errors[0]+".")}return u(p,P.schema,m,y),d(p,P.schema,m,T.dependencies)})},d=function(p,m,y,w){if(!p||typeof p!="object")return Promise.resolve(null);for(var A=[p],T=[],P=[],L=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];typeof fe=="object"&&A.push(fe)}},D=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];if(typeof fe=="object")for(var be in fe){var ke=fe[be];typeof ke=="object"&&A.push(ke)}}},j=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];if(Array.isArray(fe))for(var be=0,ke=fe;be<ke.length;be++){var Re=ke[be];typeof Re=="object"&&A.push(Re)}}},W=function(F){for(var H=[];F.$ref;){var Q=F.$ref,oe=Q.split("#",2);if(delete F.$ref,oe[0].length>0){P.push(h(F,oe[0],oe[1],y,w));return}else H.indexOf(Q)===-1&&(u(F,m,y,oe[1]),H.push(Q))}L(F.items,F.additionalProperties,F.not,F.contains,F.propertyNames,F.if,F.then,F.else),D(F.definitions,F.properties,F.patternProperties,F.dependencies),j(F.anyOf,F.allOf,F.oneOf,F.items)};A.length;){var q=A.pop();T.indexOf(q)>=0||(T.push(q),W(q))}return i.promise.all(P)};return d(o,o,t,n).then(function(p){return new ab(o,s)})},r.prototype.getSchemaForResource=function(e,t){if(t&&t.root&&t.root.type==="object"){var n=t.root.properties.filter(function(m){return m.keyNode.value==="$schema"&&m.valueNode&&m.valueNode.type==="string"});if(n.length>0){var i=ni(n[0].valueNode);if(i&&OP(i,".")&&this.contextService&&(i=this.contextService.resolveRelativePath(i,e)),i){var s=this.normalizeId(i);return this.getOrAddSchemaHandle(s).getResolvedSchema()}}}for(var o=Object.create(null),a=[],l=0,c=this.filePatternAssociations;l<c.length;l++){var u=c[l];if(u.matchesPattern(e))for(var h=0,d=u.getSchemas();h<d.length;h++){var p=d[h];o[p]||(a.push(p),o[p]=!0)}}return a.length>0?this.createCombinedSchema(e,a).getResolvedSchema():this.promise.resolve(null)},r.prototype.createCombinedSchema=function(e,t){if(t.length===1)return this.getOrAddSchemaHandle(t[0]);var n="schemaservice://combinedSchema/"+encodeURIComponent(e),i={allOf:t.map(function(s){return{$ref:s}})};return this.addSchemaHandle(n,i)},r}();function $l(r){try{}catch{}return r}var JP=function(){function r(e,t){this.jsonSchemaService=e,this.promise=t,this.validationEnabled=!0}return r.prototype.configure=function(e){e&&(this.validationEnabled=e.validate,this.commentSeverity=e.allowComments?void 0:Ie.Error)},r.prototype.doValidation=function(e,t,n,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var o=[],a={},l=function(h){var d=h.range.start.line+" "+h.range.start.character+" "+h.message;a[d]||(a[d]=!0,o.push(h))},c=function(h){var d=n?ub(n.trailingCommas):Ie.Error,p=n?ub(n.comments):s.commentSeverity;if(h){if(h.errors.length&&t.root){var m=t.root,y=m.type==="object"?m.properties[0]:null;if(y&&y.keyNode.value==="$schema"){var w=y.valueNode||y,A=Ue.create(e.positionAt(w.offset),e.positionAt(w.offset+w.length));l(Pn.create(A,h.errors[0],Ie.Warning,He.SchemaResolveError))}else{var A=Ue.create(e.positionAt(m.offset),e.positionAt(m.offset+1));l(Pn.create(A,h.errors[0],Ie.Warning,He.SchemaResolveError))}}else{var T=t.validate(e,h.schema);T&&T.forEach(l)}lb(h.schema)&&(p=void 0),cb(h.schema)&&(d=void 0)}for(var P=0,L=t.syntaxErrors;P<L.length;P++){var D=L[P];if(D.code===He.TrailingComma){if(typeof d!="number")continue;D.severity=d}l(D)}if(typeof p=="number"){var j="Comments are not permitted in JSON.";t.comments.forEach(function(W){l(Pn.create(W,j,p,He.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+QP++;return this.jsonSchemaService.resolveSchemaContent(new As(i),u,{}).then(function(h){return c(h)})}return this.jsonSchemaService.getSchemaForResource(e.uri,t).then(function(h){return c(h)})},r}(),QP=0;function lb(r){if(r&&typeof r=="object"){if(gn(r.allowComments))return r.allowComments;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=lb(n);if(gn(i))return i}}}function cb(r){if(r&&typeof r=="object"){if(gn(r.allowTrailingCommas))return r.allowTrailingCommas;if(gn(r.allowsTrailingCommas))return r.allowsTrailingCommas;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=cb(n);if(gn(i))return i}}}function ub(r){switch(r){case"error":return Ie.Error;case"warning":return Ie.Warning;case"ignore":return}}var fb=48,XP=57,ZP=65,Hl=97,_P=102;function yt(r){return r<fb?0:r<=XP?r-fb:(r<Hl&&(r+=Hl-ZP),r>=Hl&&r<=_P?r-Hl+10:0)}function qP(r){if(r[0]!=="#")return null;switch(r.length){case 4:return{red:yt(r.charCodeAt(1))*17/255,green:yt(r.charCodeAt(2))*17/255,blue:yt(r.charCodeAt(3))*17/255,alpha:1};case 5:return{red:yt(r.charCodeAt(1))*17/255,green:yt(r.charCodeAt(2))*17/255,blue:yt(r.charCodeAt(3))*17/255,alpha:yt(r.charCodeAt(4))*17/255};case 7:return{red:(yt(r.charCodeAt(1))*16+yt(r.charCodeAt(2)))/255,green:(yt(r.charCodeAt(3))*16+yt(r.charCodeAt(4)))/255,blue:(yt(r.charCodeAt(5))*16+yt(r.charCodeAt(6)))/255,alpha:1};case 9:return{red:(yt(r.charCodeAt(1))*16+yt(r.charCodeAt(2)))/255,green:(yt(r.charCodeAt(3))*16+yt(r.charCodeAt(4)))/255,blue:(yt(r.charCodeAt(5))*16+yt(r.charCodeAt(6)))/255,alpha:(yt(r.charCodeAt(7))*16+yt(r.charCodeAt(8)))/255}}return null}function L3(r,e,t,n){return n===void 0&&(n=1),{red:r/255,green:e/255,blue:t/255,alpha:n}}var eM=function(){function r(e){this.schemaService=e}return r.prototype.findDocumentSymbols=function(e,t,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=t.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||jf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=xs.create(e.uri,ii(e,h));if(l.push({name:ni(m.valueNode),kind:mn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var w=function(T,P,L){return o>=0&&(P.type==="array"?P.items.forEach(function(D){return w(T,D,L)}):P.type==="object"&&P.properties.forEach(function(D){if(o>=0){var j=D.valueNode;if(j){o--;var W=xs.create(e.uri,ii(e,D)),q=L?L+"."+D.keyNode.value:D.keyNode.value;T.push({name:i.getKeyLabel(D),kind:i.getSymbolKind(j.type),location:W,containerName:L}),w(T,j,q)}}})),T},A=w([],s,void 0);return o<0&&(A.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),A},r.prototype.findDocumentSymbols2=function(e,t,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=t.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||jf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=ii(e,h),w=ii(e,m.keyNode);if(l.push({name:ni(m.valueNode),kind:mn.Function,range:y,selectionRange:w}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var A=function(P,L){return o>=0&&(L.type==="array"?L.items.forEach(function(D,j){if(D&&o>=0){o--;var W=ii(e,D),q=W,F=String(j),H=A([],D);P.push({name:F,kind:i.getSymbolKind(D.type),range:W,selectionRange:q,children:H})}}):L.type==="object"&&L.properties.forEach(function(D){var j=D.valueNode;if(j&&o>=0){o--;var W=ii(e,D),q=ii(e,D.keyNode),F=A([],j);P.push({name:i.getKeyLabel(D),kind:i.getSymbolKind(j.type),range:W,selectionRange:q,children:F})}})),P},T=A([],s);return o<0&&(T.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),T},r.prototype.getSymbolKind=function(e){switch(e){case"object":return mn.Module;case"string":return mn.String;case"number":return mn.Number;case"array":return mn.Array;case"boolean":return mn.Boolean;default:return mn.Variable}},r.prototype.getKeyLabel=function(e){var t=e.keyNode.value;return t&&(t=t.replace(/[\n]/g,"\u21B5")),t&&t.trim()?t:'"'+t+'"'},r.prototype.findDocumentColors=function(e,t,n){return this.schemaService.getSchemaForResource(e.uri,t).then(function(i){var s=[];if(i)for(var o=n&&typeof n.resultLimit=="number"?n.resultLimit:Number.MAX_VALUE,a=t.getMatchingSchemas(i.schema),l={},c=0,u=a;c<u.length;c++){var h=u[c];if(!h.inverted&&h.schema&&(h.schema.format==="color"||h.schema.format==="color-hex")&&h.node&&h.node.type==="string"){var d=String(h.node.offset);if(!l[d]){var p=qP(ni(h.node));if(p){var m=ii(e,h.node);s.push({color:p,range:m})}if(l[d]=!0,o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(e.uri),s}}}return s})},r.prototype.getColorPresentations=function(e,t,n,i){var s=[],o=Math.round(n.red*255),a=Math.round(n.green*255),l=Math.round(n.blue*255);function c(h){var d=h.toString(16);return d.length!==2?"0"+d:d}var u;return n.alpha===1?u="#"+c(o)+c(a)+c(l):u="#"+c(o)+c(a)+c(l)+c(Math.round(n.alpha*255)),s.push({label:u,textEdit:Fr.replace(i,JSON.stringify(u))}),s},r}();function ii(r,e){return Ue.create(r.positionAt(e.offset),r.positionAt(e.offset+e.length))}var tM={schemaAssociations:{},schemas:{}};function rM(r,e){var t=[],n=[],i=[],s=-1,o=bs(r.getText(),!1),a=o.scan();function l(H){t.push(H),n.push(i.length)}for(;a!==17;){switch(a){case 1:case 3:{var c=r.positionAt(o.getTokenOffset()).line,u={startLine:c,endLine:c,kind:a===1?"object":"array"};i.push(u);break}case 2:case 4:{var h=a===2?"object":"array";if(i.length>0&&i[i.length-1].kind===h){var u=i.pop(),d=r.positionAt(o.getTokenOffset()).line;u&&d>u.startLine+1&&s!==u.startLine&&(u.endLine=d-1,l(u),s=u.startLine)}break}case 13:{var c=r.positionAt(o.getTokenOffset()).line,p=r.positionAt(o.getTokenOffset()+o.getTokenLength()).line;o.getTokenError()===1&&c+1<r.lineCount?o.setPosition(r.offsetAt(Br.create(c+1,0))):c<p&&(l({startLine:c,endLine:p,kind:Do.Comment}),s=c);break}case 12:{var m=r.getText().substr(o.getTokenOffset(),o.getTokenLength()),y=m.match(/^\/\/\s*#(region\b)|(endregion\b)/);if(y){var d=r.positionAt(o.getTokenOffset()).line;if(y[1]){var u={startLine:d,endLine:d,kind:Do.Region};i.push(u)}else{for(var w=i.length-1;w>=0&&i[w].kind!==Do.Region;)w--;if(w>=0){var u=i[w];i.length=w,d>u.startLine&&s!==u.startLine&&(u.endLine=d,l(u),s=u.startLine)}}}break}}a=o.scan()}var A=e&&e.rangeLimit;if(typeof A!="number"||t.length<=A)return t;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(r.uri);for(var T=[],P=0,L=n;P<L.length;P++){var D=L[P];D<30&&(T[D]=(T[D]||0)+1)}for(var j=0,W=0,w=0;w<T.length;w++){var q=T[w];if(q){if(q+j>A){W=w;break}j+=q}}for(var F=[],w=0;w<t.length;w++){var D=n[w];typeof D=="number"&&(D<W||D===W&&j++<A)&&F.push(t[w])}return F}function nM(r,e,t){function n(a){for(var l=r.offsetAt(a),c=t.getNodeFromOffset(l,!0),u=[];c;){switch(c.type){case"string":case"object":case"array":var h=c.offset+1,d=c.offset+c.length-1;h<d&&l>=h&&l<=d&&u.push(i(h,d)),u.push(i(c.offset,c.offset+c.length));break;case"number":case"boolean":case"null":case"property":u.push(i(c.offset,c.offset+c.length));break}if(c.type==="property"||c.parent&&c.parent.type==="array"){var p=o(c.offset+c.length,5);p!==-1&&u.push(i(c.offset,p))}c=c.parent}for(var m=void 0,y=u.length-1;y>=0;y--)m=Vl.create(u[y],m);return m||(m=Vl.create(Ue.create(a,a))),m}function i(a,l){return Ue.create(r.positionAt(a),r.positionAt(l))}var s=bs(r.getText(),!0);function o(a,l){s.setPosition(a);var c=s.scan();return c===l?s.getTokenOffset()+s.getTokenLength():-1}return e.map(n)}function iM(r){var e=r.promiseConstructor||Promise,t=new YP(r.schemaRequestService,r.workspaceContext,e);t.setSchemaContributions(tM);var n=new MP(t,r.contributions,e,r.clientCapabilities),i=new IP(t,r.contributions,e),s=new eM(t),o=new JP(t,e);return{configure:function(a){t.clearExternalSchemas(),a.schemas&&a.schemas.forEach(function(l){t.registerExternalSchema(l.uri,l.fileMatch,l.schema)}),o.configure(a)},resetSchema:function(a){return t.onResourceChange(a)},doValidation:o.doValidation.bind(o),parseJSONDocument:function(a){return CP(a,{collectComments:!0})},newJSONDocument:function(a,l){return AP(a,l)},doComplete:n.doComplete.bind(n),findDocumentSymbols:s.findDocumentSymbols.bind(s),findDocumentSymbols2:s.findDocumentSymbols2.bind(s),findColorSymbols:function(a,l){return s.findDocumentColors(a,l).then(function(c){return c.map(function(u){return u.range})})},findDocumentColors:s.findDocumentColors.bind(s),getColorPresentations:s.getColorPresentations.bind(s),doHover:i.doHover.bind(i),getFoldingRanges:rM,getSelectionRanges:nM,format:function(a,l,c){var u=void 0;if(l){var h=a.offsetAt(l.start),d=a.offsetAt(l.end)-h;u={offset:h,length:d}}var p={tabSize:c?c.tabSize:4,insertSpaces:c?c.insertSpaces:!0,eol:`
|
|
230
|
-
`};return
|
|
231
|
-
`);let i=0;for(let s=0;s<e-1;s++)i+=n[s].length+1;return i+=t,i}const cM=({onChange:r,onBlur:e,id:t,schema:n,fieldName:i,validate:s,defaultValue:o,mode:a})=>{const{setValue:l,control:c,setError:u,clearErrors:h,getFieldState:d}=(0,gt.Gc)(),p=(0,S.useCallback)(A=>{const{error:T}=d(i);A&&!T?u(i,{message:A}):T&&h(i)},[h,i,d,u]),m=(0,S.useCallback)(A=>{l(i,A),r?.(A)},[i,r,l]),y=(0,S.useCallback)(A=>{e?.(A)},[e]),w=(0,S.useMemo)(()=>[HO(),aM({id:t,schema:n,handleErrors:p})],[p,t,n]);return S.createElement(gt.Qr,{control:c,name:i,rules:{validate:s},defaultValue:o,render:({field:{value:A,ref:T}})=>S.createElement(JT,{ref:T,className:"codemirror-container",value:A||"",onChange:m,onBlur:y,lang:a||ia.Tr.JSON,theme:oM("light"),extensions:w,basicSetup:{bracketMatching:!0,closeBrackets:!0,tabSize:2,foldGutter:!1,lineNumbers:!1,lintKeymap:!0,drawSelection:!1}})})},uM=(0,S.memo)(cM);var zf=f(91582);function fM({mediaType:r,mediaContent:e,properties:t,id:n,resolvedBody:i,getActiveSample:s,validate:o}){const{setValue:a}=(0,gt.Gc)(),l=(0,zf.yN)(e),c=r.examples||{},u=Object.keys(c),h=r.schema,d=Qh(h||{},r.name)||r.name===ia.Tr.MULTIPART||r.name===ia.Tr.URL_ENCODED,{exampleKey:p}=(0,hc.C6)(r.operation,c),m=(0,Ee.YQ)((0,je.P6)(n,r.name,p,c))||(0,je.oY)(c[p],t),y=(0,S.useCallback)((P="",L="",D=[])=>j=>{(0,Ee.WW)((0,je.P6)(n,P,L,D),j)},[n]),w=(0,S.useCallback)(P=>{l?.(P),a("body",s(P))},[a,s,l]),A=(0,S.useCallback)((P,L)=>{a(`body.${P}`,L)},[a]),T=(0,S.useMemo)(()=>(i?.content[r.name]||{}).schema,[r.name,i?.content]);return S.createElement(S.Fragment,null,u.length&&u.length!==1&&S.createElement(hc.b_,{examples:c,onChange:w,exampleKey:p,panel:"try-it"})||null,d?S.createElement(kS,{mediaType:r,onChange:A}):S.createElement(uM,{id:"body"+n,fieldName:"body",defaultValue:m,schema:T,mode:r.name,validate:o,onChange:y(r.name,p,c)}))}const hM=(0,S.memo)(fM);var dM=f(60821),pM=Object.defineProperty,gM=Object.defineProperties,mM=Object.getOwnPropertyDescriptors,hb=Object.getOwnPropertySymbols,vM=Object.prototype.hasOwnProperty,yM=Object.prototype.propertyIsEnumerable,db=(r,e,t)=>e in r?pM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,bM=(r,e)=>{for(var t in e||(e={}))vM.call(e,t)&&db(r,t,e[t]);if(hb)for(var t of hb(e))yM.call(e,t)&&db(r,t,e[t]);return r},xM=(r,e)=>gM(r,mM(e));function wM({body:{content:r},resolvedBody:e,properties:t,mergeExampleBody:n,id:i,validate:s,pointer:o}){const{setValue:a}=(0,gt.Gc)(),l=(0,$r.Dv)(dM.J8),{examples:c,name:u}=r&&(0,Xr.getActiveMediaType)(r,l)||{},h=(0,S.useCallback)(m=>{if(!r||!r.hasSample||!c?.[m])return"";const y=u&&(0,Ee.YQ)((0,je.P6)(i,u,m,c)),w=y?JSON.parse(y):c?.[m];return(0,je.oY)(w,t)},[u,c,i,r,t]),{activeExampleName:d}=(0,$r.Dv)((0,dc.N)(o));(0,S.useEffect)(()=>{if(t&&!n){a("body",JSON.stringify(t||{},null,2));return}const m=(0,je.P6)(i,u,d,c),y=(0,Ee.YQ)(m)||h(d||"");a("body",typeof y=="object"?JSON.stringify(y,null,2):y)},[c,d,u,a,h,i,t,n]);const p=m=>S.createElement(cS.C,xM(bM({},m),{variant:"dark",fullWidth:!0,Label:hS,Dropdown:fS.Lt}));return S.createElement(S.Fragment,null,S.createElement(uS.d,{content:r,renderDropdown:p},m=>S.createElement(hM,{mediaType:m,mediaContent:r,resolvedBody:e,id:i,properties:t,getActiveSample:h,validate:s})))}const SM=(0,S.memo)(wM),kM=({paramEnum:r,fieldName:e,defaultValue:t})=>{const{control:n,setValue:i}=(0,gt.Gc)(),s=r.map((l,c)=>({idx:c,value:l})),o=l=>{i(e,l.value)},a=()=>{i(e,"")};return S.createElement(gt.Qr,{control:n,name:e,defaultValue:Array.isArray(t)?t[0]:t,render:({field:{value:l}})=>S.createElement(Mr.VD,{clearable:!0,fullWidth:!0,variant:"dark",value:l,options:s,handleClear:a,onChange:o})})},AM=(0,S.memo)(kM),CM=({name:r,param:e,place:t,renderParameter:n})=>{var i,s,o,a,l;const[c,u]=S.useState([]),h=()=>{u([...c,c.length?c[c.length-1]+1:0])},d=m=>{u(c.filter(y=>y!==m))},p=(i=e.schema.items)!=null&&i.fields?(s=e.schema.items)==null?void 0:s.fields:[{schema:((o=e.schema.items)==null?void 0:o.schema)||e.schema.items,name:"",required:e.required,description:(a=e.schema.items)==null?void 0:a.description,externalDocs:(l=e.schema.items)==null?void 0:l.externalDocs,deprecated:!1,toggle:()=>null,expanded:!1}];return S.createElement(S.Fragment,null,S.createElement(pb,null,S.createElement(ve.lX,{required:e.required},r,"(",c.length," items)"),S.createElement("span",{onClick:h},"Add item +")),c?.map((m,y)=>S.createElement(pb,{key:m},p.map(w=>n(w,t,`${r}.[${m}]`,`[${y}]${w.name&&"."+w.name}`,S.createElement(OM,{onClick:()=>d(m)},"Delete"))))))},pb=Je.ZP.div`
|
|
229
|
+
$3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function NP(r){return r.indexOf("`")!==-1?"`` "+r+" ``":r}var RP=function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var s in i)i.hasOwnProperty(s)&&(n[s]=i[s])},r(e,t)};return function(e,t){r(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}}(),vt,Fo;if(typeof process=="object")Fo=!1;else if(typeof navigator=="object"){var LP=navigator.userAgent;Fo=LP.indexOf("Windows")>=0}function D3(r){return 55296<=r&&r<=56319}function N3(r){return 56320<=r&&r<=57343}function R3(r){return r>=97&&r<=102}function BP(r){return r>=97&&r<=122}function FP(r){return r>=65&&r<=90}function L3(r){return BP(r)||FP(r)}var jP=/^\w[\w\d+.-]*$/,VP=/^\//,WP=/^\/\//;function $P(r,e){if(!r.scheme&&e)throw new Error('[UriError]: Scheme is missing: {scheme: "", authority: "'+r.authority+'", path: "'+r.path+'", query: "'+r.query+'", fragment: "'+r.fragment+'"}');if(r.scheme&&!jP.test(r.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(r.path){if(r.authority){if(!VP.test(r.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(WP.test(r.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function HP(r,e){return!r&&!e?"file":r}function zP(r,e){switch(r){case"https":case"http":case"file":e?e[0]!==Gr&&(e=Gr+e):e=Gr;break}return e}var et="",Gr="/",UP=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,Wf=function(){function r(e,t,n,i,s,o){o===void 0&&(o=!1),typeof e=="object"?(this.scheme=e.scheme||et,this.authority=e.authority||et,this.path=e.path||et,this.query=e.query||et,this.fragment=e.fragment||et):(this.scheme=HP(e,o),this.authority=t||et,this.path=zP(this.scheme,n||et),this.query=i||et,this.fragment=s||et,$P(this,o))}return r.isUri=function(e){return e instanceof r?!0:e?typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="function"&&typeof e.with=="function"&&typeof e.toString=="function":!1},Object.defineProperty(r.prototype,"fsPath",{get:function(){return ib(this,!1)},enumerable:!0,configurable:!0}),r.prototype.with=function(e){if(!e)return this;var t=e.scheme,n=e.authority,i=e.path,s=e.query,o=e.fragment;return t===void 0?t=this.scheme:t===null&&(t=et),n===void 0?n=this.authority:n===null&&(n=et),i===void 0?i=this.path:i===null&&(i=et),s===void 0?s=this.query:s===null&&(s=et),o===void 0?o=this.fragment:o===null&&(o=et),t===this.scheme&&n===this.authority&&i===this.path&&s===this.query&&o===this.fragment?this:new ks(t,n,i,s,o)},r.parse=function(e,t){t===void 0&&(t=!1);var n=UP.exec(e);return n?new ks(n[2]||et,Wl(n[4]||et),Wl(n[5]||et),Wl(n[7]||et),Wl(n[9]||et),t):new ks(et,et,et,et,et)},r.file=function(e){var t=et;if(Fo&&(e=e.replace(/\\/g,Gr)),e[0]===Gr&&e[1]===Gr){var n=e.indexOf(Gr,2);n===-1?(t=e.substring(2),e=Gr):(t=e.substring(2,n),e=e.substring(n)||Gr)}return new ks("file",t,e,et,et)},r.from=function(e){return new ks(e.scheme,e.authority,e.path,e.query,e.fragment)},r.prototype.toString=function(e){return e===void 0&&(e=!1),$f(this,e)},r.prototype.toJSON=function(){return this},r.revive=function(e){if(e){if(e instanceof r)return e;var t=new ks(e);return t._formatted=e.external,t._fsPath=e._sep===tb?e.fsPath:null,t}else return e},r}(),tb=Fo?1:void 0,ks=function(r){RP(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t._formatted=null,t._fsPath=null,t}return Object.defineProperty(e.prototype,"fsPath",{get:function(){return this._fsPath||(this._fsPath=ib(this,!1)),this._fsPath},enumerable:!0,configurable:!0}),e.prototype.toString=function(t){return t===void 0&&(t=!1),t?$f(this,!0):(this._formatted||(this._formatted=$f(this,!1)),this._formatted)},e.prototype.toJSON=function(){var t={$mid:1};return this._fsPath&&(t.fsPath=this._fsPath,t._sep=tb),this._formatted&&(t.external=this._formatted),this.path&&(t.path=this.path),this.scheme&&(t.scheme=this.scheme),this.authority&&(t.authority=this.authority),this.query&&(t.query=this.query),this.fragment&&(t.fragment=this.fragment),t},e}(Wf),rb=(vt={},vt[58]="%3A",vt[47]="%2F",vt[63]="%3F",vt[35]="%23",vt[91]="%5B",vt[93]="%5D",vt[64]="%40",vt[33]="%21",vt[36]="%24",vt[38]="%26",vt[39]="%27",vt[40]="%28",vt[41]="%29",vt[42]="%2A",vt[43]="%2B",vt[44]="%2C",vt[59]="%3B",vt[61]="%3D",vt[32]="%20",vt);function nb(r,e){for(var t=void 0,n=-1,i=0;i<r.length;i++){var s=r.charCodeAt(i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s===45||s===46||s===95||s===126||e&&s===47)n!==-1&&(t+=encodeURIComponent(r.substring(n,i)),n=-1),t!==void 0&&(t+=r.charAt(i));else{t===void 0&&(t=r.substr(0,i));var o=rb[s];o!==void 0?(n!==-1&&(t+=encodeURIComponent(r.substring(n,i)),n=-1),t+=o):n===-1&&(n=i)}}return n!==-1&&(t+=encodeURIComponent(r.substring(n))),t!==void 0?t:r}function GP(r){for(var e=void 0,t=0;t<r.length;t++){var n=r.charCodeAt(t);n===35||n===63?(e===void 0&&(e=r.substr(0,t)),e+=rb[n]):e!==void 0&&(e+=r[t])}return e!==void 0?e:r}function ib(r,e){var t;return r.authority&&r.path.length>1&&r.scheme==="file"?t="//"+r.authority+r.path:r.path.charCodeAt(0)===47&&(r.path.charCodeAt(1)>=65&&r.path.charCodeAt(1)<=90||r.path.charCodeAt(1)>=97&&r.path.charCodeAt(1)<=122)&&r.path.charCodeAt(2)===58?e?t=r.path.substr(1):t=r.path[1].toLowerCase()+r.path.substr(2):t=r.path,Fo&&(t=t.replace(/\//g,"\\")),t}function $f(r,e){var t=e?GP:nb,n="",i=r.scheme,s=r.authority,o=r.path,a=r.query,l=r.fragment;if(i&&(n+=i,n+=":"),(s||i==="file")&&(n+=Gr,n+=Gr),s){var c=s.indexOf("@");if(c!==-1){var u=s.substr(0,c);s=s.substr(c+1),c=u.indexOf(":"),c===-1?n+=t(u,!1):(n+=t(u.substr(0,c),!1),n+=":",n+=t(u.substr(c+1),!1)),n+="@"}s=s.toLowerCase(),c=s.indexOf(":"),c===-1?n+=t(s,!1):(n+=t(s.substr(0,c),!1),n+=s.substr(c))}if(o){if(o.length>=3&&o.charCodeAt(0)===47&&o.charCodeAt(2)===58){var h=o.charCodeAt(1);h>=65&&h<=90&&(o="/"+String.fromCharCode(h+32)+":"+o.substr(3))}else if(o.length>=2&&o.charCodeAt(1)===58){var h=o.charCodeAt(0);h>=65&&h<=90&&(o=String.fromCharCode(h+32)+":"+o.substr(2))}n+=t(o,!0)}return a&&(n+="?",n+=t(a,!1)),l&&(n+="#",n+=e?l:nb(l,!1)),n}function sb(r){try{return decodeURIComponent(r)}catch{return r.length>3?r.substr(0,3)+sb(r.substr(3)):r}}var ob=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function Wl(r){return r.match(ob)?r.replace(ob,function(e){return sb(e)}):r}var KP=function(){function r(e){try{this.patternRegExp=new RegExp(TP(e)+"$")}catch{this.patternRegExp=null}this.schemas=[]}return r.prototype.addSchema=function(e){this.schemas.push(e)},r.prototype.matchesPattern=function(e){return this.patternRegExp&&this.patternRegExp.test(e)},r.prototype.getSchemas=function(){return this.schemas},r}(),YP=function(){function r(e,t,n){this.service=e,this.url=t,this.dependencies={},n&&(this.unresolvedSchema=this.service.promise.resolve(new As(n)))}return r.prototype.getUnresolvedSchema=function(){return this.unresolvedSchema||(this.unresolvedSchema=this.service.loadSchema(this.url)),this.unresolvedSchema},r.prototype.getResolvedSchema=function(){var e=this;return this.resolvedSchema||(this.resolvedSchema=this.getUnresolvedSchema().then(function(t){return e.service.resolveSchemaContent(t,e.url,e.dependencies)})),this.resolvedSchema},r.prototype.clearSchema=function(){this.resolvedSchema=null,this.unresolvedSchema=null,this.dependencies={}},r}(),As=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r}(),ab=function(){function r(e,t){t===void 0&&(t=[]),this.schema=e,this.errors=t}return r.prototype.getSection=function(e){return cr(this.getSectionRecursive(e,this.schema))},r.prototype.getSectionRecursive=function(e,t){if(!t||typeof t=="boolean"||e.length===0)return t;var n=e.shift();if(t.properties&&typeof t.properties[n])return this.getSectionRecursive(e,t.properties[n]);if(t.patternProperties)for(var i=0,s=Object.keys(t.patternProperties);i<s.length;i++){var o=s[i],a=new RegExp(o);if(a.test(n))return this.getSectionRecursive(e,t.patternProperties[o])}else{if(typeof t.additionalProperties=="object")return this.getSectionRecursive(e,t.additionalProperties);if(n.match("[0-9]+")){if(Array.isArray(t.items)){var l=parseInt(n,10);if(!isNaN(l)&&t.items[l])return this.getSectionRecursive(e,t.items[l])}else if(t.items)return this.getSectionRecursive(e,t.items)}}return null},r}(),JP=function(){function r(e,t,n){this.contextService=t,this.requestService=e,this.promiseConstructor=n||Promise,this.callOnDispose=[],this.contributionSchemas={},this.contributionAssociations={},this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={}}return r.prototype.getRegisteredSchemaIds=function(e){return Object.keys(this.registeredSchemasIds).filter(function(t){var n=Wf.parse(t).scheme;return n!=="schemaservice"&&(!e||e(n))})},Object.defineProperty(r.prototype,"promise",{get:function(){return this.promiseConstructor},enumerable:!0,configurable:!0}),r.prototype.dispose=function(){for(;this.callOnDispose.length>0;)this.callOnDispose.pop()()},r.prototype.onResourceChange=function(e){var t=this,n=!1;e=this.normalizeId(e);for(var i=[e],s=Object.keys(this.schemasById).map(function(c){return t.schemasById[c]});i.length;)for(var o=i.pop(),a=0;a<s.length;a++){var l=s[a];l&&(l.url===o||l.dependencies[o])&&(l.url!==o&&i.push(l.url),l.clearSchema(),s[a]=void 0,n=!0)}return n},r.prototype.normalizeId=function(e){try{return Wf.parse(e).toString()}catch{return e}},r.prototype.setSchemaContributions=function(e){if(e.schemas){var t=e.schemas;for(var n in t){var i=this.normalizeId(n);this.contributionSchemas[i]=this.addSchemaHandle(i,t[n])}}if(e.schemaAssociations){var s=e.schemaAssociations;for(var o in s){var a=s[o];this.contributionAssociations[o]=a;for(var l=this.getOrAddFilePatternAssociation(o),c=0,u=a;c<u.length;c++){var h=u[c],n=this.normalizeId(h);l.addSchema(n)}}}},r.prototype.addSchemaHandle=function(e,t){var n=new YP(this,e,t);return this.schemasById[e]=n,n},r.prototype.getOrAddSchemaHandle=function(e,t){return this.schemasById[e]||this.addSchemaHandle(e,t)},r.prototype.getOrAddFilePatternAssociation=function(e){var t=this.filePatternAssociationById[e];return t||(t=new KP(e),this.filePatternAssociationById[e]=t,this.filePatternAssociations.push(t)),t},r.prototype.registerExternalSchema=function(e,t,n){t===void 0&&(t=null);var i=this.normalizeId(e);if(this.registeredSchemasIds[i]=!0,t)for(var s=0,o=t;s<o.length;s++){var a=o[s];this.getOrAddFilePatternAssociation(a).addSchema(i)}return n?this.addSchemaHandle(i,n):this.getOrAddSchemaHandle(i)},r.prototype.clearExternalSchemas=function(){this.schemasById={},this.filePatternAssociations=[],this.filePatternAssociationById={},this.registeredSchemasIds={};for(var e in this.contributionSchemas)this.schemasById[e]=this.contributionSchemas[e],this.registeredSchemasIds[e]=!0;for(var t in this.contributionAssociations)for(var n=this.getOrAddFilePatternAssociation(t),i=0,s=this.contributionAssociations[t];i<s.length;i++){var o=s[i],e=this.normalizeId(o);n.addSchema(e)}},r.prototype.getResolvedSchema=function(e){var t=this.normalizeId(e),n=this.schemasById[t];return n?n.getResolvedSchema():this.promise.resolve(null)},r.prototype.loadSchema=function(e){if(!this.requestService){var t="Unable to load schema from '"+$l(e)+"'. No schema request service available";return this.promise.resolve(new As({},[t]))}return this.requestService(e).then(function(n){if(!n){var i="Unable to load schema from '"+$l(e)+"': No content.";return new As({},[i])}var s={},o=[];s=cP(n,o);var a=o.length?["Unable to parse content from '"+$l(e)+"': Parse error at offset "+o[0].offset]:[];return new As(s,a)},function(n){var i="Unable to load schema from '"+$l(e)+"': "+n.toString();return new As({},[i])})},r.prototype.resolveSchemaContent=function(e,t,n){var i=this,s=e.errors.slice(0),o=e.schema;if(o.$schema){var a=this.normalizeId(o.$schema);if(a==="http://json-schema.org/draft-03/schema")return this.promise.resolve(new ab({},["Draft-03 schemas are not supported."]));a==="https://json-schema.org/draft/2019-09/schema"&&e.errors.push("Draft 2019-09 schemas are not yet fully supported.")}var l=this.contextService,c=function(p,m){if(!m)return p;var y=p;return m[0]==="/"&&(m=m.substr(1)),m.split("/").some(function(w){return y=y[w],!y}),y},u=function(p,m,y,w){var A=c(m,w);if(A)for(var T in A)A.hasOwnProperty(T)&&!p.hasOwnProperty(T)&&(p[T]=A[T]);else s.push("$ref '"+w+"' in '"+y+"' can not be resolved.")},h=function(p,m,y,w,A){l&&!/^\w+:\/\/.*/.test(m)&&(m=l.resolveRelativePath(m,w)),m=i.normalizeId(m);var T=i.getOrAddSchemaHandle(m);return T.getUnresolvedSchema().then(function(P){if(A[m]=!0,P.errors.length){var L=y?m+"#"+y:m;s.push("Problems loading reference '"+L+"': "+P.errors[0]+".")}return u(p,P.schema,m,y),d(p,P.schema,m,T.dependencies)})},d=function(p,m,y,w){if(!p||typeof p!="object")return Promise.resolve(null);for(var A=[p],T=[],P=[],L=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];typeof fe=="object"&&A.push(fe)}},D=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];if(typeof fe=="object")for(var be in fe){var ke=fe[be];typeof ke=="object"&&A.push(ke)}}},j=function(){for(var F=[],H=0;H<arguments.length;H++)F[H]=arguments[H];for(var Q=0,oe=F;Q<oe.length;Q++){var fe=oe[Q];if(Array.isArray(fe))for(var be=0,ke=fe;be<ke.length;be++){var Re=ke[be];typeof Re=="object"&&A.push(Re)}}},W=function(F){for(var H=[];F.$ref;){var Q=F.$ref,oe=Q.split("#",2);if(delete F.$ref,oe[0].length>0){P.push(h(F,oe[0],oe[1],y,w));return}else H.indexOf(Q)===-1&&(u(F,m,y,oe[1]),H.push(Q))}L(F.items,F.additionalProperties,F.not,F.contains,F.propertyNames,F.if,F.then,F.else),D(F.definitions,F.properties,F.patternProperties,F.dependencies),j(F.anyOf,F.allOf,F.oneOf,F.items)};A.length;){var q=A.pop();T.indexOf(q)>=0||(T.push(q),W(q))}return i.promise.all(P)};return d(o,o,t,n).then(function(p){return new ab(o,s)})},r.prototype.getSchemaForResource=function(e,t){if(t&&t.root&&t.root.type==="object"){var n=t.root.properties.filter(function(m){return m.keyNode.value==="$schema"&&m.valueNode&&m.valueNode.type==="string"});if(n.length>0){var i=ni(n[0].valueNode);if(i&&EP(i,".")&&this.contextService&&(i=this.contextService.resolveRelativePath(i,e)),i){var s=this.normalizeId(i);return this.getOrAddSchemaHandle(s).getResolvedSchema()}}}for(var o=Object.create(null),a=[],l=0,c=this.filePatternAssociations;l<c.length;l++){var u=c[l];if(u.matchesPattern(e))for(var h=0,d=u.getSchemas();h<d.length;h++){var p=d[h];o[p]||(a.push(p),o[p]=!0)}}return a.length>0?this.createCombinedSchema(e,a).getResolvedSchema():this.promise.resolve(null)},r.prototype.createCombinedSchema=function(e,t){if(t.length===1)return this.getOrAddSchemaHandle(t[0]);var n="schemaservice://combinedSchema/"+encodeURIComponent(e),i={allOf:t.map(function(s){return{$ref:s}})};return this.addSchemaHandle(n,i)},r}();function $l(r){try{}catch{}return r}var QP=function(){function r(e,t){this.jsonSchemaService=e,this.promise=t,this.validationEnabled=!0}return r.prototype.configure=function(e){e&&(this.validationEnabled=e.validate,this.commentSeverity=e.allowComments?void 0:Ie.Error)},r.prototype.doValidation=function(e,t,n,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var o=[],a={},l=function(h){var d=h.range.start.line+" "+h.range.start.character+" "+h.message;a[d]||(a[d]=!0,o.push(h))},c=function(h){var d=n?ub(n.trailingCommas):Ie.Error,p=n?ub(n.comments):s.commentSeverity;if(h){if(h.errors.length&&t.root){var m=t.root,y=m.type==="object"?m.properties[0]:null;if(y&&y.keyNode.value==="$schema"){var w=y.valueNode||y,A=Ue.create(e.positionAt(w.offset),e.positionAt(w.offset+w.length));l(Pn.create(A,h.errors[0],Ie.Warning,He.SchemaResolveError))}else{var A=Ue.create(e.positionAt(m.offset),e.positionAt(m.offset+1));l(Pn.create(A,h.errors[0],Ie.Warning,He.SchemaResolveError))}}else{var T=t.validate(e,h.schema);T&&T.forEach(l)}lb(h.schema)&&(p=void 0),cb(h.schema)&&(d=void 0)}for(var P=0,L=t.syntaxErrors;P<L.length;P++){var D=L[P];if(D.code===He.TrailingComma){if(typeof d!="number")continue;D.severity=d}l(D)}if(typeof p=="number"){var j="Comments are not permitted in JSON.";t.comments.forEach(function(W){l(Pn.create(W,j,p,He.CommentNotPermitted))})}return o};if(i){var u=i.id||"schemaservice://untitled/"+XP++;return this.jsonSchemaService.resolveSchemaContent(new As(i),u,{}).then(function(h){return c(h)})}return this.jsonSchemaService.getSchemaForResource(e.uri,t).then(function(h){return c(h)})},r}(),XP=0;function lb(r){if(r&&typeof r=="object"){if(gn(r.allowComments))return r.allowComments;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=lb(n);if(gn(i))return i}}}function cb(r){if(r&&typeof r=="object"){if(gn(r.allowTrailingCommas))return r.allowTrailingCommas;if(gn(r.allowsTrailingCommas))return r.allowsTrailingCommas;if(r.allOf)for(var e=0,t=r.allOf;e<t.length;e++){var n=t[e],i=cb(n);if(gn(i))return i}}}function ub(r){switch(r){case"error":return Ie.Error;case"warning":return Ie.Warning;case"ignore":return}}var fb=48,ZP=57,_P=65,Hl=97,qP=102;function yt(r){return r<fb?0:r<=ZP?r-fb:(r<Hl&&(r+=Hl-_P),r>=Hl&&r<=qP?r-Hl+10:0)}function eM(r){if(r[0]!=="#")return null;switch(r.length){case 4:return{red:yt(r.charCodeAt(1))*17/255,green:yt(r.charCodeAt(2))*17/255,blue:yt(r.charCodeAt(3))*17/255,alpha:1};case 5:return{red:yt(r.charCodeAt(1))*17/255,green:yt(r.charCodeAt(2))*17/255,blue:yt(r.charCodeAt(3))*17/255,alpha:yt(r.charCodeAt(4))*17/255};case 7:return{red:(yt(r.charCodeAt(1))*16+yt(r.charCodeAt(2)))/255,green:(yt(r.charCodeAt(3))*16+yt(r.charCodeAt(4)))/255,blue:(yt(r.charCodeAt(5))*16+yt(r.charCodeAt(6)))/255,alpha:1};case 9:return{red:(yt(r.charCodeAt(1))*16+yt(r.charCodeAt(2)))/255,green:(yt(r.charCodeAt(3))*16+yt(r.charCodeAt(4)))/255,blue:(yt(r.charCodeAt(5))*16+yt(r.charCodeAt(6)))/255,alpha:(yt(r.charCodeAt(7))*16+yt(r.charCodeAt(8)))/255}}return null}function B3(r,e,t,n){return n===void 0&&(n=1),{red:r/255,green:e/255,blue:t/255,alpha:n}}var tM=function(){function r(e){this.schemaService=e}return r.prototype.findDocumentSymbols=function(e,t,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=t.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||jf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=xs.create(e.uri,ii(e,h));if(l.push({name:ni(m.valueNode),kind:mn.Function,location:y}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var w=function(T,P,L){return o>=0&&(P.type==="array"?P.items.forEach(function(D){return w(T,D,L)}):P.type==="object"&&P.properties.forEach(function(D){if(o>=0){var j=D.valueNode;if(j){o--;var W=xs.create(e.uri,ii(e,D)),q=L?L+"."+D.keyNode.value:D.keyNode.value;T.push({name:i.getKeyLabel(D),kind:i.getSymbolKind(j.type),location:W,containerName:L}),w(T,j,q)}}})),T},A=w([],s,void 0);return o<0&&(A.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),A},r.prototype.findDocumentSymbols2=function(e,t,n){var i=this;n===void 0&&(n={resultLimit:Number.MAX_VALUE});var s=t.root;if(!s)return null;var o=n.resultLimit,a=e.uri;if((a==="vscode://defaultsettings/keybindings.json"||jf(a.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],c=0,u=s.items;c<u.length;c++){var h=u[c];if(h.type==="object")for(var d=0,p=h.properties;d<p.length;d++){var m=p[d];if(m.keyNode.value==="key"&&m.valueNode){var y=ii(e,h),w=ii(e,m.keyNode);if(l.push({name:ni(m.valueNode),kind:mn.Function,range:y,selectionRange:w}),o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a),l}}}return l}var A=function(P,L){return o>=0&&(L.type==="array"?L.items.forEach(function(D,j){if(D&&o>=0){o--;var W=ii(e,D),q=W,F=String(j),H=A([],D);P.push({name:F,kind:i.getSymbolKind(D.type),range:W,selectionRange:q,children:H})}}):L.type==="object"&&L.properties.forEach(function(D){var j=D.valueNode;if(j&&o>=0){o--;var W=ii(e,D),q=ii(e,D.keyNode),F=A([],j);P.push({name:i.getKeyLabel(D),kind:i.getSymbolKind(j.type),range:W,selectionRange:q,children:F})}})),P},T=A([],s);return o<0&&(T.pop(),n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(a)),T},r.prototype.getSymbolKind=function(e){switch(e){case"object":return mn.Module;case"string":return mn.String;case"number":return mn.Number;case"array":return mn.Array;case"boolean":return mn.Boolean;default:return mn.Variable}},r.prototype.getKeyLabel=function(e){var t=e.keyNode.value;return t&&(t=t.replace(/[\n]/g,"\u21B5")),t&&t.trim()?t:'"'+t+'"'},r.prototype.findDocumentColors=function(e,t,n){return this.schemaService.getSchemaForResource(e.uri,t).then(function(i){var s=[];if(i)for(var o=n&&typeof n.resultLimit=="number"?n.resultLimit:Number.MAX_VALUE,a=t.getMatchingSchemas(i.schema),l={},c=0,u=a;c<u.length;c++){var h=u[c];if(!h.inverted&&h.schema&&(h.schema.format==="color"||h.schema.format==="color-hex")&&h.node&&h.node.type==="string"){var d=String(h.node.offset);if(!l[d]){var p=eM(ni(h.node));if(p){var m=ii(e,h.node);s.push({color:p,range:m})}if(l[d]=!0,o--,o<=0)return n&&n.onResultLimitExceeded&&n.onResultLimitExceeded(e.uri),s}}}return s})},r.prototype.getColorPresentations=function(e,t,n,i){var s=[],o=Math.round(n.red*255),a=Math.round(n.green*255),l=Math.round(n.blue*255);function c(h){var d=h.toString(16);return d.length!==2?"0"+d:d}var u;return n.alpha===1?u="#"+c(o)+c(a)+c(l):u="#"+c(o)+c(a)+c(l)+c(Math.round(n.alpha*255)),s.push({label:u,textEdit:Fr.replace(i,JSON.stringify(u))}),s},r}();function ii(r,e){return Ue.create(r.positionAt(e.offset),r.positionAt(e.offset+e.length))}var rM={schemaAssociations:{},schemas:{}};function nM(r,e){var t=[],n=[],i=[],s=-1,o=bs(r.getText(),!1),a=o.scan();function l(H){t.push(H),n.push(i.length)}for(;a!==17;){switch(a){case 1:case 3:{var c=r.positionAt(o.getTokenOffset()).line,u={startLine:c,endLine:c,kind:a===1?"object":"array"};i.push(u);break}case 2:case 4:{var h=a===2?"object":"array";if(i.length>0&&i[i.length-1].kind===h){var u=i.pop(),d=r.positionAt(o.getTokenOffset()).line;u&&d>u.startLine+1&&s!==u.startLine&&(u.endLine=d-1,l(u),s=u.startLine)}break}case 13:{var c=r.positionAt(o.getTokenOffset()).line,p=r.positionAt(o.getTokenOffset()+o.getTokenLength()).line;o.getTokenError()===1&&c+1<r.lineCount?o.setPosition(r.offsetAt(Br.create(c+1,0))):c<p&&(l({startLine:c,endLine:p,kind:Do.Comment}),s=c);break}case 12:{var m=r.getText().substr(o.getTokenOffset(),o.getTokenLength()),y=m.match(/^\/\/\s*#(region\b)|(endregion\b)/);if(y){var d=r.positionAt(o.getTokenOffset()).line;if(y[1]){var u={startLine:d,endLine:d,kind:Do.Region};i.push(u)}else{for(var w=i.length-1;w>=0&&i[w].kind!==Do.Region;)w--;if(w>=0){var u=i[w];i.length=w,d>u.startLine&&s!==u.startLine&&(u.endLine=d,l(u),s=u.startLine)}}}break}}a=o.scan()}var A=e&&e.rangeLimit;if(typeof A!="number"||t.length<=A)return t;e&&e.onRangeLimitExceeded&&e.onRangeLimitExceeded(r.uri);for(var T=[],P=0,L=n;P<L.length;P++){var D=L[P];D<30&&(T[D]=(T[D]||0)+1)}for(var j=0,W=0,w=0;w<T.length;w++){var q=T[w];if(q){if(q+j>A){W=w;break}j+=q}}for(var F=[],w=0;w<t.length;w++){var D=n[w];typeof D=="number"&&(D<W||D===W&&j++<A)&&F.push(t[w])}return F}function iM(r,e,t){function n(a){for(var l=r.offsetAt(a),c=t.getNodeFromOffset(l,!0),u=[];c;){switch(c.type){case"string":case"object":case"array":var h=c.offset+1,d=c.offset+c.length-1;h<d&&l>=h&&l<=d&&u.push(i(h,d)),u.push(i(c.offset,c.offset+c.length));break;case"number":case"boolean":case"null":case"property":u.push(i(c.offset,c.offset+c.length));break}if(c.type==="property"||c.parent&&c.parent.type==="array"){var p=o(c.offset+c.length,5);p!==-1&&u.push(i(c.offset,p))}c=c.parent}for(var m=void 0,y=u.length-1;y>=0;y--)m=Vl.create(u[y],m);return m||(m=Vl.create(Ue.create(a,a))),m}function i(a,l){return Ue.create(r.positionAt(a),r.positionAt(l))}var s=bs(r.getText(),!0);function o(a,l){s.setPosition(a);var c=s.scan();return c===l?s.getTokenOffset()+s.getTokenLength():-1}return e.map(n)}function sM(r){var e=r.promiseConstructor||Promise,t=new JP(r.schemaRequestService,r.workspaceContext,e);t.setSchemaContributions(rM);var n=new IP(t,r.contributions,e,r.clientCapabilities),i=new DP(t,r.contributions,e),s=new tM(t),o=new QP(t,e);return{configure:function(a){t.clearExternalSchemas(),a.schemas&&a.schemas.forEach(function(l){t.registerExternalSchema(l.uri,l.fileMatch,l.schema)}),o.configure(a)},resetSchema:function(a){return t.onResourceChange(a)},doValidation:o.doValidation.bind(o),parseJSONDocument:function(a){return OP(a,{collectComments:!0})},newJSONDocument:function(a,l){return CP(a,l)},doComplete:n.doComplete.bind(n),findDocumentSymbols:s.findDocumentSymbols.bind(s),findDocumentSymbols2:s.findDocumentSymbols2.bind(s),findColorSymbols:function(a,l){return s.findDocumentColors(a,l).then(function(c){return c.map(function(u){return u.range})})},findDocumentColors:s.findDocumentColors.bind(s),getColorPresentations:s.getColorPresentations.bind(s),doHover:i.doHover.bind(i),getFoldingRanges:nM,getSelectionRanges:iM,format:function(a,l,c){var u=void 0;if(l){var h=a.offsetAt(l.start),d=a.offsetAt(l.end)-h;u={offset:h,length:d}}var p={tabSize:c?c.tabSize:4,insertSpaces:c?c.insertSpaces:!0,eol:`
|
|
230
|
+
`};return dP(a.getText(),u,p).map(function(m){return Fr.replace(Ue.create(a.positionAt(m.offset),a.positionAt(m.offset+m.length)),m.content)})}}}var oM=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function aM(r){const e={settings:{background:"var(--bg-overlay)",fontFamily:"var(--code-block-font-family)"},styles:[{tag:[M.propertyName],color:"var(--code-block-tokens-property-string-color)"},{tag:[M.processingInstruction,M.string,M.inserted,M.special(M.string)],color:"var(--code-block-tokens-string-color)"},{tag:[M.atom,M.bool,M.special(M.variableName)],color:"var(--text-secondary)"}]};switch(r){case"light":return Sf(e);case"dark":return ZT(e);default:return Sf(e)}}const Hf=sM({});function lM({id:r,schema:e,handleErrors:t}){return Hf.configure({validate:!0,schemas:[{uri:"stub://"+r,fileMatch:["*"],schema:e}]}),PT(n=>oM(this,null,function*(){var i;const s=n.state.doc,o=Nf.create(r+".json","json",0,s.toString()),a=Hf.parseJSONDocument(o),l=yield Hf.doValidation(o,a);return t((i=l?.[0])==null?void 0:i.message),l?.map(c=>({from:hb(s,c.range.start.line,c.range.start.character),to:hb(s,c.range.end.line,c.range.end.character),message:c.message,severity:cM[c.severity||3]}))}))}const cM={1:"error",2:"warning",3:"info",4:"hint"};function hb(r,e,t){return r.line(e+1).from+t}const uM=({onChange:r,onBlur:e,id:t,schema:n,fieldName:i,validate:s,defaultValue:o,mode:a})=>{const{setValue:l,control:c,setError:u,clearErrors:h,getFieldState:d}=(0,gt.Gc)(),p=(0,S.useCallback)(A=>{const{error:T}=d(i);A&&!T?u(i,{message:A}):T&&h(i)},[h,i,d,u]),m=(0,S.useCallback)(A=>{l(i,A),r?.(A)},[i,r,l]),y=(0,S.useCallback)(A=>{e?.(A)},[e]),w=(0,S.useMemo)(()=>[zO(),lM({id:t,schema:n,handleErrors:p})],[p,t,n]);return S.createElement(gt.Qr,{control:c,name:i,rules:{validate:s},defaultValue:o,render:({field:{value:A,ref:T}})=>S.createElement(QT,{ref:T,className:"codemirror-container",value:A||"",onChange:m,onBlur:y,lang:a||ia.Tr.JSON,theme:aM("light"),extensions:w,basicSetup:{bracketMatching:!0,closeBrackets:!0,tabSize:2,foldGutter:!1,lineNumbers:!1,lintKeymap:!0,drawSelection:!1}})})},fM=(0,S.memo)(uM);var zf=f(91582);function hM({mediaType:r,mediaContent:e,properties:t,id:n,resolvedBody:i,getActiveSample:s,validate:o}){const{setValue:a}=(0,gt.Gc)(),l=(0,zf.yN)(e),c=r.examples||{},u=Object.keys(c),h=r.schema,d=Qh(h||{},r.name)||r.name===ia.Tr.MULTIPART||r.name===ia.Tr.URL_ENCODED,{exampleKey:p}=(0,hc.C6)(r.operation,c),m=(0,Ee.YQ)((0,je.P6)(n,r.name,p,c))||(0,je.oY)(c[p],t),y=(0,S.useCallback)((P="",L="",D=[])=>j=>{(0,Ee.WW)((0,je.P6)(n,P,L,D),j)},[n]),w=(0,S.useCallback)(P=>{l?.(P),a("body",s(P))},[a,s,l]),A=(0,S.useCallback)((P,L)=>{a(`body.${P}`,L)},[a]),T=(0,S.useMemo)(()=>(i?.content[r.name]||{}).schema,[r.name,i?.content]);return S.createElement(S.Fragment,null,u.length&&u.length!==1&&S.createElement(hc.b_,{examples:c,onChange:w,exampleKey:p,panel:"try-it"})||null,d?S.createElement(AS,{mediaType:r,onChange:A}):S.createElement(fM,{id:"body"+n,fieldName:"body",defaultValue:m,schema:T,mode:r.name,validate:o,onChange:y(r.name,p,c)}))}const dM=(0,S.memo)(hM);var pM=f(60821),gM=Object.defineProperty,mM=Object.defineProperties,vM=Object.getOwnPropertyDescriptors,db=Object.getOwnPropertySymbols,yM=Object.prototype.hasOwnProperty,bM=Object.prototype.propertyIsEnumerable,pb=(r,e,t)=>e in r?gM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,xM=(r,e)=>{for(var t in e||(e={}))yM.call(e,t)&&pb(r,t,e[t]);if(db)for(var t of db(e))bM.call(e,t)&&pb(r,t,e[t]);return r},wM=(r,e)=>mM(r,vM(e));function SM({body:{content:r},resolvedBody:e,properties:t,mergeExampleBody:n,id:i,validate:s,pointer:o}){const{setValue:a}=(0,gt.Gc)(),l=(0,$r.Dv)(pM.J8),{examples:c,name:u}=r&&(0,Xr.getActiveMediaType)(r,l)||{},h=(0,S.useCallback)(m=>{if(!r||!r.hasSample||!c?.[m])return"";const y=u&&(0,Ee.YQ)((0,je.P6)(i,u,m,c)),w=y?JSON.parse(y):c?.[m];return(0,je.oY)(w,t)},[u,c,i,r,t]),{activeExampleName:d}=(0,$r.Dv)((0,dc.N)(o));(0,S.useEffect)(()=>{if(t&&!n){a("body",JSON.stringify(t||{},null,2));return}const m=(0,je.P6)(i,u,d,c),y=(0,Ee.YQ)(m)||h(d||"");a("body",typeof y=="object"?JSON.stringify(y,null,2):y)},[c,d,u,a,h,i,t,n]);const p=m=>S.createElement(uS.C,wM(xM({},m),{variant:"dark",fullWidth:!0,Label:dS,Dropdown:hS.Lt}));return S.createElement(S.Fragment,null,S.createElement(fS.d,{content:r,renderDropdown:p},m=>S.createElement(dM,{mediaType:m,mediaContent:r,resolvedBody:e,id:i,properties:t,getActiveSample:h,validate:s})))}const kM=(0,S.memo)(SM),AM=({paramEnum:r,fieldName:e,defaultValue:t})=>{const{control:n,setValue:i}=(0,gt.Gc)(),s=r.map((l,c)=>({idx:c,value:l})),o=l=>{i(e,l.value)},a=()=>{i(e,"")};return S.createElement(gt.Qr,{control:n,name:e,defaultValue:Array.isArray(t)?t[0]:t,render:({field:{value:l}})=>S.createElement(Mr.VD,{clearable:!0,fullWidth:!0,variant:"dark",value:l,options:s,handleClear:a,onChange:o})})},CM=(0,S.memo)(AM),OM=({name:r,param:e,place:t,renderParameter:n})=>{var i,s,o,a,l;const[c,u]=S.useState([]),h=()=>{u([...c,c.length?c[c.length-1]+1:0])},d=m=>{u(c.filter(y=>y!==m))},p=(i=e.schema.items)!=null&&i.fields?(s=e.schema.items)==null?void 0:s.fields:[{schema:((o=e.schema.items)==null?void 0:o.schema)||e.schema.items,name:"",required:e.required,description:(a=e.schema.items)==null?void 0:a.description,externalDocs:(l=e.schema.items)==null?void 0:l.externalDocs,deprecated:!1,toggle:()=>null,expanded:!1}];return S.createElement(S.Fragment,null,S.createElement(gb,null,S.createElement(ve.lX,{required:e.required},r,"(",c.length," items)"),S.createElement("span",{onClick:h},"Add item +")),c?.map((m,y)=>S.createElement(gb,{key:m},p.map(w=>n(w,t,`${r}.[${m}]`,`[${y}]${w.name&&"."+w.name}`,S.createElement(EM,{onClick:()=>d(m)},"Delete"))))))},gb=Je.ZP.div`
|
|
232
231
|
display: flex;
|
|
233
232
|
width: 100%;
|
|
234
233
|
align-items: center;
|
|
@@ -249,14 +248,14 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function DP(r){return r.i
|
|
|
249
248
|
color: #fff;
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
|
-
`,
|
|
251
|
+
`,EM=Je.ZP.span`
|
|
253
252
|
background: transparent;
|
|
254
253
|
border: none;
|
|
255
254
|
cursor: pointer;
|
|
256
255
|
position: relative;
|
|
257
256
|
margin-left: 5px;
|
|
258
257
|
display: inline-block;
|
|
259
|
-
`;var jo=(r=>(r.ARRAY="array",r.OBJECT="object",r))(jo||{});function
|
|
258
|
+
`;var jo=(r=>(r.ARRAY="array",r.OBJECT="object",r))(jo||{});function TM({schema:r,example:e}){return`(${r.type})`+(e?` ${e}`:"")}function PM(r){const e={};return r.forEach(t=>{t.in&&(e[t.in]||(e[t.in]=[]),e[t.in].push(t))}),e}function MM({schema:r,required:e}){return t=>{if(e&&!t)return"Field is required";if(e&&r.type===jo.ARRAY&&Array.isArray(t)){if(t.length>(r.rawSchema&&r.rawSchema.maxItems||1/0))return`Too many items selected, maximum ${r.rawSchema.maxItems}`;if(t.length<(r.rawSchema&&r.rawSchema.minItems||0)){const n=r.rawSchema.minItems;return`You should select at least ${n===1?`${n} item`:`${n} items`}`}}}}function IM(r){if(r.type===jo.ARRAY){const e=r.default||r.example;if(!e&&typeof r.rawSchema.items!="boolean"&&Array.isArray(r.rawSchema.items)){if(r.rawSchema.items[0].default)return[r.rawSchema.items[0].default];if(r.rawSchema.items[0].example)return[r.rawSchema.items[0].example]}if(!e&&typeof r.rawSchema.items!="boolean"&&!Array.isArray(r.rawSchema.items)&&(0,Ee.Kn)(r.rawSchema.items)){if(r.rawSchema.items.default)return[r.rawSchema.items.default];if(r.rawSchema.items.example)return[r.rawSchema.items.example]}return e||[]}else return(Number.isInteger(r.default)?r.default.toString():r.default)||r.example}function DM({oneOfType:r}){return r}const NM=["path","query","cookie","header"];function RM({id:r,param:e,values:t}){const n=(0,S.useMemo)(()=>MM(e),[e]),i=Array.isArray(e.schema.enum)&&e.schema.enum.length?e.schema.enum:void 0,s=IM(e.schema),o=r.split(".").map(a=>(0,Ee.dw)(a));return i?S.createElement(ve.NI,null,S.createElement(CM,{defaultValue:s,paramEnum:i,fieldName:r})):S.createElement(it.Xn,{fullWidth:!0,"data-cy":"parameter-input",id:r,fieldName:r,placeholder:TM(e),rules:{validate:n},defaultValue:s||(0,Ee.U2)(t,o),validateOnBlur:!0,validateOnChange:!0})}function LM({values:r,operation:e}){const t=(0,S.useMemo)(()=>PM(e.parameters||[]),[e]),n=(s,o,a,l,c)=>{var u;const h=a?(0,Ee.s1)(a,s.name):s.name,d=DM(s.schema),p=a?[o,a]:[s.in],m=(0,Ee.s1)(...p,(0,Ee.A8)(s.name));return d&&console.warn(`Unsupported parameter definition: "${d}"`),(Array.isArray(s.schema.type)?s.schema.type:[s.schema.type]).includes(jo.ARRAY)?S.createElement(OM,{key:m,name:h,param:s,place:o,renderParameter:n}):s.schema.type===jo.OBJECT?(u=s.schema.fields)==null?void 0:u.map(w=>n(w,o,h)):S.createElement(ve.NI,{key:m},S.createElement(ve.lX,{required:s.required},l||h,": ",c),d?S.createElement(ve.GE,null,"Unsupported field schema definition"):S.createElement(RM,{id:m,param:s,values:r}))},i=s=>{const o=t[s];return!o||!o.length?null:S.createElement(S.Fragment,{key:s},S.createElement(ve.NI,null,S.createElement(ve.iG,null," # ",s," parameters "),S.createElement("span",null,"\xA0")),o.map(a=>n(a,s)))};return S.createElement(ve.iA,null,NM.map(i))}var BM=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function FM(r){return BM(this,null,function*(){return(yield fetch(r)).json()})}const jM=Je.ZP.div`
|
|
260
259
|
position: relative;
|
|
261
260
|
height: 4px;
|
|
262
261
|
display: block;
|
|
@@ -358,19 +357,19 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function DP(r){return r.i
|
|
|
358
357
|
right: -8%;
|
|
359
358
|
}
|
|
360
359
|
}
|
|
361
|
-
`,
|
|
360
|
+
`,mb=()=>S.createElement(jM,null,S.createElement("div",{className:"indeterminate"})),VM=Je.ZP.div`
|
|
362
361
|
font-family: var(--font-family-monospaced);
|
|
363
362
|
margin-top: 10px;
|
|
364
363
|
line-height: 1;
|
|
365
364
|
padding-left: 10px;
|
|
366
365
|
border-left: 1px solid gray;
|
|
367
|
-
`,VM=Je.ZP.div`
|
|
368
|
-
margin-bottom: 15px;
|
|
369
366
|
`,WM=Je.ZP.div`
|
|
370
|
-
|
|
367
|
+
margin-bottom: 15px;
|
|
371
368
|
`,$M=Je.ZP.div`
|
|
369
|
+
padding: 8px 0 20px;
|
|
370
|
+
`,HM=Je.ZP.div`
|
|
372
371
|
padding: 4px 0;
|
|
373
|
-
`;var
|
|
372
|
+
`;var zM=Object.defineProperty,UM=Object.defineProperties,GM=Object.getOwnPropertyDescriptors,vb=Object.getOwnPropertySymbols,KM=Object.prototype.hasOwnProperty,YM=Object.prototype.propertyIsEnumerable,yb=(r,e,t)=>e in r?zM(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,JM=(r,e)=>{for(var t in e||(e={}))KM.call(e,t)&&yb(r,t,e[t]);if(vb)for(var t of vb(e))YM.call(e,t)&&yb(r,t,e[t]);return r},QM=(r,e)=>UM(r,GM(e));const XM=Je.ZP.input`
|
|
374
373
|
cursor: pointer;
|
|
375
374
|
margin-left: 0;
|
|
376
375
|
margin-right: 5px;
|
|
@@ -379,7 +378,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function DP(r){return r.i
|
|
|
379
378
|
align-self: baseline;
|
|
380
379
|
margin-top: 0;
|
|
381
380
|
margin-bottom: 0;
|
|
382
|
-
`,
|
|
381
|
+
`,ZM=Je.ZP.label`
|
|
383
382
|
display: inline-block;
|
|
384
383
|
cursor: pointer;
|
|
385
384
|
vertical-align: middle;
|
|
@@ -389,7 +388,7 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function DP(r){return r.i
|
|
|
389
388
|
|
|
390
389
|
overflow-wrap: break-word;
|
|
391
390
|
line-height: 20px;
|
|
392
|
-
`,
|
|
391
|
+
`,_M=Je.ZP.div`
|
|
393
392
|
width: ${({fullWidth:r})=>r?"100%":"50%"};
|
|
394
393
|
display: inline-flex;
|
|
395
394
|
align-items: center;
|
|
@@ -403,13 +402,13 @@ $3`);return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function DP(r){return r.i
|
|
|
403
402
|
margin-top: 5px;
|
|
404
403
|
}
|
|
405
404
|
`}
|
|
406
|
-
`;function
|
|
405
|
+
`;function qM(r,e){const{fullWidth:t,id:n,label:i,nowrap:s}=r;return S.createElement(_M,{fullWidth:t,nowrap:s},S.createElement(XM,QM(JM({},r),{type:"checkbox",ref:e})),S.createElement(ZM,{htmlFor:n},i))}const bb=(0,S.forwardRef)(qM),eI=11,tI=({fieldName:r,defaultValue:e,items:t,validateOnChange:n,maxDisplayedItems:i,showControls:s,trimItemsLength:o})=>{var a;const{control:l,setValue:c,getValues:u,formState:h,trigger:d}=(0,gt.Gc)(),[p,m]=(0,S.useState)(!0),y=W=>{const q=W.target.value,F=W.target.checked,H=u(r)||[];let Q;if(F)Q=[...H,q];else{const oe=H.indexOf(q);Q=[...H.slice(0,oe),...H.slice(oe+1)]}c(r,Q)},w=W=>u(r).includes(W),A=()=>{m(W=>!W)},T=()=>{c(r,t)},P=()=>{c(r,[])},L=(a=h.errors[r])==null?void 0:a.message,D=i||eI,j=o&&p?t.slice(0,D):t;return S.createElement("div",null,s?S.createElement(pt.CodeBlockControls,{controls:{select:{onClick:T,label:"Select all",tooltipText:"Select all checkboxes"},deselect:{onClick:P,label:"Deselect all",tooltipText:"Deselect all checkboxes"}}}):null,S.createElement(nI,null,S.createElement(gt.Qr,{control:l,name:r,defaultValue:e,render:()=>S.createElement(S.Fragment,null,j.map(W=>S.createElement(bb,{fullWidth:!0,id:W,value:W,checked:w(W),label:W,key:W,onChange:q=>{y(q),n&&d(r)}})))}),t.length>D&&o?S.createElement(iI,{onClick:()=>{A()}},p?"Show all":"Collapse"):null),L?S.createElement(ve.Xq,null,L):"")},rI=(0,S.memo)(tI),nI=Je.ZP.div`
|
|
407
406
|
padding: 10px;
|
|
408
407
|
border: 1px solid var(--border-primary);
|
|
409
408
|
border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
|
|
410
|
-
`,
|
|
409
|
+
`,iI=(0,Je.ZP)(pt.CodeBlockControlButton)`
|
|
411
410
|
float: right;
|
|
412
|
-
`;function bb(r){const{scopes:e,id:t}=r;let n=[];try{n=JSON.parse((0,Ee.YQ)(`auth.${t}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(ve.NI,null,S.createElement(ve.lX,null," Scopes: "),S.createElement(tI,{fieldName:`auth.${t}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const iI=({token:r,loading:e,error:t})=>e?S.createElement(ve.GE,null,"Please, finish your authorization flow or cancel authorization."):t?S.createElement(jM,null,S.createElement(ve.Xq,null,t)):r?.access_token?null:S.createElement(ve.GE,null," No Access Token. Please, Authorize. ");var sI=Object.defineProperty,oI=Object.defineProperties,aI=Object.getOwnPropertyDescriptors,xb=Object.getOwnPropertySymbols,lI=Object.prototype.hasOwnProperty,cI=Object.prototype.propertyIsEnumerable,wb=(r,e,t)=>e in r?sI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zl=(r,e)=>{for(var t in e||(e={}))lI.call(e,t)&&wb(r,t,e[t]);if(xb)for(var t of xb(e))cI.call(e,t)&&wb(r,t,e[t]);return r},Uf=(r,e)=>oI(r,aI(e)),Sb=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const Ul=({usePkce:r,id:e,flow:t,tokenUrl:n,authCorsProxyUrl:i,tokenEndpointAuthMethod:s,server:o,scopes:a,authorizationUrl:l,defaultValues:c,clientId:u})=>{var h;const{oAuth2RedirectURI:d,routingBasePath:p}=(0,$r.Dv)(Wn.qd),{setValue:m,getValues:y,trigger:w,formState:A}=(0,gt.Gc)(),[T,P]=(0,S.useState)(null),[L,D]=(0,S.useState)(!1),[j,W]=(0,S.useState)(!1),[q,F]=(0,S.useState)(void 0),[H,Q]=(0,S.useState)(void 0),[oe,fe]=(0,S.useState)(void 0),be=((h=y("auth"))==null?void 0:h[e])||{},ke=A.errors||{},Re=q!==void 0&&H!==oe?{label:"sync",onClick:()=>{q&&Q(oe)}}:void 0;(0,S.useEffect)(()=>{if(r){const Wt=(0,gi.CY)(43);ad(Wt).then(_t=>{F(Wt),Q(_t),fe(_t)})}},[r]);const Se=Wt=>Sb(void 0,null,function*(){if(!Wt||(yield w(),!(0,gi.Qr)(ke)))return;D(!0),P(null);const _t=i?i+(0,je.jg)(Wt):Wt,Or=i&&n?i+(0,je.jg)(n):n,oi=y(`auth.${e}.scopes`),ai={authorizationUrl:_t.startsWith("http")?_t:o+_t,clientId:be.client_id,scopes:oi,redirectUri:d,routingBasePath:p,successCallback:Er=>{m(`auth.${e}.token`,Er),D(!1),P(null)},errorCallback:Er=>{D(!1),P(Er?.message||"Failed to retrieve the access token")}};if(t==="implicit"&&Hr.authorizeImplicit(ai),!(0,je.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}t==="authorizationCode"&&Hr.authorizeAuthorizationCode(zl(Uf(zl({},ai),{tokenUrl:Or?.startsWith("http")?Or:o+Or,clientSecret:be.client_secret,extraHeaders:(0,je.Or)({authMethod:s,clientId:be.client_id,clientSecret:be.client_secret})}),r&&{codeVerifier:q,codeChallenge:H}))}),Oe=()=>{De(),P(null)},Te=()=>{D(!1),P(null),Hr.clearRedirectData(t)},De=()=>{m(`auth.${e}.token`,"")},bt=()=>{W(Wt=>!Wt)},Rt=Wt=>Sb(void 0,[Wt],function*({target:{value:_t}}){const Or=yield ad(_t);F(_t),fe(Or)});if(!l)return S.createElement(ve.Xq,null,"No flow info");let ir=(0,Ee.YQ)(`auth.${e}.token`)||JSON.stringify(c?.token);ir=ir?JSON.parse(ir):"";const jr=(0,Ee.Al)(e,"client_id"),si={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${e}.client_id`)||u||c?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(ve.n5,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null," Client ID: "),jr?S.createElement(it.F0,Uf(zl({},si),{options:jr})):S.createElement(it.Xn,Uf(zl({},si),{"data-cy":"client-id-input",panel:"try-it"}))),t==="authorizationCode"&&S.createElement(S.Fragment,null,(!r?.hideClientSecretInput||!r)&&S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client Secret:"),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Ee.YQ)(`auth.${e}.client_secret`)||c?.client_secret,validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),r&&!r.disableManualConfiguration&&S.createElement(WM,null,S.createElement(yb,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:j,onChange:bt,"data-cy":"pkce-options-toggle"}),j&&S.createElement($M,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Code Verifier"),S.createElement(it.nv,{fullWidth:!0,value:q,onChange:Rt,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Code Challenge"),S.createElement(it.nv,{fullWidth:!0,value:H,onChange:({target:{value:Wt}})=>{Q(Wt)},inputActionButton:Re,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:ir,panel:"try-it"}),S.createElement(bb,{id:e,scopes:a}),be.token&&be.token.access_token?S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token: "),S.createElement(it.nv,{disabled:!0,type:"password",fullWidth:!0,value:be.token.access_token,panel:"try-it"})):null),S.createElement(VM,null,be.token&&be.token.access_token?S.createElement(pt.Button,{fullWidth:!0,onClick:Oe},"Log out"):L?S.createElement(S.Fragment,null,S.createElement(pt.Button,{fullWidth:!0,onClick:Te},"Cancel"),S.createElement(gb,null)):S.createElement(pt.Button,{fullWidth:!0,disabled:!(0,gi.Qr)(ke),onClick:()=>{Se(l)}},"Authorize")),L||T||!be.token||!be.token.access_token&&S.createElement(iI,{loading:L,error:T,token:be.token}))};var uI=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function fI(r){var e,t;const{scheme:n,defaultValues:i}=r,[s,o]=(0,S.useState)({}),[a,l]=(0,S.useState)(),[c,u]=(0,S.useState)(!1);(0,S.useEffect)(()=>{h(n.openIdConnectUrl)},[n.openIdConnectUrl]);const h=d=>uI(this,null,function*(){u(!0),l("");try{const p=yield BM(d);o(p)}catch(p){l(p.message)}u(!1)});return c?S.createElement(hI,null):a?S.createElement(kb,{message:a}):S.createElement("div",null,S.createElement("div",null,(e=s?.response_types_supported)!=null&&e.includes("token")?S.createElement(S.Fragment,null,S.createElement(Mr.S6,null,"OAuth2 Implicit Flow"),S.createElement(Ul,{key:r.id,authorizationUrl:s.authorization_endpoint,authCorsProxyUrl:r.authCorsProxyUrl,scopes:s.scopes_supported,server:r.server,id:r.id,clientId:r.clientId,flow:"implicit",defaultValues:i})):(t=s?.response_types_supported)!=null&&t.includes("code")?S.createElement(S.Fragment,null,S.createElement(Mr.S6,null,"OAuth2 Authorization Flow"),S.createElement(Ul,{key:r.id,authorizationUrl:s.authorization_endpoint,tokenUrl:s.token_endpoint,authCorsProxyUrl:r.authCorsProxyUrl,scopes:s.scopes_supported,server:r.server,id:r.id,clientId:r.clientId,tokenEndpointAuthMethod:s?.token_endpoint_auth_methods_supported,flow:"authorizationCode",defaultValues:i})):S.createElement("div",null,"Unsupported flow")))}function hI(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(gb,null)))}function kb({message:r}){return S.createElement("div",null,S.createElement("div",null,S.createElement(ve.Xq,null,r)))}var dI=Object.defineProperty,pI=Object.defineProperties,gI=Object.getOwnPropertyDescriptors,Ab=Object.getOwnPropertySymbols,mI=Object.prototype.hasOwnProperty,vI=Object.prototype.propertyIsEnumerable,Cb=(r,e,t)=>e in r?dI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ob=(r,e)=>{for(var t in e||(e={}))mI.call(e,t)&&Cb(r,t,e[t]);if(Ab)for(var t of Ab(e))vI.call(e,t)&&Cb(r,t,e[t]);return r},Eb=(r,e)=>pI(r,gI(e)),yI=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function bI(r){if(!r)return"Token is required"}const xI=({id:r,server:e,flow:t,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,a;const{setValue:l,watch:c,formState:u}=(0,gt.Gc)(),[h,d]=(0,S.useState)(""),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!0),A=((o=c("auth"))==null?void 0:o[r])||{},T=((a=u.errors)==null?void 0:a.auth)||{},P=()=>{l(`auth.${r}.token`,""),(0,Ee.WW)(`auth.${r}.token`,"")},L=()=>{w(H=>!H)},D=()=>yI(void 0,null,function*(){if(p)return;const H=n&&t.tokenUrl?n+(0,je.jg)(t.tokenUrl):t.tokenUrl;if(T.client_id||T.client_secret){console.log("Provide client_id and client_secret");return}const Q=A.client_id,oe=A.client_secret;if(!Q||!oe){console.log("Provide client_id and client_secret");return}m(!0);const fe=t["x-tokenEndpointAuthMethod"];if(!(0,je.xl)(fe)){console.log(`Unsupported token endpoint auth method: ${fe}`);return}yield Hr.authorizeClientCredentials({tokenUrl:H.startsWith("http")?H:e+H,clientId:Q,clientSecret:oe,scopes:A.scopes,extraHeaders:(0,je.Or)({authMethod:fe,clientId:Q,clientSecret:oe}),successCallback:be=>{l(`auth.${r}.token`,be),m(!1)},errorCallback:be=>{P(),d(be.message),m(!1)}})}),j=Object.keys(t.scopes);let W=(0,Ee.YQ)(`auth.${r}.token`)||JSON.stringify(i?.token);W=W?JSON.parse(W):"";const q=(0,Ee.Al)(r,"client_id"),F={fieldName:`auth.${r}.client_id`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${r}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(ve.n5,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client ID:"),q?S.createElement(it.F0,Eb(Ob({},F),{options:q})):S.createElement(it.Xn,Eb(Ob({},F),{type:"password",panel:"try-it"}))),S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client Secret:"),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${r}.client_secret`,defaultValue:(0,Ee.YQ)(`auth.${r}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${r}.token`,type:"hidden",defaultValue:W,rules:{validate:bI}}),S.createElement(bb,{id:r,scopes:j})),S.createElement(pt.Button,{color:"primary",onClick:D,blinking:p},p?"Loading...":"Request Token"),S.createElement(ve.ph,null," Access Token "),h?S.createElement(ve.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,h)," "):A.token&&A.token.access_token?S.createElement(ve.TR,null,S.createElement(ve.WA,{length:A.token.access_token.length,masked:y},A.token.access_token),S.createElement(ve.lf,{onClick:L},y?"Show":"Hide"," "),S.createElement(ve.h,{onClick:P}," Clear ")):S.createElement(ve.Xq,{style:{marginBottom:"1em"}},"No token"))};var wI=Object.defineProperty,SI=Object.defineProperties,kI=Object.getOwnPropertyDescriptors,Tb=Object.getOwnPropertySymbols,AI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,Pb=(r,e,t)=>e in r?wI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cs=(r,e)=>{for(var t in e||(e={}))AI.call(e,t)&&Pb(r,t,e[t]);if(Tb)for(var t of Tb(e))CI.call(e,t)&&Pb(r,t,e[t]);return r},Os=(r,e)=>SI(r,kI(e));const OI=({securityDefaults:r,operation:e,activeServer:t,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:a,watch:l}=(0,gt.Gc)(),{parser:c}=(0,$r.Dv)(Wn.eG),u=e.security,h=(0,S.useMemo)(()=>u.map(P=>P.schemes.map(L=>L.id).join(" and ")).filter(Boolean),[u]),d=l("securityScheme"),p=(0,S.useMemo)(()=>{const P=h.findIndex(L=>L===d);return P<0?0:P},[h,d]);(0,S.useEffect)(()=>{const P=(0,Ee.YQ)("securityRequirementName"),L=h.findIndex(D=>D===P);a("securityScheme",h[L<0?0:L])},[h,e,a]);const m=(0,S.useCallback)(P=>{a("securityScheme",P.value),(0,Ee.WW)("securityRequirementName",P.value)},[a]),y=(0,S.useMemo)(()=>h.map((P,L)=>({value:P,idx:L})),[h]);if(y.length===0)return S.createElement(kb,{message:"Cannot find security schema in the definition"});const w=u[p],A=(0,Ee.A8)(w.schemes[0].id),T=l(`auth.${A}`);return S.createElement(S.Fragment,null,S.createElement(ve.n5,null,y.length>1&&S.createElement(ve.NI,null,S.createElement(ve.lX,null," Security scheme: "),S.createElement(gt.Qr,{control:o,name:"securityScheme",render:({field:{value:P}})=>S.createElement(Mr.VD,{variant:"dark",fullWidth:!0,options:y,value:P,onChange:m})}))||null,S.createElement(pt.TryItSecurityApps,{apiId:(s=(i=c?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:T,onChange:P=>{a(`auth.${A}`,P)}}),w.schemes.map(P=>{var L,D,j,W,q,F;const H=(0,Ee.A8)(P.id);if(P.type==="apiKey"){const Q=(0,Ee.Al)(H,""),oe={fieldName:`auth.${H}`,fullWidth:!0,defaultValue:(0,je.NG)(P)||(0,Ee.YQ)(`auth.${H}`)||r?.[H],rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(ve.NI,{key:H},S.createElement(ve.lX,null," ",P.name,": "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(P.type==="http"){if(P.scheme==="basic"){const Q=(0,Ee.Al)(H,"username"),oe={fieldName:`auth.${H}.username`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${H}.username`)||((L=r?.[H])==null?void 0:L.username),validate:je.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," ",(0,Fs.l)("tryItAuthBasicUsername"),": "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{panel:"try-it"}))),S.createElement(ve.NI,null,S.createElement(ve.lX,null," ",(0,Fs.l)("tryItAuthBasicPassword"),": "),S.createElement(it.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${H}.password`,defaultValue:(0,Ee.YQ)(`auth.${H}.password`)||((D=r?.[H])==null?void 0:D.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(P.scheme==="bearer"){const Q=(0,Ee.Al)(H,""),oe={fieldName:`auth.${H}`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${H}`)||r?.[H],rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," Bearer Token: "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(P.type==="oauth2"&&P.flows&&P.flows.clientCredentials)return S.createElement(xI,{key:H,flow:P.flows.clientCredentials,server:t,authCorsProxyUrl:n,id:H,clientId:P.flows.clientCredentials["x-defaultClientId"]||P["x-defaultClientId"],defaultValues:r?.[H]});if(P.type==="oauth2"&&P.flows&&P.flows.implicit)return S.createElement(Ul,{key:H,authorizationUrl:P.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((W=(j=P?.flows)==null?void 0:j.implicit)==null?void 0:W.scopes)||{}),server:t,id:H,clientId:P.flows.implicit["x-defaultClientId"]||P["x-defaultClientId"],flow:"implicit",defaultValues:r?.[H]});if(P.type==="oauth2"&&P.flows&&P.flows.authorizationCode)return S.createElement(Ul,{key:H,authorizationUrl:P.flows.authorizationCode.authorizationUrl,tokenUrl:P.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((q=P.flows.authorizationCode)==null?void 0:q.scopes)||{}),server:t,id:H,clientId:P.flows.authorizationCode["x-defaultClientId"]||P["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:P.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:P.flows.authorizationCode["x-usePkce"],defaultValues:r?.[H]});if(P.type==="oauth2"){let Q=(0,Ee.YQ)(`auth.${H}.token`)||JSON.stringify((F=r?.[H])==null?void 0:F.token);return Q=Q?JSON.parse(Q):{},S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token Type: "),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${H}.token.token_type`,defaultValue:Q.token_type||"Bearer",panel:"try-it"})),S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token: "),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${H}.token.access_token`,rules:{validate:je.np},defaultValue:Q.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(P.type==="openIdConnect")return S.createElement(fI,{key:H,server:t,authCorsProxyUrl:n,id:H,scheme:P,clientId:P["x-defaultClientId"],defaultValues:r?.[H]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var EI=f(55919);function TI({operation:r,properties:e,mergeExampleBody:t,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:a,formState:l}=(0,gt.Gc)(),c=l.errors||{},u=!!(c.path||c.cookie||c.header||c.query),{hooks:h,authCorsProxyUrl:d}=(0,$r.Dv)(Wn.qd),p=i&&Ee.IB.get(i,r.pointer),m=a();let y=m&&m.auth&&Object.keys(m.auth)[0];(!y||!m.auth[y])&&(y=void 0),y&&(m.auth[y].token!==void 0||m.auth[y].client_id!==void 0||m.auth[y].client_secret!==void 0)&&(!m.auth[y].token||!m.auth[y].token.access_token)&&(y=void 0),y&&m.auth[y].username!=null&&(!m.auth[y].username||!m.auth[y].password)&&(y=void 0);const w=r.parameters||[];return!i&&S.createElement(S.Fragment,null,"Loading...")||S.createElement("form",{style:{flex:1,display:"flex",flexDirection:"column",margin:0}},S.createElement(eS,{operation:r,onChange:o}),S.createElement(ea.UQ,{initialActiveIdx:r.security.length&&y?1:0},r.security.length&&S.createElement(fc,{header:(0,Fs.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!c.auth,success:!!y,renderChildrenHidden:!0},pt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel?S.createElement(PI,{fieldName:"auth",validate:je.np},A=>S.createElement(EI.Q,{Hook:pt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel,props:{server:s,operation:r,onChange:A,OAuth2:Hr}})):S.createElement(OI,{operation:r,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,r.requestBody&&S.createElement(fc,{header:(0,Fs.l)("tryItBody"),"data-cy":"body-trigger",error:!!c.body,renderChildrenHidden:!0},S.createElement(SM,{validate:MI,body:r.requestBody,pointer:r.pointer,id:r.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:t}))||null,w.length&&S.createElement(fc,{header:(0,Fs.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(RM,{operation:r,values:m}))||null))}function PI({fieldName:r,validate:e,children:t}){const{control:n,setValue:i}=(0,gt.Gc)();return S.createElement(gt.Qr,{control:n,name:r,rules:{validate:e},render:()=>t(i)})}function MI(){}const II=(0,S.memo)(TI);function DI({shaking:r,className:e,children:t,rootElement:n}){const[i]=(0,zf.Bs)(n),s=(0,$r.Dv)(Wn.qd);return S.createElement(Mr.q2,{scrollYOffset:s.scrollYOffset,shaking:r,className:e,"data-cy":"console",fullWidth:i?.width},t)}const NI=(0,S.memo)(DI);var RI=Object.defineProperty,LI=Object.defineProperties,BI=Object.getOwnPropertyDescriptors,Mb=Object.getOwnPropertySymbols,FI=Object.prototype.hasOwnProperty,jI=Object.prototype.propertyIsEnumerable,Ib=(r,e,t)=>e in r?RI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e)=>{for(var t in e||(e={}))FI.call(e,t)&&Ib(r,t,e[t]);if(Mb)for(var t of Mb(e))jI.call(e,t)&&Ib(r,t,e[t]);return r},Cr=(r,e)=>LI(r,BI(e)),Db=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function Nb(r){return r.startsWith("//")?"https:"+r:r}function VI({operation:r,onResponse:e,className:t,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:a}){const l=(0,gt.cI)({defaultValues:{path:(0,je.ZS)(r.parameters,"path"),cookie:(0,je.ZS)(r.parameters,"cookie"),header:(0,je.ZS)(r.parameters,"header"),query:(0,je.ZS)(r.parameters,"query")}}),[{activeServer:c},u]=(0,$r.KO)((0,dc.N)(r.pointer)),[h,d]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!1),[A,T]=(0,S.useState)(),[P,L]=(0,S.useState)(),[D,j]=(0,S.useState)(),[W,q]=(0,S.useState)(),F=(0,zf.D9)(r),{parser:H,options:Q}=(0,$r.Dv)(Wn.eG);(0,S.useEffect)(()=>{const{unsubscribe:Se}=l.watch((Oe={})=>{u(Te=>Cr(It({},Te),{requestValues:JSON.parse(JSON.stringify(Oe))})),(0,je.Hc)(Cr(It({},Oe),{query:(0,je.FU)(Oe.query||{})}))});return()=>Se()},[l,u]);const oe=(0,S.useCallback)(Se=>{d(Se)},[]),fe=(0,S.useCallback)(Se=>{u(Oe=>Cr(It({},Oe),{activeServer:Se})),l.setValue("server",Se)},[u,l]),be=l.handleSubmit(Se=>Db(this,null,function*(){var Oe,Te,De,bt,Rt,ir,jr,si,Wt,_t,Or,oi,ai;const{servers:Er,requestBody:vn}=r,Gl=vn&&vn.content&&((Oe=(0,Xr.getActiveMediaType)(vn.content))==null?void 0:Oe.name)||"";let li=Se.body;if(/json/.test(Gl))try{li=JSON.parse(li)}catch(Ke){console.error(Ke)}m(!0);const sr=A,Es=(r.httpVerb||"").toLowerCase();if(!Er)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");const Gf=Er.find(Ke=>c?.url.endsWith(Ke.url.endsWith("/")?Ke.url.substring(0,Ke.url.length-1):Ke.url)),$I=Date.now();let Mn,ci=Se.auth;if(ci){const Ke=Object.keys(ci)[0],yn=(0,ww.dw)(Ke);Mn=Cr(It({},sr),{components:Cr(It({},sr?.components),{securitySchemes:Cr(It({},(Te=sr?.components)==null?void 0:Te.securitySchemes),{[yn]:Cr(It({},(bt=(De=sr?.components)==null?void 0:De.securitySchemes)==null?void 0:bt[yn]),{type:((jr=(ir=(Rt=sr?.components)==null?void 0:Rt.securitySchemes)==null?void 0:ir[yn])==null?void 0:jr.type)==="openIdConnect"?"oauth2":((Wt=(si=sr?.components)==null?void 0:si.securitySchemes)==null?void 0:Wt[yn]).type})})})}),ci=Cr(It({},ci),{[yn]:ci[Ke]})}else Mn=It({},sr);Mn.servers=Er;const Kl=Q.corsProxyUrl;Kl&&Er.length&&(Mn.servers=Er.map(Ke=>Cr(It({},Ke),{url:Kl+Nb(Ke.url)})),Mn.paths=Cr(It({},Mn.paths),{[r.path]:Cr(It({},Mn.paths[r.path]),{[Es]:Cr(It({},Mn.paths[r.path][Es]),{servers:void 0}),servers:void 0})}));const Kf=vn?.content&&((_t=(0,Xr.getActiveMediaType)(vn.content))==null?void 0:_t.name)||null;if(Kf&&li&&ta(Kf)){const Ke=Object.values(li);li=Ke.length>1?Ke:Ke[0]}const HI=(0,je.FU)(Se.query||{}),Yf={server:Kl?Kl+Nb(Gf.url):Gf.url,serverVariables:(0,je.mj)(Gf),spec:Mn,pathName:r.path,method:r.httpVerb,parameters:It(It(It(It({},Se.path),HI),Se.header),Se.cookie),securities:{authorized:ci},requestBody:li,requestContentType:Kf,responseContentType:((Or=Se.header)==null?void 0:Or.Accept)||null,requestInterceptor:(0,je.Tz)(Q,r,ci?.Authorization)};try{const Ke=yield rw(Yf),yn=Ke?.data;yn instanceof Blob&&(ta(yn.type)&&(Ke.fileInfo={rawData:yn,fileName:(0,je.AM)(Ke.headers)}),Ke.data=yield yn.text()),e?.({request:Yf,response:Ke}),q(Ke),j(void 0)}catch(Ke){Ke&&Ke.response&&Ke.response.data instanceof Blob&&(Ke.response.data=yield Ke.response.data.text(),e?.({request:Yf,response:Ke.response})),q(void 0),j(Ke)}finally{m(!1),d(1),L(Date.now()-$I),(ai=(oi=Q.events)==null?void 0:oi.tryItSent)==null||ai.call(oi,{eventType:lc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})}}),()=>{var Se,Oe;w(!0),setTimeout(()=>w(!1),1e3),(Oe=(Se=Q.events)==null?void 0:Se.tryItSent)==null||Oe.call(Se,{eventType:lc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})});(0,pt.useMount)(()=>Db(this,null,function*(){const Se=yield xw(r,H.definition);T(Se),r.activeServer&&!c&&u(Oe=>Cr(It({},Oe),{activeServer:r.activeServer}))})),(0,S.useEffect)(()=>{F&&F!==r&&(q(void 0),j(void 0),d(0))},[r,F]);const ke=!!(W||D),Re=l.getValues();return S.createElement(gt.RV,It({},l),S.createElement(NI,{shaking:y,className:t,rootElement:n},S.createElement(ea.Hc,null,S.createElement(Rw,{active:h,hasResponse:ke,onChange:oe}),a&&S.createElement(Mr.PZ,{onClick:a}," \u2715 ")),S.createElement(Mr.RE,{hidden:h!==0,"data-cy":"console-request-body"},S.createElement(II,{operation:r,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:A,server:c||r.activeServer,onServerChange:fe})),S.createElement(Mr.RE,{hidden:h!==1,"data-cy":"console-response-body"},S.createElement(Dw,{response:W,error:D,time:P})),S.createElement(jw,{hasResponse:ke,params:Re,operation:r,loading:p,onSubmit:be})))}const WI=(0,S.memo)(VI)},85208:(v,C,f)=>{var g=f(34440),b=f(84108),x=f(61085),k=f(77706),O=f(8636);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},81998:(v,C,f)=>{var g=f(90266),b=f(42875),x=f(45828),k=f(24115),O=f(67690);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},72887:(v,C,f)=>{var g=f(65234),b=f(83250),x=g(b,"Map");v.exports=x},95678:(v,C,f)=>{var g=f(39016),b=f(62363),x=f(64348),k=f(53062),O=f(30262);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},70861:(v,C,f)=>{var g=f(83250),b=g.Symbol;v.exports=b},29233:v=>{function C(f,g){for(var b=-1,x=f==null?0:f.length,k=Array(x);++b<x;)k[b]=g(f[b],b,f);return k}v.exports=C},18498:(v,C,f)=>{var g=f(58260);function b(x,k){for(var O=x.length;O--;)if(g(x[O][0],k))return O;return-1}v.exports=b},40548:(v,C,f)=>{var g=f(24007),b=f(86040);function x(k,O){O=g(O,k);for(var E=0,N=O.length;k!=null&&E<N;)k=k[b(O[E++])];return E&&E==N?k:void 0}v.exports=x},69823:(v,C,f)=>{var g=f(70861),b=f(91339),x=f(25151),k="[object Null]",O="[object Undefined]",E=g?g.toStringTag:void 0;function N(I){return I==null?I===void 0?O:k:E&&E in Object(I)?b(I):x(I)}v.exports=N},99817:(v,C,f)=>{var g=f(45563),b=f(28597),x=f(93702),k=f(55784),O=/[\\^$.*+?()[\]{}|]/g,E=/^\[object .+?Constructor\]$/,N=Function.prototype,I=Object.prototype,B=N.toString,z=I.hasOwnProperty,Y=RegExp("^"+B.call(z).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _(X){if(!x(X)||b(X))return!1;var G=g(X)?Y:E;return G.test(k(X))}v.exports=_},86245:(v,C,f)=>{var g=f(70861),b=f(29233),x=f(55589),k=f(52624),O=1/0,E=g?g.prototype:void 0,N=E?E.toString:void 0;function I(B){if(typeof B=="string")return B;if(x(B))return b(B,I)+"";if(k(B))return N?N.call(B):"";var z=B+"";return z=="0"&&1/B==-O?"-0":z}v.exports=I},24007:(v,C,f)=>{var g=f(55589),b=f(5130),x=f(44041),k=f(99835);function O(E,N){return g(E)?E:b(E,N)?[E]:x(k(E))}v.exports=O},1622:(v,C,f)=>{var g=f(83250),b=g["__core-js_shared__"];v.exports=b},20302:(v,C,f)=>{var g=typeof f.g=="object"&&f.g&&f.g.Object===Object&&f.g;v.exports=g},77570:(v,C,f)=>{var g=f(58949);function b(x,k){var O=x.__data__;return g(k)?O[typeof k=="string"?"string":"hash"]:O.map}v.exports=b},65234:(v,C,f)=>{var g=f(99817),b=f(67736);function x(k,O){var E=b(k,O);return g(E)?E:void 0}v.exports=x},91339:(v,C,f)=>{var g=f(70861),b=Object.prototype,x=b.hasOwnProperty,k=b.toString,O=g?g.toStringTag:void 0;function E(N){var I=x.call(N,O),B=N[O];try{N[O]=void 0;var z=!0}catch{}var Y=k.call(N);return z&&(I?N[O]=B:delete N[O]),Y}v.exports=E},67736:v=>{function C(f,g){return f?.[g]}v.exports=C},34440:(v,C,f)=>{var g=f(24545);function b(){this.__data__=g?g(null):{},this.size=0}v.exports=b},84108:v=>{function C(f){var g=this.has(f)&&delete this.__data__[f];return this.size-=g?1:0,g}v.exports=C},61085:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__",x=Object.prototype,k=x.hasOwnProperty;function O(E){var N=this.__data__;if(g){var I=N[E];return I===b?void 0:I}return k.call(N,E)?N[E]:void 0}v.exports=O},77706:(v,C,f)=>{var g=f(24545),b=Object.prototype,x=b.hasOwnProperty;function k(O){var E=this.__data__;return g?E[O]!==void 0:x.call(E,O)}v.exports=k},8636:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__";function x(k,O){var E=this.__data__;return this.size+=this.has(k)?0:1,E[k]=g&&O===void 0?b:O,this}v.exports=x},5130:(v,C,f)=>{var g=f(55589),b=f(52624),x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/;function O(E,N){if(g(E))return!1;var I=typeof E;return I=="number"||I=="symbol"||I=="boolean"||E==null||b(E)?!0:k.test(E)||!x.test(E)||N!=null&&E in Object(N)}v.exports=O},58949:v=>{function C(f){var g=typeof f;return g=="string"||g=="number"||g=="symbol"||g=="boolean"?f!=="__proto__":f===null}v.exports=C},28597:(v,C,f)=>{var g=f(1622),b=function(){var k=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}();function x(k){return!!b&&b in k}v.exports=x},90266:v=>{function C(){this.__data__=[],this.size=0}v.exports=C},42875:(v,C,f)=>{var g=f(18498),b=Array.prototype,x=b.splice;function k(O){var E=this.__data__,N=g(E,O);if(N<0)return!1;var I=E.length-1;return N==I?E.pop():x.call(E,N,1),--this.size,!0}v.exports=k},45828:(v,C,f)=>{var g=f(18498);function b(x){var k=this.__data__,O=g(k,x);return O<0?void 0:k[O][1]}v.exports=b},24115:(v,C,f)=>{var g=f(18498);function b(x){return g(this.__data__,x)>-1}v.exports=b},67690:(v,C,f)=>{var g=f(18498);function b(x,k){var O=this.__data__,E=g(O,x);return E<0?(++this.size,O.push([x,k])):O[E][1]=k,this}v.exports=b},39016:(v,C,f)=>{var g=f(85208),b=f(81998),x=f(72887);function k(){this.size=0,this.__data__={hash:new g,map:new(x||b),string:new g}}v.exports=k},62363:(v,C,f)=>{var g=f(77570);function b(x){var k=g(this,x).delete(x);return this.size-=k?1:0,k}v.exports=b},64348:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).get(x)}v.exports=b},53062:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).has(x)}v.exports=b},30262:(v,C,f)=>{var g=f(77570);function b(x,k){var O=g(this,x),E=O.size;return O.set(x,k),this.size+=O.size==E?0:1,this}v.exports=b},32924:(v,C,f)=>{var g=f(67997),b=500;function x(k){var O=g(k,function(N){return E.size===b&&E.clear(),N}),E=O.cache;return O}v.exports=x},24545:(v,C,f)=>{var g=f(65234),b=g(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,f=C.toString;function g(b){return f.call(b)}v.exports=g},83250:(v,C,f)=>{var g=f(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,x=g||b||Function("return this")();v.exports=x},44041:(v,C,f)=>{var g=f(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x=/\\(\\)?/g,k=g(function(O){var E=[];return O.charCodeAt(0)===46&&E.push(""),O.replace(b,function(N,I,B,z){E.push(B?z.replace(x,"$1"):I||N)}),E});v.exports=k},86040:(v,C,f)=>{var g=f(52624),b=1/0;function x(k){if(typeof k=="string"||g(k))return k;var O=k+"";return O=="0"&&1/k==-b?"-0":O}v.exports=x},55784:v=>{var C=Function.prototype,f=C.toString;function g(b){if(b!=null){try{return f.call(b)}catch{}try{return b+""}catch{}}return""}v.exports=g},58260:v=>{function C(f,g){return f===g||f!==f&&g!==g}v.exports=C},13546:(v,C,f)=>{var g=f(40548);function b(x,k,O){var E=x==null?void 0:g(x,k);return E===void 0?O:E}v.exports=b},55589:v=>{var C=Array.isArray;v.exports=C},45563:(v,C,f)=>{var g=f(69823),b=f(93702),x="[object AsyncFunction]",k="[object Function]",O="[object GeneratorFunction]",E="[object Proxy]";function N(I){if(!b(I))return!1;var B=g(I);return B==k||B==O||B==x||B==E}v.exports=N},93702:v=>{function C(f){var g=typeof f;return f!=null&&(g=="object"||g=="function")}v.exports=C},50440:v=>{function C(f){return f!=null&&typeof f=="object"}v.exports=C},52624:(v,C,f)=>{var g=f(69823),b=f(50440),x="[object Symbol]";function k(O){return typeof O=="symbol"||b(O)&&g(O)==x}v.exports=k},67997:(v,C,f)=>{var g=f(95678),b="Expected a function";function x(k,O){if(typeof k!="function"||O!=null&&typeof O!="function")throw new TypeError(b);var E=function(){var N=arguments,I=O?O.apply(this,N):N[0],B=E.cache;if(B.has(I))return B.get(I);var z=k.apply(this,N);return E.cache=B.set(I,z)||B,z};return E.cache=new(x.Cache||g),E}x.Cache=g,v.exports=x},99835:(v,C,f)=>{var g=f(86245);function b(x){return x==null?"":g(x)}v.exports=b},14927:(v,C,f)=>{var g=typeof Map=="function"&&Map.prototype,b=Object.getOwnPropertyDescriptor&&g?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,x=g&&b&&typeof b.get=="function"?b.get:null,k=g&&Map.prototype.forEach,O=typeof Set=="function"&&Set.prototype,E=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=O&&E&&typeof E.get=="function"?E.get:null,I=O&&Set.prototype.forEach,B=typeof WeakMap=="function"&&WeakMap.prototype,z=B?WeakMap.prototype.has:null,Y=typeof WeakSet=="function"&&WeakSet.prototype,_=Y?WeakSet.prototype.has:null,X=typeof WeakRef=="function"&&WeakRef.prototype,G=X?WeakRef.prototype.deref:null,te=Boolean.prototype.valueOf,se=Object.prototype.toString,R=Function.prototype.toString,ee=String.prototype.match,U=String.prototype.slice,re=String.prototype.replace,ne=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,ce=RegExp.prototype.test,V=Array.prototype.concat,K=Array.prototype.join,le=Array.prototype.slice,pe=Math.floor,ge=typeof BigInt=="function"?BigInt.prototype.valueOf:null,me=Object.getOwnPropertySymbols,$e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ve||"symbol")?Symbol.toStringTag:null,Fe=Object.prototype.propertyIsEnumerable,at=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function Dt($,Z){if($===1/0||$===-1/0||$!==$||$&&$>-1e3&&$<1e3||ce.call(/e/,Z))return Z;var ze=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $=="number"){var _e=$<0?-pe(-$):pe($);if(_e!==$){var lt=String(_e),Me=U.call(Z,lt.length+1);return re.call(lt,ze,"$&_")+"."+re.call(re.call(Me,/([0-9]{3})/g,"$&_"),/_$/,"")}}return re.call(Z,ze,"$&_")}var At=f(65710),qt=At.custom,Xe=hr(qt)?qt:null;v.exports=function $(Z,ze,_e,lt){var Me=ze||{};if(Pr(Me,"quoteStyle")&&Me.quoteStyle!=="single"&&Me.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Pr(Me,"maxStringLength")&&(typeof Me.maxStringLength=="number"?Me.maxStringLength<0&&Me.maxStringLength!==1/0:Me.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Yr=Pr(Me,"customInspect")?Me.customInspect:!0;if(typeof Yr!="boolean"&&Yr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Pr(Me,"indent")&&Me.indent!==null&&Me.indent!==" "&&!(parseInt(Me.indent,10)===Me.indent&&Me.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Pr(Me,"numericSeparator")&&typeof Me.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var wn=Me.numericSeparator;if(typeof Z>"u")return"undefined";if(Z===null)return"null";if(typeof Z=="boolean")return Z?"true":"false";if(typeof Z=="string")return fi(Z,Me);if(typeof Z=="number"){if(Z===0)return 1/0/Z>0?"0":"-0";var Ht=String(Z);return wn?Dt(Z,Ht):Ht}if(typeof Z=="bigint"){var Jr=String(Z)+"n";return wn?Dt(Z,Jr):Jr}var Ts=typeof Me.depth>"u"?5:Me.depth;if(typeof _e>"u"&&(_e=0),_e>=Ts&&Ts>0&&typeof Z=="object")return Ot(Z)?"[Array]":"[Object]";var Ln=Ce(Me,_e);if(typeof lt>"u")lt=[];else if(Kr(lt,Z)>=0)return"[Circular]";function gr(Fn,Wi,Uo){if(Wi&&(lt=le.call(lt),lt.push(Wi)),Uo){var Go={depth:Me.depth};return Pr(Me,"quoteStyle")&&(Go.quoteStyle=Me.quoteStyle),$(Fn,Go,_e+1,lt)}return $(Fn,Me,_e+1,lt)}if(typeof Z=="function"&&!Ne(Z)){var Vo=pr(Z),Wo=Pe(Z,gr);return"[Function"+(Vo?": "+Vo:" (anonymous)")+"]"+(Wo.length>0?" { "+K.call(Wo,", ")+" }":"")}if(hr(Z)){var Ps=Ve?re.call(String(Z),/^(Symbol\(.*\))_[^)]*$/,"$1"):$e.call(Z);return typeof Z=="object"&&!Ve?Wr(Ps):Ps}if(Dn(Z)){for(var Bn="<"+ae.call(String(Z.nodeName)),Li=Z.attributes||[],di=0;di<Li.length;di++)Bn+=" "+Li[di].name+"="+Ct(xt(Li[di].value),"double",Me);return Bn+=">",Z.childNodes&&Z.childNodes.length&&(Bn+="..."),Bn+="</"+ae.call(String(Z.nodeName))+">",Bn}if(Ot(Z)){if(Z.length===0)return"[]";var Bi=Pe(Z,gr);return Ln&&!Ze(Bi)?"["+Le(Bi,Ln)+"]":"[ "+K.call(Bi,", ")+" ]"}if(wt(Z)){var Ms=Pe(Z,gr);return!("cause"in Error.prototype)&&"cause"in Z&&!Fe.call(Z,"cause")?"{ ["+String(Z)+"] "+K.call(V.call("[cause]: "+gr(Z.cause),Ms),", ")+" }":Ms.length===0?"["+String(Z)+"]":"{ ["+String(Z)+"] "+K.call(Ms,", ")+" }"}if(typeof Z=="object"&&Yr){if(Xe&&typeof Z[Xe]=="function"&&At)return At(Z,{depth:Ts-_e});if(Yr!=="symbol"&&typeof Z.inspect=="function")return Z.inspect()}if(dt(Z)){var $o=[];return k&&k.call(Z,function(Fn,Wi){$o.push(gr(Wi,Z,!0)+" => "+gr(Fn,Z))}),hi("Map",x.call(Z),$o,Ln)}if(bn(Z)){var Ho=[];return I&&I.call(Z,function(Fn){Ho.push(gr(Fn,Z))}),hi("Set",N.call(Z),Ho,Ln)}if(In(Z))return Rn("WeakMap");if(xn(Z))return Rn("WeakSet");if(ui(Z))return Rn("WeakRef");if(ht(Z))return Wr(gr(Number(Z)));if(Vr(Z))return Wr(gr(ge.call(Z)));if(Tr(Z))return Wr(te.call(Z));if($t(Z))return Wr(gr(String(Z)));if(!fr(Z)&&!Ne(Z)){var Fi=Pe(Z,gr),zo=at?at(Z)===Object.prototype:Z instanceof Object||Z.constructor===Object,ji=Z instanceof Object?"":"null prototype",Vi=!zo&&Ye&&Object(Z)===Z&&Ye in Z?U.call(dr(Z),8,-1):ji?"Object":"",Yl=zo||typeof Z.constructor!="function"?"":Z.constructor.name?Z.constructor.name+" ":"",Is=Yl+(Vi||ji?"["+K.call(V.call([],Vi||[],ji||[]),": ")+"] ":"");return Fi.length===0?Is+"{}":Ln?Is+"{"+Le(Fi,Ln)+"}":Is+"{ "+K.call(Fi,", ")+" }"}return String(Z)};function Ct($,Z,ze){var _e=(ze.quoteStyle||Z)==="double"?'"':"'";return _e+$+_e}function xt($){return re.call(String($),/"/g,""")}function Ot($){return dr($)==="[object Array]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function fr($){return dr($)==="[object Date]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function Ne($){return dr($)==="[object RegExp]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function wt($){return dr($)==="[object Error]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function $t($){return dr($)==="[object String]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function ht($){return dr($)==="[object Number]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function Tr($){return dr($)==="[object Boolean]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function hr($){if(Ve)return $&&typeof $=="object"&&$ instanceof Symbol;if(typeof $=="symbol")return!0;if(!$||typeof $!="object"||!$e)return!1;try{return $e.call($),!0}catch{}return!1}function Vr($){if(!$||typeof $!="object"||!ge)return!1;try{return ge.call($),!0}catch{}return!1}var Ri=Object.prototype.hasOwnProperty||function($){return $ in this};function Pr($,Z){return Ri.call($,Z)}function dr($){return se.call($)}function pr($){if($.name)return $.name;var Z=ee.call(R.call($),/^function\s*([\w$]+)/);return Z?Z[1]:null}function Kr($,Z){if($.indexOf)return $.indexOf(Z);for(var ze=0,_e=$.length;ze<_e;ze++)if($[ze]===Z)return ze;return-1}function dt($){if(!x||!$||typeof $!="object")return!1;try{x.call($);try{N.call($)}catch{return!0}return $ instanceof Map}catch{}return!1}function In($){if(!z||!$||typeof $!="object")return!1;try{z.call($,z);try{_.call($,_)}catch{return!0}return $ instanceof WeakMap}catch{}return!1}function ui($){if(!G||!$||typeof $!="object")return!1;try{return G.call($),!0}catch{}return!1}function bn($){if(!N||!$||typeof $!="object")return!1;try{N.call($);try{x.call($)}catch{return!0}return $ instanceof Set}catch{}return!1}function xn($){if(!_||!$||typeof $!="object")return!1;try{_.call($,_);try{z.call($,z)}catch{return!0}return $ instanceof WeakSet}catch{}return!1}function Dn($){return!$||typeof $!="object"?!1:typeof HTMLElement<"u"&&$ instanceof HTMLElement?!0:typeof $.nodeName=="string"&&typeof $.getAttribute=="function"}function fi($,Z){if($.length>Z.maxStringLength){var ze=$.length-Z.maxStringLength,_e="... "+ze+" more character"+(ze>1?"s":"");return fi(U.call($,0,Z.maxStringLength),Z)+_e}var lt=re.call(re.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Nn);return Ct(lt,"single",Z)}function Nn($){var Z=$.charCodeAt(0),ze={8:"b",9:"t",10:"n",12:"f",13:"r"}[Z];return ze?"\\"+ze:"\\x"+(Z<16?"0":"")+ne.call(Z.toString(16))}function Wr($){return"Object("+$+")"}function Rn($){return $+" { ? }"}function hi($,Z,ze,_e){var lt=_e?Le(ze,_e):K.call(ze,", ");return $+" ("+Z+") {"+lt+"}"}function Ze($){for(var Z=0;Z<$.length;Z++)if(Kr($[Z],`
|
|
411
|
+
`;function xb(r){const{scopes:e,id:t}=r;let n=[];try{n=JSON.parse((0,Ee.YQ)(`auth.${t}.scopes`))}catch{}return!e||!e.length?S.createElement(S.Fragment,null):S.createElement(ve.NI,null,S.createElement(ve.lX,null," Scopes: "),S.createElement(rI,{fieldName:`auth.${t}.scopes`,defaultValue:n,items:e,showControls:!0,trimItemsLength:!0}))}const sI=({token:r,loading:e,error:t})=>e?S.createElement(ve.GE,null,"Please, finish your authorization flow or cancel authorization."):t?S.createElement(VM,null,S.createElement(ve.Xq,null,t)):r?.access_token?null:S.createElement(ve.GE,null," No Access Token. Please, Authorize. ");var oI=Object.defineProperty,aI=Object.defineProperties,lI=Object.getOwnPropertyDescriptors,wb=Object.getOwnPropertySymbols,cI=Object.prototype.hasOwnProperty,uI=Object.prototype.propertyIsEnumerable,Sb=(r,e,t)=>e in r?oI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,zl=(r,e)=>{for(var t in e||(e={}))cI.call(e,t)&&Sb(r,t,e[t]);if(wb)for(var t of wb(e))uI.call(e,t)&&Sb(r,t,e[t]);return r},Uf=(r,e)=>aI(r,lI(e)),kb=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});const Ul=({usePkce:r,id:e,flow:t,tokenUrl:n,authCorsProxyUrl:i,tokenEndpointAuthMethod:s,server:o,scopes:a,authorizationUrl:l,defaultValues:c,clientId:u})=>{var h;const{oAuth2RedirectURI:d,routingBasePath:p}=(0,$r.Dv)(Wn.qd),{setValue:m,getValues:y,trigger:w,formState:A}=(0,gt.Gc)(),[T,P]=(0,S.useState)(null),[L,D]=(0,S.useState)(!1),[j,W]=(0,S.useState)(!1),[q,F]=(0,S.useState)(void 0),[H,Q]=(0,S.useState)(void 0),[oe,fe]=(0,S.useState)(void 0),be=((h=y("auth"))==null?void 0:h[e])||{},ke=A.errors||{},Re=q!==void 0&&H!==oe?{label:"sync",onClick:()=>{q&&Q(oe)}}:void 0;(0,S.useEffect)(()=>{if(r){const Wt=(0,gi.CY)(43);ad(Wt).then(_t=>{F(Wt),Q(_t),fe(_t)})}},[r]);const Se=Wt=>kb(void 0,null,function*(){if(!Wt||(yield w(),!(0,gi.Qr)(ke)))return;D(!0),P(null);const _t=i?i+(0,je.jg)(Wt):Wt,Or=i&&n?i+(0,je.jg)(n):n,oi=y(`auth.${e}.scopes`),ai={authorizationUrl:_t.startsWith("http")?_t:o+_t,clientId:be.client_id,scopes:oi,redirectUri:d,routingBasePath:p,successCallback:Er=>{m(`auth.${e}.token`,Er),D(!1),P(null)},errorCallback:Er=>{D(!1),P(Er?.message||"Failed to retrieve the access token")}};if(t==="implicit"&&Hr.authorizeImplicit(ai),!(0,je.xl)(s)){console.log(`Unsupported token endpoint auth method: ${s}`);return}t==="authorizationCode"&&Hr.authorizeAuthorizationCode(zl(Uf(zl({},ai),{tokenUrl:Or?.startsWith("http")?Or:o+Or,clientSecret:be.client_secret,extraHeaders:(0,je.Or)({authMethod:s,clientId:be.client_id,clientSecret:be.client_secret})}),r&&{codeVerifier:q,codeChallenge:H}))}),Oe=()=>{De(),P(null)},Te=()=>{D(!1),P(null),Hr.clearRedirectData(t)},De=()=>{m(`auth.${e}.token`,"")},bt=()=>{W(Wt=>!Wt)},Rt=Wt=>kb(void 0,[Wt],function*({target:{value:_t}}){const Or=yield ad(_t);F(_t),fe(Or)});if(!l)return S.createElement(ve.Xq,null,"No flow info");let ir=(0,Ee.YQ)(`auth.${e}.token`)||JSON.stringify(c?.token);ir=ir?JSON.parse(ir):"";const jr=(0,Ee.Al)(e,"client_id"),si={fieldName:`auth.${e}.client_id`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${e}.client_id`)||u||c?.client_id,placeholder:"Your OAuth2 app Client ID",rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement("div",null,S.createElement(ve.n5,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null," Client ID: "),jr?S.createElement(it.F0,Uf(zl({},si),{options:jr})):S.createElement(it.Xn,Uf(zl({},si),{"data-cy":"client-id-input",panel:"try-it"}))),t==="authorizationCode"&&S.createElement(S.Fragment,null,(!r?.hideClientSecretInput||!r)&&S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client Secret:"),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${e}.client_secret`,defaultValue:(0,Ee.YQ)(`auth.${e}.client_secret`)||c?.client_secret,validateOnBlur:!0,validateOnChange:!0,panel:"try-it","data-cy":"client-secret-input"})),r&&!r.disableManualConfiguration&&S.createElement($M,null,S.createElement(bb,{id:"pkce-opitons-toggle",label:"Configure PKCE manually",checked:j,onChange:bt,"data-cy":"pkce-options-toggle"}),j&&S.createElement(HM,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Code Verifier"),S.createElement(it.nv,{fullWidth:!0,value:q,onChange:Rt,panel:"try-it","data-cy":"code-verifier-input"})),S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Code Challenge"),S.createElement(it.nv,{fullWidth:!0,value:H,onChange:({target:{value:Wt}})=>{Q(Wt)},inputActionButton:Re,panel:"try-it","data-cy":"code-challenge-input"}))))),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${e}.token`,type:"hidden",defaultValue:ir,panel:"try-it"}),S.createElement(xb,{id:e,scopes:a}),be.token&&be.token.access_token?S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token: "),S.createElement(it.nv,{disabled:!0,type:"password",fullWidth:!0,value:be.token.access_token,panel:"try-it"})):null),S.createElement(WM,null,be.token&&be.token.access_token?S.createElement(pt.Button,{fullWidth:!0,onClick:Oe},"Log out"):L?S.createElement(S.Fragment,null,S.createElement(pt.Button,{fullWidth:!0,onClick:Te},"Cancel"),S.createElement(mb,null)):S.createElement(pt.Button,{fullWidth:!0,disabled:!(0,gi.Qr)(ke),onClick:()=>{Se(l)}},"Authorize")),L||T||!be.token||!be.token.access_token&&S.createElement(sI,{loading:L,error:T,token:be.token}))};var fI=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function hI(r){var e,t;const{scheme:n,defaultValues:i}=r,[s,o]=(0,S.useState)({}),[a,l]=(0,S.useState)(),[c,u]=(0,S.useState)(!1);(0,S.useEffect)(()=>{h(n.openIdConnectUrl)},[n.openIdConnectUrl]);const h=d=>fI(this,null,function*(){u(!0),l("");try{const p=yield FM(d);o(p)}catch(p){l(p.message)}u(!1)});return c?S.createElement(dI,null):a?S.createElement(Ab,{message:a}):S.createElement("div",null,S.createElement("div",null,(e=s?.response_types_supported)!=null&&e.includes("token")?S.createElement(S.Fragment,null,S.createElement(Mr.S6,null,"OAuth2 Implicit Flow"),S.createElement(Ul,{key:r.id,authorizationUrl:s.authorization_endpoint,authCorsProxyUrl:r.authCorsProxyUrl,scopes:s.scopes_supported,server:r.server,id:r.id,clientId:r.clientId,flow:"implicit",defaultValues:i})):(t=s?.response_types_supported)!=null&&t.includes("code")?S.createElement(S.Fragment,null,S.createElement(Mr.S6,null,"OAuth2 Authorization Flow"),S.createElement(Ul,{key:r.id,authorizationUrl:s.authorization_endpoint,tokenUrl:s.token_endpoint,authCorsProxyUrl:r.authCorsProxyUrl,scopes:s.scopes_supported,server:r.server,id:r.id,clientId:r.clientId,tokenEndpointAuthMethod:s?.token_endpoint_auth_methods_supported,flow:"authorizationCode",defaultValues:i})):S.createElement("div",null,"Unsupported flow")))}function dI(){return S.createElement("div",null,S.createElement("div",null,S.createElement("div",null,"Fetching OpenID Connect metadata..."),S.createElement(mb,null)))}function Ab({message:r}){return S.createElement("div",null,S.createElement("div",null,S.createElement(ve.Xq,null,r)))}var pI=Object.defineProperty,gI=Object.defineProperties,mI=Object.getOwnPropertyDescriptors,Cb=Object.getOwnPropertySymbols,vI=Object.prototype.hasOwnProperty,yI=Object.prototype.propertyIsEnumerable,Ob=(r,e,t)=>e in r?pI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Eb=(r,e)=>{for(var t in e||(e={}))vI.call(e,t)&&Ob(r,t,e[t]);if(Cb)for(var t of Cb(e))yI.call(e,t)&&Ob(r,t,e[t]);return r},Tb=(r,e)=>gI(r,mI(e)),bI=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function xI(r){if(!r)return"Token is required"}const wI=({id:r,server:e,flow:t,authCorsProxyUrl:n,defaultValues:i,clientId:s})=>{var o,a;const{setValue:l,watch:c,formState:u}=(0,gt.Gc)(),[h,d]=(0,S.useState)(""),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!0),A=((o=c("auth"))==null?void 0:o[r])||{},T=((a=u.errors)==null?void 0:a.auth)||{},P=()=>{l(`auth.${r}.token`,""),(0,Ee.WW)(`auth.${r}.token`,"")},L=()=>{w(H=>!H)},D=()=>bI(void 0,null,function*(){if(p)return;const H=n&&t.tokenUrl?n+(0,je.jg)(t.tokenUrl):t.tokenUrl;if(T.client_id||T.client_secret){console.log("Provide client_id and client_secret");return}const Q=A.client_id,oe=A.client_secret;if(!Q||!oe){console.log("Provide client_id and client_secret");return}m(!0);const fe=t["x-tokenEndpointAuthMethod"];if(!(0,je.xl)(fe)){console.log(`Unsupported token endpoint auth method: ${fe}`);return}yield Hr.authorizeClientCredentials({tokenUrl:H.startsWith("http")?H:e+H,clientId:Q,clientSecret:oe,scopes:A.scopes,extraHeaders:(0,je.Or)({authMethod:fe,clientId:Q,clientSecret:oe}),successCallback:be=>{l(`auth.${r}.token`,be),m(!1)},errorCallback:be=>{P(),d(be.message),m(!1)}})}),j=Object.keys(t.scopes);let W=(0,Ee.YQ)(`auth.${r}.token`)||JSON.stringify(i?.token);W=W?JSON.parse(W):"";const q=(0,Ee.Al)(r,"client_id"),F={fieldName:`auth.${r}.client_id`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${r}.client_id`)||s||i?.client_id,placeholder:"Your OAuth2 app Client ID"};return S.createElement(S.Fragment,null,S.createElement(ve.n5,null,S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client ID:"),q?S.createElement(it.F0,Tb(Eb({},F),{options:q})):S.createElement(it.Xn,Tb(Eb({},F),{type:"password",panel:"try-it"}))),S.createElement(ve.NI,null,S.createElement(ve.lX,null,"Client Secret:"),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${r}.client_secret`,defaultValue:(0,Ee.YQ)(`auth.${r}.client_secret`)||i?.client_secret,panel:"try-it"})),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${r}.token`,type:"hidden",defaultValue:W,rules:{validate:xI}}),S.createElement(xb,{id:r,scopes:j})),S.createElement(pt.Button,{color:"primary",onClick:D,blinking:p},p?"Loading...":"Request Token"),S.createElement(ve.ph,null," Access Token "),h?S.createElement(ve.Xq,{style:{marginBottom:"1em"}},"Failed to request token: ",S.createElement("pre",null,h)," "):A.token&&A.token.access_token?S.createElement(ve.TR,null,S.createElement(ve.WA,{length:A.token.access_token.length,masked:y},A.token.access_token),S.createElement(ve.lf,{onClick:L},y?"Show":"Hide"," "),S.createElement(ve.h,{onClick:P}," Clear ")):S.createElement(ve.Xq,{style:{marginBottom:"1em"}},"No token"))};var SI=Object.defineProperty,kI=Object.defineProperties,AI=Object.getOwnPropertyDescriptors,Pb=Object.getOwnPropertySymbols,CI=Object.prototype.hasOwnProperty,OI=Object.prototype.propertyIsEnumerable,Mb=(r,e,t)=>e in r?SI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Cs=(r,e)=>{for(var t in e||(e={}))CI.call(e,t)&&Mb(r,t,e[t]);if(Pb)for(var t of Pb(e))OI.call(e,t)&&Mb(r,t,e[t]);return r},Os=(r,e)=>kI(r,AI(e));const EI=({securityDefaults:r,operation:e,activeServer:t,authCorsProxyUrl:n})=>{var i,s;const{control:o,setValue:a,watch:l}=(0,gt.Gc)(),{parser:c}=(0,$r.Dv)(Wn.eG),u=e.security,h=(0,S.useMemo)(()=>u.map(P=>P.schemes.map(L=>L.id).join(" and ")).filter(Boolean),[u]),d=l("securityScheme"),p=(0,S.useMemo)(()=>{const P=h.findIndex(L=>L===d);return P<0?0:P},[h,d]);(0,S.useEffect)(()=>{const P=(0,Ee.YQ)("securityRequirementName"),L=h.findIndex(D=>D===P);a("securityScheme",h[L<0?0:L])},[h,e,a]);const m=(0,S.useCallback)(P=>{a("securityScheme",P.value),(0,Ee.WW)("securityRequirementName",P.value)},[a]),y=(0,S.useMemo)(()=>h.map((P,L)=>({value:P,idx:L})),[h]);if(y.length===0)return S.createElement(Ab,{message:"Cannot find security schema in the definition"});const w=u[p],A=(0,Ee.A8)(w.schemes[0].id),T=l(`auth.${A}`);return S.createElement(S.Fragment,null,S.createElement(ve.n5,null,y.length>1&&S.createElement(ve.NI,null,S.createElement(ve.lX,null," Security scheme: "),S.createElement(gt.Qr,{control:o,name:"securityScheme",render:({field:{value:P}})=>S.createElement(Mr.VD,{variant:"dark",fullWidth:!0,options:y,value:P,onChange:m})}))||null,S.createElement(pt.TryItSecurityApps,{apiId:(s=(i=c?.definition.info)==null?void 0:i["x-metadata"])==null?void 0:s.apiId,value:T,onChange:P=>{a(`auth.${A}`,P)}}),w.schemes.map(P=>{var L,D,j,W,q,F;const H=(0,Ee.A8)(P.id);if(P.type==="apiKey"){const Q=(0,Ee.Al)(H,""),oe={fieldName:`auth.${H}`,fullWidth:!0,defaultValue:(0,je.NG)(P)||(0,Ee.YQ)(`auth.${H}`)||r?.[H],rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(ve.NI,{key:H},S.createElement(ve.lX,null," ",P.name,": "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{type:"password",panel:"try-it","data-cy":"apiKey-auth-password"})))}else if(P.type==="http"){if(P.scheme==="basic"){const Q=(0,Ee.Al)(H,"username"),oe={fieldName:`auth.${H}.username`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${H}.username`)||((L=r?.[H])==null?void 0:L.username),validate:je.np,rules:{required:!0}};return S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," ",(0,Fs.l)("tryItAuthBasicUsername"),": "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{panel:"try-it"}))),S.createElement(ve.NI,null,S.createElement(ve.lX,null," ",(0,Fs.l)("tryItAuthBasicPassword"),": "),S.createElement(it.Xn,{type:"password","data-cy":"http-auth-password",fullWidth:!0,fieldName:`auth.${H}.password`,defaultValue:(0,Ee.YQ)(`auth.${H}.password`)||((D=r?.[H])==null?void 0:D.password)||"",validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(P.scheme==="bearer"){const Q=(0,Ee.Al)(H,""),oe={fieldName:`auth.${H}`,fullWidth:!0,defaultValue:(0,Ee.YQ)(`auth.${H}`)||r?.[H],rules:{validate:je.np},validateOnBlur:!0,validateOnChange:!0};return S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," Bearer Token: "),Q?S.createElement(it.F0,Os(Cs({},oe),{options:Q})):S.createElement(it.Xn,Os(Cs({},oe),{type:"password",placeholder:"(without 'Bearer')",panel:"try-it"}))))}}else{if(P.type==="oauth2"&&P.flows&&P.flows.clientCredentials)return S.createElement(wI,{key:H,flow:P.flows.clientCredentials,server:t,authCorsProxyUrl:n,id:H,clientId:P.flows.clientCredentials["x-defaultClientId"]||P["x-defaultClientId"],defaultValues:r?.[H]});if(P.type==="oauth2"&&P.flows&&P.flows.implicit)return S.createElement(Ul,{key:H,authorizationUrl:P.flows.implicit.authorizationUrl,authCorsProxyUrl:n,scopes:Object.keys(((W=(j=P?.flows)==null?void 0:j.implicit)==null?void 0:W.scopes)||{}),server:t,id:H,clientId:P.flows.implicit["x-defaultClientId"]||P["x-defaultClientId"],flow:"implicit",defaultValues:r?.[H]});if(P.type==="oauth2"&&P.flows&&P.flows.authorizationCode)return S.createElement(Ul,{key:H,authorizationUrl:P.flows.authorizationCode.authorizationUrl,tokenUrl:P.flows.authorizationCode.tokenUrl,authCorsProxyUrl:n,scopes:Object.keys(((q=P.flows.authorizationCode)==null?void 0:q.scopes)||{}),server:t,id:H,clientId:P.flows.authorizationCode["x-defaultClientId"]||P["x-defaultClientId"],flow:"authorizationCode",tokenEndpointAuthMethod:P.flows.authorizationCode["x-tokenEndpointAuthMethod"],usePkce:P.flows.authorizationCode["x-usePkce"],defaultValues:r?.[H]});if(P.type==="oauth2"){let Q=(0,Ee.YQ)(`auth.${H}.token`)||JSON.stringify((F=r?.[H])==null?void 0:F.token);return Q=Q?JSON.parse(Q):{},S.createElement(S.Fragment,{key:H},S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token Type: "),S.createElement(it.Xn,{fullWidth:!0,fieldName:`auth.${H}.token.token_type`,defaultValue:Q.token_type||"Bearer",panel:"try-it"})),S.createElement(ve.NI,null,S.createElement(ve.lX,null," Access Token: "),S.createElement(it.Xn,{type:"password",fullWidth:!0,fieldName:`auth.${H}.token.access_token`,rules:{validate:je.np},defaultValue:Q.access_token,validateOnBlur:!0,validateOnChange:!0,panel:"try-it"})))}else if(P.type==="openIdConnect")return S.createElement(hI,{key:H,server:t,authCorsProxyUrl:n,id:H,scheme:P,clientId:P["x-defaultClientId"],defaultValues:r?.[H]})}})),S.createElement("small",null,S.createElement("strong",null,"Note"),": Your credentials will be saved until the end of the browser session"))};var TI=f(55919);function PI({operation:r,properties:e,mergeExampleBody:t,securityDefaults:n,resolvedRawSpec:i,server:s,onServerChange:o}){const{watch:a,formState:l}=(0,gt.Gc)(),c=l.errors||{},u=!!(c.path||c.cookie||c.header||c.query),{hooks:h,authCorsProxyUrl:d}=(0,$r.Dv)(Wn.qd),p=i&&Ee.IB.get(i,r.pointer),m=a();let y=m&&m.auth&&Object.keys(m.auth)[0];(!y||!m.auth[y])&&(y=void 0),y&&(m.auth[y].token!==void 0||m.auth[y].client_id!==void 0||m.auth[y].client_secret!==void 0)&&(!m.auth[y].token||!m.auth[y].token.access_token)&&(y=void 0),y&&m.auth[y].username!=null&&(!m.auth[y].username||!m.auth[y].password)&&(y=void 0);const w=r.parameters||[];return!i&&S.createElement(S.Fragment,null,"Loading...")||S.createElement("form",{style:{flex:1,display:"flex",flexDirection:"column",margin:0}},S.createElement(tS,{operation:r,onChange:o}),S.createElement(ea.UQ,{initialActiveIdx:r.security.length&&y?1:0},r.security.length&&S.createElement(fc,{header:(0,Fs.l)("tryItAuth"),"data-cy":"security-trigger",error:!y&&!!c.auth,success:!!y,renderChildrenHidden:!0},pt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel?S.createElement(MI,{fieldName:"auth",validate:je.np},A=>S.createElement(TI.Q,{Hook:pt.OpenApiTryItSecurityPanel||h?.ReplaceTryItSecurityPanel,props:{server:s,operation:r,onChange:A,OAuth2:Hr}})):S.createElement(EI,{operation:r,activeServer:s.url,authCorsProxyUrl:d,securityDefaults:n}))||null,r.requestBody&&S.createElement(fc,{header:(0,Fs.l)("tryItBody"),"data-cy":"body-trigger",error:!!c.body,renderChildrenHidden:!0},S.createElement(kM,{validate:II,body:r.requestBody,pointer:r.pointer,id:r.id,resolvedBody:p?.requestBody,properties:e,mergeExampleBody:t}))||null,w.length&&S.createElement(fc,{header:(0,Fs.l)("tryItParameters"),"data-cy":"parameters-trigger",error:u,renderChildrenHidden:!0},S.createElement(LM,{operation:r,values:m}))||null))}function MI({fieldName:r,validate:e,children:t}){const{control:n,setValue:i}=(0,gt.Gc)();return S.createElement(gt.Qr,{control:n,name:r,rules:{validate:e},render:()=>t(i)})}function II(){}const DI=(0,S.memo)(PI);function NI({shaking:r,className:e,children:t,rootElement:n}){const[i]=(0,zf.Bs)(n),s=(0,$r.Dv)(Wn.qd);return S.createElement(Mr.q2,{scrollYOffset:s.scrollYOffset,shaking:r,className:e,"data-cy":"console",fullWidth:i?.width},t)}const RI=(0,S.memo)(NI);var LI=Object.defineProperty,BI=Object.defineProperties,FI=Object.getOwnPropertyDescriptors,Ib=Object.getOwnPropertySymbols,jI=Object.prototype.hasOwnProperty,VI=Object.prototype.propertyIsEnumerable,Db=(r,e,t)=>e in r?LI(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,It=(r,e)=>{for(var t in e||(e={}))jI.call(e,t)&&Db(r,t,e[t]);if(Ib)for(var t of Ib(e))VI.call(e,t)&&Db(r,t,e[t]);return r},Cr=(r,e)=>BI(r,FI(e)),Nb=(r,e,t)=>new Promise((n,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(r,e)).next())});function Rb(r){return r.startsWith("//")?"https:"+r:r}function WI({operation:r,onResponse:e,className:t,rootElement:n,properties:i,mergeExampleBody:s,securityDefaults:o,onClose:a}){const l=(0,gt.cI)({defaultValues:{path:(0,je.ZS)(r.parameters,"path"),cookie:(0,je.ZS)(r.parameters,"cookie"),header:(0,je.ZS)(r.parameters,"header"),query:(0,je.ZS)(r.parameters,"query")}}),[{activeServer:c},u]=(0,$r.KO)((0,dc.N)(r.pointer)),[h,d]=(0,S.useState)(0),[p,m]=(0,S.useState)(!1),[y,w]=(0,S.useState)(!1),[A,T]=(0,S.useState)(),[P,L]=(0,S.useState)(),[D,j]=(0,S.useState)(),[W,q]=(0,S.useState)(),F=(0,zf.D9)(r),{parser:H,options:Q}=(0,$r.Dv)(Wn.eG);(0,S.useEffect)(()=>{const{unsubscribe:Se}=l.watch((Oe={})=>{u(Te=>Cr(It({},Te),{requestValues:JSON.parse(JSON.stringify(Oe))})),(0,je.Hc)(Cr(It({},Oe),{query:(0,je.FU)(Oe.query||{})}))});return()=>Se()},[l,u]);const oe=(0,S.useCallback)(Se=>{d(Se)},[]),fe=(0,S.useCallback)(Se=>{u(Oe=>Cr(It({},Oe),{activeServer:Se})),l.setValue("server",Se)},[u,l]),be=l.handleSubmit(Se=>Nb(this,null,function*(){var Oe,Te,De,bt,Rt,ir,jr,si,Wt,_t,Or,oi,ai;const{servers:Er,requestBody:vn}=r,Gl=vn&&vn.content&&((Oe=(0,Xr.getActiveMediaType)(vn.content))==null?void 0:Oe.name)||"";let li=Se.body;if(/json/.test(Gl))try{li=JSON.parse(li)}catch(Ke){console.error(Ke)}m(!0);const sr=A,Es=(r.httpVerb||"").toLowerCase();if(!Er)throw console.error("Servers are not specified in your OpenAPI file. You can't use Try It Out console without specifying servers. If you use OpenAPI 2, make sure you configured host and basepath"),new Error("Servers are not specified");const Gf=Er.find(Ke=>c?.url.endsWith(Ke.url.endsWith("/")?Ke.url.substring(0,Ke.url.length-1):Ke.url)),HI=Date.now();let Mn,ci=Se.auth;if(ci){const Ke=Object.keys(ci)[0],yn=(0,Sw.dw)(Ke);Mn=Cr(It({},sr),{components:Cr(It({},sr?.components),{securitySchemes:Cr(It({},(Te=sr?.components)==null?void 0:Te.securitySchemes),{[yn]:Cr(It({},(bt=(De=sr?.components)==null?void 0:De.securitySchemes)==null?void 0:bt[yn]),{type:((jr=(ir=(Rt=sr?.components)==null?void 0:Rt.securitySchemes)==null?void 0:ir[yn])==null?void 0:jr.type)==="openIdConnect"?"oauth2":((Wt=(si=sr?.components)==null?void 0:si.securitySchemes)==null?void 0:Wt[yn]).type})})})}),ci=Cr(It({},ci),{[yn]:ci[Ke]})}else Mn=It({},sr);Mn.servers=Er;const Kl=Q.corsProxyUrl;Kl&&Er.length&&(Mn.servers=Er.map(Ke=>Cr(It({},Ke),{url:Kl+Rb(Ke.url)})),Mn.paths=Cr(It({},Mn.paths),{[r.path]:Cr(It({},Mn.paths[r.path]),{[Es]:Cr(It({},Mn.paths[r.path][Es]),{servers:void 0}),servers:void 0})}));const Kf=vn?.content&&((_t=(0,Xr.getActiveMediaType)(vn.content))==null?void 0:_t.name)||null;if(Kf&&li&&ta(Kf)){const Ke=Object.values(li);li=Ke.length>1?Ke:Ke[0]}const zI=(0,je.FU)(Se.query||{}),Yf={server:Kl?Kl+Rb(Gf.url):Gf.url,serverVariables:(0,je.mj)(Gf),spec:Mn,pathName:r.path,method:r.httpVerb,parameters:It(It(It(It({},Se.path),zI),Se.header),Se.cookie),securities:{authorized:ci},requestBody:li,requestContentType:Kf,responseContentType:((Or=Se.header)==null?void 0:Or.Accept)||null,requestInterceptor:(0,je.Tz)(Q,r,ci?.Authorization)};try{const Ke=yield nw(Yf),yn=Ke?.data;yn instanceof Blob&&(ta(yn.type)&&(Ke.fileInfo={rawData:yn,fileName:(0,je.AM)(Ke.headers)}),Ke.data=yield yn.text()),e?.({request:Yf,response:Ke}),q(Ke),j(void 0)}catch(Ke){Ke&&Ke.response&&Ke.response.data instanceof Blob&&(Ke.response.data=yield Ke.response.data.text(),e?.({request:Yf,response:Ke.response})),q(void 0),j(Ke)}finally{m(!1),d(1),L(Date.now()-HI),(ai=(oi=Q.events)==null?void 0:oi.tryItSent)==null||ai.call(oi,{eventType:lc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"Sent",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})}}),()=>{var Se,Oe;w(!0),setTimeout(()=>w(!1),1e3),(Oe=(Se=Q.events)==null?void 0:Se.tryItSent)==null||Oe.call(Se,{eventType:lc.nQ.TryItSent,resource:"Redocly_OperationTryIt",action:"ValidationFailed",operationId:r.operationId,operationPath:r.path,operationHttpVerb:r.httpVerb,operationSummary:r.description})});(0,pt.useMount)(()=>Nb(this,null,function*(){const Se=yield ww(r,H.definition);T(Se),r.activeServer&&!c&&u(Oe=>Cr(It({},Oe),{activeServer:r.activeServer}))})),(0,S.useEffect)(()=>{F&&F!==r&&(q(void 0),j(void 0),d(0))},[r,F]);const ke=!!(W||D),Re=l.getValues();return S.createElement(gt.RV,It({},l),S.createElement(RI,{shaking:y,className:t,rootElement:n},S.createElement(ea.Hc,null,S.createElement(Lw,{active:h,hasResponse:ke,onChange:oe}),a&&S.createElement(Mr.PZ,{onClick:a}," \u2715 ")),S.createElement(Mr.RE,{hidden:h!==0,"data-cy":"console-request-body"},S.createElement(DI,{operation:r,properties:i,mergeExampleBody:s,securityDefaults:o,resolvedRawSpec:A,server:c||r.activeServer,onServerChange:fe})),S.createElement(Mr.RE,{hidden:h!==1,"data-cy":"console-response-body"},S.createElement(Nw,{response:W,error:D,time:P})),S.createElement(Vw,{hasResponse:ke,params:Re,operation:r,loading:p,onSubmit:be})))}const $I=(0,S.memo)(WI)},85208:(v,C,f)=>{var g=f(34440),b=f(84108),x=f(61085),k=f(77706),O=f(8636);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},81998:(v,C,f)=>{var g=f(90266),b=f(42875),x=f(45828),k=f(24115),O=f(67690);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},72887:(v,C,f)=>{var g=f(65234),b=f(83250),x=g(b,"Map");v.exports=x},95678:(v,C,f)=>{var g=f(39016),b=f(62363),x=f(64348),k=f(53062),O=f(30262);function E(N){var I=-1,B=N==null?0:N.length;for(this.clear();++I<B;){var z=N[I];this.set(z[0],z[1])}}E.prototype.clear=g,E.prototype.delete=b,E.prototype.get=x,E.prototype.has=k,E.prototype.set=O,v.exports=E},70861:(v,C,f)=>{var g=f(83250),b=g.Symbol;v.exports=b},29233:v=>{function C(f,g){for(var b=-1,x=f==null?0:f.length,k=Array(x);++b<x;)k[b]=g(f[b],b,f);return k}v.exports=C},18498:(v,C,f)=>{var g=f(58260);function b(x,k){for(var O=x.length;O--;)if(g(x[O][0],k))return O;return-1}v.exports=b},40548:(v,C,f)=>{var g=f(24007),b=f(86040);function x(k,O){O=g(O,k);for(var E=0,N=O.length;k!=null&&E<N;)k=k[b(O[E++])];return E&&E==N?k:void 0}v.exports=x},69823:(v,C,f)=>{var g=f(70861),b=f(91339),x=f(25151),k="[object Null]",O="[object Undefined]",E=g?g.toStringTag:void 0;function N(I){return I==null?I===void 0?O:k:E&&E in Object(I)?b(I):x(I)}v.exports=N},99817:(v,C,f)=>{var g=f(45563),b=f(28597),x=f(93702),k=f(55784),O=/[\\^$.*+?()[\]{}|]/g,E=/^\[object .+?Constructor\]$/,N=Function.prototype,I=Object.prototype,B=N.toString,z=I.hasOwnProperty,Y=RegExp("^"+B.call(z).replace(O,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function _(X){if(!x(X)||b(X))return!1;var G=g(X)?Y:E;return G.test(k(X))}v.exports=_},86245:(v,C,f)=>{var g=f(70861),b=f(29233),x=f(55589),k=f(52624),O=1/0,E=g?g.prototype:void 0,N=E?E.toString:void 0;function I(B){if(typeof B=="string")return B;if(x(B))return b(B,I)+"";if(k(B))return N?N.call(B):"";var z=B+"";return z=="0"&&1/B==-O?"-0":z}v.exports=I},24007:(v,C,f)=>{var g=f(55589),b=f(5130),x=f(44041),k=f(99835);function O(E,N){return g(E)?E:b(E,N)?[E]:x(k(E))}v.exports=O},1622:(v,C,f)=>{var g=f(83250),b=g["__core-js_shared__"];v.exports=b},20302:(v,C,f)=>{var g=typeof f.g=="object"&&f.g&&f.g.Object===Object&&f.g;v.exports=g},77570:(v,C,f)=>{var g=f(58949);function b(x,k){var O=x.__data__;return g(k)?O[typeof k=="string"?"string":"hash"]:O.map}v.exports=b},65234:(v,C,f)=>{var g=f(99817),b=f(67736);function x(k,O){var E=b(k,O);return g(E)?E:void 0}v.exports=x},91339:(v,C,f)=>{var g=f(70861),b=Object.prototype,x=b.hasOwnProperty,k=b.toString,O=g?g.toStringTag:void 0;function E(N){var I=x.call(N,O),B=N[O];try{N[O]=void 0;var z=!0}catch{}var Y=k.call(N);return z&&(I?N[O]=B:delete N[O]),Y}v.exports=E},67736:v=>{function C(f,g){return f?.[g]}v.exports=C},34440:(v,C,f)=>{var g=f(24545);function b(){this.__data__=g?g(null):{},this.size=0}v.exports=b},84108:v=>{function C(f){var g=this.has(f)&&delete this.__data__[f];return this.size-=g?1:0,g}v.exports=C},61085:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__",x=Object.prototype,k=x.hasOwnProperty;function O(E){var N=this.__data__;if(g){var I=N[E];return I===b?void 0:I}return k.call(N,E)?N[E]:void 0}v.exports=O},77706:(v,C,f)=>{var g=f(24545),b=Object.prototype,x=b.hasOwnProperty;function k(O){var E=this.__data__;return g?E[O]!==void 0:x.call(E,O)}v.exports=k},8636:(v,C,f)=>{var g=f(24545),b="__lodash_hash_undefined__";function x(k,O){var E=this.__data__;return this.size+=this.has(k)?0:1,E[k]=g&&O===void 0?b:O,this}v.exports=x},5130:(v,C,f)=>{var g=f(55589),b=f(52624),x=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,k=/^\w*$/;function O(E,N){if(g(E))return!1;var I=typeof E;return I=="number"||I=="symbol"||I=="boolean"||E==null||b(E)?!0:k.test(E)||!x.test(E)||N!=null&&E in Object(N)}v.exports=O},58949:v=>{function C(f){var g=typeof f;return g=="string"||g=="number"||g=="symbol"||g=="boolean"?f!=="__proto__":f===null}v.exports=C},28597:(v,C,f)=>{var g=f(1622),b=function(){var k=/[^.]+$/.exec(g&&g.keys&&g.keys.IE_PROTO||"");return k?"Symbol(src)_1."+k:""}();function x(k){return!!b&&b in k}v.exports=x},90266:v=>{function C(){this.__data__=[],this.size=0}v.exports=C},42875:(v,C,f)=>{var g=f(18498),b=Array.prototype,x=b.splice;function k(O){var E=this.__data__,N=g(E,O);if(N<0)return!1;var I=E.length-1;return N==I?E.pop():x.call(E,N,1),--this.size,!0}v.exports=k},45828:(v,C,f)=>{var g=f(18498);function b(x){var k=this.__data__,O=g(k,x);return O<0?void 0:k[O][1]}v.exports=b},24115:(v,C,f)=>{var g=f(18498);function b(x){return g(this.__data__,x)>-1}v.exports=b},67690:(v,C,f)=>{var g=f(18498);function b(x,k){var O=this.__data__,E=g(O,x);return E<0?(++this.size,O.push([x,k])):O[E][1]=k,this}v.exports=b},39016:(v,C,f)=>{var g=f(85208),b=f(81998),x=f(72887);function k(){this.size=0,this.__data__={hash:new g,map:new(x||b),string:new g}}v.exports=k},62363:(v,C,f)=>{var g=f(77570);function b(x){var k=g(this,x).delete(x);return this.size-=k?1:0,k}v.exports=b},64348:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).get(x)}v.exports=b},53062:(v,C,f)=>{var g=f(77570);function b(x){return g(this,x).has(x)}v.exports=b},30262:(v,C,f)=>{var g=f(77570);function b(x,k){var O=g(this,x),E=O.size;return O.set(x,k),this.size+=O.size==E?0:1,this}v.exports=b},32924:(v,C,f)=>{var g=f(67997),b=500;function x(k){var O=g(k,function(N){return E.size===b&&E.clear(),N}),E=O.cache;return O}v.exports=x},24545:(v,C,f)=>{var g=f(65234),b=g(Object,"create");v.exports=b},25151:v=>{var C=Object.prototype,f=C.toString;function g(b){return f.call(b)}v.exports=g},83250:(v,C,f)=>{var g=f(20302),b=typeof self=="object"&&self&&self.Object===Object&&self,x=g||b||Function("return this")();v.exports=x},44041:(v,C,f)=>{var g=f(32924),b=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,x=/\\(\\)?/g,k=g(function(O){var E=[];return O.charCodeAt(0)===46&&E.push(""),O.replace(b,function(N,I,B,z){E.push(B?z.replace(x,"$1"):I||N)}),E});v.exports=k},86040:(v,C,f)=>{var g=f(52624),b=1/0;function x(k){if(typeof k=="string"||g(k))return k;var O=k+"";return O=="0"&&1/k==-b?"-0":O}v.exports=x},55784:v=>{var C=Function.prototype,f=C.toString;function g(b){if(b!=null){try{return f.call(b)}catch{}try{return b+""}catch{}}return""}v.exports=g},58260:v=>{function C(f,g){return f===g||f!==f&&g!==g}v.exports=C},13546:(v,C,f)=>{var g=f(40548);function b(x,k,O){var E=x==null?void 0:g(x,k);return E===void 0?O:E}v.exports=b},55589:v=>{var C=Array.isArray;v.exports=C},45563:(v,C,f)=>{var g=f(69823),b=f(93702),x="[object AsyncFunction]",k="[object Function]",O="[object GeneratorFunction]",E="[object Proxy]";function N(I){if(!b(I))return!1;var B=g(I);return B==k||B==O||B==x||B==E}v.exports=N},93702:v=>{function C(f){var g=typeof f;return f!=null&&(g=="object"||g=="function")}v.exports=C},50440:v=>{function C(f){return f!=null&&typeof f=="object"}v.exports=C},52624:(v,C,f)=>{var g=f(69823),b=f(50440),x="[object Symbol]";function k(O){return typeof O=="symbol"||b(O)&&g(O)==x}v.exports=k},67997:(v,C,f)=>{var g=f(95678),b="Expected a function";function x(k,O){if(typeof k!="function"||O!=null&&typeof O!="function")throw new TypeError(b);var E=function(){var N=arguments,I=O?O.apply(this,N):N[0],B=E.cache;if(B.has(I))return B.get(I);var z=k.apply(this,N);return E.cache=B.set(I,z)||B,z};return E.cache=new(x.Cache||g),E}x.Cache=g,v.exports=x},99835:(v,C,f)=>{var g=f(86245);function b(x){return x==null?"":g(x)}v.exports=b},14927:(v,C,f)=>{var g=typeof Map=="function"&&Map.prototype,b=Object.getOwnPropertyDescriptor&&g?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,x=g&&b&&typeof b.get=="function"?b.get:null,k=g&&Map.prototype.forEach,O=typeof Set=="function"&&Set.prototype,E=Object.getOwnPropertyDescriptor&&O?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,N=O&&E&&typeof E.get=="function"?E.get:null,I=O&&Set.prototype.forEach,B=typeof WeakMap=="function"&&WeakMap.prototype,z=B?WeakMap.prototype.has:null,Y=typeof WeakSet=="function"&&WeakSet.prototype,_=Y?WeakSet.prototype.has:null,X=typeof WeakRef=="function"&&WeakRef.prototype,G=X?WeakRef.prototype.deref:null,te=Boolean.prototype.valueOf,se=Object.prototype.toString,R=Function.prototype.toString,ee=String.prototype.match,U=String.prototype.slice,re=String.prototype.replace,ne=String.prototype.toUpperCase,ae=String.prototype.toLowerCase,ce=RegExp.prototype.test,V=Array.prototype.concat,K=Array.prototype.join,le=Array.prototype.slice,pe=Math.floor,ge=typeof BigInt=="function"?BigInt.prototype.valueOf:null,me=Object.getOwnPropertySymbols,$e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,Ve=typeof Symbol=="function"&&typeof Symbol.iterator=="object",Ye=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===Ve||"symbol")?Symbol.toStringTag:null,Fe=Object.prototype.propertyIsEnumerable,at=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function($){return $.__proto__}:null);function Dt($,Z){if($===1/0||$===-1/0||$!==$||$&&$>-1e3&&$<1e3||ce.call(/e/,Z))return Z;var ze=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof $=="number"){var _e=$<0?-pe(-$):pe($);if(_e!==$){var lt=String(_e),Me=U.call(Z,lt.length+1);return re.call(lt,ze,"$&_")+"."+re.call(re.call(Me,/([0-9]{3})/g,"$&_"),/_$/,"")}}return re.call(Z,ze,"$&_")}var At=f(65710),qt=At.custom,Xe=hr(qt)?qt:null;v.exports=function $(Z,ze,_e,lt){var Me=ze||{};if(Pr(Me,"quoteStyle")&&Me.quoteStyle!=="single"&&Me.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(Pr(Me,"maxStringLength")&&(typeof Me.maxStringLength=="number"?Me.maxStringLength<0&&Me.maxStringLength!==1/0:Me.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Yr=Pr(Me,"customInspect")?Me.customInspect:!0;if(typeof Yr!="boolean"&&Yr!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(Pr(Me,"indent")&&Me.indent!==null&&Me.indent!==" "&&!(parseInt(Me.indent,10)===Me.indent&&Me.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(Pr(Me,"numericSeparator")&&typeof Me.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var wn=Me.numericSeparator;if(typeof Z>"u")return"undefined";if(Z===null)return"null";if(typeof Z=="boolean")return Z?"true":"false";if(typeof Z=="string")return fi(Z,Me);if(typeof Z=="number"){if(Z===0)return 1/0/Z>0?"0":"-0";var Ht=String(Z);return wn?Dt(Z,Ht):Ht}if(typeof Z=="bigint"){var Jr=String(Z)+"n";return wn?Dt(Z,Jr):Jr}var Ts=typeof Me.depth>"u"?5:Me.depth;if(typeof _e>"u"&&(_e=0),_e>=Ts&&Ts>0&&typeof Z=="object")return Ot(Z)?"[Array]":"[Object]";var Ln=Ce(Me,_e);if(typeof lt>"u")lt=[];else if(Kr(lt,Z)>=0)return"[Circular]";function gr(Fn,Wi,Uo){if(Wi&&(lt=le.call(lt),lt.push(Wi)),Uo){var Go={depth:Me.depth};return Pr(Me,"quoteStyle")&&(Go.quoteStyle=Me.quoteStyle),$(Fn,Go,_e+1,lt)}return $(Fn,Me,_e+1,lt)}if(typeof Z=="function"&&!Ne(Z)){var Vo=pr(Z),Wo=Pe(Z,gr);return"[Function"+(Vo?": "+Vo:" (anonymous)")+"]"+(Wo.length>0?" { "+K.call(Wo,", ")+" }":"")}if(hr(Z)){var Ps=Ve?re.call(String(Z),/^(Symbol\(.*\))_[^)]*$/,"$1"):$e.call(Z);return typeof Z=="object"&&!Ve?Wr(Ps):Ps}if(Dn(Z)){for(var Bn="<"+ae.call(String(Z.nodeName)),Li=Z.attributes||[],di=0;di<Li.length;di++)Bn+=" "+Li[di].name+"="+Ct(xt(Li[di].value),"double",Me);return Bn+=">",Z.childNodes&&Z.childNodes.length&&(Bn+="..."),Bn+="</"+ae.call(String(Z.nodeName))+">",Bn}if(Ot(Z)){if(Z.length===0)return"[]";var Bi=Pe(Z,gr);return Ln&&!Ze(Bi)?"["+Le(Bi,Ln)+"]":"[ "+K.call(Bi,", ")+" ]"}if(wt(Z)){var Ms=Pe(Z,gr);return!("cause"in Error.prototype)&&"cause"in Z&&!Fe.call(Z,"cause")?"{ ["+String(Z)+"] "+K.call(V.call("[cause]: "+gr(Z.cause),Ms),", ")+" }":Ms.length===0?"["+String(Z)+"]":"{ ["+String(Z)+"] "+K.call(Ms,", ")+" }"}if(typeof Z=="object"&&Yr){if(Xe&&typeof Z[Xe]=="function"&&At)return At(Z,{depth:Ts-_e});if(Yr!=="symbol"&&typeof Z.inspect=="function")return Z.inspect()}if(dt(Z)){var $o=[];return k&&k.call(Z,function(Fn,Wi){$o.push(gr(Wi,Z,!0)+" => "+gr(Fn,Z))}),hi("Map",x.call(Z),$o,Ln)}if(bn(Z)){var Ho=[];return I&&I.call(Z,function(Fn){Ho.push(gr(Fn,Z))}),hi("Set",N.call(Z),Ho,Ln)}if(In(Z))return Rn("WeakMap");if(xn(Z))return Rn("WeakSet");if(ui(Z))return Rn("WeakRef");if(ht(Z))return Wr(gr(Number(Z)));if(Vr(Z))return Wr(gr(ge.call(Z)));if(Tr(Z))return Wr(te.call(Z));if($t(Z))return Wr(gr(String(Z)));if(!fr(Z)&&!Ne(Z)){var Fi=Pe(Z,gr),zo=at?at(Z)===Object.prototype:Z instanceof Object||Z.constructor===Object,ji=Z instanceof Object?"":"null prototype",Vi=!zo&&Ye&&Object(Z)===Z&&Ye in Z?U.call(dr(Z),8,-1):ji?"Object":"",Yl=zo||typeof Z.constructor!="function"?"":Z.constructor.name?Z.constructor.name+" ":"",Is=Yl+(Vi||ji?"["+K.call(V.call([],Vi||[],ji||[]),": ")+"] ":"");return Fi.length===0?Is+"{}":Ln?Is+"{"+Le(Fi,Ln)+"}":Is+"{ "+K.call(Fi,", ")+" }"}return String(Z)};function Ct($,Z,ze){var _e=(ze.quoteStyle||Z)==="double"?'"':"'";return _e+$+_e}function xt($){return re.call(String($),/"/g,""")}function Ot($){return dr($)==="[object Array]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function fr($){return dr($)==="[object Date]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function Ne($){return dr($)==="[object RegExp]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function wt($){return dr($)==="[object Error]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function $t($){return dr($)==="[object String]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function ht($){return dr($)==="[object Number]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function Tr($){return dr($)==="[object Boolean]"&&(!Ye||!(typeof $=="object"&&Ye in $))}function hr($){if(Ve)return $&&typeof $=="object"&&$ instanceof Symbol;if(typeof $=="symbol")return!0;if(!$||typeof $!="object"||!$e)return!1;try{return $e.call($),!0}catch{}return!1}function Vr($){if(!$||typeof $!="object"||!ge)return!1;try{return ge.call($),!0}catch{}return!1}var Ri=Object.prototype.hasOwnProperty||function($){return $ in this};function Pr($,Z){return Ri.call($,Z)}function dr($){return se.call($)}function pr($){if($.name)return $.name;var Z=ee.call(R.call($),/^function\s*([\w$]+)/);return Z?Z[1]:null}function Kr($,Z){if($.indexOf)return $.indexOf(Z);for(var ze=0,_e=$.length;ze<_e;ze++)if($[ze]===Z)return ze;return-1}function dt($){if(!x||!$||typeof $!="object")return!1;try{x.call($);try{N.call($)}catch{return!0}return $ instanceof Map}catch{}return!1}function In($){if(!z||!$||typeof $!="object")return!1;try{z.call($,z);try{_.call($,_)}catch{return!0}return $ instanceof WeakMap}catch{}return!1}function ui($){if(!G||!$||typeof $!="object")return!1;try{return G.call($),!0}catch{}return!1}function bn($){if(!N||!$||typeof $!="object")return!1;try{N.call($);try{x.call($)}catch{return!0}return $ instanceof Set}catch{}return!1}function xn($){if(!_||!$||typeof $!="object")return!1;try{_.call($,_);try{z.call($,z)}catch{return!0}return $ instanceof WeakSet}catch{}return!1}function Dn($){return!$||typeof $!="object"?!1:typeof HTMLElement<"u"&&$ instanceof HTMLElement?!0:typeof $.nodeName=="string"&&typeof $.getAttribute=="function"}function fi($,Z){if($.length>Z.maxStringLength){var ze=$.length-Z.maxStringLength,_e="... "+ze+" more character"+(ze>1?"s":"");return fi(U.call($,0,Z.maxStringLength),Z)+_e}var lt=re.call(re.call($,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,Nn);return Ct(lt,"single",Z)}function Nn($){var Z=$.charCodeAt(0),ze={8:"b",9:"t",10:"n",12:"f",13:"r"}[Z];return ze?"\\"+ze:"\\x"+(Z<16?"0":"")+ne.call(Z.toString(16))}function Wr($){return"Object("+$+")"}function Rn($){return $+" { ? }"}function hi($,Z,ze,_e){var lt=_e?Le(ze,_e):K.call(ze,", ");return $+" ("+Z+") {"+lt+"}"}function Ze($){for(var Z=0;Z<$.length;Z++)if(Kr($[Z],`
|
|
413
412
|
`)>=0)return!1;return!0}function Ce($,Z){var ze;if($.indent===" ")ze=" ";else if(typeof $.indent=="number"&&$.indent>0)ze=K.call(Array($.indent+1)," ");else return null;return{base:ze,prev:K.call(Array(Z+1),ze)}}function Le($,Z){if($.length===0)return"";var ze=`
|
|
414
413
|
`+Z.prev+Z.base;return ze+K.call($,","+ze)+`
|
|
415
414
|
`+Z.prev}function Pe($,Z){var ze=Ot($),_e=[];if(ze){_e.length=$.length;for(var lt=0;lt<$.length;lt++)_e[lt]=Pr($,lt)?Z($[lt],$):""}var Me=typeof me=="function"?me($):[],Yr;if(Ve){Yr={};for(var wn=0;wn<Me.length;wn++)Yr["$"+Me[wn]]=Me[wn]}for(var Ht in $)Pr($,Ht)&&(ze&&String(Number(Ht))===Ht&&Ht<$.length||Ve&&Yr["$"+Ht]instanceof Symbol||(ce.call(/[^\w$]/,Ht)?_e.push(Z(Ht,$)+": "+Z($[Ht],$)):_e.push(Ht+": "+Z($[Ht],$))));if(typeof me=="function")for(var Jr=0;Jr<Me.length;Jr++)Fe.call($,Me[Jr])&&_e.push("["+Z(Me[Jr])+"]: "+Z($[Me[Jr]],$));return _e}},83949:v=>{"use strict";var C=String.prototype.replace,f=/%20/g,g={RFC1738:"RFC1738",RFC3986:"RFC3986"};v.exports={default:g.RFC3986,formatters:{RFC1738:function(b){return C.call(b,f,"+")},RFC3986:function(b){return String(b)}},RFC1738:g.RFC1738,RFC3986:g.RFC3986}},67905:(v,C,f)=>{"use strict";var g=f(85095),b=f(95990),x=f(83949);v.exports={formats:x,parse:b,stringify:g}},95990:(v,C,f)=>{"use strict";var g=f(37748),b=Object.prototype.hasOwnProperty,x=Array.isArray,k={allowDots:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:g.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},O=function(X){return X.replace(/&#(\d+);/g,function(G,te){return String.fromCharCode(parseInt(te,10))})},E=function(X,G){return X&&typeof X=="string"&&G.comma&&X.indexOf(",")>-1?X.split(","):X},N="utf8=%26%2310003%3B",I="utf8=%E2%9C%93",B=function(G,te){var se={__proto__:null},R=te.ignoreQueryPrefix?G.replace(/^\?/,""):G,ee=te.parameterLimit===1/0?void 0:te.parameterLimit,U=R.split(te.delimiter,ee),re=-1,ne,ae=te.charset;if(te.charsetSentinel)for(ne=0;ne<U.length;++ne)U[ne].indexOf("utf8=")===0&&(U[ne]===I?ae="utf-8":U[ne]===N&&(ae="iso-8859-1"),re=ne,ne=U.length);for(ne=0;ne<U.length;++ne)if(ne!==re){var ce=U[ne],V=ce.indexOf("]="),K=V===-1?ce.indexOf("="):V+1,le,pe;K===-1?(le=te.decoder(ce,k.decoder,ae,"key"),pe=te.strictNullHandling?null:""):(le=te.decoder(ce.slice(0,K),k.decoder,ae,"key"),pe=g.maybeMap(E(ce.slice(K+1),te),function(ge){return te.decoder(ge,k.decoder,ae,"value")})),pe&&te.interpretNumericEntities&&ae==="iso-8859-1"&&(pe=O(pe)),ce.indexOf("[]=")>-1&&(pe=x(pe)?[pe]:pe),b.call(se,le)?se[le]=g.combine(se[le],pe):se[le]=pe}return se},z=function(X,G,te,se){for(var R=se?G:E(G,te),ee=X.length-1;ee>=0;--ee){var U,re=X[ee];if(re==="[]"&&te.parseArrays)U=[].concat(R);else{U=te.plainObjects?Object.create(null):{};var ne=re.charAt(0)==="["&&re.charAt(re.length-1)==="]"?re.slice(1,-1):re,ae=parseInt(ne,10);!te.parseArrays&&ne===""?U={0:R}:!isNaN(ae)&&re!==ne&&String(ae)===ne&&ae>=0&&te.parseArrays&&ae<=te.arrayLimit?(U=[],U[ae]=R):ne!=="__proto__"&&(U[ne]=R)}R=U}return R},Y=function(G,te,se,R){if(G){var ee=se.allowDots?G.replace(/\.([^.[]+)/g,"[$1]"):G,U=/(\[[^[\]]*])/,re=/(\[[^[\]]*])/g,ne=se.depth>0&&U.exec(ee),ae=ne?ee.slice(0,ne.index):ee,ce=[];if(ae){if(!se.plainObjects&&b.call(Object.prototype,ae)&&!se.allowPrototypes)return;ce.push(ae)}for(var V=0;se.depth>0&&(ne=re.exec(ee))!==null&&V<se.depth;){if(V+=1,!se.plainObjects&&b.call(Object.prototype,ne[1].slice(1,-1))&&!se.allowPrototypes)return;ce.push(ne[1])}return ne&&ce.push("["+ee.slice(ne.index)+"]"),z(ce,te,se,R)}},_=function(G){if(!G)return k;if(G.decoder!==null&&G.decoder!==void 0&&typeof G.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof G.charset<"u"&&G.charset!=="utf-8"&&G.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var te=typeof G.charset>"u"?k.charset:G.charset;return{allowDots:typeof G.allowDots>"u"?k.allowDots:!!G.allowDots,allowPrototypes:typeof G.allowPrototypes=="boolean"?G.allowPrototypes:k.allowPrototypes,allowSparse:typeof G.allowSparse=="boolean"?G.allowSparse:k.allowSparse,arrayLimit:typeof G.arrayLimit=="number"?G.arrayLimit:k.arrayLimit,charset:te,charsetSentinel:typeof G.charsetSentinel=="boolean"?G.charsetSentinel:k.charsetSentinel,comma:typeof G.comma=="boolean"?G.comma:k.comma,decoder:typeof G.decoder=="function"?G.decoder:k.decoder,delimiter:typeof G.delimiter=="string"||g.isRegExp(G.delimiter)?G.delimiter:k.delimiter,depth:typeof G.depth=="number"||G.depth===!1?+G.depth:k.depth,ignoreQueryPrefix:G.ignoreQueryPrefix===!0,interpretNumericEntities:typeof G.interpretNumericEntities=="boolean"?G.interpretNumericEntities:k.interpretNumericEntities,parameterLimit:typeof G.parameterLimit=="number"?G.parameterLimit:k.parameterLimit,parseArrays:G.parseArrays!==!1,plainObjects:typeof G.plainObjects=="boolean"?G.plainObjects:k.plainObjects,strictNullHandling:typeof G.strictNullHandling=="boolean"?G.strictNullHandling:k.strictNullHandling}};v.exports=function(X,G){var te=_(G);if(X===""||X===null||typeof X>"u")return te.plainObjects?Object.create(null):{};for(var se=typeof X=="string"?B(X,te):X,R=te.plainObjects?Object.create(null):{},ee=Object.keys(se),U=0;U<ee.length;++U){var re=ee[U],ne=Y(re,se[re],te,typeof X=="string");R=g.merge(R,ne,te)}return te.allowSparse===!0?R:g.compact(R)}},85095:(v,C,f)=>{"use strict";var g=f(44852),b=f(37748),x=f(83949),k=Object.prototype.hasOwnProperty,O={brackets:function(R){return R+"[]"},comma:"comma",indices:function(R,ee){return R+"["+ee+"]"},repeat:function(R){return R}},E=Array.isArray,N=Array.prototype.push,I=function(se,R){N.apply(se,E(R)?R:[R])},B=Date.prototype.toISOString,z=x.default,Y={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:b.encode,encodeValuesOnly:!1,format:z,formatter:x.formatters[z],indices:!1,serializeDate:function(R){return B.call(R)},skipNulls:!1,strictNullHandling:!1},_=function(R){return typeof R=="string"||typeof R=="number"||typeof R=="boolean"||typeof R=="symbol"||typeof R=="bigint"},X={},G=function se(R,ee,U,re,ne,ae,ce,V,K,le,pe,ge,me,$e,Ve,Ye){for(var Fe=R,at=Ye,Dt=0,At=!1;(at=at.get(X))!==void 0&&!At;){var qt=at.get(R);if(Dt+=1,typeof qt<"u"){if(qt===Dt)throw new RangeError("Cyclic object value");At=!0}typeof at.get(X)>"u"&&(Dt=0)}if(typeof V=="function"?Fe=V(ee,Fe):Fe instanceof Date?Fe=pe(Fe):U==="comma"&&E(Fe)&&(Fe=b.maybeMap(Fe,function(hr){return hr instanceof Date?pe(hr):hr})),Fe===null){if(ne)return ce&&!$e?ce(ee,Y.encoder,Ve,"key",ge):ee;Fe=""}if(_(Fe)||b.isBuffer(Fe)){if(ce){var Xe=$e?ee:ce(ee,Y.encoder,Ve,"key",ge);return[me(Xe)+"="+me(ce(Fe,Y.encoder,Ve,"value",ge))]}return[me(ee)+"="+me(String(Fe))]}var Ct=[];if(typeof Fe>"u")return Ct;var xt;if(U==="comma"&&E(Fe))$e&&ce&&(Fe=b.maybeMap(Fe,ce)),xt=[{value:Fe.length>0?Fe.join(",")||null:void 0}];else if(E(V))xt=V;else{var Ot=Object.keys(Fe);xt=K?Ot.sort(K):Ot}for(var fr=re&&E(Fe)&&Fe.length===1?ee+"[]":ee,Ne=0;Ne<xt.length;++Ne){var wt=xt[Ne],$t=typeof wt=="object"&&typeof wt.value<"u"?wt.value:Fe[wt];if(!(ae&&$t===null)){var ht=E(Fe)?typeof U=="function"?U(fr,wt):fr:fr+(le?"."+wt:"["+wt+"]");Ye.set(R,Dt);var Tr=g();Tr.set(X,Ye),I(Ct,se($t,ht,U,re,ne,ae,U==="comma"&&$e&&E(Fe)?null:ce,V,K,le,pe,ge,me,$e,Ve,Tr))}}return Ct},te=function(R){if(!R)return Y;if(R.encoder!==null&&typeof R.encoder<"u"&&typeof R.encoder!="function")throw new TypeError("Encoder has to be a function.");var ee=R.charset||Y.charset;if(typeof R.charset<"u"&&R.charset!=="utf-8"&&R.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var U=x.default;if(typeof R.format<"u"){if(!k.call(x.formatters,R.format))throw new TypeError("Unknown format option provided.");U=R.format}var re=x.formatters[U],ne=Y.filter;return(typeof R.filter=="function"||E(R.filter))&&(ne=R.filter),{addQueryPrefix:typeof R.addQueryPrefix=="boolean"?R.addQueryPrefix:Y.addQueryPrefix,allowDots:typeof R.allowDots>"u"?Y.allowDots:!!R.allowDots,charset:ee,charsetSentinel:typeof R.charsetSentinel=="boolean"?R.charsetSentinel:Y.charsetSentinel,delimiter:typeof R.delimiter>"u"?Y.delimiter:R.delimiter,encode:typeof R.encode=="boolean"?R.encode:Y.encode,encoder:typeof R.encoder=="function"?R.encoder:Y.encoder,encodeValuesOnly:typeof R.encodeValuesOnly=="boolean"?R.encodeValuesOnly:Y.encodeValuesOnly,filter:ne,format:U,formatter:re,serializeDate:typeof R.serializeDate=="function"?R.serializeDate:Y.serializeDate,skipNulls:typeof R.skipNulls=="boolean"?R.skipNulls:Y.skipNulls,sort:typeof R.sort=="function"?R.sort:null,strictNullHandling:typeof R.strictNullHandling=="boolean"?R.strictNullHandling:Y.strictNullHandling}};v.exports=function(se,R){var ee=se,U=te(R),re,ne;typeof U.filter=="function"?(ne=U.filter,ee=ne("",ee)):E(U.filter)&&(ne=U.filter,re=ne);var ae=[];if(typeof ee!="object"||ee===null)return"";var ce;R&&R.arrayFormat in O?ce=R.arrayFormat:R&&"indices"in R?ce=R.indices?"indices":"repeat":ce="indices";var V=O[ce];if(R&&"commaRoundTrip"in R&&typeof R.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var K=V==="comma"&&R&&R.commaRoundTrip;re||(re=Object.keys(ee)),U.sort&&re.sort(U.sort);for(var le=g(),pe=0;pe<re.length;++pe){var ge=re[pe];U.skipNulls&&ee[ge]===null||I(ae,G(ee[ge],ge,V,K,U.strictNullHandling,U.skipNulls,U.encode?U.encoder:null,U.filter,U.sort,U.allowDots,U.serializeDate,U.format,U.formatter,U.encodeValuesOnly,U.charset,le))}var me=ae.join(U.delimiter),$e=U.addQueryPrefix===!0?"?":"";return U.charsetSentinel&&(U.charset==="iso-8859-1"?$e+="utf8=%26%2310003%3B&":$e+="utf8=%E2%9C%93&"),me.length>0?$e+me:""}},37748:(v,C,f)=>{"use strict";var g=f(83949),b=Object.prototype.hasOwnProperty,x=Array.isArray,k=function(){for(var se=[],R=0;R<256;++R)se.push("%"+((R<16?"0":"")+R.toString(16)).toUpperCase());return se}(),O=function(R){for(;R.length>1;){var ee=R.pop(),U=ee.obj[ee.prop];if(x(U)){for(var re=[],ne=0;ne<U.length;++ne)typeof U[ne]<"u"&&re.push(U[ne]);ee.obj[ee.prop]=re}}},E=function(R,ee){for(var U=ee&&ee.plainObjects?Object.create(null):{},re=0;re<R.length;++re)typeof R[re]<"u"&&(U[re]=R[re]);return U},N=function se(R,ee,U){if(!ee)return R;if(typeof ee!="object"){if(x(R))R.push(ee);else if(R&&typeof R=="object")(U&&(U.plainObjects||U.allowPrototypes)||!b.call(Object.prototype,ee))&&(R[ee]=!0);else return[R,ee];return R}if(!R||typeof R!="object")return[R].concat(ee);var re=R;return x(R)&&!x(ee)&&(re=E(R,U)),x(R)&&x(ee)?(ee.forEach(function(ne,ae){if(b.call(R,ae)){var ce=R[ae];ce&&typeof ce=="object"&&ne&&typeof ne=="object"?R[ae]=se(ce,ne,U):R.push(ne)}else R[ae]=ne}),R):Object.keys(ee).reduce(function(ne,ae){var ce=ee[ae];return b.call(ne,ae)?ne[ae]=se(ne[ae],ce,U):ne[ae]=ce,ne},re)},I=function(R,ee){return Object.keys(ee).reduce(function(U,re){return U[re]=ee[re],U},R)},B=function(se,R,ee){var U=se.replace(/\+/g," ");if(ee==="iso-8859-1")return U.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(U)}catch{return U}},z=function(R,ee,U,re,ne){if(R.length===0)return R;var ae=R;if(typeof R=="symbol"?ae=Symbol.prototype.toString.call(R):typeof R!="string"&&(ae=String(R)),U==="iso-8859-1")return escape(ae).replace(/%u[0-9a-f]{4}/gi,function(le){return"%26%23"+parseInt(le.slice(2),16)+"%3B"});for(var ce="",V=0;V<ae.length;++V){var K=ae.charCodeAt(V);if(K===45||K===46||K===95||K===126||K>=48&&K<=57||K>=65&&K<=90||K>=97&&K<=122||ne===g.RFC1738&&(K===40||K===41)){ce+=ae.charAt(V);continue}if(K<128){ce=ce+k[K];continue}if(K<2048){ce=ce+(k[192|K>>6]+k[128|K&63]);continue}if(K<55296||K>=57344){ce=ce+(k[224|K>>12]+k[128|K>>6&63]+k[128|K&63]);continue}V+=1,K=65536+((K&1023)<<10|ae.charCodeAt(V)&1023),ce+=k[240|K>>18]+k[128|K>>12&63]+k[128|K>>6&63]+k[128|K&63]}return ce},Y=function(R){for(var ee=[{obj:{o:R},prop:"o"}],U=[],re=0;re<ee.length;++re)for(var ne=ee[re],ae=ne.obj[ne.prop],ce=Object.keys(ae),V=0;V<ce.length;++V){var K=ce[V],le=ae[K];typeof le=="object"&&le!==null&&U.indexOf(le)===-1&&(ee.push({obj:ae,prop:K}),U.push(le))}return O(ee),R},_=function(R){return Object.prototype.toString.call(R)==="[object RegExp]"},X=function(R){return!R||typeof R!="object"?!1:!!(R.constructor&&R.constructor.isBuffer&&R.constructor.isBuffer(R))},G=function(R,ee){return[].concat(R,ee)},te=function(R,ee){if(x(R)){for(var U=[],re=0;re<R.length;re+=1)U.push(ee(R[re]));return U}return ee(R)};v.exports={arrayToObject:E,assign:I,combine:G,compact:Y,decode:B,encode:z,isBuffer:X,isRegExp:_,maybeMap:te,merge:N}},95472:(v,C,f)=>{"use strict";var g;/** @license React v17.0.2
|